• 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
Plotting Audio Data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Plotting Audio Data


  • Subject: Plotting Audio Data
  • From: Michael Paluszek <email@hidden>
  • Date: Fri, 30 May 2008 15:34:02 -0400

Our goal was to make a plot of an audio waveform. This was our first application of Core Audio.

We started with code from /Examples/CoreAudio/SimpleSDK/PlayFile and integrated it into our plugin class. We then added a callback to fileAU (in PlayFile) based on the PrintBuffer callback in /Examples/ CoreAudio/AuioUnits/AUPublic/Utility/AUBuffer.cpp.

err = AudioUnitAddRenderNotify( fileAU, VCAudio::AudioInputProc, this );

You have to check if the callback is called during pre render since there is no data in pre render

OSStatus VCAudio::AudioInputProc( void* inRefCon, AudioUnitRenderActionFlags* ioActionFlags, const AudioTimeStamp* inTimeStamp, UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList* ioData)

...

if(*ioActionFlags != kAudioUnitRenderAction_PostRender)
{
		return noErr;
}

...

We cast the buffer to float with

audioData[i] = ((float *)buf.mData)[k];

The code was integrated into our VisualCommander data source plugin. While the audio is running VC samples the waveform at 10 Hz. A movie of the results can be found at

http://www.psatellite.com/vc/movies/PSSAudio.php

The loop looks for the first non-zero value (if any) for each buffer.

The plugin plays the audio and plots the waveform. The movie shows how one sets up a window in VisualCommander and then plays the music and shows the waveform.

Sincerely,

Mike

------------------------------------------------------
Michael Paluszek
Princeton Satellite Systems
33 Witherspoon Street
Princeton, NJ 08542-3207
Phone (609) 279-9606
Fax (609) 279-9607
email@hidden
www.psatellite.com




_______________________________________________ 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
  • Prev by Date: AudioUnit implementation restrictions
  • Next by Date: Re: exception thrown in AUBase::DispatchGetPropertyInfo for AudioChannelLayout
  • Previous by thread: Re: AudioUnit implementation restrictions
  • Next by thread: AU Lab + Guard Malloc = Crash
  • Index(es):
    • Date
    • Thread