Music

The Music toolbox writes music in a graph. You can write a melody as text, either as notes such as C3:hn G2 A2 or in numbered notation (jianpu, the notation common in China), or build it from note and beat nodes. Music values can be transposed, repeated, reversed, sped up, put one after another or played together. Patterns in the mini-notation of TidalCycles add live-coding rhythms. Then the toolbox renders music to sound on SoundFont, FM, plucked, wavetable or synthesizer instruments, mixes parts, and reads and writes MIDI files.

Use it to compose, to generate music from rules, or to turn a score into audio or MIDI.

  • Included in: Divooka Explore and Divooka Compute Standard. In Compute, start a document from the Music workload, or add the Music reference with Add reference (Ctrl+Shift+L).
  • Maturity: Preview · Support: Tier 2 (proposed) · what these mean
  • Open it: node library (Ctrl+Shift+Space) → Music, or search for a node with Ctrl+Space.
  • Examples and reference: Ctrl+Shift+E → Music Synth (3 examples) and Audio · node reference

New to graphs? Start with Your first program.

Main ideas

Music is a value. Notes turns a line of text into music; With plays two pieces at once, Then one after the other; Repeat, Transpose, Tempo and Instrument return changed copies.

A length carries on. In C3:hn G2 A2, hn (half note) applies to C3 and to every note after it until another length appears.

Rendering makes sound. Render Music and the instrument nodes turn music into an audio clip that the Audio Processing nodes can mix and save.

Example: Pachelbel's canon, two voices

Open Music Synth > Canon in C (Ctrl+Shift+E). Its Euterpea group builds the canon in seven nodes:

  1. Notes C3:hn G2 A2 E2 F2 C2 F2 G2: the ground bass, in half notes.
  2. Instrument, Cello, on the bass.
  3. Notes E5:hn D5 C5 B4 A4 G4 A4 B4: the first violin's line.
  4. Instrument, Violin, on the melody.
  5. With, the violin on top and the cello below, plays both at once.
  6. Repeat, Times 2.
  7. Tempo, Factor 41/60, turns the default 120 beats a minute into 82.

Run it with F5 and the Preview plays the canon. The same document writes the canon a second way, in numbered notation, played through the MIDI visualizer of the Synth toolbox.

To use your own music: change the Notes text, or start from From MIDI with a MIDI file.

More examples to open

Example What it shows
Audio > A Song with a Mixer Bass, melody and drums on three instruments, mixed to stereo
Audio > Live Patterns TidalCycles-style patterns: scales, Euclidean rhythms, swing
Music Synth > Live Patterns Patterns played live on the audio device
Audio > Melody in a Loop A melody built note by note in a loop

Tips and limits

  • SoundFonts. Default SoundFont is the GeneralUser GS bank that ships with Divooka; Load SoundFont reads another .sf2 file.
  • Live playback needs an audio device. Start Live plays on it, and Update Live swaps the pattern at the next cycle. Render Live renders the same thing offline.
  • MIDI out. Save MIDI writes a MIDI file any notation program or DAW can open.

Goes well with: Audio Processing to mix and save, Synth for the MIDI visualizer.

What is in the toolbox

Category Some of its nodes
Euterpea Accelerando, Accent, Articulate, Chord and 38 more
Music Articulate, Cut, Equals, Length and 28 more
Pattern Arpeggiate, Degrade, Equals, Every and 22 more
Music Event Make Music Event, Deconstruct, Equals, Instrument and 9 more
Patterns Alternate Patterns, Arpeggiate, Degrade, Euclid and 15 more
Musical Score Measures, Make Musical Score, Beats Per Measure, Beat Step Size and 7 more
Note Make Note, Equals, Base Step, Measure Fraction Duration and 8 more
Sound Font Preset Make Sound Font Preset, Deconstruct, Equals, Bank and 7 more
Rendering Default Sample Rate, Music Styles, Render Generated Music, Render MIDI and 10 more
Score Sheet MIDI Writer Make Score Sheet MIDI Writer, Create Midi, Create Midi File Reader, Emit Track Names and 5 more
Sound Font Bank Name, Path, Player, Presets and 6 more
Instrument Map Drums, Fallback, Programs, Resolve and 5 more
Live Music Add Live Track, Record Live, Render Live, Set Live Tempo and 5 more
SoundFonts Default SoundFont, Describe SoundFont, Find Preset, Load SoundFont and 4 more
Instruments FM Instrument, Play Part, Plucked Instrument, Preset Instrument and 4 more
Live Session Dispose, Cycle Beats, Instrument, Is Playing and 4 more
Songs Instrument Map, Map Instrument, MIDI Song Parts, MIDI Tempo and 3 more
Score Sheet MIDI Reader Make Score Sheet MIDI Reader, Read
Song Part Make Song Part, Audio, Name, Percussion and 2 more
Musical Measure Make Musical Measure, Sections
Cantus Sheet Music, Sheet Music (Multiple Instrument)
Instrument Play
Song Arrangement Arrange Song

See also