The ALC1150 chip on this motherboard fails to mix all channels played at it a simple,
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.
channels 2 # make 6 or 5.1 channel
format S16_LE # S32_LE
rate 48000 # can also be 44100
card 1 # your card
device 0 # your device
subdevice 0 #important?
# Uncomment below if using 6 channel
# 2 2
# 3 3
# 4 4
# 5 5
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!
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,
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!