View previous topic :: View next topic |
Author |
Message |
lemallard
Joined: 19 Sep 2012 Posts: 7
|
Posted: Wed Sep 19, 2012 3:38 pm Post subject: 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? |
|
Back to top |
|
 |
CDJonah_alt
Joined: 15 Mar 2007 Posts: 379
|
Posted: Wed Sep 19, 2012 5:05 pm Post subject: 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:
Quote: | 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 |
|
Back to top |
|
 |
lemallard
Joined: 19 Sep 2012 Posts: 7
|
Posted: Wed Sep 19, 2012 5:34 pm Post subject: |
|
|
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 the symbol list is--unless what I am reading is native to Amadeus. |
|
Back to top |
|
 |
CDJonah
Joined: 11 Nov 2006 Posts: 116
|
Posted: Wed Sep 19, 2012 5:55 pm Post subject: 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:
Quote: | 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 |
|
Back to top |
|
 |
lemallard
Joined: 19 Sep 2012 Posts: 7
|
Posted: Thu Sep 20, 2012 4:07 am Post subject: |
|
|
Yes, I read it as a raw file. Looking at your C-code would be a good start.  |
|
Back to top |
|
 |
CDJonah
Joined: 11 Nov 2006 Posts: 116
|
Posted: Thu Sep 20, 2012 3:53 pm Post subject: 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 |
|
Back to top |
|
 |
lemallard
Joined: 19 Sep 2012 Posts: 7
|
Posted: Thu Sep 20, 2012 5:56 pm Post subject: |
|
|
Thanks. I know that this is obscure, but it is necessary.  |
|
Back to top |
|
 |
CDJonah
Joined: 11 Nov 2006 Posts: 116
|
Posted: Fri Sep 21, 2012 4:03 am Post subject: 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 |
|
Back to top |
|
 |
lemallard
Joined: 19 Sep 2012 Posts: 7
|
Posted: Fri Sep 21, 2012 11:01 am Post subject: |
|
|
Thanks for the effort, Chuck. I am assuming that I will be able to read this directly, even though it is not a text file. The question now is the format of the file. |
|
Back to top |
|
 |
rockbottom
Joined: 28 Jun 2011 Posts: 12
|
Posted: Wed Oct 03, 2012 8:49 am Post subject: |
|
|
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! |
|
Back to top |
|
 |
lemallard
Joined: 19 Sep 2012 Posts: 7
|
Posted: Wed Oct 03, 2012 10:54 am Post subject: |
|
|
Thank you, rockbottom! That does sound much, much simpler. I do not use Python, but I am more than happy to learn to do so, if it simplifies this problem for me! |
|
Back to top |
|
 |
rockbottom
Joined: 28 Jun 2011 Posts: 12
|
Posted: Wed Oct 03, 2012 3:30 pm Post subject: |
|
|
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:
Code: | 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' |
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:
Code: | python read-a.py sample.aif | and then the program would display something like:
Code: | stereo 16 bits, 44100 Hz sampling rate
9663652 bytes read |
|
|
Back to top |
|
 |
lemallard
Joined: 19 Sep 2012 Posts: 7
|
Posted: Wed Oct 03, 2012 8:19 pm Post subject: |
|
|
Thank you again! When I work on this, I will get back to you about how I did it. This is clearly a good route to take. |
|
Back to top |
|
 |
|