Subject:crop and fade as batch process
Posted by: beckman
Date:8/23/2005 4:00:05 AM
Hello, I am using a modified script of the script-preset "crop and fade". Question: Do anyone know, whether it's possible to apply this special process to a huge number od files like in the batch-converter? Would be very helpful for me. |
Subject:RE: crop and fade as batch process
Reply by: jetdv
Date:8/23/2005 7:42:52 AM
Sure, you would just have to load each file, apply the adjustment, save and close it. Then repeat for the next file. There was a post here not too long ago which talked about getting a list of files and adjusting all of them. |
Subject:RE: crop and fade as batch process
Reply by: jetdv
Date:8/23/2005 7:43:57 AM
Here's the post I was thinking of: http://www.sonymediasoftware.com/forums/ShowMessage.asp?MessageID=404976&Replies=6 |
Subject:RE: crop and fade as batch process
Reply by: beckman
Date:8/25/2005 2:41:57 AM
Hello jetdv, first of all thanks for your answers! (Also thanks to sonyTJ) Of course, I don't want to fade all files manually. So I need the combination of the effectprocess (fading is enough, cropping isn't necesssary) and the batch job. Now the standard sentence: I am not very experienced in scripting. 1. Question: Do the scriptpresets in sound forge also work as standalone scripts? Or do they have to be started in sound forge? What is the difference? Could I use an effect of sound forge externally? 2. I am happy to write a bit in english. Am I right, that .cs are scripts written c, c+ or c++? 3. I tried to combine fading and the batch job: using System; using System.IO; using System.Windows.Forms; using SoundForge; private string[] filenamearray; filenamearray = GetFileList("D:\\Audio\\00 Fadefolder\\"); //Change this path to your desired default path foreach (string filename in filenamearray) { ISfFileHost file = app.OpenFile(filename, false, false); //Process the files as needed Int64 fadesize = file.SecondsToPosition(0.002); SfAudioSelection asel = new SfAudioSelection(0, fadesize); file.DoEffect("Fade In", 0, asel, EffectOptions.EffectOnly); file.WaitForDoneOrCancel(); asel = new SfAudioSelection(file.Length - fadesize, fadesize); file.DoEffect("Fade Out", 0, asel, EffectOptions.EffectOnly); file.WaitForDoneOrCancel(); // save back to original file file.Save(SaveOptions.AndClose); file.WaitForDoneOrCancel(); // to save to a new file, use file.SaveAs(...) or file.RenderAs(...) // followed by file.Close(CloseOptions.DiscardChanges); } But compiling shows me: Compiler error 0x80004005 on Line 6 : A namespace does not directly contain members such as fields or methods And: If its written in c++ isn't there missing the main function and a definition of a class? Sincerely, beckman |
Subject:RE: crop and fade as batch process
Reply by: jetdv
Date:8/25/2005 6:34:46 AM
1. Question: Do the scriptpresets in sound forge also work as standalone scripts? Or do they have to be started in sound forge? What is the difference? Scripts must be run from INSIDE Sound Forge 2. I am happy to write a bit in english. Am I right, that .cs are scripts written c, c+ or c++? C# 3. I tried to combine fading and the batch job: Looks like you're missing the GetFileList routine. Just add the following after your last line of code: public string[] GetFileList(string OrgSaveDir) { if (OrgSaveDir == null) { OrgSaveDir = ""; } OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Multiselect = true; openFileDialog.Title = "Select file(s) to convert"; if (!(OrgSaveDir == "")) { string initialDir = OrgSaveDir; if (Directory.Exists(initialDir)) { openFileDialog.InitialDirectory = initialDir; } } else { openFileDialog.InitialDirectory = "c:\\"; } if (System.Windows.Forms.DialogResult.OK == openFileDialog.ShowDialog()) { return openFileDialog.FileNames; } else { return null; } } |
Subject:RE: crop and fade as batch process
Reply by: beckman
Date:8/26/2005 1:38:12 AM
Thanks again for your speedy return, but.... compiler error is still the same. I think I have to read a bit more about programming. May be this conservative way is long, but do I have a choice? beckman |
Subject:RE: crop and fade as batch process
Reply by: jetdv
Date:8/26/2005 7:28:01 AM
If you want to e-mail me the complete script, I'll take a look at it. |