Command line processing

This section is now closed.
Forum rules
This forum is now closed.

For help with current Audacity, please post to the 2.x. board for your operating system.

Please post feedback about the current 2.x version on the 2.x.feedback board.
Edgar
Forum Crew
Posts: 2043
Joined: Thu Sep 03, 2009 9:13 pm
Operating System: Windows 10

Re: Command line processing

Post by Edgar » Wed Aug 25, 2010 9:30 pm

trym wrote:First a couple of questions:

1) What is CLI?
2) Are you compiling this in a Linux (Unix) environment, or is this on a Windows platform?
3) What compiler are you using?
4) I studied your other answer to brian. Can AutoIt3 be used to input commands to Audacity?
1) CLI = Command Line Interface
2) I am compiling on Windows 7 but from what I can see nothing that I have done so far is platform specific and should compile and run on all three platforms.
3) Microsoft Visual C++ Express 2008 (Audacity will not compile yet with 2010)
4) I use AutoIt3 for a number of scripts but I wrote them all years ago -- I use Dragon NaturallySpeaking Pro (a speech recognition program which is very expensive) for most of my scripts -- let me take a look at AutoIt3 and get back at you later with the answer to this question.


Here is the preferred part of your initial algorithm, with my proposals in between:
0) start CLI and CD into data directory
THE: I would assume that we are in the data directory initially
efm5 - I try not to make assumptions like this. Frequently I will be processing large numbers of files and they are not always in the same data directory; here is an example of a script which I might run:

Code: Select all

]
cd "D:audioKCEA25Aug2010"
"D:audioAudacityunattendedCLISVNwinUnicode ReleaseAudacity.exe" -dounattended "D:audioKCEA25Aug2010Wed Aug 25 0015 2010.mp3" > errors.txt
"D:audioAudacityunattendedCLISVNwinUnicode ReleaseAudacity.exe" -dounattended "D:audioKCEA25Aug2010Wed Aug 25 0730 2010.mp3" >> errors.txt
cd "D:audioKCEAAug201024Aug2010"
"D:audioAudacityunattendedCLISVNwinUnicode ReleaseAudacity.exe" -dounattended "D:audioKCEAAug2010\24Aug2010Tue Aug 24 0035 2010.mp3" > errors.txt
"D:audioAudacityunattendedCLISVNwinUnicode ReleaseAudacity.exe" -dounattended "D:audioKCEAAug2010\24Aug2010Tue Aug 24 0800 2010.mp3" >> errors.txt
Note that I first start out in today's working directory and process a couple of files that I switch to yesterday's working directory which has been moved out of the main directory into the monthly directory.

You will see that a new errors.txt file is created after I change directories and that error information is appended.


1) launch Audacity with an audacity project file as the first (input) argument which will be "opened"
THE: Good. This is what we want.
a. do we want to hard code the result?
THE: To make it simple: The result could be another Audacity project file, with the same name as the input, i.e., we overwrite the input project. Eventually I want to do track splitting by the Silence Finder, as you describe below and then export as a flac. But to make it this step simple, let's constrain ourselves to do the resampling and saving only.
i. will the result be another Audacity project or a WAV/MP3/M4A/etc. file
THE: No, see answer above
ii. will the result's file name be derived from the input argument of do we want to specify an output name?
THE: Yes, see proposal under a.
efm5 - I would strongly recommend not overwriting -- it is very easy to append something to the original name. I would never trust my data to unattended manipulation!


b. are we going to assume the input is a fully qualified file name (not a Window shortcut which can cause problems for Audacity)
THE: Not sure what you mean by this. I think we could assume a "fully qualified file name".
efm5 - Trust me on this -- let's stick to a "fully qualified file name"!

2) process the track to determine split points
THE: Omit this point for now, to make it simple
efm5 - This is what I've been working on today for my own use.

a. The Silence Finder (Analyze menu) will do this but we will have to determine the right settings and hard-code them as the defaults (I have done this for the multitude of tapes and LPs I converted into single tracks using M4A as the resulting file type)
efm5 - I spent a lot of quality time with the Nyquist SilenceMarker plug-in today. One important thing I learned is that I needed a much finer granularity in the settings; here's what I came up with:

Code: Select all

;control sil-dur "Minimum duration of silence [seconds]" real "" .04 0.01 5.0
;control labelbeforedur "Label placement [seconds before silence ends]" real "" 0.01 0.0 1.0
note that I have made the granularity one hundredths of a second and set the defaults at .04 for duration and that .01 for label placement.

3) process to convert from 45 -> 33 1/3 rpm
a. I have seen reference to this as something Audacity can do, but am clueless as to the steps involved. You would have to send me a small project which needs converting and tell me exactly (in excruciating detail) how to perform this task.
THE: This is not hard at all. I have never used Audacity, but I was able to figure this out quite easily:
The whole project is saved as a single track.
i. So to mark every thing, hit "Ctrl A"
ii. For resampling from 45 to 33 rpm: Do Effect-> Change Speed. Then a dialog box appears. In this dialog we need to put "33 1/3" in the "To" box and "45" in the "From" box, and then hit "ok". This will issue the resampling process, with a progress bar for which we need to wait until it exits.
b. now that I think about it, the silences we use in #2 will be longer after the rpm conversion so we might want to convert rpm first
THE: Not applicable with this approach. Proposal is to not use Silence Finder
efm5 - The effects are almost all Nyquist plug-ins-- this makes the life little more difficult because we cannot easily call them without the dialog box -- obviously for unattended operation we may not have a dialog box -- everything must be hardcoded. I just looked at these Change Speed effect code and I think I can figure out how to call it without dialog led me play with it for a while...
-Edgar
running Audacity personally customized 2.0.6 daily in a professional audio studio
occasionally using current Audacity alpha for testing and support situations
64-bit Windows Pro 10

Edgar
Forum Crew
Posts: 2043
Joined: Thu Sep 03, 2009 9:13 pm
Operating System: Windows 10

Re: Command line processing

Post by Edgar » Wed Aug 25, 2010 10:21 pm

trym wrote:export multiple projects as flac files, ready for burning CD's
Here is a list of the format types that I have found in Audacity:

Code: Select all

/// List of export types
ExposedFormat ExportFFmpegOptions::fmts[] =
{
   {FMT_M4A,         wxT("M4A"),     wxT("m4a"),  wxT("ipod"), 48,  true ,true ,_("M4A (AAC) Files (FFmpeg)"),         CODEC_ID_AAC,    true},
   {FMT_AC3,         wxT("AC3"),     wxT("ac3"),  wxT("ac3"),  7,   false,false,_("AC3 Files (FFmpeg)"),               CODEC_ID_AC3,    true},
   {FMT_AMRNB,       wxT("AMRNB"),   wxT("amr"),  wxT("amr"),  1,   false,false,_("AMR (narrow band) Files (FFmpeg)"), CODEC_ID_AMR_NB, true},
#if FFMPEG_STABLE
   {FMT_AMRWB,       wxT("AMRWB"),   wxT("amr"),  wxT("amr"),  1,   false,false,_("AMR (wide band) Files (FFmpeg)"),   CODEC_ID_AMR_WB, true},
#endif
   {FMT_WMA2,        wxT("WMA"),     wxT("wma"),  wxT("asf"),  2,   false,false,_("WMA (version 2) Files (FFmpeg)"),   CODEC_ID_WMAV2,  true},
   {FMT_OTHER,       wxT("FFMPEG"),  wxT(""),     wxT(""),     255, true ,true ,_("Custom FFmpeg Export"),             CODEC_ID_NONE,   true}
};
and:

Code: Select all

static SF_FORMAT_INFO const simple_formats [] =
{
	{	SF_FORMAT_AIFF | SF_FORMAT_PCM_16,
		"AIFF (Apple/SGI 16 bit PCM)", "aiff"
		},

	{	SF_FORMAT_AIFF | SF_FORMAT_FLOAT,
		"AIFF (Apple/SGI 32 bit float)", "aifc"
		},

	{	SF_FORMAT_AIFF | SF_FORMAT_PCM_S8,
		"AIFF (Apple/SGI 8 bit PCM)", "aiff"
		},

	{	SF_FORMAT_AU | SF_FORMAT_PCM_16,
		"AU (Sun/Next 16 bit PCM)", "au"
		},

	{	SF_FORMAT_AU | SF_FORMAT_ULAW,
		"AU (Sun/Next 8-bit u-law)", "au"
		},

	{	SF_FORMAT_CAF | SF_FORMAT_PCM_16,
		"CAF (Apple 16 bit PCM)", "caf"
		},

#if HAVE_EXTERNAL_LIBS
	{	SF_FORMAT_FLAC | SF_FORMAT_PCM_16,
		"FLAC 16 bit", "flac"
		},
#endif

	{	SF_FORMAT_RAW | SF_FORMAT_VOX_ADPCM,
		"OKI Dialogic VOX ADPCM", "vox"
		},

#if HAVE_EXTERNAL_LIBS
	{	SF_FORMAT_OGG | SF_FORMAT_VORBIS,
		"Ogg Vorbis (Xiph Foundation)", "oga"
		},
#endif

	{	SF_FORMAT_WAV | SF_FORMAT_PCM_16,
		"WAV (Microsoft 16 bit PCM)", "wav"
		},

	{	SF_FORMAT_WAV | SF_FORMAT_FLOAT,
		"WAV (Microsoft 32 bit float)", "wav"
		},

	{	SF_FORMAT_WAV | SF_FORMAT_IMA_ADPCM,
		"WAV (Microsoft 4 bit IMA ADPCM)", "wav"
		},

	{	SF_FORMAT_WAV | SF_FORMAT_MS_ADPCM,
		"WAV (Microsoft 4 bit MS ADPCM)", "wav"
		},

	{	SF_FORMAT_WAV | SF_FORMAT_PCM_U8,
		"WAV (Microsoft 8 bit PCM)", "wav"
		},

} ; /* simple_formats */
Does anything there look like that as which you wish to export?
-Edgar
running Audacity personally customized 2.0.6 daily in a professional audio studio
occasionally using current Audacity alpha for testing and support situations
64-bit Windows Pro 10

Edgar
Forum Crew
Posts: 2043
Joined: Thu Sep 03, 2009 9:13 pm
Operating System: Windows 10

Re: Command line processing

Post by Edgar » Thu Aug 26, 2010 3:41 am

trym wrote: 4) Can AutoIt3 be used to input commands to Audacity?
I spent a few hours with AutoIt3 and the simple answer is yes, but...

It is NOT pretty! AutoIt3 can control some of the Audacity functions; f. i. you can start Audacity with a file loaded; you can Send() a <space> key (Send("{SPACE}") and the file will play. You cannot send ctrl+q to exit. I do not know why some keyboard shortcuts work and others do not. AutoIt3 has a function to pick menu items but it does not work with Audacity's menu--you can send a series of mouse button clicks to achieve selecting a menu item but the mouse coordinates are in "screen" mode not "window" mode (so any script would rely on the Audacity window always being in the same location and at least wide enough to expose the menu and item you need).

Other hassles exist but all are manageable. Specifically, for Change Speed one would want to set the default behavior so that it does 45->33.3 by default and then a simple "OK" at the dialog would do.

There are other scripting tools available--I don't have any experience with them though. With some time and effort I could get AutoIt3 to do what you want if we assume it will run overnight while no other programs are opening windows. Creating the script would be a chore but its creation could be somewhat automated.
-Edgar
running Audacity personally customized 2.0.6 daily in a professional audio studio
occasionally using current Audacity alpha for testing and support situations
64-bit Windows Pro 10

trym
Posts: 5
Joined: Tue Aug 10, 2010 8:06 pm
Operating System: Please select

Re: Command line processing

Post by trym » Thu Aug 26, 2010 4:33 pm

I think the assumption of running over night with no other programs being started is fine. So an AutoIt3 script might be sufficient

Edgar
Forum Crew
Posts: 2043
Joined: Thu Sep 03, 2009 9:13 pm
Operating System: Windows 10

Re: Command line processing

Post by Edgar » Thu Aug 26, 2010 9:09 pm

trym wrote:I think the assumption of running over night with no other programs being started is fine. So an AutoIt3 script might be sufficient
This is no longer of public interest--I sent you a PM.
-Edgar
running Audacity personally customized 2.0.6 daily in a professional audio studio
occasionally using current Audacity alpha for testing and support situations
64-bit Windows Pro 10

trym
Posts: 5
Joined: Tue Aug 10, 2010 8:06 pm
Operating System: Please select

Re: Command line processing

Post by trym » Mon Nov 01, 2010 8:29 pm

For the record - I was able to do this and much more, including resampling, noise removal, splitting in tracks, converting to flac, just by using Audacty driven by AutoIt3. Using the same scripting language it was not too hard to make CD images from scanned pictures and making CD covers correctly formatted. No need for recompiling Audacity.

Locked