• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: AVAudioEngine - Multichannel output does not play on channel 1 and 2
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AVAudioEngine - Multichannel output does not play on channel 1 and 2


  • Subject: Re: AVAudioEngine - Multichannel output does not play on channel 1 and 2
  • From: Dave Gibson <email@hidden>
  • Date: Fri, 24 Feb 2017 10:02:56 +0000

Managed to get it sorted after much confusion and trial/error. Turns out that the channel layout was the culprit. So instead of the kAudioChannelLayoutTag_DiscreteInOrder tag, I used:

let multiChannelLayout = AVAudioChannelLayout(layoutTag:
kAudioChannelLayoutTag_Unknown | numChannels)


I had previously tried the unknown tag but had issues with it because unlike all of the other channel layouts, this mode retains the information in the output buffer with each pass. I was adding each of the input busses to the output buffers incrementally, which was quickly resulting in a wall of sound; I had incorrectly interpreted this as a bad channel layout. Erasing the contents of the output buffers at the start of render callback was the answer.

It seems AVAudioEngine can do a lot of what can be done with the Core Audio C API, and the Swift/Obj-C interface is much more friendly on the whole. However, if you want to work with anything other than stereo, these channel layouts are the biggest PITA about working with AVAudioEngine at the moment. 

The AVAudioNode objects, particularly the mixer, seem to interpret and manipulate the information in the channels in all different ways depending on these settings, often resulting in silence at the output. Unfortunately, there seems to be no information about how these settings are interpreted in the graph :(

Anyway, hope that helps someone else down the line :)



On Wed, Feb 22, 2017 at 8:00 PM, <email@hidden> wrote:

Message: 1
Date: Wed, 22 Feb 2017 15:05:22 +0000
From: Dave Gibson <email@hidden>
To: email@hidden
Subject: AVAudioEngine - Multichannel output does not play on channel
        1 and 2
Message-ID:
        <CAMa4WGP3uJMorUbS3tHnpVL=u3hGkQ2NogE4aNT9xAzt_yET3Q@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

*AVAudioEngine - Multichannel output does not play on channel 1 and 2*


We have an existing iOS application that uses the Core Audio C API and
achieves multichannel output using the Matrix Mixer. I’m currently
rewriting the audio engine using AVAudioEngine but I am having problems
getting multichannel output working correctly.


In terms of hardware, I am running   * iPad Air 2 (iOS 10.2) ——>
iConnectAudio 4+*    (which receives 8 channels of audio from the iPad via
USB). In my audio graph, I have a single custom AVAudioUnit which is
outputting 8 channels of audio to the outputNode. I am setting up my audio
format as follows:



        // Muti channel format

        let numChannels = UInt32(8)

        let multiChannelLayout = AVAudioChannelLayout(layoutTag:
kAudioChannelLayoutTag_DiscreteInOrder | numChannels)



        let multiChannelFormat = AVAudioFormat(commonFormat:
stereoFormat.commonFormat, sampleRate: stereoFormat.sampleRate,
interleaved: stereoFormat.isInterleaved, channelLayout: multiChannelLayout)



I have confirmed that my custom AVAudioUnit is constantly sending all 8
channels of audio to the outputNode. However, on the iConnectAudio 4+
control panel, I can see that the device is only receiving audio on
channels 3 - 8. For some reason, it is not receiving any audio from the app
on the first 2 channels. I have confirmed this in listening tests too.


However, the audio device *IS* receiving all of the system sounds on
channels 1 and 2. For example, the click sounds when editing the text in a
UITextField can be heard on channels 1 and 2. It seems as though either -


* iOS is blocking all audio on channels 1 and 2

* The stream for audio channels 1 and 2 and getting zeroed inside the
AVAudioOutputNode


There seems to be no issue with the audio hardware itself because I am able
to output audio on all 8 channels using our existing iOS application and
other apps, such as Cubasis. So, it would suggest that the issue perhaps
lies in the AVAudioOutputNode. If I set the AVAudioFormat to a 2 channel
configuration, the audio will output on channels 1 and 2 (mixed with the
system sounds) but any configuration with more than 2 channels results in
no audio on channels 1 and 2, other than the system sounds.


It seems to me that  '*kAudioChannelLayoutTag_DiscreteInOrder |
numChannels'* would be the correct layout to use in this case - but please
do correct me if I am wrong - there's very little information on how
AVAudioEngine handles this information. In essence - I want to output each
channel independently to the audio interface, I want the outputNode to just
output the audio channels as it receives them - this is a studio
application, not a surround sound/positional audio scenario. I have also
tried setting the AVAudioChannelLayout to some value other than
kAudioChannelLayoutTag_DiscreteInOrder
but to no avail - resulting in either silence or 2-channel audio.


Has anyone had this or a similar issue?  Or could anybody suggest what’s
happening here and how I might fix the issue.


Many thanks,


Dave

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Property Listener crash
  • Previous by thread: Property Listener crash
  • Index(es):
    • Date
    • Thread