Community Forums Archive

Go Back

Subject:Exporting regions of a WAV to multiple MP3 files
Posted by: RWeigelt
Date:9/22/2008 2:37:00 PM

Note: I'm posting this in lieu of a user of the trial version (a fellow German) who contacted me because of an old blog post I wrote where I expressed my delight about the choice of scripting language (C#) when SF8.0 came out (being a .NET developer). Unfortunately I'm woefully short on free time and never have actually used scripting for SF, so I couldn't help him directly.

- - - - - - - - - - - - - start quote - - - - - - - - - - - - -

Hi!
I'm about to start a big digitalisation project and looking for a program able to do some tricky things for me. I'm not an official SoundForge user at the moment (only trial), but I would love to buy this program if it's capable doing the mentioned things. Roland Weigelt was so kind to post this for me

I have to handle a lot of WAV files in which i do mark multiple regions. These should later on be exported to single mp3s in a certain quality. Because of the big number of WAV files, the script should be able to do this in batch.

Maybe someone can help me on this. The Script should mainly be able to do the following steps

- Read a wav file with multiple regions
- Detect the name and the regions of the file
- Export the regions to single mp3s (chosable quality by dialog?)
- Naming of the new single mp3 files with the detected name_01, name_02, etc.
- Storing the new mp3s to a specific location

Further questions .....
- Would it be possible to make this script batch-able ...dealing with many files in one go?
- I would love to use LAME as the encoder. Is it possible to get it into this process somehow?
- Is it possible to run a dithering over the whole file before?
- Would it be possible to write the new created names of a single mp3 to its ID-Tag?
- Would it be possible to create subfolders for mp3s belonging to one origin file?

I know this sounds a lot. I read a lot over the forum, and it looked to me as if a lot of the building blocks are there already .... but im not capable of programing or putting them together.

Regards
Markus Kopschitz

- - - - - - - - - - - - - end quote - - - - - - - - - - - - -

Subject:RE: Exporting regions of a WAV to multiple MP
Reply by: _TJ
Date:9/23/2008 12:10:14 PM

In answer to his question - yes. Sound Forge scripting can easily do (almost) all of these things.

- Read a wav file with multiple regions
ISfFileHost file = app.OpenFile(...);

- Detect the name and the regions of the file
// markers and regions are in the markers list.
SfAudioMarkerList regions = file.Markers;

- Export the regions to single mp3s (chosable quality by dialog?)
// save only the time range of the given region to a new file.
file.RenderAs(..., regions[ii], ...) ;

- Naming of the new single mp3 files with the detected name_01, name_02, etc.
Storing the new mp3s to a specific location
string szName = file.Title + "_" + region[ii].Name;
string szDir = @"c:\whatever\";
file.RenderAs(szDir + szName, ...);

- Would it be possible to make this script batch-able ...dealing with many files in one go?
Sure, just look at the sample scripts, GenericProcessAFolder.cs shows one way to do this.

- I would love to use LAME as the encoder. Is it possible to get it into this process somehow?
You can use LAME mp3 to write into MP3 into wave files, but you can't write raw mp3 files using LAME in Sound Forge. (you actually can, but it would require a LOT of script code, essentially bypassing the Sound Forge save code and doing it all yourself - not recommended).

- Is it possible to run a dithering over the whole file before?
file.DoEffect("Dither", "preset name", ...);

- Would it be possible to write the new created names of a single mp3 to its ID-Tag?
file.Summary.Title = szName; // do this before you RenderAs

- Would it be possible to create subfolders for mp3s belonging to one origin file?
Sure, just remember to Directory.Create() folders before you try and save files into them.

All of these things (other than the LAME encoder) are very easy in Sound Forge scripting.



Message last edited on9/23/2008 3:00:10 PM by_TJ.
Subject:RE: Exporting regions of a WAV to multiple MP
Reply by: Olek321
Date:10/28/2008 6:57:40 AM

Hi SonyTJ, so i bought a new soundforge 9 yesterday.

Thanx for your kind reply. It is good to know, that sf is capable of doing all what i need.
Can you help me finding someone able to write the final script. Of course i would pay for that.

Best wishes
Olek

Go Back