Making sounds in OpenBSD (and Linux)
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bash
img
ksh
src
.gitignore
LICENSE
README.md
makefile

README.md

Minimal Sound

Notes on making sounds in OpenBSD (and Linux).

C Stuff

Build

# all
make
# square
make square
# saw
make saw
# static with musl
make static-musl
# clean
make clean

Listen

aucat/openBSD

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

aplay/Linux

_build/square 800 | aplay -t raw -f u8 -c 1 -r 44100
# or
make linuxTestSquare
make linuxDrawSquare

mplay/MacOS

_build/square 500 | mplayer -cache 1024 -quiet -rawaudio samplesize=1:channels=1:rate=14000 -demuxer rawaudio -
# or
make macTestSquare
make macDrawSquare

Visualising Wave Forms

# 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

sine`

ASM

# build object file with debug symbols
cc -std=c99 -g -c square.c
# dissasemble
objdump -d -M intel square.o

SNDIO Notes

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

Play a break

cd ~/
mkdir Samples
cd Samples
curl http://www.junglebreaks.co.uk/breaks/fools_gold.wav > fools_gold.wav
aucat -i fools_gold.wav

Built in stuff

# mixer controls
mixerclt
# record - ctrl-c to end
aucat -o recording.wav
# play recording
aucat -i recording.wav
# audio server
man sndiod
man  sndio

Links