www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - one-file pure D decoders for vorbis, flac and mp3

reply ketmar <ketmar ketmar.no-ip.org> writes:
i decided to make some noise about those, as people may thinking 
about doing the ports themselves, and effectively double (or 
triple, or...) the work.

so, here they are:
* Vorbis decoder[1] (stb_vorbis port), PD;
* FLAC decoder[2] (drflac port), PD;
* MP3 decoder[3] (minimp3 port), GPL.

they may or may not work for you, i don't know.


[1] http://repo.or.cz/iv.d.git/blob_plain/HEAD:/stb/vorbis.d
[2] http://repo.or.cz/iv.d.git/blob/HEAD:/drflac.d
[3] http://repo.or.cz/iv.d.git/blob/HEAD:/minimp3.d
Jun 29 2016
next sibling parent Guillaume Piolat <first.last gmail.com> writes:
On Wednesday, 29 June 2016 at 09:07:18 UTC, ketmar wrote:
 so, here they are:
 * Vorbis decoder[1] (stb_vorbis port), PD;
 * FLAC decoder[2] (drflac port), PD;
 * MP3 decoder[3] (minimp3 port), GPL.
That's pretty cool, thanks!
Jun 29 2016
prev sibling next sibling parent reply Martin Nowak <code dawg.eu> writes:
On Wednesday, 29 June 2016 at 09:07:18 UTC, ketmar wrote:
 i decided to make some noise about those, as people may 
 thinking about doing the ports themselves, and effectively 
 double (or triple, or...) the work.

 so, here they are:
 * Vorbis decoder[1] (stb_vorbis port), PD;
 * FLAC decoder[2] (drflac port), PD;
 * MP3 decoder[3] (minimp3 port), GPL.

 they may or may not work for you, i don't know.


 [1] http://repo.or.cz/iv.d.git/blob_plain/HEAD:/stb/vorbis.d
Nice, just recently use stb_vorbis.c. Any chance you'll turn this into a dub package?
Jun 29 2016
parent ketmar <ketmar ketmar.no-ip.org> writes:
On Wednesday, 29 June 2016 at 10:22:39 UTC, Martin Nowak wrote:
 Any chance you'll turn this into a dub package?
zero. i'm not using dub, and i hate dub polluting my source directory with it's files. but i don't mind if somebody will just fork/take the sources and create dub packages from that (or any other source from IV one is interested in). no need to ask my permissions or something.
Jun 29 2016
prev sibling next sibling parent Suliman <evermind live.ru> writes:
On Wednesday, 29 June 2016 at 09:07:18 UTC, ketmar wrote:
 i decided to make some noise about those, as people may 
 thinking about doing the ports themselves, and effectively 
 double (or triple, or...) the work.

 so, here they are:
 * Vorbis decoder[1] (stb_vorbis port), PD;
 * FLAC decoder[2] (drflac port), PD;
 * MP3 decoder[3] (minimp3 port), GPL.

 they may or may not work for you, i don't know.


 [1] http://repo.or.cz/iv.d.git/blob_plain/HEAD:/stb/vorbis.d
 [2] http://repo.or.cz/iv.d.git/blob/HEAD:/drflac.d
 [3] http://repo.or.cz/iv.d.git/blob/HEAD:/minimp3.d
What benefits from lib without phobos as dependens?
Jun 29 2016
prev sibling next sibling parent reply deadalnix <deadalnix gmail.com> writes:
On Wednesday, 29 June 2016 at 09:07:18 UTC, ketmar wrote:
 i decided to make some noise about those, as people may 
 thinking about doing the ports themselves, and effectively 
 double (or triple, or...) the work.

 so, here they are:
 * Vorbis decoder[1] (stb_vorbis port), PD;
 * FLAC decoder[2] (drflac port), PD;
 * MP3 decoder[3] (minimp3 port), GPL.

 they may or may not work for you, i don't know.


 [1] http://repo.or.cz/iv.d.git/blob_plain/HEAD:/stb/vorbis.d
 [2] http://repo.or.cz/iv.d.git/blob/HEAD:/drflac.d
 [3] http://repo.or.cz/iv.d.git/blob/HEAD:/minimp3.d
<3 I did vorbis by myself in the past in java, that format is UUURRRRGHH ! Good work.
Jun 29 2016
parent ketmar <ketmar ketmar.no-ip.org> writes:
On Wednesday, 29 June 2016 at 18:03:50 UTC, deadalnix wrote:
 I did vorbis by myself in the past in java, that format is 
 UUURRRRGHH !
lucky me, Sean did all the hard work. ;-)
 Good work.
thank you.
Jun 29 2016
prev sibling next sibling parent ketmar <ketmar ketmar.no-ip.org> writes:
vorbis decoder synced with current stb version (1.06 -> 1.09)
Jul 01 2016
prev sibling parent reply sam <savarga1 asu.edu> writes:
On Wednesday, 29 June 2016 at 09:07:18 UTC, ketmar wrote:
 i decided to make some noise about those, as people may 
 thinking about doing the ports themselves, and effectively 
 double (or triple, or...) the work.

 so, here they are:
 * Vorbis decoder[1] (stb_vorbis port), PD;
 * FLAC decoder[2] (drflac port), PD;
 * MP3 decoder[3] (minimp3 port), GPL.

 they may or may not work for you, i don't know.


 [1] http://repo.or.cz/iv.d.git/blob_plain/HEAD:/stb/vorbis.d
 [2] http://repo.or.cz/iv.d.git/blob/HEAD:/drflac.d
 [3] http://repo.or.cz/iv.d.git/blob/HEAD:/minimp3.d
This is great thanks! I was able to use minimp3 with SDL2's queueaudio function to play back almost all of the MP3s in my library. But I noticed that any MP3 with embedded album art is reported as invalid by the library. Here's a sample one: https://my.mixtape.moe/cjekko.mp3
Jul 03 2016
next sibling parent reply ketmar <ketmar ketmar.no-ip.org> writes:
On Monday, 4 July 2016 at 05:16:50 UTC, sam wrote:
 But I noticed that any MP3 with embedded album art is reported 
 as invalid by the library. Here's a sample one:

 https://my.mixtape.moe/cjekko.mp3
yep, mp3 detection is very basic. while it *tries* to do some work on it, you'd better not rely on detection results. for me, test player is happy playing 7-Zip archives as mp3s, for example. ;-) thank you for report. i may do something to improve detection, but to be honest, it is not a priority. such one-file libs are usually used in environments where you know what your files are (like game engines and such). also, please, be aware that you *may* crash libs with malformed input data. while the libs trying their best to not fail, this is, again, not a priority. but still, i'm using my test player to listen my huge vorbis/flac/mp3 collection, and it seems to work most of the time. p.s. i'll take a look at the sample anyway. minimp3 should skip ID3 tags at the start of the file, but i didn't really tested that code.
Jul 04 2016
parent reply Basile B. <b2.temp gmx.com> writes:
On Monday, 4 July 2016 at 07:33:19 UTC, ketmar wrote:
 for me, test player is happy playing 7-Zip archives as mp3s, 
 for example. ;-)
lol, does that sounds like if an hard-knee compressor limits the output ?
Jul 04 2016
parent ketmar <ketmar ketmar.no-ip.org> writes:
On Monday, 4 July 2016 at 08:18:29 UTC, Basile B. wrote:
 On Monday, 4 July 2016 at 07:33:19 UTC, ketmar wrote:
 for me, test player is happy playing 7-Zip archives as mp3s, 
 for example. ;-)
lol, does that sounds like if an hard-knee compressor limits the output ?
i'd say that it is like compressed industrial death metal.
Jul 04 2016
prev sibling parent reply ketmar <ketmar ketmar.no-ip.org> writes:
On Monday, 4 July 2016 at 05:16:50 UTC, sam wrote:
 https://my.mixtape.moe/cjekko.mp3
pushed small update, it works now. i accidentally forgot to include ID3v2 tag skiping at all, sorry! ;-) thank you for report, feel free to report even more! ;-)
Jul 04 2016
parent reply sam <savarga1 asu.edu> writes:
On Monday, 4 July 2016 at 08:01:06 UTC, ketmar wrote:
 On Monday, 4 July 2016 at 05:16:50 UTC, sam wrote:
 https://my.mixtape.moe/cjekko.mp3
pushed small update, it works now. i accidentally forgot to include ID3v2 tag skiping at all, sorry! ;-) thank you for report, feel free to report even more! ;-)
Wow that was a quick fix. Thanks! The only other problem I found was in order to compile your lib I had to add a cast in two places:
 sblimit = ((ptr - g.sb_hybrid.ptr) / 18) + 1;
turned to
 sblimit = cast(int)(((ptr - g.sb_hybrid.ptr) / 18) + 1);
and
 return nb_frames * 32 * uint16_t.sizeof * s.nb_channels;
turned to
 return cast(int)(nb_frames * 32 * uint16_t.sizeof * 
 s.nb_channels);
This was the only way I could get it to compile on DMD64 D Compiler v2.071.1 / LDC - the LLVM D compiler (1.0.0). There are a lot more errors in the gdc version mainly about pragma. But i'm not using GDC so not too concerned.
Jul 05 2016
parent ketmar <ketmar ketmar.no-ip.org> writes:
On Tuesday, 5 July 2016 at 09:04:38 UTC, sam wrote:
 This was the only way I could get it to compile on DMD64 D 
 Compiler v2.071.1 /
 LDC - the LLVM D compiler (1.0.0).
yep, i forgot to test it with 64-bit compiler, sorry. i fixed all three decoders now.
 There are a lot more errors in the gdc version mainly about 
 pragma.
yep, `pragma(inline, true);` is not supported by gdc yet. still, i added condition to all pragmas, so it should work with GDC now.
Jul 06 2016