Skip to content

mantyr/go-sound

 
 

Repository files navigation

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.

Available :

  • A Sound interface, with a BaseSound implementation that makes it simpler to write your own.
  • Sound Math (play notes together to make chords, or in serial to form a melody, ...)
  • Utilities for dealing with sounds (repeat sounds, generate from text, ...)
  • Implementations for various inputs (silence, sinusoidal wave, .wav file, ...)
  • Implementations for various outputs (play via pulse audio, draw to screen, .wav file, ...)
  • Realtime input (via MIDI) - with delay though.

Future plans:

  • Realtime input from microphone, more efficient from MIDI
  • Effects algorithms (digitial processing like delay, reverb, ...)
  • UI for modifying sounds and applying the math/effects.

Notes:

This library requires pulse audio installed to play the sounds, 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, moriyoshi and rakyll for their wavFile, pulseAudio and portmidi implementations respectively, used by go-sound.

About

Functional sound libraries for go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 98.3%
  • Python 1.7%