core-audio

iPhone - prepend data to beginning of an audio file

Hi I am trying to write some data to the beginning of an audio file. But the file is getting overwritten. If I write data worth 20 seconds to the beginning of the audio file using AudioFileWritePackets, the initial 20 seconds of data is overwritten in the original audio file. This is what I use AudioFileOpenURL((CFURLRef)flUrl, kAudi...

audio power on AudioQueue

Hi everyone. I'm now creating an Application using speech recognition.To check the Audio Power coming in through the microphone, I wrote a method as follows. -(void)checkPower(AudioqueRef)queue{ UInt32 expectedSize= sizeof(AudioQueueLevelMeterState); AudioQueueGetProperty(queue, kAudioQueueProperty_CurrentLev...

Playback MP3 using RemoteIO and AudioUnits on iPhone... possible?

I want to playback an mp3 rather than an uncompressed file using RemoteIO / AudioUnit. Using uncompressed files obviously uses far too much disk space (30MB vs 3MB for mp3). Is this even possible? If so, can you provide a little code headstart? Thanks a million. ...

Error "SysError 0 during open of "AUResources.r"" When Compiling an AudioUnit

In the default AudioUnit project shell that XCode creates, there is a line at the very bottom of your AUEffect .r file: #include "AUResources.r" When compiling under Mac OS X 10.6 Snow Leopard, this line causes the following error: SysError 0 during open of "AUResources.r" Note, this error occurs in a completely empty project sh...

AVAudioPlayer initialization: error code -50

I recently ran into a problem that I couldn't find discussed anywhere on the internet - I was initializing an AVAudioPlayer to play an audio file, and getting the following error: Error Domain=NSOSStatusErrorDomain Code=-50 "Operation could not be completed. (OSStatus error -50.) As it turns out, I had made a mistake creating my NSURL...

Storing AudioBufferLists from the ExtAudioFile API for later use

Using Xcode/Cocoa and the ExtAudioFile API, I'm trying to store away AudioBufferList* objects away for later use, but I'm running into trouble with re-accessing the data. These objects are coming from repeated ExtAudioFileRead calls. I realize that I can't just stuff these AudioBufferList* objects into an NSArray, but I was under the i...

Play m4p with AudioQueue

Is it possible to play protected m4p files with AudioQueue? I tried NSSound (it can play m4p) and the AudioQueue sample afplay (does not work otb). Is there any way to play m4p with AudioQueue? ...

What's the difference between all these audio frameworks?

In the documentation I see several frameworks for audio. All of them seem to be targeted at playing and recording audio. So I wonder what the big differences are between these? Audio Toolbox, Audio Unit, AV Foundation, and Core Audio. Or did I miss a guide that gives a good overview of all these? ...

Unable to Set/Get Volume of Input device which has single channel than Master

Hi, I am trying to Set/Get Volume level of Input device which has only single channel but no master channel, then it fails to retrieve the kAudioDevicePropertyPreferredChannelsForStereo and intermittently kAudioDevicePropertyVolumeScalar for each channel. But this works well for Output device. So is there any difference in setting/gett...

Playing built in sounds on the iPhone

I have an app that has a fake SMS screen, when this is displayed I want to play one of the SMS sounds that are on the phone. How do I do this? ...

Unable to set/get iPhone headset mic volume

Unable to set/get headset mic volumeHi. I am using the following method to retrieve the Mic volume, but AudioHardwareServiceHasProperty is failing. I realized that my mic has one input channel than the master. But the property, kAudioHardwareServiceDeviceProperty_VirtualMasterVolume documentation says irrespective of the way the volume ...

Record speaker output with Audio Unit

What I'm trying to do: Record the speaker output using Audio Units. What I have tried: I'm using Apples sample code "RecordAudioToFile", (http://developer.apple.com/mac/library/samplecode/RecordAudioToFile) which does exactly what I want, except that it use the microphone as input. It thought changing kAudioHardwarePropertyDefaultInput...

how to get Audio Device UID to pass into NSSound's setPlaybackDeviceIdentifier:

Hi All, How can i get audio device UID (USB speaker) to pass into NSSound's setPlaybackDeviceIdentifier: method Thanks ...

Sound on simulator but not device

I'm using the following to play an m4a file: NSString *path = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent: fileName]; SystemSoundID soundID; NSURL *filePath = [NSURL fileURLWithPath:path isDirectory:NO]; AudioServicesCreateSystemSoundID((CFURLRef)filePath, &soundID); AudioServicesPlaySystemSound(soundID); It w...

ExtAudioFileConvert questions

Hi everyone. I'm making some progress on taking a compressed (mp3) sound and saving it as PCM. In addition, I wanted to split the original file into chunks that are 2 seconds long, within the same process. I seem to be successful, but I am a little confused as to why. As I read blocks of audio and write the files out, I check to see ...

Simultaneous record and play from same file

I'm attempting to use Audio Queue Services for the first time. After reading all the documentation and playing with some sample code, I think I understand the classes pretty well and have implemented my own playback and recording application without any problems. I need to simultaneously record and play from the same buffer, but I'm hav...

Audio Queue: Timestamps for recorded buffers

I am trying to grab times out of recorded buffers in my AudioInputCallback function for a recording queue. Unfortunately the timestamps I'm seeing aren't as expected. Here's an example (using AudioTimeStamp.mHostTime): 2010-01-21 14:03:35.252 [61694:207] 1288747268011206 1288747396166138 -128154932 2010-01-21 14:03:35.344 [61694:2...

Sound plays in iphone simulator with breakpoint, but fails to play without breakpoint

I am trying to get a sound to play in the iPhone Simulator (using 3.1 SDK). When I add a breakpoint, and step through the code in GDB, the sound plays. However, if I disable the breakpoint, the sound does not play. The code to invoke the sound is: SoundEffect *completeSound = [myobj completeSound]; if (completeSound != nil) { [co...

OpenAL - playing buffer backwards?

I'm working on a cocoa-touch app using OpenAL, but I'm willing to switch to another framework if I'm forced (I don't really need the 3d stuff). I've been searching for a way to play a sound backwards but I've only found (very complicated) examples using Audio Unit. Is there anyway to perhaps store a buffer in reverse so I can play it b...

CoreAudio AudioUnitSetProperty always fails to set Sample Rate

I need to change the output sample rate from 44.1 to 32.0, but it always throws an error, Out: AudioUnitSetProperty-SF=\217\325\377\377, -10865. I don't know why it will let me set it for input, but then not set it for output. My code is: - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { OSStatus MyRenderer(void ...