Audio
Audio Features in Director 11.5
New to 11.5 | Audio Lingo By Category | Audio Lingo (alphabetical)
Director 11.5 introduces a new workflow for dealing with sound. There are now 16 sound channels.
Mixers and SoundObjects
In this new workflow, you control the output of a sound channel by activating a mixer member, using the play() command.
The first time mixer.play() is used for a given mixer, the first free sound channel is allotted to the mixer. You can check which channel is allotted by using mixer.channel. Sound channels are allotted in reverse order, starting with channel 16.
If you attempt to play() more than 16 mixers simultaneously, then the channel for the extra mixers will be set to 0 and no sound will play. If you use the older puppetSound or soundChannel.play() commands, then you will reduce the number of channels available for mixers.
A mixer on its own will not play any sound. You need to create a sound object for the mixer, and provide either a sound member, an absolute path to an external audio file, or a callback handler, in order to determine which sound the soundObject is to use. You then need to use soundObject.play().
Advantages
There are four main advantages of using this new workflow:
- You are not limited to one sound file per sound channel
- You can use the new audio filters to create audio effects
- You can use the new sound panning system, with any number of channels from 2 (stereo) to 6 (5.1 sound)
- You can save a particular mix of sounds to the end-user's hard disk
"Unlimited" sounds
In theory, you can create any number of soundObjects for a given mixer. In other words, you can play more than 16 sounds through only 16 mixer channels. In practice, the number of simultaneous sound that can be played smoothly will depend on the end-user's machine and sound card.
Mixers and SoundObjects both have a sampleRate property. While it is possible to use soundObjects at different sampleRates inside the same mixer, the conversion process is expensive and performance will suffer. It is best to ensure that all sounds used with a given mixer have the same sampleRate as the mixer.
Effects
There are 15 different audioFilters or effects. These can be used, for example, to affect which frequencies are heard, to modify the texture of the sound, or to add echo and reverberation to simulate how the environment affects the sound.
Panning and 5.1 sound
Both mixers and soundObjects have a panMatrix property. This can have between 1 and 6 inputs (for mono, stereo, quad or 5.1 sound) and between 1 and 6 outputs. You can use this, for example, to take a mono sound file and play it through a particular 5.1 sound speaker, or you can take a 6-channel 5.1 sound file and convert it to stereo, so that it can be heard through headphones.
The panMatrix gives you much more control than the pre-d11.5 pan property for a sound channel, in that you can define the volume on each speaker independently. The pan property only allows you to determine the balance between two speakers.
Saving a Mix
You can save the output of a mixer to the hard disk in two different ways:
Currently, you can only save in mono or stereo formats. Saving all 6 channels of a 5.1 sound mixer is not supported in D11.5.0.