4

We know there is no API for recording live streaming audio of OS X ( output sound). And we should install a kernel extension like SoundFlower and then record audio of output channel through that kernel extension.

I'm aware that some open source apps like audacity use Port Audio library to capture audio of another audio devices other than default audio device of system. But I couldn't compile Port Audio because of too much errors when building it on Xcode.

I want to know there is a straight forward Core Audio API which has capability of choosing record device? AudioQueue API has no ability to determine type of record device. How to record output sound which is being played through SoundFLower in objective C with use of some specific Mac provided API?

Thanks in advance for your responses.

  • possible duplicate of [Selecting input mic for Mac Audio Queue Services?](http://stackoverflow.com/questions/6184751/selecting-input-mic-for-mac-audio-queue-services) – sbooth Jun 16 '14 at 22:50
  • That question was not answered properly . My question in not only about Audio Queue but about all audio frameworks which can be used for selecting optional input to recording APIs. – user3323552 Jun 17 '14 at 09:41
  • On OS X an `AudioDeviceID` can be used with the AUHAL, Audio Queue, and most audio APIs. What about that question or http://stackoverflow.com/questions/4575408/audioobjectgetpropertydata-to-get-a-list-of-input-devices doesn't answer your question? – sbooth Jun 18 '14 at 03:34
  • You mean I can use Audio Queue API to capture any optional audio device with it's AudioDeviceID? – user3323552 Jun 18 '14 at 05:05
  • Do you mean can I use Audio Queue API to capture any optional audio device sound with it's AudioDeviceID? – user3323552 Jun 18 '14 at 09:32
  • If I understand your question, yes. You can use the method outlined in the other question to get a list of available output devices and then tell Audio Queue which device to use via the property `kAudioQueueProperty_CurrentDevice` – sbooth Jun 18 '14 at 11:43
  • But it couldn't record from output channel of some optional audio device? Do you think Audio Queue is capable of recording output channel of any desired audio device? Are you sure ? – user3323552 Jun 18 '14 at 12:07
  • My question is about capturing OUTPUT sound of an audio device . But I think Audio Queue is related to input channels of devices? What o you think about it? – user3323552 Jun 18 '14 at 12:12
  • I made an unfortunate typo in my last comment; I meant to write *input* device. Audio Queue can be used for recording or playback. – sbooth Jun 19 '14 at 11:56
  • Does anyone know how to record output audio or live streaming audion in ios? – Hardik1344 Aug 08 '19 at 05:25

1 Answers1

-1

This is the relevant code used in SoundFlowerBed to find and select specific audio devices:

/* From Interface */
AudioDeviceID mSoundflower2Device;
AudioDeviceID mSoundflower16Device;

/* Implementation */
// find soundflower devices, store and remove them from our output list
AudioDeviceList::DeviceList &thelist = mOutputDeviceList->GetList();
int index = 0;
for (AudioDeviceList::DeviceList::iterator i = thelist.begin(); i != thelist.end(); ++i, ++index) {
    if (0 == strcmp("Soundflower (2ch)", (*i).mName)) {
        mSoundflower2Device = (*i).mID;
        AudioDeviceList::DeviceList::iterator toerase = i;
        i--;
        thelist.erase(toerase);
    }
    else if (0 == strcmp("Soundflower (16ch)", (*i).mName)) {
        mSoundflower16Device = (*i).mID;
        AudioDeviceList::DeviceList::iterator toerase = i;
        i--;
        thelist.erase(toerase);
    }
    else if (0 == strcmp("Soundflower (64ch)", (*i).mName)) {
        mSoundflower16Device = (*i).mID;
        AudioDeviceList::DeviceList::iterator toerase = i;
        i--;
        thelist.erase(toerase);
    }
}

You'll need to download the source form here: https://github.com/mattingalls/Soundflower and include AudioDevice and AudioDeviceList files in your project.

Miniroo
  • 415
  • 5
  • 13