Skip to content

rudenoise/minimalSound

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Making sounds in OpenBSD (and Linux)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published