What is the actual problem you are trying to solve?
That's a very good question!
![Grin ;D](https://www.eevblog.com/forum/Smileys/default/grin.gif)
The goal drifted from using a sound card as an audio spectrum analyzer --> audio software and OS tools in Ubuntu and FreeBSD --> sound system architectures for the two OSs --> various config files for various components --> particular bugs in the driver for Creative Sound Core3D chipset CA0132 --> experimental patches for CA0132 driver --> how the "Intel HDA" module interacts with the CA0132 driver --> understanding CA0132 chipset architecture (e.g. CA0132 has a DSP blob, apparently an embedded 8051 core too, to control the DSP hardware, etc.) --> how to send parameters to a driver module and what parameters are supported --> how to recompile the Ubuntu kernel or, in this particular situation just the CA0132 driver module. To me that was a very interesting learning journey, thank you all for guidance!
While at it, would have been nice to fix some minor inconveniences bugs for the onboard CA0132 like:
- once in a while, only at power on (either cold start or wake from a suspend to RAM), it will be no audio out
- can not switch to headphones, HP output does not work
- can only work in stereo mode, while the chipset is 5.1
- audio connectors are swapped, the 3.5mm jacks does not match the motherboard manual
- weird Mic2 instead of Line-In (didn't check yet if this Mic2-In can also turn on mic phantom power, that would be wrong to do for a line-in)
You are correct about the Quirk values in drivers, vs loading the kernel modules with parameters. After more reading, it turns out that 'snd-hda-intel' module (common for any HDA compatible card, including for CA0132) can have a parameter 'model=generic', which can be set inside '/etc/modprobe.d/alsa-base.conf' by adding 'options snd-hda-intel model=generic'. This will tell to the CA0132 module 'snd_hda_codec_ca0132' to load one of the "Quirk" remapings, depending on each CA0132 PCI ID vendor:model.
Just for the docs, the motherboard is Asrock model "Z97 Fatal1ty Professional", and the CA0132 id is 1102:0011, which is different from any of the values currently present in the CA0132 patch. However, it feels like the work from similar chips with different IDs should be applicable to the one from the AsRock motherboard. For the docs, this is the most promising thread for patching the CA0132 (especially the Connor McAdams' posts), and I would like to try that as an exercise of compiling patches and fiddling with driver modules in Linux:
https://bugzilla.kernel.org/show_bug.cgi?id=109191#c66https://kernelnewbies.org/KernelBuild
Back to the global goal, of using the sound card as an audio spectrum analyzer, in order to measure the distortions coming from an external Peltz oscillator, in Linux I've used 'baudline' + 'arecord'. The 'arecord' is needed because the free version of 'baudline' was made for OSS (but 'baudline' can record from 'stdin', too
![ThumbsUp :-+](https://www.eevblog.com/forum/Smileys/default/icon_smile_thumbsup.gif)
).
To use 'baudline' in Linux (with ALSA), first identify the existing ALSA soundcards/inputs using 'arecord -l'. Then, start 'arecord' and pipe the audio datastream from 'arecord' to stdin, and then read the stdin datastream with 'baudline', like this:
cd baudline_1.08_linux_x86_64
# start the alsamixer, select the soundcard, enable the sound source and set the recording volume
alsamixer
# find hw:<card>,<device> numbers
arecord -l
# mine was
# card 1: PCH [HDA Intel PCH], device 2: CA0132 Analog Mic-In2 [CA0132 Analog Mic-In2]
# Subdevices: 1/1
# Subdevice #0: subdevice #0
# which means "hw:1,2" in the next command, 10000 means 10ms buffer/latency, 96kHz sampling rate, 2 channels
arecord -D hw:1,2 -B 10000 -r 96000 -f S16_LE -c 2 | ./baudline -stdin -record -channels 2 -format le16
The signal from my Peltz-Wyatt oscillator when powered from a single 1.2V battery measures about -29.7dB (3.39%) distortions, so THD > 0.00001%, audiophils:
![Scared :scared:](https://www.eevblog.com/forum/Smileys/default/scared.gif)
.
![](https://www.eevblog.com/forum/programming/audio-in-linux/?action=dlattach;attach=1538944;image)
Spectrum and distortions with 'arecord' + 'baudline':
![](https://www.eevblog.com/forum/programming/audio-in-linux/?action=dlattach;attach=1542925;image)
The hill in the backround noise floor for frequencies above 25kHz is internal noise from the soundcard. I don't know if the displayed THD includes the 50Hz hum and the noise, too, or only the fundamental and its harmonics.
![DMM :-DMM](https://www.eevblog.com/forum/Smileys/default/smiliey_dmm.gif)