192 kHz audio via HDMI - almost working as it should - Raspberry Pi Forums


hi
have been modifying /sound/arm/bcm2835-pcm.c file , compiled kernel , modules, , raspberry can play audio files 192/24.

part of original file manipulated:

code: select all

<linux/interrupt.h> #include <linux/slab.h>  #include "bcm2835.h"  /* 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, };
changed to:

code: select all

#include <linux/slab.h>  #include "bcm2835.h"  /* 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  | sndrv_pcm_fmtbit_s24_le | sndrv_pcm_fmtbit_s32_le, 	.rates = sndrv_pcm_rate_continuous | sndrv_pcm_rate_8000_192000, 	.rate_min = 8000, 	.rate_max = 1920000, 	.channels_min = 1, 	.channels_max = 2, 	.buffer_bytes_max = 256 * 1024, 	.period_bytes_min =   1 * 1024, 	.period_bytes_max = 256 * 1024, 	.periods_min = 1, 	.periods_max = 256, };
problem no matter file playing (44.1/16 or 192/24) played correct sample rate 44100 , 192000, played 32 bit depth. seems uses last format mentioned on .format line - use sndrv_pcm_fmtbit_s32_le

24 bit files 88.1 96 qnd 192 plays fine, whereas lower resolution files 16 bit @ 44.1 , 48 khz plays, distortion.

if change line to: .formats = sndrv_pcm_fmtbit_u8 | sndrv_pcm_fmtbit_s16_le plays @ 16 bit
if change line .formats = sndrv_pcm_fmtbit_u8 | sndrv_pcm_fmtbit_s24_le produces noise
if change line .formats = sndrv_pcm_fmtbit_u8 | sndrv_pcm_fmtbit_s24_3le produces noise

there seems couple of questions:
1. why use the last option in .formats line?
2. why can't use 24 bits format?
3. change 16 , 24 bit 32 bit when playing negatively affect sound quality. cant hear difference, equipment not good.

steen

here output when playing 44.1/16 flac file
cat /proc/asound/card0/pcm0p/sub0/hw_params
access: rw_interleaved
format: s32_le
subformat: std
channels: 2
rate: 44100 (44100/1)
period_size: 442
buffer_size: 1768

here when 192/24 bit flac played:
cat /proc/asound/card0/pcm0p/sub0/hw_params
access: rw_interleaved
format: s32_le
subformat: std
channels: 2
rate: 192000 (192000/1)
period_size: 1920
buffer_size: 7680

ps: i'm using microcore linux



raspberrypi



Comments

Popular posts from this blog

Thread: PKI Client 5.00 install (for eToken Pro)

ATmega2560-Arduino Pin Mapping

Crossfader Arduino Tutorial