📜 ⬆️ ⬇️

Yet another audioplayer

Hello. My name is Vadim. And I am a music lover. It's like a drug. Constantly need new music. And tools for searching and listening. This disease has lasted for many years. It all started with writing scripts that parsed, vk.com and last.fm databases. Then there were multi-stream parsers of liveinternet music through a network of proxy servers and a parser for the issuance of google and p2p networks wuala + recommendation services based on last.fm (w3z.ru - project is closed). Then there was a social network for music lovers integrated with last.fm and vk (wharrgarbl.ru - the project is closed). And finally, a desktop application for music lovers, in which it was possible to listen and search for music in a single interface (mielophone.com - the project is closed). All these projects have one thing in common - they were not opensource projects, and for various reasons they died. I was helped by many people by yamalight , Kaaboeld, and doubly sad that they had to be closed. Some are at the request of copyright holders, and some are not “pulled”. So maybe it's time to stop looking for "benefits"? - I thought, and decided to write another free, free, cross-platform audio player.

image

But look, you will merge the disc - do not even think about compressing to mp3!

A cool multi-format cross-platform library for decoding tracks is half the success. And fortunately the BASS Library is free for freeware projects. And I did not even hear about half of the formats supported by it. Great sound, written in C, fast, compact and cross platform. In general, I was pleasantly surprised at how many doors are opened for freeware / opensource projects.
')
All your files are belong to us.
The average player for android (and not only for android) suggests 5 options for aggregation of the multimedia library.
You can organize tracks by artists, albums, genres, folders, or display all tracks in a single list. It reminds me of the cartoon "pipe or jug". There, the little old man gave a little girl a pipe - so that you could see all the berries or a jug to collect them. Suppose you have a folder "My favorite tracks", in which, for example, for example, all the tracks that you liked on pandora.com, then added to vk.com and synchronized with the device. If there are several hundred tracks in this folder, like mine, then the screens with a list of artists, albums and genres will be greatly overloaded with redundant information. Folder navigation saves, but the file structure is tree-like. Some folders with albums can be nested in folders with artists, which are not. It becomes inconvenient to choose several folders, and finally they are not ordered by artists-albums-years. All you need is to sort the folders and present them in the form of a flat two-level tree :

Image #2079925, 92.6 KB

Folders are grouped by artists, sorted by year, and finally you can select the folder “my favorite tracks” for the minimum number of clicks, add a couple of favorite albums and this is the mix that I added to the device just recently.

What a pain, what a pain, mediascaner vs user - 5: 0
The first version of the library of tracks was based on the standard media library android (literally 100 milliseconds is great). But testing the functionality of getting tracks into the newly added section - I was faced with the problem of the lack of recently added tracks. The fact is that after adding a new file to the device - it does not immediately become available. First, it should be seen by the service of a media scanner, who behaves like a mannered girl and really starts only after the device is rebooted (it also freezes, discharging the battery with a bit of the track, but this is not about that now). I had to write a file system scanner. But since we have our own file scanner, we also need our own tag scanner. For these purposes, I chose www.jthink.net/jaudiotagger . It supports all formats that the player supports and, at first glance, is quite fast.
Total 70 ms per file. Did I already say that I am a music lover? I have a lot of files. And 70 milliseconds easily turn into minutes of anxious waiting. Okay in java, you can throw off the arraylist into the file with just a few lines of code and when scanning incrementally add only those tracks that have not been scanned before. Hanging an update on the refresh button, for example. Everything began to work quickly, until one day I caught myself looking at the list of tracks in my own program and did not understand why the track that had just appeared did not appear. I forgot to press the refresh button. Having rummaged in the system, I did not find the “new file” event, but I found ACTION_POWER_DISCONNECTED. By subscribing to it, it is already possible to run the scanner every time a user pulls the cord out of usb, it's better. But 70 milliseconds remain 70 milliseconds. I tried to screw the library on C and 70 ms turned into 30 ms. At first glance, the increase is not significant, but for 1000 tracks it does not seem that way anymore. This is how the current version of the scanner was born.

Let The Music Set You Free.

Legalize For only 169 rubles a month, Google Music provides the ability to listen to music absolutely legally, and moreover, you can store your media library in their cloud. Of course, I could not get past this miracle and, having bought a subscription, first of all I rushed to implement access to the repository from the player. However, not everything worked out. There is a great Unofficial-Google-Music-API written in Python, but its java ports are hopelessly outdated. More precisely, there are no problems with playing music from the cloud, so tracks filled by the user are not encrypted. But the tracks from their store, accessible by subscription and from the native application, are sent in encrypted form, and the algorithm is constantly changing. Unfortunately, there is no legal way to listen to a legally accessible track by a legal user from an illegal application. I rummaged a bit with copying from python to java, but unfortunately nothing happened. Therefore, while you can only listen to your own tracks. It's a pity. By the way, if I'm not mistaken, you can upload your own tracks to the Google Music cloud for free.

Patterns and Textures.

Breaking the whole dribbble.com several times in all directions, it seemed to me that Vox had not yet come up with anything more functional. Although of course I have strange design requirements. I hate it when the tracklist is hidden somewhere in the depths, on another screen, and you are mysteriously shown a cover with three buttons instead of it. And the majority of modern designs for some reason realizes this pattern. The cover can also be shown under the tracklist, shading, for example (as Vox does). Or if you really make beauty - then make beauty, with animation on opengl and "plug-ins of the visual image." Well, now you know where I drew inspiration from. Most of it is drawn in software , which I hope will facilitate porting to other platforms.

It '$ not for money

Well, we smoothly got to the topic of porting. And in cross-platform development, I'm noob. From the side look like - a bunch of technologies, and sadness at the exit. I want the application to be not just good, but just as cool - how WinAmp was at one time.
To start, considered the obvious solutions:
Java is cumbersome and pulls the JVM
Java Fx - heavy

Then considered innovative:
github.com/bigfatbrowncat/zetes is a very interesting and unusual solution. But so far very young. But it works. (The author on Habré - and will beat me, as the framework has not yet announced)

Then the GUI frameworks:
Qt, GTK +, wxWidgets - and for each there were specific flaws. In general - a set of heavyweight tools.

Then bold:
mono is an indecently cool solution. The interface is written native, weighs a little, it is easy to write. And I even started. And then I was surprised to realize that a significant part of the business logic of the application is implemented in C, and if the interface still writes for each platform, then why do we need mono? The general part is scanty.

And once again I considered a pool of obvious solutions - a native application for each platform. The easiest way to do this is to transfer as much as possible to C. For example, for musicbrainz, there is a library in C, it can be integrated into the application, and then in each application it remains to implement only the interface and the strings that jittery are twitching. There is only one problem. Need to learn S.

Why can't i see it

It was at this point that I began to understand that without the help of the community I could not do anything. So, what is right now:
- repository android version of the application bitbucket.org/recoilme/freeamp
- actually play.google.com/store/apps/details?id=ru.recoilme.freeamp

The application can:
- play a bunch of different formats
- scan tracks, read tags
- present the media library in a convenient form
- partially integrated with the service of Gooogle music
- use the system resources as efficiently as possible (it does not eat the battery more simply, I forgot to tell you about this fight)

Scheduled for the near future functionality:
- integration with musicbrainz and last.fm. Maximum information about each artist, scrobbling, search for covers, lyrics, and so on
- integration with music services (vk + soundcloud)
- Integration with Internet radio stations (screw the list in fact, the bass can work with them out of the box)
- all sorts of small puzzles (fly! Disassemble!): Bitbucket.org/recoilme/freeamp/issues?status=new&status=open
and much more. The project is still young and is being sawn mainly on weekends, but hopefully promising

And also there are deferred large tasks, which so far I can not handle:
- for example, build libmusicbrainz for android
- write the module of the visual image and display it on Lockscreen, for example
- rewrite media scanner on si
- well, globally, start porting to a poppy, then under linux, then under other platforms.

Welcome to contribute!

Application:
2H Company - Philip Dick
2H Company - Cultivator
The Orb - Let The Music Set You Free
The Orb - Earth (Gaia) - Patterns and Textures - Trk 2
Argaman - It '$ Not For Money
Infected Mushroom - In Front of Me

Source: https://habr.com/ru/post/209920/


All Articles