Converting AIFF to text
Moderator: Martin Hairer
Converting AIFF to text
I am looking to do time-based analysis of the AIFF files that I am creating. (In contrast to frequency-based.) This requires that I convert the AIFF file into something that I can analyze directly, such as a txt file.
I can read the AIFF file in a text editor, but I need to convert the data.
Does anyone have any suggestions on how I can accomplish this, and where I can get a symbol list to perform the conversion myself?
I can read the AIFF file in a text editor, but I need to convert the data.
Does anyone have any suggestions on how I can accomplish this, and where I can get a symbol list to perform the conversion myself?
-
- Posts: 379
- Joined: Thu Mar 15, 2007 3:57 pm
Converting AIFF to text
Years ago in a country far away, I used Amadeus (some earlier version)
to write a raw data file out. I then analyzed the data using a simple C
program that I wrote (my first and last C program). I then wrote the
output out and then had Amadeus read it and turn it back into an Aiff
flle. This was for a power pc so of course the bytes were swapped from
the intel.
Probably as easy a route as any is to dump a raw file, read the data
in, byte/word by byte/wordand then print out the values in text to the
screen and pipe the screen to a file.
Chuck
On 9/19/12 10:38 AM, lemallard wrote:
Charles D Jonah
Building 200
Chemical Sciences and Engineering Division
9700 S. Cass Avenue
Argonne, IL 60439
630-252-3471 CDJonah@anl.gov
_______________________________________________
Amadeus forum mailing list
Unsubscribe / change settings at http://two.pairlist.net/mailman/listinfo/forum_list
to write a raw data file out. I then analyzed the data using a simple C
program that I wrote (my first and last C program). I then wrote the
output out and then had Amadeus read it and turn it back into an Aiff
flle. This was for a power pc so of course the bytes were swapped from
the intel.
Probably as easy a route as any is to dump a raw file, read the data
in, byte/word by byte/wordand then print out the values in text to the
screen and pipe the screen to a file.
Chuck
On 9/19/12 10:38 AM, lemallard wrote:
--I am looking to do time-based analysis of the AIFF files that I am creating. (In contrast to frequency-based.) This requires that I convert the AIFF file into something that I can analyze directly, such as a txt file.
I can read the AIFF file in a text editor, but I need to convert the data.
Does anyone have any suggestions on how I can accomplish this, and where I can get a symbol list to perform the conversion myself?
_______________________________________________
Amadeus forum mailing list
Unsubscribe / change settings at http://two.pairlist.net/mailman/listinfo/forum_list
Charles D Jonah
Building 200
Chemical Sciences and Engineering Division
9700 S. Cass Avenue
Argonne, IL 60439
630-252-3471 CDJonah@anl.gov
_______________________________________________
Amadeus forum mailing list
Unsubscribe / change settings at http://two.pairlist.net/mailman/listinfo/forum_list
Converting AIFF to text
Did you read it as a raw file?
I don't think it is practicable to read it into a text editor -- most of
the values are not normal text values -- some will be control
characters, etc.
I can probably find my old C program and rearrange it to generate bytes
to text and then you can read the data in and re-interpret it (have to
put bytes back into 16-bit words, worry about sign, etc.)
Chuck
On 9/19/12 12:34 PM, lemallard wrote:
Amadeus forum mailing list
Unsubscribe / change settings at http://two.pairlist.net/mailman/listinfo/forum_list
I don't think it is practicable to read it into a text editor -- most of
the values are not normal text values -- some will be control
characters, etc.
I can probably find my old C program and rearrange it to generate bytes
to text and then you can read the data in and re-interpret it (have to
put bytes back into 16-bit words, worry about sign, etc.)
Chuck
On 9/19/12 12:34 PM, lemallard wrote:
_______________________________________________That is exactly what I am looking to do. However, as I read the file in its native format, the symbols are ineligible. So, I will also need to know what symbol list is--unless what I am reading is native to Amadeus.
_______________________________________________
Amadeus forum mailing list
Unsubscribe / change settings at http://two.pairlist.net/mailman/listinfo/forum_list
Amadeus forum mailing list
Unsubscribe / change settings at http://two.pairlist.net/mailman/listinfo/forum_list
Converting AIFF to text
Okay, I will need to find it -- maybe tonight
chuck
On 9/19/12 11:07 PM, lemallard wrote:
Amadeus forum mailing list
Unsubscribe / change settings at http://two.pairlist.net/mailman/listinfo/forum_list
chuck
On 9/19/12 11:07 PM, lemallard wrote:
_______________________________________________Yes, I read it as a raw file. Looking at your C-code would be a good start.
_______________________________________________
Amadeus forum mailing list
Unsubscribe / change settings at http://two.pairlist.net/mailman/listinfo/forum_list
Amadeus forum mailing list
Unsubscribe / change settings at http://two.pairlist.net/mailman/listinfo/forum_list
Converting AIFF to text
It would be except I must have deleted that folder. I have traces of
the program but nothing useful any more. I went back a couple of backups
and still couldn't find it. It may well have been 5 or more years ago.
As I recall, I read the file in byte by byte, put the two bytes together
to make the word and went from there. But I wouldn't want to count on my
memory as I seemed to have deleted everything and I don't remember that.
It was an old laptop with a limited disk drive..
Chuck
On 9/19/12 11:07 PM, lemallard wrote:
Amadeus forum mailing list
Unsubscribe / change settings at http://two.pairlist.net/mailman/listinfo/forum_list
the program but nothing useful any more. I went back a couple of backups
and still couldn't find it. It may well have been 5 or more years ago.
As I recall, I read the file in byte by byte, put the two bytes together
to make the word and went from there. But I wouldn't want to count on my
memory as I seemed to have deleted everything and I don't remember that.
It was an old laptop with a limited disk drive..
Chuck
On 9/19/12 11:07 PM, lemallard wrote:
_______________________________________________Yes, I read it as a raw file. Looking at your C-code would be a good start.
_______________________________________________
Amadeus forum mailing list
Unsubscribe / change settings at http://two.pairlist.net/mailman/listinfo/forum_list
Amadeus forum mailing list
Unsubscribe / change settings at http://two.pairlist.net/mailman/listinfo/forum_list
-
- Posts: 12
- Joined: Tue Jun 28, 2011 11:13 am
if you are a programmer the simplest solution would be to use the python language with one of the aif, wav, or audio op modules available from the python standard library:
http://docs.python.org/modindex.html
I tried that approach some time ago, using the aifc module, and I didn't have to worry about what you call the format of the file: it will only take you one line of code to open an aiff file, and another one to read its audio frames; plus any manipulations you'd want to perform on that data, of course;
from my experience, developing such a program is certainly faster than when using the C language... the drawback is that the performance is way slower but for a one-shot program, it's alright!
http://docs.python.org/modindex.html
I tried that approach some time ago, using the aifc module, and I didn't have to worry about what you call the format of the file: it will only take you one line of code to open an aiff file, and another one to read its audio frames; plus any manipulations you'd want to perform on that data, of course;
from my experience, developing such a program is certainly faster than when using the C language... the drawback is that the performance is way slower but for a one-shot program, it's alright!
-
- Posts: 12
- Joined: Tue Jun 28, 2011 11:13 am
ah, not only does it sound simple but since python code looks much like english, it is actually very simple; all you'll have to learn is how to open a terminal window and type a command...
for instance, if the python program is:
and this script is saved in a file called read-a.py in your home directory, here is the command to execute the script and read the file named sample.aif, also in your home directory:
and then the program would display something like:
for instance, if the python program is:
Code: Select all
import aifc, sys
if len(sys.argv) is not 2: exit('file name expected')
stream = aifc.open(sys.argv[1], 'r')
print 'mono' if stream.getnchannels() is 1 else 'stereo',
print stream.getsampwidth() * 8, 'bits,',
print stream.getframerate(), 'Hz sampling rate'
data = stream.readframes(stream.getnframes())
print len(data), 'bytes read'
Code: Select all
python read-a.py sample.aif
Code: Select all
stereo 16 bits, 44100 Hz sampling rate
9663652 bytes read