Mailing ListMailing List   FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Converting AIFF to text
Goto page 1, 2  Next
 
Post new topic   Reply to topic    www.hairersoft.com Forum Index -> Discussion
View previous topic :: View next topic  
Author Message
lemallard



Joined: 19 Sep 2012
Posts: 7

PostPosted: Wed Sep 19, 2012 3:38 pm    Post subject: Converting AIFF to text Reply with 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?
Back to top
View user's profile Send private message
CDJonah_alt



Joined: 15 Mar 2007
Posts: 378

PostPosted: Wed Sep 19, 2012 5:05 pm    Post subject: Converting AIFF to text Reply with quote

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
View user's profile Send private message
lemallard



Joined: 19 Sep 2012
Posts: 7

PostPosted: Wed Sep 19, 2012 5:34 pm    Post subject: Reply with 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 the symbol list is--unless what I am reading is native to Amadeus.
Back to top
View user's profile Send private message
CDJonah



Joined: 11 Nov 2006
Posts: 112

PostPosted: Wed Sep 19, 2012 5:55 pm    Post subject: Converting AIFF to text Reply with quote

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
View user's profile Send private message
lemallard



Joined: 19 Sep 2012
Posts: 7

PostPosted: Thu Sep 20, 2012 4:07 am    Post subject: Reply with quote

Yes, I read it as a raw file. Looking at your C-code would be a good start. Smile
Back to top
View user's profile Send private message
CDJonah



Joined: 11 Nov 2006
Posts: 112

PostPosted: Thu Sep 20, 2012 3:53 pm    Post subject: Converting AIFF to text Reply with quote

Okay, I will need to find it -- maybe tonight

chuck

On 9/19/12 11:07 PM, lemallard wrote:
Quote:
Yes, I read it as a raw file. Looking at your C-code would be a good start. Smile




_______________________________________________
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
View user's profile Send private message
lemallard



Joined: 19 Sep 2012
Posts: 7

PostPosted: Thu Sep 20, 2012 5:56 pm    Post subject: Reply with quote

Thanks. I know that this is obscure, but it is necessary. Smile
Back to top
View user's profile Send private message
CDJonah



Joined: 11 Nov 2006
Posts: 112

PostPosted: Fri Sep 21, 2012 4:03 am    Post subject: Converting AIFF to text Reply with quote

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:
Quote:
Yes, I read it as a raw file. Looking at your C-code would be a good start. Smile




_______________________________________________
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
View user's profile Send private message
lemallard



Joined: 19 Sep 2012
Posts: 7

PostPosted: Fri Sep 21, 2012 11:01 am    Post subject: Reply with quote

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
View user's profile Send private message
rockbottom



Joined: 28 Jun 2011
Posts: 12

PostPosted: Wed Oct 03, 2012 8:49 am    Post subject: Reply with quote

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
View user's profile Send private message
lemallard



Joined: 19 Sep 2012
Posts: 7

PostPosted: Wed Oct 03, 2012 10:54 am    Post subject: Reply with quote

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
View user's profile Send private message
rockbottom



Joined: 28 Jun 2011
Posts: 12

PostPosted: Wed Oct 03, 2012 3:30 pm    Post subject: Reply with quote

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
View user's profile Send private message
lemallard



Joined: 19 Sep 2012
Posts: 7

PostPosted: Wed Oct 03, 2012 8:19 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    www.hairersoft.com Forum Index -> Discussion All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group