@@ 25,6 25,7 @@ import (
"io"
"log"
"math"
+ "runtime"
"strings"
"time"
@@ 155,6 156,14 @@ const (
AS5 = 932.3
BF5 = AS5
B5 = 987.8
+ C6 = 1046.5
+ CS6 = 1108.7
+ DF6 = CS6
+ D6 = 1174.7
+ DS6 = 1244.5
+ EF6 = DS6
+ E6 = 1318.5
+ F6 = 1396.9
IdxBF4 = IdxAS4
IdxDF5 = IdxCS5
@@ 162,6 171,8 @@ const (
IdxGF5 = IdxFS5
IdxAF5 = IdxGS5
IdxBF5 = IdxAS5
+ IdxDF6 = IdxCS6
+ IdxEF6 = IdxDS6
)
const (
@@ 180,6 191,12 @@ const (
IdxA5
IdxAS5
IdxB5
+ IdxC6
+ IdxCS6
+ IdxD6
+ IdxDS6
+ IdxE6
+ IdxF6
IdxMax
)
@@ 199,6 216,12 @@ var freqs = []float64{
IdxA5: A5,
IdxAS5: AS5,
IdxB5: B5,
+ IdxC6: C6,
+ IdxCS6: CS6,
+ IdxD6: D6,
+ IdxDS6: DS6,
+ IdxE6: E6,
+ IdxF6: F6,
}
var notes = [][]int{
@@ 211,38 234,36 @@ var notes = [][]int{
IdxG5: {IdxG5},
IdxA5: {IdxA5},
IdxB5: {IdxB5},
+ IdxC6: {IdxC6},
+ IdxD6: {IdxD6},
}
-var halfStepUp = [][]int{
- IdxA4: {IdxA4 + 1},
- IdxB4: {IdxB4 + 1},
- IdxC5: {IdxC5 + 1},
- IdxD5: {IdxD5 + 1},
- IdxE5: {IdxE5 + 1},
- IdxF5: {IdxF5 + 1},
- IdxG5: {IdxG5 + 1},
- IdxA5: {IdxA5 + 1},
- IdxB5: {IdxB5 + 1},
-}
+var halfStepUp = func() [][]int {
+ steps := make([][]int, len(notes))
+ for i := range notes {
+ steps[i] = []int{i + 1}
+ }
+ return steps
+}()
var majChords = [][]int{
IdxA4: {IdxA4, IdxC5, IdxE5},
IdxB4: {IdxB4, IdxD5, IdxF5},
IdxC5: {IdxC5, IdxE5, IdxG5},
- IdxD5: {IdxD5, IdxF5, IdxA4},
- IdxE5: {IdxE5, IdxG5, IdxB4},
- IdxF5: {IdxF5, IdxA4, IdxC5},
- IdxG5: {IdxG5, IdxB4, IdxD5},
+ IdxD5: {IdxD5, IdxF5, IdxA5},
+ IdxE5: {IdxE5, IdxG5, IdxB5},
+ IdxF5: {IdxF5, IdxA5, IdxC6},
+ IdxG5: {IdxG5, IdxB5, IdxD6},
}
var majExtChords = [][]int{
IdxA4: {IdxA4, IdxC5, IdxE5, IdxG5},
- IdxB4: {IdxB4, IdxD5, IdxF5, IdxA4},
- IdxC5: {IdxC5, IdxE5, IdxG5, IdxB4},
- IdxD5: {IdxD5, IdxF5, IdxA4, IdxC5},
- IdxE5: {IdxE5, IdxG5, IdxB4, IdxD5},
- IdxF5: {IdxF5, IdxA4, IdxC5, IdxE5},
- IdxG5: {IdxG5, IdxB4, IdxD5, IdxF5},
+ IdxB4: {IdxB4, IdxD5, IdxF5, IdxA5},
+ IdxC5: {IdxC5, IdxE5, IdxG5, IdxB5},
+ IdxD5: {IdxD5, IdxF5, IdxA5, IdxC6},
+ IdxE5: {IdxE5, IdxG5, IdxB5, IdxD6},
+ IdxF5: {IdxF5, IdxA5, IdxC6, IdxE6},
+ IdxG5: {IdxG5, IdxB5, IdxD6, IdxF6},
}
var keyToIdx = map[string]int{
@@ 406,10 427,13 @@ func run(w *app.Window) error {
}
// This editor is needed for JS to properly deliver key events
// to us.
- med := material.Editor(th, &ed, "")
- med.Color = color.NRGBA{}
- ed.SetText("")
- med.Layout(gtx)
+ if runtime.GOOS == "js" {
+ med := material.Editor(th, &ed, "")
+ med.Color = color.NRGBA{}
+ ed.SetText("")
+ med.Layout(gtx)
+ ed.SetText("")
+ }
event.Frame(gtx.Ops)
}
case <-ready: