mdsimon2
Major Contributor
I feel like this is not well documented (at least I couldn't find a quick reference to link to!) but use (# of channels)^2 - 1. So 1023 for 10 channels and 4095 for 12 channels.
Michael
Michael
It could be somehow related as the player uses wasapi code with channel mask support in the sample format.Hmm...I wonder if it is a difference between 7.1 home theater and 7.1 wide -> https://learn.microsoft.com/en-us/windows-hardware/drivers/audio/channel-mask?
The gadget reports its channels mask (configured via the c_chmask parameter) and channel count (number of set bits in the configuration chmask) via UAC2 protocol to the host.Unfortunely if i play a source with less than 8 channels, the sound comes out completely distorted (that didn't happen with chmask 63 or 255)
Did linux host have issues with the channel mask previously? It would be surprising, as channel configuration is only optional in linux alsa. Unlike in windows WASAPI where the client must configure a channel mask which is accepted by the driver (which is likely accepting the channel mask sent by the USB device/gadget).It appears that you nailed the problem Michael when i tested with the mask 0x63F and inputing 8 channels it works flawlessely atleast on linux (coreelec)
i still have to try chmask 1599
89.9 + shipping + vat?I just got an email newsletter from Hifiberry which talked about two versions of their DAC8x. A single-ended output HAT and a balanced output one. The balanced output needs a breakout cable DB25, Tascam style. But I can't see the StudioDAC8x listed on their website. Any idea? Is it WIP?
View attachment 437070
To be honest, with 8ch DAC ICs available, I personally prefer to build my own single IC board. I am a bit surprised hifiberry go 4 stereo route, they must get those chips really cheap.I wonder if anyone has tested 4 x PCM5102 modules available e.g. from Aliexpress?
View attachment 437112
IIUC they have the same PCM5102a as Hifiberry DAC8x, each has its own linear regulator. Example e.g. https://diyelectromusic.com/2024/05/27/rpi-5-quad-stereo-sound-with-pcm5102a/ + https://diyelectromusic.com/2024/06/09/minidexed-quad-dac-pcb-design/
If complete boards can be sold for 2.5USD at single quantities, the chip itself at larger quantites must be probably lower than the 1.3USD@1k+ from TI eshop.I am a bit surprised hifiberry go 4 stereo route, they must get those chips really cheap.
Ah, thanks a lot. I was looking at their Products menu, and it doesn't seem to have the StudioDAC: I missed clicking on "More..."89.9 + shipping + vat?
Hi,89.9 + shipping + vat?
I have no idea, sorryHi,
Would you know which chips are used in that hifiberry-studio-dac8x board?
That's because none of the chips use any control from RPi (via I2C or GPIO), and the driver is just configuration of the RPi I2S interface in master mode. The only custom part is a GPIO sensing the ADC hat which enables the capture alsa device automatically if the hat is installed. That's why a standalone ADC requires a different overlay which just tells the driver to disable the playback alsa device.The new studiodac8x is working with the old dtoverlay from the old dac8x.
@phofman your analysis is correct! However, I have tried to reuse the clock generated by the Toshiba tc358743 (i2s in) to drive the DAC8x (i2s out), but cannot get the device tree overlay to work (with the first 2 channels of the DAC8x). Any ideas?That's because none of the chips use any control from RPi (via I2C or GPIO), and the driver is just configuration of the RPi I2S interface in master mode. The only custom part is a GPIO sensing the ADC hat which enables the capture alsa device automatically if the hat is installed. That's why a standalone ADC requires a different overlay which just tells the driver to disable the playback alsa device.
Again lost opportunity for using the master clock from RPi instead of PLL from bclk.
lsmod | grep snd
snd_soc_simple_card 49152 0
snd_soc_simple_card_utils 49152 1 snd_soc_simple_card
snd_soc_hdmi_codec 49152 2
snd_soc_pcm5102a 49152 1
snd_soc_spdif_rx 49152 1
snd_soc_core 311296 7 snd_soc_spdif_rx,vc4,snd_soc_pcm5102a,snd_soc_hdmi_codec,designware_i2ssnd_soc_simple_card_utils,snd_soc_simple_card
snd_compress 49152 1 snd_soc_core
snd_pcm_dmaengine 49152 1 snd_soc_core
snd_aloop 49152 3
snd_pcm 147456 9 snd_soc_hdmi_codec,designware_i2s,snd_compress,snd_soc_simple_card_utils,snd_soc_core,snd_aloop,snd_pcm_dmaengine
snd_timer 65536 2 snd_aloop,snd_pcm
snd 131072 16 snd_soc_hdmi_codec,snd_timer,snd_compress,snd_soc_core,snd_aloop,snd_pcm
cat /proc/asound/cards
1 [tc358743 ]: simple-card - tc358743
tc358743
cat /proc/asound/pcm
01-00: 1f000a4000.i2s-pcm5102a-hifi pcm5102a-hifi-0 : 1f000a4000.i2s-pcm5102a-hifi pcm5102a-hifi-0 : playback 1
01-01: 1f000a4000.i2s-dir-hifi dir-hifi-1 : 1f000a4000.i2s-dir-hifi dir-hifi-1 : capture 1
speaker-test -c 2 -t wav -D hw:CARD=tc358743,DEV=0
speaker-test 1.2.8
Playback device is hw:CARD=tc358743,DEV=0
Stream parameters are 48000Hz, S16_LE, 2 channels
WAV file(s)
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 16 to 131072
Period size range from 8 to 65536
Using max buffer size 131072
Periods = 4
was set period_size = 32768
was set buffer_size = 131072
0 - Front Left
1 - Front Right
Time per period = 0.688782
0 - Front Left
1 - Front Right
Time per period = 2.732148
0 - Front Left
1 - Front Right
Time per period = 3.411847
0 - Front Left
1 - Front Right
//based on https://github.com/AkiyukiOkayasu/RaspberryPi_I2S_Slave/blob/master/genericstereoaudiocodec.dts
/dts-v1/;
/plugin/;
/ {
compatible = "brcm,bcm2712";
fragment@0 {
target = <&sound>;
__overlay__ {
compatible = "simple-audio-card";
simple-audio-card,name = "tc358743";
status="okay";
capture_link: simple-audio-card,dai-link@0 {
format = "i2s";
// Set RasPi to I2S slave
bitclock-master = <&r_codec_dai>;
frame-master = <&r_codec_dai>;
r_cpu_dai: cpu {
sound-dai = <&i2s_clk_consumer>;
// TDM slot configuration for stereo
dai-tdm-slot-num = <2>;
dai-tdm-slot-width = <32>;
};
r_codec_dai: codec {
sound-dai = <&capture_codec>;
};
};
playback_link: simple-audio-card,dai-link@1 {
format = "i2s";
// Set RasPi to I2S slave
bitclock-master = <&p_codec_dai>;
frame-master = <&p_codec_dai>;
p_cpu_dai: cpu {
sound-dai = <&i2s_clk_consumer>;
// TDM slot configuration for stereo
dai-tdm-slot-num = <2>;
dai-tdm-slot-width = <32>;
};
p_codec_dai: codec {
sound-dai = <&playback_codec>;
};
};
};
};
fragment@1 {
target-path = "/";
__overlay__ {
playback_codec: playback_codec {
#address-cells = <0>;
#size-cells = <0>;
#sound-dai-cells = <0>;
/*
"linux,spdif-dit" is used in generic I2S(transmitter) driver.
You can see details "linux,spdif-dit" by bellow command
modinfo snd_soc_spdif_tx
*/
//compatible = "linux,spdif-dit";
compatible = "ti,pcm5102a";
status = "okay";
};
capture_codec: capture_codec {
#address-cells = <0>;
#size-cells = <0>;
#sound-dai-cells = <0>;
/*
"linux,spdif-dir" is used in generic I2S(receiver) driver.
You can see details "linux,spdif-dir" by bellow command
modinfo snd_soc_spdif_rx
*/
compatible = "linux,spdif-dir";
status = "okay";
};
};
};
fragment@2 {
target = <&i2s_clk_consumer>;
__overlay__ {
#sound-dai-cells = <0>;
status = "okay";
};
};
};