-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
45 lines (34 loc) · 857 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package main
import (
"time"
"tinygo.org/x/drivers/tone"
uncertainty "github.com/awonak/UncertaintyGo"
)
const voices int = 3
var (
// An array of VCOs bound to CV Outputs.
vcos [voices]VCO
// Configurable variables for VCOs. Values set in configure.go.
scales [voices]Scale
roots [voices]tone.Note
)
func main() {
// Initialize a collection of VCOs bound to a CV Output and provide the
// configured scale and root note for each VCO.
for i, output := range []*uncertainty.Output{
uncertainty.Outputs[1],
uncertainty.Outputs[3],
uncertainty.Outputs[5],
} {
vcos[i] = NewVCO(output, scales[i], roots[i])
}
// Main program loop.
for {
voltage := uncertainty.ReadVoltage()
for _, vco := range vcos {
newNote := vco.NoteFromVoltage(float64(voltage))
vco.SendNote(newNote)
}
time.Sleep(2 * time.Millisecond)
}
}