hisekaldma/Polyhymnia
Music programming language
{ "createdAt": "2014-12-15T09:15:53Z", "defaultBranch": "master", "description": "Music programming language", "fullName": "hisekaldma/Polyhymnia", "homepage": "http://polyhymnia.io", "language": "JavaScript", "name": "Polyhymnia", "pushedAt": "2019-11-18T20:42:29Z", "stargazersCount": 50, "topics": [], "updatedAt": "2024-09-04T02:57:49Z", "url": "https://github.com/hisekaldma/Polyhymnia"}Polyhymnia
Section titled “Polyhymnia”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.
Getting started
Section titled “Getting started”The best way to try Polyhymnia is in the online playgroud.
Build from source
Section titled “Build from source”To build Polyhymnia from source:
-
Clone the repository and run
gruntto build Polyhymnia. -
Add
polyhymnia.min.jsto your project.
<script unsrc="js/polyhymnia.min.js"></script>- Create a
Contextobject, 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();Requirements
Section titled “Requirements”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.