Re: Peak and averagePowerForChannel are nice, but what about the actual current power?
Re: Peak and averagePowerForChannel are nice, but what about the actual current power?
- Subject: Re: Peak and averagePowerForChannel are nice, but what about the actual current power?
- From: Hamish Allan <email@hidden>
- Date: Sat, 16 May 2009 17:02:27 +0100
On Sat, May 16, 2009 at 4:40 PM, Ochen Kaylan <email@hidden> wrote:
> Thanks. That makes sense to me. One thing I haven't figured out yet is how I
> want to redraw the waveform when the pixel width is arbitrary. So in your
> example of an audio editor, when the user zooms in, I'm assuming the program
> doesn't go back to the source PCM data, extract, and re-interpolate the
> waveform each step of the zoom.
I don't know of any other way. Don't worry: as you zoom in, the
problem gets smaller ;)
> (Worst case example: I have an audio editor
> where I can drag the visible bounds, so it's not a quick jump from 100% to
> 200%, but a slow zooming in. If I have 20 tracks each with 20 blocks of
> audio, it's not recalculating for each block, is it?)
Not sure what you mean by "blocks" of audio?
> This is more of a
> theoretical, as I don't have to deal with that, at least not on this
> project. But I don't know how I'd go about doing it if I did need it.
Try it! I once wrote a waveform viewer that updated the waveform in
real time while zooming (with a slider which at one end showed the
whole file and at the other showed sample resolution) and the vast
majority of time was spend in the drawing code, not the code which
calculated what to draw (I used NSBezierPath to trace the edges of the
waveform -- probably not the best idea).
> By the way, your code raises another question. Is PCM data itself the array
> of values -1 to 1 plus data headers and tails, or do you have to loop
> through each frame of a PCM file and extract the
> kAudioQueueProperty_CurrentLevelMeter property into a new array?
Depends how you extract the PCM data. What is your source file format?
> (By the way, you folks are awesome to help me with this!)
You're welcome.
> Sure, and even beyond that, if I was only hitting the file once or twice a
> second, that frequency might actually be larger than falloff period.
> However, that file of 100 pixels might not be 10 minutes. If it's one
> second, then I'll need to access it 100 times per second, far less than the
> falloff period.
Assuming a sample rate of 44100Hz, 100 times per second still wouldn't
get you what you're looking for...
> You're totally right. That was a compromise I was willing to make. Far from
> ideal, but if it saved me from something far more time/processor intensive,
> I was willing to at least try it out.
> ...
> Not at all. I can draw the graph of average and peak powers of a 10 minutes
> wave in milliseconds. Similar to your code, but I'd play and seek through
> the file at intervals totalNumberOfSeconds/numberOfPixels and get the
> average and peak powers of that millisecond. A quick loop of 100 calls for a
> 100-pixel-wide graph, however long the audio file is.
I see. Well, you could perhaps use this technique with peak power to
get a waveform, but it's likely to be considerably less efficient than
looping over the PCM data yourself.
Best wishes,
Hamish
_______________________________________________
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
References: | |
| >Peak and averagePowerForChannel are nice, but what about the actual current power? (From: Ochen Kaylan <email@hidden>) |
| >Re: Peak and averagePowerForChannel are nice, but what about the actual current power? (From: email@hidden) |
| >Re: Peak and averagePowerForChannel are nice, but what about the actual current power? (From: Hamish Allan <email@hidden>) |
| >Re: Peak and averagePowerForChannel are nice, but what about the actual current power? (From: email@hidden) |
| >Re: Peak and averagePowerForChannel are nice, but what about the actual current power? (From: Hamish Allan <email@hidden>) |
| >Re: Peak and averagePowerForChannel are nice, but what about the actual current power? (From: email@hidden) |
| >Re: Peak and averagePowerForChannel are nice, but what about the actual current power? (From: Brian Willoughby <email@hidden>) |
| >Re: Peak and averagePowerForChannel are nice, but what about the actual current power? (From: Ochen Kaylan <email@hidden>) |
| >Re: Peak and averagePowerForChannel are nice, but what about the actual current power? (From: Hamish Allan <email@hidden>) |
| >Re: Peak and averagePowerForChannel are nice, but what about the actual current power? (From: Ochen Kaylan <email@hidden>) |