{"id":1163,"date":"2018-10-01T21:20:33","date_gmt":"2018-10-01T21:20:33","guid":{"rendered":"http:\/\/digital.eca.ed.ac.uk\/sounddesignmedia\/?p=1163"},"modified":"2019-10-01T12:39:37","modified_gmt":"2019-10-01T12:39:37","slug":"03-using-the-commandline-to-process-audio","status":"publish","type":"post","link":"https:\/\/digital.eca.ed.ac.uk\/sounddesignmedia\/2018\/10\/01\/03-using-the-commandline-to-process-audio\/","title":{"rendered":"03 &#8211; Using the command line to process audio"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">The Command Line<\/h3>\n\n\n\n<p>Before going further, have a read of this, it talks you through some starting points to working on the commandline:<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-rich is-provider-audio-crafting\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"EijKni7wTP\"><a href=\"https:\/\/digital.eca.ed.ac.uk\/sounddesignmedia\/2017\/10\/10\/more-commandline-help\/\">More commandline help<\/a><\/blockquote><iframe class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" src=\"https:\/\/digital.eca.ed.ac.uk\/sounddesignmedia\/2017\/10\/10\/more-commandline-help\/embed\/#?secret=EijKni7wTP\" data-secret=\"EijKni7wTP\" width=\"600\" height=\"338\" title=\"&#8220;More commandline help&#8221; &#8212; Audio Crafting\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<p>Check out the SoX pages: <a href=\"http:\/\/sox.sourceforge.net\/\" class=\"autohyperlink\">sox.sourceforge.net\/<\/a>\n<\/p>\n\n\n\n<div id=\"outline-container-sec-1\" class=\"outline-2\">\n<h2 id=\"sec-1\"><span class=\"section-number-2\">1<\/span> Managing the terminal<\/h2>\n<div id=\"text-1\" class=\"outline-text-2\">\n<p>The terminal or shell can be daunting at first. There is no Graphical User Interface (GUI), rather a series of commands you type into the shell in order to perform actions. Without a GUI, you lose some of the reassuring feedback that things are happening as you need them to, but you get the far more important benefit of a huge increase in speed.<\/p>\n<p>Before you can do much with the shell, you need to know how to get into specific directories in order to work.<\/p>\n<p>To get into a directory with sound, if you know the full path, you can simply type<\/p>\n<p><code>cd ~\/Dropbox\/sounds<\/code>, hit <code>enter<\/code>.<\/p>\n<p>If you have dropbox installed, then this will take you to your dropbox folder and a directory within that place called <code>sounds<\/code>.<\/p>\n<p>If you don&#8217;t know the path, or can&#8217;t be bothered to type the path, you can type<\/p>\n<p><code>cd with a space after it<\/code> then drag and drop the folder in question. Press enter and the terminal will now be pointing to this particular place.<\/p>\n<p>To find out which directory you are in, type <code>pwd<\/code> and hit enter.<\/p>\n<p>To list the contents of a directory <code>ls<\/code> enter.<\/p>\n<p>To list specific files in a directory type <code>ls *.pdf<\/code><\/p>\n<p>To open one of the pdf files type <code>open thepdfname.pdf<\/code><\/p>\n<p>Can you think of a way to list all the .wav files in a directory?<\/p>\n<\/div>\n<div id=\"outline-container-sec-1-1\" class=\"outline-3\">\n<h3 id=\"sec-1-1\"><span class=\"section-number-3\">1.1<\/span> Styling the terminal<\/h3>\n<div id=\"text-1-1\" class=\"outline-text-3\">\n<p>You&#8217;ll see in my own terminal I use a colour scheme I like. Set this up in <code>Terminal:Preferences:Profiles<\/code><\/p>\n<\/div>\n<\/div>\n<\/div>\n\n\n\n<div id=\"outline-container-sec-2\" class=\"outline-2\">\n<h2 id=\"sec-2\"><span class=\"section-number-2\">2<\/span> Converting audio using SoX<\/h2>\n<div id=\"text-2\" class=\"outline-text-2\">\n<p>SoX is a brilliant command line programme for converting between file types and batch processing audio.<\/p>\n<\/div>\n<div id=\"outline-container-sec-2-1\" class=\"outline-3\">\n<h3 id=\"sec-2-1\"><span class=\"section-number-3\">2.1<\/span> Converting between file types<\/h3>\n<div id=\"text-2-1\" class=\"outline-text-3\">\n<p>Converting files from one file type to another is relatively simple.<\/p>\n<p><code>sox input.wav output.mp3<\/code><\/p>\n<p>Will simply convert the wav file called input.wav to the mp3 file called output.mp3<\/p>\n<p>To write the converted files to another directory, first make a directory for the files to live in:<\/p>\n<p><code>mkdir aifConversions<\/code><\/p>\n<p>You&#8217;ll see that the file is placed in the directory you specified.<\/p>\n<p><code>sox input.wav aifConversions\/output.aiff<\/code><\/p>\n<p>Will convert a wav file to an aiff file and place it in aifConversions folder you just made.<\/p>\n<\/div>\n<\/div>\n<div id=\"outline-container-sec-2-2\" class=\"outline-3\">\n<h3 id=\"sec-2-2\"><span class=\"section-number-3\">2.2<\/span> Converting sample rate<\/h3>\n<div id=\"text-2-2\" class=\"outline-text-3\">\n<p>This again is very simply done. Call SoX, open the sound file, change the rate with -r and name the output file:<\/p>\n<p><code>sox Blister_pack.wav -r 44.1k Blister_pack.aif<\/code><\/p>\n<p>This will convert to a very low sample rate and <em><strong>play<\/strong><\/em> that converted file back for you right after:<\/p>\n<p><code>sox Blister_pack.wav -r 8k Blister_pack_lowfi.aiff; play Blister_pack_lowfi.aiff<\/code><\/p>\n<\/div>\n<\/div>\n<div id=\"outline-container-sec-2-3\" class=\"outline-3\">\n<h3 id=\"sec-2-3\"><span class=\"section-number-3\">2.3<\/span> Converting bit depth<\/h3>\n<div id=\"text-2-3\" class=\"outline-text-3\">\n<p>It&#8217;s rare that you&#8217;d want to convert bit depth on a file, but sometimes it&#8217;s necessary to scale down from 24bit to 16bit files and to do this for all assets, particularly if you&#8217;re trying to save space in a game\/mobile project.<\/p>\n<p><code>sox Blister_pack.wav -r 44.1k -b 8 Blister_pack.aif<\/code><\/p>\n<p>The above will do this for an individual file, to do this with loads of files, you need to embrace batch processing.<\/p>\n<\/div>\n<\/div>\n<div id=\"outline-container-sec-2-4\" class=\"outline-3\">\n<h3 id=\"sec-2-4\"><span class=\"section-number-3\">2.4<\/span> Batch converting<\/h3>\n<div id=\"text-2-4\" class=\"outline-text-3\">\n<p>Writing out the text for each command can be time consuming if you have to this for all assets, so you can use the shell to batch process your conversion processes. The basic rule for this is to ensure that you&#8217;re writing new files, rather than writing over your original, pristine sources, so I always make a new directory to write everything to:<\/p>\n<p><code>mkdir converted<\/code><\/p>\n<p>The above will make a directory called <em>converted<\/em> next to where you&#8217;re working.<\/p>\n<p>Then you can run a batch process:<\/p>\n<blockquote><p><em>for all files of a certain type in the directory, do something interesting:<\/em><\/p><\/blockquote>\n<p><code>for f in *.wav; do sox \"$f\" \"converted\/${f%%.wav}.mp3\"; done<\/code><\/p>\n<p>The above will make you a bunch of mp3 files from source wav files. The quotes around the string <code>converted\/${f%%.wav}.mp3<\/code> means that we can cope with spaces in file names, but we really don&#8217;t want you to have spaces in file names so this is just an extra catch all. The complex-looking thing in the formula above is the bit attending to the file name extension. Basically, we take the first part of the file name and keep it, but swap out the file extension.<\/p>\n<p>How would you batch convert sample rates? How would you batch convert bit depth? How would you batch convert sample rate, bit depth and to aif in one go?<\/p>\n<\/div>\n<\/div>\n<\/div>\n\n\n\n<div id=\"outline-container-sec-3\" class=\"outline-2\">\n<h2 id=\"sec-3\"><span class=\"section-number-2\">3<\/span> Extracting information about your audio<\/h2>\n<div id=\"outline-container-sec-3-1\" class=\"outline-3\">\n<h3 id=\"sec-3-1\"><span class=\"section-number-3\">3.1<\/span> Making spectrograms<\/h3>\n<div id=\"text-3-1\" class=\"outline-text-3\">\n<p>You can render off a spectrogram of your sound file like this<\/p>\n<p><code>sox input.wav -n spectrogram -t \"top label\" -c \"corner label\" -o inputFileName.png<\/code><\/p>\n<p>e.g. <code>sox Blister_pack.wav -n spectrogram -t \"Blister Pack\" -c \"Blister Pack\" -o Blister_Pack.png<\/code><\/p>\n<p>To batch make spectrograms it&#8217;s pretty easy:<\/p>\n<p><code>for f in *.wav; do sox \"$f\" -n spectrogram -t \"$f\" -c \"$f\" -o \"${f%%.wav}.png\"; done<\/code><\/p>\n<\/div>\n<\/div>\n<\/div>\n\n\n\n<div id=\"outline-container-sec-4\" class=\"outline-2\">\n<h3>3.2 dumping data from a set of files to a database\/file<\/h3>\n<p>It&#8217;s straightforward to dump data about a bunch of audio files in a folder to a text file, this can be done with <em>soxi.&nbsp; <\/em>Soxi gives you file information.<\/p>\n<p>Try this to dump all the data that SoxI can get from all the .wav files in a folder:<\/p>\n<blockquote><pre>soxi *.wav &gt; database.csv\n\n<\/pre><\/blockquote>\n<p>The &gt; in the above command writes the data from soxi to a file called database.csv<\/p>\n<p>If you just want a list of files in a folder, you can use the command line to write a list of files to a text file thus:<\/p>\n<blockquote><pre>ls *.wav &gt; fileList.txt\n<\/pre><\/blockquote>\n<p>The above will write you a text file called fileList.txt with the name of all .wav files in the directory.<\/p>\n<p>To make a better set out list of files, follow <a href=\"http:\/\/digital.eca.ed.ac.uk\/sounddesignmedia\/2015\/10\/09\/making-recording-logs-quick-tip\/\">this tutorial<\/a> by Owen Green.<\/p>\n<p>If you want to dump the history of whay you&#8217;ve been typing on the commandline for future reference, you can dump it all to a text file like this:<\/p>\n<blockquote><pre>history &gt; ~\/Documents\/thingsIdidOnTheCommandLine.txt<\/pre><\/blockquote>\n<h2 id=\"sec-4\"><span class=\"section-number-2\">4<\/span> Extracting short files from longer files<\/h2>\n<div id=\"text-4\" class=\"outline-text-2\">\n<p><code>mkdir renders <\/code>\n<\/p><pre><code>sox Blister_pack.wav -c 2 renders\/output.wav sinc 0.01k silence 1 0.01 1% trim 0 0.05 fade q 100s 0 100s : newfile : restart<\/code><\/pre>\n<\/div>\n<p>The above will extract a new file when the track detects silence at 1%, it will then trim the file to make it 0.05 seconds long and apply a fade of 100 samples to the beginning and end of the file.<\/p>\n<h3>Joining files together (contatenation)<\/h3>\n<p>SoX will be very happy to add files together to make a new structure:<\/p>\n<blockquote><pre>sox file1.wav file2.wav file3.wav output.wav<\/pre><\/blockquote>\n<p>This is super useful if you want to quickly string together several files you know the names of into a single sound file.<\/p>\n<h3>Joining files together when you can&#8217;t be bothered to find out their names<\/h3>\n<p>cd into the directory where the files are<\/p>\n<p>run the following to join all the sound files in-order to create a file called output.wav<\/p>\n<blockquote><pre>sox *.wav output.wav\n\n<\/pre><\/blockquote>\n<h3>Joining your extracted files together using a random function<\/h3>\n<p>For OS X users, you&#8217;ll need to go back to brew and install the coreutils. Head to the commandline and type:<\/p>\n<blockquote><pre>brew install coreutils<\/pre><\/blockquote>\n<p>This gives you access to some useful list wrangling tools. In this case we want to play with <strong><em>gshuf. <\/em><\/strong>Use gshuf to look at all the files in a folder, generate a random list of the files which SoX will then contatenate. This is great, given the simplicity of the code used to generate output:<\/p>\n<blockquote><pre>sox $(ls *.wav | gshuf) output.wav<\/pre><\/blockquote>\n<p>Linux users probably don&#8217;t need the g in front of gshuf. Windows users, sorry, I&#8217;ve not got as far as testing this on Windows at time of writing.<\/p>\n<p>You&#8217;ll notice if you keep doing the above (changing the &#8216;output.wav&#8217; name each time) that the file count in the directory will keep growing and the size of each file will be bigger because it will keep on adding EVERY file in the folder to the output. It&#8217;s best then to export to a sub directory<\/p>\n<blockquote><pre>mkdir exported<\/pre><pre>sox $(ls *.wav | gshuf) exported\/output.wav<\/pre><\/blockquote>\n<p>DO NOT have spaces in filenames for the above otherwise you won&#8217;t be happy.<\/p>\n<h3>4.5 If you&#8217;re still following me, which I doubt you are, here&#8217;s a killer bit of scripting<\/h3>\n<p>Ok, so you&#8217;ve automatically made a folder of separate sound files and you want to restructure them into something new and you want to do it plenty of times, well there is a way to get the command line to actually do this for you. By using the seq command, you can litterally run a function on the command line several times, and pass an argument across to change what SoX does each time the sequence is run.<\/p>\n<p>Navigate to a folder of short sound files:<\/p>\n<blockquote><pre>cd folder_of_short_sound_files<\/pre><\/blockquote>\n<p>Make a directory in there called outputs:<\/p>\n<blockquote><pre>mkdir outputs<\/pre><\/blockquote>\n<p>When you&#8217;re in there, run the following line. It will create 20 random structures from the sound files that are there, place them in a folder called outputs and name each file uniquely.<\/p>\n<blockquote><pre>for i in {1..10}; do sox $(ls *.wav | gshuf) outputs\/new_$i.wav; done<\/pre><\/blockquote>\n<\/div>\n\n\n\n<p>The above should make you think carefully before opening your DAW, do you really need a DAW at all? Discuss&#8230;.<\/p>\n\n\n\n<p>The above line&#8217;s genius came from attending to answer 97 on this stack exchange post:<\/p>\n\n\n\n<figure class=\"wp-block-embed\"><div class=\"wp-block-embed__wrapper\">\n<a href=\"https:\/\/stackoverflow.com\/questions\/3737740\/is-there-a-better-way-to-run-a-command-n-times-in-bash\" class=\"autohyperlink\">stackoverflow.com\/questions\/3737740\/is-there-a-better-way-to-run-a-command-n-times-in-bash<\/a>\n<\/div><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">5 Joining channels together<\/h3>\n\n\n\n<p>This is obviously useful if you&#8217;ve been given 6 separate stems and you want to convert and play all stems on your own 5.1 system. The stems may be in SMTPE format (e.g L C R Ls Rs LFE ) and you might wish to add the channels together to conform to ITU film channel ordering (L R C LFE Ls Rs) for example.\n<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sox -m left.wav right.wav centre.wav sub.wav ls.wav rs.wav ITUsurroundOrderedFile.wav\n\nsox -m left.wav right.wav aStereoSoundFile.wav<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><\/h3>\n\n\n\n<h2 class=\"wp-block-heading\">Some other and repeated features below, continue at will<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">File Conversion<\/h3>\n\n\n\n<p>It&#8217;s straightforward when the code is installed. To be able to do loads of file conversion (to ogg, mp3 (via lame) and flac, you&#8217;ll need to reinstall sox with these libraries included. The simplest command then is to run this over your current SoX installation. FFMPEG can be used instead of SoX for file conversion, it&#8217;s also immensely powerful.<\/p>\n\n\n\n<blockquote><pre><code>brew reinstall sox --with-lame --with-flac --with-libvorbis<\/code><\/pre><\/blockquote>\n\n\n\n<h4 class=\"wp-block-heading\">Wav to Aif<\/h4>\n\n\n\n<blockquote><pre>sox input.wav output.aif<\/pre><\/blockquote>\n\n\n\n<h4 class=\"wp-block-heading\">Wav to MP3<\/h4>\n\n\n\n<p>To convert to and from mp3<\/p>\n\n\n\n<blockquote><pre>sox ohYeah_02.wav yes.mp3<\/pre><\/blockquote>\n\n\n\n<p>With SoX and the lame lib included<\/p>\n\n\n\n<blockquote><pre>sox infile.wav outfile.mp3<\/pre><\/blockquote>\n\n\n\n<h4 class=\"wp-block-heading\">Wav to flac<\/h4>\n\n\n\n<p>You&#8217;ll need ffmpeg or to install flac, or to reinstall SoX with Flac included.<\/p>\n\n\n\n<blockquote><pre>brew install flac<\/pre><\/blockquote>\n\n\n\n<p>Then run<\/p>\n\n\n\n<blockquote><pre>flac -s sourceFile.wav -o outfile.flac<\/pre><\/blockquote>\n\n\n\n<p>Or with SoX<\/p>\n\n\n\n<blockquote><pre>sox sourceFile.wav flacFile.flac<\/pre><\/blockquote>\n\n\n\n<h4 class=\"wp-block-heading\">Flac to Wav<\/h4>\n\n\n\n<blockquote><pre>flac -s sourceFile.flac -o outfile.wav<\/pre><\/blockquote>\n\n\n\n<p>Or with SoX<\/p>\n\n\n\n<blockquote><pre>sox sourceFile.flac wavFile.wav<\/pre><\/blockquote>\n\n\n\n<pre class=\"wp-block-preformatted\"><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Earwax<\/h3>\n\n\n\n<blockquote><pre>sox inputfile.wav outputfile-earwaxed.wav earwax<\/pre><\/blockquote>\n\n\n\n<p>Use with caution, only works with CD audio and stereo files and _will change the sound, worth a try though as it may work well on some material.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Data gathering<\/h3>\n\n\n\n<blockquote><pre>sox inputFile.wav -n stat<\/pre><\/blockquote>\n\n\n\n<p>gives you this kind of data:<\/p>\n\n\n\n<blockquote><pre>Samples read:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 29106000\n Length (seconds):&nbsp;&nbsp;&nbsp; 330.000000\n Scaled by:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2147483647.0\n Maximum amplitude:&nbsp;&nbsp;&nbsp;&nbsp; 0.045941\n Minimum amplitude:&nbsp;&nbsp;&nbsp; -0.042231\n Midline amplitude:&nbsp;&nbsp;&nbsp;&nbsp; 0.001855\n Mean&nbsp;&nbsp;&nbsp; norm:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0.002434\n Mean&nbsp;&nbsp;&nbsp; amplitude:&nbsp;&nbsp;&nbsp; -0.000001\n RMS&nbsp;&nbsp;&nbsp;&nbsp; amplitude:&nbsp;&nbsp;&nbsp;&nbsp; 0.004545\n Maximum delta:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0.059067\n Minimum delta:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0.000000\n Mean&nbsp;&nbsp;&nbsp; delta:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0.000821\n RMS&nbsp;&nbsp;&nbsp;&nbsp; delta:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0.002238\n Rough&nbsp;&nbsp; frequency:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3456\n Volume adjustment:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 21.767<\/pre><\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\">Generating waveforms<\/h3>\n\n\n\n<p>This can be done with ffmpeg:<\/p>\n\n\n\n<blockquote><pre>ffmpeg -i inputFile.wav -lavfi showwavespic=split_channels=1:s=1024x800 outputWaveform.png<\/pre><\/blockquote>\n\n\n\n<p>More information on this feature is here:<\/p>\n\n\n\n<figure class=\"wp-block-embed\"><div class=\"wp-block-embed__wrapper\">\n<a href=\"https:\/\/ffmpeg.org\/ffmpeg-filters.html#showwavespic\" class=\"autohyperlink\">ffmpeg.org\/ffmpeg-filters.html#showwavespic<\/a>\n<\/div><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Batch processing using FFMPEG or SOX<\/h3>\n\n\n\n<p>If you&#8217;ve been busy making loads of files with automated processes, you might want to look at all of the waveforms, or indeed do some visual sorting. When there are loads of files and you hate typing in files names, you can use batch processes. To generate waveforms for all wav files in a folder, this should help. Note you&#8217;ll need to:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>mkdir waveforms<\/p><\/blockquote>\n\n\n\n<p>before you run this. The code is expecting a folder called waveforms to write to. Note, we&#8217;re also swapping the extension .wav for .png with the &#8220;${f\/%wav\/png}&#8221;, the quotes should mean that you can cope with file names with spaces, but I think spaces are best avoided in file names if possible.<\/p>\n\n\n\n<blockquote><pre>for f in *.wav; do ffmpeg -i \"$f\" -lavfi showwavespic=split_channels=1:s=1024x800 waveforms\/\"${f\/%wav\/png}\"; done<\/pre><\/blockquote>\n\n\n\n<p>It&#8217;s pretty handy as you can check tht your fades have actually worked as you can see them. What you don&#8217;t get here is any data on the waveform however and spectrograms might be more useful to you.<\/p>\n\n\n\n<p>To batch render spectrograms, you can use SoX or FFMPEG.&nbsp; To show another way of batching, we&#8217;ll use SoX.<\/p>\n\n\n\n<p>First<\/p>\n\n\n\n<blockquote><pre>mkdir spectrogram<\/pre><\/blockquote>\n\n\n\n<p>This will make a folder called spectrgram in the folder you&#8217;re currently working in<\/p>\n\n\n\n<p>Now, you can run something like this<\/p>\n\n\n\n<blockquote><pre>for f in *.wav; do sox \"$f\" -n spectrogram -t \"$f\" -c \"$f\" -o&nbsp; spectrogram\/\"$f.png\"; done<\/pre><\/blockquote>\n\n\n\n<p>It basically looks for all the files in the folder with a .wav extension, then does the sox command giving title to the image (-t and text at bottom left -c).<\/p>\n\n\n\n<p>It&#8217;s good, but better would be to lose the .wav extension from the file names that get rendered. So, try this;<\/p>\n\n\n\n<blockquote><pre>for i in *.wav; do sox $i -n spectrogram -o spectrogram\/${i%%.wav}.png; done<\/pre><\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\">Starting with some batch processes using SoX<\/h3>\n\n\n\n<p>Batch convert to mp3 when you&#8217;ve got the LAME library connected with SoX:<\/p>\n\n\n\n<blockquote><pre>for i in *.WAV; do sox $i exports\/${i%%.wav}.mp3; done\n\n<\/pre><\/blockquote>\n\n\n\n<p>How might you batch convert to FLAC or AIFF?<\/p>\n\n\n\n<figure class=\"wp-block-embed\"><div class=\"wp-block-embed__wrapper\">\n<a href=\"https:\/\/unix.stackexchange.com\/questions\/203535\/create-sox-batch-script-to-extract-first-15-seconds-and-rename-multiple-files-in\" class=\"autohyperlink\">unix.stackexchange.com\/questions\/203535\/create-sox-batch-script-to-extract-first-15-seconds-and-rename-multiple-files-in<\/a>\n<\/div><\/figure>\n\n\n\n<p>Handy starting point for writing scripts that handle multple files and generate output data<\/p>\n\n\n\n<figure class=\"wp-block-embed\"><div class=\"wp-block-embed__wrapper\">\n<a href=\"https:\/\/hydrogenaud.io\/index.php\/topic,83319.0.html\" class=\"autohyperlink\">hydrogenaud.io\/index.php\/topic,83319.0.html<\/a>\n<\/div><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Quick crash course on getting SoX running on your windows or Os X installation;<\/h3>\n\n\n\n<p>Thanks UoW:<\/p>\n\n\n\n<figure class=\"wp-block-embed\"><div class=\"wp-block-embed__wrapper\">\n<a href=\"https:\/\/courses.cs.washington.edu\/courses\/cse373\/12sp\/homework\/1\/soxusage.txt\" class=\"autohyperlink\">courses.cs.washington.edu\/courses\/cse373\/12sp\/homework\/1\/soxusage.txt<\/a>\n<\/div><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Here&#8217;s a way to get FFMPEG installed on windows 10<\/h3>\n\n\n\n<p>Thanks MasimMan<\/p>\n\n\n\n<figure class=\"wp-block-embed\"><div class=\"wp-block-embed__wrapper\">\n<a href=\"https:\/\/www.youtube.com\/watch?v=pHR3ttH5t-w\" class=\"autohyperlink\">www.youtube.com\/watch?v=pHR3ttH5t-w<\/a>\n<\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>The Command Line Before going further, have a read of this, it talks you through some starting points to working on the commandline: Check out the SoX pages: <a href=\"http:\/\/sox.sourceforge.net\/\" class=\"autohyperlink\">sox.sourceforge.net\/<\/a> 1 Managing the terminal The terminal or shell can be daunting &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"more-link\" href=\"https:\/\/digital.eca.ed.ac.uk\/sounddesignmedia\/2018\/10\/01\/03-using-the-commandline-to-process-audio\/\"> <span class=\"screen-reader-text\">03 &#8211; Using the command line to process audio<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,32,5],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/digital.eca.ed.ac.uk\/sounddesignmedia\/wp-json\/wp\/v2\/posts\/1163"}],"collection":[{"href":"https:\/\/digital.eca.ed.ac.uk\/sounddesignmedia\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/digital.eca.ed.ac.uk\/sounddesignmedia\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/digital.eca.ed.ac.uk\/sounddesignmedia\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/digital.eca.ed.ac.uk\/sounddesignmedia\/wp-json\/wp\/v2\/comments?post=1163"}],"version-history":[{"count":14,"href":"https:\/\/digital.eca.ed.ac.uk\/sounddesignmedia\/wp-json\/wp\/v2\/posts\/1163\/revisions"}],"predecessor-version":[{"id":1303,"href":"https:\/\/digital.eca.ed.ac.uk\/sounddesignmedia\/wp-json\/wp\/v2\/posts\/1163\/revisions\/1303"}],"wp:attachment":[{"href":"https:\/\/digital.eca.ed.ac.uk\/sounddesignmedia\/wp-json\/wp\/v2\/media?parent=1163"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/digital.eca.ed.ac.uk\/sounddesignmedia\/wp-json\/wp\/v2\/categories?post=1163"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/digital.eca.ed.ac.uk\/sounddesignmedia\/wp-json\/wp\/v2\/tags?post=1163"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}