Raspberry Pi and HDMI Sample Rates

Hi,

I recently purchaced a “Volumio supported GPIO header solution (I2S) DAC” for my new Raspberry Pi2 because my AV Receiver was only picking up 48kHz on higher sample rate files via HDMI. After some testing and fiddling around I have come to the conclusion that the sound was far superior (clearer with no noise) through HDMI (ALSA) to my AV Receiver. Even my self-proclaimed tone-deaf wife came through to the lounge and commented that is was better before. Obviously now I am thinking of going back to HDMI, but I still have the same problem 48 kHz ceiling problem???

After some research I found that the Raspberry Pi supports HDMI v1.3a which as far as I believe supports up to 192kHz. I then thought maybe it is the software (Volumio, driver or something) and then found this github.com/raspberrypi/linux/issues/494 which states the ALSA driver to be limited to 48kHz, so I assume this is my problem?

My research therefore brings me to the obvious questions; Is the limitation of ALSA true? If so, are there any plans for Volumio to support a higher sample rate through ASLA/HDMI?

Cheers,
Tristan

So after some research it seems ALSA may be downsampling to 48kHz. Does anyone have any idea how to output anything above 48khz?

root@volumio:~# tvservice -a
     PCM supported: Max channels: 2, 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:  48kHz, Max rate 1536 kb/s.

Thanks,
Tris

Hy,

I have this problem too…
My raspberry pi i use hearing music over hdmi output to receiver. With openelec my pi can output 88,96,192khz 2 channel flac, and multichannel 96khz 5.1 flac with the equal sample rate displayed at av receiver.
When i install volumio, everything played at 48khz, and multichannel flac has strong distortions.
What can make to use volumio the correct sample rate output to play lossless this musics?

Another problem:
With 100% volume music is distorted… I maked reserch , and hear some info volumio hdmi output is amplified +4db.
So manually set the volume to 96, or at ssh turning off the 4db amplifiing ( all of above make a same result volume go to 96) stop the distortion, but how can this make default settings at boot up?

Hi,
I am still having the problem. I have not tried anything else, but thanks for the confirmation. Many have said that it is a limitation on the PI but I guess your testing proves otherwise? I thought the clock was unable to produce bit perfect sound over hdmi at 192khz. I solved my distortion by disabling volume control in Volumio and now using my AV Receiver or it.

Thanks,
Disabling the volume control solve my distortion problem.
Only 2 things I missed :
Playback at 88,96,192khz via hdmi :slight_smile:

Handling cue files (this is partially solved when used mpdroid)

Hi,

I made a custom kernel with a patch to push the limits to 192kHz. I tried it yesterday on a Pi1 with a semi-success: I could see the rate changing to 192kHz on my but sound was very because it was 24bits and the patch I made could not handle it.
Resampling the file to 16bits did the job but I did not have enough time to further test the system, I will do it on my Pi2B when I’ll receive the SD cards.
So in a near future I will provide all the files needed to update the kernel, stay tuned!

+1

Hi,

I finally found the time to test the new patched kernel on my Pi 2 B and it works, I could get 192/24 files played without any problem. I even tried to play a 5.1 file but only two channels are decoded (files can be found here: 2l.no/hires).
The status on my Denon AVR1911 displays correctly the bitrate, tested with a 44.1, 96 and 192kHz file.
While listening to a 44.1kHz stream (SomaFM) I could hear distortion, it was due to the +4dB amplification that Alsa do when the volume is full. Changed it with alsamixer (volume set to 86) and distortion is gone.

So here are the files to put on your system for both versions of Pi (1 and 2). There are two compressed tarball files, modules-SA.tgz and boot-SA.tgz, to be extracted in /. Please make a backup of /boot in case you want to come back to the stock Volumio kernel. My kernels are named kernel7-SA.img and kernel-SA.img, you will need to edit the /boot/config.txt and add the line «kernel=kernel-SA.img» (Pi1) or«kernel=kernel7-SA.img» (Pi2) . All other options remain the same.

boot-SA.tgz: ovh.to/GndmzkA
modules-SA.tgz: ovh.to/YEgWS5b (download links are active for 30 days)

So, to summarize:

  • make yourself God (or at least su -)
  • do a backup of the /boot directory (*.bin, *.img, *.elf, *.dat, *.dtb, overlays/)
  • remove the old files
  • copy the tarball files in /run/shm
  • cd / ; tar xvzf /run/shm/modules-SA.tgz
  • cd / ; tar xvzf /run/shm/boot-SA.tgz
  • edit /boot/config.txt
  • reboot
  • test a 192kHZ 24 bits file
  • enjoy
  • report any success or failure

If this patched kernel is working on others systems, I will make a self-extracting archive that will simplify the update process (download it, run it, it will do the backup, test if it’s a Pi1 or Pi2 and change the config.txt).

Edit: the tarball files now contains both versions for Pi1 and Pi2

If you can tell the Volumio team exactly which patches/changes you have done to the kernel, they can decide if they can put those in the Volumio kernel of an upcoming version. Then it will work by default :smiley:

The kernel is from Cirrus Logic, it includes the driver for the Wolfson cards (kernel.org/pub/linux/kernel … 5.patch.gz). The RT patches applies without any warning or error.
Then I changed some lines in the sound/arm/bcm2835-pcm.c file (raspberrypi.org/forums/viewt … 1&p=486574) to push the 48kHz limit and support 32 bits coding: (around line 25)

.formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE, .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_192000, .rate_min = 8000, .rate_max = 192000,

That’s it.

The tarball files now contain both versions for Pi1 (A, A+, B, B+) or Pi2 (1GB memory).

Could you give the n00bs a step by step command(s) for the below?
Thanks in advance! :sunglasses:

Ok, here we go:

  • Copy the two downloaded files to the /run/shm directory:
scp *_SA.tgz root@volumio.local:/run/shm/

On Windows I think you can use the file explorer to reach the RAMPLAY directory (/run/shm is RAMPLAY).

  • Connect to the PI thru SSH with user=root and password=volumio. Use Putty on Windows or slogin on a Unix box (Linux/Mac)
    for example: “slogin root@IP_of_volumio” or “slogin root@volumio.local

  • Make a backup of the /boot directory:

cd / ; tar cvzf /root/boot-Volumio.tgz /boot
  • Make sure you have the files in the archive:
 tar tvzf /root/boot-Volumio.tgz 
  • Erase the old files on /boot:
 cd /boot ; rm -fr overlays *.dtb *.dat *.bin *.elf
  • Extract the files from boot-SA.tgz:
 cd / ; tar xvzf /run/shm/boot-SA.tgz
  • Edit the /boot/config.txt file with your preferred editor and insert this line:
    you are on a Pi1
kernel=kernel-SA.img

you are on a Pi2

kernel=kernel7-SA.img
  • Extract the files from modules-SA.tgz:
cd / ; tar xvzf /run/shm/modules-SA.tgz
  • At this point you should have in /boot:

bcm2709-rpi-2-b.dtb cmdline.txt fixup_cd.dat fixup_x.dat overlays/ start.elf bootcode.bin config.txt fixup.dat kernel7.img start_cd.elf start_x.elf

  • And in /lib/modules two directories:
3.18.9-rt5 3.18.9-rt5-v7
  • reboot you Pi:
reboot
  • Put some Hi-Res audio files (from 2l.no/hires) either in RAMPLAY or on a USB stick

  • Play them and watch on your AV Amplifier the status of the incoming HDMI sound stream.

This should work but I can not make any warranty. Use a freshly installed card if you want to try before applying the changes to you existing system.

I can confirm this works with Model B pi.
However, the kernel change disables the wi-fi drivers ( or so I think ) as the kernel now reads a different version followed by -rt.

I suspect you are using a Wifi device that needs a non standard driver (i.e. not provided by the stock kernel). Can you give me the name of you device please? I’ll see if I can find the option in the kernel configuration menu.
Yes the kernel has changed it’s name, this is normal as it is a higher version than the kernel used in Volumio 1.55. To compile it I used the same configuration as Volumio (except for new kernel options, I had to improvise :sunglasses: ). The -rt5 comes from the real-time patch I applied.

Adapter Name: TP-LINK TL-WN725N
Chipset: rtl8188eu
Driver/Firmware: raspberrypi.org/forums/viewt … &start=175 (MrEngman post)
Working with Volumio: Yes but have to install driver and reboot
Tested Versions and Platforms: Volumio 1.55
Comments: Native support would be awesome
Buying Link: amazon.com/TP-LINK-TL-WN725N … B008IFXQFU

Your links are broken, please fix them. :wink:
There is a rt8188eu driver (in /lib/modules/3.18.9-rt5/kernel/drivers/staging/rtl8188eu/) but I suspect the firmware is missing.
Can you check in /lib/firmware/ if you have two directories named RTL8192E and RTL8192SU please?

Apologies- here is the correct link for drivers.

raspberrypi.org/forums/viewt … 82#p462982

However, Not sure which one to use as I dont see drivers for the RT version. I have tried all
3.18.xx version with no luck. I cant see the hardware on the Pi

I had to untar the file and use ./install.sh function.

I will go home and check for those two modules you mentioned and revert.

Thanks!

The script /boot/install.sh erases the /lib/firmware directory, I think that this is your problem.
Here is a file with the firmware: ovh.to/GrWwdPu (to be extracted in /)
If this does not work, please put a copy of lsusb and /var/log/message when you plug in your key.
I received some new SD cards, I will test my new kernel on e fresh install of Volumio.

RTL8192SU is not to be found