Unattended command line processing

Can you post the compiled version with the added command line processing feature?

http://home.wavecable.com/~edgarmusgrove/index.html#UnattendedAudacity

This is not really intended for the user who is unfamiliar with the Audacity source code and C++ programming! When you run this app from the CLI there will be NO GUI you will have to watch for the command prompt to return to know it is finished. It is really intended for unattended batch processing (I set it running in a batch process with hundreds of file when I go to bed and all is finished in the AM).

If you have a specific need to perform the same effect on large numbers of files, give me some details and I will craft a specific version specifically for you (I will need to know EXACTLY which effects are in your Audacity executable directory’s Plug-ins folder.

I recently ported my changes to Linux (should now work on both Windows & Linux–I have no way to test on Mac) and moved up to revision 11014.

I zipped up the affected source files:
UnA2Linux.zip (151 KB)
I changed the command line switches for clarity and added some new abilities:
-doTo3
-doTo4
-doSilenceProject
-doAmplify

if you call
audacity -doTo3 project.aup
(with the file names fully qualified) the project will open and the audio will be exported as an MP3 (-doTo4 exports as M4A).

[-ed] here are the folder locations for the files in the zip:
srcAudacityApp.cpp
srcAudacityApp.h
srcMenus.cpp
srcMenus.h
srcProject.cpp
srcProject.h
srceffectsAmplify.cpp
srceffectsSilence.h
srceffectsnyquistNyquist.cpp
srcwidgetsProgressDialog.cpp
lib-srclibnyquistnyquistxlispxlread.c

I have posted new executables to play with (windows & Linux):
http://home.wavecable.com/~edgarmusgrove/#CompiledUnattendedAudacity

Not meaning to dismiss this whole command line processing idea, is it not possible to do all this unattended processing using mod-pipe-script? It is even possible (though tortuous) to drive audacity, via mod-pipe-script, from a Windows batch file rather than a perl script. Mod-pipe-script even works in 1.3.13 Beta without hacking the source and recompiling !!!

In this thread on the audacity-users listserv (Feb 2010) http://audacity.238276.n2.nabble.com/mod-script-pipe-module-and-noise-reduction-td4596332.html Gale says:

On this page of the Audacity Manual http://manual.audacityteam.org/index.php?title=Scripting it says:

How to get started with scripting

Audacity 2.0 can only be used with scripting if you compile a separate plug-in module from SVN called mod-script-pipe. You’ll also need the scripting language Perl to try out the examples. We may provide an already compiled mod-script-pipe some time after releasing Audacity 2.0. If you just want to use scripting but don’t want to do the developer steps then you will need to wait for that to be released.

This document refers to the versions of Audacity and mod-script-pipe in SVN as of December 12th 2009. Our intention is to keep this document as up-to-date as possible on the wiki so that it continues to apply to latest builds of Audacity from SVN head.

Building
Ensure you have the latest SVN HEAD version of Audacity built and working. The scripting module, “mod-script-pipe” is in SVN (under lib-src), but is not built automatically.

In MSVC, right-click the mod-script-pipe project and select Build. If all goes to plan, the DLL will be placed in the “modules” directory.
Under GCC, move into the lib-src/mod-script-pipe directory and type “make”. This will build the module and copy the “.so” to the modules directory.

[ToDo] Mac instructions here

Note there is no Mac support documentation and one must still do all the stuff of compiling Audacity then mod-script-pipe to try it.

From what I can tell, Dan Horgan is the author but I don’t see any developer support for mod-script-pipe here on the forum.


@sgparry – do you understand mod-script-pipe well enough to start a new thread and give the forum members a little tutorial and some support?

hi edgard,
i trying to do batch noise reduction on many waves files.
how i can get started with the compiled audacity no gui you trying to develop.
my process flow is this:
1-load wav
2-select part of wav as noise profile(the range as input)
3-call get noise profile
4-apply noise reduction (possible many times)
5-export as wav

any help from you is appreciated.

First and foremost, Audacity is a VERY complicated program! Unless you are a very skilled C++ programmer this project is not for you.

If you are a very skilled C++ programmer, the first thing you need to do is build wxWidgets and Audacity. I think GitHub provides either/both the current alpha code and the most recent release code but it has been quite a while since I have built Audacity. I use a highly modified 2.0.6 code base which is years out of date but the source code with which I am most familiar.

Once you have both wxWidgets & Audacity building and running, I can give you my source code for unattended Audacity. I’m fairly sure that the basic CLI stuff is quite similar. I chose to “turn off” the entire GUI (with the exception of fatal error dialogs) as my monitor is always turned off during this process in doing so saves a few processor cycles. With today’s super-fast super-powerful computers I would probably not bother with all the coding work of turning off the GUI!

I have not figured out any good way of doing noise reduction in the manner to which you allude! The “noise” is rarely pre-definable (neither location/length nor constant-across-files). Remember, a noise profile needs to be at least 1 or 2 seconds in length to be useful. If you are making your own recordings and defined you have constant-across-files noise, is almost always best to identify the problem (almost always in your sound system) and fix that!

Well I am very expert in C++.

I try to achieve this as first step, may be detail me the steps to build wxWidgets and Audacity.

my waves are agent/customer call recorders, for each call I have two waves one Agent side and the other is Customer side,
I am using a VAD(Voice Activity Detection) tool which return list of ranges(start in sec … end in sec) where there is a voice activity on the given wav.
since in single wave there is only one speaker, taking the ranges outside of Voice activities list is noise for me.
according to the process I mention in my last post, the second step is 2-select part of wave as noise profile(the range as input)
this “noise/no voice” 'ranges(take 2/5 second ) from VAD as input to audacity to get the noise profile.
then apply the noise reduction function (maybe call several times) based on that profile and finally export as wav fiie.

If you “only” want to apply noise reduction to a batch of files, it may be better to use a stand-alone noise reduction program rather than Audacity. (a few examples here: https://manual.audacityteam.org/man/sample_workflow_for_lp_digitization.html#alternative)

If you wish to perform automation with the current version of Audacity, it may be worth looking at Audacity’s scripting features: https://manual.audacityteam.org/man/scripting.html

It sounds like you fit the bill experience-wise. First, go to Audacity’s GitHub:

https://github.com/audacity/audacity

login or create an account and either Clone or Download Audacity’s source. There is a first level folder called “win”; it contains a text file: “compile.txt” - the directions are quite explicit and must be followed exactly.

There is a Catch-22/chicken-before-the-egg situation in that to get the compile.txt file you must download the Audacity source but the compile.txt file tells you to download the wxWidgets source from the Audacity GitHub first. Suffice it to say it doesn’t matter if you download the Audacity source first, what does matter is compiling the wxWidgets libraries first.

Once you have wxWidgets built, compile some of the wxWidgets test projects to ensure that libraries are functioning.

After you have wxWidgets compiled and Audacity compiled and running get back to us here and we will see where we go from there.

Probably the only real advantage to making your own personal edits to the Audacity source would be to allow you to create a very large list (depending on your computer, it’s RAM and the version of Audacity the size of the list might be limited - my old computer could handle about 500 sequential launches of Audacity 2.0.6, my current computer has handled over a thousand but it does eventually need to be rebooted) then starting a batch file to process the list overnight.

In the current source code it is called “build.txt” and it can be found here: https://github.com/audacity/audacity/blob/master/win/build.txt

Sorry for the bad information; the last time I checked out the Audacity source was 14 May 2018! I guess now would be a good time to do it again.

HI steve,
thank you for the suggested tool, I am taking a look for them.

I would like to obtain mod-script-pipe module, for the moment audacity tell me ''No module were found"
I have subscribed to the developers mailing list but i didn’t get where to obtain the module.

As you are very experienced with C++, it may be quickest to build Audacity yourself from the source code. The SLNs are set up for Visual Studio 2017 (the free Community version is sufficient). You just have to add the mod-script-pipe option to the build list.

Alternatively, if you post to the developer’s mailing list and say that you are interested in using mod-script-pipe, and as if someone can give you a copy. You will probably get a reply from James, as he is the main developer of this feature.

I am sorry, it was a typo of me not writing NOT, my c++ expertise is basic.
I took a look in audacity src folder in github. it seem for me so complex to compile.
I find it easier for me to use audacity scripting as you share me the wiki page of that.

A ha, that makes a big difference :wink:

Do you have any experience with Python? A bit of experience with Python would be a big help for using mod-script-pipe (you won’t need to be “expert” with Python).

actually the project I working on is in python. so it will be big advantage to make use of audacity scripting in python.
I found a tool called sox Swiss Army knife of sound processing.
it has a command for noise reduction using frequency profiling. how likely its similar to audacity noise reduction functionality.
I tried the sox utility on a wav but it poroduce a sort of echo, and the sound quality become weird.
any explanation of this? is there any computing to get the the right amount of noise should be removed.

SoX is cool :sunglasses: though I don’t have experience with its noise reduction effect, so I can’t help you with that. Audacity uses SoX’s resampling library. We didn’t “steal” it, the developer of “libsoxr” (the resampling library in SoX) came to us and said “Hey, why don’t you use our resampling library, it’s much better than the one you are using”. He way right, their resampling library is awesome, so we now use it.

For noise reduction, the noise profile is pretty critical, as that is what tells the effect which sounds to remove and which to leave alone. Finding the right amount of noise reduction to use is in part subjective. Some experimentation is usually required to achieve the subjectively “best” sounding result. I generally start by using the defaults, then tweak the parameters one at a time to find the best settings.

hi steve,

I managed to enbled mod-script-pipe in audacity.

now my next step it write a python script that import a wave file → apply noise reduction->export as wav.
I would have this process run in loop prepossessing a list of files as input.