Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
What is a music player? (github.com/albertz)
123 points by phreeza on Nov 12, 2012 | hide | past | favorite | 68 comments


Disclaimer: VLC main developer here.

I would love to tell you that VLC (or mplayer or xine or whatever-video-engine) is great to play music, but it is not. And yet, a lot of person use VLC to play music, to our own astonishment.

Therefore, we are working to make the audio part getting better, and we are working hard on that part (next hackdays topic, in December, is only the audio core).

However, except gapless and a correct media library (which we have but is not activated), all the things listed from this article are done in VLC, including resampling, equalizer, loudness, fingerprinting, software amplification... VLC has also a compressor, a parametric equalizer, a spatializer, pitch correction, scaletempo and many downmixers / headphones enhancers. We have also Karaoke support...

Moreover, libswresample is far from being the best quality ever.

So, why don't we have gapless in VLC? Well, because to get correct gapless (not the 50ms you can have with VLC) or cross-fading, you need to have 2 inputs at the same time. And this needs quite a bit of work, notably to be sure to detect correctly EOF.


Hey, the dev of this project here,

Thanks a lot for the feedback! I didn't knew that VLC has advanced so much in such functionality like loudness normalization and dynamic range compression. How does it analyze the loudness? Does it also use the ReplayGain spec? What about album-loudness?

It sounds like besides gapless playback and a database, VLC already has everything what a music player needs to have - or what you need that VLC becomes great to play music.

Or is anything missing on the list?

For me, the intelligent automatic queue is, besides the audio quality, a very important element (because it is the way I listen to my music).


Wow, I'll have to check your music-player out. Ever since I left windows, I haven't found any music player that quite does things how I want like winamp did.


Sorry for derailing the discussion, but what do you think of foobar3000? Ideally, VLC guys would answer to this question too. :)


I assume you mean foobar2000?

http://www.foobar2000.org/


Foobar2000 is proprietary and Windows-only (thus I cannot even try it).


Wow, how is it even monetized? And if not, why bother with proprietary?


No nice visualizations, as my son discoverd . :-(


First thing first: thank you very much. VLC is a fine piece of software that has made me happy for so many hours!

A data point about your surprise: I don't like database-like interfaces, just a plain list of songs, taking the minimum screen real state. The only really useful extra feature I like is loudness adjustment per song, and I prefer to set it manually.


> Well, because to get correct gapless or cross-fading, you need to have 2 inputs at the same time.

But, but VLC has no problem with multiple inputs.

http://wiki.videolan.org/Mosaic


Good catch. :) (of course, this is HN)

Mosaic is using VLM, but VLC's main playlist does not use it :)


I hope this isn't too OT. I used VLC to listen to several audio streams. I wish the built-in bookmarking was a bit better -- just enough to keep track of these URL's without jumping through hoops.

For local media, it would be nice if VLC would (optionally?) remember where one stopped playback, so that one could resume there without having to hunt around or to manually note the location/time.

I don't want to detract from core development (i.e. thank goodness I can view/listen to this stuff reliably and without tackling a plug-in hell). Just one user's anecdote.

P.S. I'll add that initiating recording of a stream that is already playing could be a bit easier. (On Windows, I've found I have to start a second instance of VLC and start recording without first playing the stream.) And, my sincere apology if I've described features that are available but that I've missed or missed the controls for.


> And yet, a lot of person use VLC to play music, to our own astonishment.

Because it runs on every OS most people know about and it plays every file most people are able to feed it.

Also, people have been willing to put up with RealPlayer, which is even worse for playing music.


> Also, people have been willing to put up with RealPlayer, which is even worse for playing music.

The number of people using RealPlayer is incredible, indeed.


VLC gives you the option of increasing the volume upto 400 %. But its often the case that this damages the speakers (especially the tiny inbuilt speakers on some of the cheaper laptops). I dont know how this is but I've plenty of anecdotal evidence that this happens. So I think you guys should caution the users against using it too much .


This is, of course, nonsense.

This is software amplification, so at worse, you clip everything. It's like saying that you should not listen to metal or experimental music because it is more saturated and might destroy your speakers. The software cannot make the difference.

VLC only uses the normal system APIs, so at worse, it will have a fully saturated output, that could be caused by the input OR the software amplification. If the laptop speakers cannot hold what the audio card is outputting, the issue is in the drivers.


That is not necessarily nonsense, but it depends on the speakers.

Digital clipping is one of the worst things you can do to speakers with a separate high frequency driver - it radically changes the power distribution due to the additional frequencies generated by square wave clipping[1]. This can overload and burn out the driver (depending on its design). Even expensive speakers may not have sufficient protection, or the "conservative" ratings may be not adequate.

I don't know if any laptops come with 2-way (or better) speakers, but lots of computers are connected to such.

[1] http://www.st-andrews.ac.uk/~www_pa/Scots_Guide/audio/clippi...


Did you read that reference all the way through? It's not at all convincing, IMHO. In nearly all of his experiments you need a gain factor of at least 5-10x before the high frequency range starts to damage the tweeter. He starts with analysing artificial waveforms, and the effect actually lessens as he tries it on more real-world examples. My conclusion: don't play HIA's UFO Detection System too loud? Which no sane person would do, anyway.

That aside, I've always perceived some type of limiter-effect whenever I turn up VLC over 100%. Which is not clipping. I never really considered whether this limiting happened in VLC, the OS or my soundcard. It's a small laptop so no fancy soundcards either.

So, checking VLC's preferences, under Advanced>Audio there's an option called "peak protection", which is on by default. Sounds like something that does a type of limiting?

But I may be wrong, I just checked, (apparently my VLC only seems to go up to 200% by default?), but with a sufficiently loud sample, I could definitely hear clipping, instead of limiting.

But, just like your reference says, at the moment you've applied 5x clipping that's pretty extreme. You might as well have a 1-bit waveform at that point because it'll be either up or down. It won't sound like the original any more, at all. If you play that to your expensive speakers at high power, and think it's a good idea to do that for a while, then I really don't think it's VLC's job to protect you from yourself. The only possible excuse might be someone that has a long playlist of quiet sounds, amped up to 400%, leaves and isn't there to correct it when a forgotten loud track starts up. But that scenario is somewhat far-fetched, somewhat stupid and at 400%+clipping still not certain to damage the tweeters much more than loud sounds might do in general, clipped or not.


And yet, I do not see how a media player can do anything about it.


Since I know nothing about this subject I'll take your word for it . Well I'm from India and the guy who sold me the laptop told me - "Dont use VLC" . Since then I've heard this "wisdom" from some others as well . I would like to respectfully add that I too have faced this and I dont know the cause . You can try googling "VLC damages speaker" and you'll see hundreds of threads turn up . Eg: http://www.indiastudychannel.com/experts/27429-Does-VLC-play...

And another one: http://superuser.com/questions/337265/vlc-sound-boosting

From what i gather on the above thread it turns out that some sound drivers are not that smart and so it ends up damaging the speakers and its not VLCs fault .


> You can try googling "VLC damages speaker" and you'll see hundreds of threads turn up.

Now try "work from home" or "moon landing hoax".


Yes, we are trying to fix this, by proving it correctly, but cheap people like HP are trying to screw users with that.


Feeding DC (when clipping) to a speaker is never healthy for it. But clipping has many sources. The internal amplifier being one of them.


Interesting emphasis on intelligent DJ mode. I have been using Groove Basin[1] as my music player for about a year now and have loved the crap out of its DJ mode ("Dynamic Mode").

The way we made it work is that every song goes into a list sorted by date last queued, and then we use a parabolic curve which means that any song could theoretically be queued next, but songs that have not been queued the longest have the greatest chance of being queued next.

This is something that is hard to test without trying it out for a long period of time, but I think after one year it is safe to say that it's a pretty damn good algorithm.

The added benefit of using "last queued date" instead of "last played date" is that if Dynamic Mode queues a song, and you skip it because you don't want to hear it, it still moves to the end of the list and becomes less likely to be queued again.

[1]: https://github.com/superjoe30/groovebasin


Talking about the screenshots found in https://github.com/albertz/music-player

* A music player should show the current song info like title or artist. There is no way to know which is the current song. * A music player should have a clear interface. * Where is the volume? * What is fillUpTo and why it doesn't have spaces? * What is addSome and why it doesn't have spaces? * Why a clear button? * Why the format, time, and more things is being show in the interface. I am a user. Don't worry about that details. * Why input boxes to show the time and current song. Can I change that? * ...

Sorry for not testing but since more than 3 years I was using spotify so I just remove all my files.


Oh, it seems that many things aren't that obvious as I thought they would be... Maybe they become a bit more obvious when you use the player, though.

To answer some of the questions: The current song is always the blue entry. All the grey entries above it are the recently played songs. Everything below is what comes next. In addition, the artist and title of the current song is displayed at the head. Those aren't input boxes (although they might look as such). The clear button clears the queue. The volume is the slider on the right.

But I agree: The GUI needs much improvement...


My answer to that question is simply 'mplayer'. I organize my music in folders. I use cd, find and others to navigate. I have never been happy with players with databases - it somehow always gets in the way. I don't like last.fm recommendations, due to the simple fact that I like as diverse music as possible. I discover new music via radio. Mostly wfmu. For me, interesting bit is information about resampling. Thank you for it.


If you already have a diverse taste in music the last.fm recommendations will be diverse too.


I, personally, am very much in love with DeaDBeeF[1] on openSUSE. When I was still using windows, I was using foobar and continued to do so in wine on Linux. However, I did want an open-source alternative that would integrate better with my DE, so I had a look at deadbeef, which is foobar-ish. Highly recommended, as it is by far the best of the lot for my needs, even considering some of the bigger players out there, like Banshee, Amarok etc.

It ticks most of the boxes and supports plugins and DSPs, Bauer stereophonic-to-binaural DSP[2] amongst others, and can be extended to suit pretty much every need. :)

[1]: http://deadbeef.sourceforge.net/

[2]: http://bs2b.sourceforge.net/


I still use Winamp. I particularly dislike using the same player for audio and video as I would often pause one to play the other and don't like losing my music playlist.

One thing I always wanted is for a playlist which have ended to start over if I hit play instead of playing the last song again. Like a cd player would. Never found a solution to that.


Killer features for me in a music player are global keyboard hotkeys that I can use from inside other programs (or games), and a playlist queue that will continue playing randomly inside the same playlist after it finished playing the songs I've queued.

Foobar2000 is the player on Windows that I'm still in love with. You can run Foobar on MacOS using Wine, and there's plugins that will use the foobar's http control service to add global hotkeys on Mac.


Global hotkeys are easy if you have a decent command line client.

For instance, I can use xbindkeys to bind "mpc toggle" to my play/pause key.


One thing often missed is the default sorting order of the library. The library should be sorted on date by default to show the new songs and albums right on top (or atleast provide an option for it). Currently most of the players sort the library in alphabetical order.

"Intelligent automatic queue" sounds great along with other features.


I sort stuff in Banshee using the "score" field. It is automatically calculated based on how much of the song you listen to (eg 100 for listening to the whole thing, 50 for half). It gets updated on relistens.

The nice thing is that stuff you like bubbles to the top and stuff you don't goes to the bottom. You can do random play by score. Note that it doesn't only play high score stuff, but rather biases towards it, so you do get to rehear lower scoring content, just not that often.


Thank you for mentioning Banshee, your comment led to me discovering this music player. Like it very much (using on OS X).


I always assumed that because no music players seem to support this right out of the box, that I must be the only person in the world who listens to my new music before listening to my old stuff...


I guess there now are two of you. I doubt there are many more.

Seriously: A completely different behaviour than normal which would lead to no one finding the music they want to listen to (but finding newly added music easily) should only be the default if you have enough usertests to confirm that they want that. At least if your aim is that many people use your software and not only you plus the two exceptions who like that too.


Isn't it intuitive to you that music you have just been shared or have just bought is the music you are both (a) unfamiliar with and (b) most likely to want to listen to in the near future. My experience has been that being unfamiliar with music will make it difficult to search for, and that after being shared or buying something I go through a patch of listening to this music more frequently.

Either way, I don't think I am one of two people, and I think the tone of your last comment was very poor. As a rule: think first, then post.


No, it is not intuitive. Or it is: Of course it can be helpful to have such a view available. But having that as default order for a music-library(!) is not intuitive at all. Especially not for people who don't even remember the last time they added music to their collection.

I'm sorry if one could interpret my writing as poor tone. I indeed think that only a very small minority of people would like that, but that is totally ok and it was not meant as an attack. The point was that you have to determine such things, find out wether your potential customers would like that, if you are targeting people at all. If not, it doesn't matter.

>As a rule: think first, then post.

Spare me the bullshit. To say I didn't think before writing is a totally unnecessary attack - I clearly made a legitimate point.


>> I'm sorry if one could interpret my writing as poor tone.

Yeah, well, just because it's the internet and you can't see people's reactions, it doesn't mean that it suddenly becomes acceptable to imply that people are selfishly only thinking about their own user experience...

>> I indeed think that only a very small minority of people would like that [...] The point was that you have to determine such things, find out wether your potential customers would like that, if you are targeting people at all. If not, it doesn't matter.

Right, well the problem here is that you haven't heeded your own advice. You're sitting here telling me about "very small minorities" with no evidence to back up your claims. And I tend to think: absence of evidence, intuition should trounce mere opinion. (That said, I agree that if somebody hasn't added music to their collection for a long time, a time-ordered view would make less and less sense. I think that's intuitive, too.)


In iTunes in the music view (which shows you the full library), you can just order by any key, also by the added-date. Isn't that what you want? Do other complex players not have similar support?

In this project, there is no such view yet so there is no way. But it is easily possible to add such criteria to the intelligent queuing algorithm which will have the effect that new songs gets selected more likely.


Thanks for trying to make that constructive :)

Though you probably didn't want to answer my comment, but the one above: Sure think that this is the way to go, either being able to sort the library accordingly, or better by something like your intelligent queuing algorithm. But the suggestion i objected was to have this as the default-sort-setting of the library.


In the intelligent queue algorithm, you could easily add such a criterium to make that more likely. Maybe I'll add that as an option later.

Code is here: https://github.com/albertz/music-player/blob/master/queue.py

Esp. `MainQueue.calcScore` is what you would want to modify.


Here's one I would like. Shuffle, but with an awareness of sets of songs that should be played together. For example, if shuffle ever hits on "Brain Damage" from Dark Side Of The Moon, it should always proceed to "Eclipse" before resuming any other song. This could be achieved with an online database like MusicBrainz - there was a Reddit thread recently which suggested another few songs which are often played together.

Alternatively, a manual approach would be that if I hear a song I know should segue into another, I'd like to be able to suspend shuffle and have it instead pick up from the song that would generally follow that song in the track order of the source album.


In the intelligent queue algorithm, you could easily add such functionality. Maybe I'll add that as an option later.

Code is here: https://github.com/albertz/music-player/blob/master/queue.py

Look at `MainQueue.calcScore` and others.

For the manual approach, maybe some button next to a song like "add follow-up songs to this song below" would do (not sure how I would insert that into the GUI, though).


XMMS (for those using Windows: Winamp) is still the best music player out there. Not XMMS2 or the slow Audacious though, and the newer Winamp versions or skins also aren't that great anymore.


I've never seen a GUI age so well as the Winamp classic skin. Even old Apple OSes can look hideous today, but with Winamp I still find myself switching back to the classic mode.


Or you can use the Winamp Lite[1] which I think is almost identical to Winamp 2.x.

1. http://www.winamp.com/media-player/all (on the bottom)


You seriously can't compare XMMS to Winamp. When I was using Linux as my main desktop OS I tried a few players, looking for Winamp alternative. Didn't find any and went with one of those full-blown media-library nightmares (I used Amarok but I guess banshee or rhytmbox would be about the same). But back to XMMS (or few other winamp clones): Only thing they had in common was the UI. Function-wise it was nowhere near. Anything you could thik of in Winamp just wasn't there.

I had similar problems to find any totalcmd replacement.. and again, there isn't anything close (I ended up with Krusader I think, but it wasn't anywhere near).


Hmm, I guess you needed some really specific parts of Winamp then... Because for me all features I use, both have in common: play mp3's and other file types, have a playlist that effortlessly contains all your thousands of songs, the "j" shortcut to quickly jump to one, display the name and length. The only thing xmms hasn't is shift+v to fade out.


I prefer AIMP instead of Winamp, it's so much better.


I like the bit where iTunes is a "professional music player". xD

Good post, interesting read. :)


I would say iTunes is. They certainly have invested a lot into the core playback engine of iTunes and its quality.

For example they have their own loudness analyzing specification called Sound Check. A music player having its own loudness specification and analyzing algorithm is very rare! Most players don't have support for analyzing at all and if they do, they usually use the original mp3gain algorithm to calculate the ReplayGain value (but as that one is GPL, this is only for GPL players).

The overall audio playback quality is quite good.

Also they have a lot of other advanced features.

E.g. the iTunes DJ mode is actually not so bad. The algorithm behind it works quite good.

They also have a remote interface where users could vote for different songs and the song with the highest votes will get played next.


What about MPD? Most of the describe features/requirements are already there.


See here: http://news.ycombinator.com/item?id=4772713

Or directly here for a previous discussion: http://www.reddit.com/r/opensource/comments/1224ux/experimen...

Actually it lacks many of the most important features.


just read the reddit discussion. I'd say that MPD is more UNIX-y than your approach for a music player; still I appreciate your effort to build well defined requirements for your project


Yup, I've found that most people seem to re-invent MPD badly because they haven't heard of MPD.


MPD is brilliant. I've been using it for a long time now and have always been happy with it :)


P.S. albertzeyer is on Gittip:

https://www.gittip.com/albertz/

and Flattr:

http://flattr.com/thing/49143/Projects-artworks-writings-of-...

Consider supporting him financially, if you like his work.


Honestly I don't know why the author didn't go with the client/server model. Running a music player as a daemon and having a client that connects is awesome, and allows things like remote control (android apps, etc) to happen much more easily.

In fact, why they didn't just use MPD escapes me.


I had this discussion a while ago, in particular here: http://www.reddit.com/r/opensource/comments/1224ux/experimen...

MusicPlayer is already highly modular. Adding a server interface listening on some TCP port is trivial at this point. Full control via an IPython shell or just the console is already possible. (In the beginning, while it didn't had any GUI, the IPython shell interface was how I used it.) There is nothing really complicated in developing some remote control.

The way MusicPlayer manages the queue, i.e. the intelligent automatic main queue is not trivial/straight-forward to emulate in MPD and it would be hacky - that is the first and main reason I didn't used MPD. Then, using MPD wouldn't really have made it simpler, only more complicated. Forking MPD itself and extending/changing it in the way I intended would maybe have been a solution but I thought it would be simpler to just code the player engine from scratch. Despite that, MPD does not support many of the current features of MusicPlayer, like the builtin loudness analyzing algorithm, etc.


Increasingly for me the music player is the browser. I don't know which library is used when a browser plays audio, but where once I was protective of my music collection, now I find the web playback through pandora and grooveshark to be far more frequently used. For the next generation, my daughter only knows youtube as a music player; the separation of music from video seems to be a concept only readily grokked by those currently over the age of 12.


I love his in depth passion for the quality of his music, though the application UI is suffering from some "programmeritus". Nitpicking: tt should have the song name as its title, "addSome" button should be removed and replaced with drag and drop, you probably don't really need the wave form and the time field looks like and input field. I'm a big fan of foobar for the reason its interface is simple and clean.


> "addSome" button should be removed and replaced with drag and drop

Please, no. Some of us don't use desktops and don't want drag-n-drop dependencies. (I know this is currently built for Cocoa, but the project's goal is cross-platform.)


Very interesting explanation, I knew playing media files wasn't a trivial task but didn't imagine there was so much going on behind the scenes.


Nice article. I like these kinds of explanations that go into all of the difficulties of a task that aren't obvious from the outside.


Can't get it to work on OS X. The provided app bundle does start, open the Last.fm website, then does nothing. No window, no dock dropping, no (meaningful) menu bar.


Just delegating to ffmpeg fails with many TTA files, so I'll be sticking with VLC for now.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: