Skip to content
/ sounds Public

Go language generation, manipulation, storage and streaming of sounds. Uses Signals package;

Notifications You must be signed in to change notification settings

splace/sounds

Repository files navigation

sounds

Go language generation and manipulation of sounds, built on github.com/splace/signals package.

Status: (Beta :- stabilising API)

Overview/docs: GoDoc uses Signals: GoDoc

Installation:

 go get github.com/splace/sounds   

Example: play a note.(uses linux "aplay" command.)

package main

import (
	"os/exec"
	"time"
)

import . "github.com/splace/sounds"

func play(s Sound) {
	cmd := exec.Command("aplay","--rate=44100","--format=S16_LE")
	in,err:=cmd.StdinPipe()
	if err != nil {
		panic(err)
	}
	err = cmd.Start()
	if err != nil {
		panic(err)
	}
	Encode(in, 2, 44100, s)
	in.Close()
	err = cmd.Wait()
	if err != nil {
		panic(err)
	}
}

func main(){
	play(NewSound(NewTone(time.Second/440, 1),time.Second/3))
}

Example: A tune with sampled notes.

twinkle twinkle little star

About

Go language generation, manipulation, storage and streaming of sounds. Uses Signals package;

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages