Sine wave: Difference between revisions

Added Kotlin
No edit summary
(Added Kotlin)
Line 10:
 
 
 
=={{header|Kotlin}}==
Although it's possible to generate and play a sine wave tone using the Java Sound API, it's far easier to invoke the SoX utility's 'play' command which has this stuff built-in. The following was tested on Ubuntu 16.04.
<lang scala>// Version 1.2.41
 
fun main(args:Array<String>) {
val synthType = "sine"
val duration = "5"
val frequency = "440"
val pb = ProcessBuilder("play", "-n", "synth", duration, synthType, frequency)
pb.directory(null)
val proc = pb.start()
proc.waitFor()
}</lang>
 
=={{header|Perl 6}}==
9,487

edits