Decode mp3 base on https://github.com/lieff/minimp3

minimp3

Decode mp3 base on https://github.com/lieff/minimp3

Build Status Coverage Status GoDoc

See examples in example directory. make and make test test the example.

package main

import (
	"io/ioutil"

	"github.com/hajimehoshi/oto"
	"github.com/tosone/minimp3"
)

func main() {
	var file, _ = ioutil.ReadFile("test.mp3")
	dec, data, _ := minimp3.DecodeFull(file)

	player, _ := oto.NewPlayer(dec.SampleRate, dec.Channels, 2, 1024)
	player.Write(data)
}
Owner
Tosone
Super brave boy.
Tosone
Similar Resources

Go-github-actions - `go-github-actions` is a package for developing GitHub Actions

go-github-actions go-github-actions is a package for developing GitHub Actions.

Feb 6, 2022

Decode / encode XML to/from map[string]interface{} (or JSON); extract values with dot-notation paths and wildcards. Replaces x2j and j2x packages.

mxj - to/from maps, XML and JSON Decode/encode XML to/from map[string]interface{} (or JSON) values, and extract/modify values from maps by key or key-

Dec 22, 2022

a package for decode form's values into struct in Go

formam A Go package to decode HTTP form and query parameters. The only requirement is Go 1.10 or later. Features Infinite nesting for maps, structs an

Nov 25, 2022

Decode embedded EXIF meta data from image files.

goexif Provides decoding of basic exif and tiff encoded data. Still in alpha - no guarantees. Suggestions and pull requests are welcome. Functionality

Dec 17, 2022

golibwireshark - Package use libwireshark library to decode pcap file and analyse dissection data.

golibwireshark Package golibwireshark use libwireshark library to decode pcap file and analyse dissection data. This package can only be used in OS li

Nov 26, 2022

Decode / encode XML to/from map[string]interface{} (or JSON); extract values with dot-notation paths and wildcards. Replaces x2j and j2x packages.

mxj - to/from maps, XML and JSON Decode/encode XML to/from map[string]interface{} (or JSON) values, and extract/modify values from maps by key or key-

Dec 29, 2022

Generate, encode, and decode UUIDs v1 with fast or cryptographic-quality random node identifier.

A Go package for generating and manipulating UUIDs Generate, encode, and decode UUIDs v1, as defined in RFC 4122, in Go. Project Status v1.1.0 Stable:

Sep 27, 2022

A Blurhash implementation in pure Go (Decode/Encode)

A Blurhash implementation in pure Go (Decode/Encode)

go-blurhash go-blurhash is a pure Go implementation of the BlurHash algorithm, which is used by Mastodon an other Fediverse software to implement a sw

Dec 27, 2022

Encode and decode Go (golang) struct types via protocol buffers.

protostructure protostructure is a Go library for encoding and decoding a struct type over the wire. This library is useful when you want to send arbi

Nov 15, 2022

library for working amorphous data (as when you decode json into an interface{})

Introduction Decoding json into an interface{} produces an hierarchical arrangement of four data types: float64, string are 'primative types' and form

Aug 1, 2022

Encode and Decode Message Length Indicators for TCP/IP socket based protocols

SimpleMLI A Message Length Indicator Encoder/Decoder Message Length Indicators (MLI) are commonly used in communications over raw TCP/IP sockets. This

Nov 24, 2022

Decode DTMF audio in go.

go-dtmf, the simplest way to decode DTMF audio in golang. This library provides two high level API to decode DTMF audio or byte slice. It uses the Goe

Nov 7, 2022

a little app to gzip+base64 encode and decode

GO=GZIP64 A little golang console utility that reads a file and either: 1) Encodes it - gzip compress followed by base64 encode writes

Oct 16, 2021

Encode and decode binary message and file formats in Go

Encode and Decode Binary Formats in Go This module wraps the package encoding/binary of the Go standard library and provides the missing Marshal() and

Dec 22, 2022

A tool coded by GO to decode cryptoed netease music files and qqmusic files

nqdumpgo A tool coded by GO to decode cryptoed netease music files and qqmusic files 一个使用 Go 语言编写的用于解密被网易云音乐或 QQ 音乐加密的文件的程序,Go 程序在拥有与 C++程序相近的效率的同时,大大

Dec 13, 2022

Sqlyog-password-decoder - Simple decode passwords from .sycs file (SQLyog export connections file)

Decode password: ./sqlyog-password-decoder -str password -action decode Encode p

Nov 21, 2021

go implementation of lightbend's HOCON configuration library https://github.com/lightbend/config

HOCON (Human-Optimized Config Object Notation) Configuration library for working with the Lightbend's HOCON format. HOCON is a human-friendly JSON sup

Dec 3, 2022

A Go library for an efficient implementation of a skip list: https://godoc.org/github.com/MauriceGit/skiplist

A Go library for an efficient implementation of a skip list: https://godoc.org/github.com/MauriceGit/skiplist

Fast Skiplist Implementation This Go-library implements a very fast and efficient Skiplist that can be used as direct substitute for a balanced tree o

Dec 30, 2022
Comments
  • how can I change another mp3 to play

    how can I change another mp3 to play

    
    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

  • can this library be used for playing any mp3 files?

    can this library be used for playing any mp3 files?

    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.

  • Provide links for awesome-go

    Provide links for awesome-go

    https://github.com/avelino/awesome-go/pull/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.

  • 🐛 Fix err condition return

    🐛 Fix err condition return

    To break a loop in select, break doesn't work.

    When the file meets EOF, which means in the last but one round, frameSize is equal to len(dec.data), if not set dec.data = dec.data[int(frameSize):], then it would be an endless loop.

A tool coded by GO to decode cryptoed netease music files and qqmusic files

nqdumpgo A tool coded by GO to decode cryptoed netease music files and qqmusic files 一个使用 Go 语言编写的用于解密被网易云音乐或 QQ 音乐加密的文件的程序,Go 程序在拥有与 C++程序相近的效率的同时,大大

Dec 13, 2022
Small tool to batch-update MP3-ID3v2-Tags (artist + title) of mp3-files based on filename

mp3fileInfo Enriches ID3-data (artist and title) based on the filename of all mp3-files in either a specific directory if given via command line argum

Dec 19, 2021
*DEPRECATED* Please use https://gopkg.in/redsync.v1 (https://github.com/go-redsync/redsync)

Redsync.go This package is being replaced with https://gopkg.in/redsync.v1. I will continue to maintain this package for a while so that its users do

Nov 20, 2022
Package githubv4 is a client library for accessing GitHub GraphQL API v4 (https://developer.github.com/v4/).

githubv4 Package githubv4 is a client library for accessing GitHub GraphQL API v4 (https://docs.github.com/en/graphql). If you're looking for a client

Dec 26, 2022
A command-line IDv3/MP3 tagger, written in Go.

gotagger A command-line IDv3/MP3 tagger, written in Go. Usage gotag uses $EDITOR (or vim, if unspecified) to edit IDv3 tags. gotag file.mp3 export EDI

Sep 4, 2021
golang function that download a video from youtube, and convert it to a mp3 file using ffmpeg

echedwnmp3 echedwnmp3 is a function that download a video from youtube, and convert it to a mp3 file using ffmpeg example package main import(echedwn

Dec 7, 2021
lmmp3 is a little golang library that download a video from youtube, and convert it to a mp3 file using ffmpeg

lmmp3 lmmp3 is a function that download a video from youtube, and convert it to a mp3 file using ffmpeg You need to have installed ffmpeg in your syst

Aug 12, 2022
Little golang app that allows you to download a youtube video as mp3, and optionally embed ID3 tags -Cover Art, Artist ...-

yt2mp3 Little golang app that allows you to download a youtube video as mp3, and optionally embed ID3 tags -Cover Art, Artist ...- Instructions At the

Dec 25, 2021
Rpfaudio - A small opinionated cli to create Readium Audiobooks from a directory containing mp3 files

rpfaudio A small opinionated cli to create Readium Audiobooks from a directory c

Feb 18, 2022
Turn .mp3 files in current directory to a podcast feed just one command.

dir2cast Turn .mp3 files in current directory to a podcast feed just one command. Then you can subscribe to it with your favorite podcast client, down

Jun 27, 2022