Repository Public
1// ORIX Sonata2// File: Examples/st_intermodulation.sonata3// Description: A two-tone intermodulation test: 1000 Hz and 1100 Hz together, first clean, then through a saturator and then a hard clipper; in the spectrum the distorted versions grow difference tones at 100 Hz, 900 Hz and 1200 Hz that the clean one does not have.4//5// Author: Simon-Pierre Boucher6// Contact: contact@spboucher.ai7//8// category: Studies9// title: Two-Tone Test10// teaches: measuring nonlinearity, saturation versus hard clipping, one source through three chains11//12// expect: notes 313// expect: tracks 314// expect: duration 12.0000s15// expect: deterministic16instrument TwoTone {17 model patch18 release 20ms19 graph {20 node env = adsr(attack: 10ms, decay: 0ms, sustain: 1, release: 10ms)21 out (sine(freq: 1000Hz) + sine(freq: 1100Hz)) * env * 0.222 }23}2425composition "Two-Tone Test" {26 tempo 60bpm2728 instrument clean: TwoTone {29 play C4 duration 1/130 }3132 instrument saturated: TwoTone {33 rest 1/134 play C4 duration 1/135 effects {36 saturation hot(drive: 18dB)37 }38 }3940 instrument clipped: TwoTone {41 rest 2/142 play C4 duration 1/143 effects {44 distortion(mode: hard, drive: 24dB, tone: 20000Hz, output: -18dB)45 }46 }4748 master {49 peak_limit off50 }51}52