overwriting part of Audio during recording in iPhone - iphone

Is it possible to overwrite a part of the recording with another recording.
When a recording is done, user gets back to a particular point of time in recording.
And right from that time, he initiates a recording, and this should overwrite the earlier recording.
Is this possible with AVFoundation Framework available in iPhone?

Related

How can pause/resume recording audio from microphone in unity engine

In unity engine I want record audio from microphone with pause/resume ability; I want to have all of recorded audio in one AudioClip at final; and I don't know how many time it will pause and play (it's depend to user, not me) (also length of it) what can I do ?
Don't have ready made solution, but the way you should start is to use Microphone class and use its Start and End function to record audio. This returns an audio clip which can be save to a numbered file (e.g., audio_datetime_00001,audio_datetime_00002,...). Once user Play/Pause/Stop you can create a new audio file. Later you can merge them using NAudio (try Mark Heath's solution).
Happy coding!!!

How to record mic input and an audio track on iPhone at the same time

I am looking to record and save a music/song file with one or more audio track(s) let's say a max of two tracks playing simultaneously while recording my vocals via the headset or the microphone. The finished product will be a single song file(mp3 or other format).
Also, the code should have the ability to filter out outside noise/interferance and add basic effects.
Appreciate any and all Xcode help!
I have done same thing using AVAudioSessionCategoryPlayAndRecord.
in my code, played karaoke file in MPMoviePlayer and at same time takes input from mic.
output is audio from MPMoviePlayer and it will be used as input also + input from mic.
i started to save this input in caf file, and upon finish product should be single file.

Recording audio and playing iPod at the same time?

I am trying to be able to record audio through the iPhone's microphone while simultaneously playing music from the iPod.
The recording and playback work separately, but if I try to playback from the iPod and record at the same time the recording stops.
By the way, I am not actually recording the audio to save the sound file, but merely analyzing it. It's for my app that flashes to the beat of the music you play.
Does Apple just not allow record and playback at the same time?
You should be able to do this by setting the Audio Session to AVAudioSessionCategoryPlayAndRecord. Information on this is in the Apple docs, although admittedly the Core Audio documentation is (and has always been) lacking in clarity.
AVSession Class Reference
Also, it's worth noting that AVAudioRecorder and AVAudioPlayer automatically set the session for you. You can wrestle control and set the session manually using the key I highlighted above.
the problem may be you are recording audio to the same path where the playing file is saved.
try to play an audio from a url with AVAudioPlayer and you can record with AVAudioRecorder at the same time.
Cheers :) :)

Recording Chunked Audio in Background iOS

I am trying to figure out a way to record audio in the background of an iOS application and have it streamed to the server.
I have pretty much got this working for when the app is in the foreground. I use AVAudioRecorder to record input for X seconds. Once I get the callback that this has finished, I record for another X seconds. Each recording session gets stored to a different file and I send these files asynchronously to the server.
However, this doesn't seem to work while my app goes into background mode.
When going into the background, the current record session continues recording until the X seconds are up, however my app gets suspended, before I can start another recording session.
Any ideas?
Here's the code for my callback:
- (void)audioRecorderDidFinishRecording:(AVAudioRecorder *)aRecorder successfully:(BOOL)flag {
NSLog(#"hello");
[self initRecorder];
[recorder recordForDuration:5];
}
You can't restart recording in the background.
So use the Audio Queue or Audio Unit RemoteIO APIs instead, which will give you smaller "chunks" (callback buffer blocks) of audio without stopping the audio recording.
Concatenate small audio callback chunks into larger file chunks if needed for your network protocol.
Background audio playing is supported with multitasking but it's not very clear that background audio recording is. However, I have not tried it. The Audio Unit API might let you continue to record audio while the application is in the background. However, this is kind of a trick and I Imagine it might get pulled out at some point.

AVAudioRecorder

I have been working on an Audio Application where a user can record and play the recorded audio file. In my app during recording a user can pause the recording and play it to listen what he has recorded and then again he can continue the recording.
So now my question is that if a user have recorded a 20 seconds audio and when he plays the audio and wants to resume recording from over 10 seconds overlapping/discarding the next 10 seconds audio. ?
I have looked into the AVAudioRecorder documentation and there is not property to set the duration of the recorder to start recording from specific time. So please someone tell me if it is possible or not. ?
Thanks
Maybe there’s an easier solution, but you may want to look at AVMutableComposition. You can easily create an empty mutable composition, insert the recorded sound into an audio track and then edit the track as needed – delete segments, add another recording, etc.