Subject:DESPERATELY NEED HELP!
Posted by: Keeba
Date:12/13/2005 2:12:56 PM
Sorry about the caps......but I needed to get your attention. Hi, Im a guy in California, who needs a little help on scripting in Forge8. HEre is what I need to do, and tell me if anyone can point me in the right direction....... I need to join two files, with a predetermined 'silence' in between them, then mix them down over a beat bed, then save them as a specified format.... Over and Over and Over again. This would classify as a batch process, and while I am VERY astute at using Cool Edit Pro and 2K, to create batch processes, I am STUMPED as to how to create a similar batch process in Forge8. Here is the scenario - I have a source file, and I need to 'marry' that source file to MANY other files with a 'silence' between (2 seconds). So, the process - -Open source file #1 > copy. -Open 'source files (#2 - meat), insert 2 seconds of silence and paste source file #1 (in the beginning) -Then, take this file and mix it down over a bed (source file #3)at predetermined levels - Then save as (format) So - ANYONE...please tell me, how can I 'record' a batch process, or write a script, that takes file #1, and file #2 and joins them with a 1 or 2 second silence in between, then mix it down with another source file and then save it. (I know...asking a lot) Are there any tutorials on how to write a script that does certain things? I must say, Cool Edit made this a little easier with their 'record' a script function........any like solutions here....? Thanks to ANYONE that answers this post.........your help is SO greatly appreciated! Message last edited on12/13/2005 2:53:36 PM byKeeba. |
Subject:RE: DESPERATELY NEED HELP!
Reply by: _TJ
Date:12/13/2005 11:33:32 PM
Heres a script that does what you describe without the looping You will have to modify this to specify the correct mix gains and output format. And then you will have to turn it into a loop. In order to write that loop you need to know some things that you havn't mentioned yet. 1) in what form is the list of files that you are working on. (is it all of the files in a given folder? all files whose names match a pattern? is there a file somewhere that has a list of the filenames? 2) how do you determine the names of the output files (is it derived from the input file somehow?) Once you know that, you can write a loop that gets one filename2 and one output file and then runs the script from the points marked top of loop down to the bottom. using System; using System.IO; using System.Windows.Forms; using SoundForge; public class EntryPoint { public void Begin(IScriptableApp app) { string strFilename1 = @"c:\file1.wav"; string strFilename2 = @"c:\file2.wav"; string strMusicBed = @"c:\MusicBed.wav"; string strOutfile = @"c:\Output.wav"; double dGainMusic = SfHelpers.dBToRatio(-3); double dGainMain = SfHelpers.dBToRatio(-3); ISfFileHost file1 = app.OpenFile(strFilename1, true, true); if (null == file1) return; ISfFileHost file3 = app.OpenFile(strMusicBed, true, true); if (null == file3) return; // this is the top of the loop (if there was a loop) ISfFileHost file2 = app.OpenFile(strFilename2, true, true); if (null == file2) return; // make a blank file to mix into. // ISfFileHost file = app.NewFile(file3.DataFormat, true); // paste file1 to the start of the temp file SfAudioSelection aselFile1 = new SfAudioSelection(file1); file.OverwriteAudio(0, 0, file1, aselFile1); // insert 2 seconds of silence at the end of the temp file file.InsertSilence(file.Length, file.SecondsToPosition(2.0)); // paste file2 at the end of the temp file SfAudioSelection aselFile2 = new SfAudioSelection(file2); file.OverwriteAudio(file.Length, 0, file2, aselFile2); // mix the music bed into the temp file SfAudioSelection aselOut = new SfAudioSelection(file); file.MixAudio(aselOut, dGainMain, dGainMusic, file3, aselOut); file.WaitForDoneOrCancel(); // mix can take some time... // get a render template for mp3 ISfRenderer rend = app.FindRenderer(null, ".mp3"); //ISfGenericPreset tpl = rend.ChooseTemplate(IntPtr.Zero, 0); // ask the user ISfGenericPreset tpl = rend.GetTemplate("template name"); // save the temp file as mp3 RenderOptions ro = RenderOptions.RenderOnly; // this to just render // RenderOptions ro = RenderOptions.DialogFirst; // this to pop the SaveAs dialog file.SaveAs(strOutfile, rend.Guid, tpl, ro); file.WaitForDoneOrCancel(); // close the temp file file.Close(CloseOptions.DiscardChanges); // close file 2 file2.Close(CloseOptions.DiscardChanges); // to process multiple files, open a new file2 and loop back to do it again... } public void FromSoundForge(IScriptableApp app) { ForgeApp = app; //execution begins here app.SetStatusText(String.Format("Script '{0}' is running.", Script.Name)); Begin(app); app.SetStatusText(String.Format("Script '{0}' is done.", Script.Name)); } public static IScriptableApp ForgeApp = null; public static void DPF(string sz) { ForgeApp.OutputText(sz); } public static void DPF(string fmt, object o) { ForgeApp.OutputText(String.Format(fmt,o)); } public static void DPF(string fmt, object o, object o2) { ForgeApp.OutputText(String.Format(fmt,o,o2)); } public static void DPF(string fmt, object o, object o2, object o3) { ForgeApp.OutputText(String.Format(fmt,o,o2,o3)); } public static string GETARG(string k, string d) { string val = Script.Args.ValueOf(k); if (val == null || val.Length == 0) val = d; return val; } public static int GETARG(string k, int d) { string s = Script.Args.ValueOf(k); if (s == null || s.Length == 0) return d; else return Script.Args.AsInt(k); } public static bool GETARG(string k, bool d) { string s = Script.Args.ValueOf(k); if (s == null || s.Length == 0) return d; else return Script.Args.AsBool(k); } } //EntryPoint tj Message last edited on12/13/2005 11:39:22 PM by_TJ. |
Subject:RE: DESPERATELY NEED HELP!
Reply by: Keeba
Date:12/14/2005 8:31:02 AM
SonyTJ - I dont know how many people tell you this - BUT YOU ARE INCREDIBLE.... However, it seems that I may have come across like some type of professional, who could grasp programming. I am sorry - because while I get the basic concepts of the script, how it works and such, I dont know the first thing about 'writing a loop', or for that matter, my first question to you is this - do I replace the file1, file2 and musicbed 'names' with something? I guess my first thought is how do I get THIS script to work its magic on the files I am working on? Do I setup wildcard options to point TO the files, or does the program have presets to let me 'identify' the files....(as I am assuming this is the manual scripting, rather than something I could pull up and use through the batch processor window). So- in closing, to answer your questions about the Loop - 1.'all files in a given set of folders' In other words, I will be selecting (much like the batch processing window allows) all 'folders' option to run this (or so I thought....when I thought I was using the batch processor window...) 2. YEs, the file is to be saved as name of the main input file (filename2) Tell me......what do I do next.....other than the copy paste (carefully) of this code into the script editor.....?? And in case I didnt make the point earlier - YOU ARE A LIFE SAVER AND A TRUE MASTER AMONG MASTERS! BLESS YOU! |
Subject:RE: DESPERATELY NEED HELP!
Reply by: Keeba
Date:12/14/2005 9:10:15 AM
TJ - let me see if I can further explain what I am doing, to help you see what I need to do. I have TONS of clients, all with different company names. I create IVR systems for them, and they all buy my BASIC voice prompts. I personalize the WHOLE set of 60 prompts for each customer. So - I have a company called Widget1. I record their voiceover pieces (filename1) and save it. Now, I open my archive where my 60 base prompts are waiting, and now what I have to do is do that paste function I describe above, for each of the 60 files. Here is the catch - I have 600 clients, and that number is growing, FAST. As I get a new client, I need to be able to run a ONE PASS of the copmany name, against the 60 files.....BUT, then, I also need to be able to, when I add a new prompt - run that ONE prompt against all 600 names. Is this getting confusing.....I hope not. I really want you to understnad the work flow, so you can get what I m trying to get SF to do for me....and then I can get out of your hair.... :) So, ok, to start, I have the names and the 60 prompts. This script you wrote me, I think, will slap the names with the prompts, and then add a music bed ?????? (please forgive me...this is all a little overwhelming...and I have to get this ASAP.....cuz our production just skyrocketed) Will the OTHER script you wrote (generic) allow me to alter it a bit to do the second pass - where I add one prompt to all 600 names? Finally - is that generic script also one I can use when I just want to run a simple pass across all of the base produced files to add different music bed options? If not, how would I alter the script to just get the availalbe wav files in a directory, and mix them over another file - simple it seems....if I understood the freekin language... Im tryin. Ok - I think that is all I can think of......I hope. If not, please know that I will humbly be asking you upon my return. Thanks again.....in MORE ways than you can ever imagine. |
Subject:RE: DESPERATELY NEED HELP!
Reply by: _TJ
Date:12/14/2005 7:10:16 PM
yes, you replace file1, file2 and musicbed with the actual filenames of your files. i.e. you replace c:\file1.wav with your own filename for file1, etc. And then set the correct gain values for dGainMusic and dGainMain. Run this script and it will mix produce one output file. So to run 1 company file against 60 prompts you would need to run this script 60 times, changing the value of file2 each time. I suggest that you do this and let me know if the output of that single file is correct before we go any further. Please post the code that you actually run so I can get a better idea of what you are doing. Then the next step would be to get that to loop so that one file1 can be mixed with 60 file2's producing 60 output files. Once that is working we can create an outer loop that would let you mix 600 file1's against 60 file2's producing 600x60 output files, etc. The way to do this is to work from inner loop to outer loop, makeing sure that each part does the right thing before you go on. To help you any further I'm going to need to know specifics. Are the names of the 60 files the same every time? or is it a different set of 60 file2's for each file1? How often does the music bed change? Is it the same for everyone? does it change when file1 changes? or is it different for every output file? (i.e. do you have 1 music bed? 60? 600? 60x600?). What are the rules for naming the output files? do the have the same names as the 60 files? Do they go all into a single folder? Do you need to be able to pick the folder when you run the script? or is it ok to hard-code the output filename and folder into the script? The more specific you can be, the more easily I can help. tj Message last edited on12/14/2005 7:25:05 PM by_TJ. |
Subject:RE: DESPERATELY NEED HELP!
Reply by: Keeba
Date:12/14/2005 7:42:10 PM
Ok - I am on it........just as an aside, are there no 'wildcard' possibilities in this programming language? It seems that the 'wildcard' option would further extend these capabilities.... Anyhow, to quickly answer your questions at the bottom..... 1. Are the names of the 60 files the same every time - YES. They are the base Prompt files ('... main voice mail box....leave your message after the tone...' - '.....marketing departments mailbox', etc) The names of those files remain static. They will be married to the 600 files (This is the Widget1's . . ., or This is Macromedias . . . ) ending up with a file that says....'This is Widget1's .....marketing departments mailbox'. YEs...they stay the same 2. The music bed is a choosable option when ordering the base pacakge. So, to answer your question, it chnges once per 600 pass. In other words, after I create a new set of music beds (with Acid/Forge etc) then I would take my base set of wav files (the 'dry' set of 600 "This is Widget1's ...marketing departments voice mailbox" etc.) and add a new music bed to each file. 3. The output files previously, have simply assumed the parent name. In other words, I would put a 'name' on the clipboard, and then run a Cool Edit script on it that would paste the 600 files together, and then save it as the 'opened-file' name - OR - I would have 'The WIdget1's...) on the clipboard, and then run a pass against it where the first file was named "marketing_departments_voicemail_box.wav". When the script was done, it would simply save it as THAT base filename. In this scenario, that is not what I think I can do, so it would then be saving it as the filename2 option. That way, since filename2 is the 'meat' of the edit (marketing departments voicemail box) then it will have THAT name. As for the location - Im flexible on that . As I sit here and think about it, since I am going to be using these and modification of these scripts on differnet clients, to dump them all into ONE folder (so that Widget1's files are all together) would make sense...I think. Ok - now I am off to test the script part one. I will report back by morning.....and eagerly await your response whenever it arrives.....(your promptness is SO appreciated!) Thanks....A MILLION! |
Subject:RE: DESPERATELY NEED HELP!
Reply by: _TJ
Date:12/14/2005 8:12:45 PM
Wildcards are a possiblity, you can use the same ones that you would use in a Window's command prompt - * and ? |
Subject:RE: DESPERATELY NEED HELP!
Reply by: Keeba
Date:12/14/2005 8:27:43 PM
Ok - I ran the exact script you pasted in the previous posting (using Firefox to copy and paste to preserve the carraige returns and such), I adjusted the locations and this was the error I got. (code pasted below...) ---------------- Sound Forge Error 0x8004E00A The item was not found. while calling SoundForge.ISfFileHost OpenFile(System.String, Boolean, Boolean) --------message---------- Exception from HRESULT: 0x8004E00A. --------Stack Trace---------- at SoundForge.IScriptableApp.OpenFile(String pszFileName, Boolean fReadOnly, Boolean fNoWindow) at EntryPoint.Begin(IScriptableApp app) at EntryPoint.FromSoundForge(IScriptableApp app) --------- Ok - so you have the script that I used, but I have removed the actual file location, as it reveals a bit more than I would like everyone in the public to know about my project.... :) Hope that this does not cause a problem.......the string was similar to C:\Documents and Settings\Akiba Howard.DIRECTIO-519C70\Desktop\prompt_work_folder\prompts\..... And I a msure that the files are actually there, as I copied the file name directly FROm the file itself....to confirm that I was using a correct spelling. Anyhow - I ask about the wildcards, as that would seem to simplify the looping process, where it seems I could use the *.wav, to reference all wav files within this set of folders I choose. I am rambling at this point....but trying. Bare with me.... So - here isthe code that i used.... using System; using System.IO; using System.Windows.Forms; using SoundForge; public class EntryPoint { public void Begin(IScriptableApp app) { string strFilename1 = @"C:\Documents and Settings\Akiba Howard.DIRECTIO-519C70\Desktop\....wav"; string strFilename2 = @"C:\Documents and Settings\Akiba Howard.DIRECTIO-519C70\Desktop\....wav"; string strMusicBed = @"C:\Documents and Settings\Akiba Howard.DIRECTIO-519C70\Desktop\ring1.wav"; string strOutfile = @"c:\Output.wav"; double dGainMusic = SfHelpers.dBToRatio(-3); double dGainMain = SfHelpers.dBToRatio(-3); ISfFileHost file1 = app.OpenFile(strFilename1, true, true); if (null == file1) return; ISfFileHost file3 = app.OpenFile(strMusicBed, true, true); if (null == file3) return; // this is the top of the loop (if there was a loop) ISfFileHost file2 = app.OpenFile(strFilename2, true, true); if (null == file2) return; // make a blank file to mix into. // ISfFileHost file = app.NewFile(file3.DataFormat, true); // paste file1 to the start of the temp file SfAudioSelection aselFile1 = new SfAudioSelection(file1); file.OverwriteAudio(0, 0, file1, aselFile1); // insert 2 seconds of silence at the end of the temp file file.InsertSilence(file.Length, file.SecondsToPosition(2.0)); // paste file2 at the end of the temp file SfAudioSelection aselFile2 = new SfAudioSelection(file2); file.OverwriteAudio(file.Length, 0, file2, aselFile2); // mix the music bed into the temp file SfAudioSelection aselOut = new SfAudioSelection(file); file.MixAudio(aselOut, dGainMain, dGainMusic, file3, aselOut); file.WaitForDoneOrCancel(); // mix can take some time... // get a render template for mp3 ISfRenderer rend = app.FindRenderer(null, ".mp3"); //ISfGenericPreset tpl = rend.ChooseTemplate(IntPtr.Zero, 0); // ask the user ISfGenericPreset tpl = rend.GetTemplate("template name"); // save the temp file as mp3 RenderOptions ro = RenderOptions.RenderOnly; // this to just render // RenderOptions ro = RenderOptions.DialogFirst; // this to pop the SaveAs dialog file.SaveAs(strOutfile, rend.Guid, tpl, ro); file.WaitForDoneOrCancel(); // close the temp file file.Close(CloseOptions.DiscardChanges); // close file 2 file2.Close(CloseOptions.DiscardChanges); // to process multiple files, open a new file2 and loop back to do it again... } public void FromSoundForge(IScriptableApp app) { ForgeApp = app; //execution begins here app.SetStatusText(String.Format("Script '{0}' is running.", Script.Name)); Begin(app); app.SetStatusText(String.Format("Script '{0}' is done.", Script.Name)); } public static IScriptableApp ForgeApp = null; public static void DPF(string sz) { ForgeApp.OutputText(sz); } public static void DPF(string fmt, object o) { ForgeApp.OutputText(String.Format(fmt,o)); } public static void DPF(string fmt, object o, object o2) { ForgeApp.OutputText(String.Format(fmt,o,o2)); } public static void DPF(string fmt, object o, object o2, object o3) { ForgeApp.OutputText(String.Format(fmt,o,o2,o3)); } public static string GETARG(string k, string d) { string val = Script.Args.ValueOf(k); if (val == null || val.Length == 0) val = d; return val; } public static int GETARG(string k, int d) { string s = Script.Args.ValueOf(k); if (s == null || s.Length == 0) return d; else return Script.Args.AsInt(k); } public static bool GETARG(string k, bool d) { string s = Script.Args.ValueOf(k); if (s == null || s.Length == 0) return d; else return Script.Args.AsBool(k); } } //EntryPoint As you can see, the only thing I changed were the file locations. I had not even gotten to the gain adjustments and such. |
Subject:RE: DESPERATELY NEED HELP!
Reply by: _TJ
Date:12/14/2005 9:43:42 PM
The error indicates what one of the files can't be found, so we need to narrow down which one: try this script - make sure that you run it in the Script Editor window so that you can see the output (the DPF lines should print to the bottom of the Script Editor window). this will tell you what file it's having trouble with. One of those files will not exist, or it will be of invalid type, or it will be locked open by some other application. using System; using System.IO; using System.Windows.Forms; using SoundForge; public class EntryPoint { public void Begin(IScriptableApp app) { string strFilename1 = @"C:\Documents and Settings\Akiba Howard.DIRECTIO-519C70\Desktop\....wav"; string strFilename2 = @"C:\Documents and Settings\Akiba Howard.DIRECTIO-519C70\Desktop\....wav"; string strMusicBed = @"C:\Documents and Settings\Akiba Howard.DIRECTIO-519C70\Desktop\ring1.wav"; DPF("opening file1: {0}", strFilename1); ISfFileHost file1 = app.OpenFile(strFilename1, true, true); if (null == file1) return; DPF("opening file3: {0}", strMusicBed); ISfFileHost file3 = app.OpenFile(strMusicBed, true, true); if (null == file3) return; // this is the top of the loop (if there was a loop) DPF("opening file2: {0}", strFilename2); ISfFileHost file2 = app.OpenFile(strFilename2, true, true); if (null == file2) return; } public void FromSoundForge(IScriptableApp app) { ForgeApp = app; //execution begins here app.SetStatusText(String.Format("Script '{0}' is running.", Script.Name)); Begin(app); app.SetStatusText(String.Format("Script '{0}' is done.", Script.Name)); } public static IScriptableApp ForgeApp = null; public static void DPF(string sz) { ForgeApp.OutputText(sz); } public static void DPF(string fmt, object o) { ForgeApp.OutputText(String.Format(fmt,o)); } public static void DPF(string fmt, object o, object o2) { ForgeApp.OutputText(String.Format(fmt,o,o2)); } public static void DPF(string fmt, object o, object o2, object o3) { ForgeApp.OutputText(String.Format(fmt,o,o2,o3)); } public static string GETARG(string k, string d) { string val = Script.Args.ValueOf(k); if (val == null || val.Length == 0) val = d; return val; } public static int GETARG(string k, int d) { string s = Script.Args.ValueOf(k); if (s == null || s.Length == 0) return d; else return Script.Args.AsInt(k); } public static bool GETARG(string k, bool d) { string s = Script.Args.ValueOf(k); if (s == null || s.Length == 0) return d; else return Script.Args.AsBool(k); } } //EntryPoint |
Subject:RE: DESPERATELY NEED HELP!
Reply by: Keeba
Date:12/15/2005 3:30:39 PM
Ok - now I have made adjustements in the locations and hit run and got no errors. I watched the window at the bottom and it said opening files......no error window popped up, so I assume that all works ok. Next step.....(this is fun.....) |
Subject:RE: DESPERATELY NEED HELP!
Reply by: Keeba
Date:12/15/2005 3:39:36 PM
another quick question......is there any way to get this process to read a 'text' file list? In the xcopy function, I have built a list of files, that run the .bat file. I am wondering if it is possible to generate a list like that for this program, and have it run this process we are building (ok...I know...that YOU are building) by reading the list and kinda parsing the file one line at a time. You know, so it would read the list line one, and then run the process on that file, then move on to line to and run the process on that file and so on. I know...I am dreamin, but why not shoot for the stars......who know...someone here reading these and being entertained, may have a solution for it........(dream a little dream....) Ok - enough.....clearly I am getting loopy from the long hours and process....but I wont quit til I have my computer hummin along processing files....... Thanks TJ |
Subject:RE: DESPERATELY NEED HELP!
Reply by: _TJ
Date:12/15/2005 4:36:18 PM
Ok, now go back to original script, fixup the filenames and run that. you might also add the DPF() calls from the latest script into the first script. FYI, DPF stands for DebugPrintF, it's the main technique for figuring out what's going wrong when a script doesn't work right, a lot of times just figuring how what the script was doing just before it died is key to fixing things. tj |
Subject:RE: DESPERATELY NEED HELP!
Reply by: Keeba
Date:12/15/2005 4:47:09 PM
Okey dokey... Here is the error log generated......and the files were located fine....I assume.. --- System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: The parameter is incorrect. at SoundForge.ISfRenderer.GetTemplate(Object vPresetNameOrIndex) at EntryPoint.Begin(IScriptableApp app) at EntryPoint.FromSoundForge(IScriptableApp app) --- End of inner exception stack trace --- at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess) at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean verifyAccess) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at SoundForge.ScriptManager.Run(Assembly asm, String className, String methodName) at SoundForge.CodeDomScriptManager.Run(Assembly assy) at SoundForge.ScriptHost.RunScript(String szFile, String szSourceText, EngineType eType, Boolean fCompileOnly, Boolean fDebug) |
Subject:RE: DESPERATELY NEED HELP!
Reply by: _TJ
Date:12/15/2005 4:53:15 PM
getting the list of files from a text file is possible, it's only a little harder than processing all of the files in a folder in fact. The question came up before in a slightly different context. check out the thread in this forum titled "Save Regions out with Filenames from list". tj |
Subject:RE: DESPERATELY NEED HELP!
Reply by: _TJ
Date:12/15/2005 4:58:17 PM
That's this block of code: // get a render template for mp3 ISfRenderer rend = app.FindRenderer(null, ".mp3"); //ISfGenericPreset tpl = rend.ChooseTemplate(IntPtr.Zero, 0); // ask the user ISfGenericPreset tpl = rend.GetTemplate("template name"); "template name" needs to be the name of an actual render template for the associated rernderer, (in this case the .MP3 renderer). Or you could comment that line out and uncomment the line rend.ChooseTemplate() - that line pops a dialog asking the user what template to use. Come to think of it, those 3 lines of code really ought to be done at the top of the script, since we want to do it BEFORE the (soon to be creaeted ) processing loop rather than once for each output file. Note that you should also change ".mp3" to whatever output format you actually want, and then pick a template name for THAT output format. tj |
Subject:RE: DESPERATELY NEED HELP!
Reply by: Keeba
Date:12/15/2005 7:06:04 PM
OK, so I changed it to .MP3 renderer, and got the following error... System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: The parameter is incorrect. at SoundForge.ISfRenderer.GetTemplate(Object vPresetNameOrIndex) at EntryPoint.Begin(IScriptableApp app) at EntryPoint.FromSoundForge(IScriptableApp app) --- End of inner exception stack trace --- at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess) at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean verifyAccess) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at SoundForge.ScriptManager.Run(Assembly asm, String className, String methodName) at SoundForge.CodeDomScriptManager.Run(Assembly assy) at SoundForge.ScriptHost.RunScript(String szFile, String szSourceText, EngineType eType, Boolean fCompileOnly, Boolean fDebug) |
Subject:RE: DESPERATELY NEED HELP!
Reply by: _TJ
Date:12/15/2005 7:21:07 PM
You have to pass a valid Template name to rend.GetTemplate(). Try using rend.GetTemplate("Default Template") or rend.GetTemplate("128 Kbps, CD Quality Audio") |
Subject:RE: DESPERATELY NEED HELP!
Reply by: Keeba
Date:12/15/2005 7:34:22 PM
WORKED! Rendered the file.......there were a few minor errors based upon not changeing some of the levels and such (just watned to RUN IT)....but it is working. Now I would imagine the LOOP becomes the issue.......??? You are slowly becoming the MAN OF THE YEAR! |
Subject:RE: DESPERATELY NEED HELP!
Reply by: _TJ
Date:12/15/2005 7:56:58 PM
Actually you have TWO loops, so first we need to do the inner loop - merging one client file with the 60 prompt files. Since the prompt files are constant, the easy way to do this is to just put an array of filenames into the script. using System; using System.IO; using System.Windows.Forms; using SoundForge; public class EntryPoint { public void Begin(IScriptableApp app) { string strFilename1 = @"c:\Megatron\Megatron.wav"; string strMusicBed = @"c:\MusicBed.wav"; string strOutpath = @"c:\Output\"; double dGainMusic = SfHelpers.dBToRatio(-3); double dGainMain = SfHelpers.dBToRatio(-3); // list of prompt files. string[] astrPrompts = new string[] { @"c:\Prompts\Stop.wav", @"c:\Prompts\Look.wav", @"c:\Prompts\Listen.wav", }; // choose a render template for mp3 ISfRenderer rend = app.FindRenderer(null, ".mp3"); ISfGenericPreset tpl = rend.ChooseTemplate(IntPtr.Zero, 0); // ask the user //ISfGenericPreset tpl = rend.GetTemplate("Default Template"); if (null == tpl) return; // open the client file DPF("Opening {0}", strFilename1); ISfFileHost file1 = app.OpenFile(strFilename1, true, true); if (null == file1) return; // open the music bed DPF("Opening {0}", strMusicBed); ISfFileHost file3 = app.OpenFile(strMusicBed, true, true); if (null == file3) return; foreach (string strFilename2 in astrPrompts) { DPF("Opening {0}", strFilename2); ISfFileHost file2 = app.OpenFile(strFilename2, true, true); if (null == file2) return; // make a blank file to mix into. // ISfFileHost file = app.NewFile(file3.DataFormat, true); // paste file1 to the start of the temp file SfAudioSelection aselFile1 = new SfAudioSelection(file1); file.OverwriteAudio(0, 0, file1, aselFile1); // insert 2 seconds of silence at the end of the temp file file.InsertSilence(file.Length, file.SecondsToPosition(2.0)); // paste file2 at the end of the temp file SfAudioSelection aselFile2 = new SfAudioSelection(file2); file.OverwriteAudio(file.Length, 0, file2, aselFile2); // mix the music bed into the temp file SfAudioSelection aselOut = new SfAudioSelection(file); file.MixAudio(aselOut, dGainMain, dGainMusic, file3, aselOut); file.WaitForDoneOrCancel(); // mix can take some time... // make an outputfilename string strOutname = Path.GetFileNameWithoutExtension(strFilename1) + "_" + Path.GetFileNameWithoutExtension(strFilename2); string strOutfile = Path.Combine(strOutpath, strOutname + "." + rend.Extension); // save the temp file to the given template RenderOptions ro = RenderOptions.RenderOnly; // this to just render file.SaveAs(strOutfile, rend.Guid, tpl, ro); file.WaitForDoneOrCancel(); // close the temp file file.Close(CloseOptions.DiscardChanges); // close file 2 file2.Close(CloseOptions.DiscardChanges); } // loop back to do the next file. } public void FromSoundForge(IScriptableApp app) { ForgeApp = app; //execution begins here app.SetStatusText(String.Format("Script '{0}' is running.", Script.Name)); Begin(app); app.SetStatusText(String.Format("Script '{0}' is done.", Script.Name)); } public static IScriptableApp ForgeApp = null; public static void DPF(string sz) { ForgeApp.OutputText(sz); } public static void DPF(string fmt, object o) { ForgeApp.OutputText(String.Format(fmt,o)); } public static void DPF(string fmt, object o, object o2) { ForgeApp.OutputText(String.Format(fmt,o,o2)); } public static void DPF(string fmt, object o, object o2, object o3) { ForgeApp.OutputText(String.Format(fmt,o,o2,o3)); } public static string GETARG(string k, string d) { string val = Script.Args.ValueOf(k); if (val == null || val.Length == 0) val = d; return val; } public static int GETARG(string k, int d) { string s = Script.Args.ValueOf(k); if (s == null || s.Length == 0) return d; else return Script.Args.AsInt(k); } public static bool GETARG(string k, bool d) { string s = Script.Args.ValueOf(k); if (s == null || s.Length == 0) return d; else return Script.Args.AsBool(k); } } //EntryPoint Dont forget to change the filenames and gain values before you run this. tj |
Subject:RE: DESPERATELY NEED HELP!
Reply by: Keeba
Date:12/15/2005 8:02:43 PM
OK - now before I unleash this on a sample set of folders, tell me - can I assume that I need to (since I am using ONE prompt at a time) change the value of the promt file, and that will then whip the prompt file out as the filename2 string? I actually think I am getting this stuff........WOW! |
Subject:RE: DESPERATELY NEED HELP!
Reply by: Keeba
Date:12/15/2005 8:19:44 PM
More specifically - can I remove the last two, and THEN, adjust the name of the prompt filename? |
Subject:RE: DESPERATELY NEED HELP!
Reply by: _TJ
Date:12/15/2005 8:19:48 PM
I'm not sure that I understand the question. The idea is that you fill in the prompt array with the actual names of the prompt files. so replace the 3 lines of filename in this... // list of prompt files. string[] astrPrompts = new string[] { @"c:\Prompts\Stop.wav", @"c:\Prompts\Look.wav", @"c:\Prompts\Listen.wav", }; with 60 lines of filenames for all of your prompt files. then the loop foreach (string strFilename2 in astrPrompts) { ....... } // loop back to do the next file. will pull one entry from the array at a time. stuff it into the variable called strFilename2, and then run the code inside the loop body (the stuff between the curly braces {}) So the if the prompt array has 3 files, the loop body executes 3 times. tj Message last edited on12/15/2005 8:20:23 PM by_TJ. |
Subject:RE: DESPERATELY NEED HELP!
Reply by: Keeba
Date:12/15/2005 8:23:16 PM
AHHHHHHHH Now I get it! So I need to add the 60 prompts to the script - OK then......off to work. Thank you..for the hundredth time.... |
Subject:RE: DESPERATELY NEED HELP!
Reply by: _TJ
Date:12/15/2005 8:24:34 PM
yes, if you want to test with only one prompt file, just have one entry in the array. You can also just comment out the extra entries. // list of prompt files. string[] astrPrompts = new string[] { @"c:\Prompts\Stop.wav", // @"c:\Prompts\Look.wav", // @"c:\Prompts\Listen.wav", }; |
Subject:RE: DESPERATELY NEED HELP!
Reply by: Keeba
Date:12/15/2005 8:31:36 PM
OK - now I think we have it! Last but not least is to understand the mixing elements..... please explain briefly... aselOut, dGainMain, dGainMusic, file3, aselOut Where should I make adjustments to the mix gains and so on? |
Subject:RE: DESPERATELY NEED HELP!
Reply by: _TJ
Date:12/15/2005 8:41:40 PM
SfAudioSelection is a time selection and channel selection. to mix you have to have to specify two ranges. the range of the desination (i.e the file being mixed into) and the range of the source (in this case file3). In this case we want to mix file3 into file starting at time 0 in both files, and extending for the total length of file. (if file3 is longer than file, we ignore the extra). so we use the same asel variable for both source and destination - aselOut. the mix gains are similar, you need to specify the volume of the destination AND the volume of the source. dGainMain is the destination volume, which in this case contains the client and prompt files pasted end to end without any volume change. dGainMusic is the source volume, ie. the volume of the music bed. My sample script sets both of these gain values to -3 db, which probably will make the music too loud, but is a pretty typical value that you would use when you want source and destination to end up relatively equal in volume and you don't want to risk having them total to more than 0 db and ending up clipping. Message last edited on12/15/2005 8:43:25 PM by_TJ. |
Subject:RE: DESPERATELY NEED HELP!
Reply by: _TJ
Date:12/15/2005 8:55:15 PM
incidently I'm using a shorthand way of initializeing aselOut, SfAudioSelection aselOut = new SfAudioSelection(file); is equivalent to SfAudioSelection aselOut = new SfAudioSelection(0, file.Length); which is equivalent to aselOut.Start = 0; aselOut.Length = file.Length; tj |
Subject:RE: DESPERATELY NEED HELP!
Reply by: Keeba
Date:12/15/2005 11:04:56 PM
Ok TJ - I think I got it. One last favor, and I am out of your hair. I need an alternate version of this script, that, instead of doing the music bed thingy, simply pastes another file. To do this, I will manually shift each file down one, eliminating the music bed, so there will be three 'pieces' - the prompt, and then filename1 and then filename2. That is it. Here is the idea - THe file created > The prompt pasted in> File1 pasted in > 2 seconds added > filename 2 pasted in > saved as mp3 > move on to next..... I am sure this is simply a different version of what you have written.......right? With a few minor adjustments???? These will be the full compliment of the scripting source I need to make Sound Forge the power house production tool for my buisness....... Thank you ever so much for your help, and if there is anything else....it is likely you will see it here next week, but I think I have it now - and this is great. Talk soon. |
Subject:RE: DESPERATELY NEED HELP!
Reply by: Keeba
Date:12/15/2005 11:28:24 PM
Yes Yes...I know what I said...but wati...I just thought of something in my process that I could adjust...and need your help on it...... Ok - here is the question........just like I have done with the list of 60 prompt files, // list of prompt files. string[] astrPrompts = new string[] { @"c:\Prompts\Stop.wav", @"c:\Prompts\Look.wav", @"c:\Prompts\Listen.wav", }; changed THAT code to reflect the file locations...... Can I do the same with, lets say.....filename1, or filename2? What would that code look like? Like for instance if there were a consistent list of 'filename1's'. How would I add the code to do the same loop for filename1, such that the only constant in the string strFilename1 = @"c:\Megatron\Megatron.wav"; string strMusicBed = @"c:\MusicBed.wav"; string strOutpath = @"c:\Output\"; section.....would be the music bed and the output folder.........which by the way, will be the only thing for THIS script, that I will need to adjust as I run different passes on these template folders......... Does that make sense? And if this simple sub-version is easy enough...I will add IT to the other previously wished for sub-version.....that just pastes three files together........(above this one...) Thank you again TJ - and I hope you have a good weekend. |
Subject:RE: DESPERATELY NEED HELP!
Reply by: Keeba
Date:12/16/2005 12:02:26 AM
I can only way WOW!!!! I just sat here and toyed around with it til I got it doing what I really wanted it to do and MAN ALIVE! This is GREAT! AMAZING and GREAT........Oh TJ - while I am about to ask you for a slight adjustment on the main script......or to instruct me on how to do it.....I want to say first....not ONLY are you fast and ameenable to sometimes 'overbearing' customers.......you are GOOD! I mean good. I hope you are ....well, lets just say, well compensated for your expertise! Ok - enough of the slathering....here is what I have discovered about the main script on this page......the final looping version. First off, YES, I need a version that not only loops the prompts, but also the names......this way I can just run around and around......doing tons and tons of these things for these folks....and have a million different versions.....(a little excited....can ya tell) So, a version of the script that does these extra things.... First, not only does it loop through the prompts, but also the names files....I can produce a list of those as well, and just paste it in. IT worked GREAT for hte prompts....ran smooth as ice. Second, is the slight adjustment.... The adjustment I need is one that starts the filename1 at a specified point AFTER the beginning. In other words, I want a little of the music bed to play first, before filname1 begins......I think if I see this in one version, I can apply it to the others..... Ok - just so I dont have to come back again tonight....let me make sure I have gotten it all out..... 1. Can you show me a version of hte script that also loops through the names as well as the prompts, This way, once one name is done, it will go back and start on name number two, and run all the prompts........and so on and so forth.....(again...WOW) 2. A basic version of this script, that simply takes three files and pastes them together with a 1 second space between each. 3. A newer version of this same script, that lets me start filename1 a little bit AFTER the beginning....so I hear a bit of the music bed first...THEN filename1 begins... OK - I SWEAR....that is IT. I mean it...I know I have said it before....but this time I am shutting off the computer, and I wont turn it back on til later tomorrow...I PROMISE! THanks.....I am gone now......talk later..... (thanks) |
Subject:RE: DESPERATELY NEED HELP!
Reply by: _TJ
Date:12/16/2005 11:30:17 AM
The outer loop is just like the inner loop, just outer... .... // list of client files string[] astrClients = new string[] { @"c:\Megatron\Megatron.wav", @"c:\Janeco\Janeco.wav", }; // list of prompt files. string[] astrPrompts = new string[] { @"c:\Prompts\Stop.wav", @"c:\Prompts\Look.wav", @"c:\Prompts\Listen.wav", }; // open music bed file here, and choose a render template here. foreach (string strFilename1 in astrClients) { // open strFilename1 here foreach (string strFilename2 in astrPrompts) { ....... } // loop back to do the next prompt // close strFilename1 here } // loop back to do the next client |
Subject:RE: DESPERATELY NEED HELP!
Reply by: _TJ
Date:12/16/2005 11:37:50 AM
3. A newer version of this same script, that lets me start filename1 a little bit AFTER the beginning....so I hear a bit of the music bed first...THEN filename1 begins... To do this, you just insert silence into the temp file BEFORE you write file1 into it. // put 1/2 second of silence at the begging of our temp file file.InsertSilence(0, file.SecondsToPosition(0.5)); // paste file1 after the leading silence SfAudioSelection aselFile1 = new SfAudioSelection(file1); file.OverwriteAudio(file.Length, 0, file1, aselFile1); // insert 2 seconds of silence after that file.InsertSilence(file.Length, file.SecondsToPosition(2.0)); // paste file2 after that. SfAudioSelection aselFile2 = new SfAudioSelection(file2); file.OverwriteAudio(file.Length, 0, file2, aselFile2); 2. A basic version of this script, that simply takes three files and pastes them together with a 1 second space between each. this is just like the original script, except you have to call file.OverwriteAudio(...) file.InsertSilence(...) file.OverwriteAudio(...) file.InsertSilence(...) file.OverwriteAudio(...) simple. |
Subject:RE: DESPERATELY NEED HELP!
Reply by: Keeba
Date:12/18/2005 10:58:20 PM
Hey TJ - hope you had a nice weekend... Listen - is there a practical limit on the number of lines a script can have in it? I have seeminigly run into that limit, as I have been trying to paste in the second 'constant' set of parameters // list of client files string[] astrClients = new string[] { @"c:\Megatron\Megatron.wav", @"c:\Janeco\Janeco.wav", }; but the copying STOPS at a certain point (truncates itself)? IS there a fix for that. or have I hit the 'wall' on the line limit at 428 lines of code? This raises the wildcard option.......as a question....seems that wouldclear up a bit of the code, if I could set it up to point at *.* files in 'this folder, call them 'x parameter' ( // list of client files string[] astrClients = new string[] { ) and then duplicate that idea for the prompt section...... The question is, can code be written that uses the wilcard option to go through the folders, rather than having to list all the files. This would make the process easier for me as well, if the folder content changes.....and most importantly it seems, because ther eis a practical limit on lines of code. As well, rather than having to add more lines of code, the script will simply process *.* all of the files in the folders. Possible.....o...no? Thanks Message last edited on12/19/2005 10:38:15 AM byKeeba. |
Subject:RE: DESPERATELY NEED HELP!
Reply by: _TJ
Date:12/19/2005 12:08:31 PM
There is no limit on the number of lines. But there is a limit on the total amount of text that the Script Editor can hold. the limit would be about 32K and it's based on the amount of text that Window's allows in an edit control. If you have hit that limit, just edit the script file using another editor (outside sound forge). Then save the file, and run it using the Run Script... command on the main menu. Or Copy the file into the Script Menu folder and it will show up as an item in that menu (and as a potential toolbar button). tj |
Subject:RE: DESPERATELY NEED HELP!
Reply by: _TJ
Date:12/19/2005 12:11:51 PM
As for processing all of the files in a folder, yes that is possible. the basic syntax is string strFoldername = @"c:\Megatron"; string strFilter = "*.wav"; foreach (string strFilename in Directory.GetFiles(strFoldername, strFilter)) { // process strFilename here... } note, that this will be files only. not subfolders. use Directory.GetDirectories(strFoldername, strFilter) to enumate subfolders, then use Directory.GetFiles() on THOSE folders to get the files in them... tj Message last edited on12/19/2005 12:14:33 PM by_TJ. |
Subject:RE: DESPERATELY NEED HELP!
Reply by: Keeba
Date:12/19/2005 12:24:29 PM
GREAT - I will start on that now - let me ask you this.... When compling.....if i get the error Compiler error 0x80004005 on Line 18,2 : Syntax error, '"' expected Does that mean - a ' " ' is EXPECTED in that position? Secondly - if I get an error like Compiler error 0x80004005 on Line 18,2 : Syntax error, expected where there is NOTHING in front of the expected...what does that mean? |
Subject:RE: DESPERATELY NEED HELP!
Reply by: Keeba
Date:12/19/2005 12:37:03 PM
and forgive me for this....but I sem to be having a monday morning block... twice you have mentioned soemthing that has thrown me fora 'loop'... In the syntax you have placed here, (in this instance) I assume that I would include this syntax string at the top fo the script, where string strFilename1 = @"E:\production pieces\tonestuff\wavs\sound_1.wav"; string strMusicBed = @"E:\Templates\pieces\female\female\meat\a_call_coming_in.wav"; string strOutpath = @"E:\ringtones\production pieces\Output"; ...is. So it would look like this..... using System; using System.IO; using System.Windows.Forms; using SoundForge; public class EntryPoint { public void Begin(IScriptableApp app) { string strFoldername = @"E:\production pieces\wavs"; string strFilter = "*.wav"; string strFilename1 = @"E:\production pieces\tonestuff\wavs\sound_1.wav"; string strMusicBed = @"E:\Templates\female\meat\a_call_coming_in.wav"; string strOutpath = @"E:\ringtones\production pieces\Output"; double dGainMusic = SfHelpers.dBToRatio(-3); double dGainMain = SfHelpers.dBToRatio(-3); // list of prompt files. string[] astrPrompts = new string[] { @”E:\female\names\soft\zachcary_\zachcary_.wav”, @”E:\female\names\soft\zach_\zach_.wav”, @”E:\female\names\soft\winston_\winston_.wav”, ..... The most confusing part is where to place the rest of the code.......The foreach (string strFilename in Directory.GetFiles(strFoldername, strFilter)) { // process strFilename here... } ....does that go directly below the other code, or does it go further down the code lines where the OTHER similar statement is.... // open the music bed DPF("Opening {0}", strMusicBed); ISfFileHost file3 = app.OpenFile(strMusicBed, true, true); if (null == file3) return; foreach (string strFilename1 in astrClients) { DPF("Opening {0}", strFilename1); ISfFileHost file1 = app.OpenFile(strFilename1, true, true); if (null == file1) return; ((insert it here????)) foreach (string strFilename2 in astrPrompts) { DPF("Opening {0}", strFilename2); ISfFileHost file2 = app.OpenFile(strFilename2, true, true); if (null == file2) return; finally - the //process strFilename here } ... Where do I place that, and do I need to add the similar ... DPF("Opening {0}", strFilename2); ISfFileHost file2 = app.OpenFile(strFilename2, true, true); if (null == file2) return; ...To the code.....changing the values to represent Filename1? |
Subject:RE: DESPERATELY NEED HELP!
Reply by: Keeba
Date:12/19/2005 1:48:29 PM
Eh hem.....what the heck doe sthe 'Newline in constant' refer to....and what do I do to fix it? ......now........(sorry) By the by....I DID fix the practical limit thing...it turns out there IS a practical character limit, but when I followed your earlier advice and moved folders around the drive to have SHORTER locations, the character limit was fine. I was able to get ALL the lines in, by reducing the path to file extensively. So - that really SINT so much the issue, I think I am more worried now about how to include the snippets of code that you have shown me here. Let me be specific - In your 'outer loop' reply, you posted the following.... // list of client files string[] astrClients = new string[] { @"c:\Megatron\Megatron.wav", @"c:\Janeco\Janeco.wav", }; // list of prompt files. string[] astrPrompts = new string[] { @"c:\Prompts\Stop.wav", @"c:\Prompts\Look.wav", @"c:\Prompts\Listen.wav", }; // open music bed file here, and choose a render template here. foreach (string strFilename1 in astrClients) { // open strFilename1 here foreach (string strFilename2 in astrPrompts) { ....... } // loop back to do the next prompt // close strFilename1 here } // loop back to do the next client Now while I know that this code is split up in pieces and goes in different places, I am a little confused about where .....because like for instance.... The portion.....- ....... @"c:\Prompts\Look.wav", @"c:\Prompts\Listen.wav", }; // open music bed file here, and choose a render template here. foreach (string strFilename1 in astrClients) { // open strFilename1 here foreach (string strFilename2 in astrPrompts) { Tell me this - Should what I end up with look something like this.... ........ @"E:\meat\youve_got_an_im.wav", @"E:\meat\youve_got_an_instant_message.wav", }; // choose a render template for mp3 ISfRenderer rend = app.FindRenderer(null, ".mp3"); ISfGenericPreset tpl = rend.ChooseTemplate(IntPtr.Zero, 0); // ask the user //ISfGenericPreset tpl = rend.GetTemplate("Default Template"); if (null == tpl) return; // open the client file DPF("Opening {0}", strFilename1); ISfFileHost file1 = app.OpenFile(strFilename1, true, true); if (null == file1) return; // open the music bed DPF("Opening {0}", strMusicBed); ISfFileHost file3 = app.OpenFile(strMusicBed, true, true); if (null == file3) return; foreach (string strFilename1 in astrClients) { DPF("Opening {0}", strFilename1); ISfFileHost file1 = app.OpenFile(strFilename1, true, true); if (null == file1) return; foreach (string strFilename2 in astrPrompts) { DPF("Opening {0}", strFilename2); ISfFileHost file2 = app.OpenFile(strFilename2, true, true); if (null == file2) return; ??????????? Second question - IS this what the end loops should appear as ? // close the temp file file.Close(CloseOptions.DiscardChanges); // close file 2 file2.Close(CloseOptions.DiscardChanges); } // loop back to do the next prompt // close strFilename1 here } // loop back to do the next client public void FromSoundForge(IScriptableApp app) { ForgeApp = app; //execution begins here app.SetStatusText(String.Format("Script '{0}' is running.", Script.Name)); Begin(app); app.SetStatusText(String.Format("Script '{0}' is done.", Script.Name)); -------- Now that 'Newline in constant' error is what I get when compiling. Do I need to be more specific for you to understand why it is happenning? Not to beat a dead horse, but this error is holding the whole complining process, and I cant find a reference to that error anywhere.......'help'..... Message last edited on12/19/2005 2:44:59 PM byKeeba. |
Subject:RE: DESPERATELY NEED HELP!
Reply by: _TJ
Date:12/19/2005 3:03:09 PM
newline in constan usually means that you left off the closing quote for a quoted string string strfilename = "fred" // this is fine string strfilename = "fred // this will give you newline in constant error |
Subject:RE: DESPERATELY NEED HELP!
Reply by: Keeba
Date:12/19/2005 3:53:57 PM
// list of prompt files. string[] astrPrompts = new string[] { @"E:\prod\g\fem\meat\a_call_coming_in.wav", ((<<<this is line 296...error below)) @"E:\prod\g\fem\meat\an_important_call_is_on_the_phone.wav", @"E:\prod\g\fem\meat\answer_your_phone.wav", ________ Compiler error 0x80004005 on Line 296,42 : Newline in constant Message last edited on12/19/2005 4:02:24 PM byKeeba. |
Subject:OK - lets start fresh......
Reply by: Keeba
Date:12/19/2005 4:20:44 PM
Look at this code set - and tell me (after you try complining it....) what is wrong.....I didnt think I made adjustements to all of the compiling errors that show up...I am LOST... ----- using System; using System.IO; using System.Windows.Forms; using SoundForge; public class EntryPoint { public void Begin(IScriptableApp app) { // string strFilename1 = string strMusicBed = @"E:\ringtones\production pieces\tonestuff\wavs\sound_1.wav"; string strOutpath = @"E:\ringtones\production pieces\Output"; double dGainMusic = SfHelpers.dBToRatio(-3); double dGainMain = SfHelpers.dBToRatio(-3); // list of client files string[] astrClients = new string[] { @"E:\prod\g\fem\names\zachcary_\zachcary_.wav”, @”E:\prod\g\fem\names\zach_\zach_.wav”, @”E:\prod\g\fem\names\winston_\winston_.wav”, @”E:\prod\g\fem\names\willie_\willie_.wav”, @”E:\prod\g\fem\names\william_\william_.wav”, @”E:\prod\g\fem\names\wesley_\wesley_.wav”, @”E:\prod\g\fem\names\wes_\wes_.wav”, @”E:\prod\g\fem\names\wayne_\wayne_.wav”, @”E:\prod\g\fem\names\warrren_\warrren_.wav”, @”E:\prod\g\fem\names\walter_\walter_.wav”, @”E:\prod\g\fem\names\walt_\walt_.wav”, @”E:\prod\g\fem\names\wade_\wade_.wav”, @”E:\prod\g\fem\names\vladmir_\vladmir_.wav”, @”E:\prod\g\fem\names\vincent_\vincent_.wav”, @”E:\prod\g\fem\names\victor_\victor_.wav”, @”E:\prod\g\fem\names\vernon_\vernon_.wav”, @”E:\prod\g\fem\names\vaughn_\vaughn_.wav”, @”E:\prod\g\fem\names\tyler_\tyler_.wav”, @”E:\prod\g\fem\names\troy_\troy_.wav”, @”E:\prod\g\fem\names\trevor_\trevor_.wav”, @”E:\prod\g\fem\names\travis_\travis_.wav”, @”E:\prod\g\fem\names\tony_\tony_.wav”, @”E:\prod\g\fem\names\tommy_\tommy_.wav”, @”E:\prod\g\fem\names\tom_\tom_.wav”, @”E:\prod\g\fem\names\todd_\todd_.wav”, @”E:\prod\g\fem\names\toby_\toby_.wav”, @”E:\prod\g\fem\names\timothy_\timothy_.wav”, @”E:\prod\g\fem\names\tim_\tim_.wav”, @”E:\prod\g\fem\names\thomas_\thomas_.wav”, @”E:\prod\g\fem\names\theodore_\theodore_.wav”, @”E:\prod\g\fem\names\ted_\ted_.wav”, @”E:\prod\g\fem\names\stu_\stu_.wav”, @”E:\prod\g\fem\names\stewart_\stewart_.wav”, @”E:\prod\g\fem\names\steven_\steven_.wav”, @”E:\prod\g\fem\names\steve_\steve_.wav”, @”E:\prod\g\fem\names\stephan_\stephan_.wav”, @”E:\prod\g\fem\names\stanley_\stanley_.wav”, @”E:\prod\g\fem\names\stan_\stan_.wav”, @”E:\prod\g\fem\names\spencer_\spencer_.wav”, @”E:\prod\g\fem\names\simon_\simon_.wav”, @”E:\prod\g\fem\names\seth_\seth_.wav”, @”E:\prod\g\fem\names\sebastian_\sebastian_.wav”, @”E:\prod\g\fem\names\sean_\sean_.wav”, @”E:\prod\g\fem\names\scott_\scott_.wav”, @”E:\prod\g\fem\names\samuel_\samuel_.wav”, @”E:\prod\g\fem\names\sam_\sam_.wav”, @”E:\prod\g\fem\names\ryan_\ryan_.wav”, @”E:\prod\g\fem\names\russell_\russell_.wav”, @”E:\prod\g\fem\names\russ_\russ_.wav”, @”E:\prod\g\fem\names\roy_\roy_.wav”, @”E:\prod\g\fem\names\ross_\ross_.wav”, @”E:\prod\g\fem\names\rory_\rory_.wav”, @”E:\prod\g\fem\names\ronny_\ronny_.wav”, @”E:\prod\g\fem\names\ronald_\ronald_.wav”, @”E:\prod\g\fem\names\roland_\roland_.wav”, @”E:\prod\g\fem\names\roger_\roger_.wav”, @”E:\prod\g\fem\names\rodney_\rodney_.wav”, @”E:\prod\g\fem\names\rod_\rod_.wav”, @”E:\prod\g\fem\names\roberto_\roberto_.wav”, @”E:\prod\g\fem\names\robert_\robert_.wav”, @”E:\prod\g\fem\names\riley_\riley_.wav”, @”E:\prod\g\fem\names\ricky_\ricky_.wav”, @”E:\prod\g\fem\names\rick_\rick_.wav”, @”E:\prod\g\fem\names\richard_\richard_.wav”, @”E:\prod\g\fem\names\reed_\reed_.wav”, @”E:\prod\g\fem\names\reece_\reece_.wav”, @”E:\prod\g\fem\names\raymond_\raymond_.wav”, @”E:\prod\g\fem\names\ray_\ray_.wav”, @”E:\prod\g\fem\names\randy_\randy_.wav”, @”E:\prod\g\fem\names\randall_\randall_.wav”, @”E:\prod\g\fem\names\ralph_\ralph_.wav”, @”E:\prod\g\fem\names\quinn_\quinn_.wav”, @”E:\prod\g\fem\names\quentin_\quentin_.wav”, @”E:\prod\g\fem\names\pierre_\pierre_.wav”, @”E:\prod\g\fem\names\phillip_\phillip_.wav”, @”E:\prod\g\fem\names\peter_\peter_.wav”, @”E:\prod\g\fem\names\perry_\perry_.wav”, @”E:\prod\g\fem\names\pedro_\pedro_.wav”, @”E:\prod\g\fem\names\paul_\paul_.wav”, @”E:\prod\g\fem\names\patrick_\patrick_.wav”, @”E:\prod\g\fem\names\owen_\owen_.wav”, @”E:\prod\g\fem\names\oscar_\oscar_.wav”, @”E:\prod\g\fem\names\oliver_\oliver_.wav”, @”E:\prod\g\fem\names\norman_\norman_.wav”, @”E:\prod\g\fem\names\nigel_\nigel_.wav”, @”E:\prod\g\fem\names\nick_\nick_.wav”, @”E:\prod\g\fem\names\nicholas_\nicholas_.wav”, @”E:\prod\g\fem\names\neil_\neil_.wav”, @”E:\prod\g\fem\names\nathan_\nathan_.wav”, @”E:\prod\g\fem\names\murray_\murray_.wav”, @”E:\prod\g\fem\names\montel_\montel_.wav”, @”E:\prod\g\fem\names\mohamed_\mohamed_.wav”, @”E:\prod\g\fem\names\miles_\miles_.wav”, @”E:\prod\g\fem\names\mike_\mike_.wav”, @”E:\prod\g\fem\names\miguel_\miguel_.wav”, @”E:\prod\g\fem\names\michael_\michael_.wav”, @”E:\prod\g\fem\names\melvin_\melvin_.wav”, @”E:\prod\g\fem\names\maurice_\maurice_.wav”, @”E:\prod\g\fem\names\matthew_\matthew_.wav”, @”E:\prod\g\fem\names\marvin_\marvin_.wav”, @”E:\prod\g\fem\names\martin_\martin_.wav”, @”E:\prod\g\fem\names\mark_\mark_.wav”, @”E:\prod\g\fem\names\marcus_\marcus_.wav”, @”E:\prod\g\fem\names\manuel_\manuel_.wav”, @”E:\prod\g\fem\names\malcolm_\malcolm_.wav”, @”E:\prod\g\fem\names\mack_\mack_.wav”, @”E:\prod\g\fem\names\lynn_\lynn_.wav”, @”E:\prod\g\fem\names\luke_\luke_.wav”, @”E:\prod\g\fem\names\luis_\luis_.wav”, @”E:\prod\g\fem\names\lucas_\lucas_.wav”, @”E:\prod\g\fem\names\louis_\louis_.wav”, @”E:\prod\g\fem\names\logan_\logan_.wav”, @”E:\prod\g\fem\names\lloyd_\lloyd_.wav”, @”E:\prod\g\fem\names\liam_\liam_.wav”, @”E:\prod\g\fem\names\les_\les_.wav”, @”E:\prod\g\fem\names\leroy_\leroy_.wav”, @”E:\prod\g\fem\names\leonard_\leonard_.wav”, @”E:\prod\g\fem\names\leon_\leon_.wav”, @”E:\prod\g\fem\names\leo_\leo_.wav”, @”E:\prod\g\fem\names\lee_\lee_.wav”, @”E:\prod\g\fem\names\lawerence_\lawerence_.wav”, @”E:\prod\g\fem\names\larry_\larry_.wav”, @”E:\prod\g\fem\names\kyle_\kyle_.wav”, @”E:\prod\g\fem\names\kirin_\kirin_.wav”, @”E:\prod\g\fem\names\khan_\khan_.wav”, @”E:\prod\g\fem\names\kevin_\kevin_.wav”, @”E:\prod\g\fem\names\kev_\kev_.wav”, @”E:\prod\g\fem\names\kenton_\kenton_.wav”, @”E:\prod\g\fem\names\keith_\keith_.wav”, @”E:\prod\g\fem\names\justin_\justin_.wav”, @”E:\prod\g\fem\names\julian_\julian_.wav”, @”E:\prod\g\fem\names\juan_\juan_.wav”, @”E:\prod\g\fem\names\joshua_\joshua_.wav”, @”E:\prod\g\fem\names\josh_\josh_.wav”, @”E:\prod\g\fem\names\joseph_\joseph_.wav”, @”E:\prod\g\fem\names\jose_\jose_.wav”, @”E:\prod\g\fem\names\jorge_\jorge_.wav”, @”E:\prod\g\fem\names\jordan_\jordan_.wav”, @”E:\prod\g\fem\names\johnny_\johnny_.wav”, @”E:\prod\g\fem\names\johnathan_\johnathan_.wav”, @”E:\prod\g\fem\names\john_\john_.wav”, @”E:\prod\g\fem\names\joel_\joel_.wav”, @”E:\prod\g\fem\names\joe_\joe_.wav”, @”E:\prod\g\fem\names\jimmy_\jimmy_.wav”, @”E:\prod\g\fem\names\jim_\jim_.wav”, @”E:\prod\g\fem\names\jesus_\jesus_.wav”, @”E:\prod\g\fem\names\jesse_\jesse_.wav”, @”E:\prod\g\fem\names\jerry_\jerry_.wav”, @”E:\prod\g\fem\names\jerome_\jerome_.wav”, @”E:\prod\g\fem\names\jeremy_\jeremy_.wav”, @”E:\prod\g\fem\names\jeffery_\jeffery_.wav”, @”E:\prod\g\fem\names\jeff_\jeff_.wav”, @”E:\prod\g\fem\names\jean_\jean_.wav”, @”E:\prod\g\fem\names\jay_\jay_.wav”, @”E:\prod\g\fem\names\jason_\jason_.wav”, @”E:\prod\g\fem\names\jared_\jared_.wav”, @”E:\prod\g\fem\names\jamie_\jamie_.wav”, @”E:\prod\g\fem\names\james_\james_.wav”, @”E:\prod\g\fem\names\jacob_\jacob_.wav”, @”E:\prod\g\fem\names\jack_\jack_.wav”, @”E:\prod\g\fem\names\ivan_\ivan_.wav”, @”E:\prod\g\fem\names\issac_\issac_.wav”, @”E:\prod\g\fem\names\ian_\ian_.wav”, @”E:\prod\g\fem\names\hussein_\hussein_.wav”, @”E:\prod\g\fem\names\hugo_\hugo_.wav”, @”E:\prod\g\fem\names\hugh_\hugh_.wav”, @”E:\prod\g\fem\names\howston_\howston_.wav”, @”E:\prod\g\fem\names\howard_\howard_.wav”, @”E:\prod\g\fem\names\herman_\herman_.wav”, @”E:\prod\g\fem\names\herbert_\herbert_.wav”, @”E:\prod\g\fem\names\henry_\henry_.wav”, @”E:\prod\g\fem\names\hector_\hector_.wav”, @”E:\prod\g\fem\names\hayden_\hayden_.wav”, @”E:\prod\g\fem\names\harry_\harry_.wav”, @”E:\prod\g\fem\names\harold_\harold_.wav”, @”E:\prod\g\fem\names\gregory_\gregory_.wav”, @”E:\prod\g\fem\names\greg_\greg_.wav”, @”E:\prod\g\fem\names\graham_\graham_.wav”, @”E:\prod\g\fem\names\gordon_\gordon_.wav”, @”E:\prod\g\fem\names\glen_\glen_.wav”, @”E:\prod\g\fem\names\gerald_\gerald_.wav”, @”E:\prod\g\fem\names\george_\george_.wav”, @”E:\prod\g\fem\names\gene_\gene_.wav”, @”E:\prod\g\fem\names\gavin_\gavin_.wav”, @”E:\prod\g\fem\names\gary_\gary_.wav”, @”E:\prod\g\fem\names\fredrick_\fredrick_.wav”, @”E:\prod\g\fem\names\fred_\fred_.wav”, @”E:\prod\g\fem\names\frasier_\frasier_.wav”, @”E:\prod\g\fem\names\frank_\frank_.wav”, @”E:\prod\g\fem\names\francisco_\francisco_.wav”, @”E:\prod\g\fem\names\francis_\francis_.wav”, @”E:\prod\g\fem\names\flynn_\flynn_.wav”, @”E:\prod\g\fem\names\floyd_\floyd_.wav”, @”E:\prod\g\fem\names\fletcher_\fletcher_.wav”, @”E:\prod\g\fem\names\felix_\felix_.wav”, @”E:\prod\g\fem\names\ewan_\ewan_.wav”, @”E:\prod\g\fem\names\evan_\evan_.wav”, @”E:\prod\g\fem\names\eugene_\eugene_.wav”, @”E:\prod\g\fem\names\ethan_\ethan_.wav”, @”E:\prod\g\fem\names\ernest_\ernest_.wav”, @”E:\prod\g\fem\names\erin_\erin_.wav”, @”E:\prod\g\fem\names\erick_\erick_.wav”, @”E:\prod\g\fem\names\elliot_\elliot_.wav”, @”E:\prod\g\fem\names\ellen_\ellen_.wav”, @”E:\prod\g\fem\names\edwin_\edwin_.wav”, @”E:\prod\g\fem\names\edward_\edward_.wav”, @”E:\prod\g\fem\names\eddie_\eddie_.wav”, @”E:\prod\g\fem\names\earl_\earl_.wav”, @”E:\prod\g\fem\names\dustin_\dustin_.wav”, @”E:\prod\g\fem\names\duncan_\duncan_.wav”, @”E:\prod\g\fem\names\douglas_\douglas_.wav”, @”E:\prod\g\fem\names\donald_\donald_.wav”, @”E:\prod\g\fem\names\don_\don_.wav”, @”E:\prod\g\fem\names\dillon_\dillon_.wav”, @”E:\prod\g\fem\names\derek_\derek_.wav”, @”E:\prod\g\fem\names\dennis_\dennis_.wav”, @”E:\prod\g\fem\names\dechlan_\dechlan_.wav”, @”E:\prod\g\fem\names\dean_\dean_.wav”, @”E:\prod\g\fem\names\david_\david_.wav”, @”E:\prod\g\fem\names\dave_\dave_.wav”, @”E:\prod\g\fem\names\daryl_\daryl_.wav”, @”E:\prod\g\fem\names\danny_\danny_.wav”, @”E:\prod\g\fem\names\daniel_\daniel_.wav”, @”E:\prod\g\fem\names\dan_\dan_.wav”, @”E:\prod\g\fem\names\dale_\dale_.wav”, @”E:\prod\g\fem\names\curtis_\curtis_.wav”, @”E:\prod\g\fem\names\craig_\craig_.wav”, @”E:\prod\g\fem\names\corey_\corey_.wav”, @”E:\prod\g\fem\names\conrad_\conrad_.wav”, @”E:\prod\g\fem\names\connor_\connor_.wav”, @”E:\prod\g\fem\names\colin_\colin_.wav”, @”E:\prod\g\fem\names\clifford_\clifford_.wav”, @”E:\prod\g\fem\names\claude_\claude_.wav”, @”E:\prod\g\fem\names\clark_\clark_.wav”, @”E:\prod\g\fem\names\clarence_\clarence_.wav”, @”E:\prod\g\fem\names\christopher_\christopher_.wav”, @”E:\prod\g\fem\names\christian_\christian_.wav”, @”E:\prod\g\fem\names\chris_\chris_.wav”, @”E:\prod\g\fem\names\charles_\charles_.wav”, @”E:\prod\g\fem\names\chad_\chad_.wav”, @”E:\prod\g\fem\names\carter_\carter_.wav”, @”E:\prod\g\fem\names\carlos_\carlos_.wav”, @”E:\prod\g\fem\names\carlo_\carlo_.wav”, @”E:\prod\g\fem\names\carl_\carl_.wav”, @”E:\prod\g\fem\names\cameron_\cameron_.wav”, @”E:\prod\g\fem\names\calvin_\calvin_.wav”, @”E:\prod\g\fem\names\bruce_\bruce_.wav”, @”E:\prod\g\fem\names\brian_\brian_.wav”, @”E:\prod\g\fem\names\brandon_\brandon_.wav”, @”E:\prod\g\fem\names\bradley_\bradley_.wav”, @”E:\prod\g\fem\names\brad_\brad_.wav”, @”E:\prod\g\fem\names\boris_\boris_.wav”, @”E:\prod\g\fem\names\bobby_\bobby_.wav”, @”E:\prod\g\fem\names\bob_\bob_.wav”, @”E:\prod\g\fem\names\blake_\blake_.wav”, @”E:\prod\g\fem\names\billy_\billy_.wav”, @”E:\prod\g\fem\names\bill_\bill_.wav”, @”E:\prod\g\fem\names\bernard_\bernard_.wav”, @”E:\prod\g\fem\names\benjamin_\benjamin_.wav”, @”E:\prod\g\fem\names\ben_\ben_.wav”, @”E:\prod\g\fem\names\barry_\barry_.wav”, @”E:\prod\g\fem\names\authur_\authur_.wav”, @”E:\prod\g\fem\names\antonio_\antonio_.wav”, @”E:\prod\g\fem\names\anthony_\anthony_.wav”, @”E:\prod\g\fem\names\andy_\andy_.wav”, @”E:\prod\g\fem\names\andrew_\andrew_.wav”, @”E:\prod\g\fem\names\alvin_\alvin_.wav”, @”E:\prod\g\fem\names\allen_\allen_.wav”, @”E:\prod\g\fem\names\alfred_\alfred_.wav”, @”E:\prod\g\fem\names\alexander_\alexander_.wav”, @”E:\prod\g\fem\names\alex_\alex_.wav”, @”E:\prod\g\fem\names\albert_\albert_.wav”, @”E:\prod\g\fem\names\adam_\adam_.wav”, @”E:\prod\g\fem\names\aaron_\aaron_.wav”, }; // list of prompt files. string[] astrPrompts = new string[] { @”E:\prod\g\fem\meat\a_call_coming_in.wav”, @”E:\prod\g\fem\meat\an_important_call_is_on_the_phone.wav”, @”E:\prod\g\fem\meat\answer_your_phone.wav”, @”E:\prod\g\fem\meat\answer_your_phone_someone_is_calling.wav”, @”E:\prod\g\fem\meat\best_friend.wav”, @”E:\prod\g\fem\meat\brother_calling.wav”, @”E:\prod\g\fem\meat\brothers_calling_from_mobile.wav”, @”E:\prod\g\fem\meat\client_calling.wav”, @”E:\prod\g\fem\meat\dad_calling.wav”, @”E:\prod\g\fem\meat\dad_calling_mobile.wav”, @”E:\prod\g\fem\meat\daughter_calling.wav”, @”E:\prod\g\fem\meat\girlfriend_calling.wav”, @”E:\prod\g\fem\meat\got_a_voice_mail.wav”, @”E:\prod\g\fem\meat\grandma_calling.wav”, @”E:\prod\g\fem\meat\grandpa_calling.wav”, @”E:\prod\g\fem\meat\have_text_message.wav”, @”E:\prod\g\fem\meat\its_time_to_wake_up_this_is_your_alarm.wav”, @”E:\prod\g\fem\meat\job_calling.wav”, @”E:\prod\g\fem\meat\mom_calling.wav”, @”E:\prod\g\fem\meat\mom_calling_mobile.wav”, @”E:\prod\g\fem\meat\office_is_calling.wav”, @”E:\prod\g\fem\meat\one_of_your_friends_is_calling.wav”, @”E:\prod\g\fem\meat\one_of_your_workers_is_calling.wav”, @”E:\prod\g\fem\meat\receiving_a_call.wav”, @”E:\prod\g\fem\meat\sisters_calling.wav”, @”E:\prod\g\fem\meat\sisters_calling_from_mobile.wav”, @”E:\prod\g\fem\meat\someone_important_is_calling_you.wav”, @”E:\prod\g\fem\meat\someone_is_calling.wav”, @”E:\prod\g\fem\meat\someone_is_calling_from_home.wav”, @”E:\prod\g\fem\meat\someones_calling_u.wav”, @”E:\prod\g\fem\meat\son_calling.wav”, @”E:\prod\g\fem\meat\that_important_call_is_coming_in.wav”, @”E:\prod\g\fem\meat\the_daycare_is_calling.wav”, @”E:\prod\g\fem\meat\the_school_is_calling.wav”, @”E:\prod\g\fem\meat\the_sitter_is_calling.wav”, @”E:\prod\g\fem\meat\theres_an_emergency_call_coming_in.wav”, @”E:\prod\g\fem\meat\this_is_a_reminder.wav”, @”E:\prod\g\fem\meat\this_is_your_alrm_clock_wake_up.wav”, @”E:\prod\g\fem\meat\you_have_a_call_coming_in.wav”, @”E:\prod\g\fem\meat\you_have_a_call_coming_in_best_friend.wav”, @”E:\prod\g\fem\meat\you_have_a_call_coming_in_from_your_girlfriend.wav”, @”E:\prod\g\fem\meat\you_have_a_call_coming_in_from_your_man.wav”, @”E:\prod\g\fem\meat\your_appointment_is_calling.wav”, @”E:\prod\g\fem\meat\your_best_friend_is_calling.wav”, @”E:\prod\g\fem\meat\your_best_friend_on_phone.wav”, @”E:\prod\g\fem\meat\your_daycare_is_calling.wav”, @”E:\prod\g\fem\meat\your_favorite_person_is_calling.wav”, @”E:\prod\g\fem\meat\your_getting_a_call_from_the_house.wav”, @”E:\prod\g\fem\meat\your_getting_a_call_from_the_office.wav”, @”E:\prod\g\fem\meat\your_girlfriend_is_calling.wav”, @”E:\prod\g\fem\meat\your_honey_is_calling_pick_up.wav”, @”E:\prod\g\fem\meat\your_man_is_calling.wav”, @”E:\prod\g\fem\meat\your_secret_number_is_calling_you.wav”, @”E:\prod\g\fem\meat\your_service_is_calling.wav”, @”E:\prod\g\fem\meat\youre_receiving_an_emergency_call.wav”, @”E:\prod\g\fem\meat\youve_got_a_picture_message.wav”, @”E:\prod\g\fem\meat\youve_got_an_email.wav”, @”E:\prod\g\fem\meat\youve_got_an_im.wav”, @”E:\prod\g\fem\meat\youve_got_an_instant_message.wav”, }; // choose a render template for mp3 ISfRenderer rend = app.FindRenderer(null, ".mp3”}; ISfGenericPreset tpl = rend.ChooseTemplate(IntPtr.Zero, 0); // ask the user //ISfGenericPreset tpl = rend.GetTemplate("Default Template"); if (null == tpl) return; // open the client file DPF("Opening {0}", strFilename1); ISfFileHost file1 = app.OpenFile(strFilename1, true, true); if (null == file1) return; foreach (string strMusicBed in astrClients) { // open the music bed DPF("Opening {0}", strMusicBed); ISfFileHost file3 = app.OpenFile(strMusicBed, true, true); if (null == file3) return; DPF("Opening {0}", strFilename1); ISfFileHost file1 = app.OpenFile(strFilename1, true, true); if (null == file1) return; foreach (string strFilename2 in astrPrompts) { DPF("Opening {0}", strFilename2); ISfFileHost file2 = app.OpenFile(strFilename2, true, true); if (null == file2) return; // make a blank file to mix into. // ISfFileHost file = app.NewFile(file3.DataFormat, true); // paste file3 to the start of the temp file SfAudioSelection aselFile3 = new SfAudioSelection(file3); file.OverwriteAudio(0, 0, file3, aselFile3); // paste file2 at the end of the temp file SfAudioSelection aselFile1 = new SfAudioSelection(file1); file.OverwriteAudio(file.Length, 0, file1, aselFile1); // insert 2 seconds of silence at the end of the temp file file.InsertSilence(file.Length, file.SecondsToPosition(0.2)); // paste file2 at the end of the temp file SfAudioSelection aselFile2 = new SfAudioSelection(file2); file.OverwriteAudio(file.Length, 0, file2, aselFile2); // make an outputfilename string strOutname = Path.GetFileNameWithoutExtension(strFilename1) + "_" + Path.GetFileNameWithoutExtension(strFilename2); string strOutfile = Path.Combine(strOutpath, strOutname + "." + rend.Extension); // save the temp file to the given template RenderOptions ro = RenderOptions.RenderOnly; // this to just render file.SaveAs(strOutfile, rend.Guid, tpl, ro); file.WaitForDoneOrCancel(); // close the temp file file.Close(CloseOptions.DiscardChanges); // close file 2 file2.Close(CloseOptions.DiscardChanges); } // loop back to do the next prompt // close strFilename1 here } // loop back to do the next file. } public void FromSoundForge(IScriptableApp app) { ForgeApp = app; //execution begins here app.SetStatusText(String.Format("Script '{0}' is running.", Script.Name)); Begin(app); app.SetStatusText(String.Format("Script '{0}' is done.", Script.Name)); } public static IScriptableApp ForgeApp = null; public static void DPF(string sz) { ForgeApp.OutputText(sz); } public static void DPF(string fmt, object o) { ForgeApp.OutputText(String.Format(fmt,o)); } public static void DPF(string fmt, object o, object o2) { ForgeApp.OutputText(String.Format(fmt,o,o2)); } public static void DPF(string fmt, object o, object o2, object o3) { ForgeApp.OutputText(String.Format(fmt,o,o2,o3)); } public static string GETARG(string k, string d) { string val = Script.Args.ValueOf(k); if (val == null || val.Length == 0) val = d; return val; } public static int GETARG(string k, int d) { string s = Script.Args.ValueOf(k); if (s == null || s.Length == 0) return d; else return Script.Args.AsInt(k); } public static bool GETARG(string k, bool d) { string s = Script.Args.ValueOf(k); if (s == null || s.Length == 0) return d; else return Script.Args.AsBool(k); } } //EntryPoint |
Subject:RE: OK - lets start fresh......
Reply by: _TJ
Date:12/19/2005 4:56:20 PM
compiler error on line 358 ISfRenderer rend = app.FindRenderer(null, ".mp3”}; the closing quote is NOT A QUOTE. It's a smart quote, unfortunately, the web font is showing them as the same symbol, but if you compare that line with this one ISfRenderer rend = app.FindRenderer(null, ".mp3"}; in the Sound Forge script editor - you will see the difference. Look for quotes that are slanted rather than straight up or down. or if you get an error that you don't see, just delete the quotes and retype them and try again. And this raises a point that hadn't occurred to me. namely: TEXT EDITORS ARE NOT CODE EDITORS. Any editor that is capable of formatting (bold, italic, etc). isn't really safe for use as a code editor, because compilers don't understand formatting, but in text editors, the formatting can be invisible. MS Word can be particularly bad because of it's tendancy to substitute 'smart quotes' for quotes. In windows, you can always use notepad. or the DOS mode EDIT, they will not mess with your text. But MS Word or Wordpad are risky. tj |
Subject:RE: OK - lets start fresh......
Reply by: Keeba
Date:12/19/2005 5:00:05 PM
So I deleted the quotes and retyped them, and now get.... Compiler error 0x80004005 on Line 358,51 : Newline in constant |
Subject:RE: OK - lets start fresh......
Reply by: Keeba
Date:12/19/2005 6:14:46 PM
done. Got it. It is working. Now, I am trying to determine how to get two things to happen. A while ago, it asked me before starting......what MP3 setting I wanted to use. I need that, as I am ending up with much larger files that I want. I need to make subtle adjustments. Lets start there..... Big issue.....it is working. I just need smaller files, and need to have the 'popup ask me to set the mp3 settings..... |
Subject:RE: OK - lets start fresh......
Reply by: Keeba
Date:12/19/2005 6:32:30 PM
Ok how about this one.... I have the script running, and more than half way through, it starts erroring out, telling me that 'THere was an error saving a file" The file doesnt exist or ....." and then I end up clicking ok a million times, until I just shtu the program down and start over. Why would this be happenning IF the files that it is loking for ARE there? Message last edited on12/19/2005 9:05:14 PM byKeeba. |
Subject:RE: OK - lets start fresh......
Reply by: _TJ
Date:12/19/2005 9:05:06 PM
what MP3 setting I wanted to use the script contains a call to rend.ChooseTemplate(IntPtr.Zero, 0); This should show a dialog and ask what MP3 settings (template) to use. Are you saying that you are NOT seeing this dialog? |
Subject:RE: OK - lets start fresh......
Reply by: Keeba
Date:12/19/2005 9:07:36 PM
Nope fixed that.........sorry - I ahve been working my little fingertips off here....and I worked that bug out.....and moved onto get the script running well, until as I mention in the other post here, that it starts the error....and well....i wrote it in the last response.......but it is perplexing.......because the problem is two fold...one, that I cant start from where I left off without editing the script substantially, AND, it is a long running script, so it is a little less than exciting to have to start it all over again....and run it for another 80 minutes......(the time it takes to run the whole set of files...) (sniffle) |
Subject:RE: OK - lets start fresh......
Reply by: _TJ
Date:12/19/2005 9:10:36 PM
Don't let the error details throw you. The first line or two is usually all you need to look at. System.NullReferenceException: Object reference not set to an instance of an object. at SoundForge.ISfFileHost.WaitForDoneOrCancel() So a call to WaitForDoneOrCancel() is being done with a ISfFileHost variable that is null. (i.e. not a valid filehost - usually means that the file failed to open). if you have DPF()'s for each file open, then just look for the last one, and that will tell you where you were when it failed. |
Subject:RE: OK - lets start fresh......
Reply by: Keeba
Date:12/19/2005 9:12:04 PM
I dont wanna sell this bug short - please know that the script ran EXCELLENT for 14 of the 24 leters of the alphabet that it was running through. It was doing perfectly, and then for whatever reason, while grabbing the SAME source files, (was in the middle of a named run.....not that it crapped out at the beginning of a name line, it had done about 15 of the prompts of this particualr name, so all the necessary files WERE in place....and had been used both during the previous runs, as well as the name file which was there, because it had been used for the first 15.....) Help..........(sorry for this extra post, I just wanted you to know that it was not the 'file is actually missing' error.....this is some anomily.....as all the pertinent files were being used throughout the previous part of the script...and worked fine, and this name in particular, had been used for the first 15 prompts, but then started just erroring out.... |
Subject:RE: OK - lets start fresh......
Reply by: Keeba
Date:12/19/2005 9:13:28 PM
I will wait for your response......but I found the last file.....and there are no 'holes' in the file structure......it was running fine previously....with the prompts....and this name as well.....(sorry) |
Subject:RE: OK - lets start fresh......
Reply by: _TJ
Date:12/19/2005 9:16:49 PM
try this. once you know what your output file is going to be called. put a test in that skips making that file if it already exists.. This works better if we move the calculation of the output filename to the top of the loop. foreach (string strFilename2 in astrPrompts) { // make an outputfilename string strOutname = Path.GetFileNameWithoutExtension(strFilename1) + "_" + Path.GetFileNameWithoutExtension(strFilename2); string strOutfile = Path.Combine(strOutpath, strOutname + "." + rend.Extension); if (File.Exists(strOutfile)) { DPF("{0} already exists", strOutfile); continue; } DPF("Opening {0}", strFilename2); ISfFileHost file2 = app.OpenFile(strFilename2, true, true); if (null == file2) return; // make a blank file to mix into. // ISfFileHost file = app.NewFile(file3.DataFormat, true); // paste file3 to the start of the temp file SfAudioSelection aselFile3 = new SfAudioSelection(file3); file.OverwriteAudio(0, 0, file3, aselFile3); // paste file2 at the end of the temp file SfAudioSelection aselFile1 = new SfAudioSelection(file1); file.OverwriteAudio(file.Length, 0, file1, aselFile1); // insert 2 seconds of silence at the end of the temp file file.InsertSilence(file.Length, file.SecondsToPosition(0.2)); // paste file2 at the end of the temp file SfAudioSelection aselFile2 = new SfAudioSelection(file2); file.OverwriteAudio(file.Length, 0, file2, aselFile2); // save the temp file to the given template RenderOptions ro = RenderOptions.RenderOnly; // this to just render file.SaveAs(strOutfile, rend.Guid, tpl, ro); file.WaitForDoneOrCancel(); // close the temp file file.Close(CloseOptions.DiscardChanges); // close file 2 file2.Close(CloseOptions.DiscardChanges); } // loop back to do the next prompt Message last edited on12/19/2005 9:21:05 PM by_TJ. |
Subject:RE: OK - lets start fresh......
Reply by: _TJ
Date:12/19/2005 9:24:09 PM
Help..........(sorry for this extra post, I just wanted you to know that it was not the 'file is actually missing' error.....this is some anomily.....as all the pertinent files were being used throughout the previous part of the script...and worked fine, and this name in particular, had been used for the first 15 prompts, but then started just erroring out.... Now this sounds more like some sort of out-of-resources error. Could be a bug in Sound Forge, or could be the .NET runtime is not letting memory go. Exactly how many output files had you created when it stopped working? Message last edited on12/19/2005 9:24:45 PM by_TJ. |
Subject:RE: OK - lets start fresh......
Reply by: Keeba
Date:12/19/2005 9:26:01 PM
OK - tried it, and it ran through the list, and started up again at the same place, and unfortunately, there is not stop function, so I am unable to stop it and look at the log, I have to shut down the program, and restart it......any suggestions? |
Subject:RE: OK - lets start fresh......
Reply by: Keeba
Date:12/19/2005 9:26:56 PM
we were at 15,128......... |
Subject:RE: OK - lets start fresh......
Reply by: _TJ
Date:12/19/2005 9:30:17 PM
OK - tried it, and it ran through the list, and started up again at the same place, and unfortunately, there is not stop function, so I am unable to stop it and look at the log, I have to shut down the program, and restart it......any suggestions? yes. Incorporate the changes that I posted just a few minutes ago. The script should relatively quickly skip over the files that have already been created and pick up where it left off. When it does, does it still die at the same file? or does it get further? tj |
Subject:RE: OK - lets start fresh......
Reply by: Keeba
Date:12/19/2005 9:32:07 PM
As far as I can tell it is the same file, and then, as I 'click ok' through the files....it just goes on and on.....as if the 'prompt' files dont exist, but of course we know they do, as they were used to create the first 15 thousand files......... Hmmm.... I added that snippet, and it ran through, and did exactly what you said, and died at the same place.... |
Subject:RE: OK - lets start fresh......
Reply by: _TJ
Date:12/19/2005 9:34:05 PM
you could also try changing file.SaveAs(strOutfile, rend.Guid, tpl, ro); to file.RenderAs(strOutfile, rend.Guid, tpl, null, ro); (note the null between tpl & ro in the argument list) tj |
Subject:RE: OK - lets start fresh......
Reply by: _TJ
Date:12/19/2005 9:36:20 PM
I added that snippet, and it ran through, and did exactly what you said, and died at the same place.... are you out of disk space? Maybe there's some reason why you can't put more than 15,000 files in single output folder? what happens if you take the client file that you are failing with out of the list (or just move it to the end)? Message last edited on12/19/2005 9:39:22 PM by_TJ. |
Subject:RE: OK - lets start fresh......
Reply by: Keeba
Date:12/19/2005 9:38:09 PM
Well, that was a thought - I have however had more than 120K files in a folder.......it was VERY resource intensive, but I got em there...... I have received a few resource low messages, and think maybe I should give her a good restart......that may clean out the cobwebs........then, I will come back, try the new snippet code, and report back shortly........ Keeba |
Subject:RE: OK - lets start fresh......
Reply by: Keeba
Date:12/19/2005 9:53:24 PM
Back....and nothing new to report. I am unsure as to why this would be happenning, coming from a reasonably functional compauter background. Listen - here is a big quetson - HOW CAN I STOP THIS PROGRAM without having to shut it all the way down and restart it? |
Subject:RE: OK - lets start fresh......
Reply by: Keeba
Date:12/19/2005 9:57:37 PM
OK - figured it out.......you were right again - for whatever reason, the HD I am putting this all on isnt liking the 15K folder option. So - I am going to move it to my main HD, and move files FRom there to the other location........ I will let you know if this solvees the problem...... |
Subject:RE: OK - lets start fresh......
Reply by: _TJ
Date:12/19/2005 10:12:34 PM
OK - figured it out.......you were right again - for whatever reason, the HD I am putting this all on isnt liking the 15K folder option. So - I am going to move it to my main HD, and move files FRom there to the other location........ are you putting all of the files into the root of the drive? I vaguely remember that the root folder has different max file limits than other folders... |
Subject:RE: OK - lets start fresh......
Reply by: _TJ
Date:12/19/2005 10:15:51 PM
Listen - here is a big quetson - HOW CAN I STOP THIS PROGRAM without having to shut it all the way down and restart it? hit the cancel button at the bottom of Sound Forge sometime when it is showing, that should throw an exception and shut down the script. Message last edited on12/19/2005 10:16:16 PM by_TJ. |
Subject:RE: OK - lets start fresh......
Reply by: Keeba
Date:12/19/2005 10:50:52 PM
Ok - turns out the problem was the proactical limit on the other drive. I have it at the root of the main drive and it is working fine. Problably going to complete its process on 20 K files within the next half hour or so. Thanks TONS. One last question.....(today) How do I stop this thing. If I am in the middle of a run and need to stop it, HOW DO I STOP IT. This beast just goes and goes...and there seems to be no Stop button......? Is there any function I can do to stop it mid-run? Thanks TJ - you have been MORE than a help, and your effort here has changed our business. Salute - and happy new year. |
Subject:RE: OK - lets start fresh......
Reply by: Keeba
Date:12/20/2005 10:06:24 AM
New moment.......new morning.... Ok - it appears that all files that get opened, dont seem to get closed, so there end up being TONS of open files, that all take up resources while open, while the scirpt is running. Is there a way to close a file after it is used. The only files that are left open are the Client files. So I end up with a couple hundred Client name files open when the scirpt is done. AND....they reopen when I reopen the program..... Anyhing>????? |
Subject:RE: OK - lets start fresh......
Reply by: _TJ
Date:12/20/2005 2:02:36 PM
sure, just call ISfFileHost.Close(CloseOptions.DiscardChanges); when you are done with the file. These are the file1's right? so just file1.Close(). at the bottom the the loop where they are opened. tj |
Subject:RE: OK - lets start fresh......
Reply by: Keeba
Date:12/21/2005 12:45:22 PM
TJ - thanks again. Tell me, is there a way to save a wav file to one location and an mp3 (in the same process) to another? |
Subject:RE: OK - lets start fresh......
Reply by: _TJ
Date:12/21/2005 2:46:48 PM
Sure, use file.RenderAs() to save the mp3 first, then file.SaveAs() to save the .wav file. // do this at the top of the script somewhere... ISfRenderer rendWav = app.FindRenderer(null, ".wav"); string strArchivePath = @"c:\Archive"; // save wave files to here... ... put this inside the loop ... // render to mp3 - replace current SaveAs with this... file.RenderAs(strOutfile, rend.Guid, tpl, null, RenderOptions.RenderOnly); file.WaitForDoneOrCancel(); // archive to wave string strArchive = Path.Combine(strArchivePath, strOutname + "." + rendWav.Extension); file.SaveAs(strArchive, rendWav.Guid, "Default Template", RenderOptions.RenderOnly); file.WaitForDoneOrCancel(); file.Close(CloseOptions.DiscardChanges); Message last edited on12/21/2005 2:49:00 PM by_TJ. |
Subject:RE: OK - lets start fresh......
Reply by: Keeba
Date:12/21/2005 5:38:42 PM
TJ - I am getting no WAV output. The script runs through and checks that the mp3s are there, and runs through that list, but then does NO wav archiving.......here is the script... as well, the file1 is not closing...... ------ using System; using System.IO; using System.Windows.Forms; using SoundForge; public class EntryPoint { public void Begin(IScriptableApp app) { // string strFilename1 = string strMusicBed = @"E:\prod\sound_1.wav"; string strOutpath = @"c:\output\female\mp3"; double dGainMusic = SfHelpers.dBToRatio(-3); double dGainMain = SfHelpers.dBToRatio(-3); // list of client files string[] astrClients = new string[] { @"E:\prod\g\fem\names\zachcary_\zachcary_.wav", @"E:\prod\g\fem\names\zach_\zach_.wav", @"E:\prod\g\fem\names\winston_\winston_.wav", @"E:\prod\g\fem\names\willie_\willie_.wav", @"E:\prod\g\fem\names\william_\william_.wav", @"E:\prod\g\fem\names\wesley_\wesley_.wav", @"E:\prod\g\fem\names\wes_\wes_.wav", @"E:\prod\g\fem\names\wayne_\wayne_.wav", @"E:\prod\g\fem\names\warrren_\warrren_.wav", @"E:\prod\g\fem\names\walter_\walter_.wav", @"E:\prod\g\fem\names\walt_\walt_.wav", @"E:\prod\g\fem\names\wade_\wade_.wav", @"E:\prod\g\fem\names\vladmir_\vladmir_.wav", @"E:\prod\g\fem\names\vincent_\vincent_.wav", @"E:\prod\g\fem\names\victor_\victor_.wav", @"E:\prod\g\fem\names\vernon_\vernon_.wav", @"E:\prod\g\fem\names\vaughn_\vaughn_.wav", @"E:\prod\g\fem\names\tyler_\tyler_.wav", @"E:\prod\g\fem\names\troy_\troy_.wav", @"E:\prod\g\fem\names\trevor_\trevor_.wav", @"E:\prod\g\fem\names\travis_\travis_.wav", @"E:\prod\g\fem\names\tony_\tony_.wav", @"E:\prod\g\fem\names\tommy_\tommy_.wav", @"E:\prod\g\fem\names\tom_\tom_.wav", @"E:\prod\g\fem\names\todd_\todd_.wav", @"E:\prod\g\fem\names\toby_\toby_.wav", @"E:\prod\g\fem\names\timothy_\timothy_.wav", @"E:\prod\g\fem\names\tim_\tim_.wav", @"E:\prod\g\fem\names\thomas_\thomas_.wav", @"E:\prod\g\fem\names\theodore_\theodore_.wav", @"E:\prod\g\fem\names\ted_\ted_.wav", @"E:\prod\g\fem\names\stu_\stu_.wav", @"E:\prod\g\fem\names\stewart_\stewart_.wav", @"E:\prod\g\fem\names\steven_\steven_.wav", @"E:\prod\g\fem\names\steve_\steve_.wav", @"E:\prod\g\fem\names\stephan_\stephan_.wav", @"E:\prod\g\fem\names\stanley_\stanley_.wav", @"E:\prod\g\fem\names\stan_\stan_.wav", @"E:\prod\g\fem\names\spencer_\spencer_.wav", @"E:\prod\g\fem\names\simon_\simon_.wav", @"E:\prod\g\fem\names\seth_\seth_.wav", @"E:\prod\g\fem\names\sebastian_\sebastian_.wav", @"E:\prod\g\fem\names\sean_\sean_.wav", @"E:\prod\g\fem\names\scott_\scott_.wav", @"E:\prod\g\fem\names\samuel_\samuel_.wav", @"E:\prod\g\fem\names\sam_\sam_.wav", @"E:\prod\g\fem\names\ryan_\ryan_.wav", @"E:\prod\g\fem\names\russell_\russell_.wav", @"E:\prod\g\fem\names\russ_\russ_.wav", @"E:\prod\g\fem\names\roy_\roy_.wav", @"E:\prod\g\fem\names\ross_\ross_.wav", @"E:\prod\g\fem\names\rory_\rory_.wav", @"E:\prod\g\fem\names\ronny_\ronny_.wav", @"E:\prod\g\fem\names\ronald_\ronald_.wav", @"E:\prod\g\fem\names\roland_\roland_.wav", @"E:\prod\g\fem\names\roger_\roger_.wav", @"E:\prod\g\fem\names\rodney_\rodney_.wav", @"E:\prod\g\fem\names\rod_\rod_.wav", @"E:\prod\g\fem\names\roberto_\roberto_.wav", @"E:\prod\g\fem\names\robert_\robert_.wav", @"E:\prod\g\fem\names\riley_\riley_.wav", @"E:\prod\g\fem\names\ricky_\ricky_.wav", @"E:\prod\g\fem\names\rick_\rick_.wav", @"E:\prod\g\fem\names\richard_\richard_.wav", @"E:\prod\g\fem\names\reed_\reed_.wav", @"E:\prod\g\fem\names\reece_\reece_.wav", @"E:\prod\g\fem\names\raymond_\raymond_.wav", @"E:\prod\g\fem\names\ray_\ray_.wav", @"E:\prod\g\fem\names\randy_\randy_.wav", @"E:\prod\g\fem\names\randall_\randall_.wav", @"E:\prod\g\fem\names\ralph_\ralph_.wav", @"E:\prod\g\fem\names\quinn_\quinn_.wav", @"E:\prod\g\fem\names\quentin_\quentin_.wav", @"E:\prod\g\fem\names\pierre_\pierre_.wav", @"E:\prod\g\fem\names\phillip_\phillip_.wav", @"E:\prod\g\fem\names\peter_\peter_.wav", @"E:\prod\g\fem\names\perry_\perry_.wav", @"E:\prod\g\fem\names\pedro_\pedro_.wav", @"E:\prod\g\fem\names\paul_\paul_.wav", @"E:\prod\g\fem\names\patrick_\patrick_.wav", @"E:\prod\g\fem\names\owen_\owen_.wav", @"E:\prod\g\fem\names\oscar_\oscar_.wav", @"E:\prod\g\fem\names\oliver_\oliver_.wav", @"E:\prod\g\fem\names\norman_\norman_.wav", @"E:\prod\g\fem\names\nigel_\nigel_.wav", @"E:\prod\g\fem\names\nick_\nick_.wav", @"E:\prod\g\fem\names\nicholas_\nicholas_.wav", @"E:\prod\g\fem\names\neil_\neil_.wav", @"E:\prod\g\fem\names\nathan_\nathan_.wav", @"E:\prod\g\fem\names\murray_\murray_.wav", @"E:\prod\g\fem\names\montel_\montel_.wav", @"E:\prod\g\fem\names\mohamed_\mohamed_.wav", @"E:\prod\g\fem\names\miles_\miles_.wav", @"E:\prod\g\fem\names\mike_\mike_.wav", @"E:\prod\g\fem\names\miguel_\miguel_.wav", @"E:\prod\g\fem\names\michael_\michael_.wav", @"E:\prod\g\fem\names\melvin_\melvin_.wav", @"E:\prod\g\fem\names\maurice_\maurice_.wav", @"E:\prod\g\fem\names\matthew_\matthew_.wav", @"E:\prod\g\fem\names\marvin_\marvin_.wav", @"E:\prod\g\fem\names\martin_\martin_.wav", @"E:\prod\g\fem\names\mark_\mark_.wav", @"E:\prod\g\fem\names\marcus_\marcus_.wav", @"E:\prod\g\fem\names\manuel_\manuel_.wav", @"E:\prod\g\fem\names\malcolm_\malcolm_.wav", @"E:\prod\g\fem\names\mack_\mack_.wav", @"E:\prod\g\fem\names\lynn_\lynn_.wav", @"E:\prod\g\fem\names\luke_\luke_.wav", @"E:\prod\g\fem\names\luis_\luis_.wav", @"E:\prod\g\fem\names\lucas_\lucas_.wav", @"E:\prod\g\fem\names\louis_\louis_.wav", @"E:\prod\g\fem\names\logan_\logan_.wav", @"E:\prod\g\fem\names\lloyd_\lloyd_.wav", @"E:\prod\g\fem\names\liam_\liam_.wav", @"E:\prod\g\fem\names\les_\les_.wav", @"E:\prod\g\fem\names\leroy_\leroy_.wav", @"E:\prod\g\fem\names\leonard_\leonard_.wav", @"E:\prod\g\fem\names\leon_\leon_.wav", @"E:\prod\g\fem\names\leo_\leo_.wav", @"E:\prod\g\fem\names\lee_\lee_.wav", @"E:\prod\g\fem\names\lawerence_\lawerence_.wav", @"E:\prod\g\fem\names\larry_\larry_.wav", @"E:\prod\g\fem\names\kyle_\kyle_.wav", @"E:\prod\g\fem\names\kirin_\kirin_.wav", @"E:\prod\g\fem\names\khan_\khan_.wav", @"E:\prod\g\fem\names\kevin_\kevin_.wav", @"E:\prod\g\fem\names\kev_\kev_.wav", @"E:\prod\g\fem\names\kenton_\kenton_.wav", @"E:\prod\g\fem\names\keith_\keith_.wav", @"E:\prod\g\fem\names\justin_\justin_.wav", @"E:\prod\g\fem\names\julian_\julian_.wav", @"E:\prod\g\fem\names\juan_\juan_.wav", @"E:\prod\g\fem\names\joshua_\joshua_.wav", @"E:\prod\g\fem\names\josh_\josh_.wav", @"E:\prod\g\fem\names\joseph_\joseph_.wav", @"E:\prod\g\fem\names\jose_\jose_.wav", @"E:\prod\g\fem\names\jorge_\jorge_.wav", @"E:\prod\g\fem\names\jordan_\jordan_.wav", @"E:\prod\g\fem\names\johnny_\johnny_.wav", @"E:\prod\g\fem\names\johnathan_\johnathan_.wav", @"E:\prod\g\fem\names\john_\john_.wav", @"E:\prod\g\fem\names\joel_\joel_.wav", @"E:\prod\g\fem\names\joe_\joe_.wav", @"E:\prod\g\fem\names\jimmy_\jimmy_.wav", @"E:\prod\g\fem\names\jim_\jim_.wav", @"E:\prod\g\fem\names\jesus_\jesus_.wav", @"E:\prod\g\fem\names\jesse_\jesse_.wav", @"E:\prod\g\fem\names\jerry_\jerry_.wav", @"E:\prod\g\fem\names\jerome_\jerome_.wav", @"E:\prod\g\fem\names\jeremy_\jeremy_.wav", @"E:\prod\g\fem\names\jeffery_\jeffery_.wav", @"E:\prod\g\fem\names\jeff_\jeff_.wav", @"E:\prod\g\fem\names\jean_\jean_.wav", @"E:\prod\g\fem\names\jay_\jay_.wav", @"E:\prod\g\fem\names\jason_\jason_.wav", @"E:\prod\g\fem\names\jared_\jared_.wav", @"E:\prod\g\fem\names\jamie_\jamie_.wav", @"E:\prod\g\fem\names\james_\james_.wav", @"E:\prod\g\fem\names\jacob_\jacob_.wav", @"E:\prod\g\fem\names\jack_\jack_.wav", @"E:\prod\g\fem\names\ivan_\ivan_.wav", @"E:\prod\g\fem\names\issac_\issac_.wav", @"E:\prod\g\fem\names\ian_\ian_.wav", @"E:\prod\g\fem\names\hussein_\hussein_.wav", @"E:\prod\g\fem\names\hugo_\hugo_.wav", @"E:\prod\g\fem\names\hugh_\hugh_.wav", @"E:\prod\g\fem\names\howston_\howston_.wav", @"E:\prod\g\fem\names\howard_\howard_.wav", @"E:\prod\g\fem\names\herman_\herman_.wav", @"E:\prod\g\fem\names\herbert_\herbert_.wav", @"E:\prod\g\fem\names\henry_\henry_.wav", @"E:\prod\g\fem\names\hector_\hector_.wav", @"E:\prod\g\fem\names\hayden_\hayden_.wav", @"E:\prod\g\fem\names\harry_\harry_.wav", @"E:\prod\g\fem\names\harold_\harold_.wav", @"E:\prod\g\fem\names\gregory_\gregory_.wav", @"E:\prod\g\fem\names\greg_\greg_.wav", @"E:\prod\g\fem\names\graham_\graham_.wav", @"E:\prod\g\fem\names\gordon_\gordon_.wav", @"E:\prod\g\fem\names\glen_\glen_.wav", @"E:\prod\g\fem\names\gerald_\gerald_.wav", @"E:\prod\g\fem\names\george_\george_.wav", @"E:\prod\g\fem\names\gene_\gene_.wav", @"E:\prod\g\fem\names\gavin_\gavin_.wav", @"E:\prod\g\fem\names\gary_\gary_.wav", @"E:\prod\g\fem\names\fredrick_\fredrick_.wav", @"E:\prod\g\fem\names\fred_\fred_.wav", @"E:\prod\g\fem\names\frasier_\frasier_.wav", @"E:\prod\g\fem\names\frank_\frank_.wav", @"E:\prod\g\fem\names\francisco_\francisco_.wav", @"E:\prod\g\fem\names\francis_\francis_.wav", @"E:\prod\g\fem\names\flynn_\flynn_.wav", @"E:\prod\g\fem\names\floyd_\floyd_.wav", @"E:\prod\g\fem\names\fletcher_\fletcher_.wav", @"E:\prod\g\fem\names\felix_\felix_.wav", @"E:\prod\g\fem\names\ewan_\ewan_.wav", @"E:\prod\g\fem\names\evan_\evan_.wav", @"E:\prod\g\fem\names\eugene_\eugene_.wav", @"E:\prod\g\fem\names\ethan_\ethan_.wav", @"E:\prod\g\fem\names\ernest_\ernest_.wav", @"E:\prod\g\fem\names\erin_\erin_.wav", @"E:\prod\g\fem\names\erick_\erick_.wav", @"E:\prod\g\fem\names\elliot_\elliot_.wav", @"E:\prod\g\fem\names\ellen_\ellen_.wav", @"E:\prod\g\fem\names\edwin_\edwin_.wav", @"E:\prod\g\fem\names\edward_\edward_.wav", @"E:\prod\g\fem\names\eddie_\eddie_.wav", @"E:\prod\g\fem\names\earl_\earl_.wav", @"E:\prod\g\fem\names\dustin_\dustin_.wav", @"E:\prod\g\fem\names\duncan_\duncan_.wav", @"E:\prod\g\fem\names\douglas_\douglas_.wav", @"E:\prod\g\fem\names\donald_\donald_.wav", @"E:\prod\g\fem\names\don_\don_.wav", @"E:\prod\g\fem\names\dillon_\dillon_.wav", @"E:\prod\g\fem\names\derek_\derek_.wav", @"E:\prod\g\fem\names\dennis_\dennis_.wav", @"E:\prod\g\fem\names\dechlan_\dechlan_.wav", @"E:\prod\g\fem\names\dean_\dean_.wav", @"E:\prod\g\fem\names\david_\david_.wav", @"E:\prod\g\fem\names\dave_\dave_.wav", @"E:\prod\g\fem\names\daryl_\daryl_.wav", @"E:\prod\g\fem\names\danny_\danny_.wav", @"E:\prod\g\fem\names\daniel_\daniel_.wav", @"E:\prod\g\fem\names\dan_\dan_.wav", @"E:\prod\g\fem\names\dale_\dale_.wav", @"E:\prod\g\fem\names\curtis_\curtis_.wav", @"E:\prod\g\fem\names\craig_\craig_.wav", @"E:\prod\g\fem\names\corey_\corey_.wav", @"E:\prod\g\fem\names\conrad_\conrad_.wav", @"E:\prod\g\fem\names\connor_\connor_.wav", @"E:\prod\g\fem\names\colin_\colin_.wav", @"E:\prod\g\fem\names\clifford_\clifford_.wav", @"E:\prod\g\fem\names\claude_\claude_.wav", @"E:\prod\g\fem\names\clark_\clark_.wav", @"E:\prod\g\fem\names\clarence_\clarence_.wav", @"E:\prod\g\fem\names\christopher_\christopher_.wav", @"E:\prod\g\fem\names\christian_\christian_.wav", @"E:\prod\g\fem\names\chris_\chris_.wav", @"E:\prod\g\fem\names\charles_\charles_.wav", @"E:\prod\g\fem\names\chad_\chad_.wav", @"E:\prod\g\fem\names\carter_\carter_.wav", @"E:\prod\g\fem\names\carlos_\carlos_.wav", @"E:\prod\g\fem\names\carlo_\carlo_.wav", @"E:\prod\g\fem\names\carl_\carl_.wav", @"E:\prod\g\fem\names\cameron_\cameron_.wav", @"E:\prod\g\fem\names\calvin_\calvin_.wav", @"E:\prod\g\fem\names\bruce_\bruce_.wav", @"E:\prod\g\fem\names\brian_\brian_.wav", @"E:\prod\g\fem\names\brandon_\brandon_.wav", @"E:\prod\g\fem\names\bradley_\bradley_.wav", @"E:\prod\g\fem\names\brad_\brad_.wav", @"E:\prod\g\fem\names\boris_\boris_.wav", @"E:\prod\g\fem\names\bobby_\bobby_.wav", @"E:\prod\g\fem\names\bob_\bob_.wav", @"E:\prod\g\fem\names\blake_\blake_.wav", @"E:\prod\g\fem\names\billy_\billy_.wav", @"E:\prod\g\fem\names\bill_\bill_.wav", @"E:\prod\g\fem\names\bernard_\bernard_.wav", @"E:\prod\g\fem\names\benjamin_\benjamin_.wav", @"E:\prod\g\fem\names\ben_\ben_.wav", @"E:\prod\g\fem\names\barry_\barry_.wav", @"E:\prod\g\fem\names\authur_\authur_.wav", @"E:\prod\g\fem\names\antonio_\antonio_.wav", @"E:\prod\g\fem\names\anthony_\anthony_.wav", @"E:\prod\g\fem\names\andy_\andy_.wav", @"E:\prod\g\fem\names\andrew_\andrew_.wav", @"E:\prod\g\fem\names\alvin_\alvin_.wav", @"E:\prod\g\fem\names\allen_\allen_.wav", @"E:\prod\g\fem\names\alfred_\alfred_.wav", @"E:\prod\g\fem\names\alexander_\alexander_.wav", @"E:\prod\g\fem\names\alex_\alex_.wav", @"E:\prod\g\fem\names\albert_\albert_.wav", @"E:\prod\g\fem\names\adam_\adam_.wav", @"E:\prod\g\fem\names\aaron_\aaron_.wav", }; // list of prompt files. string[] astrPrompts = new string[] { @"E:\prod\g\fem\meat\a_call_coming_in.wav", @"E:\prod\g\fem\meat\an_important_call_is_on_the_phone.wav", @"E:\prod\g\fem\meat\answer_your_phone.wav", @"E:\prod\g\fem\meat\answer_your_phone_someone_is_calling.wav", @"E:\prod\g\fem\meat\best_friend.wav", @"E:\prod\g\fem\meat\brother_calling.wav", @"E:\prod\g\fem\meat\brothers_calling_from_mobile.wav", @"E:\prod\g\fem\meat\client_calling.wav", @"E:\prod\g\fem\meat\dad_calling.wav", @"E:\prod\g\fem\meat\dad_calling_mobile.wav", @"E:\prod\g\fem\meat\daughter_calling.wav", @"E:\prod\g\fem\meat\girlfriend_calling.wav", @"E:\prod\g\fem\meat\got_a_voice_mail.wav", @"E:\prod\g\fem\meat\grandma_calling.wav", @"E:\prod\g\fem\meat\grandpa_calling.wav", @"E:\prod\g\fem\meat\have_text_message.wav", @"E:\prod\g\fem\meat\its_time_to_wake_up_this_is_your_alarm.wav", @"E:\prod\g\fem\meat\job_calling.wav", @"E:\prod\g\fem\meat\mom_calling.wav", @"E:\prod\g\fem\meat\mom_calling_mobile.wav", @"E:\prod\g\fem\meat\office_is_calling.wav", @"E:\prod\g\fem\meat\one_of_your_friends_is_calling.wav", @"E:\prod\g\fem\meat\one_of_your_workers_is_calling.wav", @"E:\prod\g\fem\meat\receiving_a_call.wav", @"E:\prod\g\fem\meat\sisters_calling.wav", @"E:\prod\g\fem\meat\sisters_calling_from_mobile.wav", @"E:\prod\g\fem\meat\someone_important_is_calling_you.wav", @"E:\prod\g\fem\meat\someone_is_calling.wav", @"E:\prod\g\fem\meat\someone_is_calling_from_home.wav", @"E:\prod\g\fem\meat\someones_calling_u.wav", @"E:\prod\g\fem\meat\son_calling.wav", @"E:\prod\g\fem\meat\that_important_call_is_coming_in.wav", @"E:\prod\g\fem\meat\the_daycare_is_calling.wav", @"E:\prod\g\fem\meat\the_school_is_calling.wav", @"E:\prod\g\fem\meat\the_sitter_is_calling.wav", @"E:\prod\g\fem\meat\theres_an_emergency_call_coming_in.wav", @"E:\prod\g\fem\meat\this_is_a_reminder.wav", @"E:\prod\g\fem\meat\this_is_your_alrm_clock_wake_up.wav", @"E:\prod\g\fem\meat\you_have_a_call_coming_in.wav", @"E:\prod\g\fem\meat\you_have_a_call_coming_in_best_friend.wav", @"E:\prod\g\fem\meat\you_have_a_call_coming_in_from_your_girlfriend.wav", @"E:\prod\g\fem\meat\you_have_a_call_coming_in_from_your_man.wav", @"E:\prod\g\fem\meat\your_appointment_is_calling.wav", @"E:\prod\g\fem\meat\your_best_friend_is_calling.wav", @"E:\prod\g\fem\meat\your_best_friend_on_phone.wav", @"E:\prod\g\fem\meat\your_daycare_is_calling.wav", @"E:\prod\g\fem\meat\your_favorite_person_is_calling.wav", @"E:\prod\g\fem\meat\your_getting_a_call_from_the_house.wav", @"E:\prod\g\fem\meat\your_getting_a_call_from_the_office.wav", @"E:\prod\g\fem\meat\your_girlfriend_is_calling.wav", @"E:\prod\g\fem\meat\your_honey_is_calling_pick_up.wav", @"E:\prod\g\fem\meat\your_man_is_calling.wav", @"E:\prod\g\fem\meat\your_secret_number_is_calling_you.wav", @"E:\prod\g\fem\meat\your_service_is_calling.wav", @"E:\prod\g\fem\meat\youre_receiving_an_emergency_call.wav", @"E:\prod\g\fem\meat\youve_got_a_picture_message.wav", @"E:\prod\g\fem\meat\youve_got_an_email.wav", @"E:\prod\g\fem\meat\youve_got_an_im.wav", @"E:\prod\g\fem\meat\youve_got_an_instant_message.wav", }; ISfRenderer rend = app.FindRenderer(null, ".mp3"); ISfRenderer rendWav = app.FindRenderer(null, ".wav"); string strArchivePath = @"c:\output/female/wav"; // save wave files to here... ISfGenericPreset tpl = rend.ChooseTemplate(IntPtr.Zero, 0); if (null == tpl) return; // open the sound file DPF("Opening {0}", strMusicBed); ISfFileHost file3 = app.OpenFile(strMusicBed, true, true); if (null == file3) return; foreach (string strFilename1 in astrClients) { DPF("Opening {0}", strFilename1); ISfFileHost file1 = app.OpenFile(strFilename1, true, true); if (null == file1) return; foreach (string strFilename2 in astrPrompts) { // make an outputfilename string strOutname = Path.GetFileNameWithoutExtension(strFilename1) + "_" + Path.GetFileNameWithoutExtension(strFilename2); string strOutfile = Path.Combine(strOutpath, strOutname + "." + rend.Extension); if (File.Exists(strOutfile)) { DPF("{0} already exists", strOutfile); continue; } DPF("Opening {0}", strFilename2); ISfFileHost file2 = app.OpenFile(strFilename2, true, true); if (null == file2) return; // make a blank file to mix into. // ISfFileHost file = app.NewFile(file3.DataFormat, true); // paste file3 to the start of the temp file SfAudioSelection aselFile3 = new SfAudioSelection(file3); file.OverwriteAudio(0, 0, file3, aselFile3); // paste file2 at the end of the temp file SfAudioSelection aselFile1 = new SfAudioSelection(file1); file.OverwriteAudio(file.Length, 0, file1, aselFile1); // insert 2 seconds of silence at the end of the temp file file.InsertSilence(file.Length, file.SecondsToPosition(0.2)); // paste file2 at the end of the temp file SfAudioSelection aselFile2 = new SfAudioSelection(file2); file.OverwriteAudio(file.Length, 0, file2, aselFile2); // save the temp file to the given template RenderOptions ro = RenderOptions.RenderOnly; // this to just render file.SaveAs(strOutfile, rend.Guid, tpl, ro); file.WaitForDoneOrCancel(); // render to mp3 - replace current SaveAs with this... file.RenderAs(strOutfile, rend.Guid, tpl, null, RenderOptions.RenderOnly); file.WaitForDoneOrCancel(); // archive to wave string strArchive = Path.Combine(strArchivePath, strOutname + "." + rendWav.Extension); file.SaveAs(strArchive, rendWav.Guid, "Default Template", RenderOptions.RenderOnly); file.WaitForDoneOrCancel(); // close the temp file file.Close(CloseOptions.DiscardChanges); // close file 2 file2.Close(CloseOptions.DiscardChanges); // close file 1 file1.Close(CloseOptions.DiscardChanges); } // loop back to do the next prompt // close strFilename1 here } // loop back to do the next file. } public void FromSoundForge(IScriptableApp app) { ForgeApp = app; //execution begins here app.SetStatusText(String.Format("Script '{0}' is running.", Script.Name)); Begin(app); app.SetStatusText(String.Format("Script '{0}' is done.", Script.Name)); } public static IScriptableApp ForgeApp = null; public static void DPF(string sz) { ForgeApp.OutputText(sz); } public static void DPF(string fmt, object o) { ForgeApp.OutputText(String.Format(fmt,o)); } public static void DPF(string fmt, object o, object o2) { ForgeApp.OutputText(String.Format(fmt,o,o2)); } public static void DPF(string fmt, object o, object o2, object o3) { ForgeApp.OutputText(String.Format(fmt,o,o2,o3)); } public static string GETARG(string k, string d) { string val = Script.Args.ValueOf(k); if (val == null || val.Length == 0) val = d; return val; } public static int GETARG(string k, int d) { string s = Script.Args.ValueOf(k); if (s == null || s.Length == 0) return d; else return Script.Args.AsInt(k); } public static bool GETARG(string k, bool d) { string s = Script.Args.ValueOf(k); if (s == null || s.Length == 0) return d; else return Script.Args.AsBool(k); } } //EntryPoint tell me oh wise one......what do you glean from this garble....that i have destroyed... :) |
Subject:RE: OK - lets start fresh......
Reply by: _TJ
Date:12/21/2005 6:35:58 PM
You inner loop now contains this... // save the temp file to the given template RenderOptions ro = RenderOptions.RenderOnly; // this to just render file.SaveAs(strOutfile, rend.Guid, tpl, ro); file.WaitForDoneOrCancel(); // render to mp3 - replace current SaveAs with this... file.RenderAs(strOutfile, rend.Guid, tpl, null, RenderOptions.RenderOnly); file.WaitForDoneOrCancel(); // archive to wave string strArchive = Path.Combine(strArchivePath, strOutname + "." + rendWav.Extension); file.SaveAs(strArchive, rendWav.Guid, "Default Template", RenderOptions.RenderOnly); file.WaitForDoneOrCancel(); That's TWO calls to file.SaveAs(), and one to file.RenderAs(). the first one file.SaveAs(strOutfile, rend.Guid, tpl, ro); Saves the file as .MP3. This has the effect of converting the file to an mp3 file. (which is what SaveAs means - essentially convert to this format and the close the original file and open the new file - Try using SaveAs... from the File menu to see what I mean. ) Then you have file.RenderAs(strOutfile, rend.Guid, tpl, null, RenderOptions.RenderOnly); which is an attempt to render the file to mp3 again. So basically this is an attempt to render the file over itself, off the top of my head I have no idea how Sound Forge will behave in this case, but it can't be good. Then finally you have file.SaveAs(strArchive, rendWav.Guid, "Default Template", RenderOptions.RenderOnly); which is an attempt to save the file - that has already been converted to .mp3 with all of the loss of fidelity that that entails - as a .wav file. So even if you get .wav files, the would be decimated in quality. Please, if you are going to be scripting, you have to start reading the code and trying to make sense of it. Now, as to your problem of not getting wave files. It's probably this--- if (File.Exists(strOutfile)) { DPF("{0} already exists", strOutfile); continue; } Which basically says that if the .MP3 file already exists, skip the rest of the code in the loop. We do this so that we won't try and re-create the .mp3, but it will have the effect of not creating anything at all if the .mp3 exists - so no .wav file. tj Message last edited on12/21/2005 6:47:57 PM by_TJ. |
Subject:RE: OK - lets start fresh......
Reply by: Keeba
Date:12/21/2005 8:14:32 PM
Ok - first off, I have been reading code for days now, and while some of it makes sense, you should be clear that I am by NO means, a programmer, nor, have I ever had the intent on becoming a programmer, however, my business dictated that I use this program, and as such, I now had to learn SOME of it. But be clear TJ - reading this code, and trying to make sense of it, is all that I have been doing for days......ALL.....I tell ya.....ALL. Now, as for the duplication in efforts you mention, as you explain them, of course they make sense......but do you honestly remember the time BEFORE you understood this stuff.......would reading it over and over again......really have helped, or likely just confused a bit more. Sure, I am an educated old school Microsoft Cert. Pro, and long time web expert, but jeez......THIS stuff is truly 'another language', and it aint easy for a fella like me. Now can I assume (laughing in the back of my head thinking "could I really have caught those....as many times as I read throug hthe code") that I need to remove the duplicated efforts an statements, so that they trim to a functional process where the wav file is crated first, then the mp3 FROM it, and so on......? I think this old timer can whip a thing or two together....... Thanks |
Subject:RE: OK - lets start fresh......
Reply by: _TJ
Date:12/21/2005 8:49:24 PM
Sorry about that, I don't actually remember not being able to read code, and it really is another language. On the other hand, the bits of code pretty much do what they say, and while I can understand why you wouldn't get the arcane use of the SfAudioSelection object, file.SaveAs() should be clear enough. You don't really have to understand everything you see in order to begin to understand the code. The key is to realize that careful, logical analysis will always lead you to undertanding. And if that doesn't work, use the DPF() function to print out what is going on and then apply logical analysis to the resulting log. Oh, and if you spend hours without making any progress, walk away from a while. A lot of times when you spend too much time with a piece of code (or prose for that matter) you begin to see what you expect to be there rather than what actually is there. fresh eyes can often solve problems in seconds when the problem is something simple like this. So - To make this script work all you really need to do is to delete the first SaveAs(), since it basically creates the same file that the RenderAs() does. you can RenderAs() as many times as you like without changing the file that you are rendering FROM. RenderAs() makes a NEW file, while SaveAs() makes the CURRENT file into a different one. Or you can, as you suggest change the code to create the wave first, and then the mp3 from it. For that matter, you can create the wav ONLY and then use the Sound Forge Batch Converter to create the .mp3's from the .wav's. By the way, I see another problem, if you look down at the bottom of the loop you have this // close file 2 file2.Close(CloseOptions.DiscardChanges); // close file 1 file1.Close(CloseOptions.DiscardChanges); } // loop back to do the next prompt // close strFilename1 here } // loop back to do the next file. Notice that file1 is getting closed INSIDE the inner loop, The comment "close strFilename1 here" is where the file1 should be getting closed. The way I read this, this code will mix file1 with one of the prompt files, then file1 will get closed, and then the loop will attempt to use the closed file1 another 59 times. I'm surprised that this is not crashing on the second time through the inner loop. tj Message last edited on12/21/2005 8:53:52 PM by_TJ. |
Subject:RE: OK - lets start fresh......
Reply by: Keeba
Date:1/16/2006 4:23:56 PM
TJ - hope your holidays were good! Mine....well, spent working, and running these scripts. That is why I am back....to ask a quick question.... Can you instruct me please, on how to insert file2 (in selection below) into the 'file' at the two second mark. In other words, rather than having the script insert file2 at the end of the temp file, I would like it to place file2 at the two second mark. ------ // make a blank file to mix into. // ISfFileHost file = app.NewFile(file3.DataFormat, true); // paste file3 to the start of the temp file SfAudioSelection aselFile3 = new SfAudioSelection(file3); file.OverwriteAudio(0, 0, file3, aselFile3); // paste file2 at the end of the temp file SfAudioSelection aselFile1 = new SfAudioSelection(file1); file.OverwriteAudio(file.Length, 0, file1, aselFile1); // insert 2 seconds of silence at the end of the temp file file.InsertSilence(file.Length, file.SecondsToPosition(0.2)); // paste file2 at the end of the temp file SfAudioSelection aselFile2 = new SfAudioSelection(file2); file.OverwriteAudio(file.Length, 0, file2, aselFile2); // save the temp file to the given template RenderOptions ro = RenderOptions.RenderOnly; // this to just render file.SaveAs(strOutfile, rend.Guid, tpl, ro); file.WaitForDoneOrCancel(); // close the temp file file.Close(CloseOptions.DiscardChanges); ------------ Secondly, you mentioned a while ago, that I would have to adjust the gain and such, but when I did, I got no discernable changes. What would I need to change to lower the music bed gain, so that file2 and file3 are louder than the music bed (by a bit...) Thanks, and again, hope '06 is being good to you.... Akiba |
Subject:RE: OK - lets start fresh......
Reply by: Keeba
Date:1/17/2006 11:21:41 AM
Sniffle.....Sniffle.....TJ.....are you there......? Anywhere.........? |
Subject:RE: OK - lets start fresh......
Reply by: _TJ
Date:1/18/2006 6:24:02 PM
The first argument to file.OverwriteAudio() is the place in the output to start at. so just use Int64 ccStart = file.SecondsToPosition(2.0); file.OverwriteAudio(ccStart, ...); instead of file.OverwriteAudio(file.Length, ...) there is no file.InsertAudio() method. but it can be trivially implemented but just using file.InsertSilence() followed by file.OverwriteAudio() using the same start and lenght in both cases. |
Subject:RE: OK - lets start fresh......
Reply by: Keeba
Date:1/18/2006 10:09:17 PM
This works well, however, I noticed a discernable drop in the 'bed' file, when the other files were inserted, then the bed file would re-emerge. Is that because of layering ....or what? |
Subject:RE: OK - lets start fresh......
Reply by: Keeba
Date:1/19/2006 10:04:58 AM
What is this error.......I have gotten it a couple of times, and it is stopping the process from completing.. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object. at SoundForge.ISfFileHost.WaitForDoneOrCancel() at EntryPoint.Begin(IScriptableApp app) at EntryPoint.FromSoundForge(IScriptableApp app) --- End of inner exception stack trace --- |
Subject:RE: OK - lets start fresh......
Reply by: _TJ
Date:1/19/2006 12:14:29 PM
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object. at SoundForge.ISfFileHost.WaitForDoneOrCancel() this means that one of your file objects is null, which usually means that the app.OpenFile() call failed, and you went and tried to use the null file object that it returned. put a test for null after app.OpenFile() and have it skip that file. string strFilename; ISfFileHost file = app.OpenFile(strFilename, ...); if (null == file) { DPF("the file {0} failed to open", strFilename); continue; // go on to the next item in the foreach loop } |
Subject:RE: OK - lets start fresh......
Reply by: Keeba
Date:1/20/2006 10:18:19 AM
I will definately give this a try, however let me say, for your consideration....this happens NOT at the start of the script, but after it has been running for a while......a few THOUSAND in. It is a good thing that you gave me that snippet that checks for laready done files.........but each time it craps out at around the same place, but it is in the middle of the operation......does that tell you anything more about what this may be.....? I will add the Null skip now... |
Subject:RE: OK - lets start fresh......
Reply by: Keeba
Date:1/20/2006 11:30:24 AM
(getting frustrated).... I waited just a second before adding the null skip, because I am wondering, how can there be null file result, if the file has laready been used (just second previously). I am totally confused, as I could understand the null problem if it were running the FIRST pass, and found a file missing, but this is after the process has been running, and gets to a certain point...and just spits out the null error. I dont do ANYTHING while the program is running, no file deleting, no moving, no nothing....but still, just in the middle, it craps out. Anything....? Very frustrated.... But thankful........and appreciative |
Subject:RE: OK - lets start fresh......
Reply by: _TJ
Date:1/20/2006 3:07:24 PM
Ok, if you were part way though processing a file when this exception occured, then it may not be a null file object. It could be that the processing operation itself is erroring out. System.NullReferenceException: Object reference not set to an instance of an object. at SoundForge.ISfFileHost.WaitForDoneOrCancel() tells you exactly what method we were in and what the problem was. but unfortunately Object reference not set to an instance of an object is a pretty much catch-all error message. It usually just means that you tried to use a method off a null object (in this case the file object). but you can also get this error if processing crashed, or if the file was object was deleted while you were inside WaitForDoneOrCancel(). So the next thing to do is to figure out which file it is, and take that file out of the processing folder. If you skip that file, do we just die on the next file? or does it run to completion - or get further and then die.? This will tell us if the problem is that something related to that file, or to the fact that we have 1000 files under our belt. trial and error is watchword at this point. we need more data in order to figure out how to fix/work around the problem. tj |
Subject:RE: OK - lets start fresh......
Reply by: Keeba
Date:1/23/2006 10:39:41 AM
It has to be an application error, because it happens arbitrarily. I have commented out the files that the script STOPS on, to skip them, and it does, but then will crap out elsewhere. Then, sometimes, I can close out the files that are left open, and start again, and it will finish. Interesting note, when I re-comment (for lack of a better term....when I remove the 'comment out' slashes) the script will crap out on that file again. Then, I went through and checked the files themselves, and they are fine, absolutely comparable to the files just before and after IT (same bit rate, comparession etc), but for whatever reason, I cant get a full run to go through. This is a sample of the script I am using....look through it if you can (without laughing too hard) and tell me what could be wrong with it.... Tell me as well, is there an application limit of any kind that may cause this...? I do know that it was not happenning initially. In fact, it was working just fine, until I started trying to mix (have taken that part of the script OUT - STILL problems). Now, I cant get a full run to complete. VERY frustrating... anyhow...heres the script... using System; using System.IO; using System.Windows.Forms; using SoundForge; public class EntryPoint { public void Begin(IScriptableApp app) { // string strFilename1 = string strMusicBed = @"E:\prod\fast_drums.wav"; string strOutpath = @"c:\output\drums"; double dGainMusic = SfHelpers.dBToRatio(-3); double dGainMain = SfHelpers.dBToRatio(-3); // list of client files string[] astrClients = new string[] { @"E:\prod\g\male\names\agnes_\agnes_.wav", @"E:\prod\g\male\names\ahna_\ahna_.wav", @"E:\prod\g\male\names\alani_\alani_.wav", @"E:\prod\g\male\names\alice_\alice_.wav", @"E:\prod\g\male\names\alicia_\alicia_.wav", @"E:\prod\g\male\names\alise_\alise_.wav", @"E:\prod\g\male\names\alisha_\alisha_.wav", @"E:\prod\g\male\names\allison_\allison_.wav", @"E:\prod\g\male\names\alma_\alma_.wav", @"E:\prod\g\male\names\amanda_\amanda_.wav", @"E:\prod\g\male\names\amber_\amber_.wav", @"E:\prod\g\male\names\amy_\amy_.wav", @"E:\prod\g\male\names\andrea_\andrea_.wav", @"E:\prod\g\male\names\andreea_\andreea_.wav", @"E:\prod\g\male\names\angela_\angela_.wav", @"E:\prod\g\male\names\anita_\anita_.wav", @"E:\prod\g\male\names\ann_\ann_.wav", @"E:\prod\g\male\names\anna_\anna_.wav", @"E:\prod\g\male\names\annette_\annette_.wav", @"E:\prod\g\male\names\annie_\annie_.wav", @"E:\prod\g\male\names\april_\april_.wav", @"E:\prod\g\male\names\arlene_\arlene_.wav", @"E:\prod\g\male\names\ashley_\ashley_.wav", @"E:\prod\g\male\names\audrey_\audrey_.wav", @"E:\prod\g\male\names\ava_\ava_.wav", @"E:\prod\g\male\names\barbara_\barbara_.wav", @"E:\prod\g\male\names\beatrice_\beatrice_.wav", @"E:\prod\g\male\names\becky_\becky_.wav", @"E:\prod\g\male\names\bernice_\bernice_.wav", @"E:\prod\g\male\names\bertha_\bertha_.wav", @"E:\prod\g\male\names\bessie_\bessie_.wav", @"E:\prod\g\male\names\beth_\beth_.wav", @"E:\prod\g\male\names\betty_\betty_.wav", @"E:\prod\g\male\names\beverly_\beverly_.wav", @"E:\prod\g\male\names\bonnie_\bonnie_.wav", @"E:\prod\g\male\names\brenda_\brenda_.wav", @"E:\prod\g\male\names\briahna_\briahna_.wav", @"E:\prod\g\male\names\briana_\briana_.wav", @"E:\prod\g\male\names\brittany_\brittany_.wav", @"E:\prod\g\male\names\carla_\carla_.wav", @"E:\prod\g\male\names\carmen_\carmen_.wav", @"E:\prod\g\male\names\carol_\carol_.wav", @"E:\prod\g\male\names\carolyn_\carolyn_.wav", @"E:\prod\g\male\names\chantelle_\chantelle_.wav", @"E:\prod\g\male\names\charlene_\charlene_.wav", @"E:\prod\g\male\names\charlotte_\charlotte_.wav", @"E:\prod\g\male\names\cheryl_\cheryl_.wav", @"E:\prod\g\male\names\christina_\christina_.wav", @"E:\prod\g\male\names\christine_\christine_.wav", @"E:\prod\g\male\names\clara_\clara_.wav", @"E:\prod\g\male\names\claudia_\claudia_.wav", @"E:\prod\g\male\names\colleen_\colleen_.wav", @"E:\prod\g\male\names\connie_\connie_.wav", @"E:\prod\g\male\names\constance_\constance_.wav", @"E:\prod\g\male\names\crystal_\crystal_.wav", @"E:\prod\g\male\names\cyndi_\cyndi_.wav", @"E:\prod\g\male\names\cynthia_\cynthia_.wav", @"E:\prod\g\male\names\daisy_\daisy_.wav", @"E:\prod\g\male\names\dallas_\dallas_.wav", @"E:\prod\g\male\names\dana_\dana_.wav", @"E:\prod\g\male\names\danielle_\danielle_.wav", @"E:\prod\g\male\names\darcy_\darcy_.wav", @"E:\prod\g\male\names\darlene_\darlene_.wav", @"E:\prod\g\male\names\dawn_\dawn_.wav", @"E:\prod\g\male\names\debbie_\debbie_.wav", @"E:\prod\g\male\names\deborah_\deborah_.wav", @"E:\prod\g\male\names\delores_\delores_.wav", @"E:\prod\g\male\names\denise_\denise_.wav", @"E:\prod\g\male\names\desiree_\desiree_.wav", @"E:\prod\g\male\names\diana_\diana_.wav", @"E:\prod\g\male\names\diane_\diane_.wav", @"E:\prod\g\male\names\donna_\donna_.wav", @"E:\prod\g\male\names\doris_\doris_.wav", @"E:\prod\g\male\names\dorothy_\dorothy_.wav", @"E:\prod\g\male\names\edith_\edith_.wav", @"E:\prod\g\male\names\edna_\edna_.wav", @"E:\prod\g\male\names\egypt_\egypt_.wav", @"E:\prod\g\male\names\eileen_\eileen_.wav", @"E:\prod\g\male\names\elaine_\elaine_.wav", @"E:\prod\g\male\names\elanor_\elanor_.wav", @"E:\prod\g\male\names\elizabeth_\elizabeth_.wav", @"E:\prod\g\male\names\ella_\ella_.wav", @"E:\prod\g\male\names\ellen_\ellen_.wav", @"E:\prod\g\male\names\elsie_\elsie_.wav", @"E:\prod\g\male\names\emily_\emily_.wav", @"E:\prod\g\male\names\emma\emma_.wav", @"E:\prod\g\male\names\erica_\erica_.wav", @"E:\prod\g\male\names\esther_\esther_.wav", @"E:\prod\g\male\names\ethel_\ethel_.wav", @"E:\prod\g\male\names\eva_\eva_.wav", @"E:\prod\g\male\names\eve_\eve_.wav", @"E:\prod\g\male\names\evelyn_\evelyn_.wav", @"E:\prod\g\male\names\florence_\florence_.wav", @"E:\prod\g\male\names\francis_\francis_.wav", @"E:\prod\g\male\names\freddie_\freddie_.wav", @"E:\prod\g\male\names\gail_\gail_.wav", @"E:\prod\g\male\names\georgia_\georgia_.wav", @"E:\prod\g\male\names\geraldine_\geraldine_.wav", @"E:\prod\g\male\names\gertrude_\gertrude_.wav", @"E:\prod\g\male\names\gina_\gina_.wav", @"E:\prod\g\male\names\gladys_\gladys_.wav", @"E:\prod\g\male\names\gloria_\gloria_.wav", @"E:\prod\g\male\names\grace_\grace_.wav", @"E:\prod\g\male\names\hazel_\hazel_.wav", @"E:\prod\g\male\names\heather_\heather_.wav", @"E:\prod\g\male\names\helen_\helen_.wav", @"E:\prod\g\male\names\holly_\holly_.wav", @"E:\prod\g\male\names\ida_\ida_.wav", @"E:\prod\g\male\names\irene_\irene_.wav", @"E:\prod\g\male\names\jackay_\jackay_.wav", @"E:\prod\g\male\names\jackie_\jackie_.wav", @"E:\prod\g\male\names\jane_\jane_.wav", @"E:\prod\g\male\names\janet_\janet_.wav", @"E:\prod\g\male\names\janice_\janice_.wav", @"E:\prod\g\male\names\jaqueline_\jaqueline_.wav", @"E:\prod\g\male\names\jean_\jean_.wav", @"E:\prod\g\male\names\jeanette_\jeanette_.wav", @"E:\prod\g\male\names\jennifer_\jennifer_.wav", @"E:\prod\g\male\names\jessica_\jessica_.wav", @"E:\prod\g\male\names\jessie_\jessie_.wav", @"E:\prod\g\male\names\jill_\jill_.wav", @"E:\prod\g\male\names\joan_\joan_.wav", @"E:\prod\g\male\names\joann_\joann_.wav", @"E:\prod\g\male\names\josephine_\josephine_.wav", @"E:\prod\g\male\names\joy_\joy_.wav", @"E:\prod\g\male\names\joyce_\joyce_.wav", @"E:\prod\g\male\names\juanita_\juanita_.wav", @"E:\prod\g\male\names\judith_\judith_.wav", @"E:\prod\g\male\names\judy_\judy_.wav", @"E:\prod\g\male\names\julia_\julia_.wav", @"E:\prod\g\male\names\julie_\julie_.wav", @"E:\prod\g\male\names\june_\june_.wav", @"E:\prod\g\male\names\karen_\karen_.wav", @"E:\prod\g\male\names\katherine_\katherine_.wav", @"E:\prod\g\male\names\kathleen_\kathleen_.wav", @"E:\prod\g\male\names\kathy_\kathy_.wav", @"E:\prod\g\male\names\katie_\katie_.wav", @"E:\prod\g\male\names\kelly_\kelly_.wav", @"E:\prod\g\male\names\kerry_\kerry_.wav", @"E:\prod\g\male\names\kiana_\kiana_.wav", @"E:\prod\g\male\names\kiara_\kiara_.wav", @"E:\prod\g\male\names\kiera_\kiera_.wav", @"E:\prod\g\male\names\kim_\kim_.wav", @"E:\prod\g\male\names\kimberly_\kimberly_.wav", @"E:\prod\g\male\names\kristen_\kristen_.wav", @"E:\prod\g\male\names\lara_\lara_.wav", @"E:\prod\g\male\names\lashaun_\lashaun_.wav", @"E:\prod\g\male\names\laura_\laura_.wav", @"E:\prod\g\male\names\lauren_\lauren_.wav", @"E:\prod\g\male\names\lei_\lei_.wav", @"E:\prod\g\male\names\leslie_\leslie_.wav", @"E:\prod\g\male\names\lillian_\lillian_.wav", @"E:\prod\g\male\names\lily_\lily_.wav", @"E:\prod\g\male\names\linda_\linda_.wav", @"E:\prod\g\male\names\lisa_\lisa_.wav", @"E:\prod\g\male\names\lois_\lois_.wav", @"E:\prod\g\male\names\loretta_\loretta_.wav", @"E:\prod\g\male\names\lori_\lori_.wav", @"E:\prod\g\male\names\lorna_\lorna_.wav", @"E:\prod\g\male\names\lorraine_\lorraine_.wav", @"E:\prod\g\male\names\louise_\louise_.wav", @"E:\prod\g\male\names\lucille_\lucille_.wav", @"E:\prod\g\male\names\lucy_\lucy_.wav", @"E:\prod\g\male\names\lynn_\lynn_.wav", @"E:\prod\g\male\names\mae_\mae_.wav", @"E:\prod\g\male\names\marcia_\marcia_.wav", @"E:\prod\g\male\names\margaret_\margaret_.wav", @"E:\prod\g\male\names\mari_\mari_.wav", @"E:\prod\g\male\names\maria_\maria_.wav", @"E:\prod\g\male\names\marie_\marie_.wav", @"E:\prod\g\male\names\marilyn_\marilyn_.wav", @"E:\prod\g\male\names\marion_\marion_.wav", @"E:\prod\g\male\names\marissa_\marissa_.wav", @"E:\prod\g\male\names\marjorie_\marjorie_.wav", @"E:\prod\g\male\names\marla_\marla_.wav", @"E:\prod\g\male\names\martha_\martha_.wav", @"E:\prod\g\male\names\mary_\mary_.wav", @"E:\prod\g\male\names\marybeth_\marybeth_.wav", @"E:\prod\g\male\names\maureen_\maureen_.wav", @"E:\prod\g\male\names\megan_\megan_.wav", @"E:\prod\g\male\names\melanie_\melanie_.wav", @"E:\prod\g\male\names\melinda_\melinda_.wav", @"E:\prod\g\male\names\melissa_\melissa_.wav", @"E:\prod\g\male\names\michelle_\michelle_.wav", @"E:\prod\g\male\names\mildred_\mildred_.wav", @"E:\prod\g\male\names\monica_\monica_.wav", @"E:\prod\g\male\names\morgan_\morgan_.wav", @"E:\prod\g\male\names\morgana_\morgana_.wav", @"E:\prod\g\male\names\nancy_\nancy_.wav", @"E:\prod\g\male\names\natalie_\natalie_.wav", @"E:\prod\g\male\names\nessa_\nessa_.wav", @"E:\prod\g\male\names\nicole_\nicole_.wav", @"E:\prod\g\male\names\norma_\norma_.wav", @"E:\prod\g\male\names\oprah_\oprah_.wav", @"E:\prod\g\male\names\pamela_\pamela_.wav", @"E:\prod\g\male\names\patricia_\patricia_.wav", @"E:\prod\g\male\names\paula_\paula_.wav", @"E:\prod\g\male\names\pauline_\pauline_.wav", @"E:\prod\g\male\names\pearl_\pearl_.wav", @"E:\prod\g\male\names\peggy_\peggy_.wav", @"E:\prod\g\male\names\phyliss_\phyliss_.wav", @"E:\prod\g\male\names\rachel_\rachel_.wav", @"E:\prod\g\male\names\rebecca_\rebecca_.wav", @"E:\prod\g\male\names\regina_\regina_.wav", @"E:\prod\g\male\names\renee_\renee_.wav", @"E:\prod\g\male\names\rhonda_\rhonda_.wav", @"E:\prod\g\male\names\rita_\rita_.wav", @"E:\prod\g\male\names\roberta_\roberta_.wav", @"E:\prod\g\male\names\robin_\robin_.wav", @"E:\prod\g\male\names\rosa_\rosa_.wav", @"E:\prod\g\male\names\rose_\rose_.wav", @"E:\prod\g\male\names\rosemary_\rosemary_.wav", @"E:\prod\g\male\names\ruby_\ruby_.wav", @"E:\prod\g\male\names\sally_\sally_.wav", @"E:\prod\g\male\names\samantha_\samantha_.wav", @"E:\prod\g\male\names\sandra_\sandra_.wav", @"E:\prod\g\male\names\sandy_\sandy_.wav", @"E:\prod\g\male\names\sara_\sara_.wav", @"E:\prod\g\male\names\selma_\selma_.wav", @"E:\prod\g\male\names\shannon_\shannon_.wav", @"E:\prod\g\male\names\sharon_\sharon_.wav", @"E:\prod\g\male\names\shauna_\shauna_.wav", @"E:\prod\g\male\names\sheila_\sheila_.wav", @"E:\prod\g\male\names\sherry_\sherry_.wav", @"E:\prod\g\male\names\shirley_\shirley_.wav", @"E:\prod\g\male\names\stacey_\stacey_.wav", @"E:\prod\g\male\names\stephanie_\stephanie_.wav", @"E:\prod\g\male\names\sue_\sue_.wav", @"E:\prod\g\male\names\sueann_\sueann_.wav", @"E:\prod\g\male\names\susan_\susan_.wav", @"E:\prod\g\male\names\suzanne_\suzanne_.wav", @"E:\prod\g\male\names\sylvia_\sylvia_.wav", @"E:\prod\g\male\names\tama`ra_\tama`ra_.wav", @"E:\prod\g\male\names\tamara_\tamara_.wav", @"E:\prod\g\male\names\tammie_\tammie_.wav", @"E:\prod\g\male\names\tara_\tara_.wav", @"E:\prod\g\male\names\tarra_\tarra_.wav", @"E:\prod\g\male\names\teresa_\teresa_.wav", @"E:\prod\g\male\names\terry_\terry_.wav", @"E:\prod\g\male\names\thelma_\thelma_.wav", @"E:\prod\g\male\names\theresa_\theresa_.wav", @"E:\prod\g\male\names\tia_\tia_.wav", @"E:\prod\g\male\names\tiffany_\tiffany_.wav", @"E:\prod\g\male\names\tina_\tina_.wav", @"E:\prod\g\male\names\tonya_\tonya_.wav", @"E:\prod\g\male\names\tova_\tova_.wav", @"E:\prod\g\male\names\tracy_\tracy_.wav", @"E:\prod\g\male\names\tyra_\tyra_.wav", @"E:\prod\g\male\names\valerie_\valerie_.wav", @"E:\prod\g\male\names\vanessa_\vanessa_.wav", @"E:\prod\g\male\names\vera_\vera_.wav", @"E:\prod\g\male\names\veronica_\veronica_.wav", @"E:\prod\g\male\names\vicky_\vicky_.wav", @"E:\prod\g\male\names\virginia_\virginia_.wav", @"E:\prod\g\male\names\viv_\viv_.wav", @"E:\prod\g\male\names\vivian_\vivian_.wav", @"E:\prod\g\male\names\wanda_\wanda_.wav", @"E:\prod\g\male\names\wendy_\wendy_.wav", @"E:\prod\g\male\names\wilma_\wilma_.wav", @"E:\prod\g\male\names\yolanda_\yolanda_.wav", @"E:\prod\g\male\names\yoyo_\yoyo_.wav", @"E:\prod\g\male\names\yvonne_\yvonne_.wav", }; // list of prompt files. string[] astrPrompts = new string[] { @"E:\meat\a_client_is_calling.wav", @"E:\meat\an_important_calls_on_the_phone.wav", @"E:\meat\answer_your_phone.wav", @"E:\meat\answer_your_phone_someones_calling.wav", @"E:\meat\its_time_to_go_this_is_that_alarm.wav", @"E:\meat\its_time_to_go_this_is_that_reminder.wav", @"E:\meat\its_time_to_wake_up_this_is_your_alarm.wav", @"E:\meat\one_of_your_friends_is_calling.wav", @"E:\meat\one_of_your_workers_is_calling.wav", @"E:\meat\someones_calling.wav", @"E:\meat\someones_calling_from_home.wav", @"E:\meat\someones_calling_you.wav", @"E:\meat\that_important_call_youve_been_waiting_for_is_on_the_phone.wav", @"E:\meat\the_daycares_calling.wav", @"E:\meat\the_office_is_calling.wav", @"E:\meat\the_schools_calling.wav", @"E:\meat\the_sitter_is_calling.wav", @"E:\meat\theres_a_call_coming_in.wav", @"E:\meat\theres_an_emergency_call_coming_in.wav", @"E:\meat\this_is_a_reminder.wav", @"E:\meat\this_is_your_alarm_clock_wake_up.wav", @"E:\meat\you_got_an_instant_message.wav", @"E:\meat\you_have_a_call_coming_in.wav", @"E:\meat\you_have_a_text_message.wav", @"E:\meat\you_have_a_voice_mail.wav", @"E:\meat\your_appointments_calling.wav", @"E:\meat\your_best_friends_calling.wav", @"E:\meat\your_brothers_calling.wav", @"E:\meat\your_brothers_calling_from_his_mobile.wav", @"E:\meat\your_dad_is_calling.wav", @"E:\meat\your_dad_is_calling_from_his_mobile.wav", @"E:\meat\your_daughter_is_calling.wav", @"E:\meat\your_daycares_calling.wav", @"E:\meat\your_favorite_person_is_calling.wav", @"E:\meat\your_getting_a_call_from_the_house.wav", @"E:\meat\your_getting_a_call_from_the_office.wav", @"E:\meat\your_girlfriends_calling.wav", @"E:\meat\your_grandmas_calling.wav", @"E:\meat\your_grandpas_calling.wav", @"E:\meat\your_honeys_calling_pickup.wav", @"E:\meat\your_jobs_calling.wav", @"E:\meat\your_man_is_calling_you.wav", @"E:\meat\your_mans_calling_you_up.wav", @"E:\meat\your_mom_is_calling.wav", @"E:\meat\your_mom_is_calling_from_her_mobile.wav", @"E:\meat\your_receiving_a_call.wav", @"E:\meat\your_receiving_an_emergency_call.wav", @"E:\meat\your_service_is_calling.wav", @"E:\meat\your_son_is_calling.wav", @"E:\meat\youve_got_a_picture_message.wav", @"E:\meat\youve_got_a_voice_mail.wav", @"E:\meat\youve_got_an_email.wav", @"E:\meat\youve_got_an_IM.wav", }; // choose a render template for mp3 ISfRenderer rend = app.FindRenderer(null, ".wav"); ISfGenericPreset tpl = rend.ChooseTemplate(IntPtr.Zero, 0); // ask the user //ISfGenericPreset tpl = rend.GetTemplate("Default Template"); if (null == tpl) return; // open the sound file DPF("Opening {0}", strMusicBed); ISfFileHost file3 = app.OpenFile(strMusicBed, true, true); if (null == file3) return; foreach (string strFilename1 in astrClients) { DPF("Opening {0}", strFilename1); ISfFileHost file1 = app.OpenFile(strFilename1, true, true); if (null == file1) return; foreach (string strFilename2 in astrPrompts) { // make an outputfilename string strOutname = Path.GetFileNameWithoutExtension(strFilename1) + "_" + Path.GetFileNameWithoutExtension(strFilename2); string strOutfile = Path.Combine(strOutpath, strOutname + "." + rend.Extension); if (File.Exists(strOutfile)) { DPF("{0} already exists", strOutfile); continue; } DPF("Opening {0}", strFilename2); ISfFileHost file2 = app.OpenFile(strFilename2, true, true); if (null == file2) return; // make a blank file to mix into. // ISfFileHost file = app.NewFile(file3.DataFormat, true); // paste file3 to the start of the temp file SfAudioSelection aselFile3 = new SfAudioSelection(file3); file.OverwriteAudio(0, 0, file3, aselFile3); // paste file2 at the end of the temp file SfAudioSelection aselFile1 = new SfAudioSelection(file1); //Int64 ccStart = file.SecondsToPosition(2.0); //file.OverwriteAudio(ccStart, 0, file1, aselFile1); file.OverwriteAudio(file.Length, 0, file1, aselFile1); // insert 2 seconds of silence at the end of the temp file file.InsertSilence(file.Length, file.SecondsToPosition(0.2)); // paste file2 at the end of the temp file SfAudioSelection aselFile2 = new SfAudioSelection(file2); file.OverwriteAudio(file.Length, 0, file2, aselFile2); // save the temp file to the given template RenderOptions ro = RenderOptions.RenderOnly; // this to just render file.SaveAs(strOutfile, rend.Guid, tpl, ro); file.WaitForDoneOrCancel(); // close the temp file file.Close(CloseOptions.DiscardChanges); // close file 2 file2.Close(CloseOptions.DiscardChanges); } // loop back to do the next prompt // close strFilename1 here // close file 1 file1.Close(CloseOptions.DiscardChanges); } // loop back to do the next file. } public void FromSoundForge(IScriptableApp app) { ForgeApp = app; //execution begins here app.SetStatusText(String.Format("Script '{0}' is running.", Script.Name)); Begin(app); app.SetStatusText(String.Format("Script '{0}' is done.", Script.Name)); } public static IScriptableApp ForgeApp = null; public static void DPF(string sz) { ForgeApp.OutputText(sz); } public static void DPF(string fmt, object o) { ForgeApp.OutputText(String.Format(fmt,o)); } public static void DPF(string fmt, object o, object o2) { ForgeApp.OutputText(String.Format(fmt,o,o2)); } public static void DPF(string fmt, object o, object o2, object o3) { ForgeApp.OutputText(String.Format(fmt,o,o2,o3)); } public static string GETARG(string k, string d) { string val = Script.Args.ValueOf(k); if (val == null || val.Length == 0) val = d; return val; } public static int GETARG(string k, int d) { string s = Script.Args.ValueOf(k); if (s == null || s.Length == 0) return d; else return Script.Args.AsInt(k); } public static bool GETARG(string k, bool d) { string s = Script.Args.ValueOf(k); if (s == null || s.Length == 0) return d; else return Script.Args.AsBool(k); } } //EntryPoint -------- And let me REITERATE, that the process will be going along fine, for a few thousand files, then all of the sudden, it will open the music bed, the client file, and then the prompt file, then just stop. As if it is tired of putting them together, at THIS one file. THen, I remark that file out, and let it move on, and it stops again on the next file. By the way.....for whatever reason, the 'error' message only pops up occasionally. Like right now....the app is just sitting there. It opened the three files, and then just stopped. No message, no files, no nothing (and this time it stopped on the FIRST file)..... HELP ME PLEASE....I bet it is something in the script, that i have changed, or edited imporperly....although it Compiles properly......I HAVE to have done SOMETHING wrong.... ARGHHHH!!!!! Help please.......whew. Thanks Message last edited on1/23/2006 12:06:53 PM byKeeba. |
Subject:RE: OK - lets start fresh......
Reply by: _TJ
Date:1/23/2006 1:26:43 PM
It has to be an application error, because it happens arbitrarily. I have commented out the files that the script STOPS on, to skip them, and it does, but then will crap out elsewhere. Then, sometimes, I can close out the files that are left open, and start again, and it will finish. Interesting note, when I re-comment (for lack of a better term....when I remove the 'comment out' slashes) the script will crap out on that file again. It might be an application error. I don't see anything wrong with your script other than the fact that the music bed is never closed. But it is only opened at the start of the script anyway, so that shouldn't matter. In the future, when you post your script, please edit the lists of file name's to contain only 2 or 3 entries. And wrap the whole thing in an html <pre> </pre> tag so that the indenting doesn't get removed. like this.. // list of client files string[] astrClients = new string[] { @"E:\prod\g\male\names\agnes_\agnes_.wav", ... 300 filename removed... @"E:\prod\g\male\names\yvonne_\yvonne_.wav", }; The actual filenames are of no use to me or anyone, they just make the thread really really long. What happens when you use file.RenderAs() instead of file.SaveAs()? Is that better? or worse? if it is an Application error, you don't have any way to fix it, so you are just going to have to try and narrow down the cause so that you can figure out a way to work around it. If you can nail down an exact method of reproducing it, we will try and get it fixed, but even then, a fix isn't going to get released until the next regularly scheduled version of Sound Forge. The more information you can give us about exactly what causes the problem, the more likely it will be that we can find the problem and fix it. If you have your script do only 900 files, then quit; restart Sound Forge and do the next 900 does that avoid the problem? I think that switching from file.SaveAs() to file.RenderAs() would be the mostly likely way to workaround the problem. But that's only a guess. The thing to do now is to change whatever you can think to change to try and find a work around. tj |
Subject:RE: OK - lets start fresh......
Reply by: Keeba
Date:1/23/2006 2:08:19 PM
Ok - one step at a time......first off, the FileRender as....where would I put that.....as when I tried a replace, I got a compile error saying ...requires '4' arguments.... How would I insert that into the structure...(I tried to add it atthe File Saveas place...)' Second, 900....is that an arbitrary number? Did you get that from math derived from my process? I ask so that I can know if there is a formula that you applied to get to that number (remove ten lines of prompts....or remark out ten lines of names) Ok - I will be back here shrtly........thanks |
Subject:RE: OK - lets start fresh......
Reply by: _TJ
Date:1/23/2006 2:46:30 PM
If you look back in this thread you will see where I showed you before the arguments to RenderAs() the post is about halfway down the thread. And yes, you do put it where the SaveAs() call is now. but dont ADD it, you REPLACE the call to SaveAs() with a call to RenderAs(). They both end up writing the file out, the difference between them is that SaveAs() has side effects on the file being saved, and RenderAs() does not. 900 is arbitrary. I got it because you died after about a thousand files. Do the RenderAs() thing first, that's more likely to be a useful workaround. tj |
Subject:RE: OK - lets start fresh......
Reply by: Keeba
Date:1/23/2006 3:08:15 PM
I did the RenderAs replacement, but it wont complie. I get this error... Compiler error 0x80004005 on Line 400,4 : No overload for method 'RenderAs' takes '4' arguments |
Subject:RE: OK - lets start fresh......
Reply by: Keeba
Date:1/24/2006 12:26:20 AM
ARGHHHHHH!!!!! (insert certain explicatives......) I am just a little frustrated.......as for whatever reason, this problem would HAVE to occur right when a proejct is about to come due. Anyhow....Just venting... Ok...I have tried and tried, and no ONE thing seems to be causing the problem. I keep getting the same error, and it keeps stopping in different places. Not any certain file, or any certain number, as believed before. It is very arbitrary....AND, I am miffed by this inability to restart, after I shut the program down, and restart it. It still stops in the same place... again...and in a most polite manned....ARGHHHH!!!!! Stumped. A. |
Subject:RE: OK - lets start fresh......
Reply by: _TJ
Date:1/24/2006 12:16:36 PM
Did you try RenderAs()? |
Subject:RE: OK - lets start fresh......
Reply by: Keeba
Date:1/24/2006 4:56:02 PM
I apologize, I must not have been clear. I tried to replace the SaveAs with the RenderAs, however got the error listed two posts above....(the compiler error). I am stuck there.....I cant get the script to compile with the RenderAs () option.....in place of the SaveAs option... Can you assist me on that.... |
Subject:RE: OK - lets start fresh......
Reply by: _TJ
Date:1/25/2006 11:31:34 AM
please go back and read the post again. RenderAs() takes 5 arguments. I showed you exactly what the code should look like weeks ago in this very thread, two days ago I suggested referred you back to that post. It's about halfway down the thread at this point. |