A simple editor for creating music box melodies with an animated music box that "plays" them for you.
Just click on the diamonds to generate a note and press play. There are some featured melodies included.
NEW: Create a BoxHub account and share your boxes:
The note sounds are from https://freesound.org/people/UbikPhonik/
Tech used :
- Animations are created by me in After Effects and exported as SVG animation which is then played in the browser with the lottie player. https://lottiefiles.com/web-player
- For the actual music box editor - vanilla JS
- for database firebase - https://firebase.google.com/
- for server - node.js with express
- for censoring bad words in a database - https://www.npmjs.com/package/bad-words
- code editor and hosting - repl.it https://repl.it/repls
Make sure you tune-up the box when first loading to cache the sounds and make sure they are loaded.
-save notes and load notes
-generate random notes
-tuning up the music box
-copy notes from sheet and auto-paste on next sheet
-add new block "+" and delete block "-" or press "++" to generate N blocks from input and "clear" to delete all.
-move notes with arrows
-toggle hold notes
-piece fast preview
-two blocks animating preview modes - show one block at a time or all blocks being visible while playing
-listen to the music only (radio icon) - remove all heavy matrix elements and generate a music output
-mixing notes - combine two or more pieces.
-build-in tunes: Ode of Joy, Twinkle Twinkle Little Star, Star Wars Theme, Jurassic Park Theme, Elf Song.
--save notes to a database https://musicboxdb-2--anthony-tonev.repl.co/
My idea was to write an app that is simple enough to be beginner-friendly so anyone can learn to write simple music pieces without knowing complex note notations and also have an open-source note sharing system where users build melodies on top off or inspired by other users melodies.
Works best on a desktop with chrome in full-screen repl view.
I've added a guide that explains most of the stuff: https://docs.google.com/document/d/1VuNxjiUfA3SQPqONgDC-7V46lHGHZw3rfcvPiS7jNRI/edit?usp=sharing
Here are some gifs that try to explain the rest of the stuff:
Navigate on the block with the arrows or swap between adjacent blocks or cross between adjacent blocks (there were some bugs with these - most are fixed - there is one know bug where notes in perfect vertical line will merge when doing the cross matrix thing - but making holes on them will allow them to cross)
Mix different projects by chaining their notes together - very useful if you want to create a playlist or if you want to work in parts to reduce memory consumption.
Navigate from top to bottom when loading, previewing and editing by pressing the elevator buttons.
Radio player - Press the radio icon to generate the music and DELETE the blocks with their notes and editing panels ( they can be generated again via the load button). If all you want to do is listening to your creation then you don't need all that 15x15 matrix stuff - this mode is the player part of the editor.
The fast preview feature: Preview notes at 2x speed of the current delay value. After that, it will reset back to normal speed. Sometimes you will want to preview faster to find bad notes. In that case, you don't want to switch delay all the time - just included a button for it.
- Lack of phone support.
- Not working in Edge.
- Adding and removing blocks is scrolling off.
- Too many features - after hackathon deadline ends I will try to trim it a bit.
Huge thanks to ebest and vedprad1 for the amazing content they have created - I will not be able to compose such awesome music even if I'm using professional tools. Also greatly appreciate their and everyone else's issue reports and feedback. ay
I now see one more problem (sorry if I am annoying you):
I tried to enter the name of the original composer for a new entry, but the letters "Wang" were replaced with 4 Hearts.
@vedprad1 No problem - I'm happy for receiving issue reports.
Yes I saw your post in the DB monitor. The issue is that I've added a bad words checkers since I wan't to avoid disqualification if someone wants to add bad words in the DB for people to read hate speech. So I censor them with ❤️.
Yet a lot of names can mean a bad thing in eng. For instance the word "book" in my home language will appear like "k❤️❤️❤️❤️❤️".
For now I will monitor these stuff and will fix them manually. I will add the words for inspection somewhere in the db.
I've fixed the name of the author. Great piece by the way!
I noticed another problem:
I submitted a song into the database, and once I did, it appeared in the database.
However, it is not appearing now.
@vedprad1 Ok I have tested now - added one melody and I will see if it gets erased after the server falls asleep. I'm saving them to a file but maybe there is some update msg or something that the editor promps the app. I have closed all instances of repl editor. Thank you for the bug reports.
@vedprad1 After some testing - I've noticed data missing.. I have found an article stating that files are not being updated properly on the editor itself
I will figure out some firebase db backup I guess.
Added a firebase database - now everything is saved on the cloud where no data can be lost. I have removed the clumsy local database and I can even monitor the incoming uploads from the firebase console.
I'm so pissed that I've lost so much time on a data base integration which is not even a part from my submission because it is a separate repl, but what can you do... At least data can be stored.
Thanks again for point this out - I would have never figure out such problem existed since I've updated the app in the editor and thus "semi-manually" saved the file.
@vedprad1 there are 3 rules regarding posts -
1 Providing arranger name,
2 piece has to be ending with 'grand' or 'mini' - this is done automatic when played within the editor (tells player what size is the piece) but I've added it as a feature at sunday. Jurassic Park has to have ',grand' at the end,
3The third rule checks if the music has a proper notes format. I have removed the last rule now.
Just added 5 test pieces - seems to be working.
Wow! This is pretty good!
I probably just have one problem regarding this: The software is very hard to use on an phone or tablet, although you probably designed this for computer only.
If you want, you could add the following music into the collection:
Jurrassic Park Theme
Originally by John Williams
Arranged by @vedprad1
@AAnonymity Yes I don't keep boxes info - I plan to save the project into a database where I will keep the info for the number of boxes same as I do with the record collection.
For now the only way to load previous projects is with '++' button, on the left there is an input area where you can specify how many blocks you need and it will create that many boxes - then load peace.
I have yet to write documentations about these stuff...
Hello. I went to BoxHub, I created a tune, then realised I had inserted the wrong note sequence. Then I went and updated the box, then the page didn't render correctly, as in the the container boxes were all over the place. The tune is one I made up, in the generator. The name of the tune is "A step in". I also found that the note sequence had been updated, just something got messed up. Here is a screenshot:
@johnstev111 Thanks for the report- I will see what got wrong. This thing is from yesterday - so it might have some bugs but data will never be lost.
I've noticed that you missed to include a keyword -ID I use that so you can give your box projects names and then update and access them via these keywords. They appear in Box menu when you load boxes from the database. Just a lazy way to add selecting projects for now.
See here: "/" are separators of all the box keyword IDs that I have (all of my existing projects). When I type one there and press view it will load the data for the specific one and I should be able to edit it with the update button.
I've added a keyword for your one - it is just the word 'steps'.
But if you wish I can change it.
@johnstev111 Yes - ⭐s are the only notes that use simple html audio and thus fail to load on a first run. This might cause it to fail and break. the editor. Not sure.
I can't erase the star notes because there are other pieces that use them- was the old way to add a hold note and now it is like a magical pitch sound effect. You can add normal notes 🔹 which are same as 🔶1.0 . From 🔔 slider you can change 🔶 delay type. Like 🔶 0.5 which will make the note extend and sound more "slow". 🔶1.5 will make it fast and etc.
But ⭐will remain broken for now since changing its behaviour will screw so many pieces. It
Added Howler.js. I will add more note delay types next.
I have reversed the ordering of the database - newer pieces will show up first.
When I find the time I will add a search method and accounts.
This is definitely one of the best so far. I think you've done a great job creating it and updating!!! Thanks for posting early and allowing us to follow your development.
As soon as I had something working I posted it. Not only to share development history (open source love) but also to gain free crowd sourcing.
That way people can point out issues and the ones that can do music can learn how to use it and add content.
It's not a generally good idea to post early - usually you would like to work on something private and keep an eye on the competition uploads. That way you know the height of the bar and you can surprise everyone with something amazing and they will never know what hit them. Also you keep your idea a secret.
However in my case - content is 50% of the whole thing. The early I post the better. And the issue feedback I get is pretty good - I would have called it done on day One if I never heard any complains.
Very cool. I think the number of rows should always be a multiple of 4, since most of the music we listen to subdivides into four.
okay you've probably won this contest
I'm a begginer, and I'm not exactly fluent in English (I've started learning English a while ago) but I dream of becoming a good programmer. I didn't know that a program so cool could be written like this. It was probably very hard to program, so I would like to say: Congratulations! Now I admire you.
@rodrigosm29 Thank you for your support. There are still 10 more days - I've build this basically in 2 , so there is still time for someone to write 5 apps like this one. There is still some fight to be had - I will try to tweak some stuff to put a fair fight. Only time will tell (and the judge).
Also I'm coding since 2 years so - I'm as much a beginner as any aspiring coder out there. I'm an artist and mostly animator. So I guess it looks kinda nice because of my artistic touch. However - the algorithm is the core any app - and I still have what to learn and what to improve. So I share the same dream too.
What if the community could ACTUALLY add musics? like if there was online storage for the music pieces?
@ebest I'm thinking about adding a firebase data base with a version control on your peaces - only the latest peace will be played when song is called and you can call early drafts of peaces if you want. I will see if it can be done simple enough - I want to avoid registrations at this point and nothing should be erased. The last part is kinda tricky but honestly songs are just strings - I think the free plan of firebase can handle enormous amount of songs and versions and I don't expect to get flooded with data (unless someone is willing to flood me on purpose }:D ). Also, I have to check how I can hide environment variables in repl.it - so I can hide the API key of firebase.
@katyadee A music box that I had since I was a lvl 3 human. It plays a unique melody-lullaby that I'm still trying to find what it's called.
When hackaton theme was announced I thought I wanted to use the opportunity and record it's music then share it with an animated music box that plays the recorded audio. I've animated the box and proceeded with the recording.
But the recording I did was homemade. And it was not sounding like it was played by the cartoony box. Was too realistic for it to mix well with the character.
So I've decided to code a digital music box editor, then learn a little bit of music composition and then compose it's unique music box melody on it. I still have to train my music hearing but I will eventually play it. It's a very nice melody worth sharing.
@ebest In this game you get a tiny bit of XP every day and this is how you lvl up, but you can have a decent game time at any level. Some say that the real game starts when you reach lvl 22 because then you can decide to skip the tutorial stages or get access to better tutorial stages (academies, universities, courses). But honestly if you run the top tier class - the programmer class you can have fun at any level. At the current stage of the meta they can crush noobs even at level 10. So OP.
First song: THE FIRST SONG
Optimal delay: 300
When I made this, I noticed one thing when you load it up. If the song takes more then one block, you first have to add enough blocks for the song to fit in. This one takes 11 blocks! My suggestion is so that you can put the music code in the url.
London bridges falling up
Optimal delay is 200. 7 blocks required.
A classic: Ode to joy (Symphony No. 9) just slightly simplified to fit.
Optimal delay: 300. Blocks: 14
Any more songs to use?
@ebest wow, thanks alot I will add your song in the collection.
And yes that thing about loading them is not working well - it just loads notes. I have an object where I store notes, delay info and block count for community contributions. I will fix that to work the same way.
I will have to implement the url load for sure so I can make it like a community sharing thing but do you have any suggestions about a database maybe. I was thinking about firebase database where you just add a name and you get unique key plus that name and a version number if it's the same name - soma data about the song author etc. Or I can just make a node server and store them locally.
@ebest Yes I recognised them right away. I still think there should be the name of the person that added it as a box music. So I will name them like so : A. B. Gomme's "London Bridges falling down" by ebest.
BTW I have also added a button to generate n number of blocks (++ button next to load button).
Improved Ode to Joy:
@ebest I've added more notes - you can switch between 9 notes and 16 notes mode by pressing "more cowbells!/less cowbells" button. Old songs will still sound the same but now songs will also have a type - 'mini' for simple 9 notes one and 'grand' for 16 notes one. These are all the notes I could find - not sure if they work for all songs but at least they can cover more than before.
I have used a pack of sounds from freesounds.org that are named like so :
- I saw that some are missing, so I will try to find a pack with all notes - but this is very strange since this pack should have all notes from the box recorded. I guess it was not a note rich box.
@ebest it turns out I can - this is the code snippet
previewNote.currentTime = 0;
previewNote.volume = (volumeVal / 100);
//held notes part
previewNote.mozPreservesPitch = false; //something that does something
previewNote.playbackRate = 0.5; //the lower this is the longer the note will be heard
@Anthony_Tonev Finished! It uses all 16 notes.
@ebest wow - john williams, his jurrasic park score and starwars are the most recognisable - everyone can guess them.
btw I have just added the hold note - only 1 type for now - delay 0.4 and it activates when holding 1 right before clicking on a note. Just need to fix it in the load function.
@ebest load function is very primitive - not keeping it up with the new features. Load notes is just loading notes - it does not care for anything else. I will try to add it. On the button for community contribution it is updating the size. However it is recommended you switch to 16 first because you will need to tune the box anyway...
@ebest hold key '1' and press the note right away it will make a note 40% longer--it will be played but it does not work with load and move arrows yet, however it keeps it in save by adding a dot after the note coordinates. I plan to add more delay type although they seem very similar but first I will have to make some audio correction on the files because they have some amount of silence which affects the stretch or if I will edit them anyway I think I can make better long notes by adding sound effects on the audio file in audacity... I think this will be a better solution than roughly stretching it.
OMG! I would never be able to accomplish this! Good job! Keep up the good work and GOOD LUCK!!!