I made a change in the blogger configuration to ease the later work when blogging. It is possible that older entries are not correctly formatted.

Saturday 31 May 2008

Alsa library musings

I have taken a look at the alsa library tonight.

There seems to be a few fun things one can do. I started to use the small test program: pcm.c from the alsa-lib source directory.

I looked at the code. I have not changed anything yet. But the program is small but shows many aspects of how to interact with pcm streams and drivers.

So one thing I did was to use the small program to create a little scale playing: some thing like:

for a in 1 1.25 1.33 1.5 1.66 1.75 2 do \
    ./pcm -f `echo $a * 440|bc`& pid $! \
    & (sleep 1; kill $pid) \
done

Of course, the numbers 1 1.25 1.33 1.5 1.66 1.75 2 are approximation of some of the notes of a scala. I have been to lazy to look for the exact numbers.

This little test is really not much, and it certainly does make clear how to use the alsa function libraries, but it's fun. Nevertheless, after looking at the code, I have the feeling that I am going to have much fun in the future with playing with sound.

The possibility of combining both my musical theory musings together with my programming is quite a wonderful feeling.

Some of the ideas I have:

  • find the different instruments harmonic series and implement a small tool to be able to play some instrument
  • implement some composition mechanisms:
    • arpegios
    • Travis picking
    • combinations of instruments
    • combine with language ?