Beispiel #1
0
func main() {
	const buffers = 1
	if err := al.OpenDevice(buffers); err != nil {
		log.Fatal(err)
	}
	al.Start()

	sine := snd.Sine()
	// mod is a modulator; try replacing the nil argument to
	// the oscillator with this.
	// mod := snd.NewOscil(sine, 200, nil)
	osc := snd.NewOscil(sine, 440, nil) // oscillator
	al.AddSource(osc)

	for range time.Tick(time.Second) {
		log.Printf("underruns=%-4v buflen=%-4v tickavg=%-12s drift=%s\n",
			al.Underruns(), al.BufLen(), al.TickAverge(), al.DriftApprox())
	}
}
Beispiel #2
0
package main

import (
	"math"
	"time"

	"dasa.cc/snd"
	"dasa.cc/snd/al"
)

var (
	sawtooth = snd.Sawtooth()
	sawsine  = snd.SawtoothSynthesis(8)
	square   = snd.Square()
	sqsine   = snd.SquareSynthesis(49)
	sine     = snd.Sine()
	triangle = snd.Triangle()
	notes    = snd.EqualTempermant(12, 440, 48)

	keys       [12]Key
	reverb     snd.Sound
	metronome  snd.Sound
	loop       *snd.Loop
	lowpass    *snd.LowPass
	keymix     *snd.Mixer
	keygain    *snd.Gain
	master     *snd.Mixer
	mastergain *snd.Gain

	bpm     = snd.BPM(80)
	loopdur = snd.Dtof(bpm.Dur(), snd.DefaultSampleRate) * 8 //nframes