Subject:Apply Effects to large number of files
Posted by: daphyd
Date:1/18/2011 6:50:43 AM
Hi There, I have a script / plugin I've developed which is very similar in nature to the batch processor. Essentially, I have a long (long) list of files, and for each one I open it, apply a chain of effects, then save and close it. The issue I am having is that as the script runs through the list of files, it get's slower and slower to open / close the files. Eventually it crashes with an out of memory exception. Is there any way to tell SF via the API to do a cleanup, like a garbage collection, and release handles to files to have been closed? I am releasing resources (setting to null) and reguarly calling GC.Collect() on my side of the API, but I can't find anything to tell SF to do some memory housekeeping. Thanks in advance. Message last edited on1/18/2011 6:51:59 AM bydaphyd. |
Subject:RE: Apply Effects to large number of files
Reply by: roblesinge
Date:1/19/2011 6:13:53 AM
What version of SF are you using? How many files are we talking about here? I've had a similar problem before with a batch merge script. I would never fully run out of memory, but it sure would chug slowly until I could close out some of the files in the script. You've got drawing turned off on the open file calls, right? Rob. |
Subject:RE: Apply Effects to large number of files
Reply by: daphyd
Date:1/19/2011 10:00:44 AM
Hi Thanks for your reply. I'm using the very latest version 10.0c. We're talking in the region of 10,500 files. I'm turning drawing off (NoWindow flag): fileObj = AudioEngine.SoundForgeInstance.OpenFile(filePath, false, true); Applying effects: fileObj.DoEffect(effect.Description, effect.Settings, audioSelection, EffectOptions.EffectOnly); fileObj.WaitForDoneOrCancel(); and then closing the file and releasing my local handle: fileObj.Save(SaveOptions.WaitForDoneOrCancel); fileObj.Close(CloseOptions.SaveChanges); fileObj.WaitForDoneOrCancel(); fileObj = null; Also, every 100 files, I'm running a cleanup routine: AudioEngine.SoundForgeInstance.DoEvents(AudioEngine.SoundForgeInstance.Win32Window.Handle); AudioEngine.SoundForgeInstance.WaitForDoneOrCancel(); AudioEngine.Window.ProgressMessage.Text = "Having a Rest!"; Application.DoEvents(); GC.Collect(); GC.WaitForPendingFinalizers(); cleanupCounter = 0; Thread.Sleep(5000); I thought this would be enough. However, it still get's slower and slower. I've stepped through my code, and the delays are happening on the calls to OpenFile and Save / Close. It get's progressively slower as it get's further through the batch. Not sure what else to try, but any suggestions would be appreciated. Thanks. |
Subject:RE: Apply Effects to large number of files
Reply by: beckman
Date:7/8/2011 3:11:34 AM
Such along time ago... Hello, this is a kind of reply, but no real help I guess. In Excel there is an option "application.screenupdating = false". If there will be a similar possibility in SF, preventing from making the opening-processing-closing activity visible, it will help improving the performance. The moaning of the graphic board, performing an awful flickering is everything else than classy. Sony developers should have a look to the old bath-converter as a stand alone tool. Maybe there is some source code which can help. But this of course is only an additional effect to your problem. I think you don’t need direct hints like these: Dimensioning the variables with the smallest size will reduce occupying memory. Byte bites decimal. With best regards from Germany, beckman |