📜 ⬆️ ⬇️

Musical publics in a new way, or how I did Public Radio

This is the only post about the project Public Radio in the hub "I am promoting". The reason is simple: this post is perfect, in no way technological. I just do not know which hub is better to put this post.

I write it more for the most half a year ago, when I put it in the back box, and then I almost abandoned this project. For the same people as me, for some reason or other, life circumstances stopped working on some wonderful project and are about to give up on it. I brought Public Radio to a logical point, to today's first release thanks, perhaps, to some luck that put me on my feet, but such an article probably would have helped me if I hadn't been so lucky.
The rest of the publications will go to “web development”, “javascript” and so on: I have a lot to tell about the stuff of my “radio”, but I really want to start a big story about it with lyrics and just stories of how I do it did.

So that you understand what I am talking about: Public Radio is a specialized player for music publics in Vkontakte. As my good friend said, one of the first testers of this application is “last.fm with selections from warm tube people, not from soulless robots.” Actually, this is an absolutely accurate description: last.fm gives you fairly accurate selections according to your tastes, but these are really “groups similar to those that you are listening to.” But there is one BUT: many groups, similar to those that I listen to, and many that will delight me, do not match. For a week of using Public Radio, I was surprised to understand for myself that I really like some representatives of the domestic alternative scene (for example, Dusty Rainbow Pioneer Camp), although I always listened to some other music.
')



Thank you very much, of course, I would like to say to those people who spread good music to such communities every day - for four to five hours of playback daily. Without you, nothing would have happened, guys!

Idea



I will start from afar, even before the moment when the idea of ​​radio came to me at all.

I am very fond of music. Not in the sense that in the very same VC I have written “ya milaman”, but in the sense that a set of high-quality acoustics from the frequency response of death to neighbors, two guitars (acoustics and electro) moves with me from one apartment to another and a vinyl record player.
And I do not like recommendation services like last.fm. According to my feelings - they are too soulless or something. You listen to one group, they say to you, “Look, boy, here you are the same group, listen to them too.” You listen and understand that yes, it is absolutely the same. Something like "try this cheese sandwich, the cheese is different here, but it tastes just like you just ate."

Therefore, I preferred to listen to online radio stations such as Channel X. I, frankly, came across it by chance - I was looking for a soundtrack from GTA, and it turned out that there really is such an online station, very high quality.

Over time, I discovered for myself such a thing as music in VC. These are communities where music is laid out in a specific format - the amount of content laid out can go up to 6-8 hours of play per day. For example, in my groups there is a post-grunge public, and a new retro wave public. Sometimes it's just music news (alternative scene, or classic rock). There are publics of piano covers of famous songs, there are publics of instrumental music. In general, the music is absolutely for every taste.
It is extremely pleasant to listen to them, however, most of them in their format presuppose thoughtful listening: albums are laid out, selections are laid out, and as a result, in the “play all” mode, the musical style changes abruptly every 30 minutes. In addition, very often there is a feeling of déjà vu, if you listen to the publics daily. “I already listened to this album!”.

In the meantime, I still started the fun project GTA V radio in my old place of work. At first I just made for myself a player of mp3-files, pulled from the tracker, then the rest wanted to make a promotional project out of it.

Two and two things happened in my head, and I decided to make a small challenge for myself: at least some full-fledged application hosted on imtqy.com (read, no backend at all). It turned out, and four days later I played a prototype, which you could already listen to.
He used an algorithm that found music groups from user groups. The algorithm was as simple as boots: we take the last 20 posts, if they have at least 20 tracks, then this can be played. Oddly enough, this simple logic has proven effective.

The prototype was loaded for about five minutes, after which 5-10 groups appeared (how many would be typed), which could really be turned on and run this very random with conditions. The random was tricky: he chose the tracks whenever possible from the ones that weren’t playing, and if there weren’t, there was a certain logic that took them that had been played for a long time. I still want to make it difficult by setting the condition - not to reproduce the same artist in a row, and so far no hands reach, much more than other project tasks.

Actually, the first problem was in the load time: the VKontakte API did not allow to perform more than three requests per second, so it all turned into a fun quest: request a list of groups, then request posts for each of the groups. An average user can have a couple of hundreds of groups, and in the end - it stretched (with sometimes pop-up problems with timeout errors and other fun) for minutes. Naturally, it is tired.

Yes, it was possible to listen (as I and my friends did), but for full-fledged, ghm, development and advancement it was extremely ineffective.
In addition, 5-10 groups looked extremely lonely, and madly wanted to add some recommendations, but with such speed it would be unrealistic. Although the music from this radio at my house played non-stop.

Long box



The events took place about six months ago, in May 2014, after which, due to a number of circumstances in my life, I decided to postpone Public Radio. Sometimes the presence of food in the refrigerator is still more important than projects for the soul, alas.

Yes, I then left the former place of work. For the summer, I got into one rather curious place by the backend developer at the node, and in two months I was attacked by a terrible apathy: I had a feeling that I was taken for money by the gentleman, but at the same time to the position of junior. No trust, a lot of C-style coding (the backbone of the developers - former sshniki). I already started to think that the development is not mine. The apotheosis was a moment that I still remember:

-In this js-module there is a bug, find it.
in five minutes:
-Bug in this section of the code, how it works - without a clue, but except in it there should not be a bug. It can be run on these two lines: ...
-This is a closed list with a pointer, I wrote it myself, leave it like that, look for a bug. This is for performance.
in ten minutes:
-I replaced with the proposed code, measured the speed, the processor drops to hundredths of a percent, the memory consumption is the same, the bug is gone.
-No, leave this code, look for a bug.
after four hours:
-I found a bug, was a plus instead of a minus in one place.
- Well, okay. I told you that the list works.


Now it is even perceived as ridiculous, but then for some reason I began to seriously think that I did not have a soul for development, that it was not mine, and that it wasn’t what I should do. I even began to scroll through the option in order to get a master’s degree from the shelf. Indeed, the lack of effective activity depresses and suppresses. Looking back, I understand what they are generally talking about when they say “they give stupid work so that you yourself are stupid”. I was rapidly becoming stupid, as if I forgot everything that I could and lost the desire to do something. I even lost confidence in myself and my actions, so much so that I still occasionally come back to the elevator and check if I closed the door. It passes, of course, but from time to time it still happens.

Fortunately, the guys from me with my smart ideas are tired there, it seems, just like me from them, and we said goodbye. This is a separate funny story, but I will not tell it.

At that time I stopped seeing the triumph of intellect in programming, and, frankly speaking, I simply began to look for a place where you can conveniently sit on the fifth point and get good money for your knowledge. Then there was another change of place in attempts to submerge the fifth point where it is warmer, but in September I went to a stable rhythm in life, for the first time in God knows how many years. It was as if everything had stabilized in my head, and the hands themselves stretched to Public Radio. Not because it was even so interesting to start the project already, but because there was an opportunity to roll in those technologies that I could not run in the main place of work.

The most interesting thing is that the very confidence in myself and my decisions came back precisely because I did this very radio.
I argued a lot with friends about how it should work, the most dispute at first was about not letting the track go and move on to the next one. Technically, this was possible, of course, but ideologically not. If you do not like the "station" - choose another, and do not look for something on it that you like. Attempting to find what you like in disgusting, when there is something nearby that you may like right away, akin to some kind of masochism. At least in my opinion. This was, by the way, another argument in the piggy bank of a high-quality recommender system.

At the same time, in September, I saw a new concept of material design from Google, and she hooked, as Metro UI hooked in due time, and therefore I decided to stylize the application for it. Not sure what happened, but at least the design change went well.
If the post is read by frontend developers, then I will explain what was so tasty for me to mess around and “let off steam” - both in terms of technology and in terms of UX.

A little bit of frontend-porn:
browsers: ie11 + (and that is because I have winPhone), chrome-ff is the last
Javascript: ES6 / traceur;
MVVM: vue.js;
Template: Jade;
Styles: Stylus;
build system: gulp + browserify + gulp (how exactly this is for one of the following articles)
API: VK.com. Musicbrainz, coverartarchive, last.fm - delayed until the next release for a number of reasons.
From temporarily saw functionality: a shader equalizer for the background (native calls, no libraries), neural network on brain.js in the web worker to personalize the recommendations (I hope to add in the second release).

If you understand frontend, then I think you understand how tempting it looks.
And if you understand the backend - alas and oh, there is no backend. AT ALL. This is not an application with a backend on apy, it is not an application even with remote services for storing data like firebird. The maximum that is used, except for the VKontakte API and music services, is localStorage and indexedDB on the client. Public radio is a real client-side web application. I don’t even have anything on the server except nginx. After all, at the very beginning there was just one more achievement in my piggy bank: to make an adult serious application that can be deployed on imtqy.com. Unfortunately, because of last.fm, there will have to be some kind of backend: their api does not support CORS, and friends are already asking for its support.

For me, it was akin to picking under the car - it will not go as it should, but the process of fine-tuning is a pleasure.
Just a mind game and a triumph of neatness. What you are doing for yourself - you try to polish, you do not want to do muck. Therefore, you sit and meditate for hours on how to do it right. This truth was akin to psychological detente.

No, it would “drive” sooner or later, but I absolutely do not understand the promotion and promotion of applications, and therefore I most likely would have done exactly the same thing as with many of my other projects I would have published and forgot.

Revival



And here in my story there was another small turn: I went to the cliffs for a week and a half. Just take a break from everything, finally stabilize brains, stay away from electronics. And it was there that I realized that I really want to share the project I created with as many people as possible: after all, I got a neat application that really caught me and many of my friends.

And that means - would have hooked on many other people.

More importantly, I could prove to myself that I can create web projects that work, drive, and that others really like. No, there was no commercial goal either then or now, I just wanted to make a good project.

A week ago, I came back, started hrenachit (otherwise you will not tell), and at the same time I took the domain publicradio.io.

And today I can say that I have the first release of Public Radio. Yes, there is not much functionality that I would like to see in it: there is no smart search string that would prompt stations for friends, certain artists or other stations. No complex social interaction. No analytics and personalization for group owners. There is not even a banal removal of groups that you don’t like from the list. But it works, it plays music, recommends me something that I enjoy listening, I like and add to “my groups”. This is something without which I could not see this “fucking radio” (yes, there was a period when I called it that way and no other way).

I work on it at night, on weekends, and I am truly happy, every minute of working with him really gives me pleasure, especially when you mess around with the music that plays from him.

You know, I just now realized that I came into a big commercial web development exactly two years ago. On October 20, 2012, I began to work in the first place of those that are listed in my resume, for some reason I still remember this date.
Perhaps this is symbolic: start the third year of working in web development, launching your own project. Non-profit, really fun, a project that I like myself and that I want to develop.

Probably, someone will have a thought “what's the catch? why take so long? Yes, I'll do it on my knee in a week. ”

I will not argue, do. I myself assembled the first version in four days, as I said.
And for so long ... Two words: performance and recommendations. And the speed in terms of working with the API, and with the render.
To be honest, data acquisition could be done 2 times faster, I specifically reduced it now: VC responds via jsonp, which is parsed as javascript, in VK Api maximum utilization mode, it turned out that 3 times per second browser parsil scripts up to 2 MB in size each. The browser, which is logical, hung up for this time, and even the sound was twitching.

With the recommendation engine - this is a separate story, to which I will dedicate a whole post, there it will also become clear exactly how I selected the optimal logic of coincidences.

In the meantime, I just want to share what I have done and motivate other people: do not give up. If you think you are creating something beautiful, complete it. No matter whether someone will use it or not, you yourself will get pleasure from what you have created, what you really brought to the end, you will see how what appeared in your head lives, how your thought matearized under with your own hands, and it is priceless.

What's next?



Then I will develop the project - if people like it, of course. True, I terribly do not have enough time - so if someone wants to join, I'm all for it. I would be glad to see in the Public Radio team another front-end designer and designer who would like to try myself in Material Design.

Of course, I will write 4 or 5 articles on Habr about a set of technologies, as promised above. I really have something to say - starting from shaders (here are two that I made specifically for Public Radio, but have not yet implemented it, to explain the reasons for a long time, to be honest: www.shadertoy.com/view/XsBSDW , www.shadertoy.com / view / XsBXDW ) or building a web application as a finite state machine on top of the es6 generators - and ending with the simplest recommender system and the subtleties that I encountered while creating it on my knee.
The first article is about gulp + browserify + gulp, I hope I will post it on Wednesday.

Public Radio will not become a commercial project, at least until it is my project.

Honestly, I don’t know how to promote it, and I sincerely hope that I’ll just get lucky and it will become somewhat viral. I will contact the owners of small publics and offer to add them to the list of recommended ones: the first 500 publics are now taken by the word music, they are parted, calculated by the genre, and so on - if you create a catalog with genres, it will significantly speed up and improve the work of the site - for placing the link on the radio (the radio supports links to publics, for example, publicradio.io/?shantrock ), and, possibly, the publication of a post on the radio. If someone has good ideas for the development of the project - I will be glad to hear them, as well as useful comments.

I would very much like to make a mobile application with audio caching - to listen to the “radio” on the road or in the subway, where limited traffic (this infection can eat up to 50 MB per minute, especially during the download).

But for now, I personally have plans tonight just to turn on my favorite station on Public Radio, gather friends, and celebrate the launch of my first full-fledged web project.

Thanks to all. Hope you enjoy Public Radio .

UPD: Forgot to say. If you like the project and want to help in its development - please share the link with friends. This is very important, much more important than in normal cases “tell friends about us”: if you manage to forge a partnership with a large number (from 500, ideally at least 1500-2000) of music publics, you will significantly speed up the download and make more accurate recommendations . At the same time, the engine will be almost completely rewritten in order to connect the neural network for the system of recommendations. And the willingness of public owners to make contact and help provide data directly depends on the public audience of Public Radio.

UPD2: Corrected the code, now the recommendations will be loaded much faster, but at the same time, for the first minute a couple of times for a split second the sound may hang.

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


All Articles