avaudiorecorder

AVAudioRecorder stops working when writing to /dev/null on iPhone 5s with iOS 7

拈花ヽ惹草 提交于 2019-12-04 09:44:38
问题 I have an app that monitors the background audio level without recording to a file. I use the trick of writing to /dev/null to accomplish this. This code has worked on the iPhone 3GS with iOS 6, iPhone 4 with iOS 6 and iOS 7, and in the simulator with iOS 7 and iPhone Retina (4-inch 64-bit). When I try it on a real iPhone 5s, however, the recorder seems to capture audio for a moment, and then silently dies. This is the code: // Inititalize the audio NSURL *url = [NSURL fileURLWithPath:@"/dev

AVAudioRecorder - Proper MPEG4 AAC Recording Settings

老子叫甜甜 提交于 2019-12-04 09:30:02
问题 I've got a live app with an estimated 15% of users reporting that the record feature is not working. This isn't happening on our test devices, but the reports show that the problem is that prepareToRecord is returning NO. I've had trouble finding sample settings for AAC format. Are any of my settings off? App requires iOS5 and uses ARC. AVAudioSession *audioSession = [AVAudioSession sharedInstance]; [audioSession setCategory:AVAudioSessionCategoryRecord error:nil]; NSDictionary

FileManager cannot find audio file

北城余情 提交于 2019-12-04 05:29:33
问题 Helloo! My ultimate goal is to create a UITableViewController with recordings made in-app, using FileManager to traverse the /Documents/ directory and list all the recordings found there. The recording and playback are functioning just fine with one recording, with the following setup: // In VC#1 func setupRecorder(){ let audioSession:AVAudioSession = AVAudioSession.sharedInstance() do { try audioSession.setCategory(AVAudioSessionCategoryPlayAndRecord) } catch { print("Audio Setup Error: \

AVAudioRecorder Memory Leak

半世苍凉 提交于 2019-12-03 22:15:33
I'm hoping someone out there can back me up on this... I've been working on an application that allows the end user to record a small audio file for later playback and am in the process of testing for memory leaks. I continue to very consistently run into a memory leak when the AVAudioRecorder's "stop" method attempts to close the audio file to which it's been recording. This really seems to be a leak in the framework itself, but if I'm being a bonehead you can tell me. To illustrate, I've worked up a stripped down test app that does nothing but start/stop a recording w/ the press of a button.

AVAudioRecorder not recording in background after audio session interruption ended

和自甴很熟 提交于 2019-12-03 19:09:08
问题 I am recording audio in my app, both in foreground and in background. I also handle AVAudioSessionInterruptionNotification to stop recording when interruption begins and start again when it ends. Although in foreground it works as expected, when app is recording in background and I receive a call it doesn't start again recording after call ends. My code is the following: - (void)p_handleAudioSessionInterruptionNotification:(NSNotification *)notification { NSUInteger interruptionType = [[

iOS: How to trim silence from start and end of .aif audio recording?

£可爱£侵袭症+ 提交于 2019-12-03 16:52:47
My app includes the ability for the user to record a brief message; I'd like to trim off any silence (or, to be more precise, any audio whose volume falls below a given threshold) from the beginning and end of the recording. I'm recording the audio with an AVAudioRecorder, and saving it to an .aif file. I've seen some mention elsewhere of methods by which I could have it wait to start recording until the audio level reaches a threshold; that'd get me halfway there, but won't help with trimming silence off the end. If there's a simple way to do this, I'll be eternally grateful! Thanks. This

AVAudioRecorder records only the audio after interruption

纵然是瞬间 提交于 2019-12-03 14:32:01
In my application for recording and playing audio using AVAudioRecorder and AVAudioPlayer I came across a scenario in the case of incoming phone call.While the recording is in progress and if the phone call comes,the audio recorded after the phone call is only recorded.I want the recording recorded after the phone call to be the continuation of the audio recorded before the phone call. I track the interruption occuring in audio recorder using the AVAudioRecorderDelegate methods (void)audioRecorderBeginInterruption:(AVAudioRecorder *)avRecorder and (void)audioRecorderEndInterruption:

Saving a recorded AVAudioRecorder sound file: Now what? ( iOS, Xcode 4 )

一笑奈何 提交于 2019-12-03 14:10:42
问题 In my App, I want the user to be able to record one sound file and play it back, and then save the sound file for later. I used this tutorial to set up the play and record interface, but this tutorial leaves out a key part: how do I permanently save the sound to the disk? Also, while you're here, how do I set a maximum time for the sound file to record? I don't want sound files exceeding 30 seconds in length. Thanks, hopefully I can get this all sorted out. 回答1: Voice Record Demo is a great

Routing iPhone Audio Sound

拥有回忆 提交于 2019-12-03 10:08:39
问题 I have an app which does listen and play sound at the same time. By default, the sound output goes through the earphone. So I use the following code to route it through the speaker: UInt32 audioRouteOverride = kAudioSessionOverrideAudioRoute_Speaker; AudioSessionSetProperty (kAudioSessionProperty_OverrideAudioRoute, sizeof(audioRouteOverride), &audioRouteOverride); This works fine. But now, I'd like to route the sound through the headphones when headphones or external speakers are attached.

AVAudioRecorder doesn't write out proper WAV File Header

陌路散爱 提交于 2019-12-03 09:30:36
问题 I'm working on a project on the iPhone where I'm recording audio from the device mic using AVAudioRecorder, and then will be manipulating the recording. To ensure that I'm reading in the samples from the file correctly, I'm using python's wave module to see if it returns the same samples. However, python's wave module returns "fmt chunk and/or data chunk missing" when trying to open the wav file that is saved by AVAudioRecorder. These are the settings I am using to record the file: