Skip to content

numberOfChannels reported as 2 for a single channel, mono, audio file #667

@itsramiel

Description

@itsramiel

Description

Hi,

I am trying to retrieve the channel count for an audio file. My file is mono, single channel. This can be checked with ffmpeg

ffmpeg -i assets/mono.wav                                            1m 33s 10:11:00 AM
ffmpeg version 7.1.1 Copyright (c) 2000-2025 the FFmpeg developers
  built with Apple clang version 17.0.0 (clang-1700.0.13.3)
  configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/7.1.1_3 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags='-Wl,-ld_classic' --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libharfbuzz --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-audiotoolbox --enable-neon
  libavutil      59. 39.100 / 59. 39.100
  libavcodec     61. 19.101 / 61. 19.101
  libavformat    61.  7.100 / 61.  7.100
  libavdevice    61.  3.100 / 61.  3.100
  libavfilter    10.  4.100 / 10.  4.100
  libswscale      8.  3.100 /  8.  3.100
  libswresample   5.  3.100 /  5.  3.100
  libpostproc    58.  3.100 / 58.  3.100
[aist#0:0/pcm_s16le @ 0x1569042f0] Guessed Channel Layout: mono
Input #0, wav, from 'assets/mono.wav':
  Metadata:
    encoder         : Sony Sound Forge 7.0
    title           : Large fan
    IENG            : Sebastian Lindstr�m
    copyright       : Copy freely
    comment         : Large fanblades?
                    : No. A recording of an attempt to
                    : create the sound of an explosion using several clicks, modified with Accoustic Mirror using an audio sample of a preast reading the latin prayer 'Pater Noster', heavily flanged, reversed, flanged again, then crossfaded into a perfect loop?
                    : Yes.
                    : So... fanblades. Useful? You decide.
    ISBJ            : oh, for the love of... it's noise, ok!?
    date            : 2013-05-15
  Duration: 00:00:05.00, bitrate: 769 kb/s
  Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, mono, s16, 768 kb/s
At least one output file must be specified

However when I retrieve it using react-native-audio-api after creating an AudioBuffer, the reported channelCount is 2

Steps to reproduce

  1. Clone repro
  2. Run app
  3. Observe how the logged number is 2
  4. Retrieve channel count with ffmpeg
  5. Observe how output mentions mono

Snack or a link to a repository

https://github.com/itsramiel/AudioApidChannelCount

React Native Audio API version

0.8.2

React Native version

0.81.4

Platforms

Android, iOS

JavaScript runtime

Hermes

Workflow

React Native

Architecture

Fabric (New Architecture)

Build type

Debug app & dev bundle

Device

Android emulator

Device model

No response

Acknowledgements

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions