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 8847087
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:07:49+00:00 2026-06-14T12:07:49+00:00

i have a Problem ;) i want to record Audio from the Mic and

  • 0

i have a Problem 😉

i want to record Audio from the Mic and Write it to the Filesystem with Extended Audio File Services and also play the recorded Stuff.
if i only use the remoteIO with two callbacks one for read one for write it works.

For the Volumen Control i want to use the MultiChannelMixer and the AUGraph.
is it possible that you realize playback and recording with the same mixer and the RemoteIO?

i think it must look like this:

RemotIO Input   ->        -> Write Callback
                    Mixer
RemoteIO Output <-        <- Read Callback

i create two AUNodes (RemoteIO and MultiChannelMixer), how must i set the Callbacks and the Connections that one Callback deliver the AudioData from the mic and an other reads the Data from a File and both paths go through the mixer?

The reading and writing is not the Problem, only the configuration of the Nodes!

…and the output of CAShow:

AudioUnitGraph 0x8AEE000:
  Member Nodes:
    node 1: 'aumx' 'mcmx' 'appl', instance 0x865a510 O I
    node 2: 'auou' 'rioc' 'appl', instance 0x865d0a0 O I
  Connections:
    node   1 bus   0 => node   2 bus   0  [ 2 ch,  44100 Hz, 'lpcm' (0x0000000C) 16-bit little-endian signed integer]
    node   2 bus   1 => node   1 bus   1  [ 2 ch,  44100 Hz, 'lpcm' (0x0000000C) 16-bit little-endian signed integer]
  Input Callbacks:
    {0x4150, 0x7573340} => node   2 bus   1  [2 ch, 44100 Hz]
    {0x4330, 0x7573340} => node   1 bus   0  [2 ch, 44100 Hz]
  CurrentState:
    mLastUpdateError=0, eventsToProcess=F, isRunning=F

here is the setup code:

    OSStatus setupErr = noErr;

AudioComponentDescription mixerDescription;
AudioComponentDescription ioDescription;

// the AUNodes
AUNode mixerNode;
AUNode ioNode;

// the graph
setupErr = NewAUGraph(&_graph);
NSAssert(setupErr == noErr, @"Couldn't create graph");

// the mixer
mixerDescription.componentFlags = 0;
mixerDescription.componentFlagsMask = 0;
mixerDescription.componentType = kAudioUnitType_Mixer;
mixerDescription.componentSubType = kAudioUnitSubType_MultiChannelMixer;
mixerDescription.componentManufacturer = kAudioUnitManufacturer_Apple;

// the io 
ioDescription.componentFlags = 0;
ioDescription.componentFlagsMask = 0;
ioDescription.componentType = kAudioUnitType_Output;
ioDescription.componentSubType = kAudioUnitSubType_RemoteIO;
ioDescription.componentManufacturer = kAudioUnitManufacturer_Apple;

// add mixer Node
setupErr = AUGraphAddNode(self.graph, &mixerDescription, &mixerNode);
NSAssert(setupErr == noErr, @"Couldn't create master mixer");

// add io Node
setupErr = AUGraphAddNode(self.graph, &ioDescription, &ioNode);
NSAssert(setupErr == noErr, @"Couldn't create io node");

// open Graph
setupErr = AUGraphOpen(self.graph);
NSAssert(setupErr == noErr, @"Couldn't open graph");

// get the mixer info
setupErr = AUGraphNodeInfo(self.graph, mixerNode, &mixerDescription, &_mixer);
NSAssert(setupErr == noErr, @"Couldn't get master mixer info");

// get the io info
setupErr = AUGraphNodeInfo(self.graph, ioNode, &ioDescription, &_io);
NSAssert(setupErr == noErr, @"Couldn't get io Node info");

// enable io input
UInt32 enableFlag = 1;
setupErr = AudioUnitSetProperty(self.io, kAudioOutputUnitProperty_EnableIO, kAudioUnitScope_Input, kInputBus, &enableFlag, sizeof(enableFlag));
NSAssert(setupErr == noErr, @"Couldn't enable io input");

// set up the mixers input callbacks
AURenderCallbackStruct outputCallbackStruct;
outputCallbackStruct.inputProc = outputCallback;
outputCallbackStruct.inputProcRefCon = self;

AURenderCallbackStruct inputCallbackStruct;
inputCallbackStruct.inputProc = inputCallback;
inputCallbackStruct.inputProcRefCon = self;

setupErr = AUGraphConnectNodeInput(self.graph, mixerNode, 0, ioNode, 0);
NSAssert(setupErr == noErr, @"Couldn't connect mixer output to io output");
setupErr = AUGraphConnectNodeInput(self.graph, ioNode, 1, mixerNode, 1);
NSAssert(setupErr == noErr, @"Couldn't connect io input to mixer input");

// set output Callback
setupErr = AUGraphSetNodeInputCallback(self.graph, ioNode, 1, &outputCallbackStruct);
NSAssert(setupErr == noErr, @"Error setting io output callback");

// set input Callback
setupErr = AUGraphSetNodeInputCallback(self.graph, mixerNode, 0, &inputCallbackStruct);
NSAssert(setupErr == noErr, @"Error setting mixer input callback");

// describe format
AudioStreamBasicDescription audioFormat = {0};
audioFormat.mSampleRate                 = 44100.00;
audioFormat.mFormatID                   = kAudioFormatLinearPCM;
audioFormat.mFormatFlags                = kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked;
audioFormat.mFramesPerPacket            = 1;
audioFormat.mChannelsPerFrame           = 2;
audioFormat.mBitsPerChannel             = 16;
audioFormat.mBytesPerPacket             = 4;
audioFormat.mBytesPerFrame              = 4;

// set the rio input properties
setupErr = AudioUnitSetProperty(self.io, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, kOutputBus, &audioFormat, sizeof(audioFormat));
NSAssert(setupErr == noErr, @"Error setting RIO input property");

// set the rio output properties
setupErr = AudioUnitSetProperty(self.io, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, kInputBus, &audioFormat, sizeof(audioFormat));
NSAssert(setupErr == noErr, @"Error setting RIO output property");

// set the master fader output properties
setupErr = AudioUnitSetProperty(self.mixer, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Global, kOutputBus, &audioFormat, sizeof(audioFormat));
NSAssert(setupErr == noErr, @"Error setting master output property");

// set the master fader input properties
setupErr = AudioUnitSetProperty(self.mixer, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Global, kOutputBus, &audioFormat, sizeof(audioFormat));
NSAssert(setupErr == noErr, @"Error setting master input1 property");

// initialize Graph
setupErr = AUGraphInitialize(self.graph);
NSAssert(setupErr == noErr, @"Error initializing graph - error code");

CAShow(self.graph);

// start Graph
setupErr = AUGraphStart(self.graph);
NSAssert(setupErr == noErr, @"Error starting graph. - error code");

i hope you understand my problem 🙂
Thanks..

Update:
Some more Stuff to describe my Problem!

Recording: RemoteIO InputScope Bus 0 -> Mixer Input Bus 0 -> Mixer Output Bus 0 -> Write Callback -> File
Playback: File -> Read Callback -> Mixer Input Bus 1 -> Mixer Output Bus 0 -> RemoteIO OutputScope Bus 1

Connection Plan

  • 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-14T12:07:50+00:00Added an answer on June 14, 2026 at 12:07 pm

    You need create AUGraph with three nodes (units):

    1. File Player (kAudioUnitSubType_AudioFilePlayer)
    2. RemoteIO
    3. Mixer

    Connect them like this:

    AUGraphConnectNodeInput(m_graph, m_player, 0, m_mixerNode, 0); // player -> mixer
    AUGraphConnectNodeInput(m_graph, m_mixerNode, 0, m_rioNode, 0); // mixer -> output
    AUGraphConnectNodeInput(m_graph, m_rioNode, 1, m_mixerNode, 1); // input -> mixer
    

    Enable input on RIO:

    UInt32 enable = 1;
    AudioUnitSetProperty(m_rioUnit, kAudioOutputUnitProperty_EnableIO, kAudioUnitScope_Input, 1, &enable, sizeof(UInt32));
    

    Get mixer output format and set it as client format for Extended Audio File:

    AudioStreamBasicDescription mixerASBD;
    UInt32 prop = sizeof(mixerASBD);
    AudioUnitGetProperty(m_mixerUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 0, &mixerASBD, &prop);
    ExtAudioFileSetProperty(extAudioFile, kExtAudioFileProperty_ClientDataFormat, sizeof(mixerASBD), &mixerASBD);
    

    Define render callback:

    static OSStatus mixerCallBack(void *inRefCon, AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp * inTimeStamp, UInt32 inBusNumber,UInt32 inNumberFrames, AudioBufferList *ioData) {
        if ((*ioActionFlags) & kAudioUnitRenderAction_PostRender)
            return (ExtAudioFileWrite(extAudioFile, inNumberFrames, ioData));
    
        return noErr;
    }
    

    Add callback for output data from mixer:

    AudioUnitAddRenderNotify(m_mixerUnit, mixerCallBack, NULL);
    

    That’s all. You need to schedule audio files to FilePlayer unit to play.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this problem: I want to generate a new source code file from
I have problem, when I want add Node to my GUI from other Thread.
I have problem with fancybox. I want to write a function that will run
I have a problem with calling get_PrimaryKeys() function from msi.dll in c#. I want
I want to record the live audio and play it.As far as UI is
I have a problem in matlab I want to record a speech for 2
i have this problem: starting from an empty list (0 elements) i want check
I currently use AudioRecord to record audio in from the mic of an Android
I have a problem with boost shared_memory_object and mapped_region. I want to write a
I am using GWT/JAVA for development. I have following problem: I want to remove

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.