Music
The music project lets you make music. Turn your keyboard into a musical instrument. When you have a song, write it down in a simple plain-text file, and get it as an mp3.
Here’s an example of an mp3 that was created using this music project: Hedwig’s Theme.
That audio recording was generated from a text file: hedwig.txt. How cool is that?
Pros
- You can specify the exact frequencies you’d like to use in your songs, so it’s perfect for microtonal and non-Western music.
- Because you don’t have to perform and record your pieces, the barrier to entry is super low: Even if you’re a non-musician, you can use this project to express yourself musically.
Cons
- The synthesizer is able to produce very realistic sounds that are physically modeled, but the instrument selection is limited: We have just a rudimentary marimba (MarimbaInstrument). Do you know how to model instruments? Let me know if you do!
- The text files are not as expressive as sheet music: For example, there’s no way to indicate that a note should linger on and on… or stop abruptly. There’s no way to indicate that a passage should be played particularly softly, or by a particular instrument.
- There’s no support for input and output devices other than your computer keyboard and speakers. Should we add support for this? There is a standard format for communicating with your audio equipment that we could use.
Getting started
If you’re using Ubuntu, then follow the two-step instructions below! If you’re not using Ubuntu, the project might still work: the underlying tools are capable of running on any operating system. If you do find a way to install these tools on your operating system, then send me an email to have your instructions included here.
Here’s how to install the project on Ubuntu:
1. Install the dependencies:
sudo apt-get install git php lame mpv
2. Download the music project:
git clone https://github.com/spencer-mortensen/music.git
cd music
You should now be able to record Hedwig’s Theme:
./record songs/hedwig.txt
You should see an audio file (“mp3/hedwig.mp3”) and you should hear it playing.
In the future, you can play your audio files like this:
mpv mp3/hedwig.mp3
You can also turn your computer keyboard into a musical instrument! Here’s how:
./play
Now press some keys to hear sounds. When you’re done, press Ctrl+C to exit.
If you’re comfortable with it, you should check out the source code to see how you can modify the key mappings.