  -- Mutable Instruments UGens test file
-- Restart SC after installing to pick up new SynthDefs
-- Test each synth one at a time with d1, hush between tests

-- =============================================
-- MiPlaits - Macro oscillator (16 engines)
-- =============================================

-- Engine 0: Virtual analog pair
d1 $ n "c5 e5 g5 c6" # s "miplaits" 
  # engine 0 # timbre 0.5 # morph 0.3 # harm 0.2

-- Engine 2: Waveshaping
d1 $ n "c4 [ef4 g4] af4 bf4" # s "miplaits" # engine 2 # timbre (slow 4 $ range 0.1 0.9 saw) # morph 0.5

-- Engine 4: FM
d1 $ n "c3 g3 c4 ef4" # s "miplaits" # engine 4 # harm (range 0.1 0.5 sine) # timbre 0.6 # morph 0.3

-- Engine 6: Chord
d1 $ slow 2 $ n "c4 f4 g4 c5" # s "miplaits" # engine 6 # harm 0.5 # timbre 0.5 # morph 0.3

-- Engine 8: Wavetable
d1 $ n "c4*4" # s "miplaits" # engine 8 # timbre (range 0 1 sine) # morph (slow 2 $ range 0 1 tri)

-- Engine 14: Modal
d1 $ n "c5 e5 g5 b5" # s "miplaits" # engine 14 # timbre 0.4 # morph 0.7 # harm 0.3

-- With internal LPG (set level > 0 to activate the built-in LPG)
d1 $ n "c4*8" # s "miplaits" # engine 0 # level 1 # decay 0.3 # lpg_colour 0.5 # timbre (range 0.2 0.8 sine)

hush

-- =============================================
-- MiRings - Resonator
-- =============================================

-- Model 0: Modal (bells / mallet)
d1 $ n "c5 e5 g5 c6" # s "mirings" # model 0 # struct 0.3 # bright 0.6 # damp 0.5 # pos 0.25

-- Model 1: Sympathetic strings
d1 $ slow 2 $ n "c4 g4 c5 e5" # s "mirings" # model 1 # struct 0.5 # bright 0.7 # damp 0.3

-- Model 2: Inharmonic strings
d1 $ n "c3 [~ g3] ef4 [~ c4]" # s "mirings" # model 2 # struct (range 0.1 0.5 sine) # bright 0.5

-- Model 3: FM
d1 $ n "c4 e4 g4 b4" # s "mirings" # model 3 # struct 0.4 # bright 0.6

-- Poly mode
d1 $ n "c4 e4 g4 b4" # s "mirings" # model 0 # poly 4 # struct 0.25 # bright 0.5 # damp 0.7

hush

-- =============================================
-- MiElements - Physical modeling
-- =============================================

-- Blow exciter (flute-like)
d1 $ slow 2 $ n "c4 e4 g4 c5" # s "mielements" # blow_level 0.8 # blow_timb 0.5 # flow 0.4 # geom 0.3 # bright 0.6

-- Strike exciter (mallet-like)
d1 $ n "c4 e4 g4 c5" # s "mielements" # strike_level 0.9 # strike_timb 0.5 # mallet 0.6 # geom 0.25 # bright 0.5

-- Both exciters
d1 $ slow 2 $ n "c3 g3 c4 e4" # s "mielements" # blow_level 0.4 # strike_level 0.6 # space 0.5

hush

-- =============================================
-- MiOmi - Dual oscillator FM + filters
-- =============================================

-- Clean FM
d1 $ slow 2 $ n "c4 ef4 g4 bf4" # s "miomi" # level1 0.5 # level2 0.3 # fm1 0.2 # omicutoff 0.7

-- Detuned pad
d1 $ slow 4 $ n "c3 f3 g3 bf3" # s "miomi" # detune 0.3 # level1 0.5 # level2 0.5 # omicutoff 0.5 # reson 0.2

-- Aggressive FM
d1 $ n "c3*4" # s "miomi" # fm1 (range 0 0.8 sine) # fm2 0.3 # fb 0.2 # omicutoff (range 0.3 0.9 sine)

hush

-- =============================================
-- MiWarps - Wave folder / ring mod
-- =============================================

-- Crossfade algo
d1 $ n "c4 e4 g4 c5" # s "miwarps" # algo 0 # timb (range 0 1 sine)

-- Frequency shift algo
d1 $ n "c3 g3 c4 e4" # s "miwarps" # algo 2 # timb 0.4 # lev1 0.6 # lev2 0.4

hush

-- =============================================
-- MiTides - Complex waveshaping oscillator
-- =============================================

d1 $ n "c4 e4 g4 c5" # s "mitides" # shape (range 0.2 0.8 sine) # slope 0.5 # smooth 0.5

hush

-- =============================================
-- Global Effects Tests
-- Apply on any orbit / pattern
-- =============================================

-- MiVerb (set verbgain > 0 to activate)
d1 $ n "c5 e5 ~ g5" # s "mirings" # model 0 # struct 0.3 # verbgain 1 # verbwet 0.7 # verbtime 0.8 # verbdamp 0.3

-- MiClouds granular (set cloudsgain > 0 to activate)
d1 $ n "c4 e4 g4 c5" # s "mirings" # cloudsgain 1 # cloudswet 0.5 # cloudssize 0.5 # cloudsdens 0.6 # cloudstex 0.7 # cloudspitch 0

-- MiRipples filter (set ripplesgain > 0 to activate)
d1 $ n "c3*8" # s "miplaits" # engine 0 # ripplesgain 1 # ripplescf (range 0.1 0.9 sine) # ripplesreson 0.5 # ripplesdrive 1.5

-- Stacking: MiPlaits through MiClouds
d1 $ slow 2 $ n "c4 ef4 g4 bf4" # s "miplaits" # engine 6 # timbre 0.5 # cloudsgain 1 # cloudswet 0.7 # cloudssize 0.8 # cloudsdens 0.5 # cloudsfb 0.3

hush

-- =============================================
-- Musical combos (on your Ardour stems)
-- =============================================

-- d1 kick, d4 bass: MiPlaits sub bass
d4 $ n "c2 ~ c2 [~ c2]" # s "miplaits" # engine 0 # timbre 0.1 # morph 0.1 # harm 0.05
  # lpg_colour 0.2 # level 1 # decay 0.4

-- d5 melody: MiRings bells
d5 $ n "c5 e5 g5 [b5 c6]" # s "mirings" # model 0 # struct 0.3 # bright 0.6 # damp 0.5
  # verbgain 0.5 # verbwet 0.6 # verbtime 0.7

-- d6 pad: MiOmi pad
d6 $ slow 4 $ n "<c4'min7 f4'maj7 g4'dom7 c4'min7>" # s "miomi"
  # detune 0.3 # level1 0.5 # level2 0.4 # omicutoff 0.5
  # verbgain 0.3 # verbwet 0.5 # verbtime 0.9

hush
