Home

Awesome

Hum Synthesizer 0.6.0 👄

A music notation language and synthesizer written in Rust.

Hum converts markup text files to playable music saved as WAV files.

This project is in early development, and its public API is possibly subject to breaking changes at any time. If I knowingly make a breaking change, I will update the MINOR version in the semantic versioning scheme, where the version numbers are MAJOR.MINOR.PATCH.

DISCLAIMER: This program produces sound output in the form of *.wav files, and it is not yet considered stable. You should turn down your volume before experimenting with sound output to protect your ears and speakers.

<a name="requirements"></a> Requirements

Building the Project

To build the project, use cargo build in the root directory.

Testing the Project

To test the project, use cargo run in the root directory.

Hum has two required, positional command-line arguments:

  1. the path of the *.hum input file
  2. the path of the *.wav output file

To convert the included *.hum file, "daisy.hum," to a file called "daisy.wav," use the following command in the root directory:

cargo run daisy.hum daisy.wav

Installing the Latest Release

To install the latest release as a CLI tool, first make sure that you have fulfilled the requirements by installing Rust.

Then you can run the following command in the terminal:

cargo install hum

Now you can use hum like any other CLI tool. For example, presuming the file daisy.hum exists in the current directory, you could use:

hum daisy.hum daisy.wav

Using Hum as a Library

You can also use Hum as a library in your own Rust programs. Right now, there is one method which implements the functionality of the CLI tool:

extern crate hum;
...
hum::convert_to_wav(input, output);

An Explanation of the Hum Music Notation Language:

The Hum music notation language is intended to be easily interpreted by human musicians and computers. It is still in early development and subject to change, but here is a brief explanation of the features available so far. I encourage you to look at the included example files and modify them to help you understand how the language works. First off, here is what the language looks like:

~ DAISY BELL by Harry Dacre
~ Based on an 1892 print in The Johns Hopkins University Lester S Levy Sheet Music Collection
~ Arranged by Connor Bulakites to demonstrate the Hum Synthesizer

[ 180_bpm ][ 3/4 ]

***********************************************************************

% square
| (Dn_5 1/2)+ -------------------- | (Bn_4 1/2)+ -------------------- ;
~ Dai-                             ~ sy!

% sine
| (Rest 1/4) (Bn_4 1/4) (Bn_4 1/4) | (Rest 1/4) (Gn_4 1/4) (Gn_4 1/4) ;
| (Rest 1/4) (Gn_4 1/4) (Gn_4 1/4) | (Rest 1/4) (Dn_4 1/4) (Dn_4 1/4) ;
| (Rest 1/4) (Dn_4 1/4) (Dn_4 1/4) | (Rest 1/4) (Bn_3 1/4) (Bn_3 1/4) ;
| (Dn_4 1/2)+ -------------------- | (Bn_3 1/2)+ -------------------- ;

% sawtooth
| (Gn_2 1/2)+ -------------------- | (Dn_2 1/2)+ -------------------- ;


***********************************************************************

% square
| (Gn_4 1/2)+ -------------------- | (Dn_4 1/2)+ -------------------- ;
~ Dai-                             ~ sy!

% sine
| (Rest 1/4) (Dn_4 1/4) (Dn_4 1/4) | (Rest 1/4) (Bn_3 1/4) (Bn_3 1/4) ;
| (Rest 1/4) (Gn_3 1/4) (Gn_3 1/4) | (Rest 1/4) (Gn_3 1/4) (Gn_3 1/4) ;
| (Gn_3 1/2)+ -------------------- | (Dn_3 1/2)+ -------------------- ;

% sawtooth
| (Bn_1 1/2)+ -------------------- | (Gn_1 1/2)+ -------------------- ;

Now for some explanation of what you're seeing:

Why Did I Make This?

I thought it was cool, and I've never programmed a large project in Rust before, so obviously I'm the person for the job 😎. Also, I like the idea of an open music markup language being easily readable by both humans and computers. I think if it's implemented correctly, it might make it easier to preserve musical scores in digital format. This has been a fun project to get started with so far, and I hope that people make awesome music with it.

Why the Choice of License?

For more insight on what you currently are and aren't allowed to do with this code, you can read more about the terms of the GPL at the GNU website. If anybody actually starts contributing to or using this code and wants to convince me to release it under an alternative license, then just contact me, and I am open to having a conversation regarding the matter 🙂.