You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
744 B
Go
38 lines
744 B
Go
3 years ago
|
package staros
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"testing"
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
const (
|
||
|
rat float64 = 1.059463094 //2^(1/12)
|
||
|
C float64 = 493.8833013 * rat
|
||
|
CU = C * rat * rat
|
||
|
D = CU * rat
|
||
|
DU = D * rat
|
||
|
E = DU * rat
|
||
|
F = E * rat
|
||
|
FU = F * rat
|
||
|
G = FU * rat
|
||
|
GU = G * rat
|
||
|
A = GU * rat
|
||
|
AU = A * rat
|
||
|
B = AU * rat
|
||
|
)
|
||
|
|
||
|
func beepMusic(qual ...float64) {
|
||
|
for _, v := range qual {
|
||
|
fmt.Println(v)
|
||
|
Beep(v, 700)
|
||
|
time.Sleep(time.Millisecond * 1000)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func Test_Music(t *testing.T) {
|
||
|
beepMusic(G, D, A, AU, A, G, F, D, DU, D, C, D, AU/2, C, G/2, C, D)
|
||
|
time.Sleep(time.Second * 3)
|
||
|
beepMusic(D,AU,A,G,A,D*2,F*2,G*2,F*2,D*2,D*2,C*2,D*2,DU*2,D*2,AU,A,E,G,FU)
|
||
|
}
|