Polyhymnia is a programming language for composing music. It lets you write rules that evaluate to sequences and patterns of notes, chords and drums.
Polyhymnia is still in the design stage. Some things will change. Some things won’t.
The best way to try Polyhymnia is in the online playgroud.
To build Polyhymnia from source:
-
Clone the repository and run
grunt
to build Polyhymnia. -
Add
polyhymnia.min.js
to your project.
<script src="js/polyhymnia.min.js"></script>
- Create a
Context
object, and pass in samples for your instruments:
var context = new Polyhymnia.Context({
instruments: [
{ name: 'Kick', samples: [{ url: 'audio/Kick.mp3' }] },
{ name: 'Snare', samples: [{ url: 'audio/Snare.mp3' }] },
{ name: 'Hihat', samples: [{ url: 'audio/Hihat.mp3' }] },
{
name: 'Pad',
samples: [
{ root: 'C', octave: 1, url: 'audio/PadC1.mp3' },
{ root: 'C', octave: 2, url: 'audio/PadC2.mp3' },
{ root: 'C', octave: 3, url: 'audio/PadC3.mp3' },
{ root: 'C', octave: 4, url: 'audio/PadC4.mp3' },
{ root: 'C', octave: 5, url: 'audio/PadC5.mp3' }
]
}
]
});
- Pass the code you want to play to the Context object:
context.parse('Play = Pad: C D E F');
- Play it:
context.play();
Polyhymnia runs in the browser and uses the Web Audio API, which is part of HTML5. It should work in all modern browsers, including Safari on iOS and Chrome on Android. You won’t have much luck with Internet Explorer.