Repository Public
1// ORIX Sonata2// File: Examples/fm_bells.sonata3// Description: FM and modal synthesis side by side: a custom four-operator bell, a tubular bell with custom partials, and an FM bass.4//5// Author: Simon-Pierre Boucher6// Contact: contact@spboucher.ai7//8// expect: notes 309// expect: tracks 310// expect: duration 5.3333s11// expect: deterministic12instrument GlassBell {13 model fm14 algorithm 415 op1.ratio 116 op2.ratio 3.517 op2.level 0.5518 op2.decay 900ms19 op3.ratio 120 op4.ratio 7.0721 op4.level 0.322 op4.decay 150ms23 envelope adsr(attack: 1ms, decay: 0ms, sustain: 1, release: 1.5s)24}2526instrument Gamelan {27 model modal_percussion28 body bell29 // Mode frequencies as ratios of the fundamental.30 partials [1, 2.03, 2.71, 3.95, 5.4, 6.9]31 decay 1.632 hardness 0.733}3435composition "FM Bells" {36 tempo 90bpm37 key D pentatonic_major38 seed 113940 instrument bells: GlassBell {41 gain -10dB42 pan -0.343 let notes = scale(D5, pentatonic_major)44 repeat 16 {45 play choose(notes) duration 1/8 velocity 0.4 + random() * 0.546 }47 effects {48 delay dub(mix: 0.2)49 }50 }5152 instrument gamelan: Gamelan {53 gain -6dB54 pan 0.355 for n in [D4, A3, B3, F#4, E4, A3, D4, D3] {56 play n duration 1/457 }58 }5960 instrument bass: FMBass {61 gain -8dB62 repeat 2 {63 play D2 duration 3/864 play D2 duration 1/8 velocity 0.665 play A1 duration 1/266 }67 }6869 master {70 effects {71 reverb plate(mix: 0.2)72 }73 }74}75