Audiokit: Setting Input/Output for external device

Created on 11 May 2017  Â·  24Comments  Â·  Source: AudioKit/AudioKit

While connecting an external I/O device , It is batter has a setting for user can select which channels are prefer .
ig. User apogee quartet , quartet has 4 analog input , and 6 analog output , you can select specific I/O channels for recording and monitor . you can select input 1 & 2 for stereo recording or just 1 for
mono recording.

For current version I test with quartet , if will using default input 1 , still works , but if your audio is via other channels , nothing can be recorded

A setting view with real time chart UI will be great for measuring the input/output volume

img

enhancement tips and tricks

Most helpful comment

Don't sell yourself short, It's pretty uncommon to be a pro user at all :)

All 24 comments

I only have the Apogee One with two inputs and one stereo output so I'd probably have to get a Quartet to really test out a fix. Its a relative small portion of users that have this big of a hardware configuration and want to program for it, but I feel ya, it should be supported.

Thanks : )
I think you must face some problem you have check your code is working correct
after connect to external device
Can't see the log for developing is a pain in the ass ...

Hi , I just think maybe you don't need to get a quartet , I think Duet is enough for testing

I have several interfaces with multiple Ins and outs.

RME 18 channel
Roland 4 channel
PreSonus 2 Channel

It's not that uncommon for pro users to have several multi channel
interfaces.

L

On Wednesday, May 10, 2017, WebberLai notifications@github.com wrote:

Hi , I just think maybe you don't need to get a quartet , I think Duet is
enough for testing

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/audiokit/AudioKit/issues/891#issuecomment-300700825,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AHxL7pyoN56fh_q9jKTfs0MGixuj5-Rpks5r4rJAgaJpZM4NXjeR
.

--
Larry Seyer
http://LarrySeyer.com
l

Don't sell yourself short, It's pretty uncommon to be a pro user at all :)

@WebberLai Quartet on its way.

Amazing ~ I will pull new code today , and test it later
Many thanks

Sorry , I forgot to ask , how can I verify that I can select other inputs for recording ???

Alright, so I have the Quartet, but it only shows up as a single input in AudioKit for macOS. I haven't tried for iOS, maybe it is smarter.

I think this is going to require getting down and dirty with multi route: https://forums.developer.apple.com/thread/16790

The link this exactly I neeeeeeeeeed !!!
Thank you
BTW,Quartet works on iOS , but only if input is from "input1"

To add to all this... I had a post about 6 months ago but was using a Motu interface that had many multi-channel inputs. It has to do with detecting all the audio recording/playback streams. This app I found will display all the available inputs/outputs. perhaps it will also be helpful in adding this feature.

https://github.com/rnine/AMCoreAudio

let me know how I can help.

@Joebayld That is an incredible find! I'm diving into the code.

No problem. Also, I was thinking because the AudioKit.inputDevice is a singleton, maybe we make another input class that is like a 'AKLineInput' and has a variable that lets you determine what channel to listen to, and maybe a mono/stereo option.

Just thinking over it.

Yeah, that would be incredible. Luckily rnine has MIT license on this stuff so we can use it directly.

adding myself to this issue. :)

I looked at AMCoreAudio finally - it works great. We should use it if possible for macOS, or at least use the HAL calls like that.

Also interested in seeing this functionality. Been struggling with multichannel inputs the last few days (on iOS)

+1 for this functionality on macOS. I'm working on a Room EQ app that would greatly benefit from this for edit rooms in a post production setting.

I spent the last couple of days fighting with this. Finally found something that is roughly working, so I thought I'd share.

I'm trying to push out 8 channels to audio to my modular synth through the ES-8 USB audio device. I kept running into issues where it would only talk to the first 2 channels, as if it's a stereo output. I had to create a custom channel format and bypass the AudioKit provided output mixer.

let engine = AudioKit.engine
engine.connect(lfo1.avAudioNode, to: engine.mainMixerNode, format: channelFormat(for: kAudioChannelLabel_Left))
engine.connect(lfo2.avAudioNode, to: engine.mainMixerNode, format: channelFormat(for: kAudioChannelLabel_Discrete_7))

// force main mixer to mirror output format
engine.connect(engine.mainMixerNode, to: engine.outputNode, format: engine.outputNode.outputFormat(forBus: 0))

The last line seems to be the key to getting all outputs online. I'm still trying to figure out how to properly query the interface for these channel formats. Right now everything has to be hardcoded, which obviously won't work for compatibility between devices.

Here is a way to create a custom audio format in Swift:

    func channelFormat(for channelLabel: AudioChannelLabel) -> AVAudioFormat {
        let desc = AudioChannelDescription.init(mChannelLabel: channelLabel, mChannelFlags: AudioChannelFlags.init(rawValue: 0), mCoordinates: (0.0, 0.0, 0.0))
        let singleChannelLayout = AudioChannelLayout.init(mChannelLayoutTag: 0, mChannelBitmap: AudioChannelBitmap.init(rawValue: 0), mNumberChannelDescriptions: 1, mChannelDescriptions: desc)
        let singleChannelLayoutPointer = UnsafeMutablePointer<AudioChannelLayout>.allocate(capacity: 1)
        singleChannelLayoutPointer.initialize(to: singleChannelLayout)
        let wrappedSingleChannelLayout = AVAudioChannelLayout.init(layout: singleChannelLayoutPointer)
        return AVAudioFormat.init(standardFormatWithSampleRate: 44100, channelLayout: wrappedSingleChannelLayout)
    }

@kylestew Thanks for posting the sample code. Did you manage to get the formats from the interface?

you might want to take a look at AMCoreAudio: https://github.com/rnine/AMCoreAudio

Thanks @ryanfrancesconi , do you know of any iOS solutions?

oh sorry, i had assumed you were talking about macOS. No, I don't work on iOS.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dddx80 picture dddx80  Â·  3Comments

gm3197 picture gm3197  Â·  10Comments

minayko picture minayko  Â·  4Comments

bluenucleus picture bluenucleus  Â·  5Comments

jamesharvey2 picture jamesharvey2  Â·  3Comments