Tutorial: Page (1) of 2 - 05/12/05 Email this story to a friend. email article Print this page (Article printing at MyDmn.com).print page facebook

Scripting System Streams in DVD Studio Pro, Part 3

Switching audio streams on the fly By Dave Nagel
In the last installment in this tutorial series, we looked at a method for creating an "audio options" menu that allowed viewers to select an audio stream from a DVD menu. However, there are times when you'd want to let viewers switch audio streams on the fly as they're watching a movie--perhaps to change languages, perhaps to enable or disable a "director's commentary" track. Whatever the reason, you want to give your viewers the chance to switch audio streams on the fly and make it as simple as possible.

For this, you'll need to do some scripting. But unlike our previous tutorial (which you can read by clicking here), we won't be using a menu to accomplish this, so you won't be able to connect your script to a menu button. Instead, you'll be connecting it to a button on the user's remote control so that the audio can be switched without the need to stop the movie in progress.

Setting up the project
For this project, you will need to create a track that has multiple audio streams. In my case, that will mean a standard audio stream, plus a special stream that I've created that contains the director's commentary. These will be positioned in the A1 and A2 slots, respectively, in the Track Editor.



Of course, you can do this with more than two audio streams, and the streams you use don't have to be along the lines of a director's commentary. You can use multiple streams for multiple languages, multiple audio formats (surround, stereo) or anything else you can dream up.

Once you've set up your track with your alternate audio streams, you're ready to begin creating the script to enable switching on the fly.


Creating the script
To begin, add a new script to your project by choosing Project > Add to Project > Script. Then double-click the script to select it and activate the Script Editor.



Now, in order for this script to work, we're going to have to do two things. First, we're going to have to determine which audio stream is currently playing; then we're going to have to use this information as the basis for switching to a different stream.

Information about the current audio stream is stored in SPRM 1. So what we're going to do is collect this information and move it into one of our available GPRMs. So in the Script Editor, select the default Nop command. Then, in the Inspector palette, change this Nop command to "Set GPRM." By default, the Operation value will be set to "mov." This is fine. But you need to switch the Source Type to "SPRM" and the Source Value to "SPRM 1." Leave the Target as GPRM 0, unless you're using that GPRM for something else.



Now we need to create separate commands for each one of our audio streams. Essentially what we'll be doing is using a button on the remote to move sequentially through all of the streams availablefor our track. If the viewer is currently listening to audio stream 1, then clicking a button on the remote will switch to audio stream 2. Clicking it again will move back to audio stream 1, or, if you have more than two streams, it will move to stream 3, then stream 4, then stream 5, etc.

So create a new command in your script by clicking t6he little "+" sign in the Script Editor. Switch this command to "Set System Stream." Click the Audio checkbox, and then choose Audio Stream 1 from the pull-down menu on the right.



Then, at the bottom of the Inspector palette, click on the Compare Command checkbox. What we want to do here is ensure that the audio will switch to audio stream 1 only if the current audio track is audio stream 2 (or whatever the last audio stream in your track may be.) In my case, since I have two audio streams, I'll use the following: "Execute if GPRM 0 is = to Immediate with value 1."



Why? Each audio stream has a numeric value starting at 0. So, if audio stream 1 is currently playing, the value in GPRM 0 will be 0. If audio stream 2 is playing, the value in GPRM 0 will be 1. If audio stream 3 is playing, the value in GPRM 0 will be 2.


Page: 1 2 Next Page


Related Keywords:apple dvd studio pro, scripting, switching audio, set system stream, audio stream, alternate audio track

HOT THREADS on DMN Forums
Content-type: text/html  Rss  Add to Google Reader or
Homepage    Add to My AOL  Add to Excite MIX  Subscribe in
NewsGator Online 
Real-Time - what users are saying - Right Now!

Our Privacy Policy --- @ Copyright, 2015 Digital Media Online, All Rights Reserved