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

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.

Related

How to get duration of specific audio in AudioSourse just_audio Flutter?

I am building a project can play audios with just_audio.
I have a list of audios put in AudioSource and I need to create a control dash (a play button and a progress bar) for each of audio in the list, instead of using a common for the playlist as usual.
But I have no idea how to get duration/duration stream of each audio in the list and every time I click the play button of a specific audio, only that audio will be played?
enter image description here
In the picture, I can only get duration of current state, using player.durationStream, and when I click the play button, only current audio of sequenceState be played.
Please help, tkx a lot!!!
This feature isn't yet supported, but there is an open feature request for it:
https://github.com/ryanheise/just_audio/issues/141
However, this may not be what you actually want. Be aware that querying the duration directly from the media file can be inefficient in some cases, and so if you actually know the duration in advance, it may be better for the app to maintain its own local database of metadata which includes the durations:
If the audio is coming from a podcast, note that the podcast feed should report a medium-fidelity duration for each item in the XML file, measured in seconds(*).
If the audio was recorded by your app, you could save the duration metadata into your database at the same time the recording is made.
If the audio is on the device, you can query it using flutter_audio_query.
If the audio is an asset packaged with the app, then the durations are known by implication and can also be packaged with the app (i.e. hard coded).
(*) If the podcast feed omitted the duration field, you can still query it by extracting just enough of the audio file to read its duration and then disposing of the temporary player:
final disposablePlayer = Player();
final duration = await disposablePlayer.setAudioSource(...);
disposablePlayer.dispose();

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 use simpleaudioengine to play audio in a specified duration

i want to use SimpleAudioEngine to play a 2s mp3, but not so simple. I want to this audio plays 4s, that it, this mp3's duration should be 4s. Any good idea can solve this problem, Thank u very much
Edit the file to be 4 seconds using audacity audio editor. You can extend the file without changing the pitch of the audio. Then export the file as a separate mp3 file. Then just pay the file normally.

record and play the same file

I am trying to record the audio using AVAudioRecorder. My problem is i want to play the file while it is being recorded. Is there any way i can do this? I have set the category to PlayAndRecord. I have created the file for recording.
I have tried to initialize both the recorder and the player for the URL and tried to play the file after the record function. But it seems that only one chunk of the file gets played.
I seriously doubt you can do this with AVAudioRecorder and AVAudioPlayer convenience classes.
The AVAudioPlayer assumes that the file it plays is static and complete. For example, it has no method to dynamically update the track length. It reads the track length once at startup and that is why only the initial chunk of the file gets played. Any modifications to the file made after the AVAudioPlayer instances opens the file are ignored.
You'll need to set up a custom audio queue if you want to get fancy.
As an aside, how do you plan on getting around feedback problem of caused by recording what you are playing? You have nothing but a shrieking squeal in very short order.

Play audio and video at a same time in iPhone application

Is it possible to play audio and video file at a same time? I want to play different audio file and video file at a same time and also want control for both, so is it possible?
Sorry, not that I know of. The movie view automatically stops all audio files and takes up the whole screen, so you are forced to listen to the audio for the video.
If the audio is part of the video file, yes.
If it's an MP3 file or some other external type how are you planning on playing it? The phone might allow this to happen depending on what you're up too.
You might be in luck soon though...
Another helpful link is here.