Re: [a little OT] File format for a bunch of floats
Re: [a little OT] File format for a bunch of floats
- Subject: Re: [a little OT] File format for a bunch of floats
- From: Iain McCowan <email@hidden>
- Date: Wed, 22 Sep 2010 20:51:19 +1000
Hi Lance,
I have always used "sox" for this sort of thing. (there is afconvert on mac which is similar, but I'm not as familiar and don't know if it is as flexible).
As you say, it is a raw format, 32-bit, floats... so you can convert it to e.g. a wave file using sox with something like:
sox -t raw -b 32 -f -L -r 16000 foo.raw -u -b 16 foo.wav
Assuming your sample rate is 16000 (or change to whatever it is if you know) might turn it into a wave file with 16-bit unsigned ints, just going from the man page... of course there are plenty more choices than wave too.
And then you can always script to run over a set of files. I'm rusty on this, so read the man and play a bit - you can probably get the sample rate by trial and error if you don't know it.
you can get sox for mac from darwin ports:
cheers,
Iain.
On Wed, Sep 22, 2010 at 8:30 PM, Jerry
<email@hidden> wrote:
On Sep 22, 2010, at 3:24 AM, Jerry wrote:
I have a _lot_ of audio files that have been generated by unusual means. They are 32-bit little endian floating point, one channel, with no header. I suppose this is some form of "raw." It's just a bunch of floats, all audio.
I would like to be able to have them play by e.g. invoking QuickLook on them or other similar means such as within DEVONthink. I don't want to modify the file unless I absolutely have to, and then only by automatic means (no manually opening in an editor and saving in another format.
I'm pretty sure this is a stupid question, but is there some file extension that I can add that will make the OS recognize them correctly?
My fallback is to save one file as AIFF and see how much bigger the AIFF is than the raw--that is the header size and it is at the beginning. I can read out that number of bytes and stuff them in to the front of my file before I write out the floats, then add .aiff to the file name. I recall having done this in the past (manually, for a small number of files) and it worked for all similar AIFF files regardless of lengths.
I know this isn't really a CoreAudio question but what better place to ask. 8^)
On a related note, I used to have an OS9 utility that would tell me the header length of AIFF files. Is there a tool around that does this? Command line?
Thanks,
Lance
Responding to my own post...
Is there a command line tool that I can use to convert this file format into another, more "OS-friendly," format? I'm on 10.5.
Jerry
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden