One of the major enhancements in Director 11.5 is the Audio Enhancements. There are many new things happened with audio and in this tutorial we will discuss about how to create a mixer and associate a soundobjects to that mixer. So...what is this mixer and soundobject?...
As the Adobe Director Documentation describes, a mixer is a container that mixes the sound objects that it contains and plays the resulting output. Because multiple audio sources are merged into a single audio source, mixers save resources by reducing the amount of data transferred to the sound card.
And, A sound object is the audio data that is added to a mixer. Sound objects contain the actual sound data of the audio file (local or on the network), audio cast member, or streaming member along with modifications like effects. You can apply audio filters to sound objects.
Ok...let's get started... There are two ways of doing this, one with the UI and other through scripting! Let's see the UI first...
Step 1: Create a New movie....
Step 2: Import a sound file into cast.
Step 3: Go to window menu and click the audio mixer menu item.
Step 4: Click on the + button and choose 'New Mixer'
Step 5:
Choose the new mixer and click on + again. Choose the 'Add Sound' and choose the sound member in the cast.
Step 6: Now, we can choose either the mixer node or the sound object node and add a filter.
Step 7: Play the mixer by clicking the play button in the right hand side.
Now, Let's see how to do the same using scripting...
Step 1: Create a New movie....
Step 2: Import a sound file into cast.
Step 3: Open the script editor and
create the following movie script.
global gMix
on startMovie
-- Create a new Mixer
gMix = new (#mixer)
-- Create a sound object from Member 1 in gMix
sndObj = gMix.createSoundObject("sndObj1", member(1))
-- Put the sound object in an infinite loop
sndObj.loopcount = 0
-- Create a LowPass Filter with
default cut off
lowPass = audioFilter(#lowPassFilter)
-- Append the filter to the sound object's filter list
sndObj.filterlist.append(lowPass)
-- Play the Mixer. This will play all the sound objects
contained in it
gMix.play()
end
on stopMovie
-- If the mixer was created, then delete it
if not voidp(gMix) then
gMix.erase()
end if
end
The above script first creates a new mixer. And then it creates a sound object named "sndobj1" from the audio cast member 1. Then we create a filter to apply it on the sound object and this time it is LowPass Filter. Next, we apply that filter on the sound object. Play the mixer and enjoy!! once the movie is stopped, we could delete the existing the mixer with erase() on stopmovie.
Download the sample movie here
Feedback:
If you have any questions or comments concerning this
article, please send a message to shrinidhi@gmail.com |