avaudioplayer

How to switch between speaker and headphones in iPhone application

I've written an app that plays audio using AVAudioPlayer. I've implemented a function that switches the audio to the speaker: UInt32 sessionCategory = kAudioSessionCategory_MediaPlayback; AudioSessionSetProperty(kAudioSessionProperty_AudioCategory, sizeof(sessionCategory), &sessionCategory); UInt32 audioRouteOverride = kAudioSessio...

AVAudioPlayer crash after playing from an AVAudioRecorder

I've got a button the user tap to start recording and tap again to stop. When it stop I want the recorded voice 'echo' back so the user can hear what was recorded. This works fine the first time. If I hit the button for the third time, it starts a new recording and when I hit stop it crashes with EXC_BAD_ACCESS. - (IBAction) readToMeTap...

Cannot play a recorded sound on device.

I'm using the exact code from the iPhone Application Programming Guide Multimedia Support to use AVAudioRecorder to record a file to the disk and then AVAudioPlayer to load and play that file. This is working fine in the simulator but is not working on the device. The file gets loaded (we can see the NSTimeInterval) but does not play (...

AVAudioPlayer not unloading cached memory after each new allocation

I am seeing in Instruments that when I play a sound via the standard "AddMusic" example method that Apple provides, it allocates 32kb of memory via the prepareToPlay call (which references the AudioToolBox framework's Cache_DataSource::ReadBytes function) each time a new player is allocated (i.e. each time a different sound is played). ...

Can I get an audio session / apply audio units to playback from MPMusicPlayerController?

Hi there, I'd like to take control of the audio coming from MPMusicPlayerController (i.e., playing from the iPod library). For example, I'd like to apply EQ to it or do DSP, reverb, that kind of thing. Is this possible? Is there an audio session that I can grab a handle on? Or, perhaps is there some way to play back files from the iPod ...

Software for composing iPhone game background music

I want to compose some basic background music for an iPhone game. What's a good program for OS X (10.5.8)? I'd like to save the audio files in a compressed format that's compatible w/ AVAudioPlayer (aif, aiff, caf, mp3, aac, m4a, mp4, wav). Perhaps something like Logic Studio Express? Cheers! ...

How to play songs programmetically in iPhone from server ?

Hello all, In my current application I want to show a songs list in table view which is pretty easy but on selection of one of the songs it should be played in any existing audio player in iPhone . How can I do so . Provide me if anyone have good tutorial or example link ...

How to make music plays from begging of the app until a viewcontroller has been presented?

Hey guys I have a problem with an app Im making. The thing is I want to add it some background music, but I just want to add it in the main view. My app has 3 view controllers: Main View Controller, Second View Controller and Third View Controller. What I want is to start the music in the Main View Controller and stop it when the Third...

Playing audio from a wav file in iPhone SpeakHere example

I'm working with the iPhone SpeakHere example, and I would like to be able to play audio from either the mic (as in the example) or from a wav file. I have working code to play from a particular wav file, which looks like this: NSString *path = [[NSBundle mainBundle] pathForResource:@"basketBall" ofType:@"wav"]; AVAudioPlayer* t...

avaudioplayer interferes with mpmovieplayer on ipad

my app plays video and audio. however, i have a problem where once i play an audio file using avaudioplayer, the video refuses to play. when i play the video first, everything is fine. but if the audio is played first, any time i try to play the video it simply pops up the video player but will not play the actual video (you can use the ...

AVAudioPlayer Memory Leak - Media Player Framework

Hi Friends, I am using AVAudioPlayer object to play an audio. I created an audioPlayer object initially. I play an animation and when ever animation starts I play the audio and pause the audio when the animation is finished. I initially found three memory Leaks using Instruments. (The responsible caller mentioned was RegisterEmbedCode...

Avaudioplayer problem

Hi All, Actually i am using avaudioplayer. my player is working very fine (forward,revind,play,pause,volume,progress bar). Only problem is that i am not able to stop the song. so all songs are overlapped please any body tell me where i put [self.player stop] to stop my player when i play new song. ...

How i play Mp3 from server from avaudioplayer

Hello, I am new in iPhone,Anyone tell me please how i play audio uploaded on server. in my application some songs are from local and some others are from Server,Locally i play songs successfully but how i play a audio file from server from AVAudioplayer. Thanks, Arun ...

Initialization of AVAudioRecorder with aac

Hi everybody, I want to initialize a AVAudioRecorder with a aac file format, but it doesnt work... Whats wrong with the following code? soundFilePath = [soundFilePath stringByAppendingPathExtension:@"aac"]; NSURL *url = [NSURL fileURLWithPath:soundFilePath isDirectory:FALSE]; NSMutableDictionary *recordSetting = [[NSMutableDictionary...

Second call to AVAudioPlayer -> EXC_BAD_ACCESS (code posted, what did I miss?)

I'm using this code to play a different mp3 files with every call. The first time through works great. The second time crash, as indicated below. .h AVAudioPlayer *player; @property (nonatomic, retain) AVAudioPlayer *player; .m -(void)load:(NSURL *)aFileURL { if (aFileURL) { AVAudioPlayer *newPlayer = [[AVAudioPlayer alloc] in...

OpenAL doesn't work when using AVAudioRecorder and AVAudioPlayer

hi. i have been troubled about audio problem for several days. i don't think OpenAL get along with AVAudio functions. i have my own OpenAL class. ( wrapped the MyOpenAL class ) my app start to record using AVAudioRecorder. i stop recording. and then i clicked the "OpenAL Play"button that play any sound using OpenAL. i can't hear it. but...

Objective C sound lagging when multiple repeat

Hi, i'm coding in simple game where i move a square which performs a sound effect each time the square's moving. (like a walking sound) Problem is playing the sound effect cause a display refresh lag. As if it was too much performance for the engine. I was asking if there's a way to properly play the repeatitive but not continuously sou...

How to play sounds in locked mode on iPhone

Everybody knows the standard procedure to keep your app alive, after the user pressed the lock button (silent sound). If I start a sound with AVAudioPlayer (before the iphone is locked), the sound plays till it's end (after locking). The app is still running. If I try to start another sound while the iPhone is locked, it will never get p...

iPhone AVAudioPlayer failed to find codec

Hello, I am writing an app that downloads a wav file from a server and needs to play that file. The files use the mulaw codec with 2:1 compression. These wav files are dynamically created by a seperate process so there is no way for me to preconvert the files to a different format or codec, I need to be able to play them as is. I am ...

Return to AvAudioPlayer

I can use some help with an AVAudioPlayer issue. My App is basically an interactive audio book. The RootViewController is a UITableView using a drill-down approach sitting on top of a Navigation Controller. The first level are the Chapters and the second level are the Topics. Each Topic goes to an audio file which plays in a SoundPlayerV...