Re: Iterating through audio data
Re: Iterating through audio data
- Subject: Re: Iterating through audio data
- From: GW Rodriguez <email@hidden>
- Date: Wed, 25 May 2011 22:58:49 -0400
Yes I assumed that I wasn't going to plot each sample. My plan was to
start with every 100 samples and see how it looks.
So here's what I'm looking at doing:
// open audio file
// find length in samples of the file
-(void) getData {
AudioBufferList tempList;
for (SInt64 i=1; i < length; i = i+50) {
Err = ExtAudioFileSeek(audioFileRef, i);
UInt32 s = (UInt32) i;
Err = ExAudioFileRead(audioFileRef, &s, &tempList)
// something to print amplitude
}
}
So I'm not sure about the AudioBuffer and how to get the float values (-1.-1.).
Thanks a bunch Brian
GW Rodriguez
On May 25, 2011, at 9:33 PM, Brian Willoughby <email@hidden> wrote:
> Waveform displays are generally a very reduced bandwidth depiction of the audio data because the full audio data is almost always inefficient to access as quickly as needed for display. As a result, nearly every successful audio product uses some sort of caching mechanism to create the reduced data image from the original audio data and store it away somewhere for fast access. To that end you can access the audio file directly, and use your own custom format for the cached data. Keep in mind that you do not need 24-bit samples, and you certainly don't need 44,100 samples per every second of audio.
>
> If you want to leverage as much Apple code as possible, I recommend the AudioFile and ExtAudioFile classes. With these, you can scan through all the data as fast as the computer can read it, without being limited to the time it would take to play the audio. These classes do use ASBD structures, but the structures do not contain the actual audio data. Instead, they describe the format of the data, and then you pull the actual data from the AudioFile class as fast as you want.
>
> You can combine these tasks using ExtAudioFile to embed sample rate conversion and bit depth reduction, such that your cached data for the image is created as you read the file. This is a good way to leverage Apple's optimized code. If you're worried about missing isolated peak samples, then you might not want sample rate conversion, but in general you will obtain a perfectly nice rendition of the waveform by reducing its rate and depth to the point that it fits within the pixels of your view.
>
> Brian Willoughby
> Sound Consulting
>
>
> On May 25, 2011, at 17:38, GW Rodriguez wrote:
>> I am attempting to draw a waveform (a seemingly taboo topic), and I'm not looking for tips on how to do this. I am just not sure how to get all the samples/amplitudes.
>>
>> If someone can point me in the direction, is it in the ASBD? And how do I speed through and read all that data not in audio time but as fast as the computer can?
>
_______________________________________________
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