Piano App is a virtual piano site that you can use to play songs with many different instruments. It's possible to play the piano keys with your mouse/keyboard or let the piano play by itself by loading '.piano' files or example song samples that already come with the site.
Piano-App-Demo.mp4
.piano files are a type of file that I created in an attempt to represent a song in a human-readable way, using plain text. Inside .piano files, you can specify information such as the notes that make up the song, their durations, how fast they should be played, or even pauses in the song.
The beginning of a song is set through the START
keyword. This keyword must be present in every .piano file.
START
Your notes go here...
When creating new songs, you can make use of the START
command to make the song start at an specific point you're testing, so you don't have to hear the song from the start over and over again.
The song speed is a measure of tempo, like BPM, the difference is that 200 BPM, for example, is not equal to 200 "speed". In .piano files, a speed of 100 can be considered very slow and a speed of 1000 can be considered very fast.
The song speed can be set using the (>>)
command. In the example below, we are setting the song speed to 250.
START
(>> 250)
It's also possible to remove the song speed by setting it to a negative value. In these cases, the delay between notes will have to be controlled using manual pauses, which will be addressed later.
To play a note, declare the note name inside parenthesis. The range of notes goes from C0 to C8, but be aware that some instruments do not have sound for very high or very low notes.
In the example below, we are playing a B5:
START
(B5)
To play more than 1 note at a time, declare the notes in the same line. In the example below, we are playing a C chord:
START
(C4) (E4) (G4)
It's a good idea to use indentation in your favor when separating the bass notes from the melody ones. I personally like to organize my .piano files by putting the bass notes in the left and the melody notes in the right:
START
(C2) (C5)
(C2) (E5)
(C2) (E5)
You can control the duration/sustain of notes through an optional parameter when declaring a note. In the example below, we are playing an A5 and holding it for some time.
START
(A3 500)
If all or many of your notes have the same duration, you can set a default duration time using the (#)
command. In the example below, we are setting the default note duration to 200.
START
(# 200)
Manual pauses in the song can be made using the (@)
command. In the example below, we are playing an E3, then waiting 1000 milliseconds, then playing an A3.
START
(E3)
(@ 1000)
(A3)
If you have Node.js 16.15.1^ installed in your machine, clone the repository and type the following commands:
npm install
npm start
If you have Docker installed in your machine, clone the repository and perform the following steps:
docker compose up -d
Then, in any browser, access http://localhost:3000.