Re: getting PCM data from an audio file
Re: getting PCM data from an audio file
- Subject: Re: getting PCM data from an audio file
- From: "Andrew GFunk" <email@hidden>
- Date: Mon, 02 Jun 2003 22:05:42 -0700
Thanks for trying to help me out Philippe! I thought about the FSRef being
NULL. If it were, the call
printf("mSampleRate %g\n", srcFmt.mSampleRate);
shouldn't work, right? It does though. Here's the output of my program:
mSampleRate 44100
2003-06-02 21:56:42.117 audioFileTest1[407] <00000000 >
The second line comes from the following call:
NSLog(@"%@", data);
So I guess the FSRef part of my code is right. Any other ideas?
Or maybe some simple example code on reading audio data?
Thanks,
Andrew Garber
From: Philippe Wicker <email@hidden>
To: "Andrew GFunk" <email@hidden>
CC: CoreAudio <email@hidden>
Subject: Re: getting PCM data from an audio file
Date: Mon, 2 Jun 2003 17:19:33 +0200
On Monday, June 2, 2003, at 07:41 AM, Andrew GFunk wrote:
FSRef fsRef;
FSPathMakeRef ([[thisBundle pathForResource:@"Waiting2" ofType:@"aif"]
UTF8String], &fsRef, NULL);
AudioFileOpen(&fsRef, 1, 0, &originalAudioFile);
AudioFileGetProperty(originalAudioFile, kAudioFilePropertyDataFormat,
&propertySize, &srcFmt);
printf("mSampleRate %g\n", srcFmt.mSampleRate);
You could check if FSPathMakeRef returns a non null FSRef.
FSPathMakeRef expects a 1st parameter which is a const UInt8* but a C
string (char* or SInt8*) containing a UNIX (POSIX) path works well (this is
how I use it myself). Maybe pathForResource it is not returning a standard
UNIX path in your case? It could be also that the resource you're searching
does not exist. You could try a call to FSPathMakeRef with a path to an
AIFF file you are sure about (eg /tmp/YourFile.aiff, or ./YourFile.aiff if
your file resides in the same directory than the executable).
Regards,
Philippe Wicker
email@hidden
_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 2 months FREE*
http://join.msn.com/?page=features/junkmail
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.