Subject:Run Sony Noise Reduction from Script
Posted by: clmn
Date:12/20/2005 12:42:28 PM
I just downloaded a trial of the Sony Noise Reduction Plug In for Sound Forge and Im wondering what the script code would be to run this ? I looked in the DoMenuCommands document in the SDK but I didnt see anything for this. Thanks. |
Subject:RE: Run Sony Noise Reduction from Script
Reply by: _TJ
Date:12/20/2005 2:27:09 PM
There isn't anything for this. Plugins that aren't part of Sound Forge are not accessible from DoMenu. You will need to use the ISfFileHost.DoEffect() method. SfAudioSelection asel = app.ActiveWindow.EditRegion; app.CurrentFile.DoEffect("Sony Noise Reduction", 0, asel, EffectOptions.DialogFirst); |
Subject:RE: Run Sony Noise Reduction from Script
Reply by: clmn
Date:12/20/2005 2:38:34 PM
So will the code you posted work inside of my change event in the watch folders script, or does it require additional changes for that? |
Subject:RE: Run Sony Noise Reduction from Script
Reply by: _TJ
Date:12/20/2005 4:31:32 PM
I expect it would work as a replacement for your Do("Normalize") command. Have you tried it? |
Subject:RE: Run Sony Noise Reduction from Script
Reply by: clmn
Date:12/21/2005 6:02:45 AM
I just tried it now and it seems to work. I wanted it to just run with the last used values without displaying a dialog box like the Do command items do when set to true. So I was wondering if I did this correct just changeing EffectOptions to EffectOnly or if I need to change anything else. Here is what I have for this line: ForgeApp.CurrentFile.DoEffect("Sony Noise Reduction", 0, asel, EffectOptions.EffectOnly); ALSO: I also get a "An error occured during the current operation error" error all of a sudden in my watchfolders script when I exit the watchfolders script . This causes sound forge to keep executing, after a while my computer started getting slow then I looked in my computer proccess and I had about 10 soundforges running on their from testing it. Im guessing since it didnt occur untill I added the noise reduction code it might have something to do with that line a code above or something with the noice reduction code but I cant figure out what. Thanks. Message last edited on12/21/2005 9:29:15 AM byclmn. |
Subject:RE: Run Sony Noise Reduction from Script
Reply by: _TJ
Date:12/21/2005 2:28:44 PM
ForgeApp.CurrentFile.DoEffect("Sony Noise Reduction", 0, asel, EffectOptions.EffectOnly); the '0' there is the preset to use. where I believe 0 is interpreted as 'last settings', if you want to be sure about that, you should use the name of a preset there instead. ForgeApp.CurrentFile.DoEffect("Sony Noise Reduction", "My preset", asel, EffectOptions.EffectOnly); You are correct that using EffectOptions.EffectOnly is the way to avoid having the dialog box show up. Your having several copies of Sound Forge running is not because of Noise Reduction. More likely it is because you are shutting it down improperly and it is never fully exiting. the app.ModalPump() makes it possible to get to the minimize button, but it ALSO makes it possible to get to the close button. I suspect that if you close down Sound Forge while your script is running, Sound Forge never completely exits. Message last edited on12/21/2005 2:29:12 PM by_TJ. |
Subject:RE: Run Sony Noise Reduction from Script
Reply by: clmn
Date:12/22/2005 7:11:20 AM
Ok one more thing here and I should have my script finished. Currently when I run the sony noise reduction on the file and try to close the file within the script it comes up with a messagebox asking if you want to save. I am using the Do("File.Save"); and Do("File.Close") commands that I had before. I was wondering though if it would work better using: ForgeApp.CurrentFile.Save(); and ForgeApp.CurrentFile.Close(); since I am using the ForgeApp to call the Noise Reduction effect. I tried this but I am not sure what these statements need for arguments since they need one. So if you think this way would work so it would save and close without bringing up a dialog box Ill try that I just need the arguments Im suppose to use. Thanks Alot. |
Subject:RE: Run Sony Noise Reduction from Script
Reply by: _TJ
Date:12/22/2005 11:54:49 AM
You are correct, using ForgeApp.CurrentFile.Save() & Close() could avoid the dialog boxes. If you just want to save the file back to its original name and format, then there is an even easier way. Just use ForgeApp.CurrentFile.Close(CloseOptions.SaveChanges); instead of Do("File.Save") and Do("File.Close") tj Message last edited on12/22/2005 12:24:08 PM by_TJ. |
Subject:RE: Run Sony Noise Reduction from Script
Reply by: clmn
Date:12/28/2005 8:42:49 AM
I had everything working while debugging, then I removed a messagebox I had right before the sound forge code saves and close the file to let me know if it went through the code or not. Then I went through and removed that messagebox and now sound forge freezes every time the script runs the noise reduction part of my script. My guess would be it tries to save and close the file before its finished being excuted on but Im not sure. Is thier a way around this so I could have a short pause like a messagebox allows so all my Noise Reduction statements execute successfully ? Here is the block of code where my problem is: ForgeApp.OpenFile(files.ToString().Replace(szWatchDir,szProcessDir), false, true);//2nd one true Do("Process.DCOffset", true); Do("Process.Normalize", true); Do("Process.ParametricEQ", true); Do("Effects.GraphicDynamics", true); SfAudioSelection asel = ForgeApp.ActiveWindow.EditRegion; ForgeApp.CurrentFile.DoEffect("Sony Noise Reduction", 0, asel, EffectOptions.EffectOnly); MessageBox.Show("ok"); ForgeApp.CurrentFile.Close(CloseOptions.SaveChanges) Thanks Message last edited on12/28/2005 8:46:19 AM byclmn. |
Subject:RE: Run Sony Noise Reduction from Script
Reply by: _TJ
Date:12/28/2005 2:24:31 PM
put a call to ForgeApp.CurrentFile.WaitForDoneOrCancel(); after the DoEffect() and before the Close(). tj |