Free technical help for digital creators - music, video, art, photography, graphic & web design

Director and sound by Matt Ottewill & Ian Wood

Director movies

These Director files demonstrate many of
the techniques described on this page.

download icon Sound control 1 tutorial movie (.dir)

download icon Sound control 2 tutorial movie (.dir)
Includes alternative syntax, setting
volume, fadeIn and panning)

download icon Audio mixer tutorial movie (.dir)

Need help downloading these files?

File types

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.

Importing sound

There are two ways to import sound into Director ...

  1. 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.

  2. 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.

Controlling playback

You can control sound playback in 5 ways ...

  1. 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.

  2. By controlling it with Lingo

  3. By embedding sound in a QuickTime movie

  4. By embedding sound in a Flash movie

  5. By pre-setting whether the sound loops or not in the cast member property inspector

Sound control with Lingo

Lingo allows comprehensive control of sound. Here are some of the functions ...

Setting volume

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

Staring and stopping

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 3

sound(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

Fading in and out

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

Panning sound

sound(3).pan = -100 --New syntax locates a mono sound within the stereo field (-100 = far left, 0 = center, + 100 = far right)

Checking to see if a sound is already playing

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

Sound control with Lingo (continued)

Audio levels in a QuickTime movie

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

Creating a button to start and stop sound

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

Create a button to pause and re-start a sound

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()

Making an audio fader

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

Making a (DJ mixer) cross fader

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

Problem fix for when MIAW stops sound playback by Ian Wood

In authoring and projectors, opening or forgetting a MIAW stops the puppetSound and sound playfile sounds in all movies.

Fixes for channels 1 & 2

Using the forget window command stops the sound. Use close window instead.

Fixes for channels 3-8

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

Mixing QuickTime & Director sound (Nove 2000)

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.

Macs

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.

Windows

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