2004 to 2016 Mazda 3 Forum and Mazdaspeed 3 Forums banner

1 - 20 of 33 Posts

·
Audio-SQ-Maniac
Joined
·
119 Posts
Discussion Starter #1
I'm not a Linux programmer or anything. But was wondering if it would be doable to use USB Audio DACs with our headunit.
I tried with 3 different USB devices, while they turn ON, there is no sound comming out. Maybe it need some ALSA modification..? Kernel modules/usb audio drivers missing ? Any input on the subject would be apreciated, thanks.
 

·
Registered
Joined
·
124 Posts
i think it would be technically possible but i doubt anyone has done it yet. Do you feel that the DAC is the limiting factor in the audio?
 

·
Audio-SQ-Maniac
Joined
·
119 Posts
Discussion Starter #4
i think it would be technically possible but i doubt anyone has done it yet. Do you feel that the DAC is the limiting factor in the audio?
Yes it really is. An external DAC would have flat frequency response and better SNR, more dynamic and open soundstage.
I'm using a MiniDSP 6x8 sound processor and would like to use the digital input on it from the HU thru a USB to SPDIF adapter.
 

·
Registered
Joined
·
24 Posts
I don't use a USB DAC, but I do use a high-end DAP in my 3 via AUX and the difference in audio quality is astonishing. I have tried audio over BlueTooth as well as running audio off of the USB port (64GB USB Drive), and without question, audio through my DAP is significantly better, clearer, more dynamic, etc.

I think the problem with using an audio transport to the head unit via USB will only transport a digital signal to the car. Analogue over USB is a new thing supported by USB-C standards and is still very difficult to find in use. And I don't think the car supports Analogue over USB due to its older USB tech (possibly 2.0).

Your experiences may be different.

~Ex
 

·
Registered
Joined
·
372 Posts
I can't imagine how this would work without building an all-new OS image for the system. Your USB devices likely don't have any driver support, because the system most likely only has the drivers needed for the hardware that's in place; this isn't like a desktop Linux system where they include the drivers for every imaginable piece of hardware, and you can just plug it in and it "just works". We're lucky that USB-to-Ethernet adapters work; that was probably intentionally included for debugging purposes. Even if drivers were present, then you'd have to modify the audio software to direct the output to this new audio output device; most likely, the music application was written with the assumption that there'd only be one output, the built-in one that's standard in the hardware. So you'd need to build a new kernel with the USB audio driver included, and you'd have to either modify the audio application, or come up with some workaround to have it play on that USB device, like modifying the kernel devices so that the USB device appears as whatever the standard audio output is. And building a new kernel isn't easy because ARM systems like this frequently have closed-source drivers for some of the proprietary hardware they include.

Personally, I do think it'd be great if there were an effort to make a completely independent OS for these Mazda devices, instead of just trying to hack the software that's in place. It'd give us a lot of freedom to have these things run however and whatever we want (including Android Auto), and we could probably get much better performance too by ditching the crappy and horribly slow HTML/JS application system they use and switching to a C++/Qt UI system instead. But it'd be a large undertaking.
 

·
Audio-SQ-Maniac
Joined
·
119 Posts
Discussion Starter #7
I can't imagine how this would work without building an all-new OS image for the system. Your USB devices likely don't have any driver support, because the system most likely only has the drivers needed for the hardware that's in place; this isn't like a desktop Linux system where they include the drivers for every imaginable piece of hardware, and you can just plug it in and it "just works". We're lucky that USB-to-Ethernet adapters work; that was probably intentionally included for debugging purposes. Even if drivers were present, then you'd have to modify the audio software to direct the output to this new audio output device; most likely, the music application was written with the assumption that there'd only be one output, the built-in one that's standard in the hardware. So you'd need to build a new kernel with the USB audio driver included, and you'd have to either modify the audio application, or come up with some workaround to have it play on that USB device, like modifying the kernel devices so that the USB device appears as whatever the standard audio output is. And building a new kernel isn't easy because ARM systems like this frequently have closed-source drivers for some of the proprietary hardware they include.

Personally, I do think it'd be great if there were an effort to make a completely independent OS for these Mazda devices, instead of just trying to hack the software that's in place. It'd give us a lot of freedom to have these things run however and whatever we want (including Android Auto), and we could probably get much better performance too by ditching the crappy and horribly slow HTML/JS application system they use and switching to a C++/Qt UI system instead. But it'd be a large undertaking.
Our headunit use the ALSA sound architercure, if we already have the generic snd-usb-audio driver in the HU, it could be very easy to use USB sound output on our head units.
Many USB sound cards comply with the USB Audio Class standard and use the generic snd-usb-audio driver.
 

·
Audio-SQ-Maniac
Joined
·
119 Posts
Discussion Starter #8
There, I knew it ! Usb Audio driver is here already.
All we need ( I think) is switch default audio output in ALSA.
IE; from device ID 0,0 to 0,1
 

Attachments

·
Audio-SQ-Maniac
Joined
·
119 Posts
Discussion Starter #9 (Edited)
Hummm :) Entered command "aplay -l" to list available audio devices, USB audio device is detected !!

:)

Now working on how to switch default audio device. I'm a complete Linux newb btw lol.
 

Attachments

·
Audio-SQ-Maniac
Joined
·
119 Posts
Discussion Starter #10 (Edited)
I did it !!

IT WORKS !! :grin2::smile2:

All I had to do is edit asound.conf and set default PCM device to HW2 instead of 0.

Now if I play music from my USB drive in USB port 1 and plug my USB to SPDIF adapter in USB port 2, I get digital music output from my head unit. I'm so happy :grin2:
 

·
Audio-SQ-Maniac
Joined
·
119 Posts
Discussion Starter #12 (Edited)
good work. What are you sending the output to? An amp + speakers?
Spdif output goes into a DSP. (MiniDSP C-DSP 6x8 )
Then from the DSP to 4 amplifiers. I have a active 3 way frontstage, so 1 amp for the tweets, 1 amp for 3.5" midranges, 1 amp for 8" midbasses and 1 amp for the 15" sub.
Amps are Pioneer Premiers and Hivi's. Drivers are Peerlesss/Dayton/Wavecor
Still tuning the DSP but sounds awesome so far.
 

·
Registered
Joined
·
416 Posts
I did it !!

IT WORKS !! :grin2::smile2:

All I had to do is edit asound.conf and set default PCM device to HW2 instead of 0.

Now if I play music from my USB drive in USB port 1 and plug my USB to SPDIF adapter in USB port 2, I get digital music output from my head unit. I'm so happy :grin2:
Could you please add more details of how you do this?
 

·
Registered
Joined
·
3 Posts
Hey and good work. :)

A simple question - maybe you can help me. I hope it's okay to hijack your thread @DanB0yDro.
Can I play music from my S8 (Galaxy) via USB? I don't like the sound signature over bluetooth due to the lack of hi-res bluetooth standards of my 3.
When I plug in my S8 via USB the MZD only reads the files via MTP and play those. (But only a few to find here, the most of it are FLACs...)

Thanks in advance!
 

·
Registered
Joined
·
1 Posts
Hi Dan,
here are my list of devices and my asound.conf file. Please let me know how to edit my asound.conf to launch my USB audio output. Thk you!




###########################################
# Version: 1.0.3
###########################################
#
# Set the default SRC to speex fixed point
#
defaults.pcm.rate_converter "speexrate"
defaults.namehint.showall on

#
# This card (fileout) is handy to have for debugging audio. Use with
# caution, however, as it can eat up memory very quickly.
#
pcm.fileout{
type file
slave {
pcm "dmix_48000"
}
file "/tmp/debug.wav"
format wav
perm 0777
}

#
# The buffer_size is set to approx 120mS which is the maximum
# tolerable group delay for the Bluetooth HF far-side call audio
# to come out of the cabin speakers.
#
pcm.dmix_48000{
type dmix
ipc_key 5678293
ipc_key_add_uid yes
slave {
pcm "hw:0,0"
rate 48000
format S16_LE
buffer_size 6144
period_size 1536
}
}

#
# The buffer_size is set to approx 20mS which is the maximum
# tolerable group delay for the Bluetooth HF far-side call audio
# to come in the microphone.
#
pcm.dsnoop_48000{
type dsnoop
ipc_key 5778293
ipc_key_add_uid yes
slave {
pcm "hw:0,0"
rate 48000
format S16_LE
buffer_size 6144
period_size 1536
}
}

#
# The asymed plugin allows simultaneous playback and capture from
# different processes.
#
pcm.asymed {
type asym
playback.pcm "dmix_48000"
capture.pcm "dsnoop_48000"
}

#
# The asymed plugin allows simultaneous playback and capture from
# different processes.
#
pcm.tel_asymed {
type asym
playback.pcm "dmix_48000"
capture.pcm "mic_hw"
}

#
# The "mic" card is a generic input capture for the microphone
#
pcm.mic {
type plug
slave {
pcm "asymed"
}
}

#
# The "mic_hw" card is a generic input capture for the microphone
# without the dsnoop plugin
#
pcm.mic_hw {
type plug
slave {
pcm "hw:0,0"
rate 48000
format S16_LE
}
}

#
# Set a default playback and capture device. This card is not controlled
# by any part of audio management and will output audio regardless of
# any audio management configuration or setting.
#
pcm.!default {
type plug
slave {
pcm "asymed"
}
}

#
# Use this card to route mono or stereo input to the left channel only
# For stereo input, Left Output = 0.5 Left + 0.5 Right
# For mono input, Left Output = Left In
# For both, Right Output = 0
# Sample rate must be 48000
#
pcm.routeLeft {
type route
slave.pcm "asymed"
slave.channels 2
ttable.0.0 0.5
ttable.1.0 0.5
ttable.0.1 0.0
ttable.1.1 0.0
}

#
# Use this card to route mono or stereo input to the right channel only
# For stereo input, Right Output = 0.5 Left + 0.5 Right
# For mono input, Right Output = Left In
# For both, Left Output = 0
# Sample rate must be 48000
#
pcm.routeRight {
type route
slave.pcm "asymed"
slave.channels 2
ttable.0.1 0.5
ttable.1.1 0.5
ttable.0.0 0.0
ttable.1.0 0.0
}

########################################################################
#
# These ALSA cards and mixer elements are part of the Entertainment Mux
#
# PCM Card <----> ALSA Mixer Element
# entertainmentUsb <----> entertainmentMuxUsbIn
# entertainmentBtsa <----> entertainmentMuxBtsaIn
#
# Use this card (entertainmentMl) for mirror link media streams
# Any input sample rate accepted
pcm.entertainmentMl {
type plug
slave.pcm "entertainmentMlVol"
slave.channels 2
route_policy "duplicate"
}
pcm.entertainmentMlVol {
type softvol
slave.pcm "entertainmentLRCrossover"
control {
name "entertainmentMuxMlIn"
card 0
}
min_dB -100.0
max_dB 0.0
resolution 100
}
# Use this card (entertainmentUsb) for USB media streams
# Any input sample rate accepted
pcm.entertainmentUsb {
type plug
slave.pcm "entertainmentUsbVol"
slave.channels 2
route_policy "duplicate"
}
pcm.entertainmentUsbVol {
type softvol
slave.pcm "entertainmentLRCrossover"
control {
name "entertainmentMuxUsbIn"
card 0
}
min_dB -100.0
max_dB 0.0
resolution 100
}
# Use this card (entertainmentBtsa) for BDS streams
# Any input sample rate accepted
pcm.entertainmentBtsa {
type plug
slave.pcm "entertainmentBtsaVol"
slave.channels 2
route_policy "duplicate"
}
pcm.entertainmentBtsaVol {
type softvol
slave.pcm "entertainmentLRCrossover"
control {
name "entertainmentMuxBtsaIn"
card 0
}
min_dB -100.0
max_dB 0.0
resolution 100
}
pcm.entertainmentLRCrossover {
type route
slave.pcm "entertainmentNaviMute"
slave.channels 2
ttable.0.0 1.0
ttable.1.0 0.0
ttable.0.1 0.0
ttable.1.1 1.0
}
pcm.entertainmentNaviMute {
type softvol
slave.pcm "asymed"
control {
name "mediaNaviMute"
card 0
}
min_dB -100.0
max_dB 0.0
resolution 100
}
#
# End of Entertainment Mux
#
########################################################################

########################################################################
#
# These ALSA cards and mixer elements are part of the Information Mux
#
# PCM Card <----> ALSA Mixer Element
# informationGeneric <----> informationMuxGenericIn
# informationNavi <----> informationMuxNaviIn
# informationTts <----> informationMuxTtsIn
#
# Use this card (informationGeneric) for the generic prompts
# Any input sample rate accepted, mono or stereo OK
pcm.informationGeneric {
type plug
slave.pcm "informationGenericVol"
slave.channels 2
route_policy "duplicate"
}
pcm.informationGenericVol {
type softvol
slave.pcm "asymed"
control {
name "informationMuxGenericIn"
card 0
}
min_dB -100.0
max_dB 0.0
resolution 100
}
# Use this card (informationNavi) for navigation
# Any input sample rate accepted, mono or stereo OK
pcm.informationNavi {
type plug
slave.pcm "informationNaviVol"
slave.channels 2
route_policy "duplicate"
}
pcm.informationNaviVol {
type softvol
slave.pcm "routeLeft"
control {
name "informationMuxNaviIn"
card 0
}
min_dB -100.0
max_dB 0.0
resolution 100
}

# Use this card (informationNaviAlt) for alternate navigation
# Any input sample rate accepted, mono or stereo OK
pcm.informationNaviAlt { ##NaviAlt Testing
type plug
slave.pcm "informationNaviAltVol"
slave.channels 2
route_policy "duplicate"
}
pcm.informationNaviAltVol {
type softvol
slave.pcm "routeLeft"
control {
name "informationMuxNaviAltIn"
card 0
}
min_dB -100.0
max_dB 0.0
resolution 100
}

# Use this card (informationTts) for TTS prompts
# Any input sample rate accepted, mono or stereo OK
pcm.informationTts {
type plug
slave.pcm "informationTtsVol"
slave.channels 2
route_policy "duplicate"
}
pcm.informationTtsVol {
type softvol
slave.pcm "asymed"
control {
name "informationMuxTtsIn"
card 0
}
min_dB -100.0
max_dB 0.0
resolution 100
}
#
# End of Information Mux
#
#######################################################################

########################################################################
#
# These ALSA cards and mixer elements are part of the VR Mux
#
# PCM Card <----> ALSA Mixer Element
# vrGeneric <----> vrMuxGenericIn
#
# Use this card (vrAudioPlayer) for the audio player
# Any input sample rate accepted, mono or stereo OK
pcm.vrGeneric {
type plug
slave.pcm "vrGenericVol"
slave.channels 2
route_policy "duplicate"
}
pcm.vrGenericVol {
type softvol
slave.pcm "asymed"
control {
name "vrMuxGenericIn"
card 0
}
min_dB -100.0
max_dB 0.0
resolution 100
}
#
# End of VR Mux
#
#######################################################################

########################################################################
#
# These ALSA cards and mixer elements are part of the Telephony Mux
#
# PCM Card <----> ALSA Mixer Element
# telephonyGeneric <----> telephonyMuxGenericIn
# telephonyPrompt <----> telephonyMuxPromptIn
#
# Use this card (telephonyGeneric) for the telephony audio
# Any input sample rate accepted, mono or stereo OK
pcm.telephonyGeneric {
type plug
slave.pcm "telephonyGenericVol"
slave.channels 2
route_policy "duplicate"
}
pcm.telephonyGenericVol {
type softvol
slave.pcm "tel_asymed"
control {
name "telephonyMuxGenericIn"
card 0
}
min_dB -100.0
max_dB 0.0
resolution 100
}
# Use this card (telephonyPrompt) for the telephony prompts
# Any input sample rate accepted, mono or stereo OK
pcm.telephonyPrompt {
type plug
slave.pcm "telephonyPromptVol"
slave.channels 2
route_policy "duplicate"
}
pcm.telephonyPromptVol {
type softvol
slave.pcm "asymed"
control {
name "telephonyMuxPromptIn"
card 0
}
min_dB -100.0
max_dB 0.0
resolution 100
}
#
# End of Telephony Mux
#
#######################################################################

########################################################################
#
# These ALSA cards and mixer elements are part of the Alert Mux
#
# PCM Card <----> ALSA Mixer Element
# alertGeneric <----> alertGenericIn
#
# Use this card (alertGeneric) for generic alert audio
# Any input sample rate accepted, mono or stereo OK
pcm.alertGeneric {
type plug
slave.pcm "alertGenericVol"
slave.channels 2
route_policy "duplicate"
}
pcm.alertGenericVol {
type softvol
slave.pcm "asymed"
control {
name "alertGenericIn"
card 0
}
min_dB -100.0
max_dB 0.0
resolution 100
}
#
# End of Alert Mux
#
#######################################################################


ctl.mixer0{
type hw
card 0
}


#######################################################################
# BT SCO Audio Definitions
#######################################################################
pcm.bt_sco_dmix_8000 {
type dmix
ipc_key 1000
ipc_key_add_uid yes
slave {
pcm "hw:1,0"
rate 8000
format S16_LE
channels 1
buffer_size 512
period_size 256
}
}

pcm.bt_sco_dsnoop_8000 {
type dsnoop
ipc_key 2000
ipc_key_add_uid yes
slave {
pcm "hw:1,0"
rate 8000
format S16_LE
channels 1
buffer_size 512
period_size 256
}
}

pcm.bt_sco_dmix_16000 {
type dmix
ipc_key 3000
ipc_key_add_uid yes
slave {
pcm "hw:1,0"
rate 16000
format S16_LE
channels 1
buffer_size 512
period_size 256
}
}

pcm.bt_sco_dsnoop_16000 {
type dsnoop
ipc_key 4000
ipc_key_add_uid yes
slave {
pcm "hw:1,0"
rate 16000
format S16_LE
channels 1
buffer_size 512
period_size 256
}
}


#
# Since the two virtual Bluetooth devices below configure the same
# underlying hardware at different sample rates, they cannot be used
# concurrently. However, multiple processes can open either one or
# the other individually multiple times. In other words, if bluetoothSco
# is used by any process, other processes can also use it without
# restriction. However, once bluetoothSco is opened by a process,
# bluetoothScoWB cannot be opened by any other process until all processes
# utilizing bluetoothSco have finished.
#
pcm.bluetoothSco
{
type asym
playback.pcm "bt_sco_dmix_8000"
capture.pcm "bt_sco_dsnoop_8000"
}

pcm.bluetoothScoWB
{
type asym
playback.pcm "bt_sco_dmix_16000"
capture.pcm "bt_sco_dsnoop_16000"
}
 

Attachments

·
Registered
Joined
·
298 Posts
I did it !!

IT WORKS !! :grin2::smile2:

All I had to do is edit asound.conf and set default PCM device to HW2 instead of 0.

Now if I play music from my USB drive in USB port 1 and plug my USB to SPDIF adapter in USB port 2, I get digital music output from my head unit. I'm so happy :grin2:
Confirm that work!

Did you have problem, with CMedia chipset CMU support OK, but use other usb DAC (with chipset DAC (ESS ES9023) + Chipset USB (SA9023) + AD823X2), some time it halt the Music Player and not play any song in usb storage...?
 

·
Audio-SQ-Maniac
Joined
·
119 Posts
Discussion Starter #18
Confirm that work!

Did you have problem, with CMedia chipset CMU support OK, but use other usb DAC (with chipset DAC (ESS ES9023) + Chipset USB (SA9023) + AD823X2), some time it halt the Music Player and not play any song in usb storage...?
I have that problem from time to time, like after 100 songs or when I skip too many. Seems like a usb buffer problem
 

·
Registered
Joined
·
298 Posts
I have that problem from time to time, like after 100 songs or when I skip too many. Seems like a usb buffer problem
That is strange, when i pluged usb sound with CMedia 6206, the music player run very smoothly, never happend with any problem.

If i using usb DAC (ESS DA chipset, SA9023 USB chipset...) it often happend halt the music player when play song from usb..... don't know why?

May be usb buffer problem like you said, because my usb DAC support 24bit, 96Khz...
 
1 - 20 of 33 Posts
Top