• 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: Jens Alfke <email@hidden>
  • Date: Wed, 25 Mar 2009 10:21:30 -0700


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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: How to show the wave of the audio file in my application when sound is playing?
      • From: Dave Fernandes <email@hidden>
References: 
 >How to show the wave of the audio file in my application when sound is playing? (From: ldl0313036 <email@hidden>)

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