On Aug 5, 2015, at 9:30 AM, Jens Alfke <[email protected]> wrote: > On Aug 5, 2015, at 12:39 AM, Matthew Pease <[email protected]> wrote: >> The more detailed version is that I'd like to provide a Tivo style ability >> to seek in the recent history of a stream. I want to display the entire >> history of the stream as graph of the levels. So that the user can see >> where there is activity within the stream. The app would allow them to >> quickly jump to some point in the history. > > Ah, you want a waveform view. I’ve implemented this by rendering to a > low-resolution PCM stream (e.g. 8khz 8-bit mono) then running some simple > processing on the stream to capture the maximum absolute value in every bin > of x ms, where the value of x depends on the resolution you want for your > display. > > (The trickiest thing to work out was the conversion from raw amplitude to a > volume level; I went with the cube root.)
The two most common ways to depict audio waveforms are Peak and RMS. I don't think there's any standard for displaying cube root - although I'm sure it looks interesting. I'd recommend against inventing new math for displaying audio waveforms, especially since there are well-established standards. For Peak value, you can just take the absolute value of the signed samples and display the largest in each summarized group. For RMS value, you square each individual sample, take the average of all squared samples in a groups, and then take the square root of that average (mean) of the sum. If your group is a single sample, then taking the square root of the squared value just gives you the original sample value (but it does convert negative numbers to positive). But when you average several squared sample values, the result is weighted so that large peaks add more to the sum than smaller values. There are various more advanced methods for calculating the hold, decay, and perceived intensity of sound, but they're not necessary in a basic meter. Brian Willoughby Sound Consulting _______________________________________________ Do not post admin requests to the list. They will be ignored. Coreaudio-api mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/coreaudio-api/archive%40mail-archive.com This email sent to [email protected]
