Notes on making sounds in OpenBSD (and Linux).
Build
# all
make
# square
make square
# saw
make saw
# static with musl
make static-musl
# clean
make clean
cat /dev/random | aucat -e u8 -c 0:0 -i -
_build/square 800 | aucat -e u8 -c 0:0 -i -
# or
make kshTestSquare
make kshDrawSquare
_build/square 800 | aplay -t raw -f u8 -c 1 -r 44100
# or
make linuxTestSquare
make linuxDrawSquare
_build/square 500 | mplayer -cache 1024 -quiet -rawaudio samplesize=1:channels=1:rate=14000 -demuxer rawaudio -
# or
make macTestSquare
make macDrawSquare
# make a gnuplot of a cycle
bash/makeVisualiser.bash square
bash/makeVisualiser.bash saw
bash/makeVisualiser.bash triangle
bash/makeVisualiser.bash sine
# _build/sine.gif
# or
make bashDraw
# build object file with debug symbols
cc -std=c99 -g -c square.c
# dissasemble
objdump -d -M intel square.o
sndio is kernel rather that user-space, so can't be heled up by other processes hogging processor cycles.
Less is more keep it simple!
Programming Interface via sio_open lib, sndio.h. Programming tips page.
Server Interface cia sndoid
# play white noise
cat > /dev/audio < /dev/random &
# stop
kill %1
# play amen from sream (comes out fast as can be prcessed?)
cat > /dev/audio < /home/rudenoise/Samples/amen.wav &
# to stream output would it work to write a program that chops off 4-bytes/1-word and streams them at 44000khz?
# stop kill
kill %1
cd ~/
mkdir Samples
cd Samples
curl http://www.junglebreaks.co.uk/breaks/fools_gold.wav > fools_gold.wav
aucat -i fools_gold.wav
# mixer controls
mixerclt
# record - ctrl-c to end
aucat -o recording.wav
# play recording
aucat -i recording.wav
# audio server
man sndiod
man sndio