SPB Git

Repository Public

in_fm_from_scratch.sonata 2.5 KB 105 lines

1// ORIX Sonata2// File: Examples/in_fm_from_scratch.sonata3// Description: Three instruments made on the four-operator FM engine without presets: a glassy bell from an inharmonic ratio, a brassy stab whose brightness follows velocity, and a hollow bass from a 1:1 pair with feedback.4//5// Author: Simon-Pierre Boucher6// Contact: contact@spboucher.ai7//8// category: Instruments9// title: FM from Scratch10// teaches: fm engine parameters, operator ratios and levels, velocity_to_index, algorithms11//12// expect: notes 4413// expect: tracks 314// expect: duration 9.6000s15// expect: deterministic16instrument GlassBell {17    model fm18    algorithm 119    op1.ratio 120    op1.level 0.921    op1.decay 2.5s22    op1.sustain 023    // A non-integer ratio gives the inharmonic partials of a bell.24    op2.ratio 3.525    op2.level 0.5526    op2.decay 1.2s27    op2.sustain 028    op3.level 029    op4.level 030    envelope adsr(attack: 1ms, decay: 3s, sustain: 0, release: 1.5s)31}3233instrument BrassStab {34    model fm35    algorithm 136    op1.ratio 137    op1.level 0.938    op1.attack 30ms39    op1.sustain 0.840    op2.ratio 141    op2.level 0.742    op2.attack 60ms43    op2.sustain 0.644    op3.level 045    op4.level 046    // Harder notes get more modulation, so they are brighter.47    velocity_to_index 0.848    envelope adsr(attack: 30ms, decay: 200ms, sustain: 0.8, release: 150ms)49}5051instrument HollowBass {52    model fm53    algorithm 154    feedback 0.4555    op1.ratio 156    op1.level 157    op1.sustain 0.758    op2.ratio 259    op2.level 0.3560    op2.decay 150ms61    op2.sustain 0.162    op3.level 063    op4.level 064    envelope adsr(attack: 3ms, decay: 250ms, sustain: 0.6, release: 120ms)65}6667composition "FM from Scratch" {68    tempo 100bpm69    key D minor7071    instrument bell: GlassBell {72        gain -8dB73        pan 0.374        for n in [D5, A5, F5, D6, C6, A5, F5, E5] {75            play n duration 1/2 velocity 0.776        }77        effects {78            reverb plate(mix: 0.3)79        }80    }8182    instrument brass: BrassStab {83        gain -9dB84        pan -0.385        rest 2bars86        repeat 2 {87            chord [D4, F4, A4] duration 1/8 staccato velocity 0.588            rest 1/889            chord [D4, F4, A4] duration 1/8 staccato velocity 0.7590            rest 1/891            chord [C4, E4, G4, Bb4] duration 1/2 velocity 192        }93    }9495    instrument bass: HollowBass {96        gain -6dB97        repeat 4 {98            play D2 duration 3/899            play D2 duration 1/8 velocity 0.6100            play F2 duration 1/4101            play A2 duration 1/4102        }103    }104}105
Files main
Menu

Theme