Jump to content

Sine wave: Difference between revisions

Added Go
(→‎{{header|Kotlin}}: Added version based on Java Sound API.)
(Added Go)
Line 10:
 
 
 
=={{header|Go}}==
{{works with|Ubuntu 16.04}}
<br>
Go lacks audio support in its standard library and, whilst there are third party packages that could be used, an easier approach is to invoke the SoX utility's 'play' command as was done in the second Kotlin example.
<lang go>package main
 
import (
"fmt"
"os/exec"
)
 
func main() {
synthType := "sine"
duration := "5"
frequency := "440"
cmd := exec.Command("play", "-n", "synth", duration, synthType, frequency)
err := cmd.Run()
if err != nil {
fmt.Println(err)
}
}</lang>
 
=={{header|Kotlin}}==
9,485

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.