AudioKit / AudioKit

Audio synthesis, processing, & analysis platform for iOS, macOS and tvOS

Home Page:http://audiokit.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FormatConverter discards 2nd channel when going from 2 to 1 channels

quantamrhino opened this issue · comments

macOS Version(s) Used to Build

macOS 13 Ventura

Xcode Version(s)

Xcode 14

Description

Using formatConverter.Options as follows:

options.format = .caf
options.sampleRate = 48000
options.bitDepth = 16
options.channels = 1 // mono.

if I have a stereo file with 1 channel (left), this converts it to a mono file correctly.
But a stereo file with 1 channel (right) converts it to an empty file.
is this expected behavior - to discard the second channel?

If so, how does one convert a 1-channel stereo file to a mono file (with the non empty channel) as the first channel? (effectively flatten it).

Crash Logs, Screenshots or Other Attachments (if applicable)

No response

It sounds like it is just grabbing the first channel (left) and making it into a mono file. I wouldn't think that is the expected behavior, but it would take some digging to find where this is occurring and how to mix the two channels. If you want to make a minimal GitHub example I can take a look.

I think there is a Stereo Limiter AudioKit node that could be used to make an incoming stream Mono.