• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to show the wave of the audio file in my application when sound is playing?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to show the wave of the audio file in my application when sound is playing?


  • Subject: Re: How to show the wave of the audio file in my application when sound is playing?
  • From: Dave Fernandes <email@hidden>
  • Date: Wed, 25 Mar 2009 19:40:20 -0400

If you want the time weighting that a sound level meter uses, see:
http://en.wikipedia.org/wiki/Sound_level_meter

If you want to measure sound pressure level in dB, see:
http://en.wikipedia.org/wiki/Sound_pressure_level

Human hearing has a roughly logarithmic response, so dB is a good "unit".

That said, I use dB with 125 ms exponential time weighting for a VU type display, but I plot raw amplitude for a strip chart display. Like Jens said, don't waste cycles plotting at higher resolution than your display device supports.

Dave

On Mar 25, 2009, at 1:21 PM, Jens Alfke wrote:


On Mar 24, 2009, at 11:32 PM, ldl0313036 wrote:

Now I want to show the wave of the audio in my application when it is playing.

I built my own implementation of this. To avoid drowning in data I created a low-resolution preview waveform by running the audio file through an ExtAudioFile with the client format set to 8-bit mono at a low bit-rate (about 1Khz), and saving the output as a byte array. This lowers the footprint to about 1kbyte/sec. This is still sort of slow to generate, so I store it to disk in a cache directory, tagged with the mod date of the audio file.


Drawing this isn't difficult. You need to map samples in the byte- array to pixel x coords onscreen, and interpolate. On the y axis, amplitude doesn't map linearly to perceived volume level. I did some research on this and tried a few algorithms based on exponentials before settling on the simple
y = amplitude^3
which is what CoreAudio itself uses, apparently.


—Jens _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40utoronto.ca


This email sent to email@hidden

_______________________________________________ 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: 
 >How to show the wave of the audio file in my application when sound is playing? (From: ldl0313036 <email@hidden>)
 >Re: How to show the wave of the audio file in my application when sound is playing? (From: Jens Alfke <email@hidden>)

  • Prev by Date: RE: AudioQueueOflineRender() and 'alac' files on iPhone
  • Next by Date: Re: trouble with AudioQueuOfflineRender() after a while my queue callback function no longer gets invoked even thou queue is still running!
  • Previous by thread: Re: How to show the wave of the audio file in my application when sound is playing?
  • Next by thread: Audio Feature App
  • Index(es):
    • Date
    • Thread