tosone / minimp3 Goto Github PK
View Code? Open in Web Editor NEWDecode mp3 base on https://github.com/lieff/minimp3
License: MIT License
Decode mp3 base on https://github.com/lieff/minimp3
License: MIT License
package main
import (
"io/ioutil"
"time"
"github.com/hajimehoshi/oto"
"github.com/tosone/minimp3"
"log"
)
func players() error {
file, _ := ioutil.ReadFile("assets/mp3/test.mp3")
dec, data, _ := minimp3.DecodeFull(file)
player, _ := oto.NewPlayer(dec.SampleRate, dec.Channels, 2, 4000)
player.Write(data)
dec.Close()
player.Close()
return nil
}
func main() {
for i := 0; i < 3; i++ {
if err := players(); err != nil {
log.Fatal(err)
}
time.Sleep(time.Second * 5)
}
}
when I run above code it got a error:
panic: oto: NewContext can be called only once
how can I solve this error, and I want to chenge another mp3 to play , is seems I cant close NewContext then create a new player
my test.mp3 is 2 second
Sorry this is not really an issue, but just a question.
Does anyone know a native mp3 encoding lib for Go ?
avelino/awesome-go#1785
https://github.com/avelino/awesome-go/blob/master/.github/PULL_REQUEST_TEMPLATE.md
awesome-go requires godoc.org, goreportcard.com and coverage links to be listed.
I test this library with a downloaded mp3 file, it cannot play music clearly. But it can play your test.mp3, so I want to ask, does this library can be used for playing any mp3 file?
I checked the downloaded file, its rate is 44100, channel is 2.
Is it possible to get the duration ?
Do you support resizing sound?
Do you support adjusting playback time?
Don't you get an EOF error when caling decoder.Read() faster or with larger buffer than the speed of decoding itself - even if you haven't actually decoded the whole file ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.