Re: convertiing raw data to wav from analytic instrument ??
Doug Lee <dgl <at> dlee.org>
2010-12-11 19:17:39 GMT
Try each of the suggested encodings to see if any give you good
results, if you don't know the encoding used to create the original
file. Chances are it's either signed, unsigned, or float, since it
sounds like raw data not encoded with any compression algorithm
intended for sound.
On Sat, Dec 11, 2010 at 06:33:47PM +0100, ciclo esano wrote:
Great answer!
yes you hit the nail!
Using play -e raw -b 32 -c 1 -r 441000 --endian little dat.raw
I am facing with the following error:
play FAIL sox: --encoding: `raw' is not one of: signed-integer,
unsigned-integer, floating-point, ms-adpcm, ima-adpcm, oki-adpcm,
gsm-full-rate, u-law, mu-law, a-law.
That's strange. I am sure the data are in little-endian format (since
the storage CPU is Intel), each sample is 32-bit long integer, I have
32768 samples but have no idea about the real sampling rate. This I can
try with several speeds, but the question about the "encoding" still
unclear for me.
So, I am stuck here
2010/12/11 Doug Lee <[1]dgl <at> dlee.org>
On Sat, Dec 11, 2010 at 05:43:01PM +0100, ciclo esano wrote:
> Dear soxer
> I have a set of digital data acquired in the time domain by an
> analytical instrument, stored as 32-bit long integer
(little-endian).
> Each sample contains mixed audio signals (10Hz - 20kHz) which
decay
> exponentially in a couple of seconds.
> I need to convert that data in an audio format (PCM ob better WAV)
> which can be easily played by any multimedia player.
> Unfortunately I have no idea on how to start with this project.
> I thought the command line sox should be able to handle that, if I
use
> its
> command line switches to force it to treat your data as 32-bit
samples
> at a
> particular rate.
> Something like this maybe should work:
> sox -e raw -b 32 -c 1 -r SAMPLERATE --endian little data.raw -b 16
-c 1
> -r 44100 sound.wav
>
> Moreover the information about bit rate, channel and everything
> concerning audio file is very difficult to apply here, since the
raw
> data are coming from a digitizer after several downsampling
processes
> to have all the signals in the audio range (in fact they arise
from the
> high frequency of nuclear spins, hundreds of MHz)
Sounds like a fascinating and useful application of SoX actually!
Other pros may have more to say here, but here's my spin (pardon the
pun) on this. I'm saying more than necessary so that the message
will
stand on its own as possible tutorial material in the archives:
I think you're trying to convert one format to another. If you're
trying to do more than that, my directions below may be incomplete.
I first advise using `play' if you can, to test your input data
interpretation on the fly, before making an output file of the
results. Here's what you need for that:
I think you have the exact sampling rate for the input file. If
not,
you'll either need it or need to put up with funny results due to
its
absence. If the sampling rate for the input data file is not
constant, we have more problems I think.
Next you need the exact format of the data - number of bits,
encoding,
and such. You seem to have that..
Then the syntax to specify all this for the input file. Starting
with
your example, try
play -e raw -b 32 -c 1 -r SAMPLERATE --endian little data.raw
If you don't get the sort of sound you want from that, the
intended
resulting wav file wouldn't sound right either.
Once you get acceptable results live, you can start trying to
convert to another output format from there. Your example should
try to make a monaural, 16-bit, 44.1 kHz result using all other
format specifications as found in the original file.
Unless I missed something, your approach should work, perhaps with
a little tweaking if the source file interpretation isn't right
already. If not, let us know what's going wrong, and we can go
from there.
And if it's no violation of contract or any similar regulation,
I'd
enjoy hearing a resulting file, preferably wav, flac, or other
lossless version. :)
--
Doug Lee [2]dgl <at> dlee.org
[3]http://www.dlee.org
SSB BART Group [4]doug.lee <at> ssbbartgroup.com
[5]http://www.ssbbartgroup.com
"The nice thing about standards is that there are so many of them
to choose from." -- Andrew Tanenbaum
--------------------------------------------------------------------
----------
Oracle to DB2 Conversion Guide: Learn learn about native support for
PL/SQL,
new data types, scalar functions, improved concurrency, built-in
packages,
OCI, SQL*Plus, data movement tools, best practices and more.
[6]http://p.sf.net/sfu/oracle-sfdev2dev
_______________________________________________
Sox-users mailing list
[7]Sox-users <at> lists.sourceforge.net
[8]https://lists.sourceforge.net/lists/listinfo/sox-users
References
1. mailto:dgl <at> dlee.org
2. mailto:dgl <at> dlee.org
3. http://www.dlee.org/
4. mailto:doug.lee <at> ssbbartgroup.com
5. http://www.ssbbartgroup.com/
6. http://p.sf.net/sfu/oracle-sfdev2dev
7. mailto:Sox-users <at> lists.sourceforge.net
8. https://lists.sourceforge.net/lists/listinfo/sox-users
------------------------------------------------------------------------------
Oracle to DB2 Conversion Guide: Learn learn about native support for PL/SQL,
new data types, scalar functions, improved concurrency, built-in packages,
OCI, SQL*Plus, data movement tools, best practices and more.
http://p.sf.net/sfu/oracle-sfdev2dev
_______________________________________________
Sox-users mailing list
Sox-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-users
--
--
Doug Lee dgl <at> dlee.org http://www.dlee.org
SSB BART Group doug.lee <at> ssbbartgroup.com http://www.ssbbartgroup.com
"It's not easy to be crafty and winsome at the same time, and few accomplish
it after the age of six." --John W. Gardner and Francesca Gardner Reese
------------------------------------------------------------------------------
Oracle to DB2 Conversion Guide: Learn learn about native support for PL/SQL,
new data types, scalar functions, improved concurrency, built-in packages,
OCI, SQL*Plus, data movement tools, best practices and more.
http://p.sf.net/sfu/oracle-sfdev2dev