Articles Archive
Articles Search
Director Wiki
 

Mixing Sound with Digital Video and Flash Audio on Windows

May 22, 2001
by Will Turnage

Hey Handyman!

I'd like to use WAV sounds and AVI files with sound in the same .dir file for Windows. Of course as soon as one type of sound plays (WAV) the AVI sound won't play and vice versa. Is there any way around this?

Thanks!

Trey Shively

Trey,

The reason you are having troubles with your AVI files has to do with the way sound cards work on many Windows systems. When Director plays a sound file, it can take control of the sound card so that no other Windows applications can use it. This might seem ideal, but what you're missing is that Director isn't actually playing the AVI file. Instead, the Windows system is playing the AVI file through Director. While this small detail might seem irrelevant, it's the cause of your problem. Director is seizing control of the sound card to play your WAV file, and when Windows tries to play the AVI file, it plays the video fine but it can't play the sound because Director still has control of the sound card.

Lucky for you, there are four basic Lingo properties you can use to control sound mixing on Windows machines. They are:

First, you should look at the soundKeepDevice. The soundKeepDevice is a system property that can either be true or false. If it's set to true, then Director will take control of the sound card whenever it plays a sound file, and it will keep control of the sound card during your movie. If you set the soundKeepDevice to false, then Director will release the sound card as soon as your sounds are done playing. The only downside to setting the soundKeepDevice to false is that it requires Director to take control of the sound card every time it plays a sound and release the sound card when the sound is done playing. If you're progamming a game, or some other project that requires many sounds to be played frequently, then setting the soundKeepDevice to false will cause problems in your movie because of the constant capturing and releasing of the sound card.

In those instances, though, there are two other Lingo terms to help you solve your problem. They are the soundDevice and the soundDeviceList. The first thing you should do is find out what soundDevice your computer is set to use. In the message window, type:

put the soundDevice
-- "DirectSound"

There are three possible choices for the soundDevice on Windows systems. They are DirectSound, MacroMix, and QT3Mix. By default, Director will try to select DirectSound, but if it's not available, then it will select MacroMix. To find out what's available on your machine, all you have to do is use the soundDeviceList.

put the soundDeviceList
-- ["DirectSound", "MacroMix", "QT3Mix"]

If you're running Windows NT, or you have an older version of Win95 installed without DirectSound, then the DirectSound option will not show up. Also, if you don't have Quicktime installed on your machine, then the QT3Mix option will not show up. Regardless, the MacroMix option will always show up. Which soundDevice is right for your project? Here's a breakdown of each option:

DirectSound - this option allows all of your sound mixing to be handled through Microsoft's DirectX software. If you use this option, then you don't need to worry about switching the soundKeepDevice at all because this sound mixing is handled automatically through DirectX. The only downside to this option is that it's not available on Windows NT, and for Windows 95 users, it might require an installation of DirectX.

MacroMix - this option is Macromedia's own software-based sound mixing solution. Its biggest benefit is that it's available on all Windows machines and doesn't require any other software to be installed. Its only drawback is that it's not able to mix audio and digital video sounds, so if you use MacroMix in a project with audio and digital video, then you will have to switch the soundKeepDevice off in order for both media types to work.

QT3Mix - this option allows Quicktime to handle all of the sound mixing in your movie on a system level. You can't use QT3Mix on a computer unless it has Quicktime installed on it, and in your case of using AVI files, you should import the AVI files as Quicktime movies if you want to use the QT3Mix option.

On a final note, if you're using Flash movies inside of Director, you might also encounter a problem where Flash sounds will not play at the same time as Director sounds. This feature is controlled through the Lingo property the soundMixMedia. If you set this value to true, then Director will take control of the sound mixing for your Flash movies. The only downside to this approach is that in processor intensive movies, the audio might not sound exactly as you intended in your Flash movie. You can alleviate this by setting the soundMixMedia to false, but then you will not be able to play Flash audio and Director audio at the same time.

Will Turnage is a multimedia programmer based in New York City. In addition to his weekly role as Director Online's Multimedia Handyman, he is also the Technology Director for Sony Music's Client Side Technologies Group. You can read more about his work at http://will.turnage.com/.

Copyright 1997-2024, Director Online. Article content copyright by respective authors.