Sound implementation notes

From LinuxMCE
Jump to: navigation, search

Some notes follow for Sound implementation in Orbiter:

Notes originally compiled by --Tschak909 04:53, 10 July 2010 (CEST)

Goals

  • Implement Play Sound and Stop Sound commands in Orbiter.
  • Implement Serialization changes needed to send sounds over the wire to non-OSD orbiters.
  • Implement Playback of serialized sounds.

Since Play Sound and Stop Sound are not used by Orbiter in any capacity, we can use this specifically for playback of fed back sound.

Tools needed for Implementation of Sound

  • libao - for sound output.
  • libaudiofile - for sound reading during orbitergen.
  • pure-data - used during sound development for creating the sound data.

Constraints of Sounds

  • Should at most be 1 second in length.
  • Should allow to be clipped, as operations can take less than .75 seconds.
  • Should allow for slight sample rate changes (to add some uniqueness)
  • Should only be in the 3kHz-5kHz range, this range will be band passed.
  • Should be audible at almost no volume, and with the above, should only be played at softest volume.

Rationale of constraints

Should at most be 1 second in length

The longest orbiter wait should be less than one second, and the sounds should be designed appropriately. They will not loop.

Should allow to be clipped, as operations can take less than a second

If an operation takes less time than intended, then a Stop Sound command should be emitted. This will see most of its use with CMD_Goto_DesignObj.

Should allow for slight sample rate changes

I intend to put a small timer routine within the audio thread, to slowly change the sample rate by a small amount. This value should be small enough not to cause noticeable filter drift beyond the wanted frequency ranges, but it should be large enough to notice a slight pitch shift.

Why do I want this?

Simply because I want to have a sound change slightly over the course of time, so that the human ear does not fatigue to repeated action of sound during any given day. I will do this by simply changing the sample rate by small values by a random time interval no less than 15 minutes, and no more than 2 hours.

Sound should be within specific frequency ranges

This is still up for further analysis. Tenatively, sounds should only be in the 3kHz-5kHz range, this range will be band passed, It will provide a small cross section of human speech frequencies which the brain is adept at detecting, when concentration permits. The goal is to create a sound you can hear when you need to. It is not a foreground sound, and it should never be treated as such.

Should be audible at almost no volume, and with the above, should only be played at softest volume.

Discreet sounds. This is key. Sounds should be audible at the softest volumes, and thus proper frequency filtering is key, but also careful attention to the individual timbres (and the consequence of harmonics seleted within a given sound) so as to provide a pleasing sound that can both be easily heard, and ignored.

To do:

  • Implement libao thread
  • Implement audiofile routines in OrbiterGen to generate serialized audio data.
  • Implement CMD_Play_Media to call libao thread to play serialized audio once.
  • Implement CMD_Stop_Media to call libao thread to stop audio
  • Research, Design, and record sounds from pure-data.

--Tschak909 04:53, 10 July 2010 (CEST)