Menu

#383 bad number of channels with coreaudio and more than 8 input channels

open
nobody
None
5
2 days ago
2 days ago
No

Hello,

I use, and appreciate, sox a lot, on Linux and MacOS. Thank you all for this wonderful contribution.

I tried to record a sound from a multichannel audio device (more than 8 inputs and 8 outputs) on MacOS, with coreaudio, and I noticed that:

  • the detected number of channels is wrong: 8 are reported
  • the sound is bad: like the resulting channels are interleaved and too slow

I got the same results with 3 different audio devices, by RME: FireFace 400 (firewire, 18 inputs and outputs) , Babyface (USB, 12 inputs and outputs), and UCX (USB, 18 inputs and outputs).

Here is the result with a FireFace 400 (as the default system device):

% sox -V -V -d multi16-1.wav remix 1 trim 0 1
sox DBUG sox: Looking for a default device: trying format `coreaudio'
sox DBUG coreaudio: audio device did not accept 44100 sample rate. Use 48000 instead.
sox:      SoX v
time:     Feb 22 2015 20:51:03
uname:    Darwin m.home 23.6.0 Darwin Kernel Version 23.6.0: Tue Feb 24 20:49:34 PST 2026; root:xnu-10063.141.1.711.7~1/RELEASE_ARM64_T8103 arm64
compiler: gcc Apple LLVM 16.0.0 (clang-1600.0.26.6)
arch:     1288 48 88 L 
sox DBUG coreaudio: audio device did not accept 2 channels. Use 8 channels instead.
sox DBUG coreaudio: audio device did not accept 44100 sample rate. Use 48000 instead.

Input File     : 'default' (coreaudio)
Channels       : 8
Sample Rate    : 48000
Precision      : 32-bit
Sample Encoding: 32-bit Signed Integer PCM
Endian Type    : little
Reverse Nibbles: no
Reverse Bits   : no

sox INFO sox: Overwriting `multi16-1.wav'
sox DBUG wav: Writing Wave file: Microsoft PCM format, 1 channel, 48000 samp/sec
sox DBUG wav:         192000 byte/sec, 4 block align, 32 bits/samp

Output File    : 'multi16-1.wav'
Channels       : 1
Sample Rate    : 48000
Precision      : 32-bit
Sample Encoding: 32-bit Signed Integer PCM
Endian Type    : little
Reverse Nibbles: no
Reverse Bits   : no
Comment        : 'Processed by SoX'

sox DBUG remix: 0: 
sox DBUG remix:     0 1
sox INFO sox: effects chain: input        48000Hz  8 channels (multi) 32 bits unknown length
sox INFO sox: effects chain: remix        48000Hz  1 channels (multi) 32 bits unknown length
sox INFO sox: effects chain: trim         48000Hz  1 channels (multi) 32 bits 00:00:01.00
sox INFO sox: effects chain: output       48000Hz  1 channels (multi) 32 bits 00:00:01.00
sox DBUG sox: start-up time = 0.070946
In:0.00% 00:00:01.01 [00:00:00.00] Out:48.0k [======|======] Hd:1.8 Clip:0    
sox DBUG remix: output buffer still held 384 samples; dropped.
Done.
sox DBUG wav: Finished writing Wave file, 192000 data bytes 48000 samples

I installed sox with macports and brew, version 14.4.2. No difference.

% sox -V -V --version
sox:      SoX v
time:     Feb 22 2015 20:51:03
uname:    Darwin m.home 23.6.0 Darwin Kernel Version 23.6.0: Tue Feb 24 20:49:34 PST 2026; root:xnu-10063.141.1.711.7~1/RELEASE_ARM64_T8103 arm64
compiler: gcc Apple LLVM 16.0.0 (clang-1600.0.26.6)
arch:     1288 48 88 L 

% port installed and '*sox*'
The following ports are currently installed:
  sox @14.4.2_8 (active)
  soxr @0.1.3_0 (active)

% brew info sox
==> sox : stable 14.4.2 (bottled)
SOund eXchange: universal sound sample translator
https://sox.sourceforge.net/
Conflicts with:
  sox_ng (because both install `play`, `rec`, `sox`, `soxi` binaries)
Installed (on request)
/opt/homebrew/Cellar/sox/14.4.2_6 (26 files, 2.5MB) *
  Poured from bottle using the formulae.brew.sh API on 2026-05-18 at 15:05:07
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/s/sox.rb
License: GPL-2.0-or-later AND LGPL-2.1-or-later
==> Dependencies
Required (8): flac , lame , libogg , libpng , libsndfile , libvorbis , mad , opusfile 
Recursive Runtime (12): all installed 
==> Downloading https://formulae.brew.sh/api/formula/sox.json
==> Analytics
install: 2,617 (30 days), 11,237 (90 days), 31,048 (365 days)
install-on-request: 2,488 (30 days), 10,913 (90 days), 29,523 (365 days)
build-error: 1 (30 days)

Note that the output exhibits the same problem:

  • bad number of detected channels
  • bad sound: like the channels and interleaved, and too fast
% sox -V -V input.wav -d trim 0 1
sox DBUG sox: Looking for a default device: trying format `coreaudio'
sox DBUG coreaudio: audio device did not accept 2 channels. Use 8 channels instead.
sox DBUG coreaudio: audio device did not accept 44100 sample rate. Use 48000 instead.
sox:      SoX v
time:     Feb 22 2015 20:51:03
uname:    Darwin m.home 23.6.0 Darwin Kernel Version 23.6.0: Tue Feb 24 20:49:34 PST 2026; root:xnu-10063.141.1.711.7~1/RELEASE_ARM64_T8103 arm64
compiler: gcc Apple LLVM 16.0.0 (clang-1600.0.26.6)
arch:     1288 48 88 L 
sox INFO formats: detected file format type `wav'
sox DBUG wav: Searching for 66 6d 74 20
sox DBUG wav: WAV Chunk fmt 
sox DBUG wav: Searching for 64 61 74 61
sox DBUG wav: WAV Chunk data
sox DBUG wav: Reading Wave file: Microsoft PCM format, 2 channels, 44100 samp/sec
sox DBUG wav:         176400 byte/sec, 4 block align, 16 bits/samp, 38915124 data bytes
sox DBUG wav:         9728781 Samps/chans
sox DBUG wav: Searching for 4c 49 53 54
sox DBUG wav: WAV Chunk LIST
sox DBUG wav: Type INFO
sox DBUG wav: Attempting to seek beyond unsupported chunk `IPRD' of length 19 bytes
sox DBUG wav: Attempting to seek beyond unsupported chunk `IART' of length 10 bytes
sox DBUG wav: Attempting to seek beyond unsupported chunk `IGNR' of length 12 bytes
sox DBUG wav: Attempting to seek beyond unsupported chunk `ICOP' of length 54 bytes
sox DBUG wav: Attempting to seek beyond unsupported chunk `INAM' of length 15 bytes
sox DBUG wav: Attempting to seek beyond unsupported chunk `ITRK' of length 3 bytes
sox DBUG wav: Chunk ICRD
sox DBUG wav: Attempting to seek beyond unsupported chunk `id3 ' of length 160011 bytes

Input File     : 'input.wav'
Channels       : 2
Sample Rate    : 44100
Precision      : 16-bit
Duration       : 00:03:40.61 = 9728781 samples = 16545.5 CDDA sectors
File Size      : 39.1M
Bit Rate       : 1.42M
Sample Encoding: 16-bit Signed Integer PCM
Endian Type    : little
Reverse Nibbles: no
Reverse Bits   : no

sox DBUG coreaudio: audio device did not accept 2 channels. Use 8 channels instead.
sox DBUG coreaudio: audio device did not accept 44100 sample rate. Use 48000 instead.
sox INFO formats: can't set sample rate 44100; using 48000
sox INFO formats: can't set 2 channels; using 8

Output File    : 'default' (coreaudio)
Channels       : 8
Sample Rate    : 48000
Precision      : 25-bit
Sample Encoding: 32-bit Floating Point PCM
Endian Type    : little
Reverse Nibbles: no
Reverse Bits   : no

sox DBUG effects_i_dsp: make_lpf(n=6719 Fc=0.005238281 β=10.62 ρ=0.63 dc-norm=0 scale=160)
sox DBUG rate: fir_len=42 phases=160 coef_interp=0 size=53.8k
sox DBUG rate:     0|41    preload=20 remL=0
sox DBUG rate:     0|41    preload=20 remL=0
sox DBUG remix: 0: 
sox DBUG remix:     0 1
sox DBUG remix: 1: 
sox DBUG remix:     1 1
sox DBUG remix: 2: 
sox DBUG remix:     0 1
sox DBUG remix: 3: 
sox DBUG remix:     1 1
sox DBUG remix: 4: 
sox DBUG remix:     0 1
sox DBUG remix: 5: 
sox DBUG remix:     1 1
sox DBUG remix: 6: 
sox DBUG remix:     0 1
sox DBUG remix: 7: 
sox DBUG remix:     1 1
sox INFO sox: effects chain: input        44100Hz  2 channels (multi) 16 bits 00:03:40.61
sox INFO sox: effects chain: trim         44100Hz  2 channels (multi) 16 bits 00:00:01.00
sox INFO sox: effects chain: rate         48000Hz  2 channels         32 bits 00:00:01.00
sox INFO sox: effects chain: channels     48000Hz  8 channels (multi) 32 bits 00:00:01.00
sox INFO sox: effects chain: output       48000Hz  8 channels (multi) 25 bits 00:00:01.00
sox DBUG sox: automatically entering interactive mode
sox DBUG sox: start-up time = 0.076592
In:0.46% 00:00:01.02 [00:03:39.59] Out:48.0k [-=====|===== ] Hd:2.8 Clip:0    
sox DBUG input: output buffer still held 956 samples; dropped.
Done.

Discussion


Log in to post a comment.

MongoDB Logo MongoDB