I am building a Binaural Synthesis engine in Max/MSP for use with a 3D Virtual Audiory Space built in C++. To make this work I've created a convolution filter that takes impulse responses.
I'm using the MIT KEMAR library of HRIR measurements for the basis of my convolution, but I'm running into a problem.
The impulse responses are stored as 16bit headerless .dat files. Which is great because there's no extra unwanted information in there. but Max will not import .raw or .dat files. It cannot parse the file properly.
So I've resigned myself to having to convert all of my .dat impulse responses to .wav and read them in that way. Audacity can do this just fine, the problem is while there is a batch export, there is no batch import for raw data files. I'll have to import every file manually, and there are over 500 of them. Audacity won't let me shift-click or ctrl-click in the import raw data dialog.
Is there a way to write a script that will help me with this? or a workaround native to audacity? I could write a script that would do the conversions in supercollider for me, but the time it would take me to write, test, refactor, test again, and finalize a script there would probably take me longer than manually importing every file. I'm stuck....
Batch Import of Raw Data for file conversion.
Forum rules
Audacity 1.3.x is now obsolete. Please use the current Audacity 2.1.x version.
The final version of Audacity for Windows 98/ME is the legacy 2.0.0 version.
Audacity 1.3.x is now obsolete. Please use the current Audacity 2.1.x version.
The final version of Audacity for Windows 98/ME is the legacy 2.0.0 version.
Re: Batch Import of Raw Data for file conversion.
Audacity Chains do not currently support RAW import.
SoX is probably the best tool for the job.
I don't use Windows so I'm unsure of the necessary steps for a .BAT file but I believe there is a sample .BAT file included in the SoX download.
I can probably help with the necessary SoX command, so I'll get back to you on that point.
SoX is probably the best tool for the job.
I don't use Windows so I'm unsure of the necessary steps for a .BAT file but I believe there is a sample .BAT file included in the SoX download.
I can probably help with the necessary SoX command, so I'll get back to you on that point.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
Re: Batch Import of Raw Data for file conversion.
steve wrote:I can probably help with the necessary SoX command, so I'll get back to you on that point.
Code: Select all
sox -s -b 16 -c 1 -r 44100 infile.raw outfile.wavinfile.raw is the file name of the input file
outfile.wav is the name of the output file
-s means that the input file is signed integer
-b 16 means that the input file is 16 bit
-c 1 means that the input file is 1 channel (mono)
-r 44100 means that the input file has a sample rate of 44100 Hz.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
Re: Batch Import of Raw Data for file conversion.
Ok, here's a batch script that should work with SoX
To use this,
Install SoX
Open NotePad and copy and paste the above code.
Save the file inside the SoX folder and call it "import-raw.bat" (the name is not important but it needs the .bat file extension)
Make a shortcut to this file on your desktop
Now just drag and drop your raw files onto the shortcut.
The converted files should appear in a folder called "converted" inside the Sox folder.
Code: Select all
cd %~dp0
mkdir converted
FOR %%A IN (%*) DO sox -t raw -s -b 16 -c 1 -r 44100 %%A "converted/%%~nA.wav"
pause
Install SoX
Open NotePad and copy and paste the above code.
Save the file inside the SoX folder and call it "import-raw.bat" (the name is not important but it needs the .bat file extension)
Make a shortcut to this file on your desktop
Now just drag and drop your raw files onto the shortcut.
The converted files should appear in a folder called "converted" inside the Sox folder.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)