Audio Player Logic – Fyne Golang GUI tutorial 66

Audio Player Logic – Fyne Golang GUI tutorial 66

Source Code


package main
import (
    "os"
    "time"
    "github.com/faiface/beep/mp3"
    "github.com/faiface/beep/speaker"
)
func main() {
    // open file
    // underscore mean we are ignoring error
    f, _ := os.Open("hen.mp3")
    // decoding mp3 file
    // 3 outputs
    // stream , format and error
    streamer, format, _ := mp3.Decode(f)
    // activate speakers
    speaker.Init(format.SampleRate, format.SampleRate.N(time.Second/10))
    // play
    speaker.Play(streamer)
    // looping
    select {}
}

[easy_media_download url=”http://blogvali.com/wp-content/uploads/fyne-golang-downloads/main56.go” text=”Download Code” color=”red_darker”]

Fyne Golang GUI Course

Tony BB
 

TonyBB is a Coach , marketer, hypnotist and a founder of RSKVF Production who specializes in providing simple, affordable, and easy to use solutions for Life.

Click Here to Leave a Comment Below 0 comments

Leave a Reply: