abr...@cjaudio.com wrote:
> Does anyone know how to do this "in house", eg. without resorting to a
> specialized scripting language?
No. Saying you have a CSV file is about like saying you have an Excel
file; it allows you to reliably produce the same set of numbers, but it
doesn't carry any information about what the numbers represent. You
have to provide this knowledge to whatever program you use to convert
the CSV file to something else. For widely-used CSV formats (maybe US
Census data?) there are ready-made programs for it, but for all the
other millions of CSV formats in the world, you get to roll your own.
For jobs like this, it usually works out better to implement the program
in more of a scripting language (awk, Perl, Python, etc) instead of a
real, official compiled language (FORTRAN, C, C++, etc). The scripting
language will have built-in features for parsing the CSV file that you
will take a long time for you to reimplement badly in an official
compiled language. Also, the requirements are almost guaranteed to be
poorly specified, which means more revisions of the code, which is
usually easier with a scripting language.
>
http://www.bluechillies.com/software/file-conversion-csv-to-wav.html
A lot of these are probably wrappers around existing open-source
libraries that they then charge you $17 to $80 for. Which would be OK
if the perpetrators provided any end-user support in return, or
supported further development of the underlying code, but they don't.
That looks like a reasonable approach, actually. It expects a CSV file
with two columns: time and amplitude. It reads both values, discards
the time (it seems to assume that the input data is sampled at 100 kHz),
keeps the amplitudes in an array, normalizes the entire array, resamples
to 44.1 kHz, and writes a 16-bit mono 44.1 kHz WAV file.
I am not sure what a couple of the fixed constants do, so this might die
or do an incomplete job if you try to convert a really huge file
(several dozen minutes maybe?), but for shorter files it should be fine.
On Linux you would save the contents of that github file to (say)
hantek-csv-converter.py . Then you would put the CSV data in (say)
hantek.csv in the same directory. Then, in that directory, do
chmod 755 hantek-csv-converter.py
./hantek-csv-converter.py hantek.csv
and after a bit, a new file named hantek.wav should appear in the same
directory.
On Windows you need to install Python for Windows first, which exists.
If the installer asks you about configuring it to run Python scripts
from the command line, say yes. Save the contents of that github file
to (say) hantek-csv-converter.py . Then you would put the CSV data in
(say) hantek.csv in the same directory. Then, in a cmd.exe window,
navigate to that directory, and do
python hantek-csv-converter.py hantek.csv
and after a bit, a new file named hantek.wav should appear in the same
directory.
If the only thing that will do is a single .exe with a nice happy clicky
interface, you'll probably either need to get it from Hantek or pay to
have one written. It will probably be cheaper to buy a different signal
generator that saves files in a reasonable format than to buy a custom-
written program.
Matt Roberds