Re: Iterating through audio data
Re: Iterating through audio data
- Subject: Re: Iterating through audio data
- From: Brian Willoughby <email@hidden>
- Date: Thu, 26 May 2011 16:04:29 -0700
Perhaps the AudioConverter should only be used for upsampling, or
when the display needs to be fast rather than accurate.
You make a good point about details. By retaining the original
sample rate, the display can reflect minimum and maximum details that
would be lost when downsampling, but the cost is that it takes longer
to process lots of samples when they only affect one pixel. The cost
to benefit ratio can be dialed in by the developer, to their taste or
aesthetic. Perhaps partial downsampling would speed things up, but
without completely downsampling to the 'screen' resolution.
Another consideration for waveform display is that Cocoa drawing has
subpixel accuracy, and will draw anti-aliased pixels very smoothly.
It is thus possible to display more samples than the raw pixels
suggest. If your window is 1,000 pixels across, your waveform
display could draw several thousand individual points in that range,
and the graphic would look like a quite realistic waveform. The days
of blocky waveform depictions could easily be behind us. Dialing in
the right balance between displaying all samples, which would be way
too slow, versus only displaying one sample per pixel, which would
skip details, can be left to the developer as a choice handled by
their algorithm.
Brian Willoughby
Sound Consulting
On May 26, 2011, at 15:12, James Chandler Jr wrote:
That sounds like an excellent idea to use the sample-rate converter
to upsample and draw audio zoomed in at less than 1 sample per pixel.
I don't know how many samples that a sample-rate converter could
downsample "batch" before the graphic becomes too full of errors to
be useful.
For instance, to display a 3 minute, 44.1K song within 1000
horizontal pixels (180 ms per pixel)-- One would resample from a
rate of 44100.0 down to a rate of 5.56. The resampled output
Nyquist would be 2.78 Hz and the audio window would show a blank
line. All details of interest would have been brickwall-filtered.
In some cases even a small amount of downsampling might give
unexpected results.
For instance, on a dainty finger cymbal, if we downsample even by a
factor of two, then the graphic representation would be horribly
wrong. The downsampling would have knocked out too many high
harmonics to remain an accurate display.
_______________________________________________
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