Thread overview
Amper audio player for GNU/Linux and X11
Mar 17, 2017
ketmar
Mar 17, 2017
Claude
Mar 17, 2017
ketmar
Mar 17, 2017
Guillaume Piolat
Mar 17, 2017
ketmar
Mar 19, 2017
ketmar
Mar 19, 2017
ketmar
Mar 20, 2017
Kagamin
Mar 20, 2017
Kagamin
Mar 24, 2017
ketmar
March 17, 2017
first, this is a weekend project to improve the underlying libraries, not a rival for existing audio/media players. yet it still may be of some interest.

Amper is a WinAMP2/XMMS insipred player, with WinAMP2/XMMS skin support. it is using X11 for UI and ALSA for sound output. some ineresting features of Amper are:

* pure D audio code, no external decoder libraries required (and no SDL);
* supports FLAC, Vorbis, Opus, MP3 playback;
* various hardware sampling rates with transparent resampling of source audio;
* multiband equalizer (the code is there, but UI is not ready yet);
* font rendering via FreeType, and font selecting via fontconfig;
* reading skins directly from zip archives via iv.vfs library;
* windowing via arsd.simpledisplay library;
* CLI control utility (using simple RPC library iv.ncrpc);
* notification area icon with hint window;
* sound playback is done in background thread (std.concurrency rox!);
* other k00l things i forget.

screenshot: [0]
Amper repo: [1]
IV repo (required to build Amper): [2]
ARSD repo (required to build Amper): [3]

if you have all the pathes set right, "rdmd amper.d" will start Amper.

as this is very WIP, you can't add files to playlist from UI yet (lol), so you have to pass 'em at command line, like this:
	rdmd amper.d mymusic.opus

WARNING! this is *WIP* code. many features are missing, and there are alot of bugs. yet Amper already can play music, and you can control it (to some extent) with a mouse. please, don't report bugs, as i probably already know about 'em (but tnx for trying).

i'm announcing the project at this early stage to show that D can be used for "serious programs", including decoding various complicated audio formats and DSP processing, and for writing "fancy" UIs.

please note that arsd.simpledisplay supports windows too, this is just my code that doesn't (but i'll eventually fix it, so Amper will be able to work on windows).

also please note that Amper is not a frontend to some existing audio decoding/playback library, all audio processing is done with D!

you will prolly need dmd 2.073.2 to build Amper (lower versions not tested).

skin credits: PipBoy2000 by Gerko.

p.s.: press ctrl+q to quit Amper. ;-)

p.p.s.: please, no reddit/lobsters/slashdot/etc.


[0] http://files.catbox.moe/y5wtak.png
[1] http://repo.or.cz/amper.git
[2] http://repo.or.cz/iv.d.git
[3] https://github.com/adamdruppe/arsd.git
March 17, 2017
On Friday, 17 March 2017 at 06:33:38 UTC, ketmar wrote:
> * pure D audio code, no external decoder libraries required (and no SDL);
> * supports FLAC, Vorbis, Opus, MP3 playback;
> * various hardware sampling rates with transparent resampling of source audio;
> * multiband equalizer (the code is there, but UI is not ready yet);

So you ported the FLAC, OPUS and MP3 decoder to D ?

That's huge. :)
March 17, 2017
Claude wrote:

> On Friday, 17 March 2017 at 06:33:38 UTC, ketmar wrote:
>> * pure D audio code, no external decoder libraries required (and no SDL);
>> * supports FLAC, Vorbis, Opus, MP3 playback;
>> * various hardware sampling rates with transparent resampling of source audio;
>> * multiband equalizer (the code is there, but UI is not ready yet);
>
> So you ported the FLAC, OPUS and MP3 decoder to D ?
>
> That's huge. :)

yep.

and two Vorbis decoders: stb_vorbis and Xyph's Tremor. Amper is using Tremor.

sure, i cheated a little: FLAC decoder is standalone dr_flac library, and Opus was ripped from ffmpeg (and the code is awful). but hey, it works! ;-)

mp3 decoder is originated in ffmpeg too. it was extracted to minimp3.c library by i-forgot-who, and then i ported it to D.
March 17, 2017
On Friday, 17 March 2017 at 06:33:38 UTC, ketmar wrote:
>
> i'm announcing the project at this early stage to show that D can be used for "serious programs", including decoding various complicated audio formats and DSP processing, and for writing "fancy" UIs.
>
> please note that arsd.simpledisplay supports windows too, this is just my code that doesn't (but i'll eventually fix it, so Amper will be able to work on windows).
>
> also please note that Amper is not a frontend to some existing audio decoding/playback library, all audio processing is done with D!
>

There is a crazy amount of work here. Congrats ketmar.
I've always been curious of what Amper looked like!
March 17, 2017
Guillaume Piolat wrote:

> There is a crazy amount of work here. Congrats ketmar.
> I've always been curious of what Amper looked like!

tnx. it will be even more impressive with equalizer UI finished! ;-)

there is no documentation on Amper console commands, but i can secretly tell you that user is able to change the skin without restarting Amper, for example. and do alot of other things (including equalizer control), which are impossible to do from UI yet. ;-)

tbh, Amper is not that complicated: it mostly using already written libraries. most of the Amper code was done in three days, 'cause i already have console audio player, and ALSA backend. Adam's excellent simpledisplay.d took care of low-level window manipulation tasks (and image loading).
March 19, 2017
ketmar wrote:

> if you have all the pathes set right, "rdmd amper.d" will start Amper.

quickfix: "rdmd -J. amper.d" ;-)
March 19, 2017
fixed some issues with 64bits compilation. tnx, NotSpooky!

yet it is not possible to build 64bit Amper due to dmd bug:

	Error: undefined identifier '__va_list_tag'

yes, exactly like that: no error line, nothing more. sorry, i don't have 64bit system, so i cannot do much with that. i tried some obvious workarounds, but without any success. 32bit ftw!
March 20, 2017
dmd -m64 -c amper.d
should work on 32-bit system too and compile to 64-bit code.
March 20, 2017
Also https://github.com/ldc-developers/druntime/blob/ldc/src/object.d#L48 may shed some light, but it sounds strange.
March 24, 2017
some updates:

* region.txt support for skins;
* reworked equalizer (smaller, faster);
* background scanner for playlist items (Amper won't hang when adding alot of files to playlist anymore);
* ID3v2 parser, so mp3s will have (some) metainfo too;
* fully configurable global hotkeys (including hotkeys for playback control);
* better on-the-fly skin reloading;
* pure X11 renderer, so Amper is using much less memory now.