◊ A tool for creating a sequence of ascii text files from given video using FFMPEG ◊
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
506 B

package audio
import (
"os"
"time"
"github.com/faiface/beep"
"github.com/faiface/beep/mp3"
"github.com/faiface/beep/speaker"
)
func PlayAudio(audioPath string) {
f, err := os.Open(audioPath)
if err != nil {
panic(err)
}
streamer, format, err := mp3.Decode(f)
defer streamer.Close()
speaker.Init(format.SampleRate, format.SampleRate.N(time.Second/10))
done := make(chan bool)
speaker.Play(beep.Seq(streamer, beep.Callback(func() {
done <- true
})))
<-done
}