Flash vs. audio markers

General Add comments

I was challenged today to find out how we could read the audio markers from a mp3 file in a Flash movie. The markers were added using SoundForge and are crucial for the application we are building.

Since there is no way in Flash to read those markers, I had to find another way.

A possible solution was to write an xml file with the marker information and load it into the Flash Player when the sound was being loaded. I found this cumbersome because of the 2 files and the problems that would arise when updating the markers and to keep the files synchronised.

After taking a deeper look into the SoundForge documentation, I found out that it is actually possible to write your own scripts, in c# for instance, that can be run from within SoundForge. To create your own scripts, you need the SoundForge 8 Script Developers Kit, which is available for free download. The API allows you to read all files that are opened in SoundForge and then enables you to edit them by code. Reading the markers was pretty trivial given that the API itself is very straight forward and there is some good documentation available in NDoc format.

I decided to write the markers into the “comment” field of the ID3 information. This was also pretty easy to do and best of all, it can be read by the Flash Player. The markers are in a format like “10_23_76″, which means there are markers on seconds 10, 23 and 76.

The ActionScript part is not done yet, but this shouldn’t be a problem. The most important thing was to get the markers into our Flash movies.

The script (C# sourcecode) is available for download if you are interested. To run it, just open SoundForge, go to Tools -> Scripting -> Run Script… and then browse for the script. You can also put the script in the “Script Menu” folder inside the SoundForge installation folder. Doing so, the script will be available in the Scripting panel.

Have fun and be sure to let me know if you find any bugs or other weird things.


Add to Bloglines - Digg This! - del.icio.us - Stumble It! - Twit This! - Technorati links - Share on Facebook - Feedburner
 

5 Responses to “Flash vs. audio markers”

  1. John Says:

    Not sure if this would be easier or just create more steps, but what about converting your audio to FLV (minus the video) and using the cue points in the FLV format? Or does that just create more work?

    FlashAmpPro makes use of an array that has the amplitude data dumped into it. YOu could save that to an external file.

  2. Duncan Says:

    Very cool indeed! Is there a maximum limit to the amount of information you can put into the “comments” area of an id3 tag? I tried the script but it seems to only put a maximum of 28 characters in there.

  3. Shayne Cantly Says:

    Hi Christophe,

    I’ve been trying to find a Sound Forge script that will do a specific task. Since I don’t know anything about programming or scripting, I was hoping to find a script that some one had already done. My searches lead me to you.
    I need a script that will automate the following process.
    I need to watermark thousands of audio files, which means I need to mix in an extra piece of audio that says “Audition Purposes Only” at 15 second intervals on each peice of music. It then needs to save each completed mix file as a lower res MP3 file.
    I’m happy to pay a little money to someone who can create this script for me.
    Let me know if you can help, or know someone who can.
    Thanks.

  4. Bäcker Says:

    Hey.
    Very good idéa with the script indeed, sad to say that the download link doesn’t work. Would very much like to get hold of the source code and the plugin, sitting here and trying to understans C# and how to do this myselfe without any greater success :(

  5. Shawn Snyder Says:

    hey Christophe!

    Is there any chance you can post your cs code again if you still have it? The current link is broken. Much appreciated.

    :)

Leave a Reply

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Login