GeorgeIoak
Posts: 43
Joined: Thu Aug 30, 2012 1:50 am

24-bit/192kHz Audio Over HDMI

Mon Jan 06, 2014 11:51 pm

I've read that the latest distribution supports this so I downloaded 2013-12-20-wheezy-raspbian.img and ran it on my older original RPi. Here's some basic system information

Code: Select all

[email protected] ~ $ uname -a
Linux raspberrypi 3.10.25+ #622 PREEMPT Fri Jan 3 18:41:00 GMT 2014 armv6l GNU/Linux
[email protected] ~ $ tvservice -a
     PCM supported: Max channels: 8, Max samplerate: 192kHz, Max samplesize 24 bits.
     AC3 supported: Max channels: 6, Max samplerate:  48kHz, Max rate  640 kb/s.
     DTS supported: Max channels: 6, Max samplerate:  96kHz, Max rate 1536 kb/s.
  DTS_HD supported: Max channels: 8, Max samplerate: 192kHz, Max rate    8 kb/s.

Code: Select all

[email protected] ~ $ aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
default:CARD=ALSA
    bcm2835 ALSA, bcm2835 ALSA
    Default Audio Device
sysdefault:CARD=ALSA
    bcm2835 ALSA, bcm2835 ALSA
    Default Audio Device
[email protected] ~ $
So I decided to test using aplay but as you can see, it is converting the file to 16-bit/48kHz because I assume it thinks the hardware doesn't support 24-bit/96kHz.

Code: Select all

[email protected] ~ $ 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
But if I use omxplayer it does appear that the file is played in 24-bit/96kHz. My AVR only displays frequency and not bit level so I can only confirm that it is playing at 96kHz.

Code: Select all

[email protected] ~ $ 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 ;)
So I installed mplayer to see how it would play the files and it too produced some interesting results:

Code: Select all

[email protected] ~ $ 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)
[email protected] ~ $ 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)
So I'm confused as to what is happening and why it is behaving like this.

GeorgeIoak
Posts: 43
Joined: Thu Aug 30, 2012 1:50 am

Re: 24-bit/192kHz Audio Over HDMI

Mon Jan 13, 2014 8:17 pm

I just thought I'd post a reply to see if anyone could at least test playing a 24-bit/96kHz audio file. I good site for reference of where to get free downloads is http://www.24bit96.com/24bit96khz-downl ... nload.html

Thanks in advance,
George

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5144
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: 24-bit/192kHz Audio Over HDMI

Mon Jan 13, 2014 8:30 pm

The alsa driver currently limits you to 16-bit / 48kHz. It could support higher - create a github issue to stop me forgetting about this:
https://github.com/raspberrypi/linux/issues

Openmax can support 24-bit / 192kHz. You can test this with hello_audio test app.

GeorgeIoak
Posts: 43
Joined: Thu Aug 30, 2012 1:50 am

Re: 24-bit/192kHz Audio Over HDMI

Mon Jan 13, 2014 9:47 pm

Thanks for confirming this. I create an issue and give the hello_audio a try. Do you know offhand if hello_audio can handle flac or just is it just wav files?

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5144
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: 24-bit/192kHz Audio Over HDMI

Mon Jan 13, 2014 10:10 pm

GeorgeIoak wrote:Thanks for confirming this. I create an issue and give the hello_audio a try. Do you know offhand if hello_audio can handle flac or just is it just wav files?
hello_audio is just a demo app that takes raw data (it generates a sine wave).
It shouldn't be hard to make it read data from a file. You can convert wav to raw with something like sox.

GeorgeIoak
Posts: 43
Joined: Thu Aug 30, 2012 1:50 am

Re: 24-bit/192kHz Audio Over HDMI

Mon Jan 13, 2014 10:18 pm

OK, been a while since I messed with this. I thought this code had been changed. I was looking at https://github.com/raspberrypi/linux/bl ... 2835-pcm.c and noticed the formats and rates weren't implemented but I could have sworn I read somewhere that they were.

Code: Select all

/* hardware definition */
static struct snd_pcm_hardware snd_bcm2835_playback_hw = {
        .info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER |
                 SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID),
        .formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE,
        .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000,
        .rate_min = 8000,
        .rate_max = 48000,
        .channels_min = 1,
        .channels_max = 2,
        .buffer_bytes_max = 128 * 1024,
        .period_bytes_min =   1 * 1024,
        .period_bytes_max = 128 * 1024,
        .periods_min = 1,
        .periods_max = 128,
};

mhelin
Posts: 116
Joined: Wed Oct 17, 2012 7:18 pm

Re: 24-bit/192kHz Audio Over HDMI

Fri Apr 13, 2018 1:20 pm

How is this today? Can 24 bit/192kHz audio played using ALSA over HDMI now?

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5144
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: 24-bit/192kHz Audio Over HDMI

Fri Apr 13, 2018 1:36 pm

mhelin wrote:
Fri Apr 13, 2018 1:20 pm
How is this today? Can 24 bit/192kHz audio played using ALSA over HDMI now?
Not trivially through alsa. It can from openmax.
There do exist kernel patches that enable higher bitrates and multichannel through alsa,
but they didn't play nicely with sonic pi so haven't yet been merged, but it's something that will hopefully be resolved at some point.

Return to “Graphics, sound and multimedia”

Who is online

Users browsing this forum: No registered users and 13 guests