Guide to Use of Sound in Director
Stephen Wilson, Conceptual/
Information Arts Program, SFSU
Sound formats
Wav is the Windows standard for recorded digital sound and is now
understood by macintosh. Thus it is the most recommended for work in Director.
Aiff is the mac standard for recorded digital sound
Quicktime(mov) sound-only movies are very flexible and can be
used in Director via quicktime movie controls.
Midi (mid) is the international standard for storing note based
synthesized music. It is not a digitized recording but rather a sequence
of note values and instrument notations which are synthesized on midi instruments.
It is highly compressed. (Must be converted to be used in Director
8)
Mp3 is highly compressed, high quality (Must be converted to
be used in Director 8)
RealAudio (ram) is a streaming format. (It is purposely
hard to capture on local computers in order to protect copyright.
It cannot be captured without specialized software)
Windows Media Player (avi) is another streaming format.
Sampling Rates and Bit Resolution
Digital sound recording can be captured at various levels of quality.
Sampling rates indicate how many snippets of the analog sound wave are
captured per second. They are measured in kilohertz (khz-thousands
of samples per second) Customary values include 11.025 khz (AM quality)
, 22.050 khz(FM), and 44.100 khz (CD quality). There is a calculable
trade-off between quality and file size. 44khz samples require 4
times the file size as 11khz samples.
Sound quality is also affected by bit resolution - for example 8 or
16-bit resolution. Bit resolution refers to how many nuances can
be differentiated in each sample. 8 bit = 256 variations; 16 bit
= 65,536 variations.
You can also pick whether to record in mono or stereo (2 channels)
Sampling, Composing, and Capturing Sound
Director has no sound creation capabilities except a rudimentary recording
function (Insert media element). You must either capture sound from
the web (for example, public domain sound archives) or use specialized
software to create and edit sound.
Sampling and editing software (for example, SoundEdit, Peak, Deck, Pro
Tools, Sound Forge) include flexible tools for recording and processing
sounds. You can mix several tracks, apply filters and effects, etc.
You can then save in various formats.
Sequencing software allows you to create midi compositions by chosing
notes and instrument defintiions and arranging via standard or non-standard
musical notation.
Speech synthesis software allows you to convert standard ascii text
into speech generated with synthesized voices. (Requires special
xtra to use in Director)
You can get sound into the computer via the microphone, the earphone
output on a tape or cdplayer, or via the internal cd player in the computer.
Newer macs need special sound digitizing usb hardware to take the sound
signal in.
Methods by which Director refers to sounds
-
1 Import sound into Director cast members. (These become part
of Director but can quickly engorge the movie size.)
-
2. Import sound into Director cast members via link to external files.
(Recommened- These can be used by Director lingo but remain as external
files. You must be careful include the files whenever you transport
the movie - for example by creating folder to enclose sounds and director
movies together)
-
3. Leave as external files and use special playfile lingo commands
Methods by which Director plays sounds
-
1. Place in special sound channels in the score. (These only play
when play head is in their frame. It is difficult to orchestrate interactive
control)
-
2. Use Lingo to play sound members via special sound channels.
These do not appear visually in the score. They are not the same
as the visual sprite channels.
-
3 Use Lingo to play external sound files
Samples of Lingo to Control Sound
These examples assume that you have imported sound into Director into cast
members called "greeting" and "heartbeat" via the link to external file
or direct import. (The members could be named anything you want.
Also the examples show mouseUp scripts, the scripts could be placed anywhere
Lingo goes - for example on enterFrame, etc.) Sound channels can be on
any channel 1-8. You need to keep track to where you put sounds;
they are not visible in score. 8 sounds can be playing simultaneously.
If you start playing a sound in a channel that already has a sound, it
will stop it and start the new one.
Play, stop, pause a sound
| play a sound (can be on any channel 1-8)
on mouseUp
sound(1).play(member "greeting")
end
on mouseUp
sound(1).stop()
end
|
Pause and start a sound ( no need to specify name
of sound - already determined when started playing in particular channel
- picks up where paused)
on mouseEnter
sound(2).pause()
end
on mouseLeave
sound(2).play()
end |
Check if a sound is still playing before playing it again. Check if a sound
is done before going to next section of movie.
| Check if a sound is still playing before playing it
again. For example at the frame at the end of a repeating section of the
movie. Soundbusy (channel) = 0 if done or 1 if still playing
on exitFrame
if soundbusy(2) = 0 then
sound(2).play(member
"heartbeat")
end if
end |
Check if a sound is done before going to next section of
movie.
on exitFrame
if soundbusy(3) = 0 then
go frame "section2"
else
go frame "section1"
end if
end |
Start a new sound when sprite reaches a particular position
Check where your animation is - for example the sprite 4 has reached the
right edge of the screen. Play a new sound. Assumes a different
sound is already playing in channel 3
on exitFrame
if sprite(4).loch > 600 then
sound(3).member = "greeting"
end if
end |
Control the volume and fade-ins and outs
| Change the volume of a sound to low when entering a graphic
sprite - back high when leave. Volumes can have any value 0-255
on mouseEnter
sound(4).volume = 128
end
on mouseLeave
sound(4).volume = 255
end
|
Fade a sound to a particular volume level over a certain
length of time. Start playing when enter frame. Fade to volume level
20 over 5 seconds. (time is given in miliseconds - thousnadths of
a second)
on enterFrame
sound(6).play(member "heartbeat")
sound(6).fadeto (20,5000)
end
Set the sound level for all sounds
on startMovie
set the soundLevel = 200
end |
Playlists. queues for sounds
You can setup a playlist. When a sound finishes in a particular channel
it will start playing the next sound. One simple way is to use the
queue command to add sounds. A more complex way involves setting
up Director lists. This is very flexible allowing particular start and
end times. (See the book for details)
| Queue 3 sounds into a sound channel
on EnterFrame
sound(7).queue(member("greeting"))
sound(7).queue(member("heartbeat"))
sound(7).queue(member("greeting"))
end |
Each time you stop the sound. The next play would
start the next sound. The other advantage of queues is that there
is no delay in the sounds starting.
sound(7).play() -- starts greeting
sound(7).stop() -- stops greeting
sound(7).play() -- starts heartbeat etc |
Currenttime of a sound
Check where you are in a sound and do something such as change the image
Currenttime reports current time of playing sound in miliseconds.
| Make various sprites visible as the sound proceeds. Assumes
you have started the sound playing already in some channel. You need
to check for a range of times because the script may not executed when
the sound is exactly at a particular place. You would stretch this
to the script channel in every frame of a movie section so it would be
checked all the time.
on exitFrame
set cur = sound(2).currenttime
if cur < 2000 then sprite(11).visible = true
if cur > 2000 and cur < 6000 then sprite(12).visible = true
if cur > 6000 and cur < 9000 then sprite(13).visible = true
end |
Change frequency - rateshift
Rateshift is undocumented feature that lets you change the pitch of the
sounds. the number after the rateshif parameter indicates the change
from normal in semitones. It can have value from -12 to +12.
The example would shift heartbeat to a higher pitch.
| sound(1).play([#member: member("heartbeat"), #rateShift:
41] |
Timing Delays in Director
Often you want short delays before the next event happens. For example,
if you flash text on the screen you must give time for the visitor to read
it. Lingo moves so quick it might not be visible. This is the
Lingo routines to introduce a delay. It uses a function called the
timer. Once you start it, it keeps track of how many ticks (60ths
of a second) have passed. You use a repeat while command to
stop Director in a loop until the timer has gone the length of time you
want. In this example it shows sprite 4 and then waits about 90 ticks
(approx 1.5 second) and then makes sprite 4 invisible and shows sprite
5.
on mouseUp
sprite (4).visible = true
starttime
repeat while the timer < 90
end repeat
sprite(4).visible = false
sprite (5).visible = true
end |