Speex to FLAC in windows command line

1

I've got a speex audio file (snd.spx), and I've found foobar2000 is the only software I can easily convert it to the more-widely-usable format FLAC (snd.flac) so I can edit it before encoding again to a lossy format. The other software I have just seems to complain about it (mencoder, ffmpeg, both of which complain they're not compiled to handle speex :( )

Using the GUI is great but clicking manually many times as the files are generated is combersome, so I want to set up a small script to do it for me

Here is where I run into problems, I can't find documentation about how to do this through the command line, calling foobar2000 /? brings up the foobar2000 GUI and gives me some non-helpful information

Available switches:
  /add <list-of-files> - appends the specified files to the current playlist instead of replacing the playlist content and playing them immediately
  /immediate - bypasses the "please wait" dialog when adding files
  /play, /pause, /playpause, /prev, /next, /rand, /stop - playback controls
  /exit - exits foobar2000
  /show, /hide - shows or hides the main foobar2000 window
  /config - opens the Preferences dialog
  /command:<menu command> - invokes the specified main menu command
  /playlist_command:<context menu command> - invokes the specified context menu command on current playlist selection
  /playing_command:<context menu command> - invokes the specified context menu command on currently played track
  /context_command:<context menu command> <files> - invokes the specified context menu command on the specified files

None of these options seem to give me access to the file conversion abilies.


Another speex-to-FLAC solution using the command line would also be acceptable if it is portable
(and doesn't require me to compile binaries, I don't have the right environment available to me)

Paul S.

Posted 2015-01-29T01:39:01.397

Reputation: 143

Answers

0

I figured out a method to do the conversion using the official tools,

  1. Using the Speex windows binaries from here (1.1.11win32.zip worked for me)
  2. Using the FLAC windows binaries from here (I got flac-1.3.1-win.zip)

You need to do the conversion in two steps to get to get from .spx to .flac as the official decoder for Speex only lets you decode to .wav or raw PCM

Now assuming you've got speexdec.exe and flac.exe in the current directory, and %~d1%~p1%~n1.spx is the path to the .spx file, (It's .bat file trickery to get input args without file extensions)

speexdec.exe "%~d1%~p1%~n1.spx" "%~d1%~p1%~n1.wav"
flac.exe -o "%~d1%~p1%~n1.flac" -8 "%~d1%~p1%~n1.wav"
del "%~d1%~p1%~n1.wav"

The last line cleans up the intermediate file

Paul S.

Posted 2015-01-29T01:39:01.397

Reputation: 143