Alsa driver limited to 16-bit / 48kHz audio files

Open
#494 34 comments 1 reaction 1 assignee View on GitHub

@popcornmix is already working on this.

Since May 17, 2017.

Assessment

This issue has not been assessed yet.

Description

Assigned for implementation/action confirmed

While trying to play 24-bit/96kHz or 24-bit 192kHz files with aplay the files are downsampled to 16-bit

pi@raspberrypi ~ $ aplay -v audio/JimmyAndTheCrows96kHz.wav
Playing WAVE 'audio/JimmyAndTheCrows96kHz.wav' : Signed 24 bit Little Endian in 3bytes, Rate 96000 Hz, Stereo
Plug PCM: Rate conversion PCM (48000, sformat=S16_LE)
Converter: linear-interpolation
Protocol version: 10002
Its setup is:
  stream       : PLAYBACK
  access       : RW_INTERLEAVED
  format       : S24_3LE
  subformat    : STD
  channels     : 2
  rate         : 96000
  exact rate   : 96000 (96000/1)
  msbits       : 24
  buffer_size  : 32768
  period_size  : 8192
  period_time  : 85333
  tstamp_mode  : NONE
  period_step  : 1
  avail_min    : 8192
  period_event : 0
  start_threshold  : 32768
  stop_threshold   : 32768
  silence_threshold: 0
  silence_size : 0
  boundary     : 1073741824
Slave: Hardware PCM card 0 'bcm2835 ALSA' device 0 subdevice 0
Its setup is:
  stream       : PLAYBACK
  access       : MMAP_INTERLEAVED
  format       : S16_LE
  subformat    : STD
  channels     : 2
  rate         : 48000
  exact rate   : 48000 (48000/1)
  msbits       : 16
  buffer_size  : 16384
  period_size  : 4096
  period_time  : 85333
  tstamp_mode  : NONE
  period_step  : 1
  avail_min    : 4096
  period_event : 0
  start_threshold  : 16384
  stop_threshold   : 16384
  silence_threshold: 0
  silence_size : 0
  boundary     : 1073741824
  appl_ptr     : 0
  hw_ptr       : 0

pi@raspberrypi ~ $ mplayer -ao alsa audio/test32bit_44.1kHz.wav
MPlayer svn r34540 (Debian), built with gcc-4.6 (C) 2000-2012 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing audio/test32bit_44.1kHz.wav.
libavformat version 53.21.1 (external)
Mismatching header version 53.19.0
Audio only file format detected.
Load subtitles in audio/
==========================================================================
Opening audio decoder: [pcm] Uncompressed PCM audio decoder
AUDIO: 44100 Hz, 2 ch, s32le, 2822.4 kbit/100.00% (ratio: 352800->352800)
Selected audio codec: [pcm] afm: pcm (Uncompressed PCM)
==========================================================================
AO: [alsa] 44100Hz 2ch s32le (4 bytes per sample)
Video: no video
Starting playback...
A:  23.5 (23.5) of 66.0 (01:06.0)  1.8%


MPlayer interrupted by signal 2 in module: play_audio
A:  23.6 (23.5) of 66.0 (01:06.0)  1.8%

Exiting... (Quit)
pi@raspberrypi ~ $ mplayer -ao alsa audio/JimmyAndTheCrows96kHz.wav
MPlayer svn r34540 (Debian), built with gcc-4.6 (C) 2000-2012 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing audio/JimmyAndTheCrows96kHz.wav.
libavformat version 53.21.1 (external)
Mismatching header version 53.19.0
libavformat file format detected.
[wav @ 0xb63ecc78]max_analyze_duration reached
[lavf] stream 0: audio (pcm_s24le), -aid 0
Clip info:
 comment: Jimmy And The Crows
 encoded_by: Keith Greeninger, Chris Kee & Br
 date: 2013-07-25
 creation_time: 14:58:00
 time_reference: 0
 coding_history: A=PCM,F=96000,W=24,M=stereo,T=KORG AudioGate ver.2.3.2 (Windows 7),

 artist: Keith Greeninger, Chris Kee & Brain
 title: Jimmy And The Crows
Load subtitles in audio/
==========================================================================
Opening audio decoder: [pcm] Uncompressed PCM audio decoder
AUDIO: 96000 Hz, 2 ch, s24le, 4608.0 kbit/100.00% (ratio: 576000->576000)
Selected audio codec: [pcm] afm: pcm (Uncompressed PCM)
==========================================================================
AO: [alsa] 48000Hz 2ch s24le (3 bytes per sample)
Video: no video
Starting playback...
A:  36.9 (36.9) of 475.2 (07:55.2)  9.2%


MPlayer interrupted by signal 2 in module: decode_audio
A:  37.0 (36.9) of 475.2 (07:55.2)  9.2%

Exiting... (Quit)

But playing with omxplayer they "appear" to play back correctly:

pi@raspberrypi ~ $ omxplayer -p audio/JimmyAndTheCrows96kHz.wav
Audio codec pcm_s24le channels 2 samplerate 96000 bitspersample 24
Subtitle count: 0, state: off, index: 1, delay: 0
have a nice day ;)
Dominant language
C
Stars
13.2k
Forks
5.5k
Avg merge
2d 21h
Merged PRs (30d)
21

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from raspberrypi/linux

All issues in raspberrypi/linux

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.