Re: Recommendations for decoding mp3 files in go

1,865 views
Skip to first unread message

Mateusz Czapliński

unread,
Nov 28, 2012, 6:06:20 AM11/28/12
to golan...@googlegroups.com
On Tuesday, November 27, 2012 8:42:37 PM UTC+1, rhiro wrote:
Are there some quality libraries I can or should use or port?  I'd like a library so I can get individual samples and do things like Fourier analysis on sections of the track.  Thanks.

The only mp3-related lib already in Go that I know of, supports only reading ID3 data (i.e. metadata) from mp3 files AFAIK - http://go.pkgdoc.org/github.com/ascherkus/go-id3/src/id3

I have once tried to build/port a lib which would let me manipulate mp3s *without* actually decoding the mpeg frames contents (for splitting mp3s in lossless way), but I abandoned this work in unfinished state. I think I based the port on the https://github.com/mpatric/mp3agic Java library, which is nice in that it is MIT-licensed, and has decent test coverage, from what I remember. But it also does not support decoding of the frames, if I understand correctly, so probably not enough for you. That said, I could probably share the initial work I did, should you be interested (also on MIT licensing terms & for free). Please contact me privately in such case.

/Mateusz.

Mateusz Czapliński

unread,
Mar 10, 2013, 6:19:16 PM3/10/13
to golan...@googlegroups.com, matt....@gmail.com
Hi Matt,

I've dug up the code and put it at: https://github.com/akavel/splitsound
Please note, as I've written earlier, that this is totally WIP, unfinished, etc, etc, I can't guarantee it will help you with anything. But I sure hope it will :)
But if you're interested just in lossless mp3 splitting, I'd suggest to look directly at the pcutmp3 project, http://code.google.com/p/pcutmp3/ that I tried to port.

I've worked on this code somewhere in 2011, and from what it looks like, first I tried to port Java code from https://github.com/mpatric/mp3agic (MIT licensed), because it claims to "read low-level mpeg frame data", I believe. Then at some moment I switched to another approach and started trying to directly port http://code.google.com/p/pcutmp3/ ("New BSD license", from looking at that page, linked to "BSD 3-clause": http://opensource.org/licenses/BSD-3-Clause). Then I put the project on a shelf, I think my main problem was that I couldn't manage to verify for long time if the code is actually working OK, because I didn't manage to verify test coverage. So then I started trying to help revive the Golang's gocov tool, but that's totally another story, and not that much related. And now there seem to be some thirdparty coverage verification tools, e.g. https://github.com/axw/gocov, so the verification should be possible again.

Please note also, that the code is written for some pre-1.0 version of Go, so it will probably need some gofixing and maybe manual adjustments. Ah, and for the parts I authored I claim MIT license, but probably BSD for the pcutmp3 port if that would apply better.

Hope this will help you or anyone else anyone with anything. If you manage to build something usable on that, I'd be very grateful for info! I still have a hobby usecase where I might like to be able to use lossless mp3 splitting.
Good luck
/Mateusz.

On Tuesday, February 19, 2013 10:03:55 AM UTC+1, matt....@gmail.com wrote:
Hi Mateusz, 
I'm interested in the work you've done on splitting mp3s in a lossless way. Can you point me to any resources?

Thanks,
Matt

Tony Worm

unread,
Mar 11, 2013, 12:17:02 PM3/11/13
to golan...@googlegroups.com
I have an unfinished wav library that might be used as a reference:

you can see how I read the file with the 'encoding/binary' package

hope this helps

~Tony
Reply all
Reply to author
Forward
0 new messages