ALC1150 on MSI z87-GD65 ALSA setup

The ALC1150 chip on this motherboard fails to mix all channels played at it a simple,

pcm.!default{
   type hw
   card 1
}

Works but fails in mixing and does not take in SND_PCM_FORMAT_FLOAT inputs(may be because it is writing directly to the card’s buffer which doesn’t support float inputs). The fix is to use dmix but a lot of the dmix setups I used didn’t work at all, all ended in “can’t open output” errors. Put the following in /etc/asound.conf and it’ll work like a charm, no need for sound servers! It is a modified version of the conf found in http://wiki.gentoo.org/wiki/ALSA.

pcm.dmixed {
        type asym
        playback.pcm {
                type dmix
                ipc_key 5678293
                ipc_perm 0660
                ipc_gid audio

                slave {
                        channels 2 # make 6 or 5.1 channel
                        pcm {
                                format S16_LE # S32_LE
                                rate 48000 # can also be 44100
                                type hw
                                card 1 # your card
                                device 0 # your device
                                subdevice 0 #important?
                        }

                        period_size 1024
                        buffer_size 8192
                }

                bindings {
                        0 0
                        1 1
# Uncomment below if using 6 channel
#                       2 2
#                       3 3
#                       4 4
#                       5 5
                }
        }
        capture.pcm "hw:0"
}

pcm.!default {
        type plug
        slave.pcm "dmixed"
}


Advertisements

Spectrum is back!

The spectrum code that I wrote a few months ago was updated with a fourier transform of the audio signal that makes plotting a proper spectrum(frequency vs. amplitude) possible. The code is here. The integration uses Simpson’s 1/3 rule. Below are a few references that I found useful, plus some trigonometry knowledge from school days came in handy!

http://www.stewartcalculus.com/data/CALCULUS%20Early%20Transcendentals/upfiles/FourierSeries5ET.pdf

http://en.wikipedia.org/wiki/Fourier_series

 

Spectrum

This is a sound spectrum using ALSA & OpenGL, it is not a *proper* spectrum because it does not have any FFT support it just shows data only ordered by time. Download the code and ‘make’ to compile. Following packages are needed,

freeglut3, libasound-dev

Dancing cubes

This is true ALSA multi-threaded capturing! This my first, ALSA and POSIX thread application. Happy that it works as intended(well I hope the cubes jumped much higher but hey..they jump!). Drawing is done on one thread and the capturing is done on another. Make sure you set the recording source for ALSA to your system out. It was easy for me because ALSA is managed(to an extent) by PulseAudio(don’t worry, the application does not include anything PulseAudio). pavucontrol makes it easier to set the source to the system’s output’s monitor.

Here’s how to compile this,

g++ -I. -o dance ogl.cc alsa.cc -DdDOUBLE -lGL -lGLU -lglut -lode -lasound

Please have the ALSA development package installed.
ALSA code was ripped out from Linux Journal’s web site, thank you!