I solved it by using ffmpeg:
inputDeviceName := "Microphone (Realtek High Definition Audio)"
outputFile := "recording.mp3"
cmd := exec.Command("C:/Dev/ffmpeg/bin/ffmpeg.exe", "-f","dshow",
"-i","audio=" + inputDeviceName, outputFile)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
cmd.Stdin = os.Stdin
err := cmd.Start()
if err != nil {
println(err.Error())
}
err = cmd.Wait()
if err != nil {
println(err.Error())
}
It works quite well. Also killing the process using cmd.Process.Kil() stops
it successfully as the file will be written correctly.
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.