Director can replay 8 channels of sound (mono or stereo), plus QuickTime video sound, simultaneously. However, simultaneous Director and QuickTime sound may not work on PCs unless a suitable audio driver is present (see below).
Director can handle all major file types (including MP3, .aif, .wav, .sd2) and sample rates and bit depths, and seems happy to mix and match. However, if you are originating your own sounds you should try to stick to 44.1Khz sample rate, 16bit bit depth (CD quality) to avoid some cross platform issues. You may also want to stick to one file format, .aif or .wav.
There are two ways to import sound into Director ...
Standard import. This will embed the sound into the movie and is suitable for short sound files which will not swell the size of movie too much.
Link to external file. This will link to an external file which should be located in a folder entitled "Media" on the same level as your movie. Locate the sound file in the folder first and then import it. The movie may pause to locate and buffer the file when it is needed for playback unless you use the preLoad function.
You can control sound playback in 5 ways ...
By placing the sound in one of the 2 score sound channels. Unsurprisingly, sound placed in score channel 1 will play back on sound channel 1, and 2 in 2. Use the tempo channel to make use of cue points you have placed in the sound file with SoundEdit 16 or Sound Designer.
By controlling it with Lingo
By embedding sound in a QuickTime movie
By embedding sound in a Flash movie
By pre-setting whether the sound loops or not in the cast member property inspector
Lingo allows comprehensive control of sound. Here are some of the functions ...
The volume of each of the 8 sound channels can be controlled between 0 (silence) and 255 (maximum volume)
set the volume of sound 3 to 255 --Old syntax sets the volume of sound playing in channel 3 to maximum
sound(3).volume = 255 --New syntax sets the volume of sound playing in channel 3 to maximum
set the soundLevel = 4 --sets the computer system sound level. The range of volumes are 0 to 7
puppetSound 3, "sound cast member name" --Old syntax starts a sound playing in channel 3
sound(3).play(member("sound cast member name")) --New syntax starts a sound playing in channel 3
sound(3).queue(member("sound cast member name"))
sound(3).play() --New syntax queues and then starts a sound playing in channel 3sound(3).play([#member: member("sound cast member name")]) --New syntax starts a sound playing in channel 3
puppetSound 3, 0 --Old syntax stops any sound currently playing in channel 3
sound(3).stop() --New syntax stops any sound currently playing in channel 3
sound(3).pause() --New syntax pauses any sound currently playing in channel 3. Use the "sound(3).play()" syntax to start it again
puppetSound 3, "sound cast member name"
sound fadeIn 3, 2*60 --Old syntax fades the sound in over a period of 2 seconds. Director can count in ticks (60 ticks per second)
In the new syntax you must queue the sound first ...
sound(3).queue(member("sound cast member name"))
sound(3).fadein(3000) --Fade in over 3 seconds
sound(3).play() --New syntax fades the sound in over a period of 2 seconds. Director counts in milliseconds. There are 1000 milliseconds per second
Sound fadeOut appears to only be supported in the old syntax ...
sound fadeOut 3, 2*60 --Old syntax fades the sound out over 2 seconds
sound(3).pan = -100 --New syntax locates a mono sound within the stereo field (-100 = far left, 0 = center, + 100 = far right)
if soundBusy (3) = FALSE then --Old syntax checks to see if sound is playing in a given audio channel (3). returns either FALSE or TRUE
sound(3).isbusy() --New syntax checks to see if a sound is either playing OR paused OR queued in a given audio channel (3).
if sound(3).status = 3 --New syntax checks to see if sound is playing (3).
if sound(3).status = 4 --New syntax checks to see if sound is paused (4)
Here's a sample script that incorporates many of these functions ...
if soundBusy (3) = FALSE then
sound(3).queue(member("sound cast member name"))
sound(3).volume = 255 --Volume
sound(3).pan = 0 --Centre
sound(3).fadein(3000) --Fade in over 3 seconds
sound(3).play()
end if
Volume of a QuickTime movie audio channel is set with the Volume Of Sprite property, where the sprite is the score channel in which the video lives. Values range from 0 (silence) to 255 (maximum). For example ...
set the volume of sprite 10 to 200
or ...
sprite(10).volume = 200
This script when attached to a button graphic will toggle a sound file on and off.
on mouseUp
if soundBusy (3) = FALSE then --Checks to see if audio ISN'T playing in sound channel 3
sound(3).play(member("sound cast member name")) --Starts sound file playing
sprite(the currentSpriteNum).member = member "Stop audio button" --Switches the graphic of the button
else
if soundBusy (3) = TRUE then --Checks to see if audio IS playing in sound channel 3
sound(3).stop() --Stops sound file playing
sprite(the currentSpriteNum).member = member "Start audio button" --Switches the graphic of the button
end if
end if
end mouseUp
This script will pause or resume playing a sound file in channel 1 ...
if sound(1).status = 3 then --3 means playing
sound(1).pause()
else
if sound(1).status = 4 then --4 means paused
sound(1).play()
This involves making a vertical fader knob (sprite 2) and constraining it to a vertical fader track (sprite 1) and then controlling the volume of a sound channel with a piece of maths which tracks the fader knob position against the fader track relative to Director's sound channel volume range of 0 - 255.
sound(3).volume = 255 - (sprite(2).locV - sprite(1).top) * 255/sprite(1).height
A complete script attached to a vertical fader knob might go something like ...
on mouseDown
repeat while the STILLDOWN = TRUE
sprite(2).locV = constrainV(1, the mouseV)
sound(3).volume = 255 - (sprite(2).locV - sprite(1).top) * 255/sprite(1).height
updateStage
end repeat
end mouseDown
For a horizontal fader (left to right) try ...
on mouseDown
repeat while the STILLDOWN = TRUE
sprite(2).locH = constrainH(1, the mouseH)
sound(3).volume = 0 + (sprite(2).locH - sprite(1).left) * 255/sprite(1).width
updateStage
end repeat
end mouseDown
This involves making a horizontal fader knob (sprite 2) and constraining it to a horizontal fader track (sprite 1) and then controlling the volume of 2 sound channels (sound 1 and sound 2) with a piece of maths which tracks the fader knob position against the fader track relative to Director's sound channel volume range of 0 - 255.
repeat while the STILLDOWN = TRUE
sprite(2).locH = constrainH(1, the mouseH)
updateStage
set the volume of sound 1 = 0 + (sprite(2).locH - sprite(1).left) * 255/sprite(1).width
set the volume of sound 2 = 255 - (sprite(2).locH - sprite(1).left) * 255/sprite(1).width
end repeat
In authoring and projectors, opening or forgetting a MIAW stops the puppetSound and sound playfile sounds in all movies.
Using the forget window command stops the sound. Use close window instead.
forget window AND open window stops the sound. The fix is to open the MIAW before playing the sound, using visibility or rect to control when it shows. Then use close window, not forget window.
Here is an example script to launch a Miaw ...
on mouseup me
cursor 280
global info
whichWindow = window ("info")
whichWindow.windowtype = 3
open info
whichWindow.movetofront()
updatestage
end
And to close a MIAW ...
on mouseup me
close window "info"
updatestage
end
NOTE: This advice was written in Nove 2000. Things may have improved since then and most recent audio drivers may work fine.
When you want to play QuickTime video in A Director project, Director hands over control to the host computers installed QuickTime system "plug-ins". This can cause Director sound channels 1-8 to stop functioning temporarily.
On the Mac this process is entirely compatible with the Mac Sound Manage. QuickTime sound (perhaps accompanying a video file) and Director sound channels can play together.
On Windows its a different deal. Although many drivers will work OK, certain Windows audio drivers are NOT capable of playing QuickTime audio and other Director sound channels simultaneously.
On a PC, open the Message Window and enter ...
"put the soundDeviceList" then hit Return. It will return a list of any installed sound drivers.
The "QT3Mix" and "DirectSound" (v 5.0) sound drivers ARE capable of simultaneous QT and Director sound.
NOTE: Before starting on a major project, you should make a quick test on a typical end-user system to ensure QuickTime and Director sound will play simultaneously, if you need them to.
You can test for installed drivers and then specify the sound driver you want by using the SoundDevice function.
If the DirectSound Xtra is included in your projector and the DirectX driver installed on the PC system, this will be default sound driver, but there are some issues with it.
But what if these drivers aren't installed? 2 options ...
Write a script that returns the sound drivers, then set an alert warning the end user to update their drivers, and provide a link to a relevant web site where they can download the driver. QT3Mix is good.
Don't mix QT and Director sound
These Director files demonstrate many of the techniques described on this page.
Sound control 1 tutorial movie (.dir)
Sound control 2 tutorial movie (.dir) Includes alternative syntax, setting volume, fadeIn and panning)
Audio mixer tutorial movie (.dir)
Need help downloading these files?