Skip to content

sbulen/sjrbMIDI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sjrbMIDI

sjrbMIDI is an open-source (GNU-GPL3 license) collection of classes to simplify creating and reading MIDI files via PHP.

The idea was to make it as easy as possible to write a bunch of MIDI events to a physical MIDI file. The file will be readable by any DAW.

PHP is such an easy language to work with, I wanted to be able to experiment with algorithmic composition in PHP. I am sharing this here in case anyone else finds it helpful and fun.

Capabilities

  1. Can read and write existing MIDI files, and dump their contents.
  2. Can create new MIDI files, with full control over all aspects of the MIDI file.
  3. A class exists for a musical Key, to enable diatonic math & writing logic that stays "in key".
  4. A class exists for Rhythm, to make it easier to manipulate note durations to follow a rhythm.
  5. An extension to the Rhythm class exists for Euclid, for generation of Euclidean rhythms.
  6. Classes exist for creation & manipulation of event series, for both Pitch Wheel events and Control Change events. Several wave forms exist, from sin to sawtooth to square, etc., for these curves.
  7. A class exists for a musical Phrase, that allows you to operate on sets of notes a time. Methods exist for various musical transformations, e.g., retrograde, transpose, inversion, etc.
  8. A class exists for Dynamics, that allows you to emphasize notes according to the rhythm and time signature being used.
  9. A class exists for a DrumGenerator, which will do what it says - generate a drum track. Highly configurable, the DrumGenerator allows you to specify a set of sequences to be generated and a set of instrument properties. The result can range from dreamy & spacey to manic metal jazz...
  10. A class exists for a ChordGenerator, which will generate chord sequences.
  11. A class exists for a TonalGenerator, which will generate melodic lines based on phrases.

To use

Create your file in .php and execute it from your browser. The MIDI file that is created can then be loaded into your DAW.

Use one of the examples as an easy starter.

Documentation may be found here: https://github.com/sbulen/sjrbMIDI/blob/main/sjrbMIDI.pdf

Limitations

  1. This does not honor any of the real-time MIDI messages at this time. Not sure PHP would be the platform to do that...
  2. This software is geared towards generating files in MIDI file format 1.
  3. I have not tested the SMPTE functions, only straight-up MIDI.

Further reading

About

Set of classes written in PHP for the creation & manipulation of MIDI files.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published