RosettaCodeData/Task/Musical-scale/Scala/musical-scale.scala
2023-07-01 13:44:08 -04:00

12 lines
369 B
Scala

import net.java.dev.sna.SNA
object PlayMusicScale extends App with SNA {
snaLibrary = "Kernel32"
val Beep = SNA[Int, Int, Unit]
println("Please don't shoot the piano player, he's doing the best that he can!")
List(0, 2, 4, 5, 7, 9, 11, 12).
foreach(f => Beep((261.63 * math.pow(2, f / 12.0)).toInt, if (f == 12) 1000 else 500))
println("That's all")
}