Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9008917
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:03:46+00:00 2026-06-16T02:03:46+00:00

I have to record an audio by mixing multiple audio file. For example, if

  • 0

I have to record an audio by mixing multiple audio file. For example, if three audio file are being played, so I have to mix the sound of all those playing audio and record it into a single audio file.
Please help me in this in this, if any working code is there to achieve it.

Thanks in Advance !!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T02:03:47+00:00Added an answer on June 16, 2026 at 2:03 am

    I think I understand what you’re asking.

    You want to create a single track using three tracks available to you. Now, you cannot have audio files playing when you try to use them, they’re locked.

    You’ll want to use AVMutableComposition, load all the tracks as AVURLAssets and then combine them. Now I’ve only written code to append one file to another file, so my example won’t be complete, but it should point you in the right direction.

    // Generate a composition of the two audio assets that will be combined into
    // a single track
    AVMutableComposition* composition = [AVMutableComposition composition];
    AVMutableCompositionTrack* audioTrack = [composition addMutableTrackWithMediaType:AVMediaTypeAudio
                                                                     preferredTrackID:kCMPersistentTrackID_Invalid];
    
    // grab the two audio assets as AVURLAssets according to the file paths
    AVURLAsset* masterAsset = [[AVURLAsset alloc] initWithURL:[NSURL fileURLWithPath:self.masterFile] options:nil];
    AVURLAsset* activeAsset = [[AVURLAsset alloc] initWithURL:[NSURL fileURLWithPath:self.newRecording] options:nil];
    
    NSError* error = nil;
    
    // grab the portion of interest from the master asset
    [audioTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, masterAsset.duration)
                    ofTrack:[[masterAsset tracksWithMediaType:AVMediaTypeAudio] objectAtIndex:0]
                     atTime:kCMTimeZero
                      error:&error];
    if (error)
    {
        // report the error
        return;
    }
    
    // append the entirety of the active recording
    [audioTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, activeAsset.duration)
                    ofTrack:[[activeAsset tracksWithMediaType:AVMediaTypeAudio] objectAtIndex:0]
                     atTime:masterAsset.duration
                      error:&error];
    
    if (error)
    {
        // report the error
        return;
    }
    
    // now export the two files
    // create the export session
    // no need for a retain here, the session will be retained by the
    // completion handler since it is referenced there
    
    AVAssetExportSession* exportSession = [AVAssetExportSession
                                       exportSessionWithAsset:composition
                                       presetName:AVAssetExportPresetAppleM4A];
    if (nil == exportSession)
    {
        // report the error
        return;
    }
    
    
    NSString* combined = @"combined file path";// create a new file for the combined file
    
    // configure export session  output with all our parameters
    exportSession.outputURL = [NSURL fileURLWithPath:combined]; // output path
    exportSession.outputFileType = AVFileTypeAppleM4A; // output file type
    
    [exportSession exportAsynchronouslyWithCompletionHandler:^{
    
        // export status changed, check to see if it's done, errored, waiting, etc
        switch (exportSession.status)
        {
            case AVAssetExportSessionStatusFailed:
                break;
            case AVAssetExportSessionStatusCompleted:
                break;
            case AVAssetExportSessionStatusWaiting:
                break;
            default:
                break;
        }
        NSError* error = nil;
    
        // your code for dealing with the now combined file
    }];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I record an audio file and I have a core data object representing
I have got an audio file which is quite quiet. I'm playing it using
I need to record audio file that can be played with silverlight. Audio files
I have a view responsible for recording audio. How can i record several audios
I use the following code to record audio files and play. I have a
I'm working on an app that will both record an audio file, and then
I have an application in which user can record audio and play it with
I have been using the code in http://opensebj.blogspot.com/2009/04/naudio-tutorial-5-recording-audio.html to record audio. Basically this code:
i have this problem, i create a app, in this app i record audio
I need to record more than one audio at a time. I have two

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.