padster / go-sound

Functional sound libraries for go
GNU General Public License v3.0
118 stars 15 forks source link

go-sound

go-sound is a go library for dealing with sound waves. At the fundamental level, the library models each sound as a channel of [-1, 1] samples that represent the Compression Wave that comprises the sound.
To see it it action, check out demo.go or the examples provided by each file in the sounds package.

A tutorial explaining the basics behind sound wave modelling in code, and how it is implemented in go-sound, is available on my blog: http://padsterprogramming.blogspot.ch/2015/11/sounds-good-part-1.html

Features :

In progress:

Future plans:

Notes:

This library requires pulse audio installed to play the sounds, libflac for reading/writing flac files, and OpenGL 3.3 / GLFW 3.1 for rendering a soundwave to screen.

Some planned additions are included above, and include effects like those available in Audacity (e.g. rewriting Nyquist, LADSPA plugins in Go), or ones explained here or here. Additionally, some more complex instrument synthesizers could be added, and contributions are welcome.

The example piano .wav C note came from: http://freewavesamples.com/ensoniq-sq-1-dyno-keys-c4

Frequencies of notes are all obtained from: http://www.phy.mtu.edu/~suits/notefreqs.html

For MIDI input, a number of things are required for portmidi:

Overall quite a pain and there's still a noticeable delay in the MIDI input, patches to reduce that are welcome!

Credit to cryptix, cocoonlife, moriyoshi and rakyll for their wavFile, pulseAudio and portmidi implementations respectively, used by go-sound.