hsc3 0.8 → 0.21
raw patch · 1346 files changed
Files
- Help/Graph/adc-bit-reduction.hs +21/−0
- Help/Graph/adc-down-sample.hs +13/−0
- Help/Graph/adc-kabelscahden.hs +25/−0
- Help/Graph/adc-shepard-tones.hs +37/−0
- Help/Graph/bb-microhelix.hs +71/−0
- Help/Graph/cr-lucier.hs +78/−0
- Help/Graph/dm-shift-register.hs +55/−0
- Help/Graph/ds-sos-bell.hs +45/−0
- Help/Graph/es-tw-570012853274615808.hs +19/−0
- Help/Graph/f0-1-4Q6-p.hs +14/−0
- Help/Graph/f0-2012-04-19.hs +7/−0
- Help/Graph/f0-pkt-00.hs +9/−0
- Help/Graph/f0-pkt-07.hs +10/−0
- Help/Graph/f0-pkt-26.hs +16/−0
- Help/Graph/f0-pkt-28.hs +18/−0
- Help/Graph/f0-red-frik.hs +25/−0
- Help/Graph/f0-tw-0454598285861617665.hs +7/−0
- Help/Graph/f0-tw-0456384156159574016.hs +5/−0
- Help/Graph/f0-tw-0839296011982024704.hs +7/−0
- Help/Graph/f0-tw-1105496695637454848.hs +12/−0
- Help/Graph/f0-tw-1125557217086857216.hs +17/−0
- Help/Graph/f0-tw-1136928201886904320.hs +11/−0
- Help/Graph/f0-tw-1138498427241861122.hs +14/−0
- Help/Graph/f0-tw-1210118661022867458.hs +21/−0
- Help/Graph/f0-tw-1254441448327479299.hs +57/−0
- Help/Graph/f0-tw-1338987643057688579.hs +9/−0
- Help/Graph/f0-tw-1343283697840226307.hs +20/−0
- Help/Graph/f0-tw-1367808902457397250.hs +14/−0
- Help/Graph/f0-tw-15eN.hs +5/−0
- Help/Graph/f0-tw0011.hs +6/−0
- Help/Graph/f0-tw0014.hs +12/−0
- Help/Graph/f0-tw0020.hs +12/−0
- Help/Graph/f0-tw0028.hs +22/−0
- Help/Graph/f0-tw0030.hs +6/−0
- Help/Graph/f0-tw0033.hs +17/−0
- Help/Graph/f0-tw0041.hs +5/−0
- Help/Graph/f0-tw0045.hs +6/−0
- Help/Graph/f0-tw0049.hs +7/−0
- Help/Graph/f0-tw0051.hs +8/−0
- Help/Graph/f0-tw0077.hs +7/−0
- Help/Graph/f0-tw0084.hs +6/−0
- Help/Graph/f0-tw0120.hs +8/−0
- Help/Graph/f0-tw0121.hs +7/−0
- Help/Graph/f0-tw0125.hs +9/−0
- Help/Graph/f0-tw0134.hs +12/−0
- Help/Graph/f0-tw0220.hs +13/−0
- Help/Graph/f0-tw0224.hs +13/−0
- Help/Graph/f0-tw0225.hs +5/−0
- Help/Graph/jar-1-4Qx.hs +6/−0
- Help/Graph/jar-rk_20120422.hs +19/−0
- Help/Graph/jh-4157.hs +27/−0
- Help/Graph/jl-1-9.hs +13/−0
- Help/Graph/jl-bitwise.hs +7/−0
- Help/Graph/jl-dark-sea-horns.hs +15/−0
- Help/Graph/jl-jl-1-Z.hs +8/−0
- Help/Graph/jl-pwm-crossfade.hs +15/−0
- Help/Graph/jl-rain-thunder.hs +23/−0
- Help/Graph/jmcc-aleatoric-quartet.hs +38/−0
- Help/Graph/jmcc-alien-froggies.hs +20/−0
- Help/Graph/jmcc-alien-meadow.hs +9/−0
- Help/Graph/jmcc-analog-bubbles-mouse.hs +17/−0
- Help/Graph/jmcc-analog-bubbles.hs +5/−0
- Help/Graph/jmcc-analogue-daze.hs +33/−0
- Help/Graph/jmcc-babbling-brook.hs +18/−0
- Help/Graph/jmcc-bach-prelude.hs +16/−0
- Help/Graph/jmcc-berlin-1977.hs +47/−0
- Help/Graph/jmcc-birdies.hs +17/−0
- Help/Graph/jmcc-birds.hs +30/−0
- Help/Graph/jmcc-blips.hs +21/−0
- Help/Graph/jmcc-bouncing-objects.hs +25/−0
- Help/Graph/jmcc-bowed-string.hs +57/−0
- Help/Graph/jmcc-clustered-sines.hs +19/−0
- Help/Graph/jmcc-coolant.hs +13/−0
- Help/Graph/jmcc-cymbalism-accelerando.hs +25/−0
- Help/Graph/jmcc-cymbalism.hs +52/−0
- Help/Graph/jmcc-data-space.hs +26/−0
- Help/Graph/jmcc-deep-trip.hs +21/−0
- Help/Graph/jmcc-demanding-studies.hs +23/−0
- Help/Graph/jmcc-filter-input.hs +5/−0
- Help/Graph/jmcc-harmonic-swimming.hs +21/−0
- Help/Graph/jmcc-harmonic-tumbling.hs +19/−0
- Help/Graph/jmcc-hell-is-busy.hs +16/−0
- Help/Graph/jmcc-impulse-sequencer.hs +25/−0
- Help/Graph/jmcc-landon-rose.hs +27/−0
- Help/Graph/jmcc-lfo-modulation.hs +5/−0
- Help/Graph/jmcc-lots-o-sines.hs +15/−0
- Help/Graph/jmcc-metal-plate.hs +35/−0
- Help/Graph/jmcc-modal-space.hs +77/−0
- Help/Graph/jmcc-moto-rev.hs +4/−0
- Help/Graph/jmcc-narrow-band-filtered-crackle-noise.hs +27/−0
- Help/Graph/jmcc-noise-burst-sweep.hs +15/−0
- Help/Graph/jmcc-phase-modulation.hs +16/−0
- Help/Graph/jmcc-plucked-strings.hs +31/−0
- Help/Graph/jmcc-police-state.hs +23/−0
- Help/Graph/jmcc-pond-life.hs +27/−0
- Help/Graph/jmcc-pulsing-bottles.hs +15/−0
- Help/Graph/jmcc-rails.hs +21/−0
- Help/Graph/jmcc-random-panning-sines.hs +13/−0
- Help/Graph/jmcc-random-pulsations.hs +22/−0
- Help/Graph/jmcc-random-sine-waves.hs +14/−0
- Help/Graph/jmcc-resonant-dust.hs +13/−0
- Help/Graph/jmcc-resonators-harmonic-series.hs +57/−0
- Help/Graph/jmcc-reverberated-sine-percussion.hs +23/−0
- Help/Graph/jmcc-ring-modulated-klank.hs +17/−0
- Help/Graph/jmcc-sample-and-hold-liquidities.hs +26/−0
- Help/Graph/jmcc-saucer-base.hs +14/−0
- Help/Graph/jmcc-sawed-cymbals.hs +14/−0
- Help/Graph/jmcc-scratchy.hs +7/−0
- Help/Graph/jmcc-sidereal-time.hs +21/−0
- Help/Graph/jmcc-snare-909.hs +37/−0
- Help/Graph/jmcc-spe.hs +28/−0
- Help/Graph/jmcc-sprinkler-mouse.hs +11/−0
- Help/Graph/jmcc-sprinkler.hs +12/−0
- Help/Graph/jmcc-strummable-guitar.hs +45/−0
- Help/Graph/jmcc-strummable-silk.hs +53/−0
- Help/Graph/jmcc-sweepy-noise.hs +15/−0
- Help/Graph/jmcc-swept-resonant-noise.hs +55/−0
- Help/Graph/jmcc-synthetic-piano.hs +45/−0
- Help/Graph/jmcc-tank.hs +91/−0
- Help/Graph/jmcc-theremin.hs +16/−0
- Help/Graph/jmcc-tremulate.hs +33/−0
- Help/Graph/jmcc-uplink.hs +18/−0
- Help/Graph/jmcc-what-was-i-thinking.hs +25/−0
- Help/Graph/jmcc-why-supercollider.hs +12/−0
- Help/Graph/jmcc-wind-metals.hs +67/−0
- Help/Graph/jmcc-zizle.hs +39/−0
- Help/Graph/jp-record-scratcher.hs +14/−0
- Help/Graph/ljp-one-line.hs +6/−0
- Help/Graph/lkp-chaos-engine.hs +5/−0
- Help/Graph/mn-k2ws.hs +21/−0
- Help/Graph/mp-rm-octaver.hs +7/−0
- Help/Graph/my-mouse.hs +6/−0
- Help/Graph/np-pebble-beach.hs +47/−0
- Help/Graph/nv-ml-2014-06-03.hs +7/−0
- Help/Graph/nv-tw-01.hs +15/−0
- Help/Graph/nv-tw-2013-01-11.hs +21/−0
- Help/Graph/nv-tw-2013-12-04.hs +10/−0
- Help/Graph/nv-tw-2014-02-21.hs +16/−0
- Help/Graph/nv-tw-40.hs +18/−0
- Help/Graph/nv-tw-41.hs +15/−0
- Help/Graph/nv-tw-43.hs +8/−0
- Help/Graph/nv-tw-52.hs +24/−0
- Help/Graph/or-gong.hs +60/−0
- Help/Graph/pc-thx.hs +29/−0
- Help/Graph/pj-forest-sounds-m.hs +14/−0
- Help/Graph/pmi.hs +12/−0
- Help/Graph/rb-hh-808.hs +21/−0
- Help/Graph/rd-20060909.hs +38/−0
- Help/Graph/rd-20060910.hs +20/−0
- Help/Graph/rd-20060911.hs +21/−0
- Help/Graph/rd-20060914.hs +30/−0
- Help/Graph/rd-20060918.hs +45/−0
- Help/Graph/rd-20060921.hs +37/−0
- Help/Graph/rd-20060925.hs +31/−0
- Help/Graph/rd-20060928.hs +35/−0
- Help/Graph/rd-20061007.hs +23/−0
- Help/Graph/rd-20061008.hs +31/−0
- Help/Graph/rd-20061015.hs +33/−0
- Help/Graph/rd-20061017.hs +328/−0
- Help/Graph/rd-20061022.hs +27/−0
- Help/Graph/rd-20061028.hs +25/−0
- Help/Graph/rd-20061030.hs +33/−0
- Help/Graph/rd-20070423.hs +39/−0
- Help/Graph/rd-lg-timed.hs +29/−0
- Help/Graph/rd-tgrn.hs +24/−0
- Help/Graph/rd-trmlo.hs +73/−0
- Help/Graph/sc-bottle-m.hs +33/−0
- Help/Graph/sp-insects-m.hs +19/−0
- Help/Graph/tb-1-4Tw.hs +6/−0
- Help/Graph/tm-drummer.hs +21/−0
- Help/Graph/tm-tw-463992770596577280.hs +13/−0
- Help/Graph/tw-tw-01.hs +6/−0
- Help/Graph/tw-tw-02.hs +14/−0
- Help/Graph/unk-laser-bubble.hs +24/−0
- Help/Graph/unk-m21360.hs +41/−0
- Help/Graph/unk-no-input-fft.hs +21/−0
- Help/Graph/unk-sin-gliss.hs +7/−0
- Help/Graph/unk-train.hs +38/−0
- Help/Notes/mul-add.help.hs +23/−0
- Help/Notes/sample-accuracy.help.hs +54/−0
- Help/Notes/signal-effect-group.help.hs +7/−0
- Help/Nrt/nrt.02.hs +16/−0
- Help/Server/b_alloc.help.hs +23/−0
- Help/Server/b_alloc.help.lhs +0/−10
- Help/Server/b_allocRead.help.hs +62/−0
- Help/Server/b_allocRead.help.lhs +0/−15
- Help/Server/b_allocReadChannel.help.hs +34/−0
- Help/Server/b_close.help.hs +1/−0
- Help/Server/b_close.help.lhs +0/−6
- Help/Server/b_fill.help.hs +1/−0
- Help/Server/b_fill.help.lhs +0/−13
- Help/Server/b_free.help.hs +11/−0
- Help/Server/b_free.help.lhs +0/−8
- Help/Server/b_gen.help.hs +32/−0
- Help/Server/b_gen.help.lhs +0/−9
- Help/Server/b_get.help.hs +1/−0
- Help/Server/b_get.help.lhs +0/−8
- Help/Server/b_getn.help.hs +45/−0
- Help/Server/b_getn.help.lhs +0/−11
- Help/Server/b_info.help.hs +3/−0
- Help/Server/b_query.help.hs +48/−0
- Help/Server/b_query.help.lhs +0/−15
- Help/Server/b_read.help.hs +2/−0
- Help/Server/b_read.help.lhs +0/−17
- Help/Server/b_readChannel.help.hs +2/−0
- Help/Server/b_set.help.hs +1/−0
- Help/Server/b_set.help.lhs +0/−10
- Help/Server/b_setn.help.hs +1/−0
- Help/Server/b_setn.help.lhs +0/−14
- Help/Server/b_write.help.hs +1/−0
- Help/Server/b_write.help.lhs +0/−27
- Help/Server/b_zero.help.hs +1/−0
- Help/Server/b_zero.help.lhs +0/−8
- Help/Server/c_fill.help.hs +1/−0
- Help/Server/c_fill.help.lhs +0/−11
- Help/Server/c_get.help.hs +14/−0
- Help/Server/c_get.help.lhs +0/−8
- Help/Server/c_getn.help.hs +19/−0
- Help/Server/c_getn.help.lhs +0/−9
- Help/Server/c_set.help.hs +1/−0
- Help/Server/c_set.help.lhs +0/−9
- Help/Server/c_setn.help.hs +1/−0
- Help/Server/c_setn.help.lhs +0/−13
- Help/Server/clearSched.help.hs +1/−0
- Help/Server/clearSched.help.lhs +0/−3
- Help/Server/d_free.help.hs +1/−0
- Help/Server/d_free.help.lhs +0/−7
- Help/Server/d_load.help.hs +1/−0
- Help/Server/d_load.help.lhs +0/−9
- Help/Server/d_loadDir.help.hs +1/−0
- Help/Server/d_loadDir.help.lhs +0/−9
- Help/Server/d_recv.help.hs +1/−0
- Help/Server/d_recv.help.lhs +0/−9
- Help/Server/dumpOSC.help.hs +15/−0
- Help/Server/dumpOSC.help.lhs +0/−13
- Help/Server/g_deepFree.help.hs +1/−0
- Help/Server/g_deepFree.help.lhs +0/−9
- Help/Server/g_freeAll.help.hs +8/−0
- Help/Server/g_freeAll.help.lhs +0/−7
- Help/Server/g_head.help.hs +1/−0
- Help/Server/g_head.help.lhs +0/−8
- Help/Server/g_new.help.hs +12/−0
- Help/Server/g_new.help.lhs +0/−13
- Help/Server/g_queryTree.help.hs +43/−0
- Help/Server/g_tail.help.hs +1/−0
- Help/Server/g_tail.help.lhs +0/−8
- Help/Server/n_after.help.hs +1/−0
- Help/Server/n_after.help.lhs +0/−9
- Help/Server/n_before.help.hs +1/−0
- Help/Server/n_before.help.lhs +0/−9
- Help/Server/n_fill.help.hs +1/−0
- Help/Server/n_fill.help.lhs +0/−13
- Help/Server/n_free.help.hs +1/−0
- Help/Server/n_free.help.lhs +0/−9
- Help/Server/n_map.help.hs +1/−0
- Help/Server/n_map.help.lhs +0/−14
- Help/Server/n_mapn.help.hs +31/−0
- Help/Server/n_mapn.help.lhs +0/−16
- Help/Server/n_query.help.hs +21/−0
- Help/Server/n_query.help.lhs +0/−10
- Help/Server/n_run.help.hs +1/−0
- Help/Server/n_run.help.lhs +0/−11
- Help/Server/n_set.help.hs +2/−0
- Help/Server/n_set.help.lhs +0/−11
- Help/Server/n_setn.help.hs +5/−0
- Help/Server/n_setn.help.lhs +0/−15
- Help/Server/n_trace.help.hs +13/−0
- Help/Server/n_trace.help.lhs +0/−10
- Help/Server/notify.help.hs +17/−0
- Help/Server/notify.help.lhs +0/−9
- Help/Server/quit.help.hs +1/−0
- Help/Server/quit.help.lhs +0/−7
- Help/Server/s_get.help.hs +1/−0
- Help/Server/s_get.help.lhs +0/−8
- Help/Server/s_getn.help.hs +1/−0
- Help/Server/s_getn.help.lhs +0/−10
- Help/Server/s_new.help.hs +2/−0
- Help/Server/s_new.help.lhs +0/−38
- Help/Server/s_newargs.help.lhs +0/−32
- Help/Server/s_noid.help.hs +1/−0
- Help/Server/s_noid.help.lhs +0/−11
- Help/Server/status.help.hs +5/−0
- Help/Server/status.help.lhs +0/−16
- Help/Server/sync.help.hs +1/−0
- Help/Server/sync.help.lhs +0/−9
- Help/Server/tr.help.hs +1/−0
- Help/Server/tr.help.lhs +0/−13
- Help/Server/u_cmd.help.hs +1/−0
- Help/Server/u_cmd.help.lhs +0/−9
- Help/UGen/Analysis/amplitude.help.lhs +0/−18
- Help/UGen/Analysis/compander.help.lhs +0/−77
- Help/UGen/Analysis/pitch.help.lhs +0/−32
- Help/UGen/Analysis/runningSum.help.lhs +0/−13
- Help/UGen/Analysis/slope.help.lhs +0/−21
- Help/UGen/Analysis/zeroCrossing.help.lhs +0/−15
- Help/UGen/Buffer/bufAllpassC.help.lhs +0/−28
- Help/UGen/Buffer/bufAllpassL.help.lhs +0/−1
- Help/UGen/Buffer/bufAllpassN.help.lhs +0/−1
- Help/UGen/Buffer/bufChannels.help.lhs +0/−5
- Help/UGen/Buffer/bufCombC.help.lhs +0/−26
- Help/UGen/Buffer/bufCombL.help.lhs +0/−1
- Help/UGen/Buffer/bufCombN.help.lhs +0/−1
- Help/UGen/Buffer/bufDelayC.help.lhs +0/−24
- Help/UGen/Buffer/bufDelayL.help.lhs +0/−1
- Help/UGen/Buffer/bufDelayN.help.lhs +0/−1
- Help/UGen/Buffer/bufDur.help.lhs +0/−12
- Help/UGen/Buffer/bufFrames.help.lhs +0/−17
- Help/UGen/Buffer/bufRateScale.help.lhs +0/−13
- Help/UGen/Buffer/bufRd.help.lhs +0/−28
- Help/UGen/Buffer/bufSampleRate.help.lhs +0/−14
- Help/UGen/Buffer/detectIndex.help.lhs +0/−22
- Help/UGen/Buffer/index.help.lhs +0/−21
- Help/UGen/Buffer/indexInBetween.help.lhs +0/−23
- Help/UGen/Buffer/osc.help.lhs +0/−48
- Help/UGen/Buffer/playBuf.help.lhs +0/−74
- Help/UGen/Buffer/recordBuf.help.lhs +0/−1
- Help/UGen/Buffer/vOsc.help.lhs +0/−51
- Help/UGen/Chaos/crackle.help.lhs +0/−15
- Help/UGen/Chaos/cuspL.help.lhs +0/−31
- Help/UGen/Chaos/cuspN.help.lhs +0/−1
- Help/UGen/Chaos/fbSineC.help.lhs +0/−54
- Help/UGen/Chaos/fbSineL.help.lhs +0/−1
- Help/UGen/Chaos/fbSineN.help.lhs +0/−1
- Help/UGen/Chaos/henonC.help.lhs +0/−1
- Help/UGen/Chaos/henonL.help.lhs +0/−1
- Help/UGen/Chaos/henonN.help.lhs +0/−46
- Help/UGen/Chaos/latoocarfianC.help.lhs +0/−42
- Help/UGen/Chaos/linCongC.help.lhs +0/−36
- Help/UGen/Chaos/linCongL.help.lhs +0/−1
- Help/UGen/Chaos/linCongN.help.lhs +0/−1
- Help/UGen/Chaos/logistic.help.lhs +0/−9
- Help/UGen/Chaos/lorenzL.help.lhs +0/−45
- Help/UGen/Chaos/quadC.help.lhs +0/−1
- Help/UGen/Chaos/quadL.help.lhs +0/−1
- Help/UGen/Chaos/quadN.help.lhs +0/−22
- Help/UGen/Chaos/rossler.help.lhs +0/−9
- Help/UGen/Control/mrg2.help.lhs +0/−28
- Help/UGen/Demand/dbrown.help.lhs +0/−21
- Help/UGen/Demand/dbufrd.help.lhs +0/−40
- Help/UGen/Demand/dbufwr.help.lhs +0/−31
- Help/UGen/Demand/demand.help.lhs +0/−31
- Help/UGen/Demand/demandEnvGen.help.lhs +0/−41
- Help/UGen/Demand/dgeom.help.lhs +0/−17
- Help/UGen/Demand/dibrown.help.lhs +0/−1
- Help/UGen/Demand/diwhite.help.lhs +0/−1
- Help/UGen/Demand/drand.help.lhs +0/−18
- Help/UGen/Demand/dseq.help.lhs +0/−22
- Help/UGen/Demand/dser.help.lhs +0/−14
- Help/UGen/Demand/dseries.help.lhs +0/−17
- Help/UGen/Demand/dstutter.help.lhs +0/−15
- Help/UGen/Demand/dswitch.help.lhs +0/−34
- Help/UGen/Demand/dswitch1.help.lhs +0/−16
- Help/UGen/Demand/duty.help.lhs +0/−35
- Help/UGen/Demand/dwhite.help.lhs +0/−20
- Help/UGen/Demand/dxrand.help.lhs +0/−1
- Help/UGen/Demand/tDuty.help.lhs +0/−55
- Help/UGen/DiskIO/diskIn.help.lhs +0/−23
- Help/UGen/DiskIO/vDiskIn.help.lhs +0/−24
- Help/UGen/Envelope/detectSilence.help.lhs +0/−10
- Help/UGen/Envelope/done.help.lhs +0/−12
- Help/UGen/Envelope/envCoord.help.lhs +0/−11
- Help/UGen/Envelope/envGen.help.lhs +0/−32
- Help/UGen/Envelope/envLinen.help.lhs +0/−9
- Help/UGen/Envelope/envPerc.help.lhs +0/−9
- Help/UGen/Envelope/envSine.help.lhs +0/−10
- Help/UGen/Envelope/envTrapezoid.help.lhs +0/−9
- Help/UGen/Envelope/free.help.lhs +0/−17
- Help/UGen/Envelope/freeSelf.help.lhs +0/−11
- Help/UGen/Envelope/freeSelfWhenDone.help.lhs +0/−13
- Help/UGen/Envelope/line.help.lhs +0/−15
- Help/UGen/Envelope/linen.help.lhs +0/−17
- Help/UGen/Envelope/pause.help.lhs +0/−24
- Help/UGen/Envelope/pauseSelf.help.lhs +0/−14
- Help/UGen/Envelope/pauseSelfWhenDone.help.lhs +0/−18
- Help/UGen/Envelope/xLine.help.lhs +0/−20
- Help/UGen/External/atsNoiSynth.help.lhs +0/−38
- Help/UGen/External/atsSynth.help.lhs +0/−29
- Help/UGen/External/ay.help.lhs +0/−68
- Help/UGen/External/fm7.help.lhs +0/−109
- Help/UGen/External/lpcSynth.help.lhs +0/−44
- Help/UGen/External/lpcVals.help.lhs +0/−1
- Help/UGen/External/membraneCircle.help.lhs +0/−27
- Help/UGen/External/membraneHexagon.help.lhs +0/−1
- Help/UGen/External/pv_Invert.help.lhs +0/−12
- Help/UGen/External/stkBowed.help.lhs +0/−4
- Help/UGen/External/stkFlute.help.lhs +0/−5
- Help/UGen/External/stkMandolin.help.lhs +0/−25
- Help/UGen/External/stkModalBar.help.lhs +0/−25
- Help/UGen/External/stkShakers.help.lhs +0/−24
- Help/UGen/External/vosim.help.lhs +0/−34
- Help/UGen/FFT/convolution.help.lhs +0/−13
- Help/UGen/FFT/fft.help.lhs +0/−23
- Help/UGen/FFT/ifft.help.lhs +0/−9
- Help/UGen/FFT/packFFT.help.lhs +0/−54
- Help/UGen/FFT/partConv.help.lhs +0/−57
- Help/UGen/FFT/pv_BinScramble.help.lhs +0/−23
- Help/UGen/FFT/pv_BinShift.help.lhs +0/−15
- Help/UGen/FFT/pv_BinWipe.help.lhs +0/−27
- Help/UGen/FFT/pv_BrickWall.help.lhs +0/−11
- Help/UGen/FFT/pv_ConformalMap.help.lhs +0/−30
- Help/UGen/FFT/pv_Copy.help.lhs +0/−20
- Help/UGen/FFT/pv_Diffuser.help.lhs +0/−19
- Help/UGen/FFT/pv_LocalMax.help.lhs +0/−19
- Help/UGen/FFT/pv_MagAbove.help.lhs +0/−26
- Help/UGen/FFT/pv_MagBelow.help.lhs +0/−26
- Help/UGen/FFT/pv_MagClip.help.lhs +0/−25
- Help/UGen/FFT/pv_MagFreeze.help.lhs +0/−25
- Help/UGen/FFT/pv_RandComb.help.lhs +0/−14
- Help/UGen/FFT/pv_RandWipe.help.lhs +0/−25
- Help/UGen/FFT/pv_RectComb.help.lhs +0/−15
- Help/UGen/FFT/pvcollect.help.lhs +0/−40
- Help/UGen/Filter/allpassC.help.lhs +0/−1
- Help/UGen/Filter/allpassL.help.lhs +0/−1
- Help/UGen/Filter/allpassN.help.lhs +0/−45
- Help/UGen/Filter/bBandPass.help.lhs +0/−13
- Help/UGen/Filter/bBandStop.help.lhs +0/−13
- Help/UGen/Filter/bHiPass.help.lhs +0/−14
- Help/UGen/Filter/bHiShelf.help.lhs +0/−22
- Help/UGen/Filter/bLowPass.help.lhs +0/−30
- Help/UGen/Filter/bLowShelf.help.lhs +0/−24
- Help/UGen/Filter/bPeakEQ.help.lhs +0/−20
- Help/UGen/Filter/bpf.help.lhs +0/−17
- Help/UGen/Filter/bpz2.help.lhs +0/−7
- Help/UGen/Filter/brf.help.lhs +0/−6
- Help/UGen/Filter/clip.help.lhs +0/−6
- Help/UGen/Filter/combC.help.lhs +0/−1
- Help/UGen/Filter/combL.help.lhs +0/−1
- Help/UGen/Filter/combN.help.lhs +0/−36
- Help/UGen/Filter/decay.help.lhs +0/−13
- Help/UGen/Filter/decay2.help.lhs +0/−19
- Help/UGen/Filter/degreeToKey.help.lhs +0/−25
- Help/UGen/Filter/delay1.help.lhs +0/−6
- Help/UGen/Filter/delay2.help.lhs +0/−6
- Help/UGen/Filter/delayC.help.lhs +0/−1
- Help/UGen/Filter/delayL.help.lhs +0/−1
- Help/UGen/Filter/delayN.help.lhs +0/−25
- Help/UGen/Filter/formlet.help.lhs +0/−13
- Help/UGen/Filter/fos.help.lhs +0/−13
- Help/UGen/Filter/freeVerb.help.lhs +0/−24
- Help/UGen/Filter/freqShift.help.lhs +0/−40
- Help/UGen/Filter/hasher.help.lhs +0/−8
- Help/UGen/Filter/hpf.help.lhs +0/−6
- Help/UGen/Filter/hpz1.help.lhs +0/−6
- Help/UGen/Filter/hpz2.help.lhs +0/−6
- Help/UGen/Filter/klank.help.lhs +0/−39
- Help/UGen/Filter/lag.help.lhs +0/−6
- Help/UGen/Filter/lag2.help.lhs +0/−6
- Help/UGen/Filter/lag3.help.lhs +0/−6
- Help/UGen/Filter/latch.help.lhs +0/−26
- Help/UGen/Filter/leakDC.help.lhs +0/−7
- Help/UGen/Filter/limiter.help.lhs +0/−7
- Help/UGen/Filter/linExp.help.lhs +0/−20
- Help/UGen/Filter/linLin.help.lhs +0/−19
- Help/UGen/Filter/lpf.help.lhs +0/−11
- Help/UGen/Filter/lpz1.help.lhs +0/−6
- Help/UGen/Filter/lpz2.help.lhs +0/−6
- Help/UGen/Filter/mantissaMask.help.lhs +0/−11
- Help/UGen/Filter/median.help.lhs +0/−25
- Help/UGen/Filter/moogFF.help.lhs +0/−36
- Help/UGen/Filter/normalizer.help.lhs +0/−11
- Help/UGen/Filter/onePole.help.lhs +0/−17
- Help/UGen/Filter/oneZero.help.lhs +0/−13
- Help/UGen/Filter/pitchShift.help.lhs +0/−7
- Help/UGen/Filter/pluck.help.lhs +0/−45
- Help/UGen/Filter/ramp.help.lhs +0/−16
- Help/UGen/Filter/resonz.help.lhs +0/−37
- Help/UGen/Filter/rhpf.help.lhs +0/−8
- Help/UGen/Filter/ringz.help.lhs +0/−33
- Help/UGen/Filter/rlpf.help.lhs +0/−13
- Help/UGen/Filter/select.help.lhs +0/−20
- Help/UGen/Filter/shaper.help.lhs +0/−16
- Help/UGen/Filter/slew.help.lhs +0/−7
- Help/UGen/Filter/sos.help.lhs +0/−15
- Help/UGen/Filter/twoPole.help.lhs +0/−14
- Help/UGen/Filter/twoZero.help.lhs +0/−9
- Help/UGen/Filter/wrapIndex.help.lhs +0/−19
- Help/UGen/Granular/grainBuf.help.lhs +0/−46
- Help/UGen/Granular/grainFM.help.lhs +0/−38
- Help/UGen/Granular/grainIn.help.lhs +0/−30
- Help/UGen/Granular/grainSin.help.lhs +0/−30
- Help/UGen/Granular/warp1.help.lhs +0/−43
- Help/UGen/IO/in.help.lhs +0/−32
- Help/UGen/IO/inFeedback.help.lhs +0/−61
- Help/UGen/IO/inTrig.help.lhs +0/−19
- Help/UGen/IO/keyState.help.lhs +0/−11
- Help/UGen/IO/lagIn.help.lhs +0/−12
- Help/UGen/IO/localBuf.help.lhs +0/−81
- Help/UGen/IO/localIn.help.lhs +0/−20
- Help/UGen/IO/localOut.help.lhs +0/−38
- Help/UGen/IO/mouseButton.help.lhs +0/−8
- Help/UGen/IO/mouseX.help.lhs +0/−9
- Help/UGen/IO/mouseY.help.lhs +0/−10
- Help/UGen/IO/offsetOut.help.lhs +0/−14
- Help/UGen/IO/out.help.lhs +0/−9
- Help/UGen/IO/replaceOut.help.lhs +0/−17
- Help/UGen/IO/soundIn.help.lhs +0/−14
- Help/UGen/IO/xOut.help.lhs +0/−13
- Help/UGen/Information/controlRate.help.lhs +0/−1
- Help/UGen/Information/numAudioBuses.help.lhs +0/−1
- Help/UGen/Information/numBuffers.help.lhs +0/−1
- Help/UGen/Information/numControlBuses.help.lhs +0/−1
- Help/UGen/Information/numInputBuses.help.lhs +0/−1
- Help/UGen/Information/numOutputBuses.help.lhs +0/−1
- Help/UGen/Information/numRunningSynths.help.lhs +0/−5
- Help/UGen/Information/radiansPerSample.help.lhs +0/−2
- Help/UGen/Information/sampleDur.help.lhs +0/−3
- Help/UGen/Information/sampleRate.help.lhs +0/−15
- Help/UGen/Information/subsampleOffset.help.lhs +0/−34
- Help/UGen/MachineListening/beatTrack.help.lhs +0/−60
- Help/UGen/MachineListening/loudness.help.lhs +0/−44
- Help/UGen/MachineListening/onsets.help.lhs +0/−102
- Help/UGen/Math/abs.help.lhs +0/−7
- Help/UGen/Math/absDif.help.lhs +0/−10
- Help/UGen/Math/add.help.lhs +0/−11
- Help/UGen/Math/amClip.help.lhs +0/−8
- Help/UGen/Math/atan2.help.lhs +0/−20
- Help/UGen/Math/clip2.help.lhs +0/−10
- Help/UGen/Math/dbAmp.help.lhs +0/−9
- Help/UGen/Math/difSqr.help.lhs +0/−17
- Help/UGen/Math/distort.help.lhs +0/−9
- Help/UGen/Math/eq.help.lhs +0/−2
- Help/UGen/Math/excess.help.lhs +0/−14
- Help/UGen/Math/fdiv.help.lhs +0/−11
- Help/UGen/Math/fold2.help.lhs +0/−9
- Help/UGen/Math/gt.help.lhs +0/−25
- Help/UGen/Math/hypot.help.lhs +0/−28
- Help/UGen/Math/max.help.lhs +0/−9
- Help/UGen/Math/mod.help.lhs +0/−7
- Help/UGen/Math/mul.help.lhs +0/−20
- Help/UGen/Math/pow.help.lhs +0/−24
- Help/UGen/Math/ring1.help.lhs +0/−19
- Help/UGen/Math/roundUp.help.lhs +0/−12
- Help/UGen/Math/scaleNeg.help.lhs +0/−9
- Help/UGen/Math/softClip.help.lhs +0/−10
- Help/UGen/Math/sumSqr.help.lhs +0/−16
- Help/UGen/Math/thresh.help.lhs +0/−8
- Help/UGen/Noise/brownNoise.help.lhs +0/−14
- Help/UGen/Noise/clipNoise.help.lhs +0/−10
- Help/UGen/Noise/coinGate.help.lhs +0/−10
- Help/UGen/Noise/dust.help.lhs +0/−11
- Help/UGen/Noise/dust2.help.lhs +0/−12
- Help/UGen/Noise/expRand.help.lhs +0/−10
- Help/UGen/Noise/grayNoise.help.lhs +0/−9
- Help/UGen/Noise/iRand.help.lhs +0/−10
- Help/UGen/Noise/lfClipNoise.help.lhs +0/−20
- Help/UGen/Noise/lfNoise0.help.lhs +0/−19
- Help/UGen/Noise/lfNoise1.help.lhs +0/−23
- Help/UGen/Noise/lfNoise2.help.lhs +0/−20
- Help/UGen/Noise/lfdClipNoise.help.lhs +0/−34
- Help/UGen/Noise/lfdNoise0.help.lhs +0/−39
- Help/UGen/Noise/lfdNoise1.help.lhs +0/−5
- Help/UGen/Noise/lfdNoise3.help.lhs +0/−5
- Help/UGen/Noise/linRand.help.lhs +0/−11
- Help/UGen/Noise/nRand.help.lhs +0/−15
- Help/UGen/Noise/pinkNoise.help.lhs +0/−13
- Help/UGen/Noise/rand.help.lhs +0/−13
- Help/UGen/Noise/randID.help.lhs +0/−8
- Help/UGen/Noise/randSeed.help.lhs +0/−8
- Help/UGen/Noise/tExpRand.help.lhs +0/−11
- Help/UGen/Noise/tRand.help.lhs +0/−10
- Help/UGen/Noise/tiRand.help.lhs +0/−15
- Help/UGen/Noise/whiteNoise.help.lhs +0/−29
- Help/UGen/Oscillator/blip.help.lhs +0/−31
- Help/UGen/Oscillator/fSinOsc.help.lhs +0/−26
- Help/UGen/Oscillator/formant.help.lhs +0/−22
- Help/UGen/Oscillator/gendy1.help.lhs +0/−178
- Help/UGen/Oscillator/impulse.help.lhs +0/−17
- Help/UGen/Oscillator/klang.help.lhs +0/−11
- Help/UGen/Oscillator/lfCub.help.lhs +0/−31
- Help/UGen/Oscillator/lfPar.help.lhs +0/−5
- Help/UGen/Oscillator/lfPulse.help.lhs +0/−17
- Help/UGen/Oscillator/lfSaw.help.lhs +0/−21
- Help/UGen/Oscillator/lfTri.help.lhs +0/−12
- Help/UGen/Oscillator/oscN.help.lhs +0/−10
- Help/UGen/Oscillator/pmOsc.help.lhs +0/−23
- Help/UGen/Oscillator/pulse.help.lhs +0/−26
- Help/UGen/Oscillator/saw.help.lhs +0/−12
- Help/UGen/Oscillator/silent.help.lhs +0/−7
- Help/UGen/Oscillator/sinOsc.help.lhs +0/−33
- Help/UGen/Oscillator/syncSaw.help.lhs +0/−14
- Help/UGen/Oscillator/tChoose.help.lhs +0/−19
- Help/UGen/Oscillator/tGrains.help.lhs +0/−67
- Help/UGen/Oscillator/twChoose.help.lhs +0/−23
- Help/UGen/Oscillator/twindex.help.lhs +0/−23
- Help/UGen/Oscillator/varSaw.help.lhs +0/−13
- Help/UGen/Panner/linPan2.help.lhs +0/−10
- Help/UGen/Panner/pan2.help.lhs +0/−14
- Help/UGen/Panner/rotate2.help.lhs +0/−35
- Help/UGen/Panner/splay.help.lhs +0/−19
- Help/UGen/Trigger/gate.help.lhs +0/−8
- Help/UGen/Trigger/inRange.help.lhs +0/−17
- Help/UGen/Trigger/lastValue.help.lhs +0/−12
- Help/UGen/Trigger/mostChange.help.lhs +0/−10
- Help/UGen/Trigger/peak.help.lhs +0/−11
- Help/UGen/Trigger/phasor.help.lhs +0/−23
- Help/UGen/Trigger/pulseCount.help.lhs +0/−9
- Help/UGen/Trigger/pulseDivider.help.lhs +0/−13
- Help/UGen/Trigger/runningMax.help.lhs +0/−15
- Help/UGen/Trigger/runningMin.help.lhs +0/−23
- Help/UGen/Trigger/sendTrig.help.lhs +0/−26
- Help/UGen/Trigger/setResetFF.help.lhs +0/−17
- Help/UGen/Trigger/stepper.help.lhs +0/−57
- Help/UGen/Trigger/sweep.help.lhs +0/−42
- Help/UGen/Trigger/tDelay.help.lhs +0/−14
- Help/UGen/Trigger/timer.help.lhs +0/−11
- Help/UGen/Trigger/toggleFF.help.lhs +0/−12
- Help/UGen/Trigger/trig.help.lhs +0/−9
- Help/UGen/Trigger/trig1.help.lhs +0/−8
- Help/Ugen/abs.help.hs +2/−0
- Help/Ugen/absDif.help.hs +2/−0
- Help/Ugen/acos.help.hs +3/−0
- Help/Ugen/add.help.hs +13/−0
- Help/Ugen/allpassC.help.hs +10/−0
- Help/Ugen/allpassL.help.hs +4/−0
- Help/Ugen/allpassN.help.hs +16/−0
- Help/Ugen/amClip.help.hs +2/−0
- Help/Ugen/ampComp.help.hs +12/−0
- Help/Ugen/ampDb.help.hs +2/−0
- Help/Ugen/amplitude.help.hs +14/−0
- Help/Ugen/analogBassDrum.help.hs +20/−0
- Help/Ugen/analogPhaser.help.hs +25/−0
- Help/Ugen/analogPhaserMod.help.hs +7/−0
- Help/Ugen/analogSnareDrum.help.hs +18/−0
- Help/Ugen/analogTape.help.hs +22/−0
- Help/Ugen/analogVintageDistortion.help.hs +14/−0
- Help/Ugen/arrayMax.help.hs +4/−0
- Help/Ugen/arrayMin.help.hs +4/−0
- Help/Ugen/asin.help.hs +3/−0
- Help/Ugen/atan.help.hs +2/−0
- Help/Ugen/atan2.help.hs +9/−0
- Help/Ugen/atari2600.help.hs +27/−0
- Help/Ugen/audioMSG.help.hs +5/−0
- Help/Ugen/ay.help.hs +30/−0
- Help/Ugen/bAllPass.help.hs +15/−0
- Help/Ugen/bBandPass.help.hs +12/−0
- Help/Ugen/bBandStop.help.hs +18/−0
- Help/Ugen/bGen.help.hs +20/−0
- Help/Ugen/bHiPass.help.hs +12/−0
- Help/Ugen/bHiPass4.help.hs +5/−0
- Help/Ugen/bHiShelf.help.hs +18/−0
- Help/Ugen/bLowPass.help.hs +24/−0
- Help/Ugen/bLowPass4.help.hs +5/−0
- Help/Ugen/bLowShelf.help.hs +21/−0
- Help/Ugen/bMoog.help.hs +19/−0
- Help/Ugen/bPeakEQ.help.hs +40/−0
- Help/Ugen/balance2.help.hs +33/−0
- Help/Ugen/beatTrack.help.hs +11/−0
- Help/Ugen/bezier.help.hs +52/−0
- Help/Ugen/blOsc.help.hs +18/−0
- Help/Ugen/blip.help.hs +28/−0
- Help/Ugen/blitB3.help.hs +13/−0
- Help/Ugen/blitB3Saw.help.hs +11/−0
- Help/Ugen/blitB3Square.help.hs +19/−0
- Help/Ugen/blitB3Tri.help.hs +27/−0
- Help/Ugen/blockSize.help.hs +5/−0
- Help/Ugen/bpf.help.hs +26/−0
- Help/Ugen/bpz2.help.hs +2/−0
- Help/Ugen/brf.help.hs +5/−0
- Help/Ugen/brownNoise.help.hs +11/−0
- Help/Ugen/brz2.help.hs +4/−0
- Help/Ugen/bufAllpassC.help.hs +6/−0
- Help/Ugen/bufAllpassL.help.hs +6/−0
- Help/Ugen/bufAllpassN.help.hs +6/−0
- Help/Ugen/bufChannels.help.hs +0/−0
- Help/Ugen/bufCombC.help.hs +19/−0
- Help/Ugen/bufCombL.help.hs +6/−0
- Help/Ugen/bufCombN.help.hs +6/−0
- Help/Ugen/bufDelayC.help.hs +20/−0
- Help/Ugen/bufDelayL.help.hs +5/−0
- Help/Ugen/bufDelayN.help.hs +5/−0
- Help/Ugen/bufDur.help.hs +14/−0
- Help/Ugen/bufFrames.help.hs +13/−0
- Help/Ugen/bufGrain.help.hs +9/−0
- Help/Ugen/bufRateScale.help.hs +23/−0
- Help/Ugen/bufRd.help.hs +39/−0
- Help/Ugen/bufSampleRate.help.hs +7/−0
- Help/Ugen/bufWr.help.hs +19/−0
- Help/Ugen/cOsc.help.hs +29/−0
- Help/Ugen/changed.help.hs +15/−0
- Help/Ugen/checkBadValues.help.hs +4/−0
- Help/Ugen/chen.help.hs +21/−0
- Help/Ugen/choose.help.hs +3/−0
- Help/Ugen/chromagram.help.hs +5/−0
- Help/Ugen/circleRamp.help.hs +9/−0
- Help/Ugen/clearBuf.help.hs +14/−0
- Help/Ugen/clip.help.hs +2/−0
- Help/Ugen/clip2.help.hs +8/−0
- Help/Ugen/clipNoise.help.hs +5/−0
- Help/Ugen/coinGate.help.hs +4/−0
- Help/Ugen/combC.help.hs +15/−0
- Help/Ugen/combL.help.hs +5/−0
- Help/Ugen/combN.help.hs +4/−0
- Help/Ugen/compander.help.hs +24/−0
- Help/Ugen/complexRes.help.hs +5/−0
- Help/Ugen/concat.help.hs +14/−0
- Help/Ugen/control.hs +44/−0
- Help/Ugen/controlDur.help.hs +5/−0
- Help/Ugen/controlRate.help.hs +3/−0
- Help/Ugen/convolution.help.hs +14/−0
- Help/Ugen/cos.help.hs +3/−0
- Help/Ugen/cosh.help.hs +3/−0
- Help/Ugen/coyote.help.hs +5/−0
- Help/Ugen/crackle.help.hs +9/−0
- Help/Ugen/crest.help.hs +4/−0
- Help/Ugen/crossoverDistortion.help.hs +9/−0
- Help/Ugen/ctl8Voicer.help.hs +36/−0
- Help/Ugen/cuspL.help.hs +24/−0
- Help/Ugen/cuspN.help.hs +3/−0
- Help/Ugen/dNoiseRing.help.hs +7/−0
- Help/Ugen/dbAmp.help.hs +5/−0
- Help/Ugen/dbrown.help.hs +11/−0
- Help/Ugen/dbufrd.help.hs +21/−0
- Help/Ugen/dbufwr.help.hs +38/−0
- Help/Ugen/dc.help.hs +11/−0
- Help/Ugen/dconst.help.hs +5/−0
- Help/Ugen/decay.help.hs +7/−0
- Help/Ugen/decay2.help.hs +13/−0
- Help/Ugen/degreeToKey.help.hs +11/−0
- Help/Ugen/delTapWr.help.hs +6/−0
- Help/Ugen/delay1.help.hs +5/−0
- Help/Ugen/delay2.help.hs +2/−0
- Help/Ugen/delayC.help.hs +5/−0
- Help/Ugen/delayL.help.hs +5/−0
- Help/Ugen/delayN.help.hs +19/−0
- Help/Ugen/demand.help.hs +41/−0
- Help/Ugen/demandEnvGen.help.hs +76/−0
- Help/Ugen/detectIndex.help.hs +5/−0
- Help/Ugen/detectSilence.help.hs +4/−0
- Help/Ugen/dfm1.help.hs +10/−0
- Help/Ugen/dgeom.help.hs +6/−0
- Help/Ugen/dibrown.help.hs +6/−0
- Help/Ugen/difSqr.help.hs +9/−0
- Help/Ugen/diodeRingMod.help.hs +39/−0
- Help/Ugen/disintegrator.help.hs +5/−0
- Help/Ugen/diskIn.help.hs +7/−0
- Help/Ugen/distort.help.hs +2/−0
- Help/Ugen/div.help.hs +12/−0
- Help/Ugen/diwhite.help.hs +6/−0
- Help/Ugen/dneuromodule.help.hs +6/−0
- Help/Ugen/done.help.hs +6/−0
- Help/Ugen/doubleWell3.help.hs +10/−0
- Help/Ugen/dpw3Tri.help.hs +18/−0
- Help/Ugen/dpw4Saw.help.hs +6/−0
- Help/Ugen/drand.help.hs +21/−0
- Help/Ugen/dseq.help.hs +54/−0
- Help/Ugen/dser.help.hs +6/−0
- Help/Ugen/dseries.help.hs +6/−0
- Help/Ugen/dshuf.help.hs +13/−0
- Help/Ugen/dstutter.help.hs +19/−0
- Help/Ugen/dswitch.help.hs +10/−0
- Help/Ugen/dswitch1.help.hs +8/−0
- Help/Ugen/dust.help.hs +17/−0
- Help/Ugen/dust2.help.hs +14/−0
- Help/Ugen/dustRange.help.hs +21/−0
- Help/Ugen/duty.help.hs +17/−0
- Help/Ugen/dwgBowed.help.hs +30/−0
- Help/Ugen/dwgBowedTor.help.hs +30/−0
- Help/Ugen/dwgClarinet3.help.hs +30/−0
- Help/Ugen/dwgFlute.help.hs +27/−0
- Help/Ugen/dwgPlucked2.help.hs +47/−0
- Help/Ugen/dwgPluckedStiff.help.hs +46/−0
- Help/Ugen/dwgSoundBoard.help.hs +49/−0
- Help/Ugen/dwhite.help.hs +17/−0
- Help/Ugen/dwrand.help.hs +6/−0
- Help/Ugen/dx7.help.hs +104/−0
- Help/Ugen/dxrand.help.hs +29/−0
- Help/Ugen/dynKlang.help.hs +22/−0
- Help/Ugen/dynKlank.help.hs +24/−0
- Help/Ugen/envAdsr.help.hs +57/−0
- Help/Ugen/envAsr.help.hs +30/−0
- Help/Ugen/envCoord.help.hs +43/−0
- Help/Ugen/envDetect.help.hs +8/−0
- Help/Ugen/envFollow.help.hs +6/−0
- Help/Ugen/envGate.help.hs +20/−0
- Help/Ugen/envGen.help.hs +54/−0
- Help/Ugen/envLinen.help.hs +26/−0
- Help/Ugen/envPairs.help.hs +14/−0
- Help/Ugen/envPerc.help.hs +23/−0
- Help/Ugen/envSine.help.hs +10/−0
- Help/Ugen/envStep.help.hs +16/−0
- Help/Ugen/envTrapezoid.help.hs +10/−0
- Help/Ugen/envTriangle.help.hs +10/−0
- Help/Ugen/envXyc.help.hs +5/−0
- Help/Ugen/equal_to.help.hs +33/−0
- Help/Ugen/eventVoicer.help.hs +81/−0
- Help/Ugen/excess.help.hs +10/−0
- Help/Ugen/expRand.help.hs +4/−0
- Help/Ugen/expRandN.help.hs +13/−0
- Help/Ugen/fSinOsc.help.hs +9/−0
- Help/Ugen/fbSineC.help.hs +31/−0
- Help/Ugen/fbSineL.help.hs +1/−0
- Help/Ugen/fbSineN.help.hs +1/−0
- Help/Ugen/fdiv.help.hs +4/−0
- Help/Ugen/fft.help.hs +9/−0
- Help/Ugen/fftTrigger.help.hs +1/−0
- Help/Ugen/fm7.help.hs +94/−0
- Help/Ugen/fmGrain.help.hs +6/−0
- Help/Ugen/fmGrainB.help.hs +10/−0
- Help/Ugen/fold2.help.hs +5/−0
- Help/Ugen/formant.help.hs +21/−0
- Help/Ugen/formlet.help.hs +30/−0
- Help/Ugen/fos.help.hs +7/−0
- Help/Ugen/frac.help.hs +10/−0
- Help/Ugen/free.help.hs +5/−0
- Help/Ugen/freeSelf.help.hs +3/−0
- Help/Ugen/freeSelfWhenDone.help.hs +9/−0
- Help/Ugen/freeVerb.help.hs +14/−0
- Help/Ugen/freezer.help.hs +80/−0
- Help/Ugen/freqShift.help.hs +31/−0
- Help/Ugen/friction.help.hs +30/−0
- Help/Ugen/gVerb.help.hs +17/−0
- Help/Ugen/gammatone.help.hs +101/−0
- Help/Ugen/gate.help.hs +2/−0
- Help/Ugen/gateReset.help.hs +6/−0
- Help/Ugen/gaussTrig.help.hs +6/−0
- Help/Ugen/gbmanL.help.hs +1/−0
- Help/Ugen/gbmanN.help.hs +15/−0
- Help/Ugen/gcd.help.hs +19/−0
- Help/Ugen/gendy1.help.hs +80/−0
- Help/Ugen/grainBuf.help.hs +40/−0
- Help/Ugen/grainFM.help.hs +26/−0
- Help/Ugen/grainIn.help.hs +5/−0
- Help/Ugen/grainSin.help.hs +26/−0
- Help/Ugen/grayNoise.help.hs +6/−0
- Help/Ugen/greater_than.help.hs +3/−0
- Help/Ugen/greyholeRaw.help.hs +3/−0
- Help/Ugen/hairCell.help.hs +5/−0
- Help/Ugen/harmonicOsc.help.hs +13/−0
- Help/Ugen/hasher.help.hs +11/−0
- Help/Ugen/henonC.help.hs +1/−0
- Help/Ugen/henonL.help.hs +1/−0
- Help/Ugen/henonN.help.hs +29/−0
- Help/Ugen/hilbert.help.hs +3/−0
- Help/Ugen/hilbertFIR.help.hs +2/−0
- Help/Ugen/hpf.help.hs +9/−0
- Help/Ugen/hpz1.help.hs +15/−0
- Help/Ugen/hpz2.help.hs +2/−0
- Help/Ugen/hypot.help.hs +21/−0
- Help/Ugen/iEnvGen.help.hs +31/−0
- Help/Ugen/iRand.help.hs +4/−0
- Help/Ugen/iRandN.help.hs +17/−0
- Help/Ugen/ifft.help.hs +9/−0
- Help/Ugen/iirFilter.help.hs +7/−0
- Help/Ugen/impulse.help.hs +21/−0
- Help/Ugen/in.help.hs +40/−0
- Help/Ugen/inFeedback.help.hs +25/−0
- Help/Ugen/inRange.help.hs +8/−0
- Help/Ugen/inTrig.help.hs +5/−0
- Help/Ugen/index.help.hs +9/−0
- Help/Ugen/indexInBetween.help.hs +15/−0
- Help/Ugen/indexL.help.hs +10/−0
- Help/Ugen/integrator.help.hs +23/−0
- Help/Ugen/jPverbRaw.help.hs +14/−0
- Help/Ugen/k2a.help.hs +11/−0
- Help/Ugen/keyState.help.hs +2/−0
- Help/Ugen/keyTrack.help.hs +6/−0
- Help/Ugen/klang.help.hs +22/−0
- Help/Ugen/klank.help.hs +26/−0
- Help/Ugen/ladspa.help.hs +244/−0
- Help/Ugen/lag.help.hs +17/−0
- Help/Ugen/lag2.help.hs +6/−0
- Help/Ugen/lag3.help.hs +13/−0
- Help/Ugen/lagIn.help.hs +7/−0
- Help/Ugen/lagUD.help.hs +28/−0
- Help/Ugen/lastValue.help.hs +8/−0
- Help/Ugen/latch.help.hs +32/−0
- Help/Ugen/latoocarfianC.help.hs +19/−0
- Help/Ugen/lcm.help.hs +10/−0
- Help/Ugen/leakDC.help.hs +11/−0
- Help/Ugen/lfBrownNoise0.help.hs +4/−0
- Help/Ugen/lfBrownNoise2.help.hs +21/−0
- Help/Ugen/lfClipNoise.help.hs +22/−0
- Help/Ugen/lfCub.help.hs +38/−0
- Help/Ugen/lfGauss.help.hs +47/−0
- Help/Ugen/lfNoise0.help.hs +25/−0
- Help/Ugen/lfNoise1.help.hs +11/−0
- Help/Ugen/lfNoise2.help.hs +13/−0
- Help/Ugen/lfPar.help.hs +2/−0
- Help/Ugen/lfPulse.help.hs +31/−0
- Help/Ugen/lfSaw.help.hs +45/−0
- Help/Ugen/lfTri.help.hs +27/−0
- Help/Ugen/lfdClipNoise.help.hs +17/−0
- Help/Ugen/lfdNoise0.help.hs +13/−0
- Help/Ugen/lfdNoise1.help.hs +5/−0
- Help/Ugen/lfdNoise3.help.hs +5/−0
- Help/Ugen/limiter.help.hs +4/−0
- Help/Ugen/linCongC.help.hs +21/−0
- Help/Ugen/linCongL.help.hs +1/−0
- Help/Ugen/linCongN.help.hs +1/−0
- Help/Ugen/linExp.help.hs +16/−0
- Help/Ugen/linLin.help.hs +16/−0
- Help/Ugen/linPan2.help.hs +5/−0
- Help/Ugen/linRand.help.hs +6/−0
- Help/Ugen/linXFade2.help.hs +5/−0
- Help/Ugen/line.help.hs +7/−0
- Help/Ugen/linen.help.hs +17/−0
- Help/Ugen/localBuf.help.hs +70/−0
- Help/Ugen/localIn.help.hs +25/−0
- Help/Ugen/localOut.help.hs +15/−0
- Help/Ugen/log.help.hs +2/−0
- Help/Ugen/logistic.help.hs +13/−0
- Help/Ugen/loopBuf.help.hs +38/−0
- Help/Ugen/lorenzL.help.hs +23/−0
- Help/Ugen/lorenzTrig.help.hs +18/−0
- Help/Ugen/lores.help.hs +8/−0
- Help/Ugen/loudness.help.hs +7/−0
- Help/Ugen/lpcAnalyzer.help.hs +17/−0
- Help/Ugen/lpf.help.hs +19/−0
- Help/Ugen/lpg.help.hs +38/−0
- Help/Ugen/lpz1.help.hs +2/−0
- Help/Ugen/lpz2.help.hs +2/−0
- Help/Ugen/lti.help.hs +5/−0
- Help/Ugen/mantissaMask.help.hs +2/−0
- Help/Ugen/max.help.hs +10/−0
- Help/Ugen/mce.help.hs +24/−0
- Help/Ugen/mdaPiano.help.hs +9/−0
- Help/Ugen/meddis.help.hs +5/−0
- Help/Ugen/median.help.hs +16/−0
- Help/Ugen/membraneCircle.help.hs +20/−0
- Help/Ugen/membraneHexagon.help.hs +14/−0
- Help/Ugen/metro.help.hs +13/−0
- Help/Ugen/miBraids.help.hs +67/−0
- Help/Ugen/miClouds.help.hs +45/−0
- Help/Ugen/miElements.help.hs +97/−0
- Help/Ugen/miOmi.help.hs +18/−0
- Help/Ugen/miPlaits.help.hs +82/−0
- Help/Ugen/miRings.help.hs +86/−0
- Help/Ugen/miRipples.help.hs +17/−0
- Help/Ugen/miTides.help.hs +84/−0
- Help/Ugen/miVerb.help.hs +20/−0
- Help/Ugen/midEQ.help.hs +8/−0
- Help/Ugen/midiCPS.help.hs +5/−0
- Help/Ugen/min.help.hs +2/−0
- Help/Ugen/mix.help.hs +21/−0
- Help/Ugen/mod.help.hs +2/−0
- Help/Ugen/modDif.help.hs +20/−0
- Help/Ugen/monoGrain.help.hs +4/−0
- Help/Ugen/moogFF.help.hs +22/−0
- Help/Ugen/moogLadder.help.hs +31/−0
- Help/Ugen/moogVCF.help.hs +9/−0
- Help/Ugen/mostChange.help.hs +5/−0
- Help/Ugen/mouseButton.help.hs +5/−0
- Help/Ugen/mouseX.help.hs +7/−0
- Help/Ugen/mouseY.help.hs +9/−0
- Help/Ugen/mrg2.help.hs +19/−0
- Help/Ugen/mul.help.hs +22/−0
- Help/Ugen/mulAdd.help.hs +20/−0
- Help/Ugen/nRand.help.hs +4/−0
- Help/Ugen/neg.help.hs +2/−0
- Help/Ugen/neoFormant.help.hs +15/−0
- Help/Ugen/nestedAllpassC.help.hs +48/−0
- Help/Ugen/nhHall.help.hs +5/−0
- Help/Ugen/nodeId.help.hs +6/−0
- Help/Ugen/normalizer.help.hs +5/−0
- Help/Ugen/numBuffers.help.hs +5/−0
- Help/Ugen/numRunningSynths.help.hs +2/−0
- Help/Ugen/obxdFilter.help.hs +42/−0
- Help/Ugen/offsetOut.help.hs +9/−0
- Help/Ugen/onePole.help.hs +10/−0
- Help/Ugen/oneZero.help.hs +10/−0
- Help/Ugen/onsets.help.hs +17/−0
- Help/Ugen/osc.help.hs +59/−0
- Help/Ugen/osc1.help.hs +23/−0
- Help/Ugen/oscN.help.hs +1/−0
- Help/Ugen/oteyPianoStrings.help.hs +10/−0
- Help/Ugen/oteySoundBoard.help.hs +13/−0
- Help/Ugen/out.help.hs +35/−0
- Help/Ugen/packFFT.help.hs +15/−0
- Help/Ugen/pan2.help.hs +15/−0
- Help/Ugen/panAz.help.hs +5/−0
- Help/Ugen/pause.help.hs +15/−0
- Help/Ugen/pauseSelf.help.hs +7/−0
- Help/Ugen/pauseSelfWhenDone.help.hs +8/−0
- Help/Ugen/peak.help.hs +5/−0
- Help/Ugen/peakFollower.help.hs +17/−0
- Help/Ugen/perlin3.help.hs +4/−0
- Help/Ugen/phasor.help.hs +72/−0
- Help/Ugen/phasorModal.help.hs +23/−0
- Help/Ugen/pinkNoise.help.hs +31/−0
- Help/Ugen/pitch.help.hs +38/−0
- Help/Ugen/pitchShift.help.hs +11/−0
- Help/Ugen/playBuf.help.hs +55/−0
- Help/Ugen/playBufCF.help.hs +20/−0
- Help/Ugen/pluck.help.hs +57/−0
- Help/Ugen/pmOsc.help.hs +30/−0
- Help/Ugen/poll.help.hs +32/−0
- Help/Ugen/pow.help.hs +15/−0
- Help/Ugen/pulse.help.hs +13/−0
- Help/Ugen/pulseCount.help.hs +17/−0
- Help/Ugen/pulseDPW.help.hs +5/−0
- Help/Ugen/pulseDivider.help.hs +6/−0
- Help/Ugen/pv_BinBufRd.help.hs +9/−0
- Help/Ugen/pv_BinScramble.help.hs +21/−0
- Help/Ugen/pv_BinShift.help.hs +10/−0
- Help/Ugen/pv_BinWipe.help.hs +8/−0
- Help/Ugen/pv_BrickWall.help.hs +28/−0
- Help/Ugen/pv_BufRd.help.hs +6/−0
- Help/Ugen/pv_Compander.help.hs +15/−0
- Help/Ugen/pv_ConformalMap.help.hs +13/−0
- Help/Ugen/pv_Diffuser.help.hs +12/−0
- Help/Ugen/pv_Freeze.help.hs +5/−0
- Help/Ugen/pv_HainsworthFoote.help.hs +16/−0
- Help/Ugen/pv_Invert.help.hs +11/−0
- Help/Ugen/pv_JensenAndersen.help.hs +6/−0
- Help/Ugen/pv_LocalMax.help.hs +6/−0
- Help/Ugen/pv_MagAbove.help.hs +13/−0
- Help/Ugen/pv_MagBelow.help.hs +13/−0
- Help/Ugen/pv_MagClip.help.hs +6/−0
- Help/Ugen/pv_MagFreeze.help.hs +14/−0
- Help/Ugen/pv_MagGate.help.hs +8/−0
- Help/Ugen/pv_MagMul.help.hs +6/−0
- Help/Ugen/pv_MagSmear.help.hs +6/−0
- Help/Ugen/pv_Morph.help.hs +8/−0
- Help/Ugen/pv_Mul.help.hs +7/−0
- Help/Ugen/pv_PlayBuf.help.hs +13/−0
- Help/Ugen/pv_RandComb.help.hs +18/−0
- Help/Ugen/pv_RandWipe.help.hs +15/−0
- Help/Ugen/pv_RecordBuf.help.hs +15/−0
- Help/Ugen/pv_RectComb.help.hs +15/−0
- Help/Ugen/pv_SpectralMap.help.hs +21/−0
- Help/Ugen/pv_Split.help.hs +63/−0
- Help/Ugen/pv_xFade.help.hs +8/−0
- Help/Ugen/quadC.help.hs +12/−0
- Help/Ugen/quadL.help.hs +1/−0
- Help/Ugen/quadN.help.hs +1/−0
- Help/Ugen/rDelayMap.help.hs +35/−0
- Help/Ugen/rDelaySet.help.hs +6/−0
- Help/Ugen/rDelaySetBuf.help.hs +7/−0
- Help/Ugen/rLagC.help.hs +21/−0
- Help/Ugen/rLoopSet.help.hs +23/−0
- Help/Ugen/rShufflerL.help.hs +28/−0
- Help/Ugen/rSmplrIndex.help.hs +57/−0
- Help/Ugen/rTracePlay.help.hs +17/−0
- Help/Ugen/rTraceRd.help.hs +45/−0
- Help/Ugen/radiansPerSample.help.hs +3/−0
- Help/Ugen/ramp.help.hs +20/−0
- Help/Ugen/rand.help.hs +9/−0
- Help/Ugen/rand2.help.hs +2/−0
- Help/Ugen/randN.help.hs +16/−0
- Help/Ugen/randSeed.help.hs +20/−0
- Help/Ugen/rcd.help.hs +11/−0
- Help/Ugen/rdl.help.hs +30/−0
- Help/Ugen/rdx7Env.help.hs +13/−0
- Help/Ugen/recordBuf.help.hs +21/−0
- Help/Ugen/redPhasor.help.hs +17/−0
- Help/Ugen/redPhasor2.help.hs +7/−0
- Help/Ugen/replaceOut.help.hs +15/−0
- Help/Ugen/resonator.help.hs +28/−0
- Help/Ugen/resonz.help.hs +60/−0
- Help/Ugen/rhpf.help.hs +7/−0
- Help/Ugen/ring1.help.hs +9/−0
- Help/Ugen/ring2.help.hs +9/−0
- Help/Ugen/ring3.help.hs +9/−0
- Help/Ugen/ring4.help.hs +9/−0
- Help/Ugen/ringz.help.hs +22/−0
- Help/Ugen/rlpf.help.hs +32/−0
- Help/Ugen/rlpfd.help.hs +4/−0
- Help/Ugen/rmShelf.help.hs +12/−0
- Help/Ugen/rmeq.help.hs +8/−0
- Help/Ugen/rongs.help.hs +32/−0
- Help/Ugen/rotate2.help.hs +10/−0
- Help/Ugen/roundUp.help.hs +8/−0
- Help/Ugen/rpvDecayTbl.help.hs +11/−0
- Help/Ugen/runningMax.help.hs +16/−0
- Help/Ugen/runningMin.help.hs +12/−0
- Help/Ugen/runningSum.help.hs +18/−0
- Help/Ugen/sampleDur.help.hs +3/−0
- Help/Ugen/sampleRate.help.hs +7/−0
- Help/Ugen/sanitize.help.hs +3/−0
- Help/Ugen/saw.help.hs +25/−0
- Help/Ugen/sawDPW.help.hs +5/−0
- Help/Ugen/scaleNeg.help.hs +8/−0
- Help/Ugen/schmidt.help.hs +4/−0
- Help/Ugen/select.help.hs +44/−0
- Help/Ugen/selectX.help.hs +12/−0
- Help/Ugen/sendReply.help.hs +8/−0
- Help/Ugen/sensoryDissonance.help.hs +6/−0
- Help/Ugen/setResetFF.help.hs +12/−0
- Help/Ugen/shaper.help.hs +55/−0
- Help/Ugen/shufflerB.help.hs +39/−0
- Help/Ugen/silent.help.hs +2/−0
- Help/Ugen/sin.help.hs +3/−0
- Help/Ugen/sinGrain.help.hs +13/−0
- Help/Ugen/sinOsc.help.hs +154/−0
- Help/Ugen/sinOscFB.help.hs +13/−0
- Help/Ugen/sineShaper.help.hs +5/−0
- Help/Ugen/sinh.help.hs +3/−0
- Help/Ugen/slew.help.hs +15/−0
- Help/Ugen/slope.help.hs +11/−0
- Help/Ugen/sms.help.hs +9/−0
- Help/Ugen/sndfileIn.help.hs +14/−0
- Help/Ugen/sndfileRead.help.hs +21/−0
- Help/Ugen/softClip.help.hs +2/−0
- Help/Ugen/softClipAmp.help.hs +6/−0
- Help/Ugen/sonLPC.help.hs +21/−0
- Help/Ugen/sortBuf.help.hs +7/−0
- Help/Ugen/sos.help.hs +45/−0
- Help/Ugen/soundIn.help.hs +14/−0
- Help/Ugen/specCentroid.help.hs +8/−0
- Help/Ugen/specFlatness.help.hs +8/−0
- Help/Ugen/spectralEntropy.help.hs +12/−0
- Help/Ugen/splay.help.hs +41/−0
- Help/Ugen/spreader.help.hs +15/−0
- Help/Ugen/spring.help.hs +51/−0
- Help/Ugen/sqrDif.help.hs +2/−0
- Help/Ugen/sqrSum.help.hs +2/−0
- Help/Ugen/squiz.help.hs +25/−0
- Help/Ugen/standard2DL.help.hs +11/−0
- Help/Ugen/standardL.help.hs +11/−0
- Help/Ugen/stepper.help.hs +40/−0
- Help/Ugen/stkBandedWG.help.hs +23/−0
- Help/Ugen/stkInst.help.hs +119/−0
- Help/Ugen/stkMandolin.help.hs +25/−0
- Help/Ugen/stkModalBar.help.hs +35/−0
- Help/Ugen/stkMoog.help.hs +44/−0
- Help/Ugen/stkPluck.help.hs +9/−0
- Help/Ugen/stkShakers.help.hs +21/−0
- Help/Ugen/streson.help.hs +11/−0
- Help/Ugen/stringVoice.help.hs +19/−0
- Help/Ugen/sub.help.hs +10/−0
- Help/Ugen/subsampleOffset.help.hs +13/−0
- Help/Ugen/sum3.help.hs +8/−0
- Help/Ugen/sum4.help.hs +5/−0
- Help/Ugen/sumSqr.help.hs +9/−0
- Help/Ugen/summer.help.hs +7/−0
- Help/Ugen/svf.help.hs +33/−0
- Help/Ugen/svfBp.help.hs +17/−0
- Help/Ugen/svfHp.help.hs +17/−0
- Help/Ugen/svfLp.help.hs +17/−0
- Help/Ugen/sweep.help.hs +54/−0
- Help/Ugen/switchDelay.help.hs +10/−0
- Help/Ugen/syncSaw.help.hs +8/−0
- Help/Ugen/t2a.help.hs +15/−0
- Help/Ugen/t2k.help.hs +2/−0
- Help/Ugen/tBall.help.hs +19/−0
- Help/Ugen/tBetaRand.help.hs +17/−0
- Help/Ugen/tBrownRand.help.hs +19/−0
- Help/Ugen/tChoose.help.hs +9/−0
- Help/Ugen/tDelay.help.hs +5/−0
- Help/Ugen/tDuty.help.hs +30/−0
- Help/Ugen/tExpRand.help.hs +8/−0
- Help/Ugen/tExpRandN.help.hs +4/−0
- Help/Ugen/tGaussRand.help.hs +7/−0
- Help/Ugen/tGrains.help.hs +74/−0
- Help/Ugen/tLine.help.hs +5/−0
- Help/Ugen/tRand.help.hs +22/−0
- Help/Ugen/tRandN.help.hs +4/−0
- Help/Ugen/tScramble.help.hs +8/−0
- Help/Ugen/tWindex.help.hs +13/−0
- Help/Ugen/tXLine.help.hs +5/−0
- Help/Ugen/tan.help.hs +3/−0
- Help/Ugen/tanh.help.hs +8/−0
- Help/Ugen/tap.help.hs +6/−0
- Help/Ugen/tartini.help.hs +24/−0
- Help/Ugen/thresh.help.hs +2/−0
- Help/Ugen/tiRand.help.hs +15/−0
- Help/Ugen/timer.help.hs +3/−0
- Help/Ugen/toggleFF.help.hs +4/−0
- Help/Ugen/trig.help.hs +8/−0
- Help/Ugen/trig1.help.hs +11/−0
- Help/Ugen/trigAvg.help.hs +9/−0
- Help/Ugen/trigControl.help.hs +7/−0
- Help/Ugen/twChoose.help.hs +9/−0
- Help/Ugen/twoPole.help.hs +7/−0
- Help/Ugen/twoTube.help.hs +20/−0
- Help/Ugen/twoZero.help.hs +4/−0
- Help/Ugen/vDiskIn.help.hs +10/−0
- Help/Ugen/vOsc.help.hs +18/−0
- Help/Ugen/vOsc3.help.hs +19/−0
- Help/Ugen/varLag.help.hs +4/−0
- Help/Ugen/varSaw.help.hs +43/−0
- Help/Ugen/varShapeOsc.help.hs +9/−0
- Help/Ugen/vbFourses.help.hs +24/−0
- Help/Ugen/vbJonVerb.help.hs +15/−0
- Help/Ugen/vbSlide.help.hs +10/−0
- Help/Ugen/vibrato.help.hs +24/−0
- Help/Ugen/vosim.help.hs +33/−0
- Help/Ugen/vosimOsc.help.hs +15/−0
- Help/Ugen/warp1.help.hs +33/−0
- Help/Ugen/weaklyNonlinear2.help.hs +21/−0
- Help/Ugen/whiteNoise.help.hs +70/−0
- Help/Ugen/wrap.help.hs +6/−0
- Help/Ugen/wrap2.help.hs +2/−0
- Help/Ugen/wrapIndex.help.hs +5/−0
- Help/Ugen/xFade2.help.hs +2/−0
- Help/Ugen/xLine.help.hs +3/−0
- Help/Ugen/xOut.help.hs +8/−0
- Help/Ugen/zOsc.help.hs +8/−0
- Help/Ugen/zeroCrossing.help.hs +7/−0
- Help/Ugen/zitaRev.help.hs +37/−0
- Help/hsc3.help.lhs +0/−656
- Help/tutorial.lhs +0/−313
- README +0/−22
- README.md +85/−0
- Setup.hs +3/−0
- Setup.lhs +0/−3
- Sound/SC3.hs +0/−22
- Sound/SC3/ID.hs +0/−11
- Sound/SC3/Monadic.hs +0/−14
- Sound/SC3/Server.hs +0/−13
- Sound/SC3/Server/Command.hs +0/−295
- Sound/SC3/Server/Command/Completion.hs +0/−82
- Sound/SC3/Server/NRT.hs +0/−26
- Sound/SC3/Server/Play.hs +0/−38
- Sound/SC3/Server/Status.hs +0/−47
- Sound/SC3/Server/Synthdef.hs +0/−322
- Sound/SC3/Server/Utilities.hs +0/−11
- Sound/SC3/UGen.hs +0/−60
- Sound/SC3/UGen/Analysis.hs +0/−29
- Sound/SC3/UGen/Buffer.hs +0/−160
- Sound/SC3/UGen/Chaos.hs +0/−85
- Sound/SC3/UGen/Composite.hs +0/−70
- Sound/SC3/UGen/Composite/Monadic.hs +0/−21
- Sound/SC3/UGen/Demand.hs +0/−32
- Sound/SC3/UGen/Demand/ID.hs +0/−66
- Sound/SC3/UGen/Demand/Monadic.hs +0/−67
- Sound/SC3/UGen/DiskIO.hs +0/−32
- Sound/SC3/UGen/Enum.hs +0/−41
- Sound/SC3/UGen/Envelope.hs +0/−56
- Sound/SC3/UGen/Envelope/Construct.hs +0/−102
- Sound/SC3/UGen/External.hs +0/−74
- Sound/SC3/UGen/External/ATS.hs +0/−98
- Sound/SC3/UGen/External/LPC.hs +0/−62
- Sound/SC3/UGen/FFT.hs +0/−162
- Sound/SC3/UGen/FFT/ID.hs +0/−20
- Sound/SC3/UGen/FFT/Monadic.hs +0/−18
- Sound/SC3/UGen/Filter.hs +0/−373
- Sound/SC3/UGen/Granular.hs +0/−29
- Sound/SC3/UGen/IO.hs +0/−77
- Sound/SC3/UGen/Information.hs +0/−49
- Sound/SC3/UGen/MachineListening.hs +0/−53
- Sound/SC3/UGen/Math.hs +0/−249
- Sound/SC3/UGen/Noise/ID.hs +0/−108
- Sound/SC3/UGen/Noise/Monadic.hs +0/−111
- Sound/SC3/UGen/Operator.hs +0/−131
- Sound/SC3/UGen/Oscillator.hs +0/−92
- Sound/SC3/UGen/Panner.hs +0/−45
- Sound/SC3/UGen/Rate.hs +0/−32
- Sound/SC3/UGen/UGen.hs +0/−446
- Sound/SC3/UGen/UGen/Lift.hs +0/−36
- Sound/SC3/UGen/UId.hs +0/−12
- Sound/SC3/UGen/Utilities.hs +0/−26
- Sound/Sc3.hs +9/−0
- Sound/Sc3/Common.hs +15/−0
- Sound/Sc3/Common/Base.hs +369/−0
- Sound/Sc3/Common/Base/System.hs +30/−0
- Sound/Sc3/Common/Buffer.hs +218/−0
- Sound/Sc3/Common/Buffer/Array.hs +35/−0
- Sound/Sc3/Common/Buffer/Gen.hs +128/−0
- Sound/Sc3/Common/Buffer/Vector.hs +44/−0
- Sound/Sc3/Common/Context.hs +62/−0
- Sound/Sc3/Common/Enum.hs +128/−0
- Sound/Sc3/Common/Envelope.hs +552/−0
- Sound/Sc3/Common/Help.hs +296/−0
- Sound/Sc3/Common/Help/Sc2.hs +238/−0
- Sound/Sc3/Common/Math.hs +988/−0
- Sound/Sc3/Common/Math/Filter.hs +89/−0
- Sound/Sc3/Common/Math/Filter/Beq.hs +117/−0
- Sound/Sc3/Common/Math/Interpolate.hs +143/−0
- Sound/Sc3/Common/Math/Noise.hs +51/−0
- Sound/Sc3/Common/Math/Operator.hs +557/−0
- Sound/Sc3/Common/Math/Warp.hs +145/−0
- Sound/Sc3/Common/Math/Window.hs +105/−0
- Sound/Sc3/Common/Mce.hs +174/−0
- Sound/Sc3/Common/Monad.hs +32/−0
- Sound/Sc3/Common/Monad/Operators.hs +133/−0
- Sound/Sc3/Common/Random.hs +56/−0
- Sound/Sc3/Common/Rate.hs +92/−0
- Sound/Sc3/Common/SoundFile.hs +133/−0
- Sound/Sc3/Common/Uid.hs +143/−0
- Sound/Sc3/Common/Unsafe.hs +58/−0
- Sound/Sc3/Fd.hs +9/−0
- Sound/Sc3/Server.hs +16/−0
- Sound/Sc3/Server/Command.hs +6/−0
- Sound/Sc3/Server/Command/Completion.hs +26/−0
- Sound/Sc3/Server/Command/Enum.hs +165/−0
- Sound/Sc3/Server/Command/Generic.hs +560/−0
- Sound/Sc3/Server/Command/Plain.hs +437/−0
- Sound/Sc3/Server/Command/Plain/Completion.hs +69/−0
- Sound/Sc3/Server/Enum.hs +121/−0
- Sound/Sc3/Server/Fd.hs +5/−0
- Sound/Sc3/Server/Graphdef.hs +316/−0
- Sound/Sc3/Server/Graphdef/Binary.hs +111/−0
- Sound/Sc3/Server/Graphdef/Graph.hs +81/−0
- Sound/Sc3/Server/Graphdef/Io.hs +19/−0
- Sound/Sc3/Server/Graphdef/Read.hs +66/−0
- Sound/Sc3/Server/Graphdef/Text.hs +91/−0
- Sound/Sc3/Server/Monad.hs +5/−0
- Sound/Sc3/Server/Nrt.hs +87/−0
- Sound/Sc3/Server/Nrt/Edit.hs +55/−0
- Sound/Sc3/Server/Nrt/Render.hs +83/−0
- Sound/Sc3/Server/Nrt/Stat.hs +32/−0
- Sound/Sc3/Server/Nrt/Ugen.hs +62/−0
- Sound/Sc3/Server/Options.hs +113/−0
- Sound/Sc3/Server/Param.hs +77/−0
- Sound/Sc3/Server/Recorder.hs +122/−0
- Sound/Sc3/Server/Scsynth.hs +64/−0
- Sound/Sc3/Server/Status.hs +180/−0
- Sound/Sc3/Server/Synthdef.hs +108/−0
- Sound/Sc3/Server/Transport/Fd.hs +210/−0
- Sound/Sc3/Server/Transport/Monad.hs +433/−0
- Sound/Sc3/Ugen.hs +24/−0
- Sound/Sc3/Ugen/Analysis.hs +86/−0
- Sound/Sc3/Ugen/Bindings.hs +9/−0
- Sound/Sc3/Ugen/Bindings/Composite.hs +603/−0
- Sound/Sc3/Ugen/Bindings/Composite/External.hs +196/−0
- Sound/Sc3/Ugen/Bindings/Db.hs +3052/−0
- Sound/Sc3/Ugen/Bindings/Db/External.hs +3541/−0
- Sound/Sc3/Ugen/Bindings/Hw.hs +77/−0
- Sound/Sc3/Ugen/Bindings/Hw/Construct.hs +83/−0
- Sound/Sc3/Ugen/Bindings/Hw/External.hs +6/−0
- Sound/Sc3/Ugen/Bindings/Hw/External/F0.hs +26/−0
- Sound/Sc3/Ugen/Bindings/Hw/External/Sc3_Plugins.hs +69/−0
- Sound/Sc3/Ugen/Bindings/Hw/External/Wavelets.hs +30/−0
- Sound/Sc3/Ugen/Bindings/Hw/External/Zita.hs +29/−0
- Sound/Sc3/Ugen/Bracketed.hs +109/−0
- Sound/Sc3/Ugen/Brackets.hs +24/−0
- Sound/Sc3/Ugen/Constant.hs +32/−0
- Sound/Sc3/Ugen/Control.hs +98/−0
- Sound/Sc3/Ugen/Enum.hs +16/−0
- Sound/Sc3/Ugen/Envelope.hs +47/−0
- Sound/Sc3/Ugen/Event.hs +235/−0
- Sound/Sc3/Ugen/Graph.hs +617/−0
- Sound/Sc3/Ugen/Graph/Reconstruct.hs +150/−0
- Sound/Sc3/Ugen/Graph/Transform.hs +83/−0
- Sound/Sc3/Ugen/Help/Graph.hs +87/−0
- Sound/Sc3/Ugen/Hs.hs +392/−0
- Sound/Sc3/Ugen/Label.hs +4/−0
- Sound/Sc3/Ugen/Math.hs +35/−0
- Sound/Sc3/Ugen/Math/Composite.hs +32/−0
- Sound/Sc3/Ugen/Mce.hs +85/−0
- Sound/Sc3/Ugen/Mrg.hs +8/−0
- Sound/Sc3/Ugen/Name.hs +97/−0
- Sound/Sc3/Ugen/Optimise.hs +149/−0
- Sound/Sc3/Ugen/Plain.hs +60/−0
- Sound/Sc3/Ugen/Pp.hs +32/−0
- Sound/Sc3/Ugen/Primitive.hs +32/−0
- Sound/Sc3/Ugen/Proxy.hs +15/−0
- Sound/Sc3/Ugen/Types.hs +11/−0
- Sound/Sc3/Ugen/Ugen.hs +753/−0
- Sound/Sc3/Ugen/Util.hs +341/−0
- emacs/hsc3.el +453/−226
- hsc3.cabal +127/−85
- lib/hsc3-min-imports.hs +6/−0
- lib/hsc3-std-extensions.hs +2/−0
- lib/hsc3-std-imports.hs +21/−0
+ Help/Graph/adc-bit-reduction.hs view
@@ -0,0 +1,21 @@+-- bit reduction (adc)+let downSample =+ let f = lfNoise2 kr 8+ nh = lfNoise2 kr 3+ src = blip ar (f * 200 + 300) (nh * 10 + 20)+ sr = mouseX kr 1000 (sampleRate * 0.1) Exponential 0.2+ in latch src (impulse ar sr 0) * 0.1+ bitSz = mouseY kr 1 24 Exponential 0.2+ bitRedux = roundTo downSample (0.5 ** bitSz)+in mce2 downSample bitRedux++-- bit reduction (adc) ; id+let downSample =+ let f = lfNoise2Id 'α' kr 8+ nh = lfNoise2Id 'β' kr 3+ src = blip ar (f * 200 + 300) (nh * 10 + 20)+ sr = mouseX kr 1000 (sampleRate * 0.1) Exponential 0.2+ in latch src (impulse ar sr 0) * 0.1+ bitSz = mouseY kr 1 24 Exponential 0.2+ bitRedux = roundTo downSample (0.5 ** bitSz)+in mce2 downSample bitRedux
+ Help/Graph/adc-down-sample.hs view
@@ -0,0 +1,13 @@+-- down sample (adc)+let f = lfNoise2 kr 8+ nh = lfNoise2 kr 3+ src = blip ar (f * 200 + 300) (nh * 10 + 20)+ sr = mouseX kr 1000 (sampleRate * 0.1) Exponential 0.2+in latch src (impulse ar sr 0) * 0.1++-- down sample (adc) ; id+let f = lfNoise2Id 'α' kr 8+ nh = lfNoise2Id 'β' kr 3+ src = blip ar (f * 200 + 300) (nh * 10 + 20)+ sr = mouseX kr 1000 (sampleRate * 0.1) Exponential 0.2+in latch src (impulse ar sr 0) * 0.1
+ Help/Graph/adc-kabelscahden.hs view
@@ -0,0 +1,25 @@+-- https://swiki.hfbk-hamburg.de/MusicTechnology/851 march 2003 (adc) / (jrhb)+let freq = 50+ sustain = 1+ amp = 0.5+ hum = let t = dust kr (7 ** lfNoise1 kr 0.3)+ h = toggleFF (coinGate 0.4 t) * rlpf (lfPulse ar freq 0 0.5 + (lfNoise1 kr 2 * 0.5 - 0.5)) 6000 0.15+ n = trig t (tRand 0 0.01 (coinGate 0.4 t)) * whiteNoise ar+ m = trig t (tRand 0 0.01 (coinGate 0.4 t)) * brownNoise ar+ k = trig t (lfNoise1 kr (mce2 4 4.2) * 0.1 + 0.11) * lfClipNoise ar (lfNoise0 kr 7 * 30 + 40)+ in distort (leakDC ((h + n + m + k) * 10) 0.995)+ e = envGen kr 1 1 0 1 RemoveSynth (Envelope [amp,amp,0] [sustain,0] [] Nothing Nothing 0)+in clip2 hum 1 * e * 0.25++-- https://swiki.hfbk-hamburg.de/MusicTechnology/851 march 2003 (adc) / (jrhb) ; id+let freq = 50+ sustain = 1+ amp = 0.5+ hum = let t = dustId 'α' kr (7 ** lfNoise1Id 'β' kr 0.3)+ h = toggleFF (coinGateId 'γ' 0.4 t) * rlpf (lfPulse ar freq 0 0.5 + (lfNoise1Id 'δ' kr 2 * 0.5 - 0.5)) 6000 0.15+ n = trig t (tRandId 'ε' 0 0.01 (coinGateId 'ζ' 0.4 t)) * whiteNoiseId 'η' ar+ m = trig t (tRandId 'θ' 0 0.01 (coinGateId 'ι' 0.4 t)) * brownNoiseId 'κ' ar+ k = trig t (lfNoise1Id 'λ' kr (mce2 4 4.2) * 0.1 + 0.11) * lfClipNoiseId 'μ' ar (lfNoise0Id 'ν' kr 7 * 30 + 40)+ in distort (leakDC ((h + n + m + k) * 10) 0.995)+ e = envGen kr 1 1 0 1 RemoveSynth (Envelope [amp,amp,0] [sustain,0] [] Nothing Nothing 0)+in clip2 hum 1 * e * 0.25
+ Help/Graph/adc-shepard-tones.hs view
@@ -0,0 +1,37 @@+-- shepard tones, alberto de campo (adc)+let interp n l r = let i = (r - l) / n in [l,l + i .. r - i]+ hanning_window n =+ let lp = pi * (-0.5)+ rp = lp + 2 * pi+ hf i = sin i * 0.5 + 0.5+ in map hf (interp n lp rp)+ freq_tbl = let amp_f i = (0.5 ** i) * 20000 in map amp_f (interp 1024 0 10)+ amp_tbl = let square x = x * x in map square (hanning_window 1024)+ b0 = asLocalBuf freq_tbl+ b1 = asLocalBuf amp_tbl+ rate = 0.1+ ratescale = 1024 / 48000 / 10 -- sample-rate+ ph = phasor ar 0 (rate * ratescale) 0 1024 0+ phases = mce (map (\n -> n * 0.1 * 1024 + ph) [0..9])+ freqs = bufRdC 1 ar b0 phases Loop+ amps = bufRdC 1 ar b1 phases Loop+in mix (sinOsc ar freqs 0 * amps) * 0.05++-- shepard tones, alberto de campo (adc) ; id+let interp n l r = let i = (r - l) / n in [l,l + i .. r - i]+ hanning_window n =+ let lp = pi * (-0.5)+ rp = lp + 2 * pi+ hf i = sin i * 0.5 + 0.5+ in map hf (interp n lp rp)+ freq_tbl = let amp_f i = (0.5 ** i) * 20000 in map amp_f (interp 1024 0 10)+ amp_tbl = let square x = x * x in map square (hanning_window 1024)+ b0 = asLocalBufId 'α' freq_tbl+ b1 = asLocalBufId 'β' amp_tbl+ rate = 0.1+ ratescale = 1024 / 48000 / 10 -- sample-rate+ ph = phasor ar 0 (rate * ratescale) 0 1024 0+ phases = mce (map (\n -> n * 0.1 * 1024 + ph) [0..9])+ freqs = bufRdC 1 ar b0 phases Loop+ amps = bufRdC 1 ar b1 phases Loop+in mix (sinOsc ar freqs 0 * amps) * 0.05
+ Help/Graph/bb-microhelix.hs view
@@ -0,0 +1,71 @@+-- batuhan bozkurt 2009 http://www.earslap.com (bb) - mce...........................+let rp = replicate+ ctrigs_ () =+ let i = mce (rp 8 (1/8) +++ rp 8 (1/4) +++ [dseq (drand dinf (mce2 1 2)) (mce2 (1/16) (1/16))])+ d = dxrand dinf (mceMap (* 1.25) i)+ in tDuty ar d 0 DoNothing (dwhite dinf 0.5 1) 0+ ctrigs = mce2 (ctrigs_ ()) (ctrigs_ ())+ clicks =+ let n = pinkNoise ar * decay ctrigs (0.001 * abs (lfNoise1 ar 4))+ in fold (bpf n 15000 0.9 * (25 * range 0 1 (lfNoise1 ar 8))) (-1) 1+ snd1 =+ let o = sinOsc ar (midiCps 44) 0 * 0.5 + sinOsc ar (midiCps 90) 0 * 0.6+ in lpf o (midiCps 32) * 2 + hpf (lpf (whiteNoise ar * 0.008) 12000) 2400+ hiNoise =+ let n = whiteNoise ar+ e = decay2 (ctrigs * (lfNoise1 ar 8 * 0.5 + 0.5)) 0.02 0.1 * 0.05+ in bpf (n * e) (tRand 12000 15000 ctrigs) 0.9+ trigMod = roundTo (lfNoise0 ar 8) 1+ bass =+ let t = mceChannel 0 ctrigs * trigMod+ ph = sweep ar t (2 * pi * mce2 52.8 740) + (pi/3)+ ph' = wrap ph (-pi) pi+ mean u = sum (mceChannels u) / fromIntegral (mceDegree_err u)+ o = tanh (mean (sinOsc ar 0 ph' * mce2 2 0.05))+ d = Envelope [0, 0.5, 0.4, 0] [0, 0.2, 0.01] [EnvNum (-5)] Nothing Nothing 0+ e = envGen ar (abs t) 1 0 1 DoNothing d+ in o * e * 0.25+ snd1' =+ let t = mceChannel 0 ctrigs+ d = Envelope [0, 1, 0.6, 0] [0.0001, 0.4, 0.01] [EnvNum (-4)] Nothing Nothing 0+ e = envGen ar (t * lfNoise0 ar 8) 1 0 1 DoNothing d+ in pan2 (snd1 * e) (tRand (-1) 1 t) 1+in limiter (midEQ (clicks + snd1' + hiNoise + bass) 14000 0.7 8) 1 0.01++-- batuhan bozkurt 2009 http://www.earslap.com (bb) - mce...........................+let rp = replicate+ ctrigs_ z =+ let i = mce (rp 8 (1/8) +++ rp 8 (1/4) +++ [dseqId (z,'α') (drandId (z,'β') dinf (mce2 1 2)) (mce2 (1/16) (1/16))])+ d = dxrandId (z,'γ') dinf (mceMap (* 1.25) i)+ in tDuty ar d 0 DoNothing (dwhiteId (z,'δ') dinf 0.5 1) 0+ ctrigs = mce2 (ctrigs_ 'a') (ctrigs_ 'a')+ clicks =+ let n = pinkNoiseId 'ε' ar * decay ctrigs (0.001 * abs (lfNoise1Id 'ζ' ar 4))+ in fold (bpf n 15000 0.9 * (25 * range 0 1 (lfNoise1Id 'η' ar 8))) (-1) 1+ snd1 =+ let o = sinOsc ar (midiCps 44) 0 * 0.5 + sinOsc ar (midiCps 90) 0 * 0.6+ in lpf o (midiCps 32) * 2 + hpf (lpf (whiteNoiseId 'θ' ar * 0.008) 12000) 2400+ hiNoise =+ let n = whiteNoiseId 'ι' ar+ e = decay2 (ctrigs * (lfNoise1Id 'κ' ar 8 * 0.5 + 0.5)) 0.02 0.1 * 0.05+ in bpf (n * e) (tRandId 'λ' 12000 15000 ctrigs) 0.9+ trigMod = roundTo (lfNoise0Id 'μ' ar 8) 1+ bass =+ let t = mceChannel 0 ctrigs * trigMod+ ph = sweep ar t (2 * pi * mce2 52.8 740) + (pi/3)+ ph' = wrap ph (-pi) pi+ mean u = sum (mceChannels u) / fromIntegral (mceDegree_err u)+ o = tanh (mean (sinOsc ar 0 ph' * mce2 2 0.05))+ d = Envelope [0, 0.5, 0.4, 0] [0, 0.2, 0.01] [EnvNum (-5)] Nothing Nothing 0+ e = envGen ar (abs t) 1 0 1 DoNothing d+ in o * e * 0.25+ snd1' =+ let t = mceChannel 0 ctrigs+ d = Envelope [0, 1, 0.6, 0] [0.0001, 0.4, 0.01] [EnvNum (-4)] Nothing Nothing 0+ e = envGen ar (t * lfNoise0Id 'ν' ar 8) 1 0 1 DoNothing d+ in pan2 (snd1 * e) (tRandId 'ξ' (-1) 1 t) 1+in limiter (midEQ (clicks + snd1' + hiNoise + bass) 14000 0.7 8) 1 0.01
+ Help/Graph/cr-lucier.hs view
@@ -0,0 +1,78 @@+-- Alvin Lucier, "Music on a Long Thin Wire, Simulated" (Chandrasekhar Ramakrishnan)+let freq = control kr "freq" 60+ blocksize = recip controlRate+ mk_dt f = recip f - blocksize+ string_delay = mk_dt freq+ pk1_pos = 0.1 -- pickup one position+ src_pos = 0.3 -- source position+ pk2_pos = 0.9 -- pickup two postion+ max_delay = 1.0 -- maximum delay time (corresponds to a length = c * s)+ mk_delay i r = lpz1 (delayC i max_delay (r * string_delay))+ mk_allpass i r dt = lpz1 (allpassC i max_delay (r * string_delay) dt)+ drv = localIn 1 ar 0 -- driver (source + data stored in the string)+ pk1_R = mk_delay drv (src_pos - pk1_pos)+ pk1_L = mk_allpass (pk1_R * negate 1) (pk1_pos * 2) (rand 0.001 0.11)+ pk2_L = mk_delay pk1_L (pk2_pos - pk1_pos) * 0.99+ stringL = mk_delay pk2_L (1.0 - pk2_pos)+ pk2_R = mk_allpass (stringL * negate 1) (1.0 - pk2_pos) (2 + rand 0.001 0.11) * 0.99+ stringR = mk_delay pk2_R (pk2_pos - src_pos)+ source =+ let s = sinOsc ar 220 0 * 0.01+ a = amplitude kr drv 0.01 0.01 * 11+ p = pulse ar (60 + a) 0.5 * 0.1+ f = rlpf (s + p) 320 0.05+ e = 1.0 - min (amplitude kr drv 0.01 0.01) 1.0+ in normalizer f 0.7 0.01 * e+ l_out = localOut (source * 0.2 + stringR)+ outL = pk1_L + pk1_R+ outR = pk2_L + pk2_R+in mrg [mce2 outL outR, drv, source, l_out]++-- Alvin Lucier, "Music on a Long Thin Wire, Simulated" (Chandrasekhar Ramakrishnan) ; id+let freq = control kr "freq" 60+ blocksize = recip controlRate+ mk_dt f = recip f - blocksize+ string_delay = mk_dt freq+ pk1_pos = 0.1 -- pickup one position+ src_pos = 0.3 -- source position+ pk2_pos = 0.9 -- pickup two postion+ max_delay = 1.0 -- maximum delay time (corresponds to a length = c * s)+ mk_delay i r = lpz1 (delayC i max_delay (r * string_delay))+ mk_allpass i r dt = lpz1 (allpassC i max_delay (r * string_delay) dt)+ drv = localIn 1 ar 0 -- driver (source + data stored in the string)+ pk1_R =+ let i = drv+ r = src_pos - pk1_pos+ in mk_delay i r+ pk1_L =+ let i = pk1_R * negate 1+ r = pk1_pos * 2+ dt = randId 'α' 0.001 0.11+ in mk_allpass i r dt+ pk2_L =+ let i = pk1_L+ r = pk2_pos - pk1_pos+ in mk_delay i r * 0.99+ stringL =+ let i = pk2_L+ r = 1.0 - pk2_pos+ in mk_delay i r+ pk2_R =+ let i = stringL * negate 1+ r = 1.0 - pk2_pos+ dt = 2 + randId 'β' 0.001 0.11+ in mk_allpass i r dt * 0.99+ stringR =+ let i = pk2_R+ r = pk2_pos - src_pos+ in mk_delay i r+ source =+ let s = sinOsc ar 220 0 * 0.01+ p = pulse ar (60 + amplitude kr drv 0.01 0.01 * 11) 0.5 * 0.1+ f = rlpf (s + p) 320 0.05+ e = 1.0 - min (amplitude kr drv 0.01 0.01) 1.0+ in normalizer f 0.7 0.01 * e+ l_out = localOut (source * 0.2 + stringR)+ outL = pk1_L + pk1_R+ outR = pk2_L + pk2_R+in mrg [mce2 outL outR, drv, source, l_out]
+ Help/Graph/dm-shift-register.hs view
@@ -0,0 +1,55 @@+-- https://sccode.org/1-590 (dm)+let shift_register_f n tr x =+ let buf = localBuf 1 n+ count = pulseCount tr 0+ in mrg2+ (demand tr 0 (mceReverse (dbufrd buf (mceMap (+ count) (mce [1 .. n])) Loop)))+ (demand tr 0 (dbufwr buf count x Loop))+ amp = 0.1+ ip = impulse kr (1/16) 0+ rt = tChoose ip (mce [3,5,10])+ trs = tChoose ip (mce [0,2,-2,7,-5])+ tr1 = trig1 (cuspL ar (rt * 3) 1 1.9 0.0) 0.001+ tr4 = pulseDivider tr1 4 0+ oct = demand tr4 0 (drand dinf (mce [12,-12]))+ note = demand tr1 0 (dseq dinf (mce [42,46,51,54,59,63,66] + oct + trs)) -- scramble+ chord = shift_register_f 5 tr1 (midiCps note)+ sig = pmOsc ar+ (vibrato ar chord 6 0.02 0 0 0.04 0.1 0.0 0.0)+ (urange 1.01 2.01 (lfPulse kr (1/8) 0 0.5) * chord)+ (envGen kr tr1 1 0 1 DoNothing (envelope [3,3,0] [0, 0.2] [EnvNum (-4)]))+ 0+ cmp = mix (sig * ampCompA kr chord 0 0.32 1 * amp)+in xFade2+ (mce2 cmp cmp)+ (gVerb (bpf cmp (midiCps 90) 1) 50 8 0.5 0.5 15 0 0.7 0.5 300)+ 0.2+ 1++-- https://sccode.org/1-590 (dm) ; id+let shift_register_f n tr x =+ let buf = localBufId 'α' 1 n+ count = pulseCount tr 0+ in mrg2+ (demand tr 0 (mceReverse (dbufrdId 'γ' buf (mceMap (+ count) (mce [1 .. n])) Loop)))+ (demand tr 0 (dbufwrId 'β' buf count x Loop))+ amp = 0.1+ ip = impulse kr (1/16) 0+ rt = tChooseId 'δ' ip (mce [3,5,10])+ trs = tChooseId 'ε' ip (mce [0,2,-2,7,-5])+ tr1 = trig1 (cuspL ar (rt * 3) 1 1.9 0.0) 0.001+ tr4 = pulseDivider tr1 4 0+ oct = demand tr4 0 (drandId 'ζ' dinf (mce [12,-12]))+ note = demand tr1 0 (dseqId 'η' dinf (mceMap (+ trs) (mce [42,46,51,54,59,63,66])) + oct) -- scramble+ chord = shift_register_f 5 tr1 (midiCps note)+ sig = pmOsc ar+ (vibratoId 'θ' ar chord 6 0.02 0 0 0.04 0.1 0.0 0.0)+ (urange 1.01 2.01 (lfPulse kr (1/8) 0 0.5) * chord)+ (envGen kr tr1 1 0 1 DoNothing (envelope [3,3,0] [0, 0.2] [EnvNum (-4)]))+ 0+ cmp = mix (sig * ampCompA kr chord 0 0.32 1 * amp)+in xFade2+ (mce2 cmp cmp)+ (gVerb (bpf cmp (midiCps 90) 1) 50 8 0.5 0.5 15 0 0.7 0.5 300)+ 0.2+ 1
+ Help/Graph/ds-sos-bell.hs view
@@ -0,0 +1,45 @@+-- https://github.com/supercollider-quarks/SynthDefPool/blob/master/pool/sos_bell.scd (ds)+let f (_,g,_,_,z,o,_,_,p,_,_) =+ let mce_mean x = sum (mceChannels x) / fromIntegral (mceDegree_err x)+ freq = unitCps p / 2+ amp = z * g * 16+ pan = o * 2 - 1+ -- Stretched harmonic series+ s1 = sinOsc ar (mce [2,3,4.1,5.43,6.8,8.21] * freq) 0 * mce [1,0.9,0.8,0.7,0.6,0.5] * 0.1+ s2 = let e_dat = Envelope [0,1,0.3,0.2,0] [0,0.3,0.3,0.3] [] Nothing Nothing 0+ in s1 * envGen ar g 1 0 1 DoNothing e_dat+ -- A bit of FM adds warble+ s3 = s2 * (lfTri ar (X.randN 6 1.0 1.8) 1 * 0.3 + 0.7)+ -- Mix down the partials in the main sound+ s4 = mce_mean s3+ strike = let e_dat = Envelope [0,1,0.2,0.1,0] [0,0.01,0,0.04] [] Nothing Nothing 0+ e = envGen ar g 1 0 1 DoNothing e_dat+ in sinOsc ar (lfNoise1 ar (freq * 36) * 100 + (freq * 8 )) 1 * 0.1 * e+ hum = let e_dat = Envelope [0,0.05,0.05,0] [0.5,0.5,1] [] Nothing Nothing 0+ e = envGen ar g 1 0 1 DoNothing e_dat+ in mce_mean (sinOsc ar (mce2 (freq * 1.01) (freq * 0.47)) 0 * e)+ in pan2 (s4 + strike + hum) pan amp+in mix (voicer 16 f) * control kr "gain" 1++-- https://github.com/supercollider-quarks/SynthDefPool/blob/master/pool/sos_bell.scd (ds) ; id+let f (c,g,_,_,z,o,_,_,p,_,_) =+ let mce_mean x = sum (mceChannels x) / fromIntegral (mceDegree_err x)+ freq = unitCps p / 2+ amp = z * g * 16+ pan = o * 2 - 1+ -- Stretched harmonic series+ s1 = sinOsc ar (mce [2,3,4.1,5.43,6.8,8.21] * freq) 0 * mce [1,0.9,0.8,0.7,0.6,0.5] * 0.1+ s2 = let e_dat = Envelope [0,1,0.3,0.2,0] [0,0.3,0.3,0.3] [] Nothing Nothing 0+ in s1 * envGen ar g 1 0 1 DoNothing e_dat+ -- A bit of FM adds warble+ s3 = s2 * (lfTri ar (X.randNId 6 (c,'α') 1.0 1.8) 1 * 0.3 + 0.7)+ -- Mix down the partials in the main sound+ s4 = mce_mean s3+ strike = let e_dat = Envelope [0,1,0.2,0.1,0] [0,0.01,0,0.04] [] Nothing Nothing 0+ e = envGen ar g 1 0 1 DoNothing e_dat+ in sinOsc ar (lfNoise1Id (c,'β') ar (freq * 36) * 100 + (freq * 8 )) 1 * 0.1 * e+ hum = let e_dat = Envelope [0,0.05,0.05,0] [0.5,0.5,1] [] Nothing Nothing 0+ e = envGen ar g 1 0 1 DoNothing e_dat+ in mce_mean (sinOsc ar (mce2 (freq * 1.01) (freq * 0.47)) 0 * e)+ in pan2 (s4 + strike + hum) pan amp+in mix (voicer 16 f) * control kr "gain" 1
+ Help/Graph/es-tw-570012853274615808.hs view
@@ -0,0 +1,19 @@+-- https://twitter.com/sluyterrific_sc/status/570012853274615808 (es) ; edit=rd+let dup f = mce2 (f ()) (f ())+ -- this is not (of course) as written but sounds nicely....+ greyhole_no_reorder i = let (p,q) = unmce2 i in X.greyholeRaw p q+ t = dup (\_ -> dust2 ar 9)+ o = 0.1+ a = lfNoise2 ar o * 9 + 9+ s = varSaw ar (tExpRand 9 5000 t) 0 0.5 * decay t 1+in greyhole_no_reorder s a 0 o (lfNoise2 ar 1) (lfNoise2 ar 1 + 1) 2 a++-- https://twitter.com/sluyterrific_sc/status/570012853274615808 (es) ; edit=rd ; id+let dup (z1,z2) f = mce2 (f z1) (f z2)+ -- this is not (of course) as written but sounds nicely....+ greyhole_no_reorder i = let (p,q) = unmce2 i in X.greyholeRaw p q+ t = dup ('α','β') (\z -> dust2Id z ar 9)+ o = 0.1+ a = lfNoise2Id 'γ' ar o * 9 + 9+ s = varSaw ar (tExpRandId 'δ' 9 5000 t) 0 0.5 * decay t 1+in greyhole_no_reorder s a 0 o (lfNoise2Id 'ε' ar 1) (lfNoise2Id 'ζ' ar 1 + 1) 2 a
+ Help/Graph/f0-1-4Q6-p.hs view
@@ -0,0 +1,14 @@+-- http://sccode.org/1-4Q6 (f0)+let f (_,g,_,y,z,o,_,_,p,px,_) =+ let normalise x = map (/ (maximum x)) x+ amps = normalise [1,0.67,1,1.8,2.67,1.67,1.46,1.33,1.33,1,1.33]+ durs = [1,0.9,0.65,0.55,0.325,0.35,0.25,0.2,0.15,0.1,0.075]+ frqs = [0.56,0.56,0.92,0.92,1.19,1.7,2,2.74,3,3.76,4.07]+ dets = [0,1,0,1.7,0,0,0,0,0,0,0]+ fn i =+ let shp = let cv = EnvNum (-4.5)+ in envPerc_c 0.005 ((y + 1) * 6 * durs!!i) (amps!!i) (cv,cv)+ env = envGen ar g (latch z g) 0 1 DoNothing shp+ in sinOsc ar (midiCps (p * 127 + px) * frqs!!i + dets!!i) 0 * env * g+ in pan2 (mixFill 11 fn) (o * 2 - 1) 1+in mix (voicer 16 f) * control kr "gain" 0.75
+ Help/Graph/f0-2012-04-19.hs view
@@ -0,0 +1,7 @@+-- https://www.listarc.bham.ac.uk/lists/sc-users/msg17536.html (f0)+let s0 = lfSaw ar 10 0 * 0.01+ t0 = lfTri ar (mce2 5 6 * 0.1) 0+ t1 = lfTri kr 0.1 0 * 0.05 + 0.05+ s1 = limiter (brf s0 t0 1) 1 0.01+ o = combN s1 0.1 (roundTo t1 0.01) 1+in o * 0.1
+ Help/Graph/f0-pkt-00.hs view
@@ -0,0 +1,9 @@+-- http://www.fredrikolofsson.com/f0blog/?q=node/490 (f0)+let sosc fr = sinOsc ar fr 0+ f0 = mce3 100 200 300 + sosc (mce3 0.11 0.22 0.33)+ ph0 = sosc (mce3 0.1 0.2 0.3) * 2 * pi+ a0 = 0.1 + sosc (mce3 0.01 0.02 0.03) * 0.05+ i = sinOsc ar f0 ph0 * a0+ w = sosc (sosc (sosc 0.13 * 5 + 6) * 8 + 50)+ s = splay i w 0.7 (sosc 1.2 * 0.6) True+in mix (mceTranspose (gVerb s 20 5 1 0.5 25 0 1 1 30))
+ Help/Graph/f0-pkt-07.hs view
@@ -0,0 +1,10 @@+-- http://www.fredrikolofsson.com/f0blog/?q=node/490 (f0)+let param n =+ let f g z = take n (iterate g z)+ in zip4 (f (* 4) 2) (f (/ 2) (1/2)) (f (* 4) 1) (f (* 4) 2)+ gen f0 (m,f1,l,r) = sinOsc ar f0 0 * m + linExp (sinOsc ar f1 0) (-1) 1 l r+ pkt n =+ let c = foldl gen 1 (param n)+ o = sinOsc ar c 0 * 0.1+ in gVerb (leakDC o 0.995) 16 8 0.75 0.5 15 1 0.7 0.5 16 * 0.1+in pkt 12
+ Help/Graph/f0-pkt-26.hs view
@@ -0,0 +1,16 @@+-- http://www.fredrikolofsson.com/f0blog/?q=node/490 (f0)+let n = 8+ pkt i =+ let t = i / constant n+ a = abs (varSaw ar 0.02 t 0.5 * 7.5)+ b = varSaw ar 0.16 t (2/3) * a + 300+ c = varSaw ar 0.064 t 0.5 * 25 + 50+ d = varSaw ar 0.012 t 0.75 * c + 200+ e = varSaw ar 0.024 t 0.25 * 0.475 + 0.5+ f = varSaw ar (100 + i) t e+ g = varSaw ar 0.048 0 0.5 * 25 + 150+ h = varSaw ar ((i + 1) * g) t (1/3) * 150+ o = sinOsc ar h (f * pi) * d + b+ z = leakDC (varSaw ar o t 0.5) 0.995+ in pan2 z (varSaw ar 0.02 t 0.5) 1+in mixFill n pkt * (0.25 / constant n)
+ Help/Graph/f0-pkt-28.hs view
@@ -0,0 +1,18 @@+-- http://www.fredrikolofsson.com/f0blog/?q=node/490 (f0)+let n = 28+ pkt i =+ let a = lfSaw ar ((i + 1) * 5) 0 * 0.5 * pi+ b = sinOsc ar ((i + 1) * 0.001) 0 * 0.5+ c = max (lfSaw ar (0.2 + b) (i / constant n) * 0.4) 0+ d = sinOsc ar 0.03 (i + 1) * 0.5 + 1+ e = sinOsc ar (200 + i) 0 * d+ f = sinOsc ar 0.04 (i + 2) * 0.5 + 1+ g = sinOsc ar (400 + i) 0 * f+ h = sinOsc ar 0.05 (i + 3) * 0.5 + 1+ j = sinOsc ar (800 + i) 0 * h+ k = linExp i 0 (constant n - 1) 70 1500+ z = sinOsc ar k a * c * e * g * j+ l = linLin i 0 (constant n - 1) (-0.925) 0.925+ in pan2 z l (1 / constant n)+ y = limiter (leakDC (mixFill n pkt) 0.995) 1 0.01+in gVerb y 3 5 0.2 0.8 20 0.1 0.7 0.5 300 * 0.2
+ Help/Graph/f0-red-frik.hs view
@@ -0,0 +1,25 @@+-- red_frik (f0)+let red tr n =+ let o1 = fSinOsc kr (tRand 0.3 5 tr) 0 * tRand 0 0.5 tr + tRand 0.49 0.56 tr+ o2 = fSinOsc kr o1 0 * tRand 0.3 0.6 tr + tRand 0.3 0.5 tr+ in rhpf n (tRand 0.3 3 tr) o2 * 0.1+ n = mceFill 2 (\_ -> brownNoise ar)+ tr = impulse kr 0.1 0+in red tr n * 0.1++-- red_frik (f0) ; monad+let red tr n = do+ r1 <- tRandM 0.3 3 tr+ r2 <- tRandM 0.3 5 tr+ r3 <- tRandM 0 0.5 tr+ r4 <- tRandM 0.49 0.56 tr+ r5 <- tRandM 0.3 0.6 tr+ r6 <- tRandM 0.3 0.5 tr+ let o1 = fSinOsc kr r2 0 * r3 + r4+ o2 = fSinOsc kr o1 0 * r5 + r6+ return (rhpf n r1 o2 * 0.1)+ red_frik_m = do+ n <- replicateM 2 (brownNoiseM ar)+ let tr = impulse kr 0.1 0+ red tr (mce n)+in uid_st_eval red_frik_m * 0.1
+ Help/Graph/f0-tw-0454598285861617665.hs view
@@ -0,0 +1,7 @@+-- https://twitter.com/redFrik/status/454598285861617665 (f0)+let b = mce [9,8 .. 1]+ c = lfTri ar (3 ** lfTri ar (1 / b) (b / 9)) 0+ d = lfTri ar (1 / b) 0 `modE` 1 / 9 + 0.01+ f = 2 ** roundE (lfTri ar (b / 99) 0) * 99 * b+ o = grainSin 2 c d f 0 (-1) 512+in splay (tanh o) 1 1 0 True / 2
+ Help/Graph/f0-tw-0456384156159574016.hs view
@@ -0,0 +1,5 @@+-- https://twitter.com/redFrik/status/456384156159574016 (f0)+let a = 1 / mce [3,12,4,1,6,2]+ s = lag3 (sinOsc ar a 0) (abs (sinOsc ar (2.67 ** a) 0)) * 99+ f = ((sinOsc ar ((1 / a) / 9) a `greater_than` 0) * 20 + 99) / a+in splay (sinOsc ar (hpf (ringz s f 1) 440) 0) 1 1 0 True * 0.25
+ Help/Graph/f0-tw-0839296011982024704.hs view
@@ -0,0 +1,7 @@+-- https://twitter.com/redFrik/status/839296011982024704+let a x = lfSaw ar x 0+ t = a (mce [0.5,0.6])+ f = (a 5 * a 0.015 + 1) * 98+ m = (2 ** a 4 `roundTo` 0.5) * 99+ g = grainFM 1 t 16 f m (2 ** a (1 / mce [8,9]) * 8) 0 (-1) 512+in tanh (g / 2) * 0.25
+ Help/Graph/f0-tw-1105496695637454848.hs view
@@ -0,0 +1,12 @@+-- f0 ; https://twitter.com/redFrik/status/1105496695637454848+let b = mce [1 .. 15] / 151+ w = ceil (varSaw kr b b (1 / 5.15) + 1.5)+ s = select ((ceil (varSaw kr (1 / 15) (1 / 5) b * 5) + 5) / 5) (mce [51 * 1.5, 51, 151])+ x = lag s b+ y = varSaw kr (5 + b) 0 0.5+ z = varSaw kr b b b * (b / 5) + mce [1.5, 5, 1]+ m = varSaw kr (5 - b) b b * 5 + 5+ o = varSaw ar ((w * x + y) * z) b ((varSaw kr b 0 0.5 + 5) / 15) * (m `greater_than` 1.515)+ f = 1515 ** (varSaw kr ((1 - b) / 5) 0 0.5 / 15 + 1 + b)+ rq = 1.5 ** varSaw kr b 0 0.5 / 5+in splay (bLowPass o f rq) 1 1 0 True / 5
+ Help/Graph/f0-tw-1125557217086857216.hs view
@@ -0,0 +1,17 @@+-- https://twitter.com/redFrik/status/1125557217086857216 (f0) ; id+let scl = [0, 2.94, 4.98, 7.02, 9.96] -- pythagorean+ a = lfTri+ b = (mce [-7 .. 6] + 0.7) * 2/666+ m = degreeToKey (asLocalBuf scl) ((a kr b b * a kr b 0 * 9 + 9) `modE` 32) 12 + 24+ o = varSaw ar (midiCps m) 0 ((a kr b 0 + 1) / 2) * ampComp kr m 440 (1/3) * a kr b b * b * 9+ s = rlpf o (lag2 m ((1 / b) `modE` 1) * 3) 1+in tanh (splay (allpassN s 0.3 (0.2 - b) 3) 1 1 0 True)++-- https://twitter.com/redFrik/status/1125557217086857216 (f0) ; id+let scl = [0, 2.94, 4.98, 7.02, 9.96] -- pythagorean+ a = lfTri+ b = (mce [-7 .. 6] + 0.7) * 2/666+ m = degreeToKey (asLocalBufId 'α' scl) ((a kr b b * a kr b 0 * 9 + 9) `modE` 32) 12 + 24+ o = varSaw ar (midiCps m) 0 ((a kr b 0 + 1) / 2) * ampComp kr m 440 (1/3) * a kr b b * b * 9+ s = rlpf o (lag2 m ((1 / b) `modE` 1) * 3) 1+in tanh (splay (allpassN s 0.3 (0.2 - b) 3) 1 1 0 True)
+ Help/Graph/f0-tw-1136928201886904320.hs view
@@ -0,0 +1,11 @@+-- https://twitter.com/redFrik/status/1136928201886904320 (f0)+let gt = greater_than+ f a i =+ let b = mce [4,2,1,3,5]+ c = roundTo (a ar (1/b) 0 * b) (a ar (b/9) 0 `gt` 0)+ o = sinOscFB ar (c ** 2 * ((a ar 0.02 i `gt` 0) + 1 * 50)) (a ar (c/9) 0 `modE` 1)+ s = o * max (a ar (1/b * a ar (b/99) i) 0) 0 * a ar 0.01 i+ x = allpassC s 1 (wrap c 0.5 1) 2+ y = bpf x (i * 99 + 400) 0.001 * (a ar 0.04 i + 1 * 9)+ in splay (x + y) 1 1 0 True / 3+in sum (zipWith f [lfTri,lfSaw,lfPar] [0,1,2]) / 3
+ Help/Graph/f0-tw-1138498427241861122.hs view
@@ -0,0 +1,14 @@+-- https://twitter.com/redFrik/status/1138498427241861122 (f0)+let f = sqrt 9+ b = mce2 f 9.999+ e = pitchShift+ a = sinOscFB+ d = max (a ar (b/99) 0) 0+ t1 = ugen_if (a ar (a ar (9/999) 0) 0 `greater_than` a ar (9/99) 0) f (9/b)+ t2 = ugen_if (a ar (9/99) 0 `less_than` a ar (99/9999) 0) (b/9) f+ f1 = lag (9.9 * b * t1 * t2) 0.1+ s1 = a ar f1 d * a ar (b/9) 0 * d+ c = e s1 (9 / b) (9 / sqrt b) (b / 999) (b / 99)+ s2 = gVerb (c * d * d * d) 99 9 (9/999) 0.5 15 1 0.7 0.5 300+ s3 = s2 / 9 + e c (f/9) (f/9) 0 0+in mix (mceTranspose (hpf (splay s3 1 1 0 True) 9 / 9))
+ Help/Graph/f0-tw-1210118661022867458.hs view
@@ -0,0 +1,21 @@+-- f0 ; https://twitter.com/redFrik/status/1210118661022867458+let b = mce (map recip [2 .. 7])+ d = 1 / 48+ g = cos (cos 0)+ l = mce [0,-16,0,-16,0,0,-16,0,-16,0,-16,0,0,0,-16,-16,47,0,-16,0,-16,0,-16,0,0,-16,0,0,-16,0,0,0,0,0,-5,-16,-16,-15]+ f = duty ar b 0 DoNothing (dseq dinf (l + 48))+ o = sinOscFB ar f (max (sinOsc ar d 0) 0) * sin (cos 0)+ c = sinOsc ar 0 (pi ** o)+ p = pitchShift c g (recip b) d d * b+in leakDC (splay (c + p) 1 1 0 True) 0.995 * g++-- f0 ; https://twitter.com/redFrik/status/1210118661022867458 ; id+let b = mce (map recip [2 .. 7])+ d = 1 / 48+ g = cos (cos 0)+ l = mce [0,-16,0,-16,0,0,-16,0,-16,0,-16,0,0,0,-16,-16,47,0,-16,0,-16,0,-16,0,0,-16,0,0,-16,0,0,0,0,0,-5,-16,-16,-15]+ f = duty ar b 0 DoNothing (dseqId 'α' dinf (l + 48))+ o = sinOscFB ar f (max (sinOsc ar d 0) 0) * sin (cos 0)+ c = sinOsc ar 0 (pi ** o)+ p = pitchShift c g (recip b) d d * b+in leakDC (splay (c + p) 1 1 0 True) 0.995 * g
+ Help/Graph/f0-tw-1254441448327479299.hs view
@@ -0,0 +1,57 @@+-- f0 <https://twitter.com/redFrik/status/1254441448327479299>+let b = [1,3,5,8,10]+ e = [3,2/3,4,3/2,2]+ c = 0.021+ d = lfTri ar (mce b / 999) 0 `modE` 1+ m = lfTri ar (mce b * c) 0+ l = m * 7 + 20 + dseq dinf (mce b `modE` m * 5 + 6)+ j = duty ar (mce e / (12 ** m)) 0 DoNothing l+ f = midiCps (degreeToKey (asLocalBuf b) j 12)+ y = decay2 (impulse ar (mce [2/3,1.5,3,1.5,3]) 0) c d * d+ o = sinOscFB ar f ((lfTri ar (c / mce b) 0 + 1) / 3) * y+in freeVerb (splay o 1 1 0 True) 0.1 1 0.5 * 0.2++-- f0 <https://twitter.com/redFrik/status/1254441448327479299> ; id+let b = [1,3,5,8,10]+ e = [3,2/3,4,3/2,2]+ c = 0.021+ d = lfTri ar (mce b / 999) 0 `modE` 1+ m = lfTri ar (mce b * c) 0+ l = m * 7 + 20 + dseqId 'α' dinf (mce b `modE` m * 5 + 6)+ j = duty ar (mce e / (12 ** m)) 0 DoNothing l+ f = midiCps (degreeToKey (asLocalBufId 'β' b) j 12)+ y = decay2 (impulse ar (mce [2/3,1.5,3,1.5,3]) 0) c d * d+ o = sinOscFB ar f ((lfTri ar (c / mce b) 0 + 1) / 3) * y+in freeVerb (splay o 1 1 0 True) 0.1 1 0.5 * 0.2++-- rd (edit) ; f0 <https://twitter.com/redFrik/status/1254441448327479299>+let b = [1,3,5,8,10]+ e = [3,2/3,4,3/2,2]+ c = 0.021+ d = lfTri ar (mce b / 999) 0 `modE` 1+ m = lfTri ar (mce b * c) 0+ l = m * 7 + 20 + dseq dinf (mce b `modE` m * 5 + 6)+ j = duty ar (mce e / (12 ** m)) 0 DoNothing l+ k = degreeToKey (asLocalBuf b) j 12+ o = sinOscFB ar (midiCps k) (lfTri ar (((c / mce b) + 1) / 3) 1 * d)+ r = freeVerb (splay o 1 1 0 True) 0.1 1 0.5 * 0.2+ p = out 90 (a2k k)+in mrg2 r p++-- rd (edit) ; f0 <https://twitter.com/redFrik/status/1254441448327479299> ; id+let b = [1,3,5,8,10]+ e = [3,2/3,4,3/2,2]+ c = 0.021+ d = lfTri ar (mce b / 999) 0 `modE` 1+ m = lfTri ar (mce b * c) 0+ l = m * 7 + 20 + dseqId 'α' dinf (mce b `modE` m * 5 + 6)+ j = duty ar (mce e / (12 ** m)) 0 DoNothing l+ k = degreeToKey (asLocalBufId 'β' b) j 12+ o = sinOscFB ar (midiCps k) (lfTri ar (((c / mce b) + 1) / 3) 1 * d)+ r = freeVerb (splay o 1 1 0 True) 0.1 1 0.5 * 0.2+ p = out 90 (a2k k)+in mrg2 r p++---- ; drawings+UI.ui_sc3_scope 2 0 (2 ^ 14) 0 "audio" 0+UI.ui_sc3_ctl_plot 1200 5 90 1200 (1/25) 5
+ Help/Graph/f0-tw-1338987643057688579.hs view
@@ -0,0 +1,9 @@+-- f0 <https://twitter.com/redFrik/status/1338987643057688579>+let b = mce [8..18]+ x = varSaw ar (mce [18.1,81.8,1.81] + b) 1 (varSaw ar (b/81) 0 0.5)+ t = varSaw ar (8/1.818) (mce [1,8/18]) 0.5+ d = (varSaw ar (b/181.8) 0 0.5 `in_exprange` (1.81/818,1.8/181.8)) `roundTo` (1.81/818)+ c = varSaw ar (1/8) (1/b) 0.5 + 8.18 * 1.8+ z = varSaw ar (1/81.8) 0 0.5 `in_range` (1.8 ** (-1),8.1/8.18)+ p = (pluck x t (1.8/181.8) d c z * (varSaw ar (1.8/b) 0 0.5) / 1.8)+in hpf (splay p 1 1 0 True) (18/1.81)
+ Help/Graph/f0-tw-1343283697840226307.hs view
@@ -0,0 +1,20 @@+-- f0 <https://twitter.com/redFrik/status/1343283697840226307>+let b = mce [2..12] / 12+ f = mce [136.1, 163.3, 181.4, 204.1, 244.9, 272.1, 326.5, 362.8, 408.2, 489.8, 544.2]+ z = mceFill 11 (\_ -> whiteNoise ar) * ((lfTri ar b 0 + 1) / 2) + brownNoise ar+ t = lfTri ar (121 ** lfTri ar ((2 / 121) * b) 0) 0+ d = (lag2 ((1 / 212) `greater_than` lfTri ar (1/212.1) 0) (2 / b) / 12 * 1.2 + 1.2) / f+ p = pluck z t (2 / 121) d (1 / 2 * 12 / 1.2) ((lfTri ar (b/12) 0 + 1) / 2)+in splay (hpf p 12) 1 (1 / 2.1 / 2) 0 True++-- f0 <https://twitter.com/redFrik/status/1343283697840226307> ; id+let b = mce [2..12] / 12+ f = mce [136.1, 163.3, 181.4, 204.1, 244.9, 272.1, 326.5, 362.8, 408.2, 489.8, 544.2]+ z = mceFillInt 11 (\e -> whiteNoiseId ('α',e) ar) * ((lfTri ar b 0 + 1) / 2) + brownNoiseId 'β' ar+ t = lfTri ar (121 ** lfTri ar ((2 / 121) * b) 0) 0+ d = (lag2 ((1 / 212) `greater_than` lfTri ar (1/212.1) 0) (2 / b) / 12 * 1.2 + 1.2) / f+ p = pluck z t (2 / 121) d (1 / 2 * 12 / 1.2) ((lfTri ar (b/12) 0 + 1) / 2)+in splay (hpf p 12) 1 (1 / 2.1 / 2) 0 True++---- ; drawings+UI.ui_sc3_scope 2 0 (2 ^ 14) 0 "audio" 0
+ Help/Graph/f0-tw-1367808902457397250.hs view
@@ -0,0 +1,14 @@+-- f0 <https://twitter.com/redFrik/status/1367808902457397250>+-- there is a subtle error in this translation i cannot see+-- the only differences appears to be the shared (impulse ar 0 0) node and the ordering at sum3+let rat = [76.1, 76.1, 64, 57, 38.1, 85.4, 32, 114, 42.7, 47.9, 95.9]+ f i =+ let i_ = constant i+ f0 = (rat !! i) * (sinOsc ar (1 / 16) 0 `greater_than` 0 * 2 + 6 - (sinOsc ar (sinOsc ar (1 / 32) i_) 0 / 20))+ z = sinOsc ar f0 0 / 9+ x = varLag_env (floorE (sinOsc ar (1 / 64) 0 * 6 + 6)) 0.1 (EnvNum 0) Nothing+ y = varLag_env (sinOsc ar (sinOsc ar (1 / 4) (i_ / 11 * pi) `less_than` 0 * 2) 0 * 0.1) 0.01 (EnvNum (sinOsc ar 0.01 i_)) Nothing+ dly = (i_ + x) `modE` 11 / 33 + 0.1 + y+ dcy = sinOsc ar (1 / 9) 0 + 1+ in combC z 0.5 dly dcy+in tanh (splay (mce (map f [0 .. 10])) 1 1 0 True)
+ Help/Graph/f0-tw-15eN.hs view
@@ -0,0 +1,5 @@+-- f0 ; https://sccode.org/1-5eN+let s = gbmanN ar (mce2 2300 1150) 1.2 2.1+ f0 = pulse ar 4 (mce2 1 2 / 8) + (lfPulse ar (1/8) 0 0.5 / 5 + 1)+ f1 = lfSaw ar f0 0 + 2+in X.glitchRHPF s f1 1 * 0.05
+ Help/Graph/f0-tw0011.hs view
@@ -0,0 +1,6 @@+-- tw 0011 (f0) ; https://twitter.com/redFrik/status/23182604046+let s o i = sinOsc ar ((mce2 (constant i) (constant i + 0.0001)) ** 2 * f o (i - 1)) (f o (i - 1) * 0.0001) * f o (i - 1)+ f o i = if i > 0 then s o i else o+in f 60 6 / 60++---- note ; this graph has 48 UGens ; c.f. scd graph which has 1950
+ Help/Graph/f0-tw0014.hs view
@@ -0,0 +1,12 @@+-- http://fredrikolofsson.com/f0blog/?q=node/478 (f0)+let a = sinOscFB ar+ k = 1/9+ f i = let a0 = a (i+1) k * 999+ a1 = a k 1 * k+ a2 = a a0 k * a1+ a3 = a 0.1 3+ a4 = a a2 a3 * ((i+2) * 999)+ a5 = a k k+ in a a4 a5 * k+ s = sum (map f [0..9])+in mce2 s s * 0.1
+ Help/Graph/f0-tw0020.hs view
@@ -0,0 +1,12 @@+-- http://fredrikolofsson.com/f0blog/?q=node/478 (f0)+let a n = lfPulse ar n 0 0.5+ b = mce [1..4]+ a1 = (a (b/32) + 1) / 8+ a2 = (a a1 + 1) * b+ a3 = a (b/64)+ a4 = a (a (b/8)) * 2 + b+ a5 = a (4/b)+ a6 = a a2+ a7 = a ((a6 + ((mix a3 + a5) * a4)) * 100)+ s = mix a7 / 8+in mce2 s s * 0.1
+ Help/Graph/f0-tw0028.hs view
@@ -0,0 +1,22 @@+-- http://www.fredrikolofsson.com/f0blog/?q=node/537 (f0) ; slow to start...+let fib = 0 : scanl (+) 1 fib+ sc3_fib k = take k (drop 1 fib)+ n = map ((* 99) . (`mod` 8)) (sc3_fib 16)+ p = dseq dinf (dshuf 8 (mce (map fromInteger n)))+ q = combN (duty ar (1/8) 0 DoNothing p) 4 4 16+ o = lfTri ar q 0 / 4+ f = lfTri kr (1/16) 0 * 2e3 + 3e3+in pan2 (moogFF o f 2 0) 0 0.5++-- http://www.fredrikolofsson.com/f0blog/?q=node/537 (f0) ; slow to start... ; id+let fib = 0 : scanl (+) 1 fib+ sc3_fib k = take k (drop 1 fib)+ n = map ((* 99) . (`mod` 8)) (sc3_fib 16)+ p = dseqId 'α' dinf (dshufId 'β' 8 (mce (map fromInteger n)))+ q = combN (duty ar (1/8) 0 DoNothing p) 4 4 16+ o = lfTri ar q 0 / 4+ f = lfTri kr (1/16) 0 * 2e3 + 3e3+in pan2 (moogFF o f 2 0) 0 0.5++---- ;+sc3_fib 16 == [1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987]
+ Help/Graph/f0-tw0030.hs view
@@ -0,0 +1,6 @@+-- http://www.fredrikolofsson.com/f0blog/?q=node/537 (f0)+let a i j k l = lfPar ar i j * k + l+ f = a 1 0 5 (a (mce2 0.05 0.04) 0 50 160 `roundTo` 50)+ w = a 0.2 0 0.5 (a 3 0 0.2 0.5)+ o = varSaw ar f 0 w / 8+in gVerb o 80 3 0.5 0.5 15 1 0.7 0.5 300 * 0.1
+ Help/Graph/f0-tw0033.hs view
@@ -0,0 +1,17 @@+-- http://www.fredrikolofsson.com/f0blog/?q=node/537 (f0)+let f = roundE (lfPar ar (1/14) 0) * 20 + 80+ a = pulse ar (mce [1..4]) 0.35+ n = mceFill 4 (\_ -> brownNoise ar) * a+ z i = mce2 ((i + 1) * f) ((i * f) + (i + 1 / 3))+ o = lfPar ar (mce (map z [0..3])) 0+ (s1,s2) = unmce2 (splay ((o `greater_than` n) / 3) 1 1 0 True)+in (s1 + s2) * 0.1++-- http://www.fredrikolofsson.com/f0blog/?q=node/537 (f0) ; id+let f = roundE (lfPar ar (1/14) 0) * 20 + 80+ a = pulse ar (mce [1..4]) 0.35+ n = mce (map (flip brownNoiseId ar) ['α','β','γ','δ']) * a+ z i = mce2 ((i + 1) * f) ((i * f) + (i + 1 / 3))+ o = lfPar ar (mce (map z [0..3])) 0+ (s1,s2) = unmce2 (splay ((o `greater_than` n) / 3) 1 1 0 True)+in (s1 + s2) * 0.1
+ Help/Graph/f0-tw0041.hs view
@@ -0,0 +1,5 @@+-- http://www.fredrikolofsson.com/f0blog/?q=node/537 (f0)+let s = sweep ar (localIn' 6 ar) 1+ i = impulse ar (mce [1,0.749,6,12,3,4]) 0+ o = sinOsc ar (1 / runningMax s i) 0+in mrg [tanh (splay o 1 1 0 True) * 0.05,localOut o]
+ Help/Graph/f0-tw0045.hs view
@@ -0,0 +1,6 @@+-- http://www.fredrikolofsson.com/f0blog/?q=node/537 (f0)+let a i j k l = sinOsc ar i j * k + l+ f = a (a 0.11 0 1 0) 0 1 0+ p_f = a (95 * a 0.01 0 1 1) 0 (a 0.005 0 50 0) 100+ p = a p_f (a (mce2 98 97) 0 1 0) (pi + a 0.0005 0 1 0) 0+in tanh (a f p 1 0) * 0.1
+ Help/Graph/f0-tw0049.hs view
@@ -0,0 +1,7 @@+-- https://www.listarc.bham.ac.uk/lists/sc-users/msg18379.html (f0)+let t = 0+ o0 = lfSaw ar 3 0 * 9 + 99+ s0 = sweep ar t (mce [3..9]) `modE` o0+ s1 = sweep ar t (mce [33,32..3]) `modE` 128 .&. s0+ o1 = sinOsc ar (midiCps (s1 + 33)) 0 * pi+in splay (sinOsc ar 9 o1) 1 1 0 True / 12
+ Help/Graph/f0-tw0051.hs view
@@ -0,0 +1,8 @@+-- http://sccode.org/1-4Qy (f0)+let ascii_u = mce . map (constant . fromEnum)+ i = a (ascii_u "sunday")+ f = a (9 / ascii_u "slow") * 400 + 500+ w = a (7 / ascii_u "coding") + 1.1+ a = saw ar+ l = splay (bBandPass i f w / 5) 1 1 0 True+in gVerb l 10 3 0.5 0.5 15 1 0.7 0.5 300 * 0.2
+ Help/Graph/f0-tw0077.hs view
@@ -0,0 +1,7 @@+-- http://sccode.org/1-4Qy (f0)+let a = sinOsc ar+ f = a (1 / mce2 5 6) 0 + mce2 798 912+ p = (a (1 / 16) 0 * 19 + 99) * a (mce2 9 8) 0+ m = a (a 6 0 * a 0.009 0) 0+ b = a f p * m+in tanh (a (mce2 201 301) b) * 0.1
+ Help/Graph/f0-tw0084.hs view
@@ -0,0 +1,6 @@+-- http://sccode.org/1-4Qy (f0)+let a = saw ar+ f = a (mce [5,7..15] * 19) * 99 + 199+ g = a (mce [1,3..13] * 29) * 199 + 299+ w = a (mce [3,5..11] * (a 3 * 2 + 3)) * 299 + 399+in splay (formant ar f g w) 1 1 0 True / 9
+ Help/Graph/f0-tw0120.hs view
@@ -0,0 +1,8 @@+-- http://sccode.org/1-4Qy (f0)+let a = lfTri+ z = a kr (1 / mce2 7 8) 0 * a kr (1 / 9) 0 * 99+ l = midiCps (mce [60 .. 79])+ f = select z l+ w = a kr (1 / mce2 3 4) 0 `modE` 1+ o = varSaw ar f 0 w+in combN o 1 (1 / mce2 5 6) 8 / 8
+ Help/Graph/f0-tw0121.hs view
@@ -0,0 +1,7 @@+-- http://sccode.org/1-4Qy (f0)+let a = sinOsc+ z = a kr (1 / mce2 8 7) 0 * a kr (1 / 30) 0 * 9+ l = midiCps (mce [56,62 .. 98])+ m = a ar (1 / mce2 4 3) 0+ o = a ar (select z l) 0 * m+in tanh (combN o 1 (1 / mce2 6 5) 9) * 0.1
+ Help/Graph/f0-tw0125.hs view
@@ -0,0 +1,9 @@+-- http://sccode.org/1-4Qy (f0)+let g = control kr "amp" 0.15+ a = sinOsc ar+ f = a (1 / mce [8,9]) 0 * 4 + mce [400,202]+ u = (a (1/9) 0 + 1) / 88+ d = (a (1/8) 0 + 1) / 99+ i = inFeedback 1 (mce [1,0])+ p = combC (lagUD i u d) 1 0.08 9+in a f p * g
+ Help/Graph/f0-tw0134.hs view
@@ -0,0 +1,12 @@+-- http://sccode.org/1-4Qy (f0) (requires -w 512)+let mean l = sum l / fromIntegral (length l)+ a = lfSaw ar+ n' = 50+ n = constant n'+ z i = let o1 = a ((i + 1) / mce [3,4]) 0+ o2 = a ((i + 1) / 8) 0 + 1+ f0 = o1 `greater_than` o2 * (n / 2) + n+ m = a ((i + 1) / n) (i / (n / 2))+ o3 = blip ar f0 (i + mce [2,3]) * m+ in ringz o3 ((i + 1) * (n * 2 - 1)) 0.1+in mean (map z [0 .. n']) / 10
+ Help/Graph/f0-tw0220.hs view
@@ -0,0 +1,13 @@+-- http://www.fredrikolofsson.com/f0blog/?q=node/617 (f0)+let c = inFeedback 1 0+ b = clearBuf (localBuf 1 90000)+ g = tGrains 2 (sinOsc ar 3 0) b (c + 3) 2 12 0 0.1 4+ r = recordBuf ar b 0 1 0 1 Loop 1 DoNothing c+in mrg2 (hpf (sinOsc ar 99 (c * 6) / 9 + g) 9 * 0.75) r++-- http://www.fredrikolofsson.com/f0blog/?q=node/617 (f0) ; id+let c = inFeedback 1 0+ b = clearBuf (localBufId 'α' 1 90000)+ g = tGrains 2 (sinOsc ar 3 0) b (c + 3) 2 12 0 0.1 4+ r = recordBuf ar b 0 1 0 1 Loop 1 DoNothing c+in mrg2 (hpf (sinOsc ar 99 (c * 6) / 9 + g) 9 * 0.75) r
+ Help/Graph/f0-tw0224.hs view
@@ -0,0 +1,13 @@+-- http://www.fredrikolofsson.com/f0blog/?q=node/617 (f0)+let c = 200000+ b = clearBuf (localBuf 2 c)+ d = bufRd 2 ar b (sinOsc ar (mce2 2 3 * 9) 0 * c) NoLoop LinearInterpolation+ w = bufWr b (abs (sinOsc ar (mce2 99 145) 0) * c) Loop (sinOsc ar (3 / mce2 2 3) 0 / 3)+in mrg2 (d * 0.1) w++-- http://www.fredrikolofsson.com/f0blog/?q=node/617 (f0) ; id+let c = 200000+ b = clearBuf (localBufId 'α' 2 c)+ d = bufRd 2 ar b (sinOsc ar (mce2 2 3 * 9) 0 * c) NoLoop LinearInterpolation+ w = bufWr b (abs (sinOsc ar (mce2 99 145) 0) * c) Loop (sinOsc ar (3 / mce2 2 3) 0 / 3)+in mrg2 (d * 0.1) w
+ Help/Graph/f0-tw0225.hs view
@@ -0,0 +1,5 @@+-- http://www.fredrikolofsson.com/f0blog/?q=node/617 (f0)+let b = mce [1..8] * 99+ o = blip ar (b / 2 + lfSaw kr ((-8) / b) 1 * 99) (b / 4 + (lfSaw kr (1 / b) 1 * 99))+ c = combN (o * sinOsc ar (8 / b) (lfSaw ar (99 / b) 0)) 0.2 0.2 1+in sin (splay c 1 1 0 True) * 0.1
+ Help/Graph/jar-1-4Qx.hs view
@@ -0,0 +1,6 @@+-- http://sccode.org/1-4Qx (jar)+let f = lfCub kr 9.1 0 * 100 + mce [200,300,400,500]+ g = lfCub kr (1 / mce [2,3,5,7]) 0 * 0.5 + lfCub kr 9 0+ h = lfCub kr (1/2) 0 * 0.4 + 0.5+ s = lfCub ar f 0 * lag (g `greater_than` h) 0.1+in splay s 1 0.075 0 True
+ Help/Graph/jar-rk_20120422.hs view
@@ -0,0 +1,19 @@+-- rukano; Apr 22, 2012; Re: Epic Pads (jar)+let freq_f _ = midiCps (lchoose [60,64,65,67]) * (lfNoise2 kr 1 * 0.011 + 1)+ freq = mceFill 24 freq_f+ gen = lfSaw ar freq 0 * 0.1+ fmod = lfCub kr (1/12) 0 `in_range` (1,mouseX kr 2 16 Linear 0.2) -- modulate filter with mouse+ rqmod = lfNoise2 kr (1/8) `in_range` (0.1,1)+ sig = rlpf gen (freq * fmod) rqmod+ amp = mouseY kr 0 0.25 Linear 0.2+in splay sig 1 1 0 True * amp++-- rukano; Apr 22, 2012; Re: Epic Pads (jar) ; id+let freq_f z = midiCps (lchooseId z [60,64,65,67]) * (lfNoise2Id z kr 1 * 0.011 + 1)+ freq = mce (map freq_f (take 24 ['α'..]))+ gen = lfSaw ar freq 0 * 0.1+ fmod = lfCub kr (1/12) 0 `in_range` (1,mouseX kr 2 16 Linear 0.2) -- modulate filter with mouse+ rqmod = lfNoise2Id 'β' kr (1/8) `in_range` (0.1,1)+ sig = rlpf gen (freq * fmod) rqmod+ amp = mouseY kr 0 0.25 Linear 0.2+in splay sig 1 1 0 True * amp
+ Help/Graph/jh-4157.hs view
@@ -0,0 +1,27 @@+-- jh ; <https://scsynth.org/t/auditory-illusion-with-exponentially-spaced-frequencies/4157>+mix (sinOsc ar (300 * mce (map (4 **) (take 200 [0, 0.002 ..]))) 0 * 0.02)++-- jh ; <https://scsynth.org/t/auditory-illusion-with-exponentially-spaced-frequencies/4157> ; doppler+splay (sinOsc ar (120 * mce (map (2 **) (take 100 [0, 0.002 ..]))) 0) 1 0.1 0 True++-- jh ; <https://scsynth.org/t/auditory-illusion-with-exponentially-spaced-frequencies/4157> ; doppler-formants+splay (saw ar (120 * mce (map (2 **) (take 100 [0, 0.002 ..])))) 1 0.1 0 True++-- sinosc ; <https://scsynth.org/t/auditory-illusion-with-exponentially-spaced-frequencies/4157> ; rd (edit)+let k = 100 -- 200 ; c.f. 12 25 50 100 200 400 600 800+ b = 2 -- 4 ; c.f. 2, 3, 4+ n = 0.02 -- 0.002 ; c.f. 0.002 0.004 0.01 0.05 0.1 0.125+ f0 = 120 -- 300 ; c.f. 120 180 240+ fMul = map (b **) (take k [0, n ..])+in splay (sinOsc ar (mce fMul * f0) 0) 1 0.1 0 True++-- sinosc ; <https://scsynth.org/t/auditory-illusion-with-exponentially-spaced-frequencies/4157> ; rd (edit)+let k = 160+ t = impulse ar 0.1 0+ sinosc f = sin (phasor ar t (f * sampleDur) 0 1 0 * 2 * pi)+ b = tRand 2 2.25 t+ n = tRand 0.002 0.02 t+ f0 = tRand 90 180 t+ fMul = map (b **) (take k [0, n ..])+ e = envGen ar t 1 0 1 DoNothing (envPerc 1 10)+in splay (sinosc (mce fMul * f0)) 1 0.1 0 True * e
+ Help/Graph/jl-1-9.hs view
@@ -0,0 +1,13 @@+-- http://sccode.org/1-9 (jl)+let n = 956 -- 0+ k = 99 -- 1+ a = hpf (pinkNoise ar * 0.005) 10 * line kr 0 1 9 DoNothing+ f i = ringz (a * lfNoise1 kr (0.05 + rand 0 0.1)) (55 * (i + n) + 60) 0.2+in tanh (gVerb (mixFill k f) 70 99 0.5 0.5 15 1 0.7 0.5 300)++-- http://sccode.org/1-9 (jl) ; id+let n = 956 -- 0+ k = 98 -- 1+ a = hpf (pinkNoiseId 'α' ar * 0.005) 10 * line kr 0 1 9 DoNothing+ f (z,i) = ringz (a * lfNoise1Id z kr (0.05 + randId z 0 0.1)) (55 * (i + n) + 60) 0.2+in tanh (gVerb (sum (map f (zip ['β' ..] [0 .. k]))) 70 99 0.5 0.5 15 1 0.7 0.5 300)
+ Help/Graph/jl-bitwise.hs view
@@ -0,0 +1,7 @@+-- bitwise ; a0f253ff89f6b244ea29a1e431dd9e5df5571a8b (jl)+let t = pulseCount (impulse ar 8e3 0) 0+ s = ((((t * 15) .&. (t .>>. 5)) .|.+ ((t * 5) .&. (mce2 (t .>>. 3) (t .>>. 4))) .|.+ ((t * 2) .&. (t .>>. 9)) .|.+ ((t * 8) .&. (t .>>. 11))) - 3) `modE` 256+in tanh (hpf (((s / 127) - 1) * 3) 20) * 0.02
+ Help/Graph/jl-dark-sea-horns.hs view
@@ -0,0 +1,15 @@+-- http://sccode.org/1-j#c51 (jl)+let n = lfNoise1+ x = localIn' 2 ar+ a = tanh (sinOsc ar 65 (x * lfNoise1 ar 0.1 * 3) * lfNoise1 ar 3 * 6)+ f i = allpassN i 0.3 (X.randN 2 0.1 0.3) 5+ o = tanh (iter 9 f a)+in mrg2 (o * 0.2) (localOut o)++-- http://sccode.org/1-j#c51 (jl) ; id+let n = lfNoise1Id+ x = localIn' 2 ar+ a = tanh (sinOsc ar 65 (x * n 'α' ar 0.1 * 3) * n 'β' ar 3 * 6)+ f z i = allpassN i 0.3 (X.randNId 2 (z,'γ') 0.1 0.3) 5+ o = tanh (useqId 'δ' 9 f a)+in mrg2 (o * 0.2) (localOut o)
+ Help/Graph/jl-jl-1-Z.hs view
@@ -0,0 +1,8 @@+-- http://sccode.org/1-Z (jl)+let a = lag (impulse kr 8 0) 0.1+ b = crackle ar (lag (abs (lfSaw kr 3 0)) 0.1 * 1.8)+ c = a * b+ d = lag (impulse kr 2 0 + impulse kr 4 0.5) 0.1+ e = blip ar 4.9 7 * 0.4+ f = d * e+in tanh (c + gVerb f 1 1 0.5 0.5 15 1 0.7 0.5 300 * 5) * 0.5
+ Help/Graph/jl-pwm-crossfade.hs view
@@ -0,0 +1,15 @@+-- http://sccode.org/1-L (jl)+let urangeMce u = let [u0,u1] = mceChannels u in urange u0 u1+ n = mce [400,500,450,376,600]+ d = 1/20+ f = demand (impulse kr d (mce2 0 0.5)) 0 (dseq dinf n)+ f_ = urangeMce f (lfPulse kr 8 0 (range 0 1 (lfTri kr d 1)))+in lpf (saw ar (max 376 f_ * mce2 1 0.99) * 0.5) 8000 * 0.1++-- http://sccode.org/1-L (jl) ; id+let urangeMce u = let [u0,u1] = mceChannels u in urange u0 u1+ n = mce [400,500,450,376,600]+ d = 1/20+ f = demand (impulse kr d (mce2 0 0.5)) 0 (dseqId 'α' dinf n)+ f_ = urangeMce f (lfPulse kr 8 0 (range 0 1 (lfTri kr d 1)))+in lpf (saw ar (max 376 f_ * mce2 1 0.99) * 0.5) 8000 * 0.1
+ Help/Graph/jl-rain-thunder.hs view
@@ -0,0 +1,23 @@+-- http://sccode.org/1-e (jl)+let d0 = lpf (dust2 ar (lfNoise1 kr 0.2 `in_range` (40,50))) 7000+ n0 = pinkNoise ar * (0.08 + lfNoise1 kr 0.3 * 0.02) + d0+ e0 = line kr 0 1 10 DoNothing+ p0 = tanh (3 * gVerb (hpf n0 400) 250 100 0.25 0.5 15 0.3 0.7 0.5 300 * e0)+ lfNoise1C r f = clip (lfNoise1 r f) 0 1+ n1 = pinkNoise ar * ((lfNoise1C kr 3 * lfNoise1C kr 2) ** 1.8)+ f1 = linExp (lfNoise1 kr 1) (-1) 1 100 2500+ e1 = line kr 0 0.7 30 DoNothing+ p1 = gVerb (tanh (lpf (10 * hpf n1 20) f1)) 270 30 0.7 0.5 15 0.5 0.7 0.5 300 * e1+in limiter (p0 + p1) 1 0.01 * 0.2++-- http://sccode.org/1-e (jl) ; id+let d0 = lpf (dust2Id 'γ' ar (lfNoise1Id 'δ' kr 0.2 `in_range` (40,50))) 7000+ n0 = pinkNoiseId 'α' ar * (0.08 + lfNoise1Id 'β' kr 0.3 * 0.02) + d0+ e0 = line kr 0 1 10 DoNothing+ p0 = tanh (3 * gVerb (hpf n0 400) 250 100 0.25 0.5 15 0.3 0.7 0.5 300 * e0)+ lfNoise1C e r f = clip (lfNoise1Id e r f) 0 1+ n1 = pinkNoiseId 'ε' ar * ((lfNoise1C 'ζ' kr 3 * lfNoise1C 'η' kr 2) ** 1.8)+ f1 = linExp (lfNoise1Id 'θ' kr 1) (-1) 1 100 2500+ e1 = line kr 0 0.7 30 DoNothing+ p1 = gVerb (tanh (lpf (10 * hpf n1 20) f1)) 270 30 0.7 0.5 15 0.5 0.7 0.5 300 * e1+in limiter (p0 + p1) 1 0.01 * 0.2
+ Help/Graph/jmcc-aleatoric-quartet.hs view
@@ -0,0 +1,38 @@+-- aleatoric quartet (jmcc) #7+let base_mn = 66 -- control kr "note" 66+ amp = 0.07 -- control kr "amp" 0.07+ density = mouseX kr 0.01 1 Linear 0.1+ dmul = recip density * 0.5 * amp+ dadd = amp - dmul+ rapf i = allpassN i 0.05 (mce2 (rand 0 0.05) (rand 0 0.05)) 1+ mk_f _ = let m = lfNoise0 kr (lchoose [1, 0.5, 0.25]) * 7 + base_mn + rand (-30) 30+ in midiCps (lag (roundTo m 1) 0.2)+ mk_s n = let x = pinkNoise ar * max 0 (lfNoise1 kr 8 * dmul + dadd)+ in pan2 (combL x 0.02 (recip (mk_f n)) 3) (rand2 1) 1+ g = iter 5 rapf (mixFill 4 mk_s)+in leakDC g 0.995++-- aleatoric quartet (jmcc) #7 ; monadic+let aleatoric_quartet_m = do+ let base_mn = 66 -- control kr "note" 66+ amp = 0.07 -- control kr "amp" 0.07+ density = mouseX kr 0.01 1 Linear 0.1+ dmul = recip density * 0.5 * amp+ dadd = amp - dmul+ rapf i = do r <- replicateM 2 (randM 0 0.05)+ return (allpassN i 0.05 (mce r) 1)+ mk_f = do r0 <- lchooseM [1, 0.5, 0.25]+ r1 <- randM (-30) 30+ n0 <- lfNoise0M kr r0+ let m = n0 * 7 + base_mn + r1+ m' = lag (roundTo m 1) 0.2+ return (midiCps m')+ mk_s = do f <- fmap recip mk_f+ r <- randM (-1) 1+ x <- do n0 <- pinkNoiseM ar+ n1 <- lfNoise1M kr 8+ return (n0 * max 0 (n1 * dmul + dadd))+ return (pan2 (combL x 0.02 f 3) r 1)+ g <- chainM 5 rapf =<< fmap sum (sequence (replicate 4 mk_s))+ return (leakDC g 0.995)+in uid_st_eval aleatoric_quartet_m
+ Help/Graph/jmcc-alien-froggies.hs view
@@ -0,0 +1,20 @@+-- alien froggies (jmcc) #1 ; texture=overlap,0.25,0.5,5,inf+let alien_froggies_n r =+ let r' = fold (r * exp (linRand (-0.2) 0.2 0)) 1 30+ o = formant ar r' (expRand 200 3000) (rand 0 9 * r' + r')+ in o * 0.05+in alien_froggies_n 11++-- alien froggies (jmcc) #1 ; texture=overlap,0.25,0.5,5,inf ; id+let alien_froggies_n r =+ let r' = fold (r * exp (linRandId 'α' (-0.2) 0.2 0)) 1 30+ o = formant ar r' (expRandId 'β' 200 3000) (randId 'γ' 0 9 * r' + r')+ in o * 0.05+in alien_froggies_n 11++-- alien froggies (jmcc) #1 ; event control+let f (_,g,x,y,z,o,rx,_,_,_,_) =+ let r = fold (11 * exp (x * 0.4 - 0.2)) 1 30+ s = formant ar r (linExp y 0 1 200 3000) (rx * 9 * r + r)+ in pan2 s (o * 2 - 1) (0.5 * z * g)+in mix (voicer 16 f) * control kr "gain" 1
+ Help/Graph/jmcc-alien-meadow.hs view
@@ -0,0 +1,9 @@+-- alien meadow (jmcc) #6 ; texture=overlap,2,6,6,inf+let b = rand 0 5000+ f = sinOsc ar (rand 0 20) 0 * b * 0.1 + b+in pan2 (sinOsc ar f 0) (rand2 1) (sinOsc ar (rand 0 20) 0 * 0.05 + 0.05)++-- alien meadow (jmcc) #6 ; texture=overlap,2,6,6,inf ; id+let b = randId 'α' 0 5000+ f = sinOsc ar (randId 'β' 0 20) 0 * b * 0.1 + b+in pan2 (sinOsc ar f 0) (randId 'γ' (-1) 1) (sinOsc ar (randId 'δ' 0 20) 0 * 0.05 + 0.05)
+ Help/Graph/jmcc-analog-bubbles-mouse.hs view
@@ -0,0 +1,17 @@+-- analog bubbles with mouse control (jmcc) #3+let y = mouseY kr 0.1 10 Exponential 0.2 {- lfo 1 rate -}+ x = mouseX kr 2 40 Exponential 0.2 {- lfo 2 rate -}+ o2 = lfSaw kr x 0 * (-3) + 80 {- depth & offset in semitones -}+ o1 = lfSaw kr y 0 * 24 + o2 {- depth in semitones, offset is lfo_2 -}+ f = midiCps o1 {- convert to frequency -}+ s = sinOsc ar f 0 * 0.04+in combN s 0.2 0.2 4 {- echoing sine wave -}++-- analog bubbles (jmcc) #1 ; C-cC-v c.f. hsc3-ui-region+let f1 = control_m kr "f1" 0.4 (0.1,16,"exp")+ f2 = control_m kr "f2" 8.0 (0.1,16,"exp")+ dt = control_m kr "dt" 0.90375 (0.5,2,"lin")+ o = lfSaw kr (mce2 f2 (f2 * dt)) 0 * 3 + 80+ f = lfSaw kr f1 0 * 24 + o+ s = sinOsc ar (midiCps f) 0 * 0.04+in combN s 0.2 0.2 4
+ Help/Graph/jmcc-analog-bubbles.hs view
@@ -0,0 +1,5 @@+-- analog bubbles (jmcc) #1+let o = lfSaw kr (mce2 8 7.23) 0 * 3 + 80+ m = lfSaw kr 0.4 0 * 24 + o+ s = sinOsc ar (midiCps m) 0 * 0.04+in combN s 0.2 0.2 4 * 0.1
+ Help/Graph/jmcc-analogue-daze.hs view
@@ -0,0 +1,33 @@+-- ; analogue daze (jmcc) #3+let dsequ s tr = demand tr 0 (dseq dinf (mce s))+ patternList = [55,63,60,63,57,65,62,65]+ f octave clockRate pwmrate fltrate =+ let trg = impulse kr clockRate 0+ freq = map (midiCps . (+ (12 * octave))) patternList+ sq = dsequ freq trg+ pwm = sinOsc kr pwmrate (rand 0 (2 * pi)) * 0.4 + 0.5+ cf = sinOsc kr fltrate (rand 0 (2 * pi)) * 1400 + 2000+ in rlpf (lfPulse ar (lag sq 0.05) 0 pwm * 0.1) cf (1/15)+ a = lfNoise0 ar (lfNoise1 kr 0.3 * 6000 + 8000) * (mce2 0.07 0.08)+ x = decay (impulse ar 2 0) 0.15 * a+ g = mce [f 1 8 0.31 0.2,f 0 2 0.13 0.11] + x+ z = 0.4 * (combN g 0.375 0.375 5 + mceReverse g)+ e = envLinen 2 56 2 1+in z * envGen kr 1 1 0 1 RemoveSynth e++-- ; analogue daze (jmcc) #3 ; id+let dsequId k s tr = demand tr 0 (dseqId k dinf (mce s))+ patternList = [55,63,60,63,57,65,62,65]+ f k octave clockRate pwmrate fltrate =+ let trg = impulse kr clockRate 0+ freq = map (midiCps . (+ (12 * octave))) patternList+ sq = dsequId 'α' freq trg+ pwm = sinOsc kr pwmrate (randId (k,'β') 0 (2 * pi)) * 0.4 + 0.5+ cf = sinOsc kr fltrate (randId (k,'γ') 0 (2 * pi)) * 1400 + 2000+ in rlpf (lfPulse ar (lag sq 0.05) 0 pwm * 0.1) cf (1/15)+ a = lfNoise0Id 'δ' ar (lfNoise1Id 'ε' kr 0.3 * 6000 + 8000) * (mce2 0.07 0.08)+ x = decay (impulse ar 2 0) 0.15 * a+ g = mce [f 'ζ' 1 8 0.31 0.2,f 'η' 0 2 0.13 0.11] + x+ z = 0.4 * (combN g 0.375 0.375 5 + mceReverse g)+ e = envLinen 2 56 2 1+in z * envGen kr 1 1 0 1 RemoveSynth e
+ Help/Graph/jmcc-babbling-brook.hs view
@@ -0,0 +1,18 @@+-- babbling brook (jmcc) #Sc3+let b f m a g _ = let n3 = lpf (brownNoise ar) f * m + a+ n4 = onePole (brownNoise ar) 0.99+ in rhpf n4 n3 0.03 * g+ x = mceFill 2 (b 14 400 500 0.006)+ y = mceFill 2 (b 20 800 1000 0.010)+in x + y++-- babbling brook (jmcc) #Sc3+uid_st_eval (do+ let b f m a g = do n1 <- brownNoiseM ar+ n2 <- brownNoiseM ar+ let n3 = lpf n2 f * m + a+ n4 = onePole n1 0.99+ return (rhpf n4 n3 0.03 * g)+ x <- replicateM 2 (b 14 400 500 0.006)+ y <- replicateM 2 (b 20 800 1000 0.010)+ return (mce x + mce y))
+ Help/Graph/jmcc-bach-prelude.hs view
@@ -0,0 +1,16 @@+-- jmcc <https://soundcloud.com/soundaspureform/bach-prelude>+let p1 = [[60,64,67,72,76],[60,62,69,74,77],[59,62,67,74,77],[60,64,67,72,76]+ ,[60,64,69,76,81],[60,62,66,69,74],[59,62,67,74,79],[59,60,64,67,72]+ ,[57,60,64,67,72],[50,57,62,66,72],[55,59,62,67,71],[55,58,64,67,73]+ ,[53,57,62,69,74],[53,56,62,65,71],[52,55,60,67,72],[52,53,57,60,65]+ ,[50,53,57,60,65],[43,50,55,59,65],[48,52,55,60,64],[48,55,58,60,64]+ ,[41,53,57,60,64],[42,48,57,60,63],[44,53,59,60,62],[43,53,55,59,62]+ ,[43,52,55,60,64],[43,50,55,60,65],[43,50,55,59,65],[43,51,57,60,66]+ ,[43,52,55,60,67],[43,50,55,60,65],[43,50,55,59,65],[36,48,55,58,64]]+ p2 = [[36,48,53,57,60,65,60,57,60,57,53,57,53,50,53,50]+ ,[36,47,67,71,74,77,74,71,74,71,67,71,62,65,64,62]+ ,replicate 16 60]+ p = concatMap (concat . replicate 2 . (\x -> x ++ drop 2 x)) p1 ++ concat p2+ tr = impulse kr 5 0+ freq = demand tr 0 (dseq 1 (mce (map midiCps p)))+in pan2 (freeVerb (lpf (saw ar (lag freq 0.03)) 1000) 0.3 0.5 0.35) 0 0.2
+ Help/Graph/jmcc-berlin-1977.hs view
@@ -0,0 +1,47 @@+-- berlin 1977 (jmcc) #4+let dsequ sq tr = demand tr 0 (dseq dinf (mce sq))+ dsequR sq tr = demand tr 0 (dshuf dinf (mce sq))+ clock_rate = mouseX kr 5 20 Exponential 0.2 {- mouse x controls clock rate -}+ clock_time = 1 / clock_rate+ clock = impulse kr clock_rate 0 {- sequencer trigger -}+ patternList = [55,60,63,62,60,67,63,58]+ note = dsequ patternList clock {- midi note pattern sequencer -}+ clock_16 = pulseDivider clock 16 0 {- divide clock by 16 -}+ note' = dsequR [-12,-7,-5,0,2,5] clock_16 + note {- transpose somewhat randomly -}+ freq = midiCps note' {- convert midi note to cycles per second -}+ env = decay2 clock (0.05 * clock_time) (2 * clock_time)+ amp = env * 0.1 + 0.02 {- amplitude envelope -}+ filt = env * (fSinOsc kr 0.17 0 * 800) + 1400 {- filter frequency -}+ pw = sinOsc kr 0.08 (mce2 0 (0.5 * pi)) * 0.45 + 0.5 {- pulse width LFO(s) -}+ s = pulse ar freq pw * amp+in combN (rlpf s filt 0.15) 0.2 (mce2 0.2 0.17) 1.5++-- berlin 1977 (jmcc) #4 ; id+let dsequId z sq tr = demand tr 0 (dseqId z dinf (mce sq))+ dsequRId z sq tr = demand tr 0 (dshufId z dinf (mce sq))+ clock_rate = mouseX kr 5 20 Exponential 0.2 {- mouse x controls clock rate -}+ clock_time = 1 / clock_rate+ clock = impulse kr clock_rate 0 {- sequencer trigger -}+ patternList = [55,60,63,62,60,67,63,58]+ note = dsequId 'α' patternList clock {- midi note pattern sequencer -}+ clock_16 = pulseDivider clock 16 0 {- divide clock by 16 -}+ note' = dsequRId 'β' [-12,-7,-5,0,2,5] clock_16 + note {- transpose somewhat randomly -}+ freq = midiCps note' {- convert midi note to cycles per second -}+ env = decay2 clock (0.05 * clock_time) (2 * clock_time)+ amp = env * 0.1 + 0.02 {- amplitude envelope -}+ filt = env * (fSinOsc kr 0.17 0 * 800) + 1400 {- filter frequency -}+ pw = sinOsc kr 0.08 (mce2 0 (0.5 * pi)) * 0.45 + 0.5 {- pulse width LFO(s) -}+ s = pulse ar freq pw * amp+in combN (rlpf s filt 0.15) 0.2 (mce2 0.2 0.17) 1.5++-- berlin 1977 (jmcc) #4 ; event-control+let f (_,w,_,y,z,_,_,_,p,_,_) =+ let freq = unitCps p+ env = decay2 (trig w controlDur) (0.05 * y) (2 * y)+ amp = env * z + 0.02+ filt = env * (fSinOsc kr 0.17 0 * 800) + 1400 {- filter frequency -}+ pw = sinOsc kr 0.08 (mce2 0 (0.5 * pi)) * 0.45 + 0.5 {- pulse width LFO(s) -}+ s = pulse ar freq pw * amp+ in combN (rlpf s filt 0.15) 0.2 (mce2 0.2 0.17) 1.5 * lagUD w 0 (2 + y)+in mix (voicer 16 f) * control kr "gain" 1+
+ Help/Graph/jmcc-birdies.hs view
@@ -0,0 +1,17 @@+-- birdies (jmcc) #6 ; texture=overlap,7,4,4,inf+let p1 = lfPulse kr (0.4 + rand 0 1) 0 (rand 0 0.8 + 0.1) * (rand 0 3 + 4) + 2+ p2 = lfPulse kr (0.4 + rand 0 1) 0 (rand 0 0.8 + 0.1) * (rand 0 3 + 4)+ p3 = lfPulse kr (0.2 + rand 0 0.5) 0 0.4 * 0.02+ sw = lfSaw kr (p1 + p2) 0 * (- (1000 + rand 0 800)) + (4000 + rand2 1200)+ freq = lag sw 0.05+ amp = lag p3 0.3+in pan2 (sinOsc ar freq 0 * amp) (rand2 1) 1++-- birdies (jmcc) #6 ; texture=overlap,7,4,4,inf ; id+let p1 = lfPulse kr (0.4 + randId 'α' 0 1) 0 (randId 'β' 0 0.8 + 0.1) * (randId 'γ' 0 3 + 4) + 2+ p2 = lfPulse kr (0.4 + randId 'δ' 0 1) 0 (randId 'ε' 0 0.8 + 0.1) * (randId 'ζ' 0 3 + 4)+ p3 = lfPulse kr (0.2 + randId 'η' 0 0.5) 0 0.4 * 0.02+ sw = lfSaw kr (p1 + p2) 0 * (- (1000 + randId 'θ' 0 800)) + (4000 + rand2Id 'ι' 1200)+ freq = lag sw 0.05+ amp = lag p3 0.3+in pan2 (sinOsc ar freq 0 * amp) (rand2Id 'κ' 1) 1
+ Help/Graph/jmcc-birds.hs view
@@ -0,0 +1,30 @@+-- birds (jmcc)+let node _ = let f = rand 94.0 102.0 + lag (lfSaw ar (7 + rand2 1.5) (rand 0 1) * rand 11 15) 0.1+ a = lfPulse kr (1.0 / rand 12 15.6) (rand 0 1) 0.16 * 0.05+ b = sinOsc ar (midiCps f) (rand 0 1) * a+ in rotate2 b (silent 1) (rand2 1)+ apfr i = allpassL i 0.07 (rand 0 0.06) (rand 0.7 2.0)+ d = mixFill 6 node+ w = iter 12 apfr d+in d * 0.7 + w * 0.3++-- birds (jmcc) ; monad+uid_st_eval (do+ let node = do r1 <- randM 94.0 102.0+ r2 <- randM (-1.5) 1.5+ r3 <- randM 0.0 1.0+ r4 <- randM 11.0 15.0+ r5 <- randM 0.0 1.0+ r6 <- randM 12.0 15.6+ r7 <- randM 0.0 1.0+ r8 <- randM (-1.0) 1.0+ let f = r1 + lag (lfSaw ar (7 + r2) r3 * r4) 0.1+ a = lfPulse kr (1.0 / r6) r7 0.16 * 0.05+ b = sinOsc ar (midiCps f) r5 * a+ return (rotate2 b (silent 1) r8)+ apf_r i = do r1 <- randM 0.0 0.06+ r2 <- randM 0.7 2.0+ return (allpassL i 0.07 r1 r2)+ d <- return . sum =<< sequence (replicate 6 node)+ w <- chainM 12 apf_r d+ return (d * 0.7 + w * 0.3))
+ Help/Graph/jmcc-blips.hs view
@@ -0,0 +1,21 @@+-- blips 001 (jmcc) #Sc3d1.5 ; texture=overlap,2,1,12,inf+let mk _ =+ let f = xLine kr (expRand 0.25 400) (expRand 0.25 400) 4 DoNothing+ nh = xLine kr (expRand 2 100) (expRand 2 100) 4 DoNothing+ in blip ar f nh+ pp = iter 6 (\x -> allpassN x 0.05 (mce2 (rand 0 0.05) (rand 0 0.05)) 4) . distort+in pp (rand 0 1 <** 0.8 * pan2 (mk () * mk ()) (line kr (rand2 1) (rand2 1) 4 DoNothing) 0.3)++-- blips 001 (jmcc) #Sc3d1.5 ; texture=overlap,2,1,12,inf ; id+let mk z =+ let f = xLine kr (expRandId (z,'α') 0.25 400) (expRandId (z,'β') 0.25 400) 4 DoNothing+ nh = xLine kr (expRandId (z,'γ') 2 100) (expRandId (z,'δ') 2 100) 4 DoNothing+ in blip ar f nh+ s =+ let c = randId 'ε' 0 1 <** 0.8+ o = mk 'ζ' * mk 'η'+ in c * pan2 o (line kr (rand2Id 'θ' 1) (rand2Id 'ι' 1) 4 DoNothing) 0.3+ pp =+ let f z x = allpassN x 0.05 (mce2 (randId (z,'κ') 0 0.05) (randId (z,'λ') 0 0.05)) 4+ in Sound.Sc3.Common.Base.compose_l (map f (id_seq 6 'μ')) . distort+in pp s
+ Help/Graph/jmcc-bouncing-objects.hs view
@@ -0,0 +1,25 @@+-- bouncing objects (jmcc) #2 ; texture=spawn,1,inf+let imp_frq = xLine kr (5 + rand (-2) 2) 600 4 DoNothing+ imp_amp = xLine kr 0.09 0.000009 4 DoNothing+ imp = impulse ar imp_frq 0 * imp_amp+ exc = decay imp 0.001+ flt_frq = X.randN 4 400 8400+ flt_amp = X.randN 4 0 1+ flt_rtm = X.randN 4 0.01 0.11+ flt = klank exc 1 0 1 (klankSpec_mce flt_frq flt_amp flt_rtm)+ loc = pan2 flt (rand (-1) 1) 1+ e = Envelope [1,1,0] [3,0.001] (replicate 2 EnvLin) Nothing Nothing 0+in loc * envGen kr 1 1 0 1 RemoveSynth e++-- bouncing objects (jmcc) #2 ; texture=spawn,1,inf ; id+let imp_frq = xLine kr (5 + randId 'α' (-2) 2) 600 4 DoNothing+ imp_amp = xLine kr 0.09 0.000009 4 DoNothing+ imp = impulse ar imp_frq 0 * imp_amp+ exc = decay imp 0.001+ flt_frq = X.randNId 4 'β' 400 8400+ flt_amp = X.randNId 4 'γ' 0 1+ flt_rtm = X.randNId 4 'δ' 0.01 0.11+ flt = klank exc 1 0 1 (klankSpec_mce flt_frq flt_amp flt_rtm)+ loc = pan2 flt (randId 'ε' (-1) 1) 1+ e = Envelope [1,1,0] [3,0.001] (replicate 2 EnvLin) Nothing Nothing 0+in loc * envGen kr 1 1 0 1 RemoveSynth e
+ Help/Graph/jmcc-bowed-string.hs view
@@ -0,0 +1,57 @@+-- bowed string (jmcc) ; texture=overlap,5,2,12,inf+let root = 5+ scale = map (+ root) [0,2,4,5,7,9,11]+ oct = [24,36,48,60,72,84]+ f = midiCps (lchoose scale + lchoose oct)+ x = mce2 (brownNoise ar) (brownNoise ar) * 0.007 * max 0 (lfNoise1 kr (expRand 0.125 0.5) * 0.6 + 0.4)+ geom n i z = mce (take n (iterate (* z) i))+ iota n i z = mce (take n (iterate (+ z) i))+ d = klankSpec_mce (iota 12 f f) (geom 12 1 (rand 0.7 0.9)) (X.randN 12 1.0 3.0)+ k = klank x 1 0 1 d+in softClip (k * 0.1)++-- bowed string (jmcc) ; texture=overlap,5,2,12,inf ; monad+uid_st_eval (do+ let root = 5+ scale = map (+ root) [0,2,4,5,7,9,11]+ oct = [24,36,48,60,72,84]+ n0 <- replicateM 2 (brownNoiseM ar)+ r0 <- expRandM 0.125 0.5+ r1 <- randM 0.7 0.9+ r2 <- X.randNM 12 1.0 3.0+ f <- midiCps `fmap` (Control.Monad.liftM2 (+) (lchooseM scale) (lchooseM oct))+ n1 <- lfNoise1M kr r0+ let x = mce n0 * 0.007 * max 0 (n1 * 0.6 + 0.4)+ geom n i z = mce (take n (iterate (* z) i))+ iota n i z = mce (take n (iterate (+ z) i))+ d = klankSpec_mce (iota 12 f f) (geom 12 1 r1) r2+ k = klank x 1 0 1 d+ return (softClip (k * 0.1)))++-- bowed string (jmcc) ; event control+let f (_,g,_,y,z,_,_,_,p,_,_) =+ let n0 = mce2 (brownNoise ar) (brownNoise ar)+ r0 = expRand 0.125 0.5+ r1 = rand 0.7 0.9+ r2 = X.randN 12 1.0 3.0+ fq = unitCps p+ exc = n0 * 0.005 * z * lagUD g (y * 0.1) (y * 4)+ geom n i m = mce (take n (iterate (* m) i))+ iota n i m = mce (take n (iterate (+ m) i))+ d = klankSpec_mce (iota 12 fq fq) (geom 12 1 r1) r2+ in softClip (dynKlank exc 1 0 1 d)+in mix (voicer 16 f) * control kr "gain" 0.75++-- bowed string (jmcc) ; event control ; id+let f (c,g,_,y,z,_,_,_,p,_,_) =+ let n0 = mce2 (brownNoiseId (c,'α') ar) (brownNoiseId (c,'β') ar)+ r0 = expRandId (c,'γ') 0.125 0.5+ r1 = randId (c,'δ') 0.7 0.9+ r2 = X.randNId 12 (c,'ε') 1.0 3.0+ fq = unitCps p+ exc = n0 * 0.005 * z * lagUD g (y * 0.1) (y * 4)+ geom n i m = mce (take n (iterate (* m) i))+ iota n i m = mce (take n (iterate (+ m) i))+ d = klankSpec_mce (iota 12 fq fq) (geom 12 1 r1) r2+ in softClip (dynKlank exc 1 0 1 d)+in mix (voicer 16 f) * control kr "gain" 0.75
+ Help/Graph/jmcc-clustered-sines.hs view
@@ -0,0 +1,19 @@+-- clustered sines (jmcc) #2 ; texture=xfade,4,4,inf+let cs _ =+ let n = 80+ f1 = rand 100 1100+ f2 = 4 * f1+ sp = let y = mceFill n (\_ -> f1 + rand 0 f2)+ in klangSpec_mce y (mceMap (f1 /) y) (mceFill n (const 0))+ in klang ar 1 0 sp * (0.3 / fromIntegral n)+in mceFill 2 cs++-- clustered sines (jmcc) #2 ; texture=xfade,4,4,inf ; id+let cs z =+ let n = 80+ f1 = randId 'α' 100 1100+ f2 = 4 * f1+ sp = let y = map (\zz -> f1 + randId (z,zz) 0 f2) (id_seq n 'β')+ in klangSpec y (map (f1 /) y) (replicate n 0)+ in klang ar 1 0 sp * (0.3 / fromIntegral n)+in mce (map cs (id_seq 2 'δ'))
+ Help/Graph/jmcc-coolant.hs view
@@ -0,0 +1,13 @@+-- coolant (jmcc) #2 ; texture=overlap,4,4,2,inf+let p = 10+ spec freq = let n = mceFill p (const 1) in klankSpec_mce freq n n+ gen _ = klank (onePole (brownNoise ar * 0.0015) 0.95) 1 0 1 (spec (X.randN p 40 2400))+in mceFill 2 gen++-- coolant (jmcc) #2 ; texture=overlap,4,4,2,inf ; id+let p = 10+ s = onePole (mceFillId 'α' 2 (\z _ -> brownNoiseId z ar * 0.0015)) 0.95+ n = mceFill p (const 1)+ s1 = klankSpec_mce (X.randNId p 'β' 40 2400) n n+ s2 = klankSpec_mce (X.randNId p 'γ' 40 2400) n n+in klank s 1 0 1 (mceTranspose (mce2 s1 s2))
+ Help/Graph/jmcc-cymbalism-accelerando.hs view
@@ -0,0 +1,25 @@+-- cymbalism accelerando (jmcc) #2 ; texture=overlap,4,4,4,inf+let y _ = let f1 = rand 500 2500+ f = mceFill 15 (\_ -> rand f1 (f1 + rand 0 8000))+ rt = mceFill 15 (\_ -> rand 1 5)+ in klankSpec_mce f (mceFill 15 (const 1)) rt+ z = mceFill 2 y+ w = whiteNoise ar * 0.02+ tf = xLine kr (linRand 0.5 4.5 0) (rand 0.5 35.5) 12 DoNothing+ t = impulse ar tf 0+ s = decay t 0.004 * w+in klank s 1 0 1 (mceTranspose z)++-- cymbalism accelerando (jmcc) #2 ; texture=overlap,4,4,4,inf ; id+let enumFromN e i = let j = fromEnum e in [j .. j + i]+ y n = let f1 = randId n 500 2500+ f2 = randId n 0 8000+ f = map (\e -> randId e f1 (f1 + f2)) (enumFromN n 15)+ rt = map (\e -> randId e 1 5) (enumFromN n 15)+ in klankSpec f (replicate 15 1) rt+ z = mce2 (y 'α') (y 'β')+ w = whiteNoiseId 'γ' ar * 0.02+ tf = xLine kr (linRandId 'δ' 0.5 4.5 0) (randId 'ε' 0.5 35.5) 12 DoNothing+ t = impulse ar tf 0+ s = decay t 0.004 * w+in klank s 1 0 1 (mceTranspose z)
+ Help/Graph/jmcc-cymbalism.hs view
@@ -0,0 +1,52 @@+-- cymbalism (jmcc) #2 ; texture=overlap,3,6,6,inf+let p = 15+ spec _ = let f1 = rand 500 2500+ f = mceFill p (\_ -> rand f1 (f1 + rand 0 8000))+ rt = mceFill p (\_ -> rand 1 5)+ in klankSpec_mce f (mceFill p (const 1)) rt+ t = impulse ar (rand 0.5 3.5) 0+ s = whiteNoise ar * decay t 0.004 * 0.03+in mceFill 2 (\n -> klank s 1 0 1 (spec n))++-- cymbalism (jmcc) #2 ; texture=overlap,3,6,6,inf ; monad+uid_st_eval (do+ let p = replicate 15+ f1 <- randM 500 2500+ f2 <- randM 0 8000+ let y = do f <- sequence (p (randM f1 (f1 + f2)))+ rt <- sequence (p (randM 1 5))+ return (klankSpec f (p 1) rt)+ z <- replicateM 2 y+ n <- fmap (* 0.03) (whiteNoiseM ar)+ tf <- randM 0.5 3.5+ let t = impulse ar tf 0+ s = decay t 0.004 * n+ return (klank s 1 0 1 (mceTranspose (mce z))))++-- cymbalism (jmcc) #2 ; event control+let f (_,g,x,y,z,_,_,_,_,_,_) =+ let mk_spc _ =+ let f1 = x * 2000 + 500+ f3 = mceFill 15 (\_ -> tRand f1 (f1 + rand 0 8000) g)+ rt = mceFill 15 (\_ -> tRand 1 5 g)+ in klankSpec_mce f3 (mceFill 15 (const 1)) rt+ spc = mceFill 2 mk_spc+ whn = whiteNoise ar * z * 0.1+ sig = decay (trig g controlDur) (y * 0.01) * whn+ in dynKlank sig 1 0 1 (mceTranspose spc)+in mix (voicer 16 f) * control kr "gain" 1++-- cymbalism (jmcc) #2 ; event control ; id+let f (c,g,x,y,z,_,_,_,_,_,_) =+ let enumFromN e i = let j = fromEnum e in [j .. j + i]+ mk_spc n =+ let f1 = x * 2000 + 500+ f2 = randId (c,n) 0 8000+ f3 = map (\e -> tRandId (c,e) f1 (f1 + f2) g) (enumFromN n 15)+ rt = map (\e -> tRandId (c,e) 1 5 g) (enumFromN n 15)+ in klankSpec f3 (replicate 15 1) rt+ spc = mce2 (mk_spc 'α') (mk_spc 'β')+ whn = whiteNoiseId (c,'γ') ar * z * 0.1+ sig = decay (trig g controlDur) (y * 0.01) * whn+ in dynKlank sig 1 0 1 (mceTranspose spc)+in mix (voicer 16 f) * control kr "gain" 1
+ Help/Graph/jmcc-data-space.hs view
@@ -0,0 +1,26 @@+-- data space (jmcc) #2 ; texture=overlap,1,6,4,inf+let p0 = lfPulse kr (rand0 200) 0 (rand0 1)+ p1 = lfPulse kr (rand0 40) 0 (rand0 1) * rand0 8000 + rand0 2000+ p2 = lfPulse kr (rand0 20) 0 (rand0 1)+ p3 = lfPulse kr (rand0 4) 0 (rand0 1) * rand0 8000 + rand0 2000+ p4 = lfPulse kr (rand0 20) 0 (rand0 1)+ p5 = lfPulse kr (rand0 4) 0 (rand0 1) * rand0 8000 + rand0 2000+ f = p0 * p1 + p2 * p3 + p4 * p5+ dt = rand 0.15 0.35+ o = lfPulse ar f 0 0.5 * 0.04+ l = lfNoise0 kr (rand0 3) * 0.8+in combL (pan2 o l 1) dt dt 3++-- data space (jmcc) #2 ; texture=overlap,1,6,4,inf ; id+let r e = randId e 0+ p0 = lfPulse kr (r 'α' 200) 0 (r 'β' 1)+ p1 = lfPulse kr (r 'γ' 40) 0 (r 'δ' 1) * r 'ε' 8000 + r 'ζ' 2000+ p2 = lfPulse kr (r 'η' 20) 0 (r 'θ' 1)+ p3 = lfPulse kr (r 'ι' 4) 0 (r 'κ' 1) * r 'λ' 8000 + r 'μ' 2000+ p4 = lfPulse kr (r 'ν' 20) 0 (r 'ξ' 1)+ p5 = lfPulse kr (r 'ο' 4) 0 (r 'π' 1) * r 'ρ' 8000 + r 'σ' 2000+ f = p0 * p1 + p2 * p3 + p4 * p5+ dt = randId 'τ' 0.15 0.35+ o = lfPulse ar f 0 0.5 * 0.04+ l = lfNoise0Id 'υ' kr (r 'φ' 3) * 0.8+in combL (pan2 o l 1) dt dt 3
+ Help/Graph/jmcc-deep-trip.hs view
@@ -0,0 +1,21 @@+-- deep trip (jmcc) #9 ; texture=overlap,4,12,4,inf+let f = midiCps (lfNoise1 kr (rand 0 0.3) * 60 + 70)+ a'' = sinOsc kr (rand 0 40) 0 * 0.1+ a' = max 0 (lfNoise1 kr (rand 0 8) * a'')+ a = lfNoise2 ar (f * rand 0 0.5) * a'+ z = sinOsc ar f 0 * a+ s = pan2 z (lfNoise1 kr (rand 0 5)) 1+ c0 = combN s 0.5 (X.randN 2 0.3 0.5) 20+ c1 = combN s 0.5 (X.randN 2 0.3 0.5) 20+in s + c0 + c1++-- deep trip (jmcc) #9 ; texture=overlap,4,12,4,inf ; id+let f = midiCps (lfNoise1Id 'α' kr (randId 'β' 0 0.3) * 60 + 70)+ a'' = sinOsc kr (randId 'γ' 0 40) 0 * 0.1+ a' = max 0 (lfNoise1Id 'δ' kr (randId 'ε' 0 8) * a'')+ a = lfNoise2Id 'ζ' ar (f * randId 'η' 0 0.5) * a'+ z = sinOsc ar f 0 * a+ s = pan2 z (lfNoise1Id 'θ' kr (randId 'ι' 0 5)) 1+ c0 = combN s 0.5 (X.randNId 2 'κ' 0.3 0.5) 20+ c1 = combN s 0.5 (X.randNId 2 'λ' 0.3 0.5) 20+in s + c0 + c1
+ Help/Graph/jmcc-demanding-studies.hs view
@@ -0,0 +1,23 @@+-- demanding studies (jmcc)+let s1 = drand dinf (mce [72, 75, 79, 82])+ s2 = drand 1 (mce [82, 84, 86])+ s3 = dseq dinf (mce [72, 75, 79, s2])+ x = mouseX kr 5 13 Linear 0.2+ tr = impulse kr x 0+ f = demand tr 0 (mce2 (midiCps (s1 - 12)) (midiCps s3))+ o1 = sinOsc ar (f + mce2 0 0.7) 0+ o2 = saw ar (f + mce2 0 0.7) * 0.3+ o3 = cubed (distort (log (distort (o1 + o2))))+in o3 * 0.1++-- demanding studies (jmcc) ; id+let s1 = drandId 'α' dinf (mce [72, 75, 79, 82])+ s2 = drandId 'β' 1 (mce [82, 84, 86])+ s3 = dseqId 'γ' dinf (mce [72, 75, 79, s2])+ x = mouseX kr 5 13 Linear 0.2+ tr = impulse kr x 0+ f = demand tr 0 (mce2 (midiCps (s1 - 12)) (midiCps s3))+ o1 = sinOsc ar (f + mce2 0 0.7) 0+ o2 = saw ar (f + mce2 0 0.7) * 0.3+ o3 = cubed (distort (log (distort (o1 + o2))))+in o3 * 0.1
+ Help/Graph/jmcc-filter-input.hs view
@@ -0,0 +1,5 @@+-- filter input (jmcc) #5 ; warning=feedback+let rQ = mouseY kr 0.01 1 Exponential 0.2 {- bandwidth ratio = 1/Q -}+ cf = mouseX kr 100 12000 Exponential 0.2 {- cutoff freq -}+ sg = soundIn (mce2 0 1) * 0.4 * sqrt rQ {- attenuate to offset resonance -}+in rlpf sg cf rQ
+ Help/Graph/jmcc-harmonic-swimming.hs view
@@ -0,0 +1,21 @@+-- harmonic swimming (jmcc) #1+let a = 0.02+ f = 50+ p = 20+ l = line kr 0 (- a) 60 DoNothing+ o h = let r = X.randN 2 2 8+ n = lfNoise1 kr r+ e = max 0 (n * a + l)+ in fSinOsc ar (f * (h + 1)) 0 * e+in mixFill p o++-- harmonic swimming (jmcc) #1 ; id+let a = 0.02+ f = 50+ p = 20::Int+ l = line kr 0 (- a) 60 DoNothing+ o h = let r = X.randNId 2 h 2 8+ n = lfNoise1Id h kr r+ e = max 0 (n * a + l)+ in fSinOsc ar (f * (fromIntegral h + 1)) 0 * e+in sum (map o [0 .. p - 1])
+ Help/Graph/jmcc-harmonic-tumbling.hs view
@@ -0,0 +1,19 @@+-- harmonic tumbling (jmcc) #1+let f = 80+ p = 10+ t = xLine kr (mce2 10 11) 0.1 60 DoNothing+ o h = let n = dust kr t+ r = rand 0.25 0.5+ e = decay2 (n * 0.02) 0.005 r+ in fSinOsc ar (f * (h + 1)) 0 * e+in mixFill p o++-- harmonic tumbling (jmcc) #1 ; id+let f = 80+ p = 10::Int+ t = xLine kr (mce2 10 11) 0.1 60 DoNothing+ o z = let n = dustId z kr t+ r = randId z 0.25 0.5+ e = decay2 (n * 0.02) 0.005 r+ in fSinOsc ar (f * (constant z + 1)) 0 * e+in sum (map o [0 .. p])
+ Help/Graph/jmcc-hell-is-busy.hs view
@@ -0,0 +1,16 @@+-- hell is busy (jmcc) #1 ; texture=overlap,4,4,8,inf+let o = fSinOsc ar (400 + rand 0 2000) 0+ a = lfPulse kr (1 + rand 0 10.0) 0 (rand 0 0.7) * 0.04+in pan2 (o * a) (rand (-1) 1) 1++-- hell is busy (jmcc) #1 ; texture=overlap,4,4,8,inf ; id+let o = fSinOsc ar (400 + randId 'α' 0 2000) 0+ a = lfPulse kr (1 + randId 'β' 0 10.0) 0 (randId 'γ' 0 0.7) * 0.04+in pan2 (o * a) (randId 'δ' (-1) 1) 1++-- hell is busy (jmcc) #1 ; event control+let f (_,g,x,y,z,o,rx,_,_,_,_) =+ let s1 = fSinOsc ar (400 + x * 2000) 0+ s2 = lfPulse kr (1 + y * 10) 0 (rx * 0.7)+ in pan2 (s1 * s2 * 0.35) (o * 2 - 1) (z * g)+in mix (voicer 16 f) * control kr "gain" 1
+ Help/Graph/jmcc-impulse-sequencer.hs view
@@ -0,0 +1,25 @@+-- impulse sequencer (jmcc) SC2+let dsequ s tr = demand tr 0 (dseq dinf (mce s))+ t = impulse ar 8 0 {- single sample impulse as trigger -}+ c_sq = dsequ [1,0,0,1,0,0,1,0,0,0,1,0,1,0,0,0] t * t {- clave rhythm -}+ c = decay2 c_sq 0.001 0.3 * fSinOsc ar 1700 0 * 0.1+ d_sq = dsequ [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0] t * t+ d = decay2 d_sq 0.001 0.3 * fSinOsc ar 2400 0 * 0.04+ n_sq = dsequ [1.0, 0.1, 0.1, 1.0, 0.1, 1.0, 0.1, 0.1] t * t {- noise drum -}+ n = decay2 n_sq 0.001 0.25 * brownNoise ar * 0.1+ b_sq = dsequ [1,0,0.2,0,0.2,0,0.2,0] t * t {- bass drum -}+ b = decay2 b_sq 0.001 0.5 * fSinOsc ar 100 0 * 0.2+in c + d + n + b++-- impulse sequencer (jmcc) SC2 ; id+let dsequId z s tr = demand tr 0 (dseqId z dinf (mce s))+ t = impulse ar 8 0 {- single sample impulse as trigger -}+ c_sq = dsequId 'α' [1,0,0,1,0,0,1,0,0,0,1,0,1,0,0,0] t * t {- clave rhythm -}+ c = decay2 c_sq 0.001 0.3 * fSinOsc ar 1700 0 * 0.1+ d_sq = dsequId 'β' [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0] t * t+ d = decay2 d_sq 0.001 0.3 * fSinOsc ar 2400 0 * 0.04+ n_sq = dsequId 'γ' [1.0, 0.1, 0.1, 1.0, 0.1, 1.0, 0.1, 0.1] t * t {- noise drum -}+ n = decay2 n_sq 0.001 0.25 * brownNoiseId 'δ' ar * 0.1+ b_sq = dsequId 'ε' [1,0,0.2,0,0.2,0,0.2,0] t * t {- bass drum -}+ b = decay2 b_sq 0.001 0.5 * fSinOsc ar 100 0 * 0.2+in c + d + n + b
+ Help/Graph/jmcc-landon-rose.hs view
@@ -0,0 +1,27 @@+-- landon rose (jmcc) #8+let nt =+ [[32,43,54, 89]+ ,[10,34,80,120]+ ,[67,88,90,100]+ ,[76,88,99,124]]+ fr = map (map midi_to_cps) nt+ nd e f =+ let p = klankSpec f (replicate 4 1) (replicate 4 3)+ x = e * pinkNoise ar * mce2 0.0011 0.0012+ in klank x 1 0 1 p+ env i = abs (sinOsc ar (1 / 8) ((i / 2) * pi))+in sum (zipWith nd (map env [0 .. 3]) fr)++-- landon rose (jmcc) #8 ; id+let nt =+ [[32,43,54, 89]+ ,[10,34,80,120]+ ,[67,88,90,100]+ ,[76,88,99,124]]+ fr = map (map midi_to_cps) nt+ nd z e f =+ let p = klankSpec f (replicate 4 1) (replicate 4 3)+ x = e * pinkNoiseId z ar * mce2 0.0011 0.0012+ in klank x 1 0 1 p+ env i = abs (sinOsc ar (1 / 8) ((constant i / 2) * pi))+in sum (zipWith3 nd "αβγδ" (map env [0 .. 3]) fr)
+ Help/Graph/jmcc-lfo-modulation.hs view
@@ -0,0 +1,5 @@+-- lfo modulation (jmcc) #1+let o = fSinOsc kr 0.05 0 * 80 + 160+ p = fSinOsc kr (mce2 0.6 0.7) 0 * 3600 + 4000+ s = rlpf (lfPulse ar o 0 0.4 * 0.05) p 0.2+in combL s 0.3 (mce2 0.2 0.25) 2
+ Help/Graph/jmcc-lots-o-sines.hs view
@@ -0,0 +1,15 @@+-- lots-o-sins (jmcc) #2 ; texture=xfade,4,4,inf+let n = 60 {- n sines in each channel (twice as many during cross-fade) -}+ mk_k x = mceFill n (const x)+ o1 = klang ar 1 0 (klangSpec_mce (X.randN n 40 10000) (mk_k 1) (mk_k 0))+ o2 = klang ar 1 0 (klangSpec_mce (X.randN n 40 10000) (mk_k 1) (mk_k 0))+in mce2 o1 o2 * (0.1 / constant n)++-- lots-o-sins (jmcc) #2 ; texture=xfade,4,4,inf ; id+let n = 60 {- n sines in each channel (twice as many during cross-fade) -}+ f0 = X.randNId n 'α' 40 10000+ f1 = X.randNId n 'β' 40 10000+ mk_k x = mce (replicate n x)+ o1 = klang ar 1 0 (klangSpec_mce f0 (mk_k 1) (mk_k 0))+ o2 = klang ar 1 0 (klangSpec_mce f1 (mk_k 1) (mk_k 0))+in mce2 o1 o2 * (0.1 / constant n)
+ Help/Graph/jmcc-metal-plate.hs view
@@ -0,0 +1,35 @@+-- metal plate (jmcc) #4+let+ sr = 48000+ n = 4 {- number of delay lines -}+ maxdt = ceiling (sr * 0.03) {- maximum delay time -}+ buf = mceFill n (\_ -> clearBuf (localBuf 1 maxdt)) {- buffers for delay lines -}+ tap_tm = mceFill n (\_ -> rand 0.015 0.03) {- random tap times -}+ exc_freq = mouseY kr 10 8000 Linear 0.2+ exc_trig = impulse ar 0.5 0 * 0.2+ exc = decay2 exc_trig 0.01 0.2 * lfNoise2 ar exc_freq {- excitation -}+ del = tap 1 ar buf tap_tm {- delay line taps -}+ flt_freq = mouseX kr 10 5000 Linear 0.2+ flt = lpf del flt_freq * 0.98 {- tap filters -}+ wr = recordBuf ar buf 0 1 0 1 Loop 1 DoNothing (mce1 (flt + exc)) {- write to delay lines -}+in mrg2 (mix flt) wr++-- metal plate (jmcc) #4 ; id+let+ enumFromN e i = let j = fromEnum e in [j .. j + i]+ sr = 48000+ n = 4 :: Int {- number of delay lines -}+ maxdt = ceiling (sr * 0.03) {- maximum delay time -}+ mk_buf k = clearBuf (localBufId k 1 maxdt)+ buf = map mk_buf [0 .. n - 1] {- buffers for delay lines -}+ tap_tm = map (\z -> randId ('α',z) 0.015 0.03) (enumFromN 'β' n) {- random tap times -}+ exc_freq = mouseY kr 10 8000 Linear 0.2+ exc_trig = impulse ar 0.5 0 * 0.2+ exc = decay2 exc_trig 0.01 0.2 * lfNoise2Id 'γ' ar exc_freq {- excitation -}+ del = zipWith (tap 1 ar) buf tap_tm {- delay line taps -}+ flt_freq = mouseX kr 10 5000 Linear 0.2+ flt = map (\i -> lpf i flt_freq * 0.98) del {- tap filters -}+ wr_f b f = recordBuf ar b 0 1 0 1 Loop 1 DoNothing (f + exc)+ wr = zipWith wr_f buf flt {- write to delay lines -}+in mrg2 (sum flt) (mce wr)+
+ Help/Graph/jmcc-modal-space.hs view
@@ -0,0 +1,77 @@+-- modal space (jmcc) #8 ; local buffer+let ms1 n r =+ let b = asLocalBuf [0,2,3.2,5,7,9,10] {- dorian scale -}+ x = mouseX kr 0 15 Linear 0.1 {- mouse indexes into scale -}+ k = degreeToKey b x 12 {- 12 notes per octave -}+ o = sinOsc ar (midiCps (r + k + n * 0.04)) 0 * 0.1+ t = lfPulse ar (midiCps (mce2 48 55)) 0 0.15+ f = midiCps (sinOsc kr 0.1 0 * 10 + r)+ d = rlpf t f 0.1 * 0.1+ m = o + d+ in combN m 0.31 0.31 2 + m+in ms1 (lfNoise1 kr 3) 48 + ms1 (lfNoise1 kr 3) 72 * 0.25++-- modal space (jmcc) #8 ; local buffer ; id+let ms1 n r =+ let b = asLocalBufId 'α' [0,2,3.2,5,7,9,10] {- dorian scale -}+ x = mouseX kr 0 15 Linear 0.1 {- mouse indexes into scale -}+ k = degreeToKey b x 12 {- 12 notes per octave -}+ o = sinOsc ar (midiCps (r + k + n * 0.04)) 0 * 0.1+ t = lfPulse ar (midiCps (mce2 48 55)) 0 0.15+ f = midiCps (sinOsc kr 0.1 0 * 10 + r)+ d = rlpf t f 0.1 * 0.1+ m = o + d+ in combN m 0.31 0.31 2 + m+in ms1 (lfNoise1Id 'β' kr 3) 48 + ms1 (lfNoise1Id 'γ' kr 3) 72 * 0.25++-- modal space (jmcc) #8 ; event control+let f (_,g,x,y,z,_,_,_,_,_,_) =+ let ms1 n r =+ let b = asLocalBuf [0,2,3.2,5,7,9,10] {- dorian scale -}+ k = degreeToKey b (x * 25) 12 {- 12 notes per octave -}+ o = sinOsc ar (midiCps (r + k + n * y * 0.08)) 0 * 0.1+ t = lfPulse ar (midiCps (mce2 48 55)) 0 0.15+ d = rlpf t (midiCps (sinOsc kr 0.1 0 * 10 + r)) 0.1 * 0.1+ m = o + d+ in combN m 0.31 0.31 2 + m+ ms = ms1 (lfNoise1 kr 3) 48 + ms1 (lfNoise1 kr 3) 72+ in ms * z * lagUD g 0.2 2+in mix (voicer 16 f) * control kr "gain" 1++-- modal space (jmcc) #8 ; event control ; id+let f (c,g,x,y,z,_,_,_,_,_,_) =+ let ms1 n r =+ let b = asLocalBufId 'α' [0,2,3.2,5,7,9,10] {- dorian scale -}+ k = degreeToKey b (x * 25) 12 {- 12 notes per octave -}+ o = sinOsc ar (midiCps (r + k + n * y * 0.08)) 0 * 0.1+ t = lfPulse ar (midiCps (mce2 48 55)) 0 0.15+ d = rlpf t (midiCps (sinOsc kr 0.1 0 * 10 + r)) 0.1 * 0.1+ m = o + d+ in combN m 0.31 0.31 2 + m+ ms = ms1 (lfNoise1Id (c,'β') kr 3) 48 + ms1 (lfNoise1Id (c,'γ') kr 3) 72+ in ms * z * lagUD g 0.2 2+in mix (voicer 16 f) * control kr "gain" 1++-- modal space (jmcc) #8 ; event control ; modeless+let f (_,g,_,y,z,_,_,_,p,_,_) =+ let ms1 n r =+ let o = sinOsc ar (midiCps (p * 127 + r + n * y * 0.08)) 0 * 0.1+ t = lfPulse ar (midiCps (mce2 48 55)) 0 0.15+ d = rlpf t (midiCps (sinOsc kr 0.1 0 * 10 + r)) 0.1 * 0.1+ m = o + d+ in combN m 0.31 0.31 2 + m+ ms = ms1 (lfNoise1 kr 3) 0 + ms1 (lfNoise1 kr 3) 24+ in ms * z * lagUD g (y * 0.05 + 0.01) (y * 2 + 1)+in mix (voicer 16 f) * control kr "gain" 1++-- modal space (jmcc) #8 ; event control ; modeless ; id+let f (c,g,_,y,z,_,_,_,p,_,_) =+ let ms1 n r =+ let o = sinOsc ar (midiCps (p * 127 + r + n * y * 0.08)) 0 * 0.1+ t = lfPulse ar (midiCps (mce2 48 55)) 0 0.15+ d = rlpf t (midiCps (sinOsc kr 0.1 0 * 10 + r)) 0.1 * 0.1+ m = o + d+ in combN m 0.31 0.31 2 + m+ ms = ms1 (lfNoise1Id (c,'β') kr 3) 0 + ms1 (lfNoise1Id (c,'γ') kr 3) 24+ in ms * z * lagUD g (y * 0.05 + 0.01) (y * 2 + 1)+in mix (voicer 16 f) * control kr "gain" 1
+ Help/Graph/jmcc-moto-rev.hs view
@@ -0,0 +1,4 @@+-- moto rev (jmcc) #1+let f = sinOsc kr 0.2 0 * 10 + 21+ s = lfPulse ar f (mce2 0 0.1) 0.1+in clip2 (rlpf s 100 0.1) 0.4
+ Help/Graph/jmcc-narrow-band-filtered-crackle-noise.hs view
@@ -0,0 +1,27 @@+-- narrow band filtered crackle noise (jmcc) #2 ; texture=spawn,2,inf+let e = envLinen 2 5 2 1+ rf1 = rand 0 2000 + 80+ rf2 = rf1 + (rand2 0.2 * rf1)+ rf = xLine kr rf1 rf2 9 DoNothing+ c = crackle ar (1.97 + rand 0 0.03) * 0.15+in pan2 (resonz c rf 0.2) (rand2 1) (envGen ar 1 1 0 1 RemoveSynth e)++-- narrow band filtered crackle noise (jmcc) #2 ; texture=spawn,2,inf ; id+let e = envLinen 2 5 2 1+ rf1 = randId 'α' 0 2000 + 80+ rf2 = rf1 + (rand2Id 'β' 0.2 * rf1)+ rf = xLine kr rf1 rf2 9 DoNothing+ c = crackle ar (1.97 + randId 'γ' 0 0.03) * 0.15+in pan2 (resonz c rf 0.2) (rand2Id 'δ' 1) (envGen ar 1 1 0 1 RemoveSynth e)++-- narrow band filtered crackle noise (jmcc) #2 ; event control+let f (_,g,_,y,z,o,_,_,p,_,_) =+ let cr = crackle ar (1.97 + rand 0 0.03)+ in pan2 (resonz cr (unitCps p) (0.2 - y * 0.2)) (o * 2 - 1) (z * 10 * g)+in mix (voicer 16 f) * control kr "gain" 1++-- narrow band filtered crackle noise (jmcc) #2 ; event control ; id+let f (c,g,_,y,z,o,_,_,p,_,_) =+ let cr = crackle ar (1.97 + randId (c,'γ') 0 0.03)+ in pan2 (resonz cr (unitCps p) (0.2 - y * 0.2)) (o * 2 - 1) (z * 10 * g)+in mix (voicer 16 f) * control kr "gain" 1
+ Help/Graph/jmcc-noise-burst-sweep.hs view
@@ -0,0 +1,15 @@+-- noise burst sweep (jmcc) #6 ; texture=overlap,4,2,4,inf+let n = mce2 (whiteNoise ar) (whiteNoise ar)+ lfoRate = rand (-1) 1 + mouseX kr 10 60 Exponential 0.2+ amp = max 0 (lfSaw kr lfoRate (-1))+ cfreq = mouseY kr 400 8000 Exponential 0.2+ freq = sinOsc kr 0.2 0 * cfreq + (1.05 * cfreq)+in resonz (n * amp) freq 0.1++-- noise burst sweep (jmcc) #6 ; texture=overlap,4,2,4,inf ; id+let n = mce2 (whiteNoiseId 'α' ar) (whiteNoiseId 'β' ar)+ lfoRate = randId 'γ' (-1) 1 + mouseX kr 10 60 Exponential 0.2+ amp = max 0 (lfSaw kr lfoRate (-1))+ cfreq = mouseY kr 400 8000 Exponential 0.2+ freq = sinOsc kr 0.2 0 * cfreq + (1.05 * cfreq)+in resonz (n * amp) freq 0.1
+ Help/Graph/jmcc-phase-modulation.hs view
@@ -0,0 +1,16 @@+-- phase modulation with slow beats (jmcc) #6 texture=overlap,4,4,4,inf+let x = mouseX kr 100 6000 Exponential 0.2 {- random freq of new events -}+ y = mouseY kr 0 2 Linear 0.2 {- modulation index -}+ ph = iter 3 (\i -> let f = rand 0 x in fSinOsc ar (mce [f,f + rand2 1]) 0 * y + i) 0+ freq = rand 0 x+in sinOsc ar (mce [freq, freq + rand2 1]) ph * 0.1++-- phase modulation with slow beats (jmcc) #6 texture=overlap,4,4,4,inf ; id+let nrec n f st = if n > 0 then nrec (n - 1) f (f st) else st+ x = mouseX kr 100 6000 Exponential 0.2 {- random freq of new events -}+ y = mouseY kr 0 2 Linear 0.2 {- modulation index -}+ o (e,a) = let f = randId e 0 x+ in (succ e,fSinOsc ar (mce [f,f + rand2Id 'α' 1]) 0 * y + a)+ ph = snd (nrec 3 o ('β',0))+ freq = randId 'γ' 0 x+in sinOsc ar (mce [freq, freq + rand2Id 'δ' 1]) ph * 0.1
+ Help/Graph/jmcc-plucked-strings.hs view
@@ -0,0 +1,31 @@+-- plucked strings (jmcc)+let dt _ = 1 / midiCps (floorE (rand 60 90))+ i _ = let s0 = impulse ar (rand 2 2.2) 0 * 0.3+ s1 = dust ar 0.5 * 0.3+ s2 = impulse ar (sinOsc kr (rand 0.05 0.15) (rand 0 (pi * 2)) * 5 + 5.2) 0 * 0.3+ in select (iRand 0 2) (mce [s0,s1,s2])+ s n = let dt' = dt n+ t = decay (i n) 0.1 * pinkNoise ar * 0.1+ in pan2 (combL t dt' dt' 4) (rand2 1) 1+in mixFill 5 s++-- plucked strings (jmcc) ; monad+uid_st_eval (do+ let dt = do r0 <- randM 60 90+ return (1 / midiCps (floorE r0))+ i = do r0 <- randM 2 2.2+ n0 <- dustM ar 0.5+ r1 <- randM 0.05 0.15+ r2 <- randM 0 (pi * 2)+ r3 <- iRandM 0 2+ let s0 = impulse ar r0 0 * 0.3+ s1 = n0 * 0.3+ s2 = impulse ar (sinOsc kr r1 r2 * 5 + 5.2) 0 * 0.3+ return (select r3 (mce [s0,s1,s2]))+ s = do n0 <- pinkNoiseM ar+ r1 <- randM (-1) 1+ im <- i+ dt' <- dt+ let t = decay im 0.1 * n0 * 0.1+ return (pan2 (combL t dt' dt' 4) r1 1)+ fmap sum (sequence (replicate 5 s)))
+ Help/Graph/jmcc-police-state.hs view
@@ -0,0 +1,23 @@+-- police state (jmcc) #2+let nd _ = let f = sinOsc kr (rand 0.02 0.12) (rand 0 (pi * 2)) * rand 0 600 + rand 700 1300+ in pan2 (sinOsc ar f 0 * lfNoise2 ar (rand 80 120) * 0.1) (rand2 1) 1+ e = lfNoise2 ar (mceFill 2 (\_ -> lfNoise2 kr 0.4) * 90 + 620) * lfNoise2 kr (mce2 0.3 0.301) * 0.15 + 0.18+in combL (mixFill 4 nd + e) 0.3 0.3 3++-- police state (jmcc) #2 ; monad+uid_st_eval (do+ let nd = do r0 <- randM 0.02 0.12+ r1 <- randM 0 (pi * 2)+ r2 <- randM 0 600+ r3 <- randM 700 1300+ r4 <- randM (-1) 1+ r5 <- randM 80 120+ n0 <- lfNoise2M ar r5+ let f = sinOsc kr r0 r1 * r2 + r3+ return (pan2 (sinOsc ar f 0 * n0 * 0.1) r4 1)+ ns <- replicateM 4 nd+ n0 <- replicateM 2 (lfNoise2M kr 0.4)+ n1 <- lfNoise2M ar (mce n0 * 90 + 620)+ n2 <- lfNoise2M kr (mce2 0.3 0.301)+ let e = n1 * (n2 * 0.15 + 0.18)+ return (combL (mix (mce ns) + e) 0.3 0.3 3))
+ Help/Graph/jmcc-pond-life.hs view
@@ -0,0 +1,27 @@+-- pond life (jmcc) #1 ; texture=overlap,8,8,4,inf+let f0 = 20 + rand 0 30+ f1 = fSinOsc kr f0 0 * rand 100 400 + linRand 500 2500 0+ a = lfPulse kr (3 / rand 1 9) 0 (rand 0.2 0.5) * 0.04+in pan2 (sinOsc ar f1 0 * a) (rand (-1) 1) 0.5++-- pond life (jmcc) #1 ; texture=overlap,8,8,4,inf ; id+let f0 = 20 + randId 'α' 0 30+ f1 = fSinOsc kr f0 0 * randId 'β' 100 400 + linRandId 'γ' 500 2500 0+ a = lfPulse kr (3 / randId 'δ' 1 9) 0 (randId 'ε' 0.2 0.5) * 0.04+in pan2 (sinOsc ar f1 0 * a) (randId 'ζ' (-1) 1) 0.5++-- pond life (jmcc) #1 ; event control+let f (_,g,x,y,z,o,rx,ry,_,_,_) =+ let f0 = 20 + tRand 0 (rx * 30) g+ f1 = fSinOsc kr f0 0 * linLin x 0 1 100 400 + linLin y 0 1 500 2500+ a = lfPulse kr (3 / linLin ry 0 1 1 9) 0 (rand 0.2 0.5)+ in pan2 (sinOsc ar f1 0 * a * 0.25) (o * 2 - 1) (z * g)+in mix (voicer 16 f) * control kr "gain" 1++-- pond life (jmcc) #1 ; event control ; id+let f (c,g,x,y,z,o,rx,ry,_,_,_) =+ let f0 = 20 + tRandId 'α' 0 (rx * 30) g+ f1 = fSinOsc kr f0 0 * linLin x 0 1 100 400 + linLin y 0 1 500 2500+ a = lfPulse kr (3 / linLin ry 0 1 1 9) 0 (randId (c,'β') 0.2 0.5)+ in pan2 (sinOsc ar f1 0 * a * 0.25) (o * 2 - 1) (z * g)+in mix (voicer 16 f) * control kr "gain" 1
+ Help/Graph/jmcc-pulsing-bottles.hs view
@@ -0,0 +1,15 @@+-- pulsing bottles (jmcc) #2 ; texture=overlap,4,4,4,maxBound+let r _ = resonz (whiteNoise ar * lfPulse kr (rand 4 14) 0 0.25 * rand 0 0.7) (rand 400 7400) 0.01+ s _ = sinOsc kr (rand 0.1 0.5) (rand 0 (pi * 2))+ in mixFill 6 (\n -> pan2 (r n) (s n) 1)++-- pulsing bottles (jmcc) #2 ; texture=overlap,4,4,4,maxBound ; id+let r z = let n = whiteNoiseId z ar+ r0 = randId z 4 14+ r1 = randId z 0 0.7+ r2 = randId z 400 7400+ in resonz (n * lfPulse kr r0 0 0.25 * r1) r2 0.01+ s z = let f = randId z 0.1 0.5+ p = randId z 0 (pi * 2)+ in sinOsc kr f p+in sum (zipWith3 pan2 (map r (id_seq 6 'α')) (map s (id_seq 6 'β')) (repeat 1))
+ Help/Graph/jmcc-rails.hs view
@@ -0,0 +1,21 @@+-- rails (jmcc) #2 ; texture=overlap,3,2,4,inf+let n = 20 {- resonant modes -}+ e = dust ar 100 * 0.04 {- excitation -}+ f = xLine kr 3000 300 8 DoNothing {- sweep filter down -}+ l = line kr (rand2 1) (rand2 1) 8 DoNothing {- sweep pan -}+ r = X.linRandN n 200 3200 0+ a = mceFill n (const 1)+ t = X.randN n 0.2 1.2 {- ring times -}+ k = klank (resonz e f 0.2) 1 0 1 (klankSpec_mce r a t)+in pan2 k l 1++-- rails (jmcc) #2 ; texture=overlap,3,2,4,inf ; id+let n = 20 {- resonant modes -}+ e = dustId 'α' ar 100 * 0.04 {- excitation -}+ f = xLine kr 3000 300 8 DoNothing {- sweep filter down -}+ l = line kr (rand2Id 'β' 1) (rand2Id 'γ' 1) 8 DoNothing {- sweep pan -}+ r = map (\z -> 200 + linRandId z 0 3000 0) (id_seq n 'δ')+ a = replicate n 1+ t = map (\z -> 0.2 + randId z 0 1) (id_seq n 'ε') {- ring times -}+ k = klank (resonz e f 0.2) 1 0 1 (klankSpec r a t)+in pan2 k l 1
+ Help/Graph/jmcc-random-panning-sines.hs view
@@ -0,0 +1,13 @@+-- random panning sines (jmcc) #4 ; texture=overlap,8,8,2,inf+let nd _ = pan2 (fSinOsc ar (linRand 80 2000 0) 0) (lfNoise1 kr (rand 0.8 1.2)) (lfNoise1 kr (rand 0.82 0.98))+in mixFill 8 nd * (0.4 / 8)++-- random panning sines (jmcc) #4 ; texture=overlap,8,8,2,inf ; monad+uid_st_eval (do+ let nd = do r0 <- linRandM 80 2000 0+ let o = fSinOsc ar r0 0+ l <- lfNoise1M kr =<< randM 0.8 1.2+ a <- lfNoise1M kr =<< randM 0.82 0.98+ return (pan2 o l a)+ r <- replicateM 8 nd+ return (mix (mce r) * (0.4 / 8)))
+ Help/Graph/jmcc-random-pulsations.hs view
@@ -0,0 +1,22 @@+-- random pulsations (jmcc) #1 ; texture=spawn,1.25,inf+let e = envLinen 2 5 2 0.02+ o1 = fSinOsc ar (rand 0 2000) 0 * envGen kr 1 1 0 1 DoNothing e+ o2 = sinOsc ar (linRand 8 88 0) 0+ o3 = sinOsc kr (rand 0.3 0.8) (rand 0 (2 * pi)) * 0.7+in pan2 (o1 `amClip` o2) o3 1++-- random pulsations (jmcc) #1 ; texture=spawn,1.25,inf ; id+let e = envLinen 2 5 2 0.02+ o1 = fSinOsc ar (randId 'α' 0 2000) 0 * envGen kr 1 1 0 1 DoNothing e+ o2 = sinOsc ar (linRandId 'β' 8 88 0) 0+ o3 = sinOsc kr (randId 'γ' 0.3 0.8) (randId 'δ' 0 (2 * pi)) * 0.7+in pan2 (o1 `amClip` o2) o3 1++-- random pulsations (jmcc) #1 ; event control+let f (_,g,x,y,z,o,rx,_,_,_,_) =+ let e = envLinen 2 5 2 0.02+ o1 = fSinOsc ar (x * 2000) 0 * envGen kr g 1 0 1 DoNothing e+ o2 = sinOsc ar (y * 80 + 8) 0+ o3 = sinOsc kr (o * 0.5 + 0.3) (rx * 2 * pi) * 0.7+ in pan2 (o1 `amClip` o2) o3 (z * 5 * lagUD g 0 12)+in mix (voicer 16 f) * control kr "gain" 1
+ Help/Graph/jmcc-random-sine-waves.hs view
@@ -0,0 +1,14 @@+-- random sine waves (jmcc) #1 ; texture=overlap,2,5,12,inf+let o = fSinOsc ar (rand 0 2000) 0 * 0.02+in pan2 o (rand2 1) 1++-- random sine waves (jmcc) #1 ; texture=overlap,2,5,12,inf ; id+let f = randId 'α' 0 2000+ o = fSinOsc ar f 0 * 0.02+in pan2 o (randId 'β' (-1) 1) 1++-- random sine waves (jmcc) #1 ; event control+let f (_,g,x,_,z,o,_,_,_,_,_) =+ let s = fSinOsc ar (x * 2000) 0+ in pan2 s (o * 2 - 1) (z * g)+in mix (voicer 16 f) * control kr "gain" 0.25
+ Help/Graph/jmcc-resonant-dust.hs view
@@ -0,0 +1,13 @@+-- resonant dust (jmcc) #2 ; texture=overlap,5,2,9,inf+let rf = let st = rand 80 2080+ en = st + (rand2 0.5 * st)+ in xLine kr st en 9 DoNothing+ d = dust ar (rand 50 850) * 0.3+in pan2 (resonz d rf 0.1) (rand (-1) 1) 1++-- resonant dust (jmcc) #2 ; texture=overlap,5,2,9,inf ; id+let rf = let st = randId 'α' 80 2080+ en = st + (randId 'β' (-0.5) 0.5 * st)+ in xLine kr st en 9 DoNothing+ d = dustId 'γ' ar (randId 'δ' 50 850) * 0.3+in pan2 (resonz d rf 0.1) (randId 'ε' (-1) 1) 1
+ Help/Graph/jmcc-resonators-harmonic-series.hs view
@@ -0,0 +1,57 @@+-- resonators harmonic series (jmcc) #2 ; texture=xfade,1,7,inf+let nharm = 12+ spec _ = let rat = [1.0,1.125,1.25,1.333,1.5,1.667,1.875,2.0,2.25,2.5,2.667,3.0,3.333,3.75,4.0]+ freq = lchoose rat * 120+ series n i j = case n of {0 -> []; _ -> i : series (n - 1) (i + j) j}+ in klankSpec_mce+ (mce (series nharm freq freq) + X.randN nharm (-0.5) 0.5)+ (mceFill nharm (\i -> 1 / (i + 1)))+ (X.randN nharm 0.5 4.5)+ gen n = klank (brownNoise ar * 0.001) 1 0 1 (spec n)+in mceFill 2 gen++-- resonators harmonic series (jmcc) #2 ; texture=xfade,1,7,inf ; id+let series n i j = case n of {0 -> []; _ -> i : series (n - 1) (i + j) j}+ enumFromN e i = let j = fromEnum e in [j .. j + i]+ nharm = 12+ noise = brownNoiseId 'α' ar * 0.001+ rat = [1.0,1.125,1.25,1.333,1.5,1.667,1.875,2.0,2.25,2.5,2.667,3.0,3.333,3.75,4.0]+ freq = lchooseId 'β' rat * 120+ resFreqs = zipWith (+)+ (series nharm freq freq)+ (map (\z -> rand2Id ('γ',z) 0.5) (enumFromN 'δ' nharm))+ spec = klankSpec+ resFreqs+ (map (\i -> 1 / (constant i + 1)) [0 .. nharm - 1])+ (map (\z -> randId ('ε',z) 0.5 4.5) (enumFromN 'ζ' nharm))+in Protect.uclone_all 'η' 2 (klank noise 1 0 1 spec)++-- resonators harmonic series (jmcc) #2 ; event control+let f (_,g,_,y,z,o,rx,_,p,_,_) =+ let nharm = 12+ spec _ = let freq = unitCps p+ series n i j = case n of {0 -> []; _ -> i : series (n - 1) (i + j) j}+ in klankSpec_mce+ (mce (series nharm freq freq) + (X.randN nharm (-0.5) 0.5) * rx)+ (mceFill nharm (\i -> 1 / (i + (2 * y))))+ (X.randN nharm 0.5 4.5)+ gen n = dynKlank (brownNoise ar * 0.001) 1 0 1 (spec n)+ in pan2 (mceFill 2 gen) (o * 2 - 1) (z * g)+in mix (voicer 16 f) * control kr "gain" 1++-- resonators harmonic series (jmcc) #2 ; event control ; id+let f (c,g,_,y,z,o,rx,ry,p,_,_) =+ let series n i j = case n of {0 -> []; _ -> i : series (n - 1) (i + j) j}+ enumFromN e i = let j = fromEnum e in [j .. j + i]+ nharm = 12+ noise = brownNoiseId (c,'α') ar * 0.001+ freq = unitCps p+ resFreqs = zipWith (+)+ (series nharm freq freq)+ (map (\k -> rand2Id (c,'γ',k) 0.5 * rx) (enumFromN 'δ' nharm))+ spec = klankSpec+ resFreqs+ (map (\i -> 1 / (constant i + (2 * y))) [0 .. nharm - 1])+ (map (\k -> randId (c,'ε',k) 0.5 4.5 * (0.5 + ry)) (enumFromN 'ζ' nharm))+ in pan2 (Protect.uclone_all 'η' 2 (dynKlank noise 1 0 1 spec)) (o * 2 - 1) (z * g)+in mix (voicer 16 f) * control kr "gain" 1
+ Help/Graph/jmcc-reverberated-sine-percussion.hs view
@@ -0,0 +1,23 @@+-- reverberated sine percussion (jmcc) #3+let s = mixFill 6 (\_ -> resonz (dust ar (2 / 6) * 50) (200 + rand 0 3000) 0.003)+ y = mix (combL (delayN s 0.048 0.48) 0.1 (lfNoise1 kr (X.randN 5 0 0.1) * 0.04 + 0.05) 15)+ x = iter 4 (\i -> allpassN i 0.05 (X.randN 2 0 0.05) 1) y+in s + x * 0.2++-- reverberated sine percussion (jmcc) #3 ; monad+uid_st_eval (do+ let d = 6+ c = 5+ a = 4+ s_ = do n <- dustM ar (2 / constant d)+ r <- randM 0 3000+ return (resonz (n * 50) (200 + r) 0.003)+ x_ i = do r <- X.randNM 2 0 0.05+ return (allpassN i 0.05 r 1)+ s <- fmap sum (sequence (replicate d s_))+ y <- do let z = delayN s 0.048 0.48+ r <- X.randNM c 0 0.1+ n <- lfNoise1M kr r+ return (mix (combL z 0.1 (n * 0.04 + 0.05) 15))+ x <- chainM a x_ y+ return (s + x * 0.2))
+ Help/Graph/jmcc-ring-modulated-klank.hs view
@@ -0,0 +1,17 @@+-- ring modulated klank (jmcc) #2 ; texture=overlap,4,4,4,inf+let p = 8+ k = let sp = klankSpec_mce (X.randN p 100 10000)+ (mceFill p (const 1))+ (X.randN p 0.2 1)+ in klank (dust ar 20 * 0.02) 1 0 1 sp+ f = lfNoise2 kr (rand 0.1 0.4) * 200 + rand 350 400+in pan2 (sinOsc ar f 0 * k) (rand (-1) 1) 1++-- ring modulated klank (jmcc) #2 ; texture=overlap,4,4,4,inf ; id+let p = 8+ k = let sp = klankSpec_mce (X.randNId p 'α' 100 10000)+ (mce (replicate p 1))+ (X.randNId p 'α' 0.2 1)+ in klank (dustId 'α' ar 20 * 0.02) 1 0 1 sp+ f = lfNoise2Id 'α' kr (randId 'α' 0.1 0.4) * 200 + randId 'α' 350 400+in pan2 (sinOsc ar f 0 * k) (randId 'α' (-1) 1) 1
+ Help/Graph/jmcc-sample-and-hold-liquidities.hs view
@@ -0,0 +1,26 @@+-- sample and hold liquidities (jmcc) #4+let r = mouseX kr 1 200 Exponential 0.1+ t = recip r+ c = impulse kr r 0 * 0.4+ cf = mouseY kr 100 8000 Exponential 0.1+ f = latch (whiteNoise kr * cf * 0.5 + cf) c+ p = latch (whiteNoise kr) c+ i = pan2 (sinOsc ar f 0 * decay2 c (t * 0.1) (t * 0.9)) p 1+in combN i 0.3 0.3 2++-- sample and hold liquidities (jmcc) #4 ; id+let r = mouseX kr 1 200 Exponential 0.1+ t = recip r+ c = impulse kr r 0 * 0.4+ cf = mouseY kr 100 8000 Exponential 0.1+ f = latch (whiteNoiseId 'α' kr * cf * 0.5 + cf) c+ p = latch (whiteNoiseId 'β' kr) c+ i = pan2 (sinOsc ar f 0 * decay2 c (t * 0.1) (t * 0.9)) p 1+in combN i 0.3 0.3 2++-- sample and hold liquidities (jmcc) #4 ; event control+let f (_,g,_,y,z,o,_,_,p,px,_) =+ let env = decay2 (trig g controlDur * z * 2) (0.01 + y * 0.1) (0.5 + y * 0.4)+ sig = pan2 (sinOsc ar (midiCps (p * 127 + px)) 0 * env) (o * 2 - 1) 1+ in sig + combN sig 0.3 0.3 2+in mix (voicer 16 f) * control kr "gain" 1
+ Help/Graph/jmcc-saucer-base.hs view
@@ -0,0 +1,14 @@+-- saucer base (jmcc) #6 ; texture=overlap,2,6,4,inf+let b = rand 0 1000+ c = rand 0 5000+ o = sinOsc ar (sinOsc ar (rand 0 20) 0 * b + (1.1 * b)) 0 * c + (1.1 * c)+in pan2 (sinOsc ar o 0 * 0.1) (rand2 1) 1++-- saucer base (jmcc) #6 ; texture=overlap,2,6,4,inf ; id+let a = randId 'α' 0 20+ b = randId 'β' 0 1000+ c = randId 'γ' 0 5000+ p = randId 'δ' (-1) 1+ o = sinOsc ar a 0 * b + (1.1 * b)+ o' = sinOsc ar o 0 * c + (1.1 * c)+in pan2 (sinOsc ar o' 0 * 0.1) p 1
+ Help/Graph/jmcc-sawed-cymbals.hs view
@@ -0,0 +1,14 @@+-- sawed cymbals (jmcc) #9 ; texture=overlap,4,4,6,inf+let y _ = let f1 = rand 500 2500+ f = mceFill 15 (\_ -> rand f1 (f1 + rand 0 8000))+ in klankSpec_mce f (mceConst 15 1) (X.randN 15 2 6)+ fS = xLine kr (rand 0 600) (rand 0 600) 12 DoNothing+in klank (lfSaw ar fS 0 * 0.0005) 1 0 1 (mceTranspose (mceFill 2 y))++-- sawed cymbals (jmcc) #9 ; texture=overlap,4,4,6,inf ; id+let y z _ = let f1 = randId (z,'α') 500 2500+ f = listFillId 'γ' 15 (\z' _ -> randId (z','δ') f1 (f1 + randId (z','β') 0 8000))+ rt = listFillId 'ε' 15 (\z' _ -> randId (z','ζ') 2 6)+ in klankSpec f (replicate 15 1) rt+ fS = xLine kr (randId 'θ' 0 600) (randId 'ι' 0 600) 12 DoNothing+in klank (lfSaw ar fS 0 * 0.0005) 1 0 1 (mceTranspose (mceFillId 'η' 2 y))
+ Help/Graph/jmcc-scratchy.hs view
@@ -0,0 +1,7 @@+-- scratchy (jmcc) #1+let n = mceFill 2 (\_ -> brownNoise ar * 0.5 - 0.49)+in rhpf (max n 0 * 20) 5000 1++-- scratchy (jmcc) #1 ; id+let n = mce (map (\z -> brownNoiseId z ar * 0.5 - 0.49) (id_seq 2 'α'))+in rhpf (max n 0 * 20) 5000 1
+ Help/Graph/jmcc-sidereal-time.hs view
@@ -0,0 +1,21 @@+-- sidereal time (jmcc) #9 ; texture=overlap,4,4,6,inf+let p = 15+ i = let y _ = klankSpec_mce (X.expRandN p 100 6000) (mceConst p 1) (X.randN p 2 6)+ in mceFill 2 y+ f = xLine kr (expRand 40 300) (expRand 40 300) 12 DoNothing+ t = let e = lfNoise2 kr (rand 0 8)+ in lfPulse ar f 0 (rand 0.1 0.9) * 0.002 * max 0 e+ o = distort (klank t 1 0 1 (mceTranspose i)) * 0.1+in combN o 0.6 (rand 0.1 0.6) 8 + mceReverse o++-- sidereal time (jmcc) #9 ; texture=overlap,4,4,6,inf ; id+let p = 15+ i = let y z _ = let fr = X.expRandNId p (z,'β') 100 6000+ rt = X.randNId p (z,'δ') 2 6+ in klankSpec_mce fr (mceConst p 1) rt+ in mceFillId 'ε' 2 y+ f = xLine kr (expRandId 'ζ' 40 300) (expRandId 'η' 40 300) 12 DoNothing+ t = let e = lfNoise2Id 'θ' kr (randId 'ι' 0 8)+ in lfPulse ar f 0 (randId 'κ' 0.1 0.9) * 0.002 * max 0 e+ o = distort (klank t 1 0 1 (mceTranspose i)) * 0.1+in combN o 0.6 (randId 'λ' 0.1 0.6) 8 + mceReverse o
+ Help/Graph/jmcc-snare-909.hs view
@@ -0,0 +1,37 @@+-- snare-909 (jmcc)+let x = mouseX kr 1 4 Linear 0.2+ y = mouseY kr 0.25 0.75 Exponential 0.2+ tr = impulse kr (3 * x) 0+ n = whiteNoise ar+ v = tRand 0.25 1.0 tr+ e a b = envGen ar tr 1 0 1 DoNothing (envPerc a b)+ e1 = e 0.0005 0.055+ e2 = e 0.0005 0.075+ e3 = e 0.0005 0.4+ e4 = e 0.0005 0.283+ t1 = lfTri ar 330 0+ t2 = lfTri ar 185 0+ x1 = lpf n 7040 * 0.1 + v+ x2 = hpf x1 523+ m1 = t1 * e1 * 0.25 + t2 * e2 * 0.25+ m2 = x1 * e3 * 0.20 + x2 * e4 * 0.20+in pan2 (m1 + m2) 0 y++-- snare-909 (jmcc) ; id+let x = mouseX kr 1 4 Linear 0.2+ y = mouseY kr 0.25 0.75 Exponential 0.2+ tr = impulse kr (3 * x) 0+ n = whiteNoiseId 'α' ar+ v = tRandId 'β' 0.25 1.0 tr+ e a b = envGen ar tr 1 0 1 DoNothing (envPerc a b)+ e1 = e 0.0005 0.055+ e2 = e 0.0005 0.075+ e3 = e 0.0005 0.4+ e4 = e 0.0005 0.283+ t1 = lfTri ar 330 0+ t2 = lfTri ar 185 0+ x1 = lpf n 7040 * 0.1 + v+ x2 = hpf x1 523+ m1 = t1 * e1 * 0.25 + t2 * e2 * 0.25+ m2 = x1 * e3 * 0.20 + x2 * e4 * 0.20+in pan2 (m1 + m2) 0 y
+ Help/Graph/jmcc-spe.hs view
@@ -0,0 +1,28 @@+-- spe (jmcc)+let rapf i = allpassN i 0.05 (X.randN 2 0 0.05) 4+ src = let t = impulse kr 9 0+ e = envGen kr t 0.1 0 1 DoNothing (envPerc 0.1 1)+ s = mce [00,03,02,07+ ,08,32,16,18+ ,00,12,24,32]+ f = midiCps (demand t 0 (dseq dinf s) + 32)+ rq = midiCps (lfNoise1 kr 1 * 36 + 110)+ in rlpf (lfSaw ar f 0 * e) rq 0.1+in iter 4 rapf src++-- spe (jmcc) ; monad+uid_st_eval (do+ let rapf i = do r <- replicateM 2 (randM 0 0.05)+ return (allpassN i 0.05 (mce r) 4)+ src = do let t = impulse kr 9 0+ e = envGen kr t 0.1 0 1 DoNothing (envPerc 0.1 1)+ s = mce [00,03,02,07+ ,08,32,16,18+ ,00,12,24,32]+ n <- lfNoise1M kr 1+ m <- dseqM dinf s+ let f = midiCps (demand t 0 m + 32)+ o = lfSaw ar f 0 * e+ rq = midiCps (n * 36 + 110)+ return (rlpf o rq 0.1)+ chainM 4 rapf =<< src)
+ Help/Graph/jmcc-sprinkler-mouse.hs view
@@ -0,0 +1,11 @@+-- sprinkler mouse (jmcc) #1+let n = whiteNoise ar+ f = mouseX kr 0.2 50 Linear 0.2+ t = lfPulse kr f 0 0.25 * 0.1+in bpz2 (n * t)++-- sprinkler mouse (jmcc) #1 ; id+let n = whiteNoiseId 'α' ar+ f = mouseX kr 0.2 50 Linear 0.2+ t = lfPulse kr f 0 0.25 * 0.1+in bpz2 (n * t)
+ Help/Graph/jmcc-sprinkler.hs view
@@ -0,0 +1,12 @@+-- sprinkler (jmcc) #1+let f = lfPulse kr 0.09 0 0.16 * 10 + 7+ t = lfPulse kr f 0 0.25 * 0.1+ n = whiteNoise ar+in bpz2 (n * t)++-- sprinkler (jmcc) #1 ; id+let f = lfPulse kr 0.09 0 0.16 * 10 + 7+ t = lfPulse kr f 0 0.25 * 0.1+ n = whiteNoiseId 'α' ar+in bpz2 (n * t)+
+ Help/Graph/jmcc-strummable-guitar.hs view
@@ -0,0 +1,45 @@+-- strummable guitar (jmcc) #11+let strummable_guitar_str sc ix =+ let k = constant ix+ x = mouseX kr 0 1 Linear 0.2+ t = abs (hpz1 (x `greater_than` (0.25 + k * 0.1)))+ e = decay t 0.05+ n = pinkNoise ar * e+ dt = 1 / midiCps sc+ s = combL n dt dt 4+ in pan2 s (k * 0.2 - 0.5) 1+ scale = [52,57,62,67,71,76]+ strs = sum (zipWith strummable_guitar_str scale [0..])+in leakDC (lpf strs 12000) 0.995++-- strummable guitar (jmcc) #11 ; id+let strummable_guitar_str sc (ix,z) =+ let k = constant ix+ x = mouseX kr 0 1 Linear 0.2+ t = abs (hpz1 (x `greater_than` (0.25 + k * 0.1)))+ e = decay t 0.05+ n = pinkNoiseId z ar * e+ dt = 1 / midiCps sc+ s = combL n dt dt 4+ in pan2 s (k * 0.2 - 0.5) 1+ scale = [52,57,62,67,71,76]+ strs = sum (zipWith strummable_guitar_str scale (zip [0..] ['α'..]))+in leakDC (lpf strs 12000) 0.995++-- strummable guitar (jmcc) #11 ; event control+let f (_,g,_,y,z,o,_,_,p,_,_) =+ let e = decay (trig g controlDur) 0.05+ n = pinkNoise ar * e+ dt = 1 / unitCps p+ s = combL n dt dt ((y + 1) * 3)+ in pan2 s (o * 2 - 1) (0.5 + latch z g)+in leakDC (lpf (mix (voicer 16 f)) 12000) 0.995 * control kr "gain" 1++-- strummable guitar (jmcc) #11 ; event control ; id+let f (c,g,_,y,z,o,_,_,p,_,_) =+ let e = decay (trig g controlDur) 0.05+ n = pinkNoiseId c ar * e+ dt = 1 / unitCps p+ s = combL n dt dt ((y + 1) * 3)+ in pan2 s (o * 2 - 1) (0.5 + latch z g)+in leakDC (lpf (mix (voicer 16 f)) 12000) 0.995 * control kr "gain" 1
+ Help/Graph/jmcc-strummable-silk.hs view
@@ -0,0 +1,53 @@+-- strummable silk (jmcc) #11+let x = mouseX kr 0 1 Linear 0.2+ strummable_guitar_str ix =+ let n = 15+ k = constant ix+ tr = abs (hpz1 (x `greater_than` (0.25 + k * 0.07)))+ e = decay (impulse ar 14 0 * lag (trig tr 1) 0.2 * 0.01) 0.04+ freq0 = midiCps (([-2,0,3,5,7,10,12,15] !! ix) + 60)+ freq = mce (map ((*) freq0) [1 .. constant n + 1])+ param = klankSpec_mce freq (mce (replicate n 1)) (X.randN n 0.3 1)+ in pan2 (klank (pinkNoise ar * e) 1 0 1 param) (k * 0.2 - 0.5) 1+ strs = sum (map strummable_guitar_str [0..7])+ r_allpass i = allpassN i 0.1 (X.randN 2 0 0.05) 4+in iter 6 r_allpass (leakDC (lpf strs 12000) 0.995)++-- strummable silk (jmcc) #11 ; id+let x = mouseX kr 0 1 Linear 0.2+ strummable_guitar_str (ix,z) =+ let n = 15+ k = constant ix+ tr = abs (hpz1 (x `greater_than` (0.25 + k * 0.07)))+ e = decay (impulse ar 14 0 * lag (trig tr 1) 0.2 * 0.01) 0.04+ freq0 = midiCps (([-2,0,3,5,7,10,12,15] !! ix) + 60)+ freq = mce (map ((*) freq0) [1 .. constant n + 1])+ param = klankSpec_mce freq (mce (replicate n 1)) (X.randNId n z 0.3 1)+ in pan2 (klank (pinkNoiseId z ar * e) 1 0 1 param) (k * 0.2 - 0.5) 1+ strs = sum (map strummable_guitar_str (zip [0..7] ['α'..]))+ r_allpass z i = allpassN i 0.1 (X.randNId 2 (z,'ζ') 0 0.05) 4+ rev = useqId 'λ' 6 r_allpass+in rev (leakDC (lpf strs 12000) 0.995)++-- strummable silk (jmcc) #11 ; event control+let f (_,g,_,y,z,o,_,_,p,_,_) =+ let n = 15+ e = decay (impulse ar (linExp y 0 1 11 19) 0 * (z * 2 + lag (trig g 1) 0.2) * 0.04) 0.04+ plk = pinkNoise ar * e+ freq = mce (map ((*) (unitCps p)) [1 .. constant n + 1])+ param = klankSpec_mce freq (mce (replicate n 1)) (X.randN n 0.3 1)+ in pan2 (dynKlank plk 1 0 1 param) (o * 2 - 1) z+ r_allpass i = allpassN i 0.1 (X.randN 2 0 0.05) 4+in iter 6 r_allpass (leakDC (lpf (mix (voicer 16 f)) 12000) 0.995) * control kr "gain" 1++-- strummable silk (jmcc) #11 ; event control ; id+let f (c,g,_,y,z,o,_,_,p,_,_) =+ let n = 15+ e = decay (impulse ar (linExp y 0 1 11 19) 0 * (z * 2 + lag (trig g 1) 0.2) * 0.04) 0.04+ plk = pinkNoiseId c ar * e+ freq = mce (map ((*) (unitCps p)) [1 .. constant n + 1])+ param = klankSpec_mce freq (mce (replicate n 1)) (X.randNId n c 0.3 1)+ in pan2 (dynKlank plk 1 0 1 param) (o * 2 - 1) z+ r_allpass z i = allpassN i 0.1 (X.randNId 2 (z,'ζ') 0 0.05) 4+ rev = useqId 'λ' 6 r_allpass+in rev (leakDC (lpf (mix (voicer 16 f)) 12000) 0.995) * control kr "gain" 1
+ Help/Graph/jmcc-sweepy-noise.hs view
@@ -0,0 +1,15 @@+-- sweepy noise (jmcc) #6+let n = mce2 (whiteNoise ar) (whiteNoise ar)+ lfoDepth = mouseY kr 200 8000 Exponential 0.1+ lfoRate = mouseX kr 4 60 Exponential 0.1+ freq = lfSaw kr lfoRate 0 * lfoDepth + (lfoDepth * 1.2)+ filtered = rlpf (n * 0.03) freq 0.1+in combN filtered 0.3 0.3 2 + filtered++-- sweepy noise (jmcc) #6 ; id+let n = mce2 (whiteNoiseId 'α' ar) (whiteNoiseId 'β' ar)+ lfoDepth = mouseY kr 200 8000 Exponential 0.1+ lfoRate = mouseX kr 4 60 Exponential 0.1+ freq = lfSaw kr lfoRate 0 * lfoDepth + (lfoDepth * 1.2)+ filtered = rlpf (n * 0.03) freq 0.1+in combN filtered 0.3 0.3 2 + filtered
+ Help/Graph/jmcc-swept-resonant-noise.hs view
@@ -0,0 +1,55 @@+-- swept resonant noise (jmcc) #2 ; texture=overlap,4,5,5,inf+let flt src _ =+ let p = 10+ spec = klankSpec_mce+ (X.linRandN p 80 10080 0)+ (mce (replicate p 1))+ (X.randN p 0.5 2.5)+ in klank src 1 0 1 spec+ n = whiteNoise ar * 0.007+ f = midiCps (fSinOsc kr (rand 0.1 0.3) 0 * rand 0 24 + rand 36 84)+ sw = resonz n f 0.1+in mceFill 2 (flt sw)++-- swept resonant noise (jmcc) #2 ; texture=overlap,4,5,5,inf ; id+let flt src z =+ let p = 10+ spec = klankSpec_mce+ (X.linRandNId p z 80 10080 0)+ (mce (replicate p 1))+ (X.randNId p z 0.5 2.5)+ in klank src 1 0 1 spec+ n = whiteNoiseId 'α' ar * 0.007+ f = midiCps (fSinOsc kr (randId 'β' 0.1 0.3) 0 * randId 'γ' 0 24 + randId 'δ' 36 84)+ sw = resonz n f 0.1+in mce (map (flt sw) ['ε','ζ'])++-- swept resonant noise (jmcc) #2 ; event control+let f (_,g,x,y,z,_,_,_,_,_,_) =+ let flt src _ =+ let np = 10+ spec = klankSpec_mce+ ((x + 0.5) * X.linRandN np 80 10080 0)+ (mce (replicate np 1))+ (X.randN np 0.5 2.5)+ in dynKlank src 1 0 1 spec+ f0 = (0.25 + y) * rand 0.1 0.3+ f1 = midiCps (fSinOsc kr f0 0 * rand 0 24 + rand 36 84)+ sw = resonz (whiteNoise ar * 0.007) f1 0.1+ in mceFill 2 (flt sw) * z * lag g 0.1+in mix (voicer 16 f) * control kr "gain" 1++-- swept resonant noise (jmcc) #2 ; event control ; id+let f (c,g,x,y,z,_,_,_,_,_,_) =+ let flt src k =+ let np = 10+ spec = klankSpec_mce+ ((x + 0.5) * X.linRandNId np (c,k) 80 10080 0)+ (mce (replicate np 1))+ (X.randNId np (c,k) 0.5 2.5)+ in dynKlank src 1 0 1 spec+ f0 = (0.25 + y) * randId (c,'β') 0.1 0.3+ f1 = midiCps (fSinOsc kr f0 0 * randId (c,'γ') 0 24 + randId (c,'δ') 36 84)+ sw = resonz (whiteNoiseId (c,'α') ar * 0.007) f1 0.1+ in mce (map (flt sw) ['ε','ζ']) * z * lag g 0.1+in mix (voicer 16 f) * control kr "gain" 1
+ Help/Graph/jmcc-synthetic-piano.hs view
@@ -0,0 +1,45 @@+-- synthetic piano (jmcc) #3 ; texture=overlap,6,0,6,inf+let n = iRand 36 90+ s = impulse ar (rand 0.1 0.5) (rand 0 1) * 0.1+ e = decay2 s 0.008 0.04+ c o = let n0 = lfNoise2 ar 3000+ dt = 1 / midiCps (n + o)+ in combL (n0 * e) dt dt 6+ l = ((n - 36) / 27) - 1+ c_ = sum_opt (map c [-0.05,0,0.04])+in pan2 c_ l 1++-- synthetic piano (jmcc) #3 ; texture=overlap,6,0,6,inf ; id+let n = iRandId 'α' 36 90+ f = randId 'β' 0.1 0.5+ ph = randId 'γ' 0 1+ s = impulse ar f ph * 0.1+ e = decay2 s 0.008 0.04+ c z o = let n0 = lfNoise2Id z ar 3000+ dt = 1 / midiCps (n + o)+ in combL (n0 * e) dt dt 6+ l = ((n - 36) / 27) - 1+ c_ = sum_opt (zipWith c ['δ'..] [-0.05,0,0.04])+in pan2 c_ l 1++-- synthetic piano (jmcc) #3 ; event-control+let f (_,g,_,y,z,_,_,_,p,_,_) =+ let e = decay2 (trig g controlDur) 0.008 (linLin y 0 1 0.02 0.06) * z * 2+ cmb o = let n0 = lfNoise2 ar 3000+ dt = 1 / midiCps (p * 127 + o)+ in combL (n0 * e) dt dt 6+ l = ((p * 127 - 36) / 27) - 1+ cmb_ = sum_opt (map cmb [-0.05,0,0.04])+ in pan2 cmb_ l (1 + z)+in mix (voicer 16 f) * control kr "gain" 1++-- synthetic piano (jmcc) #3 ; event-control ; id+let f (c,g,_,y,z,_,_,_,p,_,_) =+ let e = decay2 (trig g controlDur) 0.008 (linLin y 0 1 0.02 0.06) * z * 2+ cmb k o = let n0 = lfNoise2Id (c,k) ar 3000+ dt = 1 / midiCps (p * 127 + o)+ in combL (n0 * e) dt dt 6+ l = ((p * 127 - 36) / 27) - 1+ cmb_ = sum_opt (zipWith cmb ['δ'..] [-0.05,0,0.04])+ in pan2 cmb_ l (1 + z)+in mix (voicer 16 f) * control kr "gain" 1
+ Help/Graph/jmcc-tank.hs view
@@ -0,0 +1,91 @@+-- tank (jmcc) ; http://create.ucsb.edu/pipermail/sc-users/2004-April/009692.html+let s1 _ =+ let d = dust ar 0.2+ f = expRand 300 2200+ p = rand (-1) 1+ in pan2 (decay2 d 0.1 0.5 * 0.1 * cubed (fSinOsc ar f 0)) p 1+ s2 =+ let d = dust ar 0.01+ n = brownNoise ar+ in pan2 (decay2 d 0.04 0.3 * n) 0 1+ rev_f i =+ let l0 = localIn 2 ar (mce2 0 0) * 0.98+ l1 = onePole l0 0.33+ (l1l,l1r) = unmce2 l1+ l2 = rotate2 l1l l1r 0.23+ l3 = allpassN l2 0.05 (X.randN 2 0.01 0.05) 2+ l4 = delayN l3 0.3 (mce2 0.17 0.23)+ l5 = allpassN l4 0.05 (X.randN 2 0.03 0.15) 2+ l6 = leakDC l5 0.995+ l7 = l6 + i+ in mrg [l7,localOut l7]+ r_allpass i = allpassN i 0.03 (X.randN 2 0.005 0.02) 1+ s3 = s2 + mixFill 8 s1+in rev_f (iter 4 r_allpass s3)++-- tank (jmcc) ; http://create.ucsb.edu/pipermail/sc-users/2004-April/009692.html ; id+let s1 z _ =+ let d = dustId (z,'α') ar 0.2+ f = expRandId (z,'β') 300 2200+ p = randId (z,'γ') (-1) 1+ in pan2 (decay2 d 0.1 0.5 * 0.1 * cubed (fSinOsc ar f 0)) p 1+ s2 =+ let d = dustId 'δ' ar 0.01+ n = brownNoiseId 'ε' ar+ in pan2 (decay2 d 0.04 0.3 * n) 0 1+ rev_f i =+ let l0 = localIn 2 ar (mce2 0 0) * 0.98+ l1 = onePole l0 0.33+ (l1l,l1r) = unmce2 l1+ l2 = rotate2 l1l l1r 0.23+ l3 = allpassN l2 0.05 (X.randNId 2 'θ' 0.01 0.05) 2+ l4 = delayN l3 0.3 (mce2 0.17 0.23)+ l5 = allpassN l4 0.05 (X.randNId 2 'ι' 0.03 0.15) 2+ l6 = leakDC l5 0.995+ l7 = l6 + i+ in mrg [l7,localOut l7]+ r_allpass z i = allpassN i 0.03 (X.randNId 2 (z,'ζ') 0.005 0.02) 1+ s3 = s2 + mixFillId 'κ' 8 s1+in rev_f (useqId 'λ' 4 r_allpass s3)++-- tank (jmcc) ; event control+let s1 =+ let f (_,g,x,y,z,o,_,_,_,_,_) =+ let tr = trig g controlDur+ freq = linExp x 0 1 300 2200+ in pan2 (decay2 tr 0.1 (0.5 + y * 0.5) * 0.2 * cubed (fSinOsc ar freq 0)) (o * 2 - 1) z+ in mix (voicer 16 f) * control kr "gain" 1+ rev_f i =+ let l0 = localIn 2 ar (mce2 0 0) * 0.98+ l1 = onePole l0 0.33+ (l1l,l1r) = unmce2 l1+ l2 = rotate2 l1l l1r 0.23+ l3 = allpassN l2 0.05 (X.randN 2 0.01 0.05) 2+ l4 = delayN l3 0.3 (mce2 0.17 0.23)+ l5 = allpassN l4 0.05 (X.randN 2 0.03 0.15) 2+ l6 = leakDC l5 0.995+ l7 = l6 + i+ in mrg [l7,localOut l7]+ r_allpass i = allpassN i 0.03 (X.randN 2 0.005 0.02) 1+in rev_f (iter 4 r_allpass s1)++-- tank (jmcc) ; event control ; id+let s1 =+ let f (_,g,x,y,z,o,_,_,_,_,_) =+ let tr = trig g controlDur+ freq = linExp x 0 1 300 2200+ in pan2 (decay2 tr 0.1 (0.5 + y * 0.5) * 0.2 * cubed (fSinOsc ar freq 0)) (o * 2 - 1) z+ in mix (voicer 16 f) * control kr "gain" 1+ rev_f i =+ let l0 = localIn 2 ar (mce2 0 0) * 0.98+ l1 = onePole l0 0.33+ (l1l,l1r) = unmce2 l1+ l2 = rotate2 l1l l1r 0.23+ l3 = allpassN l2 0.05 (X.randNId 2 'θ' 0.01 0.05) 2+ l4 = delayN l3 0.3 (mce2 0.17 0.23)+ l5 = allpassN l4 0.05 (X.randNId 2 'ι' 0.03 0.15) 2+ l6 = leakDC l5 0.995+ l7 = l6 + i+ in mrg [l7,localOut l7]+ r_allpass z i = allpassN i 0.03 (X.randNId 2 (z,'ζ') 0.005 0.02) 1+in rev_f (useqId 'λ' 4 r_allpass s1)
+ Help/Graph/jmcc-theremin.hs view
@@ -0,0 +1,16 @@+-- theremin (jmcc) ; mouse control+let m = 7+ detune = 0+ x = mouseX kr 0 0.6 Linear 0.2+ y = mouseY kr 4000 200 Exponential 0.8+ f = y + detune+ f' = f + f * sinOsc ar m 0 * 0.02+ a = sinOsc ar f' 0 * x+in pan2 a 0 1++-- theremin (jmcc) ; event control+let f (_,w,x,y,z,o,rx,_,_,_,_) =+ let freq = lag (linExp y 0 1 4000 200) 0.8+ a = sinOsc ar (freq + freq * sinOsc ar (4 + 3 * rx) 0 * 0.02) 0 * x * 0.6 * lag w 0.2+ in pan2 a (o * 0.25) (0.5 + z)+in mix (voicer 16 f) * control kr "gain" 0.5
+ Help/Graph/jmcc-tremulate.hs view
@@ -0,0 +1,33 @@+-- tremulate (jmcc) #1 ; texture=xfade,0.5,2,inf+let f = rand 500 900+ o = fSinOsc ar (f * mce [1,1.2,1.5,1.8]) 0+ r = X.randN 4 30 90+ a = max 0 (lfNoise2 kr r) * 0.1+ l = X.randN 4 (-1) 1+in mix (pan2 o l a)++-- tremulate (jmcc) #1 ; texture=xfade,0.5,2,inf ; id+let f = randId 'α' 500 900+ o = fSinOsc ar (f * mce [1,1.2,1.5,1.8]) 0+ r = X.randNId 4 'β' 30 90+ a = max 0 (lfNoise2Id 'γ' kr r) * 0.1+ l = X.randNId 4 'δ' (-1) 1+in mix (pan2 o l a)++-- tremulate (jmcc) #1 ; event control+let f (_,w,x,_,z,o,rx,ry,_,_,_) =+ let s = fSinOsc ar ((x * 400 + 500) * mce [1,1.2,1.5,1.8]) 0+ r = X.randN 4 30 90+ a = max 0 (lfNoise2 kr (r * (0.75 + rx))) * z+ l = X.randN 4 (-1) 1+ in mix (pan2 s (l + (o * 2 - 1)) (a * lagUD w 0 (ry * 2)))+in combN (mix (voicer 16 f) * control kr "gain" 0.5) 0.1 0.1 1++-- tremulate (jmcc) #1 ; event control ; id+let f (_,g,x,_,z,o,rx,ry,_,_,_) =+ let s = fSinOsc ar ((x * 400 + 500) * mce [1,1.2,1.5,1.8]) 0+ r = X.randNId 4 'β' 30 90+ a = max 0 (lfNoise2Id 'γ' kr (r * (0.75 + rx))) * z+ l = X.randNId 4 'δ' (-1) 1+ in mix (pan2 s (l + (o * 2 - 1)) (a * lagUD g 0 (ry * 2)))+in combN (mix (voicer 16 f) * control kr "gain" 0.5) 0.1 0.1 1
+ Help/Graph/jmcc-uplink.hs view
@@ -0,0 +1,18 @@+-- uplink (jmcc) #2 ; texture=overlap,4,1,5,inf+let f _ = let p0 = lfPulse kr (rand0 20) 0 (rand0 1)+ p1 = lfPulse kr (rand0 4) 0 (rand0 1) * rand0 8000 + rand0 2000+ in p0 * p1+in pan2 (lfPulse ar (mixFill 2 f) 0 0.5 * 0.04) (rand (-0.8) 0.8) 1++-- uplink (jmcc) #2 ; texture=overlap,4,1,5,inf ; id+let f z _ = let p0 = lfPulse kr (rand0Id (z,'α') 20) 0 (rand0Id (z,'β') 1)+ p1 = lfPulse kr (rand0Id (z,'γ') 4) 0 (rand0Id (z,'δ') 1) * rand0Id (z,'ε') 8000 + rand0Id (z,'ζ') 2000+ in p0 * p1+in pan2 (lfPulse ar (mixFillId 'η' 2 f) 0 0.5 * 0.04) (randId 'θ' (-0.8) 0.8) 1++-- uplink (jmcc) #2 ; texture=overlap,4,1,5,inf ; id+let r = rand0Id+ p0 = lfPulse kr (r 'α' 20) 0 (r 'β' 1)+ p1 = lfPulse kr (r 'γ' 4) 0 (r 'δ' 1) * r 'ε' 8000 + r 'ζ' 2000+ f = mix (Protect.uclone_all 'η' 2 (p0 * p1))+in pan2 (lfPulse ar f 0 0.5 * 0.04) (randId 'θ' (-0.8) 0.8) 1
+ Help/Graph/jmcc-what-was-i-thinking.hs view
@@ -0,0 +1,25 @@+-- what was i thinking? (jmcc) #2+let p = pulse ar f (lfNoise1 kr 0.157 * 0.4 + 0.5) * 0.04+ i = lfPulse ar 0.1 0 0.05 * impulse ar 8 0 * 500+ d = decay i 2+ f = max (sinOsc kr 4 0 + 80) d+ z = rlpf p (lfNoise1 kr 0.2 * 2000 + 2400) 0.2+ c x _ = combL (x * 0.6) 0.06 (lfNoise1 kr (rand 0 0.3) * 0.025 + 0.035) 1+in z + mce [mixFill 2 (c z),mixFill 2 (c z)]++-- what was i thinking? (jmcc) #2 ; monad+uid_st_eval (do+ n0 <- lfNoise1M kr 0.2+ n1 <- lfNoise1M kr 0.157+ let p = pulse ar f (n1 * 0.4 + 0.5) * 0.04+ i = lfPulse ar 0.1 0 0.05 * impulse ar 8 0 * 500+ d = decay i 2+ f = max (sinOsc kr 4 0 + 80) d+ z = rlpf p (n0 * 2000 + 2400) 0.2+ c x = do r <- randM 0 0.3+ n <- lfNoise1M kr r+ return (combL x 0.06 (n * 0.025 + 0.035) 1)+ y = z * 0.6+ z0 <- replicateM 2 (c y)+ z1 <- replicateM 2 (c y)+ return (z + mce [sum z0,sum z1]))
+ Help/Graph/jmcc-why-supercollider.hs view
@@ -0,0 +1,12 @@+-- why supercollider (jmcc) #0+let s = mixFill 10 (\_ -> resonz (dust ar 0.2 * 50) (rand 200 3200) 0.003)+ y = mixFill 7 (\_ -> combL (delayN s 0.048 0.048) 0.1 (lfNoise1 kr (rand 0 0.1) * 0.04 + 0.05) 15)+ f i = allpassN i 0.05 (X.randN 2 0 0.05) 1+in s + 0.2 * iter 4 f y++-- why supercollider (jmcc) #0 ; id+let s = mixFillId 'α' 10 (\z _ -> resonz (dustId z ar 0.2 * 50) (randId z 200 3200) 0.003)+ y = mixFillId 'β' 7 (\z _ -> combL (delayN s 0.048 0.048) 0.1 (lfNoise1Id z kr (randId z 0 0.1) * 0.04 + 0.05) 15)+ f z i = allpassN i 0.05 (mce2 (randId (z,'γ') 0 0.05) (randId (z,'δ') 0 0.05)) 1+ x = foldl (&) y (map f (id_seq 4 'ε'))+in s + 0.2 * x
+ Help/Graph/jmcc-wind-metals.hs view
@@ -0,0 +1,67 @@+-- wind metals (jmcc) ; texture=overlap,5,2,12,inf+let n = 6+ base = expRand 60 4000+ exc = mceFill 2 (\_ -> brownNoise ar) * 0.007 * max 0 (lfNoise1 kr (expRand 0.125 0.5) * 0.75 + 0.25)+ k = klankSpec_mce (mceFill n (\_ -> rand base (base + rand 500 8000))) (mceConst n 1) (mceFill n (\_ -> rand 0.1 2))+in softClip (klank exc 1 0 1 k * 0.1)++-- wind metals (jmcc) ; texture=overlap,5,2,12,inf ; monad+uid_st_eval (do+ let n = 6+ base <- expRandM 60 4000+ rng <- randM 500 8000+ n0 <- replicateM 2 (brownNoiseM ar)+ r0 <- expRandM 0.125 0.5+ n1 <- lfNoise1M kr r0+ f <- sequence (replicate n (randM base (base + rng)))+ dt <- sequence (replicate n (randM 0.1 2))+ let exc = mce n0 * 0.007 * max 0 (n1 * 0.75 + 0.25)+ k = klankSpec f (replicate n 1) dt+ s = klank exc 1 0 1 k+ return (softClip (s * 0.1)))++-- wind metals (jmcc) ; texture=overlap,5,2,12,inf ; id+let n = 6+ base = expRandId 'α' 60 4000+ rng = randId 'β' 500 8000+ n0 = mce2 (brownNoiseId 'γ' ar) (brownNoiseId 'δ' ar)+ r0 = expRandId 'ε' 0.125 0.5+ n1 = lfNoise1Id 'ζ' kr r0+ f = X.randNId n 'η' base (base + rng)+ dt = X.randNId n 'θ' 0.1 2+ exc = n0 * 0.007 * max 0 (n1 * 0.75 + 0.25)+ k = klankSpec_mce f (mce (replicate n 1)) dt+ s = klank exc 1 0 1 k+in softClip (s * 0.1)++-- wind metals (jmcc) ; event-control+let f (c,g,x,y,z,_,_,_,_,_,_) =+ let n = 6+ base = linExp x 0 1 60 4000+ rng = tRand 500 8000 g+ n0 = mce2 (brownNoise ar) (brownNoise ar)+ r0 = tExpRand 0.125 0.5 g+ n1 = lfNoise1 kr r0+ fq = X.tRandN n base (base + rng) g+ dt = X.tRandN n 0.1 2 g+ exc = n0 * 0.01 * z * lagUD g y 2+ k = klankSpec_mce fq (mce (replicate n 1)) dt+ s = dynKlank exc 1 0 1 k+ in softClip (dynKlank exc 1 0 1 k)+in mix (voicer 16 f) * control kr "gain" 1++-- wind metals (jmcc) ; event-control ; id+let f (c,g,x,y,z,_,_,_,_,_,_) =+ let n = 6+ base = linExp x 0 1 60 4000+ rng = tRandId (c,'β') 500 8000 g+ n0 = mce2 (brownNoiseId (c,'γ') ar) (brownNoiseId (c,'δ') ar)+ r0 = tExpRandId 'ε' 0.125 0.5 g+ n1 = lfNoise1Id 'ζ' kr r0+ fq = X.tRandNId n 'η' base (base + rng) g+ dt = X.tRandNId n 'θ' 0.1 2 g+ exc = n0 * 0.01 * z * lagUD g y 2+ k = klankSpec_mce fq (mce (replicate n 1)) dt+ s = dynKlank exc 1 0 1 k+ in softClip (dynKlank exc 1 0 1 k)+in mix (voicer 16 f) * control kr "gain" 1
+ Help/Graph/jmcc-zizle.hs view
@@ -0,0 +1,39 @@+-- zizle (jmcc) #Sc3d1.5 ; texture=overlap,4,4,12,inf+let a f = let fm = mce2 (rand 0.7 1.3) 1+ ph = mce2 (rand 0 two_pi) (rand 0 two_pi)+ in mix (sinOsc ar (f * fm) ph * 0.1)+ a1 = max (a (expRand 0.3 8)) 0+ a2 = abs (a (expRand 6 24))+ o = sinOsc ar (midiCps (rand 24 108)) (rand 0 two_pi)+in pan2 (o * a1 * a2) (rand2 1) 1++-- zizle (jmcc) #Sc3d1.5 ; texture=overlap,4,4,12,inf ; id+let a z f = let fm = mce2 (randId (z,'α') 0.7 1.3) 1+ ph = mce2 (randId (z,'β') 0 two_pi) (randId (z,'γ') 0 two_pi)+ in mix (sinOsc ar (f * fm) ph * 0.1)+ a1 = max (a 'δ' (expRandId 'ε' 0.3 8)) 0+ a2 = abs (a 'ζ' (expRandId 'η' 6 24))+ o = sinOsc ar (midiCps (randId 'θ' 24 108)) (randId 'ι' 0 two_pi)+in pan2 (o * a1 * a2) (rand2Id 'κ' 1) 1++-- zizle (jmcc) #Sc3d1.5 ; event control+let f (_,g,x,y,z,o,_,_,_,_,_) =+ let a f0 = let fm = mce2 (tRand 0.7 1.3 g) 1+ ph = mce2 (tRand 0 two_pi g) (tRand 0 two_pi g)+ in mix (sinOsc ar (f0 * fm) ph)+ a1 = max (a (tExpRand 0.3 8 g)) 0+ a2 = abs (a (tExpRand 6 24 g))+ sig = sinOsc ar (midiCps (x * 84 + 24)) (tRand 0 two_pi g)+ in pan2 (sig * a1 * a2) (o * 2 - 1) (z * lagUD g (y * 0.01) (y * 2))+in mix (voicer 16 f) * control kr "gain" 1++-- zizle (jmcc) #Sc3d1.5 ; event control ; id+let f (c,g,x,y,z,o,_,_,_,_,_) =+ let a e f0 = let fm = mce2 (tRandId (e,'α') 0.7 1.3 g) 1+ ph = mce2 (tRandId (e,'β') 0 two_pi g) (tRandId (e,'γ') 0 two_pi g)+ in mix (sinOsc ar (f0 * fm) ph)+ a1 = max (a (c,'δ') (tExpRandId (c,'ε') 0.3 8 g)) 0+ a2 = abs (a (c,'ζ') (tExpRandId (c,'η') 6 24 g))+ sig = sinOsc ar (midiCps (x * 84 + 24)) (tRandId 'ι' 0 two_pi g)+ in pan2 (sig * a1 * a2) (o * 2 - 1) (z * lagUD g (y * 0.01) (y * 2))+in mix (voicer 16 f) * control kr "gain" 1
+ Help/Graph/jp-record-scratcher.hs view
@@ -0,0 +1,14 @@+-- record scratcher (jp) ; requires=buf+let (buf, nc) = (control kr "buf" 0, 2)+ dup a = mce2 a a+ d = Envelope [0, 1, 0] [0.1, 0.1] [EnvSin] (Just 1) (Just 0) 0+ e = envGen kr 1 0.5 0 1 RemoveSynth d+ x = mouseX kr (-10) 10 Linear 0.2+ dx = x - delayN x 0.1 0.1+ bdx = mouseButton kr 1 0 0.3 + dx+ bdxr = bdx * bufRateScale kr buf+ scr = playBuf nc ar buf bdxr 0 0 Loop DoNothing+in dup (scr * e)++---- ; buffer setup+withSc3 (async (b_allocRead 0 (sfResolve "pf-c5.aif") 0 0))
+ Help/Graph/ljp-one-line.hs view
@@ -0,0 +1,6 @@+-- one-line (ljp)+let lfs = lfSaw ar (mce2 1 0.99) (mce2 0 0.6) * 2000 + 2000+ lfs_t = trunc lfs (mce2 400 600) * mce2 1 (-1)+ f = onePole (mix lfs_t) 0.98+in pan2 (sinOsc ar f 0) 0 0.1+
+ Help/Graph/lkp-chaos-engine.hs view
@@ -0,0 +1,5 @@+-- http://sccode.org/1-5aJ -- chaos engine hum+let o1 = sinOsc kr 101 (saw kr 0.12345 * 678 + 9) * 0.2 + 0.8+ o2 = pulse kr (mce2 25 25.5) 0.25 * 0.125 - 0.25+ o3 = sinOsc kr (mce2 50 51) 0 * o1 + o2+in sinOsc ar (10 + 50 * o3) 0 * 0.5
+ Help/Graph/mn-k2ws.hs view
@@ -0,0 +1,21 @@+-- https://www.listarc.bham.ac.uk/lists/sc-users/msg21341.html (mn)+let fc = 400 + (lfNoise2 ar (mce2 1 2) `in_range` (100,200))+ fm = lfNoise0 ar 5 `in_range` (100,200)+ i = lfNoise1 ar 10 `in_range` (1,20)+ x = sinOsc ar (fc + (sinOsc ar fm 0 * i * fm)) 0 * 0.5+ rf = sinOsc ar (lfNoise1 ar 1 `in_range` (0.1,1)) 0 `in_range` (1000,2000)+ rq = lfNoise1 ar 1 `in_range` (0.5,10)+ a = rlpf x rf rq+ ph = a * (lfNoise1 ar 0.1 `in_range` (1.0,4.0)) * 4 * pi+in sinOsc ar 0.2 ph * 0.1++-- https://www.listarc.bham.ac.uk/lists/sc-users/msg21341.html (mn) ; id+let fc = 400 + (lfNoise2Id 'α' ar (mce2 1 2) `in_range` (100,200))+ fm = lfNoise0Id 'β' ar 5 `in_range` (100,200)+ i = lfNoise1Id 'γ' ar 10 `in_range` (1,20)+ x = sinOsc ar (fc + (sinOsc ar fm 0 * i * fm)) 0 * 0.5+ rf = sinOsc ar (lfNoise1Id 'δ' ar 1 `in_range` (0.1,1)) 0 `in_range` (1000,2000)+ rq = lfNoise1Id 'ε' ar 1 `in_range` (0.5,10)+ a = rlpf x rf rq+ ph = a * (lfNoise1Id 'ζ' ar 0.1 `in_range` (1.0,4.0)) * 4 * pi+in sinOsc ar 0.2 ph * 0.1
+ Help/Graph/mp-rm-octaver.hs view
@@ -0,0 +1,7 @@+-- rm-octaver (miller puckette) ; http://crca.ucsd.edu/~msp/techniques/latest/book-html/node77.html+let defaultPitch x = pitch x 440 60 4000 100 16 1 0.01 0.5 1 0+ rm_octaver i =+ let p = defaultPitch i+ [f,tr] = mceChannels p+ in lag3 tr 0.1 * sinOsc ar (f * 0.5) 0 * i + i+in rm_octaver (soundIn (control kr "in" 0))
+ Help/Graph/my-mouse.hs view
@@ -0,0 +1,6 @@+-- https://mohayonao.github.io/CoffeeCollider/#mouse.coffee (mohayonao) http://the.mohayonao.com/+let freq = mouseY kr 100 1000 Exponential 0.1+ freq1 = freq * mouseX kr 2 0.5 Linear 2.5+ freq2 = freq * mouseX kr 0.5 2 Linear 2.5+ feedback = mouseButton kr 0 pi 5+in sinOscFB ar (mce2 freq1 freq2) feedback * 0.1
+ Help/Graph/np-pebble-beach.hs view
@@ -0,0 +1,47 @@+-- pebble beach (np) ; http://sccode.org/1-u ; requires 'scsynth -u 57110 -m 32768'+let bg_f k =+ let sc = 0.4 + (k * 0.07)+ fr = range 3100 4900 (lag (lfNoise0 kr 21.8) 0.7) * sc+ am = range 0 1 (lag (lfNoise1 kr 5.227) 5.374)+ in bpf (pinkNoise ar * 0.4) fr 0.1 * am+ fg_f df tf _ =+ let d = dust ar (df * rand 0.8 1.2) * 50+ l = exprange 800 900 (sinOsc kr 2.2 0)+ r = exprange 2600 2900 (sinOsc kr 5.228 0)+ z = resonz d (tRand l r d) (tRand 0.03 0.08 d)+ t = lagUD (range 2 0.5 (saw kr tf)) 0.6 2.8+ o = z * t+ in o + combL o 0.8 (rand 0.2 0.8) (lchoose [-4,4])+ pebble_beach _ =+ let bg' = let am = range 0 1 (lag (lfNoise0 kr 34) 1.4)+ in brownNoise ar * 0.06 * am+ bg = bg' + mixFill 20 bg_f * 0.6+ tf = range 0.122 0.24 (sinOsc kr 0.17 0)+ df = exprange 1 700 (lfTri kr tf 0) * exprange 1 0.2 (lfTri kr tf 0)+ fg = mixFill 50 (fg_f df tf) * 0.2+ in (bg + fg) * line kr 0 1 1.2 DoNothing+in mce2 (pebble_beach ()) (pebble_beach ())++-- pebble beach (np) ; http://sccode.org/1-u ; requires 'scsynth -u 57110 -m 32768' ; id+let bg_f k =+ let sc = 0.4 + (k * 0.07)+ fr = range 3100 4900 (lag (lfNoise0Id 'α' kr 21.8) 0.7) * sc+ am = range 0 1 (lag (lfNoise1Id 'α' kr 5.227) 5.374)+ in bpf (pinkNoiseId 'α' ar * 0.4) fr 0.1 * am+ fg_f df tf =+ let d = dustId 'α' ar (df * randId 'α' 0.8 1.2) * 50+ l = exprange 800 900 (sinOsc kr 2.2 0)+ r = exprange 2600 2900 (sinOsc kr 5.228 0)+ z = resonz d (tRandId 'α' l r d) (tRandId 'α' 0.03 0.08 d)+ t = lagUD (range 2 0.5 (saw kr tf)) 0.6 2.8+ o = z * t+ in o + combL o 0.8 (randId 'α' 0.2 0.8) (lchooseId 'α' [-4,4])+ pebble_beach j =+ let bg' = let am = range 0 1 (lag (lfNoise0Id 'α' kr 34) 1.4)+ in brownNoiseId 'α' ar * 0.06 * am+ bg = bg' + sum (Protect.uprotect_seq (const False) j (map bg_f [0..19])) * 0.6+ tf = range 0.122 0.24 (sinOsc kr 0.17 0)+ df = exprange 1 700 (lfTri kr tf 0) * exprange 1 0.2 (lfTri kr tf 0)+ fg = mix (Protect.uclone_all j 50 (fg_f df tf)) * 0.2+ in (bg + fg) * line kr 0 1 1.2 DoNothing+in mce2 (pebble_beach 'α') (pebble_beach 'β')
+ Help/Graph/nv-ml-2014-06-03.hs view
@@ -0,0 +1,7 @@+-- sc-users, 2014-06-03 (nv) ; https://twitter.com/headcube/status/474064500564324352 (nv)+let y = mouseY kr 1 100 Linear 0.2+ x = mouseX kr 50 400 Exponential 0.2+ i = decay (impulse ar 0.5 0) 0.1+ i' = sin (bpf (i * y) 50 1)+ repl n = mce . replicate n+in repl 2 (pluck i' (lfSaw ar 10000 0) 0.1 (1 / x) 4 0.5)
+ Help/Graph/nv-tw-01.hs view
@@ -0,0 +1,15 @@+-- http://sccode.org/1-V (nv) L1+let a = mceFill 2 (\_ -> pinkNoise ar)+ nd i =+ let n = lfNoise1 kr (rand 0 0.05)+ f = linExp n (-1) 1 40 15000+ in bBandStop i f (expRand 0.1 2)+in lpf (iter 50 nd a) 100000++-- http://sccode.org/1-V (nv) L1 ; id+let a = mce2 (pinkNoiseId 'α' ar) (pinkNoiseId 'β' ar)+ nd z i =+ let n = lfNoise1Id (z,'γ') kr (randId (z,'δ') 0 0.05)+ f = linExp n (-1) 1 40 15000+ in bBandStop i f (expRandId (z,'ε') 0.1 2)+in lpf (useqId 'ζ' 50 nd a) 100000
+ Help/Graph/nv-tw-2013-01-11.hs view
@@ -0,0 +1,21 @@+-- https://twitter.com/headcube/status/289761321065541633 (nv)+let nc = 80+ i = inFeedback nc 20+ n = mceFill nc (\_ -> lfNoise1 kr 0.001 + 1) / constant nc+ j = combL (lpf i 2000) 1 n 0.05+ d = mceFill nc (\_ -> dust2 ar 0.01)+ x = sin (j + d)+in mceConcat [splay x 1 1 0 True+ ,mce (replicate 18 0)+ ,(x - mceRotate 1 x) / 2]++-- https://twitter.com/headcube/status/289761321065541633 (nv) ; id+let nc = 80+ i = inFeedback nc 20+ n = mceFillInt nc (\z -> lfNoise1Id z kr 0.001 + 1) / constant nc+ j = combL (lpf i 2000) 1 n 0.05+ d = mceFillInt nc (\z -> dust2Id z ar 0.01)+ x = sin (j + d)+in mceConcat [splay x 1 1 0 True+ ,mce (replicate 18 0)+ ,(x - mceRotate 1 x) / 2]
+ Help/Graph/nv-tw-2013-12-04.hs view
@@ -0,0 +1,10 @@+-- https://twitter.com/headcube/status/408145586970324992 (nv)+let mean l = sum l / fromIntegral (length l)+ f j =+ let i = j + 1+ a = saw ar ((1 / i + 1) / 6)+ p = pluck a a 1 (1 / i / (3 - lfPulse ar (1 / i) 0 0.5) / 30) 9 (0.9 / i)+ x = (0.5 ** i) * p+ o = sinOsc ar 2 0 + mce2 4 9+ in combC x 1 (o * 0.001) 0 - x+in mean (map f [0 .. 8]) / 9
+ Help/Graph/nv-tw-2014-02-21.hs view
@@ -0,0 +1,16 @@+-- nv ; https://twitter.com/headcube/status/437094206767513600+let x = impulse ar 0.05 0+ f i =+ let n = lfNoise2 kr+ a = allpassL (leakDC i 0.995) 4 ((8 ** n 0.1) / 2) 8 * 1.2+ in tanh (lpf a ((8 ** n (mce2 (rand 0 0.1) (rand 0 0.1))) * 2500))+in ugen_optimise_ir_rand (mixFill 4 (\_ -> iter 20 f x * 5))++-- nv ; https://twitter.com/headcube/status/437094206767513600 ; id+let x = impulse ar 0.05 0+ f i =+ let n e = lfNoise2Id e kr+ a = allpassL (leakDC i 0.995) 4 ((8 ** n 'α' 0.1) / 2) 8 * 1.2+ in tanh (lpf a ((8 ** n 'β' (mce2 (randId 'γ' 0 0.1) (randId 'δ' 0 0.1))) * 2500))+ y z = Protect.useq_all z 20 f x * 5+in ugen_optimise_ir_rand (mix (mceFillInt 4 y))
+ Help/Graph/nv-tw-40.hs view
@@ -0,0 +1,18 @@+-- http://sccode.org/1-V (nv) [Line 40]+let nd i =+ let t = (0.6 ** i) * 40 * impulse ar ((2 ** i) / 32) (1/2)+ f = (4 ** lfNoise0 kr (1/16)) * 300+ in sin (rlpf t f 5e-3)+ x = splay (mceFill 8 nd) 1 1 0 True+ r u = let (p,q) = mce2c u in freeVerb2 p q 0.1 1 1+in r (r x)++-- http://sccode.org/1-V (nv) [Line 40] ; id+let nd z =+ let i = constant z+ t = (0.6 ** i) * 40 * impulse ar ((2 ** i) / 32) (1/2)+ f = (4 ** lfNoise0Id z kr (1/16)) * 300+ in sin (rlpf t f 5e-3)+ x = splay (mce (map nd [0::Int .. 7])) 1 1 0 True+ r u = let (p,q) = mce2c u in freeVerb2 p q 0.1 1 1+in r (r x)
+ Help/Graph/nv-tw-41.hs view
@@ -0,0 +1,15 @@+-- https://swiki.hfbk-hamburg.de/MusicTechnology/899 (nv) [Line 41]+let n i =+ let f = 1.9 ** i / 128+ p = mceFill 2 (\_ -> pinkNoise ar)+ b = 4 ** lfNoise2 kr (1.2 ** i / 16)+ in bpf p (b * 300) 0.15 * (5 ** lfNoise2 ar f / (i + 8) * 20)+in splay (mixFill 15 n) 1 0.5 0 True++-- https://swiki.hfbk-hamburg.de/MusicTechnology/899 (nv) [Line 41] ; id+let n z i =+ let f = 1.9 ** i / 128+ p = mce2 (pinkNoiseId (z,'α') ar) (pinkNoiseId (z,'β') ar)+ b = 4 ** lfNoise2Id z kr (1.2 ** i / 16)+ in bpf p (b * 300) 0.15 * (5 ** lfNoise2Id z ar f / (i + 8) * 20)+in splay (mixFillId 'γ' 15 n) 1 0.5 0 True
+ Help/Graph/nv-tw-43.hs view
@@ -0,0 +1,8 @@+-- https://swiki.hfbk-hamburg.de/MusicTechnology/899 (nv) L43+let k = 2+ o = lfSaw ar (mce2 102 101) 0+ f i =+ let x = impulse ar 1 (i / 10) + impulse ar 0 0+ d = latch (((1.015 ** sweep ar 0 1 * 64) `modE` 1 + 1) * 200) x+ in pluck o x 1 (1 / d) 4 0.2+in mceMean (mceFill k f) * 0.25
+ Help/Graph/nv-tw-52.hs view
@@ -0,0 +1,24 @@+-- nv 52 https://swiki.hfbk-hamburg.de/MusicTechnology/899+let y = [[256,144],[128,72],[256,144],[128,162],[256,144],[128,450],[256,144],[128,648],[256,144],[216,72],[256,144],[216,162],[256,144],[216,450],[256,144],[216,648],[256,144],[320,72],[256,144],[320,162],[256,144],[320,450],[256,144],[320,648],[256,144],[432,72],[256,144],[432,162],[256,144],[432,450],[256,144],[432,648],[256,243],[128,72],[256,243],[128,162],[256,243],[128,450],[256,243],[128,648],[256,243],[216,72],[256,243],[216,162],[256,243],[216,450],[256,243],[216,648],[256,243],[320,72],[256,243],[320,162],[256,243],[320,450],[256,243],[320,648],[256,243],[432,72],[256,243],[432,162],[256,243],[432,450],[256,243],[432,648],[256,360],[128,72],[256,360],[128,162],[256,360],[128,450],[256,360],[128,648],[256,360],[216,72],[256,360],[216,162],[256,360],[216,450],[256,360],[216,648],[256,360],[320,72],[256,360],[320,162],[256,360],[320,450],[256,360],[320,648],[256,360],[432,72],[256,360],[432,162],[256,360],[432,450],[256,360],[432,648],[256,486],[128,72],[256,486],[128,162],[256,486],[128,450],[256,486],[128,648],[256,486],[216,72],[256,486],[216,162],[256,486],[216,450],[256,486],[216,648],[256,486],[320,72],[256,486],[320,162],[256,486],[320,450],[256,486],[320,648],[256,486],[432,72],[256,486],[432,162],[256,486],[432,450],[256,486],[432,648],[324,144],[128,72],[324,144],[128,162],[324,144],[128,450],[324,144],[128,648],[324,144],[216,72],[324,144],[216,162],[324,144],[216,450],[324,144],[216,648],[324,144],[320,72],[324,144],[320,162],[324,144],[320,450],[324,144],[320,648],[324,144],[432,72],[324,144],[432,162],[324,144],[432,450],[324,144],[432,648],[324,243],[128,72],[324,243],[128,162],[324,243],[128,450],[324,243],[128,648],[324,243],[216,72],[324,243],[216,162],[324,243],[216,450],[324,243],[216,648],[324,243],[320,72],[324,243],[320,162],[324,243],[320,450],[324,243],[320,648],[324,243],[432,72],[324,243],[432,162],[324,243],[432,450],[324,243],[432,648],[324,360],[128,72],[324,360],[128,162],[324,360],[128,450],[324,360],[128,648],[324,360],[216,72],[324,360],[216,162],[324,360],[216,450],[324,360],[216,648],[324,360],[320,72],[324,360],[320,162],[324,360],[320,450],[324,360],[320,648],[324,360],[432,72],[324,360],[432,162],[324,360],[432,450],[324,360],[432,648],[324,486],[128,72],[324,486],[128,162],[324,486],[128,450],[324,486],[128,648],[324,486],[216,72],[324,486],[216,162],[324,486],[216,450],[324,486],[216,648],[324,486],[320,72],[324,486],[320,162],[324,486],[320,450],[324,486],[320,648],[324,486],[432,72],[324,486],[432,162],[324,486],[432,450],[324,486],[432,648],[128,96],[160,96],[128,96],[160,216],[128,96],[160,600],[128,96],[160,864],[128,96],[270,96],[128,96],[270,216],[128,96],[270,600],[128,96],[270,864],[128,96],[400,96],[128,96],[400,216],[128,96],[400,600],[128,96],[400,864],[128,96],[540,96],[128,96],[540,216],[128,96],[540,600],[128,96],[540,864],[128,162],[160,96],[128,162],[160,216],[128,162],[160,600],[128,162],[160,864],[128,162],[270,96],[128,162],[270,216],[128,162],[270,600],[128,162],[270,864],[128,162],[400,96],[128,162],[400,216],[128,162],[400,600],[128,162],[400,864],[128,162],[540,96],[128,162],[540,216],[128,162],[540,600],[128,162],[540,864],[128,240],[160,96],[128,240],[160,216],[128,240],[160,600],[128,240],[160,864],[128,240],[270,96],[128,240],[270,216],[128,240],[270,600],[128,240],[270,864],[128,240],[400,96],[128,240],[400,216],[128,240],[400,600],[128,240],[400,864],[128,240],[540,96],[128,240],[540,216],[128,240],[540,600],[128,240],[540,864],[128,324],[160,96],[128,324],[160,216],[128,324],[160,600],[128,324],[160,864],[128,324],[270,96],[128,324],[270,216],[128,324],[270,600],[128,324],[270,864],[128,324],[400,96],[128,324],[400,216],[128,324],[400,600],[128,324],[400,864],[128,324],[540,96],[128,324],[540,216],[128,324],[540,600],[128,324],[540,864],[162,96],[160,96],[162,96],[160,216],[162,96],[160,600],[162,96],[160,864],[162,96],[270,96],[162,96],[270,216],[162,96],[270,600],[162,96],[270,864],[162,96],[400,96],[162,96],[400,216],[162,96],[400,600],[162,96],[400,864],[162,96],[540,96],[162,96],[540,216],[162,96],[540,600],[162,96],[540,864],[162,162],[160,96],[162,162],[160,216],[162,162],[160,600],[162,162],[160,864],[162,162],[270,96],[162,162],[270,216],[162,162],[270,600],[162,162],[270,864],[162,162],[400,96],[162,162],[400,216],[162,162],[400,600],[162,162],[400,864],[162,162],[540,96],[162,162],[540,216],[162,162],[540,600],[162,162],[540,864],[162,240],[160,96],[162,240],[160,216],[162,240],[160,600],[162,240],[160,864],[162,240],[270,96],[162,240],[270,216],[162,240],[270,600],[162,240],[270,864],[162,240],[400,96],[162,240],[400,216],[162,240],[400,600],[162,240],[400,864],[162,240],[540,96],[162,240],[540,216],[162,240],[540,600],[162,240],[540,864],[162,324],[160,96],[162,324],[160,216],[162,324],[160,600],[162,324],[160,864],[162,324],[270,96],[162,324],[270,216],[162,324],[270,600],[162,324],[270,864],[162,324],[400,96],[162,324],[400,216],[162,324],[400,600],[162,324],[400,864],[162,324],[540,96],[162,324],[540,216],[162,324],[540,600],[162,324],[540,864]]+ f = duty ar (1/5) 0 DoNothing (dseq 1 (mce (map mce y)))+ s = varSaw ar f 0 0.9 * lfPulse ar 5 0 0.5+in gVerb (mix s) 99 5 0.5 0.5 15.0 1.0 0.7 0.5 300.0 / 10++-- nv 52 https://swiki.hfbk-hamburg.de/MusicTechnology/899 ; id+let y = [[256,144],[128,72],[256,144],[128,162],[256,144],[128,450],[256,144],[128,648],[256,144],[216,72],[256,144],[216,162],[256,144],[216,450],[256,144],[216,648],[256,144],[320,72],[256,144],[320,162],[256,144],[320,450],[256,144],[320,648],[256,144],[432,72],[256,144],[432,162],[256,144],[432,450],[256,144],[432,648],[256,243],[128,72],[256,243],[128,162],[256,243],[128,450],[256,243],[128,648],[256,243],[216,72],[256,243],[216,162],[256,243],[216,450],[256,243],[216,648],[256,243],[320,72],[256,243],[320,162],[256,243],[320,450],[256,243],[320,648],[256,243],[432,72],[256,243],[432,162],[256,243],[432,450],[256,243],[432,648],[256,360],[128,72],[256,360],[128,162],[256,360],[128,450],[256,360],[128,648],[256,360],[216,72],[256,360],[216,162],[256,360],[216,450],[256,360],[216,648],[256,360],[320,72],[256,360],[320,162],[256,360],[320,450],[256,360],[320,648],[256,360],[432,72],[256,360],[432,162],[256,360],[432,450],[256,360],[432,648],[256,486],[128,72],[256,486],[128,162],[256,486],[128,450],[256,486],[128,648],[256,486],[216,72],[256,486],[216,162],[256,486],[216,450],[256,486],[216,648],[256,486],[320,72],[256,486],[320,162],[256,486],[320,450],[256,486],[320,648],[256,486],[432,72],[256,486],[432,162],[256,486],[432,450],[256,486],[432,648],[324,144],[128,72],[324,144],[128,162],[324,144],[128,450],[324,144],[128,648],[324,144],[216,72],[324,144],[216,162],[324,144],[216,450],[324,144],[216,648],[324,144],[320,72],[324,144],[320,162],[324,144],[320,450],[324,144],[320,648],[324,144],[432,72],[324,144],[432,162],[324,144],[432,450],[324,144],[432,648],[324,243],[128,72],[324,243],[128,162],[324,243],[128,450],[324,243],[128,648],[324,243],[216,72],[324,243],[216,162],[324,243],[216,450],[324,243],[216,648],[324,243],[320,72],[324,243],[320,162],[324,243],[320,450],[324,243],[320,648],[324,243],[432,72],[324,243],[432,162],[324,243],[432,450],[324,243],[432,648],[324,360],[128,72],[324,360],[128,162],[324,360],[128,450],[324,360],[128,648],[324,360],[216,72],[324,360],[216,162],[324,360],[216,450],[324,360],[216,648],[324,360],[320,72],[324,360],[320,162],[324,360],[320,450],[324,360],[320,648],[324,360],[432,72],[324,360],[432,162],[324,360],[432,450],[324,360],[432,648],[324,486],[128,72],[324,486],[128,162],[324,486],[128,450],[324,486],[128,648],[324,486],[216,72],[324,486],[216,162],[324,486],[216,450],[324,486],[216,648],[324,486],[320,72],[324,486],[320,162],[324,486],[320,450],[324,486],[320,648],[324,486],[432,72],[324,486],[432,162],[324,486],[432,450],[324,486],[432,648],[128,96],[160,96],[128,96],[160,216],[128,96],[160,600],[128,96],[160,864],[128,96],[270,96],[128,96],[270,216],[128,96],[270,600],[128,96],[270,864],[128,96],[400,96],[128,96],[400,216],[128,96],[400,600],[128,96],[400,864],[128,96],[540,96],[128,96],[540,216],[128,96],[540,600],[128,96],[540,864],[128,162],[160,96],[128,162],[160,216],[128,162],[160,600],[128,162],[160,864],[128,162],[270,96],[128,162],[270,216],[128,162],[270,600],[128,162],[270,864],[128,162],[400,96],[128,162],[400,216],[128,162],[400,600],[128,162],[400,864],[128,162],[540,96],[128,162],[540,216],[128,162],[540,600],[128,162],[540,864],[128,240],[160,96],[128,240],[160,216],[128,240],[160,600],[128,240],[160,864],[128,240],[270,96],[128,240],[270,216],[128,240],[270,600],[128,240],[270,864],[128,240],[400,96],[128,240],[400,216],[128,240],[400,600],[128,240],[400,864],[128,240],[540,96],[128,240],[540,216],[128,240],[540,600],[128,240],[540,864],[128,324],[160,96],[128,324],[160,216],[128,324],[160,600],[128,324],[160,864],[128,324],[270,96],[128,324],[270,216],[128,324],[270,600],[128,324],[270,864],[128,324],[400,96],[128,324],[400,216],[128,324],[400,600],[128,324],[400,864],[128,324],[540,96],[128,324],[540,216],[128,324],[540,600],[128,324],[540,864],[162,96],[160,96],[162,96],[160,216],[162,96],[160,600],[162,96],[160,864],[162,96],[270,96],[162,96],[270,216],[162,96],[270,600],[162,96],[270,864],[162,96],[400,96],[162,96],[400,216],[162,96],[400,600],[162,96],[400,864],[162,96],[540,96],[162,96],[540,216],[162,96],[540,600],[162,96],[540,864],[162,162],[160,96],[162,162],[160,216],[162,162],[160,600],[162,162],[160,864],[162,162],[270,96],[162,162],[270,216],[162,162],[270,600],[162,162],[270,864],[162,162],[400,96],[162,162],[400,216],[162,162],[400,600],[162,162],[400,864],[162,162],[540,96],[162,162],[540,216],[162,162],[540,600],[162,162],[540,864],[162,240],[160,96],[162,240],[160,216],[162,240],[160,600],[162,240],[160,864],[162,240],[270,96],[162,240],[270,216],[162,240],[270,600],[162,240],[270,864],[162,240],[400,96],[162,240],[400,216],[162,240],[400,600],[162,240],[400,864],[162,240],[540,96],[162,240],[540,216],[162,240],[540,600],[162,240],[540,864],[162,324],[160,96],[162,324],[160,216],[162,324],[160,600],[162,324],[160,864],[162,324],[270,96],[162,324],[270,216],[162,324],[270,600],[162,324],[270,864],[162,324],[400,96],[162,324],[400,216],[162,324],[400,600],[162,324],[400,864],[162,324],[540,96],[162,324],[540,216],[162,324],[540,600],[162,324],[540,864]]+ f = duty ar (1/5) 0 DoNothing (dseqId 'α' 1 (mce (map mce y)))+ s = varSaw ar f 0 0.9 * lfPulse ar 5 0 0.5+in gVerb (mix s) 99 5 0.5 0.5 15.0 1.0 0.7 0.5 300.0 / 10++---- ; calculation+import Data.List.Split {- split -}+import Sound.Sc3.Lang.Collection {- hsc3-lang -}+x = [[4, 4.5], [2, 3, 5, 6]]+mul_ext p q = take (max (length p) (length q)) (zipWith (*) (cycle p) (cycle q))+dot_x f p q = [f m n | m <- p, n <- q]+mul_dot_x = dot_x mul_ext+chunksOf 2 (map (* 4) (concat (mul_dot_x x (allTuples (mul_dot_x x x)))))++-- Local Variables:+-- truncate-lines:t+-- End:
+ Help/Graph/or-gong.hs view
@@ -0,0 +1,60 @@+-- or ; https://recarteblog.wordpress.com/2021/05/05/gongfm_sc+let ratio1 = rand 0.49 1.11 -- 0.9+ ratio2 = rand 0.17 0.55 -- 0.55+ ratio3 = rand 0.34 1.35 -- 1.03+ index2 = rand 1.33 2 -- 2+ index3 = rand 3.29 5.06 -- 4+ amp = 0.1+ dur = rand 3 9 -- 7+ pan = 0+ mnn = mce [67, 70, 74]+ g = 1+ mk_env l t = envGen kr g 1 0 1 RemoveSynth (envelope l t [])+ env3 = mk_env [0, 1, 1, 0] [0.4, 0.3, dur]+ env2 = mk_env [0, 1, 1, 0] [0, 0.3, dur]+ env1 = mk_env [0, 1, 1, 0] [0.003, 0.3, dur - 0.5]+ op3 = sinOsc ar (midiCps mnn * ratio3) 0 * midiCps mnn * ratio3 * index3 * env3+ op2 = sinOsc ar (midiCps mnn * ratio2 + op3) 0 * midiCps mnn * ratio2 * index2 * env2+ op1 = sinOsc ar (midiCps mnn * ratio1 + op2) 0+in splay (op1 * env1 * amp) 1 1 0 True++-- or ; https://recarteblog.wordpress.com/2021/05/05/gongfm_sc ; id+let ratio1 = randId 'α' 0.49 1.11 -- 0.9+ ratio2 = randId 'β' 0.17 0.55 -- 0.55+ ratio3 = randId 'γ' 0.34 1.35 -- 1.03+ index2 = randId 'δ' 1.33 2 -- 2+ index3 = randId 'ε' 3.29 5.06 -- 4+ amp = 0.1+ dur = randId 'ζ' 3 9 -- 7+ pan = 0+ mnn = mce [67, 70, 74]+ g = 1+ mk_env l t = envGen kr g 1 0 1 RemoveSynth (envelope l t [])+ env3 = mk_env [0, 1, 1, 0] [0.4, 0.3, dur]+ env2 = mk_env [0, 1, 1, 0] [0, 0.3, dur]+ env1 = mk_env [0, 1, 1, 0] [0.003, 0.3, dur - 0.5]+ op3 = sinOsc ar (midiCps mnn * ratio3) 0 * midiCps mnn * ratio3 * index3 * env3+ op2 = sinOsc ar (midiCps mnn * ratio2 + op3) 0 * midiCps mnn * ratio2 * index2 * env2+ op1 = sinOsc ar (midiCps mnn * ratio1 + op2) 0+in splay (op1 * env1 * amp) 1 1 0 True++-- or ; https://recarteblog.wordpress.com/2021/05/05/gongfm_sc ; event control+let f (_,g,x,y,z,o,rx,ry,_,_,_) =+ let ratio1 = x `in_range` (0.49,1.11)+ ratio2 = y `in_range` (0.15,0.55)+ ratio3 = o `in_range` (0.34,1.35)+ index2 = rx `in_range` (1.33,2)+ index3 = ry `in_range` (3.29,5.06)+ amp = latch z g+ dur = y * 6 + 3+ pan = 0+ mnn = mce [67, 70, 74] * (0.5 + x)+ mk_env l t = envGen kr g 1 0 1 DoNothing (envelope l t [])+ env3 = mk_env [0, 1, 1, 0] [0.4, 0.3, dur]+ env2 = mk_env [0, 1, 1, 0] [0, 0.3, dur]+ env1 = mk_env [0, 1, 1, 0] [0.003, 0.3, dur - 0.5]+ op3 = sinOsc ar (midiCps mnn * ratio3) 0 * midiCps mnn * ratio3 * index3 * env3+ op2 = sinOsc ar (midiCps mnn * ratio2 + op3) 0 * midiCps mnn * ratio2 * index2 * env2+ op1 = sinOsc ar (midiCps mnn * ratio1 + op2) 0+ in splay (op1 * env1 * amp) 1 1 0 True+in mix (voicer 16 f) * control kr "gain" 0.25
+ Help/Graph/pc-thx.hs view
@@ -0,0 +1,29 @@+-- http://ccrma-mail.stanford.edu/pipermail/stk/2007-January/000327.html (pc)+let t4 = 7.9365079365+ rvb i =+ let d = mce [0.0297, 0.0371, 0.0411, 0.0437]+ c = mix (combN i 0.05 d t4 * 0.25)+ f = (allpassN c 0.01 0.005 0.096835)+ in allpassN f 0.01 0.0017 0.032924+ mk_env z0 t0 z1 t1 t2 z2 t3 c =+ let z = [z0, z1, z1, z2, z2]+ t = [t0, t1, t2, t3]+ e = Envelope z t [c, c, c] Nothing Nothing 0+ in envGen kr 1 1 0 1 RemoveSynth e+ mk_saw f0 f1 l =+ let f = mk_env f0 t0 f0 t1 t2 f1 (t3 + t4 + t5 + t5) EnvLin+ g = mk_env 0 t0 0.1 (t1 + t2 + t3) t4 0.0 (t5 + t5) EnvLin+ s = saw ar f+ t0 = 0.035+ t1 = 0.2267573696+ t2 = 2.2675736061+ t3 = 6.8027210884+ t5 = 1.75+ in pan2 s l g+ sig =+ let n = 30+ l = mceChannels (X.randN n (-1) 1)+ f0 = mceChannels (X.randN n 200 800)+ f1 = take n (cycle [29, 87.5, 116, 175, 233, 350, 524, 880, 1048, 1760])+ in sum (zipWith3 mk_saw f0 f1 l)+in rvb sig
+ Help/Graph/pj-forest-sounds-m.hs view
@@ -0,0 +1,14 @@+-- sc-users, 2007-04-06 (pj) [paul jones]+let insects _ =+ let o = sinOsc kr (lfNoise2 kr 50 * 50 + 50) 0 * 100 + 2000+ in bpf (brownNoise ar) o 0.001 * 10+in mceFill 2 insects++-- sc-users, 2007-04-06 (pj) [paul jones] ; monad+uid_st_eval (do+ let insects_m = do+ n1 <- brownNoiseM ar+ n2 <- lfNoise2M kr 50+ let o = sinOsc kr (n2 * 50 + 50) 0 * 100 + 2000+ return (bpf n1 o 0.001 * 10)+ fmap mce (replicateM 2 insects_m))
+ Help/Graph/pmi.hs view
@@ -0,0 +1,12 @@+-- pmi ; texture=overlap,1,2,7,inf+let pm = line kr 0 (rand 0 12) (rand 1 12) DoNothing+in linPan2 (pmOsc ar (rand 0 2000) (rand 0 800) pm 0) (rand2 1) 0.05++-- pmi ; texture=overlap,1,2,7,inf ; id+let n = randId 'α' 1 12+ cf = randId 'β' 0 2000+ mf = randId 'γ' 0 800+ pme = randId 'δ' 0 12+ l = randId 'ε' (-1) 1+ pm = line kr 0 pme n DoNothing+in linPan2 (pmOsc ar cf mf pm 0) l 0.05
+ Help/Graph/rb-hh-808.hs view
@@ -0,0 +1,21 @@+-- hh-808 (rb) - http://www.create.ucsb.edu/pipermail/sc-users/2007-August/036131.html+let time = 250+ fr = [205.35,304.41,369.64,522.71,540.54,812.21]+ env i j k = Envelope i j k Nothing Nothing 0+ pulseEnv = let e = env [1.0,0.6] [time] [EnvNum (-0.5)]+ in envGen ar 1 1 0 (1/1000) DoNothing e+ s = mix (lfPulse ar (mce (map (* 4.09) fr)) 0 0.5)+ f = [\a -> ((a `equal_to` 6.0) * 0.6) ++ ((a `equal_to` 2.0) * 0.2) ++ ((a `equal_to` 1.0) * 0.9)+ ,\a -> (a * pulseEnv) + (mix (lfPulse ar (mce fr) 0 0.55)) * 0.9+ ,\a -> rlpf a 7000 0.6+ ,\a -> rhpf a 6800 1.5+ ,\a -> rhpf a 6800 1.5+ ,\a -> rhpf a 1200 1.5+ ,\a -> a + freeVerb a 0.33 0.5 0.5+ ,\a -> let c = map EnvNum [0,-0.5,0,-50]+ e = env [0,1,0.4,0,0] [2,time,50,500] c+ in a * envGen ar 1 1 0 (1/1000) RemoveSynth e+ ,\a -> mce [a,delayN a 0.005 0.005]]+in foldl1 (flip (.)) f s * 2
+ Help/Graph/rd-20060909.hs view
@@ -0,0 +1,38 @@+-- diffraction (rd, 2006-09-09)+let diffraction_p _ =+ let x = mouseX kr 0.001 0.02 Exponential 0.1+ y = mouseY kr 120 400 Exponential 0.1+ f = mce2 32 64 * lfNoise0 kr 4+ s = pulse ar f (x * lfNoise0 kr 32)+ in resonz s (y + 0.1 * lfNoise0 kr 2) (lfNoise0 kr 6 * 0.4 + 0.8) * 0.5+ diffraction_q = combN (diffraction_p ()) 0.2 (lfNoise0 kr 128 * 0.1 + 0.1) 3+ diffraction_r =+ let x = mouseX kr 0.75 1.25 Exponential 0.1+ y = mouseY kr 0.25 1 Exponential 0.1+ f _ = sinOsc ar (x * rand 50 59) 0 * y * rand 0.04 0.16+ in mce2 (mixFill 16 f) (mixFill 12 f)+in sum [diffraction_p (),diffraction_q,diffraction_r]++-- diffraction (rd, 2006-09-09) ; monad+uid_st_eval (do+ let diffraction_p = do+ let x = mouseX kr 0.001 0.02 Exponential 0.1+ y = mouseY kr 120 400 Exponential 0.1+ f <- fmap (* mce2 32 64) (lfNoise0M kr 4)+ w <- fmap (* x) (lfNoise0M kr 32)+ z <- fmap (* 0.1) (lfNoise0M kr 2)+ m <- lfNoise0M kr 6+ let s = pulse ar f w+ return (resonz s (y + z) (m * 0.4 + 0.8) * 0.5)+ diffraction_q = do+ n <- lfNoise0M kr 128+ s <- diffraction_p+ return (combN s 0.2 (n * 0.1 + 0.1) 3)+ diffraction_r =+ let x = mouseX kr 0.75 1.25 Exponential 0.1+ y = mouseY kr 0.25 1 Exponential 0.1+ f _ = do fr <- fmap (* x) (randM 50 59)+ am <- fmap (* y) (randM 0.04 0.16)+ return (sinOsc ar fr 0 * am)+ in liftM2 mce2 (mixFillM 16 f) (mixFillM 12 f)+ fmap sum (sequence [diffraction_p,diffraction_q,diffraction_r]))
+ Help/Graph/rd-20060910.hs view
@@ -0,0 +1,20 @@+-- rzblp-u (rd)+let lfn f l r = range l r (lfNoise0 kr f)+ hpb q =+ let g _ = let f = lfn q 1330 1395+ a = lfn q 0.001 0.007+ in blip ar f 24 * a+ in mixFill 2 g+ mk d =+ let q = lfn 5.2 5.2 5.21+ a = d dinf (mce [1,3,2,7,8])+ tr = impulse kr q 0+ freq = demand tr 0 a * 30 + 340+ in sum [blip ar freq 3 * lfn q 0.001 0.01+ ,resonz (impulse ar q (mce2 0 0))+ (lfn 5 30 640)+ (lfn q 0.1 0.5)+ * lfn q 0.01 1.8+ ,hpb q * lfn q 1.2 1.8+ ,blip ar (lfn q 16 36) 3 * mce2 0.03 0.09]+in mk drand + mk dxrand
+ Help/Graph/rd-20060911.hs view
@@ -0,0 +1,21 @@+-- cut-outs (rd, 2006-09-11)+let t = impulse ar 22 0 * (sinOsc kr 0.5 0 + 1)+ x = mouseX kr 0.005 0.12 Exponential 0.1+ y = mouseY kr 0.01 0.52 Exponential 0.1+ n _ = ringz (coinGate (0.05 + lfNoise0 kr 2 + y * 0.4 + t * 0.5) (t * 0.5)) (tExpRand (mce2 500 900) 1600 t) x+ s = mixFill 3 n+ b = tRand 0 1 (dust kr 8)+in mrg [clip2 s (in' 1 kr 0) * 0.25,out 0 b]++-- cut-outs (rd, 2006-09-11) ; monad+uid_st_eval (do+ let t = impulse ar 22 0 * (sinOsc kr 0.5 0 + 1)+ x = mouseX kr 0.005 0.12 Exponential 0.1+ y = mouseY kr 0.01 0.52 Exponential 0.1+ n = do n1 <- lfNoise0M kr 2+ n2 <- coinGateM (0.05 + n1 + y * 0.4 + t * 0.5) (t * 0.5)+ n3 <- tExpRandM (mce2 500 900) 1600 t+ return (ringz n2 n3 x)+ s <- fmap sum (sequence (replicate 3 n))+ b <- tRandM 0 1 =<< dustM kr 8+ return (mrg [clip2 s (in' 1 kr 0) * 0.25,out 0 b]))
+ Help/Graph/rd-20060914.hs view
@@ -0,0 +1,30 @@+-- chrd (rd, 2006-09-14)+let chrd _ =+ let m = mce [60, 65, 72, 77, 79, 84]+ d = mce (map (* 3) [5, 4, 5, 7, 4, 5])+ f = midiCps (xLine kr m (m + rand 0.05 0.5) d DoNothing)+ z = envTrapezoid 0 (rand 0.15 0.35) d (rand 0.005 0.01)+ e = envGen kr 1 1 0 1 DoNothing z+ p = xLine kr (rand2 1) (rand2 1) d DoNothing+ in mix (pan2 (fSinOsc ar f 0) p e)+in mixFill 9 chrd++-- chrd (rd, 2006-09-14) ; monad+uid_st_eval (do+ let chrd_m = do+ r0 <- randM 0.05 0.5+ r1 <- randM (-1) 1+ r2 <- randM (-1) 1+ r3 <- randM 0.15 0.35+ r4 <- randM 0.005 0.01+ let m = mce [60, 65, 72, 77, 79, 84]+ ds = 3+ d = mce (map (* ds) [5, 4, 5, 7, 4, 5])+ f = midiCps (xLine kr m (m + r0) d DoNothing)+ z = envTrapezoid 0 r3 d r4+ e = envGen kr 1 1 0 1 DoNothing z+ p = xLine kr r1 r2 d DoNothing+ o = fSinOsc ar f 0+ return (mix (pan2 o p e))+ chrd_9 <- replicateM 9 chrd_m+ return (sum chrd_9))
+ Help/Graph/rd-20060918.hs view
@@ -0,0 +1,45 @@+-- shifting pulses (rd, 2006-09-18)+let prt a f =+ let f' = f * linLin_b (sinOsc kr (rand 0.2 0.9) 0) 1 1.01 * rand 0.95 1.05+ in sinOsc ar (mce2 f f') 0 * a * mceFill 2 (\_ -> rand 0.95 1.05)+ prts n f a = sum (map (prt a) [f,f + f .. f * n])+ fmt = formant ar (mce2 20 21) (linLin_b (lfNoise2 kr 2) 10 100) 200 * 0.35+ pulses =+ let t = dust kr 0.75+ warp i = linLin i (-1) 1+ p = pulse ar (warp (mceFill 2 (\_ -> brownNoise kr)) 2 (mce2 11 15)) 0.01 * 0.1+ f = warp (mceFill 2 (\_ -> brownNoise kr)) 90 300+ rq = warp (mceFill 2 (\_ -> brownNoise kr)) 2 9+ in mrg2 (latch t t * rlpf p f rq) (sendTrig t 0 t)+in prts 2 900 0.008 + prts 9 40 0.022 + fmt + pulses++-- shifting pulses (rd, 2006-09-18) ; monad+uid_st_eval (do+ let prt a f = do+ r0 <- randM 0.2 0.9+ r1 <- randM 0.95 1.05+ r2 <- replicateM 2 (randM 0.95 1.05)+ let f' = f * linLin_b (sinOsc kr r0 0) 1 1.01 * r1+ a' = a * mce r2+ o = sinOsc ar (mce2 f f') 0+ return (o * a')+ let prts n f a = fmap sum (mapM (prt a) [f,f + f .. f * n])+ let fmt = do+ n <- lfNoise2M kr 2+ return (formant ar (mce2 20 21) (linLin_b n 10 100) 200 * 0.35)+ let pulses = do+ n0 <- replicateM 2 (brownNoiseM kr)+ n1 <- replicateM 2 (brownNoiseM kr)+ n2 <- replicateM 2 (brownNoiseM kr)+ t <- dustM kr 0.75+ let warp i = linLin i (-1) 1+ l = latch t t+ p = pulse ar (warp (mce n0) 2 (mce2 11 15)) 0.01 * 0.1+ f = warp (mce n1) 90 300+ rq = warp (mce n2) 2 9+ return (mrg2 (l * rlpf p f rq) (sendTrig t 0 t))+ p1 <- prts 2 900 0.008+ p2 <- prts 9 40 0.022+ f <- fmt+ s <- pulses+ return (p1 + p2 + f + s))
+ Help/Graph/rd-20060921.hs view
@@ -0,0 +1,37 @@+-- wial (rd, 2006-09-21)+let pls c d f = let t = pulseDivider c d 0+ e = decay2 t 0.05 0.75+ o = sinOsc ar (toggleFF t * f + f * 2) 0+ in o * e * tiRand 0 1 t * 0.5+ smpl f = [(4,6,f,0.0075)+ ,(2,6,f * 2,0.0175)+ ,(1,2,f * 16,0.025)+ ,(1,5,f * 64,0.005)+ ,(1,4,f * 128,0.035)+ ,(1,3,f * 256,0.15)+ ,(2,3,f * 512,0.35)]+ plss c (d0,d1,f,a) = pls c (mce2 d0 d1) f * a+ clk = impulse ar 16 0+ f = tWChoose (dust kr 2) (mce2 (20 * 0.66) 20) (mce2 0.25 0.75) 0+in sum (map (plss clk) (smpl f))++-- wial (rd, 2006-09-21) ; monad+let wial_m = do+ let pls c d f = do let t = pulseDivider c d 0+ e = decay2 t 0.05 0.75+ o = sinOsc ar (toggleFF t * f + f * 2) 0+ n0 <- tiRandM 0 1 t+ return (o * e * n0 * 0.5)+ smpl f = [(4,6,f,0.0075)+ ,(2,6,f * 2,0.0175)+ ,(1,2,f * 16,0.025)+ ,(1,5,f * 64,0.005)+ ,(1,4,f * 128,0.035)+ ,(1,3,f * 256,0.15)+ ,(2,3,f * 512,0.35)]+ plss c (d0,d1,f,a) = fmap (* a) (pls c (mce2 d0 d1) f)+ clk = impulse ar 16 0+ n0 <- dustM kr 2+ f <- tWChooseM n0 (mce2 (20 * 0.66) 20) (mce2 0.25 0.75) 0+ fmap sum (mapM (plss clk) (smpl f))+in uid_st_eval wial_m
+ Help/Graph/rd-20060925.hs view
@@ -0,0 +1,31 @@+-- mouse clatter (rd, 2006-09-25)+let x = mouseX kr 100 12000 Linear 0.1+ y = mouseY kr 0.01 0.15 Linear 0.1+ n1 = lfNoise0 kr (mce [3,3.25])+ t = impulse kr (n1 * 16 + 18) 0+ n2 = tRand 0.005 y t+ n3 = whiteNoise ar+ n4 = tRand 10 x t+ n5 = tRand 0 1 t+ n6 = tExpRand 0.15 1 t+ o = let e = decay2 t 0.01 n2+ in bpf (n3 * e) n4 n5+ c = X.pv_SplitAlloc (fftAlloc 2048 o 0.5 0 1 0)+ n7 = pv_RandComb c n6 t+in mix (o * 0.05 + ifft n7 0 0)++-- mouse clatter (rd, 2006-09-25) ; id+let x = mouseX kr 100 12000 Linear 0.1+ y = mouseY kr 0.01 0.15 Linear 0.1+ n1 = lfNoise0Id 'α' kr (mce [3,3.25])+ t = impulse kr (n1 * 16 + 18) 0+ n2 = tRandId 'β' 0.005 y t+ n3 = whiteNoiseId 'γ' ar+ n4 = tRandId 'δ' 10 x t+ n5 = tRandId 'ε' 0 1 t+ n6 = tExpRandId 'ζ' 0.15 1 t+ o = let e = decay2 t 0.01 n2+ in bpf (n3 * e) n4 n5+ c = X.pv_SplitAllocId 'η' (fftAllocId 'θ' 2048 o 0.5 0 1 0)+ n7 = pv_RandCombId 'ι' c n6 t+in mix (o * 0.05 + ifft n7 0 0)
+ Help/Graph/rd-20060928.hs view
@@ -0,0 +1,35 @@+-- f-lets (rd. 2006-09-28)+let f_let t g j n f =+ let pd = pulseDivider t j 0+ in formlet pd (f * tiRand (mce2 2 1) n pd) (tRand 0.01 0.04 pd) (tRand 0.05 0.10 pd) * g+ mk_n t =+ sum [f_let t 0.15 2 9 (mce2 200 400)+ ,f_let t 0.25 2 9 (mce2 (200 + tRand 0 1 t) (400 + tRand 0 1 t))+ ,f_let t 0.05 4 5 (mce2 25 50)+ ,f_let t 0.15 4 5 (mce2 (25 + tRand 0 1 t) (50 + tRand 0 1 t))+ ,f_let t 0.5 1 16 (mce2 300 600) * latch (coinGate 0.2 t) t]+in mk_n (impulse ar 24 0) * (lfNoise0 kr 2 * 0.25 + 0.25)++-- f-lets (rd. 2006-09-28) ; monad+uid_st_eval (do+ let f_let t g j n f = do+ let pd = pulseDivider t j 0+ r0 <- tiRandM (mce2 2 1) n pd+ r1 <- tRandM 0.01 0.04 pd+ r2 <- tRandM 0.05 0.10 pd+ return (formlet pd (f * r0) r1 r2 * g)+ mk_n t = do+ r0 <- tRandM 0 1 t+ r1 <- tRandM 0 1 t+ r2 <- tRandM 0 1 t+ r3 <- tRandM 0 1 t+ r4 <- coinGateM 0.2 t+ sequence [f_let t 0.15 2 9 (mce2 200 400)+ ,f_let t 0.25 2 9 (mce2 (200 + r0) (400 + r1))+ ,f_let t 0.05 4 5 (mce2 25 50)+ ,f_let t 0.15 4 5 (mce2 (25 + r2) (50 + r3))+ ,let lr = fmap (* latch r4 t)+ in lr (f_let t 0.5 1 16 (mce2 300 600))]+ tr = impulse ar 24 0+ n <- lfNoise0M kr 2+ return . (* (n * 0.25 + 0.25)) . sum =<< mk_n tr)
+ Help/Graph/rd-20061007.hs view
@@ -0,0 +1,23 @@+-- ccomb (rd, 2006-10-07)+let lwr = 48+ spart t _ = let n = range lwr 72.0 (lfNoise2 kr 0.1)+ e = decay2 t 0.01 (tRand 0.05 0.75 t)+ x = e * whiteNoise ar+ f = lag (midiCps n) 0.25+ in combC x (recip (midiCps lwr)) (recip f) (range 1 8 (lfNoise2 kr 0.1))+ t = dust kr (mce2 0.75 0.35)+in mixFill 12 (spart t) * 0.01++-- ccomb (rd, 2006-10-07) ; monad+uid_st_eval (do+ let lwr = 48+ flwr = midiCps lwr+ spart t = do n <- fmap (range lwr 72.0) (lfNoise2M kr 0.1)+ e <- fmap (decay2 t 0.01) (tRandM 0.05 0.75 t)+ x <- fmap (* e) (whiteNoiseM ar)+ m <- lfNoise2M kr 0.1+ let f = lag (midiCps n) 0.25+ m' = range 1 8 m+ return (combC x (recip flwr) (recip f) m')+ t <- dustM kr (mce2 0.75 0.35)+ return . (* 0.01) . sum =<< sequence (replicate 12 (spart t)))
+ Help/Graph/rd-20061008.hs view
@@ -0,0 +1,31 @@+-- s-chirp (rd, 2006-10-08)+let x = mouseX kr 15 0 Linear 0.1+ y = mouseY kr 15 27 Linear 0.1+ t = dust kr 9+ b = tChoose t (mce [36,48,60,72])+ n = lfNoise1 kr (mce2 3 3.05) * 0.04+ d = tiRand x y t+ e = decay2 t 0.005 (tRand 0.02 0.15 t)+ k = degreeToKey (asLocalBuf [0,2,3.2,5,7,9,10]) d 12+ f = midiCps (b + k + n)+ m = e * sinOsc ar f 0 * 0.2+ u = pulseDivider t 9 0+ r0 = tRand 0.0075 0.125 u+ r1 = tRand 0.05 0.15 u+in m * 0.5 + allpassC m 0.15 r0 r1++-- s-chirp (rd, 2006-10-08) ; id+let x = mouseX kr 15 0 Linear 0.1+ y = mouseY kr 15 27 Linear 0.1+ t = dustId 'α' kr 9+ b = tChooseId 'β' t (mce [36,48,60,72])+ n = lfNoise1Id 'γ' kr (mce2 3 3.05) * 0.04+ d = tiRandId 'δ' x y t+ e = decay2 t 0.005 (tRandId 'ε' 0.02 0.15 t)+ k = degreeToKey (asLocalBufId 'a' [0,2,3.2,5,7,9,10]) d 12+ f = midiCps (b + k + n)+ m = e * sinOsc ar f 0 * 0.2+ u = pulseDivider t 9 0+ r0 = tRandId 'ζ' 0.0075 0.125 u+ r1 = tRandId 'η' 0.05 0.15 u+in m * 0.5 + allpassC m 0.15 r0 r1
+ Help/Graph/rd-20061015.hs view
@@ -0,0 +1,33 @@+-- discretion (rd, 2006-10-15)+let mkls bp t = envGen kr 1 1 0 1 RemoveSynth (envCoord bp t 1 EnvLin)+ part _ = let t = 21+ f = mkls [(0,X.randN 2 50 55),(0.33,X.randN 2 50 65),(1,X.randN 2 50 55)] t+ a = mkls [(0,0),(0.33,X.randN 2 0.01 0.035),(1,0)] t+ in (saw ar f * a)+in mixFill 8 part++-- discretion (rd, 2006-10-15) ; id+let mkls bp t = envGen kr 1 1 0 1 RemoveSynth (envCoord bp t 1 EnvLin)+ part z _ = let f1 = X.randNId 2 (z,'α') 50 55+ f2 = X.randNId 2 (z,'β') 50 65+ f3 = X.randNId 2 (z,'γ') 50 55+ a = X.randNId 2 (z,'δ') 0.01 0.035+ t = 21+ f_ = mkls [(0,f1),(0.33,f2),(1,f3)] t+ a_ = mkls [(0,0),(0.33,a),(1,0)] t+ in (saw ar f_ * a_)+in mixFillId 'ε' 8 part++-- discretion (rd, 2006-10-15) ; monad+uid_st_eval (do+ let clone n = fmap mce . replicateM n+ mkls bp t = envGen kr 1 1 0 1 RemoveSynth (envCoord bp t 1 EnvLin)+ part = do f1 <- clone 2 (randM 50 55)+ f2 <- clone 2 (randM 50 65)+ f3 <- clone 2 (randM 50 55)+ a <- clone 2 (randM 0.01 0.035)+ let t = 21+ f_ = mkls [(0,f1),(0.33,f2),(1,f3)] t+ a_ = mkls [(0,0),(0.33,a),(1,0)] t+ return (saw ar f_ * a_)+ fmap mix (clone 8 part))
+ Help/Graph/rd-20061017.hs view
@@ -0,0 +1,328 @@+-- crotale (rd, 2006-10-17) ; id+let crotale_data =+ ([35.45+ ,128.59+ ,346.97+ ,483.55+ ,1049.24+ ,1564.02+ ,1756.33+ ,3391.66+ ,3451.80+ ,3497.26+ ,3596.89+ ,3696.73+ ,3835.23+ ,3845.95+ ,4254.85+ ,4407.53+ ,4415.26+ ,4552.86+ ,5538.07+ ,5637.73+ ,5690.29+ ,5728.00+ ,5764.27+ ,5824.41+ ,6377.60+ ,6544.35+ ,6807.14+ ,6994.97+ ,7026.84+ ,7144.58+ ,7269.61+ ,7393.67+ ,7897.25+ ,8040.45+ ,8157.77+ ,8225.01+ ,9126.15+ ,9488.52+ ,9916.40+ ,10155.59+ ,11715.95+ ,12111.83+ ,12339.99+ ,12417.66+ ,12459.28+ ,12618.33+ ,13116.49+ ,13201.12+ ,13297.83+ ,13533.75]+ ,[0.001282+ ,0.000804+ ,0.017361+ ,0.004835+ ,0.004413+ ,0.004110+ ,0.000333+ ,0.003614+ ,0.006919+ ,0.000322+ ,0.000603+ ,0.066864+ ,0.000605+ ,0.003602+ ,0.000283+ ,0.015243+ ,0.020536+ ,0.016677+ ,0.000924+ ,0.202050+ ,0.001254+ ,0.012705+ ,0.000252+ ,0.000486+ ,0.000642+ ,0.000776+ ,0.208116+ ,0.002491+ ,0.001934+ ,0.005231+ ,0.006924+ ,0.001203+ ,0.205002+ ,0.040604+ ,0.003834+ ,0.002189+ ,0.180560+ ,0.002192+ ,0.006516+ ,0.009982+ ,0.004745+ ,0.046154+ ,0.000510+ ,0.001890+ ,0.001978+ ,0.006729+ ,0.002342+ ,0.002400+ ,0.035155+ ,0.001408]+ ,[5.203680+ ,1.703434+ ,40.165168+ ,27.282501+ ,0.895052+ ,42.847427+ ,2.660366+ ,15.767886+ ,6.848367+ ,3.232500+ ,1.734338+ ,2.020241+ ,4.727905+ ,9.400103+ ,0.710251+ ,37.494625+ ,36.248794+ ,29.172658+ ,3.891019+ ,4.757885+ ,3.851426+ ,20.907810+ ,3.732874+ ,2.383410+ ,10.443285+ ,8.795611+ ,20.985643+ ,18.011800+ ,25.297883+ ,14.819819+ ,42.391899+ ,2.948513+ ,11.043763+ ,49.551651+ ,29.882694+ ,10.527188+ ,23.557245+ ,26.555616+ ,45.099605+ ,22.550390+ ,36.461261+ ,11.826201+ ,16.818185+ ,14.903121+ ,32.811138+ ,43.138904+ ,12.289558+ ,11.498942+ ,10.465788+ ,24.931695])+ (cf,ca,cd) = crotale_data+ ps = mce [-12,-5,0,2,4,5,7,12]+ t = dust kr 3+ fs = select (tiRand 0 7 t) ps+ s = decay2 t 0.06 0.01 * pinkNoise ar * tRand 0 1 t+ ks = klankSpec_k cf ca (map recip cd)+ k = dynKlank s (midiRatio fs) (tRand 0 1 t) (tRand 2 7 t) ks+in pan2 k (tRand (-1) 1 t) 1++-- crotale (rd, 2006-10-17) ; id+let crotale_data =+ ([35.45+ ,128.59+ ,346.97+ ,483.55+ ,1049.24+ ,1564.02+ ,1756.33+ ,3391.66+ ,3451.80+ ,3497.26+ ,3596.89+ ,3696.73+ ,3835.23+ ,3845.95+ ,4254.85+ ,4407.53+ ,4415.26+ ,4552.86+ ,5538.07+ ,5637.73+ ,5690.29+ ,5728.00+ ,5764.27+ ,5824.41+ ,6377.60+ ,6544.35+ ,6807.14+ ,6994.97+ ,7026.84+ ,7144.58+ ,7269.61+ ,7393.67+ ,7897.25+ ,8040.45+ ,8157.77+ ,8225.01+ ,9126.15+ ,9488.52+ ,9916.40+ ,10155.59+ ,11715.95+ ,12111.83+ ,12339.99+ ,12417.66+ ,12459.28+ ,12618.33+ ,13116.49+ ,13201.12+ ,13297.83+ ,13533.75]+ ,[0.001282+ ,0.000804+ ,0.017361+ ,0.004835+ ,0.004413+ ,0.004110+ ,0.000333+ ,0.003614+ ,0.006919+ ,0.000322+ ,0.000603+ ,0.066864+ ,0.000605+ ,0.003602+ ,0.000283+ ,0.015243+ ,0.020536+ ,0.016677+ ,0.000924+ ,0.202050+ ,0.001254+ ,0.012705+ ,0.000252+ ,0.000486+ ,0.000642+ ,0.000776+ ,0.208116+ ,0.002491+ ,0.001934+ ,0.005231+ ,0.006924+ ,0.001203+ ,0.205002+ ,0.040604+ ,0.003834+ ,0.002189+ ,0.180560+ ,0.002192+ ,0.006516+ ,0.009982+ ,0.004745+ ,0.046154+ ,0.000510+ ,0.001890+ ,0.001978+ ,0.006729+ ,0.002342+ ,0.002400+ ,0.035155+ ,0.001408]+ ,[5.203680+ ,1.703434+ ,40.165168+ ,27.282501+ ,0.895052+ ,42.847427+ ,2.660366+ ,15.767886+ ,6.848367+ ,3.232500+ ,1.734338+ ,2.020241+ ,4.727905+ ,9.400103+ ,0.710251+ ,37.494625+ ,36.248794+ ,29.172658+ ,3.891019+ ,4.757885+ ,3.851426+ ,20.907810+ ,3.732874+ ,2.383410+ ,10.443285+ ,8.795611+ ,20.985643+ ,18.011800+ ,25.297883+ ,14.819819+ ,42.391899+ ,2.948513+ ,11.043763+ ,49.551651+ ,29.882694+ ,10.527188+ ,23.557245+ ,26.555616+ ,45.099605+ ,22.550390+ ,36.461261+ ,11.826201+ ,16.818185+ ,14.903121+ ,32.811138+ ,43.138904+ ,12.289558+ ,11.498942+ ,10.465788+ ,24.931695])+ (cf,ca,cd) = crotale_data+ ps = mce [-12,-5,0,2,4,5,7,12]+ n = pinkNoiseId 'α' ar+ t = dustId 'β' kr 3+ fs = select (tiRandId 'γ' 0 7 t) ps+ g = tRandId 'δ' 0 1 t+ fo = tRandId 'ε' 0 1 t+ ds = tRandId 'ζ' 2 7 t+ p = tRandId 'η' (-1) 1 t+ s = decay2 t 0.06 0.01 * n * g+ ks = klankSpec_k cf ca (map recip cd)+ k = dynKlank s (midiRatio fs) fo ds ks+in pan2 k p 1++
+ Help/Graph/rd-20061022.hs view
@@ -0,0 +1,27 @@+-- seqr (rd)+let nrand n l = mceChannels . X.randN n l+ nfreq n l r = map (midiCps . floorE) (nrand n l r)+ seqr_f f e =+ let n = constant (length e `div` 2)+ in select (lfSaw kr f 0 * n + n) (mce e)+ seqr n =+ let f = rand 9 18 / constant n+ fr = mce2 (seqr_f f (nfreq n 72 96)) (seqr_f f (nfreq n 72 84))+ nh = mce2 (seqr_f f (nrand n 1 3)) (seqr_f f (nrand n 3 6))+ in blip ar fr nh * mce2 (seqr_f f (nrand n 0.05 0.10)) (seqr_f f (nrand n 0.05 0.15))+in seqr 12++-- seqr (rd) ; id+let nrand n e l = mceChannels . X.randNId n e l+ nfreq z n l r = map (midiCps . floorE) (nrand n z l r)+ seqr_f f e =+ let n = constant (length e `div` 2)+ in select (lfSaw kr f 0 * n + n) (mce e)+ seqr n =+ let f = randId 'α' 9 18 / constant n+ fr = mce2 (seqr_f f (nfreq 'β' n 72 96)) (seqr_f f (nfreq 'γ' n 72 84))+ nh = mce2 (seqr_f f (nrand n 'δ' 1 3)) (seqr_f f (nrand n 'ε' 3 6))+ b = blip ar fr nh+ a = mce2 (seqr_f f (nrand n 'ζ' 0.05 0.10)) (seqr_f f (nrand n 'η' 0.05 0.15))+ in b * a+in seqr 12
+ Help/Graph/rd-20061028.hs view
@@ -0,0 +1,25 @@+-- xy-interference (rd, 2006-10-28)+let x = mouseX kr 20 22000 Linear (mce2 0.005 0.025)+ y = mouseY kr 20 22000 Linear (mce2 0.005 0.075)+ nd _ = sinOsc ar (x + lfNoise0 kr (mce2 5 9)) 0 * sinOsc ar y 0+in mixFill 3 nd * 0.5++-- xy-interference (rd, 2006-10-28) ; monad+let xy_interference_m = do+ let x = mouseX kr 20 22000 Linear (mce2 0.005 0.025)+ y = mouseY kr 20 22000 Linear (mce2 0.005 0.075)+ nd = do n <- lfNoise0M kr (mce2 5 9)+ let a = sinOsc ar (x + n) 0+ b = sinOsc ar y 0+ return (a * b)+ fmap sum_opt (sequence (replicate 3 nd))+in uid_st_eval xy_interference_m * 0.5++-- xy-interference (rd, 2006-10-28) ; id+let x = mouseX kr 20 22000 Linear (mce2 0.005 0.025)+ y = mouseY kr 20 22000 Linear (mce2 0.005 0.075)+ nd z _ = let n = lfNoise0Id (z,'α') kr (mce2 5 9)+ a = sinOsc ar (x + n) 0+ b = sinOsc ar y 0+ in a * b+in mixFillId 'β' 3 nd
+ Help/Graph/rd-20061030.hs view
@@ -0,0 +1,33 @@+-- three-cpsw (rd, 2006-10-30)+let t = dust kr (mce2 12 18)+ f0 = tRand 1 64 t+ f1 = lfNoise0 kr f0+ a = tRand 0.0 0.5 t+ dt = tRand 0.975 1.025 t+ dh = tRand 0.750 0.7505 t+ f = f1 * mce2 9000 12000 + 9500+ o = saw ar f + saw ar (f * dh) + saw ar (f * dt)+in clip2 (o * a) 0.75 * 0.15++-- three-cpsw (rd, 2006-10-30) ; id+let t = dustId 'α' kr (mce2 12 18)+ f0 = tRandId 'β' 1 64 t+ f1 = lfNoise0Id 'γ' kr f0+ a = tRandId 'δ' 0.0 0.5 t+ dt = tRandId 'ε' 0.975 1.025 t+ dh = tRandId 'ζ' 0.750 0.7505 t+ f = f1 * mce2 9000 12000 + 9500+ o = saw ar f + saw ar (f * dh) + saw ar (f * dt)+in clip2 (o * a) 0.75 * 0.15++-- three-cpsw (rd, 2006-10-30) ; monad+uid_st_eval (do+ t <- dustM kr (mce2 12 18)+ f0 <- tRandM 1 64 t+ f1 <- lfNoise0M kr f0+ a <- tRandM 0.0 0.5 t+ dt <- tRandM 0.975 1.025 t+ dh <- tRandM 0.750 0.7505 t+ let f = f1 * mce2 9000 12000 + 9500+ o = saw ar f + saw ar (f * dh) + saw ar (f * dt)+ return (clip2 (o * a) 0.75 * 0.15))
+ Help/Graph/rd-20070423.hs view
@@ -0,0 +1,39 @@+-- eggcrate (rd, 2007-04-23)+let cosu = cos . (* pi)+ sinu = sin . (* pi)+ eggcrate_f u v = cosu u * sinu v+ p = mce [64,72,96,128,256,6400,7200,8400,9600]+ dup f = (f (),f ())+ (x,y) = dup (\_ -> brownNoise kr)+ t = dust kr 2.4+ (f0,f1) = dup (\_ -> tChoose t p)+ f = linLin_b (eggcrate_f x y) f0 f1+ a = linLin_b x 0 0.1+in pan2 (mix (sinOsc ar f 0)) y a++-- eggcrate (rd, 2007-04-23) ; id+let cosu = cos . (* pi)+ sinu = sin . (* pi)+ eggcrate_f u v = cosu u * sinu v+ p = mce [64,72,96,128,256,6400,7200,8400,9600]+ bimap f (i,j) = (f i,f j)+ (x,y) = bimap (`brownNoiseId` kr) ('α','β')+ t = dustId 'γ' kr 2.4+ (f0,f1) = bimap (\z -> tChooseId z t p) ('δ','ε')+ f = linLin_b (eggcrate_f x y) f0 f1+ a = linLin_b x 0 0.1+in pan2 (mix (sinOsc ar f 0)) y a++-- eggcrate (rd, 2007-04-23) ; monad+uid_st_eval (do+ let cosu = cos . (* pi)+ sinu = sin . (* pi)+ eggcrate_f u v = cosu u * sinu v+ p = mce [64,72,96,128,256,6400,7200,8400,9600]+ clone2 x = x >>= \y1 -> x >>= \y2 -> return (y1,y2)+ (x,y) <- clone2 (brownNoiseM kr)+ t <- dustM kr 2.4+ (f0,f1) <- clone2 (tChooseM t p)+ let f = linLin_b (eggcrate_f x y) f0 f1+ a = linLin_b x 0 0.1+ return (pan2 (mix (sinOsc ar f 0)) y a))
+ Help/Graph/rd-lg-timed.hs view
@@ -0,0 +1,29 @@+-- lg-timed (rd)+let timed r y p =+ let t = tDuty ar (dcons 0 (dser r p)) 0 RemoveSynth (dser r y) 1+ in latch t t+ lg u = lag u 0.03+ n = mce [52,76,66,67,68,69]+ a = mce [0.35,0.15,0.04,0.05,0.16,0.07]+ d = mce [0.1,0.5,0.09,0.08,0.07,0.3]+ x = mouseX kr 0.5 1.25 Linear 0.2+ tn = lg (timed dinf n (d * x))+ ta = lg (timed dinf a (d * x))+in sinOsc ar (midiCps tn) 0 * ta++-- lg-timed (rd) ; monad+uid_st_eval (do+ let timed r y p =+ do d0 <- dserM r p+ d1 <- dconsM 0 d0+ d2 <- dserM r y+ let t = tDuty ar d1 0 RemoveSynth d2 1+ return (latch t t)+ lg u = return (lag u 0.03)+ n = mce [52,76,66,67,68,69]+ a = mce [0.35,0.15,0.04,0.05,0.16,0.07]+ d = mce [0.1,0.5,0.09,0.08,0.07,0.3]+ x = mouseX kr 0.5 1.25 Linear 0.2+ tn <- lg =<< timed dinf n (d * x)+ ta <- lg =<< timed dinf a (d * x)+ return (sinOsc ar (midiCps tn) 0 * ta))
+ Help/Graph/rd-tgrn.hs view
@@ -0,0 +1,24 @@+-- tgrn (rd)+let b = control kr "buf" 0+ trate = mouseY kr 2 120 Exponential 0.1+ dur = 1.2 / trate+ clk = impulse ar trate 0+ pos = mouseX kr 0 (bufDur kr b) Linear 0.1+ pan = whiteNoise kr * 0.6+ n = roundTo (whiteNoise kr * 3) 1+ rate = shiftLeft 1.2 n+in tGrains 2 clk b rate pos dur pan 0.5 2++-- tgrn (rd) ; id+let b = control kr "buf" 0+ trate = mouseY kr 2 120 Exponential 0.1+ dur = 1.2 / trate+ clk = impulse ar trate 0+ pos = mouseX kr 0 (bufDur kr b) Linear 0.1+ pan = whiteNoiseId 'α' kr * 0.6+ n = roundTo (whiteNoiseId 'β' kr * 3) 1+ rate = shiftLeft 1.2 n+in tGrains 2 clk b rate pos dur pan 0.5 2++---- ; load sndfile+withSc3 (async (b_allocRead 0 "/home/rohan/sw/hsc3-graphs/snd/2006-10-05.snd" 0 0))
+ Help/Graph/rd-trmlo.hs view
@@ -0,0 +1,73 @@+-- trmlo-u (rd)+let mWrp i l r = linLin_b i (midiCps l) (midiCps r)+ mWrp1 i m = mWrp i m (m + 1)+ mWrpN i m n = mWrp i m (m + n)+ o1 = let f = 5+ d = 3+ s = envSine d 0.1+ e = envGen kr 1 1 0 1 DoNothing s+ n = 65+ m = sinOsc kr f 0+ in pan2 (sinOsc ar (mWrp1 m n) 0) m e+ o2 = let f = iRand 5 9+ d = iRand 5 9+ s = envSine d (rand 0.1 0.2)+ e = envGen kr 1 1 0 1 DoNothing s+ n = iRand 69 72+ m = sinOsc kr f 0+ in pan2 (sinOsc ar (mWrp1 m n) 0) m e+ o3 = let f = iRand 5 9+ d = iRand 9 12+ s = envSine d (rand 0.1 0.2)+ e = envGen kr 1 1 0 1 DoNothing s+ n = iRand 69 72+ m = sinOsc kr f 0+ l = line kr 0 (iRand 1 5) d DoNothing+ in pan2 (blip ar (mWrp1 m (n + l)) (linLin_b m 1 2)) m e+ o4 = let f = iRand 5 18+ d = iRand 12 15+ s = envSine d (rand 0.1 0.2)+ e = envGen kr 1 5e-2 0 1 DoNothing s+ n = iRand 69 72+ m = sinOsc kr f 0+ l = line kr 0 (iRand 1 5) d RemoveSynth+ fr = mWrpN m (n + l) (iRand 1 5)+ in pan2 (blip ar fr (linLin_b m 1 (iRand 2 24))) m e+in o1 + o2 + o3 + o4++-- trmlo ; id+let mWrp i l r = linLin_b i (midiCps l) (midiCps r)+ mWrp1 i m = mWrp i m (m + 1)+ mWrpN i m n = mWrp i m (m + n)+ o1 = let f = 5+ d = 3+ s = envSine d 0.1+ e = envGen kr 1 1 0 1 DoNothing s+ n = 65+ m = sinOsc kr f 0+ in pan2 (sinOsc ar (mWrp1 m n) 0) m e+ o2 = let f = iRandId 'α' 5 9+ d = iRandId 'β' 5 9+ s = envSine d (randId 'γ' 0.1 0.2)+ e = envGen kr 1 1 0 1 DoNothing s+ n = iRandId 'δ' 69 72+ m = sinOsc kr f 0+ in pan2 (sinOsc ar (mWrp1 m n) 0) m e+ o3 = let f = iRandId 'ε' 5 9+ d = iRandId 'ζ' 9 12+ s = envSine d (randId 'η' 0.1 0.2)+ e = envGen kr 1 1 0 1 DoNothing s+ n = iRandId 'θ' 69 72+ m = sinOsc kr f 0+ l = line kr 0 (iRandId 'ι' 1 5) d DoNothing+ in pan2 (blip ar (mWrp1 m (n + l)) (linLin_b m 1 2)) m e+ o4 = let f = iRandId 'κ' 5 18+ d = iRandId 'λ' 12 15+ s = envSine d (randId 'μ' 0.1 0.2)+ e = envGen kr 1 5e-2 0 1 DoNothing s+ n = iRandId 'ν' 69 72+ m = sinOsc kr f 0+ l = line kr 0 (iRandId 'ξ' 1 5) d RemoveSynth+ fr = mWrpN m (n + l) (iRandId 'ο' 1 5)+ in pan2 (blip ar fr (linLin_b m 1 (iRandId 'π' 2 24))) m e+in o1 + o2 + o3 + o4
+ Help/Graph/sc-bottle-m.hs view
@@ -0,0 +1,33 @@+-- bottle (sc) ; texture=overlap,2,0,4,inf ; id+let freq = rand 220 880+ perc = envPerc 0.1 0.6+ ex = envGen kr 1 1 0 1 DoNothing perc * whiteNoise ar * 0.02+ flute = ringz ex freq 0.3+ r = resonz (pinkNoise ar) (5 + (freq / 2)) 0.1+ breath = envGen kr 1 1 0 1 DoNothing perc * r+ rapf i = i + allpassN i 0.1 (linRand 0.001 0.1 (-1)) 1.0 * 0.5+ cls i = let en = let c = EnvNum (-4) in (c,c,c)+ l = envLinen_c 0.01 3.0 1.0 1 en+ z = (breath + i) * envGen kr 1 1 0 1 RemoveSynth l+ in mce2 z z+in cls (iter 2 rapf flute)++-- bottle (sc) ; texture=overlap,2,0,4,inf+let bottle_m = do+ freq <- randM 220 880+ wn <- whiteNoiseM ar+ pn <- pinkNoiseM ar+ let perc = envPerc 0.1 0.6+ ex = envGen kr 1 1 0 1 DoNothing perc * wn * 0.02+ flute = ringz ex freq 0.3+ r = resonz pn (5 + (freq / 2)) 0.1+ breath = envGen kr 1 1 0 1 DoNothing perc * r+ rapf i = do x <- linRandM 0.001 0.1 (-1)+ return (i + allpassN i 0.1 x 1.0 * 0.5)+ cls i = let en = let c = EnvNum (-4) in (c,c,c)+ l = envLinen_c 0.01 3.0 1.0 1 en+ z = (breath + i) * envGen kr 1 1 0 1 RemoveSynth l+ in mce2 z z+ f <- chainM 2 rapf flute+ return (cls f)+in uid_st_eval bottle_m
+ Help/Graph/sp-insects-m.hs view
@@ -0,0 +1,19 @@+-- insects (sp)+let insect _ =+ let a = sinOsc kr (rand 1 10) 0 * 0.5 + 0.5+ o = sinOsc ar (rand 2000 3000 + lfNoise2 kr (rand 0.05 0.1 * 50 + 50)) (rand 0.05 0.1) * 0.005 * a+ in pan2 o (lfNoise2 kr (rand 0.05 0.1)) 1+in mixFill 60 insect++-- insects (sp) ; monad+let insect_m = do+ r1 <- randM 2000 3000+ r2 <- randM 0.05 0.1+ n1 <- lfNoise2M kr (r2 * 50 + 50)+ r4 <- randM 1 10+ r5 <- randM 0.05 0.1+ n2 <- lfNoise2M kr r5+ let a = sinOsc kr r4 0 * 0.5 + 0.5+ o = sinOsc ar (r1 + n1) r2 * 0.005 * a+ return (pan2 o n2 1)+in uid_st_eval (fmap sum (replicateM 60 insect_m))
+ Help/Graph/tb-1-4Tw.hs view
@@ -0,0 +1,6 @@+-- http://sccode.org/1-4Tw (tb)+let im = mix (impulse ar (mce3 1 (1/3) (1/5)) (mce3 0 0.133 0.5))+ f i = tDuty ar (max 0.25 (timer i)) 0 DoNothing 1 0+ g n i = sinOsc ar ((4000 + (i * 500))) 0 * decay2 n 0.01 0.2+ nd = zipWith g (iterate f im) [0..9]+in splay (mce nd) 1 1 0 True
+ Help/Graph/tm-drummer.hs view
@@ -0,0 +1,21 @@+-- drummer (tm)+let n = whiteNoise ar+ tempo = 4+ tr = impulse ar tempo 0+ tr_2 = pulseDivider tr 4 2+ tr_4 = pulseDivider tr 4 0+ snare = n * decay2 tr_2 0.005 0.5+ bass = sinOsc ar 60 0 * decay2 tr_4 0.005 0.5+ hihat = hpf n 10000 * decay2 tr 0.005 0.5+in pan2 (snare + bass + hihat) 0 0.4++-- drummer (tm) ; id+let n = whiteNoiseId 'α' ar+ tempo = 4+ tr = impulse ar tempo 0+ tr_2 = pulseDivider tr 4 2+ tr_4 = pulseDivider tr 4 0+ snare = n * decay2 tr_2 0.005 0.5+ bass = sinOsc ar 60 0 * decay2 tr_4 0.005 0.5+ hihat = hpf n 10000 * decay2 tr 0.005 0.5+in pan2 (snare + bass + hihat) 0 0.4
+ Help/Graph/tm-tw-463992770596577280.hs view
@@ -0,0 +1,13 @@+-- https://twitter.com/thormagnusson/status/463992770596577280 (tm) ; texture=overlap,60,15,3,inf+let f i =+ let x = constant i + 1+ e = lfNoise2 ar 0.5 * line ar 0 0.1 (rand 1 99) DoNothing / (x * 0.2)+ in sinOsc ar (30 * x + lfNoise2 ar 0.1 * 2) 0 * e+in mceFill 2 (\_ -> mixFill 24 f)++-- https://twitter.com/thormagnusson/status/463992770596577280 (tm) ; texture=overlap,60,15,3,inf ; id+let f z i =+ let x = constant i + 1+ e = lfNoise2Id z ar 0.5 * line ar 0 0.1 (randId z 1 99) DoNothing / (x * 0.2)+ in sinOsc ar (30 * x + lfNoise2Id z ar 0.1 * 2) 0 * e+in mceFillId 'α' 2 (\z _ -> mixFillId z 24 f)
+ Help/Graph/tw-tw-01.hs view
@@ -0,0 +1,6 @@+-- tim walters ; <https://swiki.hfbk-hamburg.de/MusicTechnology/899>+let f k i =+ let x = impulse kr ((0.5 ** i) / k) 0+ in sinOsc ar i (sinOsc ar ((i + k) ** i) 0 / (decay x (mce2 i (i + 1)) * k))+ s = mixFill 16 (\k -> mixFill 6 (f k))+in mix (mceTranspose (gVerb s 1 3 0.5 0.5 15 1 0.7 0.5 300 / 512))
+ Help/Graph/tw-tw-02.hs view
@@ -0,0 +1,14 @@+-- tim walters ; <https://swiki.hfbk-hamburg.de/MusicTechnology/899>+let mk k =+ let x f m j = sinOsc ar (f + (m * 4 * j)) m * (lfNoise1 ar (((j + 1) / f) * 4)) / 2+ pp y i = x (i * k * mce2 4 8) y i+ in foldl pp (x 0.1 0 8) [0 .. 8]+in sum (map mk [0 .. 7]) / 4++-- tim walters ; <https://swiki.hfbk-hamburg.de/MusicTechnology/899> ; id+let mk (z0,k) =+ let x z f m j = sinOsc ar (f + (m * 4 * j)) m * (lfNoise1Id (z0,z) ar (((j + 1) / f) * 4)) / 2+ pp y (z,i) = x z (i * k * mce2 4 8) y i+ y0 = x 'α' 0.1 0 8+ in foldl pp y0 (zip ['β' ..] [0 .. 8])+in sum (map mk (zip ['γ'..] [0 .. 7])) / 4
+ Help/Graph/unk-laser-bubble.hs view
@@ -0,0 +1,24 @@+-- laser bubble ; https://www.listarc.bham.ac.uk/lists/sc-users/msg14775.html+let n = 8+ laser_bubble _ =+ let xr = dxrand dinf (mce [0.1,0.2,0.3,0.4,0.5])+ lf = dstutter 2 xr+ du = duty ar lf 0 DoNothing lf+ tr = abs (hpz1 du) `greater_than` 0+ ph = sweep ar tr (1 / du)+ in linExp ph 0 1 (rand 50 100) (rand 500 2000)+ [s0,s1] = mceChannels (splay (sinOsc ar (mceFill n laser_bubble) 0) 1 1 0 True)+in limiter (rotate2 s0 s1 (lfSaw kr 0.1 0)) 1 0.01 * 0.25++-- laser bubble ; https://www.listarc.bham.ac.uk/lists/sc-users/msg14775.html ; id+let n = 8+ laser_bubble_f z =+ let xr = dxrandId z dinf (mce [0.1,0.2,0.3,0.4,0.5])+ lf = dstutterId z 2 xr+ du = duty ar lf 0 DoNothing lf+ tr = abs (hpz1 du) `greater_than` 0+ ph = sweep ar tr (1/du)+ in linExp ph 0 1 (randId z 50 100) (randId z 500 2000)+ f = mce (map laser_bubble_f (take n ['α'..]))+ [s0,s1] = mceChannels (splay (sinOsc ar f 0) 1 1 0 True)+in limiter (rotate2 s0 s1 (lfSaw kr 0.1 0)) 1 0.01 * 0.25
+ Help/Graph/unk-m21360.hs view
@@ -0,0 +1,41 @@+-- https://www.listarc.bham.ac.uk/lists/sc-users/msg21360.html+let k_sr = 48000+ b = mce2 (localBuf 1 k_sr) (localBuf 1 k_sr)+ del = mce [0.2,0.3,0.4,0.5] * rand 0.15 0.35+ loc = mce [-1,-0.7,0.6,1]+ hpp = mce [rand 300 600,rand 900 1200]+ avg = mce [8000,14000]+ sdt = mce [300,400]+ lpp = mce [rand 4300 4500,rand 4000 4200]+ sr = sampleRate+ local = localIn' 2 ar+ wn = line kr 0 1 0.1 DoNothing * whiteNoise ar * 0.03+ ph = delTapWr b (wn + local)+ fb = delTapRd b ph del 1+ p_fb = mix (pan2 fb loc 1)+ h_fb = hpf p_fb hpp+ ao = X.averageOutput (abs h_fb) (impulse kr (recip (avg / sr)) 0) -- RFWUGens+ n_fb = h_fb * (0.02 / clip (lag ao (sdt / sr)) 0.0001 1)+ l_fb = lpf n_fb lpp+in mrg [localOut l_fb,out 0 l_fb]++-- https://www.listarc.bham.ac.uk/lists/sc-users/msg21360.html ; id+let k_sr = 48000+ b = mce2 (localBufId 'α' 1 k_sr) (localBufId 'β' 1 k_sr)+ del = mce [0.2,0.3,0.4,0.5] * randId 'γ' 0.15 0.35+ loc = mce [-1,-0.7,0.6,1]+ hpp = mce [randId 'δ' 300 600,randId 'ε' 900 1200]+ avg = mce [8000,14000]+ sdt = mce [300,400]+ lpp = mce [randId 'ζ' 4300 4500,randId 'η' 4000 4200]+ sr = sampleRate+ local = localIn' 2 ar+ wn = line kr 0 1 0.1 DoNothing * whiteNoiseId 'θ' ar * 0.03+ ph = delTapWr b (wn + local)+ fb = delTapRd b ph del 1+ p_fb = mix (pan2 fb loc 1)+ h_fb = hpf p_fb hpp+ ao = X.averageOutput (abs h_fb) (impulse kr (recip (avg / sr)) 0) -- RFWUGens+ n_fb = h_fb * (0.02 / clip (lag ao (sdt / sr)) 0.0001 1)+ l_fb = lpf n_fb lpp+in mrg [localOut l_fb,out 0 l_fb]
+ Help/Graph/unk-no-input-fft.hs view
@@ -0,0 +1,21 @@+-- no input fft ; https://www.listarc.bham.ac.uk/liasts/sc-users/msg63383.html+let e_01 = envelope [0.0001,1,0.0001,0.01,0.0001] (map (* 512) (normalizeSum [1,2,2,50])) [EnvExp]+ e_ix e n = constant (envelope_at e (fromIntegral n))+ fft_size = 1024+ fft_f _ = fft (localBuf 1 (constant fft_size)) (dc ar 0) 0.5 0 1 0+ bin_f _mag phase bin =+ (e_ix e_01 bin * range 10 50 (sinOsc kr (rand 0 0.05) (rand 0 (2 * pi)))+ ,phase)+ gen_f n = pvcollect (fft_f n) fft_size bin_f 0 511 0+in ifft (mceFill 2 gen_f) 1 0++-- no input fft ; https://www.listarc.bham.ac.uk/liasts/sc-users/msg63383.html ; id+let e_01 = envelope [0.0001,1,0.0001,0.01,0.0001] (map (* 512) (normalizeSum [1,2,2,50])) [EnvExp]+ e_ix e n = constant (envelope_at e (fromIntegral n))+ fft_size = 1024+ fft_f z = fft (localBufId z 1 (constant fft_size)) (dc ar 0) 0.5 0 1 0+ bin_f z _mag phase bin =+ (e_ix e_01 bin * range 10 50 (sinOsc kr (randId (z,bin) 0 0.05) (randId (z,bin) 0 (2 * pi)))+ ,phase)+ gen_f z = pvcollect (fft_f z) fft_size (bin_f z) 0 511 0+in ifft (mce2 (gen_f 'α') (gen_f 'β')) 1 0
+ Help/Graph/unk-sin-gliss.hs view
@@ -0,0 +1,7 @@+-- sin gliss (unk)+let t = 60+ ln (x0,x1) = xLine kr x0 x1 t DoNothing+ m = [(0.5,0.5),(0.5,1),(1,1.19),(1.19,1.56),(1.56,2),(2.51,2),(3.01,2.66),(4.1,3.01),(4.1,4.1)]+ a = mce [0.25,0.25,1,0.8,0.5,0.9,0.4,0.3,0.6,0.1,0.1]+ f = mce (map ln m)+in splay (sinOsc ar (500 * f) 0 * 0.1 * a) 1 1 0 True
+ Help/Graph/unk-train.hs view
@@ -0,0 +1,38 @@+-- http://www.create.ucsb.edu/pipermail/sc-users/2007-August/035957.html+let time = 24+ steam =+ let piston = lfSaw ar (xLine ar 1 7 time DoNothing) 0+ air = lpf (whiteNoise ar * piston + pinkNoise ar * piston) 5000+ e = envGen ar 1 1 0 1 DoNothing (envSine time 9)+ in bpf air 600 (1 + e)+ whistle =+ let s = klankSpec [800,600,1200,990] [1,1,1,1] [1,1,1,1]+ t = [0,0,1,1,0,0,1,1,0,0,1,0]+ l = [2,0,0.2,0,0.2,0,0.8,0,4,0,3]+ d = Envelope t l (repeat EnvLin) Nothing Nothing 0+ e = envGen ar 1 1 0 (time / 10) DoNothing d+ in klank (whiteNoise ar * 0.004) 1 0 1 s * e+ loc = let e = Envelope [-0.8,0.8] [time + 2] [EnvSin,EnvSin] Nothing Nothing 0+ in envGen ar 1 1 0 1 RemoveSynth e+in pan2 (steam + whistle) loc 1++-- http://www.create.ucsb.edu/pipermail/sc-users/2007-August/035957.html ; id+let time = 24+ steam =+ let n1 = whiteNoiseId 'α' ar+ n2 = pinkNoiseId 'β' ar+ piston = lfSaw ar (xLine ar 1 7 time DoNothing) 0+ air = lpf (n1 * piston + n2 * piston) 5000+ e = envGen ar 1 1 0 1 DoNothing (envSine time 9)+ in bpf air 600 (1 + e)+ whistle =+ let n3 = whiteNoiseId 'γ' ar+ s = klankSpec [800,600,1200,990] [1,1,1,1] [1,1,1,1]+ t = [0,0,1,1,0,0,1,1,0,0,1,0]+ l = [2,0,0.2,0,0.2,0,0.8,0,4,0,3]+ d = Envelope t l (repeat EnvLin) Nothing Nothing 0+ e = envGen ar 1 1 0 (time / 10) DoNothing d+ in klank (n3 * 0.004) 1 0 1 s * e+ loc = let e = Envelope [-0.8,0.8] [time + 2] [EnvSin,EnvSin] Nothing Nothing 0+ in envGen ar 1 1 0 1 RemoveSynth e+in pan2 (steam + whistle) loc 1
+ Help/Notes/mul-add.help.hs view
@@ -0,0 +1,23 @@+---- ; mulAdd ; optimisations++The order of the multiplier inputs is significant regards multi-rate inputs.++sclang re-orders these if required.++hsc3 does not.++The graph below will crash scsynth.++ mulAdd 0.1 (sinOsc ar 440 0) 0.05++c.f.++ MulAdd.new(in: 0.1, mul: SinOsc.ar(freq: 440, phase: 0), add: 0.05)++Note: mulAdd with i-rate at input 0 and k-rate thereafter crashes scsynth.++ sinOsc ar (mulAdd (control ir "x" 110) (control kr "y" 2) (control ir "z" 110)) 0 * 0.1++c.f.++ 0.05 + (0.1 * SinOsc.ar(freq: 440, phase: 0))
+ Help/Notes/sample-accuracy.help.hs view
@@ -0,0 +1,54 @@+---- ;++Phase cancellation, the `offsetOut` at bus 0 should cancel, the `out` at+bus 1 doesn't (or at least is exceedingly unlikely to).++sy_01 sr =+ let f = sr / 100+ o = sinOsc AR (constant f) 0 * 0.2+ in synthdef "sy_01" (mrg [offsetOut 0 o,out 1 o])++bnd_01 sr t =+ let latency = 0.2+ c = 100 / sr {- recip f -}+ m = s_new "sy_01" (-1) AddToHead 1 []+ p = bundle (t + latency) [m]+ q = bundle (t + latency + c/2) [m]+ in [p,q]++proc_01 :: Transport m => m ()+proc_01 = do+ sr <- serverSampleRateActual+ _ <- async (d_recv (sy_01 sr))+ t <- time+ mapM_ sendBundle (bnd_01 sr t)++withSc3 proc_01++The cancellation isn't completely reliable though. In supercollider language it seems+to be better, though these _should_ be equivalent...++ Routine(+ {var sr = s.actualSampleRate+ ;var f = sr / 100+ ;var c = 1 / f+ ;var g = {var o = SinOsc.ar(f,0) * 0.2; OffsetOut.ar(0,o); Out.ar(1,o)}+ ;var sy = SynthDef("g",g)+ ;var m = ["/s_new", "g", -1, 0, 1]+ ;var latency = 0.2+ ;sy.send(s)+ ;s.sync+ ;s.sendBundle(latency,m)+ ;s.sendBundle(latency + (c/2),m)}).play++To see/hear scheduler clock and sample clock drift:++ Routine(+ {var g = {OffsetOut.ar(0,Saw.ar(400) * EnvGen.kr(Env.perc, doneAction: 2) * 0.2)}+ ;var h = {OffsetOut.ar(1,Saw.ar(800) * Decay2.ar(Impulse.ar(1)) * 0.2)}+ ;var t_delay = 0.25+ ;SynthDef("g",g).send(s)+ ;SynthDef("h",h).send(s)+ ;s.sync+ ;s.sendBundle(t_delay,["/s_new", "h", -1, 0, 1])+ ;inf.do({s.sendBundle(t_delay,["/s_new", "g", -1, 0, 1]); 1.0.wait})}).play
+ Help/Notes/signal-effect-group.help.hs view
@@ -0,0 +1,7 @@+-- decay ; ordinary graph ; ordinary key bindings place at head of group one+let d = dustId 'α' ar 1+ n = whiteNoiseId 'β' ar+in decay (d * 0.5) 0.2 * n++---- ; signal/effect model using separate group, operating at the same bus+withSc3 (playAt (-1, AddToTail, 2, []) (replaceOut 0 (combC (in' 1 ar 0) 0.2 0.2 3)))
+ Help/Nrt/nrt.02.hs view
@@ -0,0 +1,16 @@+import Sound.Osc.Packet {- hosc3 -}+import Sound.Sc3 {- hsc3 -}++sy :: Synthdef+sy = synthdef "sin" (out 0 (sinOsc ar (control kr "freq" 440) 0 * 0.2))++b0,b1,b2,b3 :: Bundle+b0 = bundle 0.0 [g_new [(1, AddToTail, 0)], d_recv sy]+b1 = bundle 0.5 [s_new "sin" 1001 AddToHead 1 []]+b2 = bundle 3.0 [n_free [1001]]+b3 = bundle 3.5 [nrt_end]++main :: IO ()+main = do+ writeNrt "/tmp/nrt.02.osc" (Nrt [b0,b1,b2,b3])+ nrt_exec_plain ("/tmp/nrt.02.osc",("_",0),("/tmp/nrt.02.wav",1),48000,PcmInt16,[])
+ Help/Server/b_alloc.help.hs view
@@ -0,0 +1,23 @@+---- ; help+Sound.Sc3.sc3_scdoc_help_server_command_open False "/b_alloc"++Buffer indices are not restricted by the number of available buffers+at the server. Below allocates a buffer at index 2 ^ 15. Note the+b_alloc_setn1, which adds a b_set completion message to the b_alloc+message, is still asynchronous.++> import Sound.Sc3 {- hsc3 -}++> b0 :: Num n => n+> b0 = 2 ^ 15++> m0 = b_alloc_setn1 b0 0 [0,3,7,10]++ b0 == 2 ^ 15+ withSc3 (async m0)+ withSc3 (b_getn1_data b0 (0,4))++> g0 =+> let x = mouseX KR 0 9 Linear 0.1+> k = degreeToKey b0 x 12+> in sinOsc AR (midiCps (48 + k)) 0 * 0.1
− Help/Server/b_alloc.help.lhs
@@ -1,10 +0,0 @@-/b_alloc Allocate buffer space--int - buffer number-int - number of frames-int - number of channels (optional. default = 1 channel)-bytes - an OSC message to execute upon completion. (optional)--Allocates zero filled buffer to number of channels and samples.--Asynchronous. Replies to sender with /done when complete.
+ Help/Server/b_allocRead.help.hs view
@@ -0,0 +1,62 @@+---- ;help+Sound.Sc3.sc3_scdoc_help_server_command_open False "/b_allocRead"++> import Sound.OSC {- hosc -}+> import Sound.Sc3 {- hsc3 -}++Read an audio file into a buffer.++> f_00 = sfResolve "jonchaies.wav"+> m_00 = b_allocRead 0 f_00 0 0++ withSc3 (async m_00)++Audio data is loaded in IEEE 32-bit form, so in-memory storage can be+greater than on-disk storage.++$ sndfile-info data/audio/xenakis/jonchaies.wav+Sample Rate : 44100+Frames : 42271320+Duration : 00:15:58.533+$ du -h data/audio/xenakis/jonchaies.wav+162M data/audio/xenakis/jonchaies.wav+$++ round ((16 * 60 * 44100 * 4 * 2) / (1024 * 1024)) == 323+ round ((42271320 * 2 * 4) / (1024 * 1024)) == 323++Query buffer.++> q_00 :: Connection UDP ()+> q_00 = do+> sendMessage (b_query [0])+> r <- waitReply "/b_info"+> liftIO (print r)++ withSc3 q_00++Play buffer.++> g_00 =+> let bufnum = 257+> s = bufRateScale KR bufnum+> in playBuf 1 AR bufnum s 1 0 NoLoop RemoveSynth++Re-read file into buffer with the same identifier. The existing+buffer is freed but not before further memory is allocated,+intermediate in-memory use is greater than final memory use.++ withSc3 (async (b_allocRead 0 fn 0 0))++Free buffer. Memory is immediately made free.++ withSc3 (async (b_free 0))++Small sample buffer++> f_01 = sfResolve "metal.wav"++ withSc3 (async m_01)++> m_01 :: Message+> m_01 = b_allocRead 0 f_01 0 0
− Help/Server/b_allocRead.help.lhs
@@ -1,15 +0,0 @@-/b_allocRead Allocate buffer space and read a sound file--int - buffer number-string - path name of a sound file.-int - starting frame in file (optional. default = 0)-int - number of frames to read (optional. default = 0, see below)-bytes - an OSC message to execute upon completion. (optional)--Allocates buffer to number of channels of file and number of samples-requested, or fewer if sound file is smaller than requested. Reads-sound file data from the given starting frame in the file. If the-number of frames argument is less than or equal to zero, the entire-file is read.--Asynchronous. Replies to sender with /done when complete.
+ Help/Server/b_allocReadChannel.help.hs view
@@ -0,0 +1,34 @@+---- ;help+Sound.Sc3.sc3_scdoc_help_server_command_open False "/b_allocReadChannel"++> import Data.List {- base -}+> import Data.List.Split {- split -}+> import Sound.Sc3 {- hsc3 -}++Read an audio file with many channels (here 1024)++> fn_00 = "/home/rohan/sw/hsc3-sf/data/au/mc-10-1024.au"++> m_00 = b_allocRead 0 fn_00 0 0++ > withSc3 (async_ m_00)++Query buffer++ > withSc3 (b_query1_unpack 0)++Read only specified channels++> m_01 = b_allocReadChannel 0 fn_00 0 0 [0 .. 7]++ > withSc3 (async_ m_01)++Query buffer++ > withSc3 (b_query1_unpack 0)++Examine buffer++ > let (nf,nc) = (10,8)+ > d <- withSc3 (b_getn1_data_segment 128 0 (0,nf * nc))+ > (putStrLn . unlines . transpose . chunksOf nc . map (\n -> if n > 0 then '1' else '0')) d
+ Help/Server/b_close.help.hs view
@@ -0,0 +1,1 @@+ Sound.Sc3.Lang.Help.viewServerHelp "/b_close"
− Help/Server/b_close.help.lhs
@@ -1,6 +0,0 @@-/b_close Close attached soundfile and write header information--int - buffer number--After using a buffer with DiskOut, close the soundfile and write-header information.
+ Help/Server/b_fill.help.hs view
@@ -0,0 +1,1 @@+ Sound.Sc3.Lang.Help.viewServerHelp "/b_fill"
− Help/Server/b_fill.help.lhs
@@ -1,13 +0,0 @@-/b_fill Fill ranges of sample value(s)--int - buffer number-[- int - sample starting index- int - number of samples to fill (M)- float - value-] * N--Set contiguous ranges of sample indices to single values. For each-range, the starting sample index is given followed by the number of-samples to change, followed by the value to fill. This is only meant-for setting a few samples, not whole buffers or large sections.
+ Help/Server/b_free.help.hs view
@@ -0,0 +1,11 @@+ Sound.Sc3.Lang.Help.viewServerHelp "/b_free"++> import Sound.Sc3 {- hsc3 -}++It is safe to free un-allocated buffers.++ withSc3 (async (b_free (2 ^ 15)))++There is no multiple buffer form.++ withSc3 (mapM_ (\k -> async (b_free k)) [0..256])
− Help/Server/b_free.help.lhs
@@ -1,8 +0,0 @@-/b_free Free buffer data.--int - buffer number-bytes - an OSC message to execute upon completion (optional)--Frees buffer space allocated for this buffer.--Asynchronous. Replies to sender with /done when complete.
+ Help/Server/b_gen.help.hs view
@@ -0,0 +1,32 @@+---- ; function to generate wavetable buffer using b_gen_cheby+mk_cheby a =+ let tbl_f = [Normalise, Wavetable, Clear]+ msg = [b_alloc 10 512 1, b_gen_cheby 10 tbl_f a]+ in withSc3 (mapM_ async msg)++---- ; generate various wavetables+mk_cheby [1, 0, 1, 1, 0, 1]+mk_cheby [0.25, 0.5, 0.25]+mk_cheby [1, 0, 1, 1, 0, 1, 0.5, 0, 0.25, 0, 0.75, 1]++---- ; generate sin table ; not wavetable+withSc3 (mapM_ maybe_async [b_alloc 10 256 1,b_gen_sine1 10 [Normalise, Clear] [1, 1/2, 1/3, 1/4, 1/5]])++---- ; plot wavetable (as in-buffer layout, as plain wavetable)+import Sound.Sc3.Plot {- hsc3-plot -}+withSc3 (Sound.Sc3.Plot.plot_buffer1 10)+withSc3 (Sound.Sc3.Plot.plot_wavetable1 10)++---- ; fetch generated buffer data ; compare to haskell generated buffer+withSc3 (b_fetch1 512 10)+Gen.sine1_nrm 256 [1, 1/2, 1/3, 1/4, 1/5]++---- ; generate tables in haskell+Sound.Sc3.Plot.plot_p1_ln [Gen.cheby 256 [1, 0, 1, 1, 0, 1]]+Sound.Sc3.Plot.plot_p1_ln [Gen.cheby 256 [0.25, 0.5, 0.25]]+Sound.Sc3.Plot.plot_p1_ln [Gen.cheby 256 [1, 0, 1, 1, 0, 1, 0.5, 0, 0.25, 0, 0.75, 1]]+Sound.Sc3.Plot.plot_p1_ln [Gen.chebyShaperTbl 256 [1, 0, 1, 1, 0, 1, 0.5, 0, 0.25, 0, 0.75, 1]]+Sound.Sc3.Plot.plot_p1_ln [Gen.sine1_nrm 256 [1, 1/2, 1/3, 1/4, 1/5]]++----- ; open remote scdoc help+Sound.Sc3.Common.Help.sc3_scdoc_help_server_command_open False "/b_gen"
− Help/Server/b_gen.help.lhs
@@ -1,9 +0,0 @@-/b_gen Call a command to fill a buffer--int - buffer number-string - command name-... - command arguments--Plug-ins can define commands that operate on buffers. The arguments-after the command name are defined by the command. The currently-defined buffer fill commands are listed below in a separate section.
+ Help/Server/b_get.help.hs view
@@ -0,0 +1,1 @@+ Sound.Sc3.Lang.Help.viewServerHelp "/b_get"
− Help/Server/b_get.help.lhs
@@ -1,8 +0,0 @@-/b_get Get sample value(s)--int - buffer number-[- int - a sample index-] * N--Replies to sender with the corresponding /b_set command.
+ Help/Server/b_getn.help.hs view
@@ -0,0 +1,45 @@+ Sound.Sc3.Lang.Help.viewServerHelp "/b_getn"++> import Sound.OSC {- hosc -}+> import Sound.Sc3 {- hsc3 -}+> import Sound.Sc3.Plot {- hsc3-plot -}++Allocate and generate wavetable buffer (256 frames)++> x_00 :: DuplexOSC m => m ()+> x_00 = do+> async_ (b_alloc 0 256 1)+> let f = [Normalise,Clear]+> sendMessage (b_gen_sine1 0 f [1,1/2,1/3,1/4,1/5])++ > withSc3 x_00++Run simple read...++ > d0 <- withSc3 (b_getn1_data 0 (0,255))++and draw buffer++ > plotTable [d0]++Load sound file++> fn_00 = "/tmp/dx7.wav"++> m_00 = b_allocRead 1 fn_00 0 0++ > withSc3 (async_ m_00)++Run segmented read (n-frames of data in m-frame segments)...++> x_01 :: DuplexOSC m => m [Double]+> x_01 = do+> let m = 155+> n = m * 3+> b_getn1_data_segment m 1 (0,n)++ > d1 <- withSc3 x_01++and draw buffer++ > plotImpulses [d1]
− Help/Server/b_getn.help.lhs
@@ -1,11 +0,0 @@-/b_getn Get ranges of sample value(s)--int - buffer number-[- int - starting sample index- int - number of sequential samples to get (M)-] * N--Get contiguous ranges of samples. Replies to sender with the-corresponding /b_setn command. This is only meant for getting a few-samples, not whole buffers or large sections.
+ Help/Server/b_info.help.hs view
@@ -0,0 +1,3 @@+/b_info is the message returned by scsynth in response to /b_query.++Fields are: buffer-id:int num-frames:int num-channels:int sample-rate:float
+ Help/Server/b_query.help.hs view
@@ -0,0 +1,48 @@+ Sound.Sc3.Lang.Help.viewServerHelp "/b_query"++> import Sound.OSC {- hosc -}+> import Sound.Sc3 {- hsc3 -}++Allocate and generate wavetable buffer++> mk_b :: Transport m => m ()+> mk_b = do+> _ <- async (b_alloc 0 256 1)+> let f = [Normalise,Wavetable,Clear]+> sendMessage (b_gen_sine1 0 f [1,1/2,1/3,1/4,1/5])++ withSc3 mk_b++Query buffer++> qr_b :: Transport m => m ()+> qr_b = do+> sendMessage (b_query [0])+> r <- waitReply "/b_info"+> liftIO (print r)++ withSc3 qr_b++Variant that unpacks the result.++Query is of (buffer-id/int,#-frames/int,#-channels/int,sample-rate/float).++ withSc3 (b_query1_unpack 0)++Play buffer++> g_01 = osc AR 0 220 0 * 0.1++Free buffer++ withSc3 (async (b_free 0))++Query multiple un-allocated buffers++> qr_unalloc :: Transport m => m ()+> qr_unalloc = do+> sendMessage (b_query [2^14,2^15])+> r <- waitReply "/b_info"+> liftIO (print r)++ withSc3 qr_unalloc
− Help/Server/b_query.help.lhs
@@ -1,15 +0,0 @@-/b_query--[- int - buffer number-] * N--Responds to the sender with a /b_info message. The arguments to-/b_info are as follows:--[- int - buffer number- int - number of frames- int - number of channels- float - sample rate-] * N
+ Help/Server/b_read.help.hs view
@@ -0,0 +1,2 @@+---- ; help+Sound.Sc3.sc3_scdoc_help_server_command_open False "/b_read"
− Help/Server/b_read.help.lhs
@@ -1,17 +0,0 @@-/b_read Read sound file data into an existing buffer--int - buffer number-string - path name of a sound file-int - starting frame in file (optional, default = 0)-int - number of frames to read (optional, default = -1, see below)-int - starting frame in buffer (optional, default = 0)-int - leave file open (optional, default = 0)-bytes - an OSC message to execute upon completion (optional)--Reads sound file data from the given starting frame in the file and-writes it to the given starting frame in the buffer. If number of-frames is less than zero, the entire file is read. If reading a file-to be used by DiskIn ugen then you will want to set "leave file open"-to one, otherwise set it to zero.--Asynchronous. Replies to sender with /done when complete.
+ Help/Server/b_readChannel.help.hs view
@@ -0,0 +1,2 @@+---- ; help+Sound.Sc3.sc3_scdoc_help_server_command_open False "/b_readChannel"
+ Help/Server/b_set.help.hs view
@@ -0,0 +1,1 @@+ Sound.Sc3.Lang.Help.viewServerHelp "/b_set"
− Help/Server/b_set.help.lhs
@@ -1,10 +0,0 @@-/b_set Set sample value(s)--int - buffer number-[- int - a sample index- float - a sample value-] * N--Takes a list of pairs of sample indices and values and sets the-samples to those values.
+ Help/Server/b_setn.help.hs view
@@ -0,0 +1,1 @@+ Sound.Sc3.Lang.Help.viewServerHelp "/b_setn"
− Help/Server/b_setn.help.lhs
@@ -1,14 +0,0 @@-/b_setn Set ranges of sample value(s)--int - buffer number-[- int - sample starting index- int - number of sequential samples to change (M)- [- float - a sample value- ] * M-] * N--Set contiguous ranges of sample indices to sets of values. For each-range, the starting sample index is given followed by the number of-samples to change, followed by the values.
+ Help/Server/b_write.help.hs view
@@ -0,0 +1,1 @@+ Sound.Sc3.Lang.Help.viewServerHelp "/b_write"
− Help/Server/b_write.help.lhs
@@ -1,27 +0,0 @@-/b_write Write sound file data--int - buffer number-string - path name of a sound file-string - header format-string - sample format-int - number of frames to write (optional. default = -1, see below)-int - starting frame in buffer (optional. default = 0)-int - leave file open (optional. default = 0)-bytes - an OSC message to execute upon completion (optional)--Write a buffer as a sound file. --Header format is one of: "aiff", "next", "wav", "ircam"", "raw" --Sample format is one of: "int8", "int16", "int24", "int32", "float",-"double", "mulaw", "alaw"--Not all combinations of header format and sample format are possible.-If number of frames is less than zero, all samples from the starting-frame to the end of the buffer are written. If opening a file to be-used by DiskOut ugen then you will want to set "leave file open" to-one, otherwise set it to zero. If "leave file open" is set to one then-the file is created, but no frames are written until the DiskOut ugen-does so.--Asynchronous. Replies to sender with /done when complete.
+ Help/Server/b_zero.help.hs view
@@ -0,0 +1,1 @@+ Sound.Sc3.Lang.Help.viewServerHelp "/b_zero"
− Help/Server/b_zero.help.lhs
@@ -1,8 +0,0 @@-/b_zero Zero sample data--int - buffer number-bytes - an OSC message to execute upon completion. (optional)--Sets all samples in the buffer to zero.--Asynchronous. Replies to sender with /done when complete.
+ Help/Server/c_fill.help.hs view
@@ -0,0 +1,1 @@+ Sound.Sc3.Lang.Help.viewServerHelp "/c_fill"
− Help/Server/c_fill.help.lhs
@@ -1,11 +0,0 @@-/c_fill Fill ranges of bus value(s)--[- int - starting bus index- int - number of buses to fill (M)- float - value-] * N--Set contiguous ranges of buses to single values. For each range, the-starting sample index is given followed by the number of buses to-change, followed by the value to fill.
+ Help/Server/c_get.help.hs view
@@ -0,0 +1,14 @@+ Sound.Sc3.Lang.Help.viewServerHelp "/c_get"++> import Sound.OSC {- hosc -}+> import Sound.Sc3 {- hsc3 -}++> g_01 = out 0 (tRand 'α' 220 2200 (dust 'β' KR 1))++> x_01 :: Transport m => m ()+> x_01 = do+> sendMessage (c_get [0])+> r <- waitReply "/c_set"+> liftIO (print r)++ > withSc3 x_01
− Help/Server/c_get.help.lhs
@@ -1,8 +0,0 @@-/c_get Get bus value(s)--[- int - a bus index-] * N--Takes a list of buses and replies to sender with the corresponding-/c_set command.
+ Help/Server/c_getn.help.hs view
@@ -0,0 +1,19 @@+ Sound.Sc3.Lang.Help.viewServerHelp "/c_getn"++> import Sound.OSC {- hosc -}+> import Sound.Sc3 {- hsc3 -}++Get control bus data.++> get_c :: Transport m => m ()+> get_c = do+> sendMessage (c_getn [(0,3)])+> r <- waitReply "/c_setn"+> liftIO (print r)++ withSc3 (sendMessage (c_setn [(0,[1,880,0.5])]))+ withSc3 get_c++Function to get and unpack control bus data.++ withSc3 (c_getn1_data (0,3))
− Help/Server/c_getn.help.lhs
@@ -1,9 +0,0 @@-/c_getn Get ranges of bus value(s)--[- int - starting bus index- int - number of sequential buses to get (M)-] * N--Get contiguous ranges of buses. Replies to sender with the-corresponding /c_setn command.
+ Help/Server/c_set.help.hs view
@@ -0,0 +1,1 @@+ Sound.Sc3.Lang.Help.viewServerHelp "/c_set"
− Help/Server/c_set.help.lhs
@@ -1,9 +0,0 @@-/c_set Set bus value(s)--[- int - a bus index- float - a control value-] * N--Takes a list of pairs of bus indices and values and sets the buses to-those values.
+ Help/Server/c_setn.help.hs view
@@ -0,0 +1,1 @@+ Sound.Sc3.Lang.Help.viewServerHelp "/c_setn"
− Help/Server/c_setn.help.lhs
@@ -1,13 +0,0 @@-/c_setn Set ranges of bus value(s)--[- int - starting bus index- int - number of sequential buses to change (M)- [- float - a control value- ] * M-] * N--Set contiguous ranges of buses to sets of values. For each range, the-starting bus index is given followed by the number of channels to-change, followed by the values.
+ Help/Server/clearSched.help.hs view
@@ -0,0 +1,1 @@+ Sound.Sc3.Lang.Help.viewServerHelp "/clearSched"
− Help/Server/clearSched.help.lhs
@@ -1,3 +0,0 @@-/clearSched Clear all scheduled bundles--Removes all bundles from the scheduling queue.
+ Help/Server/d_free.help.hs view
@@ -0,0 +1,1 @@+ Sound.Sc3.Lang.Help.viewServerHelp "/d_free"
− Help/Server/d_free.help.lhs
@@ -1,7 +0,0 @@-/d_free Delete synth definition--[- string - synth def name-] * N--Removes a synth definition once all synths using it have ended.
+ Help/Server/d_load.help.hs view
@@ -0,0 +1,1 @@+ Sound.Sc3.Lang.Help.viewServerHelp "/d_load"
− Help/Server/d_load.help.lhs
@@ -1,9 +0,0 @@-/d_load Load synth definition--string - pathname of file. Can be a pattern like "synthdefs/perc-*"-bytes - an OSC message to execute upon completion. (optional)--Loads a file of synth definitions. Resident definitions with the same-names are overwritten.--Asynchronous. Replies to sender with /done when complete.
+ Help/Server/d_loadDir.help.hs view
@@ -0,0 +1,1 @@+ Sound.Sc3.Lang.Help.viewServerHelp "/d_loadDir"
− Help/Server/d_loadDir.help.lhs
@@ -1,9 +0,0 @@-/d_loadDir Load directory of synth definitions--string - pathname of directory.-bytes - an OSC message to execute upon completion. (optional)--Loads a directory of synth definitions. Resident definitions with the-same names are overwritten.--Asynchronous. Replies to sender with /done when complete.
+ Help/Server/d_recv.help.hs view
@@ -0,0 +1,1 @@+ Sound.Sc3.Lang.Help.viewServerHelp "/d_recv"
− Help/Server/d_recv.help.lhs
@@ -1,9 +0,0 @@-/d_recv Receive a synth definition file--bytes - buffer of data.-bytes - an OSC message to execute upon completion. (optional)--Loads a file of synth definitions from a buffer in the message.-Resident definitions with the same names are overwritten.--Asynchronous. Replies to sender with /done when complete.
+ Help/Server/dumpOSC.help.hs view
@@ -0,0 +1,15 @@+ Sound.Sc3.Lang.Help.viewServerHelp "/dumpOSC"++> import Sound.OSC {- hosc -}+> import Sound.Sc3 {- hsc3 -}++> ex_01 :: Transport m => m ()+> ex_01 = do+> sendMessage (dumpOSC TextPrinter)+> play (out 0 (sinOsc AR (rand 'α' 440 880) 0 * 0.1))+> pauseThread 1.0+> reset+> sendMessage (dumpOSC NoPrinter)++ withSc3 ex_01+ withSc3 (sendMessage (dumpOSC TextPrinter))
− Help/Server/dumpOSC.help.lhs
@@ -1,13 +0,0 @@-/dumpOSC Display incoming OSC messages--PrintLevel (int) - code--Turns on and off printing of the contents of incoming Open Sound-Control messages. This is useful when debugging your command stream.--The values for the code are as follows:--NoPrinter (0) - turn dumping OFF.-TextPrinter (1) - print the parsed contents of the message.-HexPrinter (2) - print the contents in hexadecimal.-AllPrinter (3) - print both the parsed and hexadecimal representations of the contents.
+ Help/Server/g_deepFree.help.hs view
@@ -0,0 +1,1 @@+ Sound.Sc3.Lang.Help.viewServerHelp "/g_deepFree"
− Help/Server/g_deepFree.help.lhs
@@ -1,9 +0,0 @@-/g_deepFree Free all synths in this group and all its sub-groups--[- int - group ID-] * N--Traverses all groups below this group and frees all the synths.-Sub-groups are not freed. A list of groups may be specified.-
+ Help/Server/g_freeAll.help.hs view
@@ -0,0 +1,8 @@+ Sound.Sc3.Lang.Help.viewServerHelp "/g_freeAll"++> import Sound.OSC+> import Sound.Sc3++> m1 = g_freeAll [0]++ > withSc3 (sendMessage m1)
− Help/Server/g_freeAll.help.lhs
@@ -1,7 +0,0 @@-/g_freeAll Delete all nodes in a group--[- int - group ID-] * N--Frees all nodes in the group. A list of groups may be specified.
+ Help/Server/g_head.help.hs view
@@ -0,0 +1,1 @@+ Sound.Sc3.Lang.Help.viewServerHelp "/g_head"
− Help/Server/g_head.help.lhs
@@ -1,8 +0,0 @@-/g_head Add node to head of group--[- int - group ID- int - node ID-] * N--Adds the node to the head (first to be executed) of the group.
+ Help/Server/g_new.help.hs view
@@ -0,0 +1,12 @@+ Sound.Sc3.Lang.Help.viewServerHelp "/g_new"++The root node of the synthesiser tree is a group with ID zero.++By convention there is a group with ID one at the root group, but+this is only a convention. We need to make the group.++> import Sound.Sc3 {- hsc3 -}++> m_01 = g_new [(1,AddToTail,0)]++ > withSc3 (send m_00)
− Help/Server/g_new.help.lhs
@@ -1,13 +0,0 @@-/g_new Create a new group--[- int - new group ID- int - add action (0,1,2, 3 or 4 see below)- int - add target ID-] * N--Create a new group and add it to the tree of nodes.--For add action definitions see /s_new.--Multiple groups may be created in one command by adding arguments.
+ Help/Server/g_queryTree.help.hs view
@@ -0,0 +1,43 @@+ Sound.Sc3.Lang.Help.viewServerHelp "/g_queryTree"++> import Sound.OSC {- hosc -}+> import Sound.Sc3 {- hsc3 -}+> import qualified Data.Tree as T {- containers -}++ withSc3 serverTree >>= mapM_ putStrLn++> g_00 =+> let f = control KR "freq" 440+> in saw AR f * 0.05++> d_01 = synthdef "saw" (out 0 g_00)++> m_02 = [d_recv d_01,g_new [(100,AddToTail,1)],s_new0 "saw" 1000 AddToTail 100]++ > withSc3 (mapM_ maybe_async m_02)++> run_query_tree = withSc3 (g_queryTree1_unpack 0)++ > qt <- run_query_tree+ > print qt+ > withSc3 (sendMessage (g_dumpTree [(0,True)]))+ > queryNode_to_group_seq qt++There is support for extracting the node tree into the standard haskell+tree data type.++ > r_tr = queryTree_rt qt+ > putStrLn (unlines ["::TREE::",T.drawTree (fmap query_node_pp r_tr)])++> q_03 =+> [int32 1,int32 0,int32 2,int32 1,int32 1+> ,int32 100,int32 1+> ,int32 1000,int32 (-1),string "saw"+> ,int32 1,string "freq",float 440.0+> ,int32 2,int32 0]++> t_04 = queryTree q_03++> t_05 = queryTree_rt t_04++ >> putStrLn (unlines ["::TREE::",T.drawTree (fmap query_node_pp t_05)])
+ Help/Server/g_tail.help.hs view
@@ -0,0 +1,1 @@+ Sound.Sc3.Lang.Help.viewServerHelp "/g_tail"
− Help/Server/g_tail.help.lhs
@@ -1,8 +0,0 @@-/g_tail Add node to tail of group--[- int - group ID- int - node ID-] * N--Adds the node to the tail (last to be executed) of the group.
+ Help/Server/n_after.help.hs view
@@ -0,0 +1,1 @@+ Sound.Sc3.Lang.Help.viewServerHelp "/n_after"
− Help/Server/n_after.help.lhs
@@ -1,9 +0,0 @@-/n_after Place a node after another--[- int - the ID of the node to place (A)- int - the ID of the node after which the above is placed (B)-] * N--Places node A in the same group as node B, to execute immediately-after node B.
+ Help/Server/n_before.help.hs view
@@ -0,0 +1,1 @@+ Sound.Sc3.Lang.Help.viewServerHelp "/n_before"
− Help/Server/n_before.help.lhs
@@ -1,9 +0,0 @@-/n_before Place a node before another--[- int - the ID of the node to place (A)- int - the ID of the node before which the above is placed (B)-] * N--Places node A in the same group as node B, to execute immediately-before node B.
+ Help/Server/n_fill.help.hs view
@@ -0,0 +1,1 @@+ Sound.Sc3.Lang.Help.viewServerHelp "/n_fill"
− Help/Server/n_fill.help.lhs
@@ -1,13 +0,0 @@-/n_fill Fill ranges of a node's control value(s)--int - node ID-[- int or string - a control index or name- int - number of values to fill (M)- float - value-] * N--Set contiguous ranges of control indices to single values. For each-range, the starting control index is given followed by the number of-controls to change, followed by the value to fill. If the node is a-group, then it sets the controls of every node in the group.
+ Help/Server/n_free.help.hs view
@@ -0,0 +1,1 @@+ Sound.Sc3.Lang.Help.viewServerHelp "/n_free"
− Help/Server/n_free.help.lhs
@@ -1,9 +0,0 @@-/n_free Delete a node--[- int - node ID-] * N--Stops a node abruptly, removes it from its group, and frees its-memory. A list of node IDs may be specified. Using this method can-cause a click if the node is not silent at the time it is freed.
+ Help/Server/n_map.help.hs view
@@ -0,0 +1,1 @@+ Sound.Sc3.Lang.Help.viewServerHelp "/n_map"
− Help/Server/n_map.help.lhs
@@ -1,14 +0,0 @@-/n_map Map a node's controls to read from a bus--int - node ID-[- int|string - a control index or name- int - control bus index-] * N--Takes a list of pairs of control names or indices and bus indices and-causes those controls to be read continuously from a global control-bus instead of responding to n_set, n_setn and n_fill commands. If the-node is a group, then it maps the controls of every node in the-group. If the control bus index is -1 then any current mapping is-undone and control reverts to normal.
+ Help/Server/n_mapn.help.hs view
@@ -0,0 +1,31 @@+ Sound.Sc3.Lang.Help.viewServerHelp "/n_mapn"++> import Sound.OSC {- hosc -}+> import Sound.Sc3 {- hsc3 -}++> f_01 nm def ix = control_f64 KR (Just ix) nm def+> g_01 = out (f_01 "bus" 0 0) (sinOsc AR (f_01 "freq" 440 1) 0 * f_01 "amp" 0.1 2)+> s_01 = synthdef "sin" g_01+> m_01 = d_recv s_01+> m_02 = s_new "sin" 1001 AddToHead 1 []+> m_03 = n_mapn 1001 [(0,0,3)]++ withSc3 (async (d_recv s_01) >> mapM_ sendMessage [m_02,m_03])++ withSc3 (sendMessage (n_mapn 1001 [(0,0,3)]))+ withSc3 (sendMessage (c_setn [(0,[1,880,0.2])]))+ withSc3 (sendMessage (c_setn [(0,[0,220,0.3])]))++ withSc3 (sendMessage (n_set1 1001 "bus" 1))+ withSc3 (sendMessage (n_set1 1001 "freq" 440))+ withSc3 (sendMessage (n_set1 1001 "amp" 0.2))+ withSc3 (sendMessage (n_setn 1001 [(0,[1,880,0.2])]))++n_mapn and n_setn only work if the control is given as an index and not as a name.++s.sendMsg("/n_mapn",1001,"bus",0,3);+s.sendMsg("/c_setn",0,3,0,880,0.1);++s.sendMsg("/n_mapn",1001,0,0,3);+s.sendMsg("/c_setn",0,3,0,880,0.1);+s.sendMsg("/c_setn",0,3,1,220,0.3);
− Help/Server/n_mapn.help.lhs
@@ -1,16 +0,0 @@-/n_mapn Map a node's controls to read from buses--int - node ID-[- int|string - a control index or name- int - control bus index- int - number of controls to map-] * N--Takes a list of triplets of control names or indices, bus indices, and-number of controls to map and causes those controls to be mapped-sequentially to buses. If the node is a group, then it maps the-controls of every node in the group. If the control bus index is -1-then any current mapping is undone and control reverts to normal.--See also: /n_map
+ Help/Server/n_query.help.hs view
@@ -0,0 +1,21 @@+ Sound.Sc3.Lang.Help.viewServerHelp "/n_query"++> import Sound.OSC {- hosc -}+> import Sound.Sc3 {- hsc3 -}++> d_00 =+> let f = control KR "freq" 440+> o = saw AR f * 0.1+> in synthdef "saw" (out 0 o)++> m_00 = s_new0 "saw" 1000 AddToTail 1++ > withSc3 (async_ (d_recv d_00) >> sendMessage m_00)++> x_01 :: Transport m => m Message+> x_01 = withNotifications $ do+> sendMessage (n_query [1000])+> waitReply "/n_info"++ > r <- withSc3 x_01+ > print r
− Help/Server/n_query.help.lhs
@@ -1,10 +0,0 @@-/n_query Get info about a node--[- int - node ID-] * N--The server sends an /n_info message for each node to registered-clients.--See Node Notifications below for the format of the /n_info message.
+ Help/Server/n_run.help.hs view
@@ -0,0 +1,1 @@+ Sound.Sc3.Lang.Help.viewServerHelp "/n_run"
− Help/Server/n_run.help.lhs
@@ -1,11 +0,0 @@-/n_run Turn node on or off--[- int - node ID- int - run flag-] * N--If the run flag set to zero then the node will not be executed. If-the run flag is set back to one, then it will be executed. Using this-method to start and stop nodes can cause a click if the node is not-silent at the time run flag is toggled.
+ Help/Server/n_set.help.hs view
@@ -0,0 +1,2 @@+---- ; help+Sound.Sc3.sc3_scdoc_help_server_command_open False "/n_set"
− Help/Server/n_set.help.lhs
@@ -1,11 +0,0 @@-/n_set Set a node's control value(s)--int - node ID-[- int|string - a control index or name- float - a control value-] * N--Takes a list of pairs of control indices and values and sets the-controls to those values. If the node is a group, then it sets the-controls of every node in the group.
+ Help/Server/n_setn.help.hs view
@@ -0,0 +1,5 @@+ Sound.Sc3.Lang.Help.viewServerHelp "/n_setn"++At some point /n_setn was broken at scsynth, it no longer behaves as specified.++/n_setn only works correctly with <int> indices, and not when the index is given as a <string>.
− Help/Server/n_setn.help.lhs
@@ -1,15 +0,0 @@-/n_setn Set ranges of a node's control value(s)--int - node ID-[- int|string - a control index or name- int - number of sequential controls to change (M)- [- float - a control value- ] * M-] * N--Set contiguous ranges of control indices to sets of values. For each-range, the starting control index is given followed by the number of-controls to change, followed by the values. If the node is a group,-then it sets the controls of every node in the group.
+ Help/Server/n_trace.help.hs view
@@ -0,0 +1,13 @@+ Sound.Sc3.Lang.Help.viewServerHelp "/n_trace"++> import Sound.OSC {- hosc -}+> import Sound.Sc3 {- hsc3 -}++> m_01 =+> [d_recv defaultSynthdef+> ,s_new "default" 100 AddToHead 1 []]++> m_02 = n_trace [1,100]++ > withSc3 (mapM_ maybe_async m_01)+ > withSc3 (sendMessage m_02)
− Help/Server/n_trace.help.lhs
@@ -1,10 +0,0 @@-/n_trace Trace a node--[- int - node ID-] * N--Causes a synth to print out the values of the inputs and outputs of-its unit generators for one control period. Causes a group to print-the node IDs and names of each node in the group for one control-period.
+ Help/Server/notify.help.hs view
@@ -0,0 +1,17 @@+ Sound.Sc3.Lang.Help.viewServerHelp "/notify"++> import Sound.OSC {- hosc -}+> import Sound.Sc3 {- hsc3 -}++> g_01 = sinOsc AR (rand 'α' 440 880) 0 * 0.1++> s_01 = synthdef "g" (out 0 g_01)++> m_01 = s_new "g" (-1) AddToHead 1 []++> f_01 :: DuplexOSC m => m Message+> f_01 = do+> async_ (d_recv s_01)+> withNotifications (sendMessage m_01 >> waitReply "/n_go")++ withSc3 (f_01 >>= \r -> liftIO (print r))
− Help/Server/notify.help.lhs
@@ -1,9 +0,0 @@-/notify Register to receive notifications from server--int - one to receive notifications, zero to stop receiving them.--If argument is one, server will remember your return address and-send you notifications. if argument is zero, server will stop-sending you notifications.--Asynchronous. Replies to sender with /done when complete.
+ Help/Server/quit.help.hs view
@@ -0,0 +1,1 @@+ Sound.Sc3.Lang.Help.viewServerHelp "/quit"
− Help/Server/quit.help.lhs
@@ -1,7 +0,0 @@-/quit Quit program--No arguments.--Exits the synthesis server.--Asynchronous. Replies to sender with /done just before completion.
+ Help/Server/s_get.help.hs view
@@ -0,0 +1,1 @@+ Sound.Sc3.Lang.Help.viewServerHelp "/s_get"
− Help/Server/s_get.help.lhs
@@ -1,8 +0,0 @@-/s_get Get control value(s)--int - synth ID-[- int|string - a control index or name-] * N--Replies to sender with the corresponding /n_set command.
+ Help/Server/s_getn.help.hs view
@@ -0,0 +1,1 @@+ Sound.Sc3.Lang.Help.viewServerHelp "/s_getn"
− Help/Server/s_getn.help.lhs
@@ -1,10 +0,0 @@-/s_getn Get ranges of control value(s)--int - synth ID-[- int|string - a control index or name- int - number of sequential controls to get (M)-] * N--Get contiguous ranges of controls. Replies to sender with the-corresponding /n_setn command.
+ Help/Server/s_new.help.hs view
@@ -0,0 +1,2 @@+---- ; help+Sound.Sc3.sc3_scdoc_help_server_command_open False "/s_new"
− Help/Server/s_new.help.lhs
@@ -1,38 +0,0 @@-/s_new Create a new synth--string - synth definition name-int - synth ID-int - add action (0,1,2, 3 or 4 see below)-int - add target ID-[- int|string - a control index or name- float - a control value-] * N--Create a new synth from a synth definition, give it an ID, and add it-to the tree of nodes. There are four ways to add the node to the tree-as determined by the add action argument which is defined as follows:--0 - add the new node to the the head of the target group-1 - add the new node to the the tail of the target group-2 - add the new node just before the target node-3 - add the new node just after the target node-4 - the new node replaces the target node, which is freed--Controls may be set when creating the synth. The control arguments are-the same as for the n_set command.--If you send /s_new with a synth ID of -1, then the server will-generate an ID for you. The server reserves all negative IDs. Since-you don't know what the ID is, you cannot talk to this node directly-later. So this is useful for nodes that are of finite duration and-that get the control information they need from arguments and buses or-messages directed to their group. In addition no notifications are-sent when there are changes of state for this node, such as /go, /end,-/on, /off.--If you use a node ID of -1 for any other command, such as /n_map, then-it refers to the most recently created node by /s_new (auto generated-ID or not). This is how you can map the controls of a node with an-auto generated ID. In a multi-client situation, the only way you can-be sure what node -1 refers to is to put the messages in a bundle.
− Help/Server/s_newargs.help.lhs
@@ -1,32 +0,0 @@-/s_newargs create a new synth--string - synth definition name-int - synth ID-int - add action (0,1,2, 3 or 4 see below)-int - add target ID-[- int|string - a control index or name- int - number of sequential controls to change (M)- [- float - a control value- ] * M-] * N--Note: this command is inherently problematic when used with -graphs generated by hsc3 since, as a rule, it is not possible-to fix the ordering of control variables.--> import Sound.SC3--> let { ks n is = let { js = (Nothing : map Just [1..])-> ; f (i,j) = control KR (maybe n ((n ++) . show) j) i }-> in mce (reverse (map f (zip is js)))-> ; f = ks "f" [1,2,3,4]-> ; g = out 0 (mix (sinOsc AR f 0 * 0.1))-> ; fs = [440, 450, 600, 700]-> ; a fd = do { async fd (d_recv (synthdef "g" g))-> ; send fd (s_newargs "g" (-1) AddToTail 1 [("f", fs)]) } }-> in do { print g-> ; withSC3 a }--> s_newargs "g" (-1) AddToTail 1 [("f", [440, 450, 600, 700])]
+ Help/Server/s_noid.help.hs view
@@ -0,0 +1,1 @@+ Sound.Sc3.Lang.Help.viewServerHelp "/s_noid"
− Help/Server/s_noid.help.lhs
@@ -1,11 +0,0 @@-/s_noid Auto-reassign synth's ID to a reserved value--[- int - synth ID-] * N--This command is used when the client no longer needs to communicate-with the synth and wants to have the freedom to reuse the ID. The-server will reassign this synth to a reserved negative number. This-command is purely for bookkeeping convenience of the client. No-notification is sent when this occurs.
+ Help/Server/status.help.hs view
@@ -0,0 +1,5 @@+ Sound.Sc3.Lang.Help.viewServerHelp "/status"++> import Sound.Sc3 {- hsc3 -}++ withSc3 serverStatus >>= mapM putStrLn
− Help/Server/status.help.lhs
@@ -1,16 +0,0 @@-/status query the status--No arguments.--Replies to sender with the following message.--/status.reply- int - unused- int - number of unit generators- int - number of synths- int - number of groups- int - number of loaded synth definitions- float - average percent CPU usage for signal processing- float - peak percent CPU usage for signal processing- double - nominal sample rate- double - actual sample rate
+ Help/Server/sync.help.hs view
@@ -0,0 +1,1 @@+ Sound.Sc3.Lang.Help.viewServerHelp "/sync"
− Help/Server/sync.help.lhs
@@ -1,9 +0,0 @@-/sync notify when async commands have completed.--int - a unique number identifying this command.--Replies with a /synced message when all asynchronous commands received-before this one have completed. The reply will contain the sent unique-ID.--Asynchronous. Replies to sender with /synced, ID when complete.
+ Help/Server/tr.help.hs view
@@ -0,0 +1,1 @@+ Sound.Sc3.Lang.Help.viewServerHelp "/tr"
− Help/Server/tr.help.lhs
@@ -1,13 +0,0 @@-/tr a trigger message--int - node ID-int - trigger ID-float - trigger value--This command is the mechanism that synths can use to trigger events in-clients.--The node ID is the node that is sending the trigger. The trigger ID-and value are determined by inputs to the SendTrig unit generator-which is the originator of this message.-
+ Help/Server/u_cmd.help.hs view
@@ -0,0 +1,1 @@+ Sound.Sc3.Lang.Help.viewServerHelp "/u_cmd"
− Help/Server/u_cmd.help.lhs
@@ -1,9 +0,0 @@-/u_cmd Send a command to a unit generator--int - node ID-int - unit generator index-string - command name-...any arguments--Sends all arguments following the command name to the unit generator-to be performed. Commands are defined by unit generator plug ins.
− Help/UGen/Analysis/amplitude.help.lhs
@@ -1,18 +0,0 @@-amplitude r i at rt-- r - operating rate- i - input- at - attack time (0.01)- rt - release time (0.01)--Amplitude follower. Tracks the peak amplitude of a signal.--> import Sound.SC3--> let { s = in' 1 AR numOutputBuses-> ; a = amplitude KR s 0.1 0.1 }-> in audition (out 0 (pulse AR 90 0.3 * a))--> let { s = in' 1 AR numOutputBuses-> ; f = amplitude KR s 0.1 0.1 * 1200 + 400 }-> in audition (out 0 (sinOsc AR f 0 * 0.3))
− Help/UGen/Analysis/compander.help.lhs
@@ -1,77 +0,0 @@-compander input control thresh slopeBelow slopeAbove clampTime relaxTime--Compressor, expander, limiter, gate, ducker. General purpose dynamics-processor.--input: The signal to be compressed / expanded / gated.--control: The signal whose amplitude determines the gain applied to the- input signal. Often the same as in (for standard gating or- compression) but should be different for ducking.--thresh: Control signal amplitude threshold, which determines the break- point between slopeBelow and slopeAbove. Usually 0..1. The- control signal amplitude is calculated using RMS.--slopeBelow: Slope of the amplitude curve below the threshold. If this- slope > 1.0, the amplitude will drop off more quickly the- softer the control signal gets when the control signal is- close to 0 amplitude, the output should be exactly zero --- hence, noise gating. Values < 1.0 are possible, but it- means that a very low-level control signal will cause the- input signal to be amplified, which would raise the noise- floor.--slopeAbove: Same thing, but above the threshold. Values < 1.0 achieve- compression (louder signals are attenuated) > 1.0, you get- expansion (louder signals are made even louder). For 3:1- compression, you would use a value of 1/3 here.--clampTime: The amount of time it takes for the amplitude adjustment to- kick in fully. This is usually pretty small, not much more- than 10 milliseconds (the default value).--relaxTime: The amount of time for the amplitude adjustment to be- released. Usually a bit longer than clampTime if both times- are too short, you can get some (possibly unwanted)- artifacts.--Example signal to process.--> import Sound.SC3--> let { e = decay2 (impulse AR 8 0 * lfSaw KR 0.3 0 * 0.3) 0.001 0.3-> ; p = mix (pulse AR (mce [80, 81]) 0.3) }-> in audition (out 0 (e * p))--Noise gate--> let { e = decay2 (impulse AR 8 0 * lfSaw KR 0.3 0 * 0.3) 0.001 0.3-> ; p = mix (pulse AR (mce [80, 81]) 0.3)-> ; z = e * p-> ; x = mouseX KR 0.01 1 Linear 0.1 }-> in audition (out 0 (mce [z, compander z z x 10 1 0.01 0.01]))--Compressor--> let { e = decay2 (impulse AR 8 0 * lfSaw KR 0.3 0 * 0.3) 0.001 0.3-> ; p = mix (pulse AR (mce [80, 81]) 0.3)-> ; z = e * p-> ; x = mouseX KR 0.01 1 Linear 0.1 }-> in audition (out 0 (mce [z, compander z z x 1 0.5 0.01 0.01]))--Limiter--> let { e = decay2 (impulse AR 8 0 * lfSaw KR 0.3 0 * 0.3) 0.001 0.3-> ; p = mix (pulse AR (mce [80, 81]) 0.3)-> ; z = e * p-> ; x = mouseX KR 0.01 1 Linear 0.1 }-> in audition (out 0 (mce [z, compander z z x 1 0.1 0.01 0.01]))--Sustainer--> let { e = decay2 (impulse AR 8 0 * lfSaw KR 0.3 0 * 0.3) 0.001 0.3-> ; p = mix (pulse AR (mce [80, 81]) 0.3)-> ; z = e * p-> ; x = mouseX KR 0.01 1 Linear 0.1 }-> in audition (out 0 (mce [z, compander z z x 0.1 1.0 0.01 0.01]))
− Help/UGen/Analysis/pitch.help.lhs
@@ -1,32 +0,0 @@-pitch in initFreq minFreq maxFreq execFreq maxBinsPerOctave median- ampThreshold peakThreshold downSample--Autocorrelation pitch follower--This is a better pitch follower than ZeroCrossing, but more costly of-CPU. For most purposes the default settings can be used and only in-needs to be supplied. Pitch returns two values (via an Array of-OutputProxys, see the OutputProxy help file), a freq which is the-pitch estimate and hasFreq, which tells whether a pitch was-found. Some vowels are still problematic, for instance a wide open-mouth sound somewhere between a low pitched short 'a' sound as in-'sat', and long 'i' sound as in 'fire', contains enough overtone-energy to confuse the algorithm.--Default values at sclang are: in = 0, initFreq = 440, minFreq = 60,-maxFreq = 4000, execFreq = 100, maxBinsPerOctave = 16, median = 1,-ampThreshold = 0.01, peakThreshold = 0.5, downSample = 1.--> import Sound.SC3--> let { x = mouseX KR 220 660 Linear 0.1-> ; y = mouseY KR 0.05 0.25 Linear 0.1-> ; s = sinOsc AR x 0 * y-> ; a = amplitude KR s 0.05 0.05-> ; f = pitch s 440 60 4000 100 16 7 0.02 0.5 1 }-> in audition (out 0 (mce [s, sinOsc AR (mceChannel 0 f / 2) 0 * a]))--> let { s = in' 1 AR numOutputBuses-> ; a = amplitude KR s 0.1 0.1-> ; f = pitch s 440 60 4000 100 16 7 0.02 0.5 1 }-> in audition (out 0 (mce [s, sinOsc AR (mceChannel 0 f) 0 * a]))
− Help/UGen/Analysis/runningSum.help.lhs
@@ -1,13 +0,0 @@-runningSum in numSamp--A running sum over a user specified number of samples, useful for-running RMS power windowing.--in - Input signal-numsamp - How many samples to take the running sum over - (initialisation rate)--> import Sound.SC3--> let a = runningSum (in' 1 AR numOutputBuses) 40 * (1/40)-> in audition (out 0 (sinOsc AR 440 0 * a))
− Help/UGen/Analysis/slope.help.lhs
@@ -1,21 +0,0 @@-slope in--Slope of signal. Measures the rate of change per second of a-signal. Formula implemented is:--out[i] = (in[i] - in[i-1]) * sampling_rate--in - input signal to measure.--In the example below a is quadratic noise, b first derivative line-segments, and c second derivative constant segments.--> import Sound.SC3--> do { a <- lfNoise2 KR 2-> ; let { s = 1/2-> ; b = slope a * s-> ; c = slope b * squared s -> ; f = mce [a, b, c] * 220 + 220-> ; o = sinOsc AR f 0 * (1/3) }-> in audition (out 0 (mix o)) }
− Help/UGen/Analysis/zeroCrossing.help.lhs
@@ -1,15 +0,0 @@-zeroCrossing in--Zero crossing frequency follower.--Outputs a frequency based upon the distance between interceptions of-the X axis. The X intercepts are determined via linear interpolation-so this gives better than just integer wavelength resolution. This is-a very crude pitch follower, but can be useful in some situations.--in - input signal.--> import Sound.SC3--> let a = sinOsc AR (sinOsc KR 1 0 * 600 + 700) 0 * 0.1-> in audition (out 0 (mce [a, impulse AR (zeroCrossing a) 0 * 0.25]))
− Help/UGen/Buffer/bufAllpassC.help.lhs
@@ -1,28 +0,0 @@-bufAllpassC buf in delayTime decayTime--Buffer based all pass delay line with cubic interpolation--All pass delay line with cubic interpolation which uses a buffer-for its internal memory. See also BufAllpassN which uses no-interpolation, and BufAllpassL which uses linear-interpolation. Cubic interpolation is more computationally-expensive than linear, but more accurate.--See also AllpassC.--buf - buffer number.-in - the input signal.-delaytime - delay time in seconds.-decaytime - time for the echoes to decay by 60 decibels. If this- time is negative then the feedback coefficient will be- negative, thus emphasizing only odd harmonics at an- octave lower.--> import Sound.SC3.Monadic--> withSC3 (\fd -> async fd (b_alloc 0 44100 1))--> do { d <- dust AR 1-> ; n <- whiteNoise AR-> ; let x = decay d 0.2 * n * 0.25-> in audition (out 0 (bufAllpassC 0 x 0.25 6)) }
− Help/UGen/Buffer/bufAllpassL.help.lhs
@@ -1,1 +0,0 @@-See bufAllpassC.
− Help/UGen/Buffer/bufAllpassN.help.lhs
@@ -1,1 +0,0 @@-See bufAllpassC.
− Help/UGen/Buffer/bufChannels.help.lhs
@@ -1,5 +0,0 @@-bufChannels bufnum--Current number of channels of buffer. Using at .ir is not the-safest choice. Since a buffer can be reallocated at any time, using-ir will not track the changes.
− Help/UGen/Buffer/bufCombC.help.lhs
@@ -1,26 +0,0 @@-bufCombC buf in delayTime decayTime--Buffer based comb delay line with cubic interpolation--All pass delay line with cubic interpolation which uses a buffer-for its internal memory. See also BufCombN which uses no-interpolation, and BufCombL which uses linear interpolation. Cubic-interpolation is more computationally expensive than linear, but-more accurate. See also CombC.--buf - buffer number.-in - the input signal.-delaytime - delay time in seconds.-decaytime - time for the echoes to decay by 60 decibels. If this- time is negative then the feedback coefficient will be- negative, thus emphasizing only odd harmonics at an- octave lower.--> import Sound.SC3.Monadic--> withSC3 (\fd -> async fd (b_alloc 0 44100 1))--> do { d <- dust AR 1-> ; n <- whiteNoise AR-> ; let x = decay d 0.2 * n * 0.25-> in audition (out 0 (bufCombC 0 x 0.25 6)) }
− Help/UGen/Buffer/bufCombL.help.lhs
@@ -1,1 +0,0 @@-See bufCombC.
− Help/UGen/Buffer/bufCombN.help.lhs
@@ -1,1 +0,0 @@-See bufCombC.
− Help/UGen/Buffer/bufDelayC.help.lhs
@@ -1,24 +0,0 @@-bufDelayC buf in delayTime--Buffer based simple delay line with cubic interpolation.--Simple delay line with cubic interpolation which uses a buffer for-its internal memory. See also BufDelayN which uses no-interpolation, and BufDelayL which uses linear interpolation. Cubic-interpolation is more computationally expensive than linear, but-more accurate.--See also DelayC.--buf - buffer number.-in - the input signal.-delaytime - delay time in seconds.--> import Sound.SC3.Monadic--> withSC3 (\fd -> async fd (b_alloc 0 44100 1))--> do { d <- dust AR 1-> ; n <- whiteNoise AR-> ; let x = decay d 0.5 * n * 0.3-> in audition (out 0 (bufDelayC 0 x 0.2 + x)) }
− Help/UGen/Buffer/bufDelayL.help.lhs
@@ -1,1 +0,0 @@-See bufDelayC.
− Help/UGen/Buffer/bufDelayN.help.lhs
@@ -1,1 +0,0 @@-See bufDelayC.
− Help/UGen/Buffer/bufDur.help.lhs
@@ -1,12 +0,0 @@-bufDur rate bufnum--Current duration of buffer (in seconds).--> import Sound.SC3--> let fn = "/home/rohan/audio/metal.wav"-> in withSC3 (\fd -> async fd (b_allocRead 0 fn 0 0))--> let { t = impulse AR (recip (bufDur KR 0)) 0-> ; p = sweep t (bufSampleRate KR 0) }-> in audition (out 0 (bufRdL 1 AR 0 p NoLoop))
− Help/UGen/Buffer/bufFrames.help.lhs
@@ -1,17 +0,0 @@-bufFrames rate bufnum--Current duration of buffer.--> import Sound.SC3--> let fn = "/home/rohan/audio/metal.wav"-> in withSC3 (\fd -> async fd (b_allocRead 0 fn 0 0))--> let p = phasor AR 0 (bufRateScale KR 0) 0 (bufFrames KR 0) 0-> in audition (out 0 (bufRdL 1 AR 0 p NoLoop))--Mouse location drags play head.--> let { r = mce [0.05, 0.075 .. 0.15]-> ; p = k2A (mouseX KR 0 (bufFrames KR 0) Linear r) }-> in audition (out 0 (mix (bufRdL 1 AR 0 p NoLoop)))
− Help/UGen/Buffer/bufRateScale.help.lhs
@@ -1,13 +0,0 @@-bufRateScale rate bufnum--Buffer rate scaling in respect to server samplerate. Returns a-ratio by which the playback of a soundfile is to be scaled.--> import Sound.SC3.Monadic--> let fn = "/home/rohan/audio/metal.wav"-> in withSC3 (\fd -> async fd (b_allocRead 0 fn 0 0))--> let { r = 1.25 * bufRateScale KR 0-> ; p = phasor AR 0 r 0 (bufFrames KR 0) 0 }-> in audition (out 0 (bufRdL 1 AR 0 p NoLoop))
− Help/UGen/Buffer/bufRd.help.lhs
@@ -1,28 +0,0 @@-bufRd numChannels rate bufnum phase loop interpolation--Plays the content of a buffer.--The number of channels must be a fixed integer. The architechture-of the SynthDef cannot change after it is compiled. NOTE: if you-supply a bufnum of a buffer that has a different numChannels then-you have specified to the BufRd, it will fail silently.--The interpolation value should be either NoInterpolation,-LinearInterpolation, CubicInterpolation or (Interpolation UGen).--> import Sound.SC3--> let fn = "/home/rohan/audio/metal.wav"-> in withSC3 (\fd -> send fd (b_allocRead 0 fn 0 0))--> let phase = (sinOsc AR 0.1 0 * bufFrames KR 0)-> in audition (out 0 (bufRd 1 AR 0 phase Loop NoInterpolation))--There are constructors, bufRdN, bufRdL, and bufRdC for the fixed-cases.--> import Sound.SC3.ID--> let { x = mouseX KR (mce [5, 10]) 100 Linear 0.1-> ; n = lfNoise1 'a' AR x }-> in audition (out 0 (bufRdL 1 AR 0 (n * bufFrames KR 0) Loop))
− Help/UGen/Buffer/bufSampleRate.help.lhs
@@ -1,14 +0,0 @@-bufSampleRate rate bufnum--Buffer sample rate.--> import Sound.SC3--> let fn = "/home/rohan/audio/metal.wav"-> in withSC3 (\fd -> async fd (b_allocRead 0 fn 0 0))--Compare a sine tone derived from sample rate of a buffer with a-440Hz tone.--> let f = mce [bufSampleRate KR 0 * 0.01, 440]-> in audition (out 0 (sinOsc AR f 0 * 0.1))
− Help/UGen/Buffer/detectIndex.help.lhs
@@ -1,22 +0,0 @@-detectIndex bufnum in--Search a table for a value and return the index where the value is-located.--Allocate and set values at buffer 10.--> import Sound.SC3--> withSC3 (\fd -> do { async fd (b_alloc 10 6 1)-> ; send fd (b_setn 10 [(0, [2, 3, 4, 0, 1, 5])]) })--Find indexes and map to an audible frequency range.--> let { n = 6-> ; x = floorE (mouseX KR 0 n Linear 0.1)-> ; i = detectIndex 10 x }-> in audition (out 0 (sinOsc AR (linExp i 0 n 200 700) 0 * 0.1))--Free buffer.--> withSC3 (\fd -> send fd (b_free 10))
− Help/UGen/Buffer/index.help.lhs
@@ -1,21 +0,0 @@-index bufnum in--Index into a table with a signal. The input signal value is-truncated to an integer value and used as an index into the table.-Out of range index values are clipped to the valid range.--Allocate and set values at buffer 10.--> import Sound.SC3--> withSC3 (\fd -> do { async fd (b_alloc 10 6 1)-> ; send fd (b_setn 10 [(0, [50, 100, 200, 400, 800, 1600])]) })--Index into the above buffer for frequency values.--> let f = index 10 (lfSaw KR 2 3 * 4)-> in audition (out 0 (sinOsc AR (mce [f, f * 9]) 0 * 0.1))--Free buffer.--> withSC3 (\fd -> send fd (b_free 10))
− Help/UGen/Buffer/indexInBetween.help.lhs
@@ -1,23 +0,0 @@-indexInBetween bufnum in--Interpolating index search into a sorted table with a signal.--Allocate and set values at buffer 10.--> import Sound.SC3--> withSC3 (\fd -> do { async fd (b_alloc 10 6 1)-> ; send fd (b_setn 10 [(0, [200, 210, 400, 430, 600, 800])]) })--Index into the above buffer for frequency values.--> let { f0 = mouseX KR 200 900 Linear 0.1-> ; i = indexInBetween 10 f0-> ; l0 = index 10 i-> ; l1 = index 10 (i + 1)-> ; f1 = linLin (frac i) 0 1 l0 l1 }-> in audition (out 0 (sinOsc AR (mce [f0, f1]) 0 * 0.1))--Free buffer.--> withSC3 (\fd -> send fd (b_free 10))
− Help/UGen/Buffer/osc.help.lhs
@@ -1,48 +0,0 @@-osc rate bufnum freq phase--Linear interpolating wavetable lookup oscillator with frequency and-phase modulation inputs.--This oscillator requires a buffer to be filled with a wavetable-format signal. This preprocesses the Signal into a form which can-be used efficiently by the Oscillator. The buffer size must be a-power of 2.--This can be acheived by creating a Buffer object and sending it one-of the "b_gen" messages ( sine1, sine2, sine3 ) with the wavetable-flag set to true.--Note about wavetables: OscN requires the b_gen sine1 wavetable flag-to be OFF. Osc requires the b_gen sine1 wavetable flag to be ON.--> import Sound.SC3--> withSC3 (\fd -> do { async fd (b_alloc 10 512 1)-> ; send fd (b_gen 10 "sine1" [1 + 2 + 4, 1, 1/2, 1/3, 1/4, 1/5]) })--> audition (out 0 (osc AR 10 220 0 * 0.1))--Modulate freq--> let f = xLine KR 2000 200 1 DoNothing-> in audition (out 0 (osc AR 10 f 0 * 0.1))--Modulate freq--> let f = osc AR 10 (xLine KR 1 1000 9 RemoveSynth) 0 * 200 + 800-> in audition (out 0 (osc AR 10 f 0 * 0.1))--Modulate phase--> let p = osc AR 10 (xLine KR 20 8000 10 RemoveSynth) 0 * 2 * pi-> in audition (out 0 (osc AR 10 800 p * 0.1))--Change the buffer while its playing--> audition (out 0 (osc AR 10 220 0 * 0.1))--> import System.Random--> do { r <- getStdRandom (randomR (0.0,1.0))-> ; let g = b_gen 10 "sine1" [1 + 2 + 4, 1, r, 1/4]-> in withSC3 (\fd -> send fd g) }
− Help/UGen/Buffer/playBuf.help.lhs
@@ -1,74 +0,0 @@-playBuf numChannels bufnum rate trigger startPos loop--Sample playback oscillator. Plays back a memory resident sample.--numChannels - number of channels that the buffer will be. This- must be a fixed integer. The architechture of the- SynthDef cannot change after it is compiled.- Warning: if you supply a bufnum of a buffer that- has a different numChannels then you have specified- to the PlayBuf, it will fail silently.--bufnum - the index of the buffer to use--rate - 1.0 is the server's sample rate, 2.0 is one octave up, 0.5- is one octave down -1.0 is backwards normal rate- etc. Interpolation is cubic. Note: If the buffer's- sample rate is different from the server's, you will- need to multiply the desired playback rate by (file's- rate / server's rate). The UGen BufRateScale.kr(bufnum)- returns this factor. See examples below. BufRateScale- should be used in virtually every case.--trigger - a trigger causes a jump to the startPos. A trigger occurs- when a signal changes from <= 0 to > 0.--startPos - sample frame to start playback (k-rate).--loop - 1 means true, 0 means false. This is modulate-able.--Allocate buffer.--> import Sound.SC3--> let fileName = "/home/rohan/audio/metal.wav"-> in withSC3 (\fd -> async fd (b_allocRead 10 fileName 0 0))--Play once only.--> let s = bufRateScale KR 10-> in audition (out 0 (playBuf 1 10 s 1 0 NoLoop RemoveSynth))--Play in infinite loop.--> let s = bufRateScale KR 10-> in audition (out 0 (playBuf 1 10 s 1 0 Loop DoNothing))--Trigger playback at each pulse.--> let { t = impulse KR 2 0-> ; s = bufRateScale KR 10 }-> in audition (out 0 (playBuf 1 10 s t 0 NoLoop DoNothing))--Trigger playback at each pulse (diminishing intervals).--> let { f = xLine KR 0.1 100 10 RemoveSynth-> ; t = impulse KR f 0 -> ; s = bufRateScale KR 10 }-> in audition (out 0 (playBuf 1 10 s t 0 NoLoop DoNothing))--Loop playback, accelerating pitch.--> let r = xLine KR 0.1 100 60 RemoveSynth-> in audition (out 0 (playBuf 1 10 r 1 0 Loop DoNothing))--Sine wave control of playback rate, negative rate plays backwards.--> let { f = xLine KR 0.2 8 30 RemoveSynth-> ; r = fSinOsc KR f 0 * 3 + 0.6-> ; s = bufRateScale KR 10 * r }-> in audition (out 0 (playBuf 1 10 s 1 0 Loop DoNothing))--Release buffer.--> withSC3 (\fd -> send fd (b_free 10))
− Help/UGen/Buffer/recordBuf.help.lhs
@@ -1,1 +0,0 @@-recordBuf bufnum offset reclevel prelevel run loop trigger doneAction inputs
− Help/UGen/Buffer/vOsc.help.lhs
@@ -1,51 +0,0 @@-vOsc rate bufpos freq phase--Variable wavetable oscillator. A wavetable lookup oscillator which-can be swept smoothly across wavetables. All the wavetables must be-allocated to the same size. Fractional values of table will-interpolate between two adjacent tables.--This oscillator requires a buffer to be filled with a wavetable-format signal. This preprocesses the Signal into a form which can-be used efficiently by the Oscillator. The buffer size must be a-power of 2.--This can be acheived by creating a Buffer object and sending it one-of the "b_gen" messages (sine1, sine2, sine3) with the wavetable-flag set to true.--This can also be acheived by creating a Signal object and sending-it the 'asWavetable' message, saving it to disk, and having the-server load it from there.--Note about wavetables: VOsc requires the b_gen sine1 wavetable flag-to be ON.--Allocate and fill tables 0 to 7.--> import Sound.SC3--> let { square a = a * a-> ; harm i = let { n = square (i + 1)-> ; f j = square ((n - j) / n) }-> in map f [0 .. n - 1]-> ; setup fd i = do { i' <- return (fromIntegral i)-> ; async fd (b_alloc i 1024 1)-> ; send fd (b_gen i "sine1" (1 + 2 + 4 : harm i')) } }-> in withSC3 (\fd -> mapM_ (setup fd) [0 .. 7])--Oscillator at buffers 0 through 7, mouse selects buffer.--> let x = mouseX KR 0 7 Linear 0.1-> in audition (out 0 (vOsc AR x (mce [120, 121]) 0 * 0.3))--Reallocate buffers while oscillator is running.--> import Control.Monad-> import System.Random--> let { rrand l r = getStdRandom (randomR (l,r))-> ; rrandl n l r = replicateM n (rrand l r)-> ; resetTable fd i = do { h <- rrandl 12 0 1-> ; send fd (b_gen i "sine1" (1 + 2 + 4 : h)) } }-> in withSC3 (\fd -> mapM_ (resetTable fd) [0 .. 7])
− Help/UGen/Chaos/crackle.help.lhs
@@ -1,15 +0,0 @@-crackle rate chaosParam--A noise generator based on a chaotic function. The parameter of-the chaotic function has useful values from just below 1.0 to just-above 2.0. Towards 2.0 the sound crackles.--The equation implemented is: y0 = fabs(y1 * param - y2 - 0.05f)--> import Sound.SC3--> audition (out 0 (crackle AR 1.95 * 0.2))--Modulate chaos parameter--> audition (out 0 (crackle AR (line KR 1.0 2.0 3 RemoveSynth) * 0.2))
− Help/UGen/Chaos/cuspL.help.lhs
@@ -1,31 +0,0 @@-cuspN rate freq a b xi-cuspL rate freq a b xi--freq - iteration frequency in Hertz-a, b - equation variables-xi - initial value of x--Cusp map chaotic generator. Non- and linear- interpolating sound-generator based on the difference equation:--xn+1 = a - b*sqrt(|xn|)--Vary frequency--> import Sound.SC3--> let x = mouseX KR 20 sampleRate Linear 0.1-> in audition (out 0 (cuspL AR x 1.0 1.99 0 * 0.3))--Mouse-controlled parameters.--> let { x = mouseX KR 0.9 1.1 Linear 0.1-> ; y = mouseY KR 1.8 2.0 Linear 0.1 }-> in audition (out 0 (cuspL AR (sampleRate / 4) x y 0 * 0.3))--As frequency control.--> let { x = mouseX KR 0.9 1.1 Linear 0.1-> ; y = mouseY KR 1.8 2.0 Linear 0.1-> ; n = cuspL AR 40 x y 0 * 0.3 }-> in audition (out 0 (sinOsc AR (n * 800 + 900) 0 * 0.4))
− Help/UGen/Chaos/cuspN.help.lhs
@@ -1,1 +0,0 @@-See cuspL.
− Help/UGen/Chaos/fbSineC.help.lhs
@@ -1,54 +0,0 @@-fbSineC rate freq im fb a c xi yi-fbSineL rate freq im fb a c xi yi-fbSineN rate freq im fb a c xi yi--Feedback sine with chaotic phase indexing.--freq - iteration frequency in Hz - 22050-im - index multiplier amount - 1-fb - feedback amount - 0.1-a - phase multiplier amount - 1.1-c - phase increment amount - 0.5-xi - initial value of x - 0.1-yi - initial value of y - 0.1--A cubic-interpolating sound generator based on the difference-equations:- - xn+1 = sin(im*yn + fb*xn)- yn+1 = (ayn + c) % 2pi--This uses a linear congruential function to drive the phase-indexing of a sine wave. For im = 1, fb = 0, and a = 1 a normal-sinewave results.--sclang default values--> import Sound.SC3--> let o = fbSineC AR (sampleRate / 4) 1 0.1 1.1 0.5 0.1 0.1 * 0.2-> in audition (out 0 o)--Increase feedback--> let { fb = line KR 0.01 4 10 DoNothing-> ; o = fbSineC AR sampleRate 1 fb 1.1 0.5 0.1 0.1 * 0.2 }-> in audition (out 0 o)--Increase phase multiplier--> let { a = line KR 1 2 10 DoNothing-> ; o = fbSineC AR sampleRate 1 0 a 0.5 0.1 0.1 * 0.2 }-> in audition (out 0 o)--Randomly modulate parameters--> let { madd a m = return . (+ a) . (* m)-> ; x = mouseX KR 1 12 Linear 0.1 -> ; n = lfNoise2 KR x }-> in do { n0 <- madd 1e4 1e4 =<< n-> ; n1 <- madd 33 32 =<< n-> ; n2 <- madd 0 0.5 =<< n-> ; n3 <- madd 1.05 0.05 =<< n-> ; n4 <- madd 0.3 0.3 =<< n-> ; audition (out 0 (fbSineC AR n0 n1 n2 n3 n4 0.1 0.1 * 0.2)) }
− Help/UGen/Chaos/fbSineL.help.lhs
@@ -1,1 +0,0 @@-See fbSineC.
− Help/UGen/Chaos/fbSineN.help.lhs
@@ -1,1 +0,0 @@-See fbSineC.
− Help/UGen/Chaos/henonC.help.lhs
@@ -1,1 +0,0 @@-See henonN.
− Help/UGen/Chaos/henonL.help.lhs
@@ -1,1 +0,0 @@-See henonN.
− Help/UGen/Chaos/henonN.help.lhs
@@ -1,46 +0,0 @@-henonN rate freq a b x0 x1-henonL rate freq a b x0 x1-henonC rate freq a b x0 x1--Henon map chaotic generator.--freq - iteration frequency in Hertz -- 22050-a, b - equation variables -- 1.4, 0.3-x0, x1 - initial and second values of x -- 0, 0--A non-interpolating sound generator based on the difference-equation:-- xn + 2 = 1 - axn + 12 + bxn--This equation was discovered by French astronomer Michel Henon-while studying the orbits of stars in globular clusters.--With default initial parameters.--> import Sound.SC3--> let x = mouseX KR 20 sampleRate Linear 0.1-> in audition (out 0 (henonN AR x 1.4 0.3 0 0 * 0.1))--With mouse-control of parameters.--> let { x = mouseX KR 1 1.4 Linear 0.1-> ; y = mouseY KR 0 0.3 Linear 0.1 }-> in audition (out 0 (henonN AR (sampleRate / 4) x y 0 0 * 0.1))--With randomly modulated parameters.--> import Sound.SC3.Monadic--> do { n0 <- return . (+ 1.20) . (* 0.20) =<< lfNoise2 KR 1-> ; n1 <- return . (+ 0.15) . (* 0.15) =<< lfNoise2 KR 1-> ; audition (out 0 (henonN AR (sampleRate / 8) n0 n1 0 0 * 0.1)) }--As a frequency control.--> let { x = mouseX KR 1 1.4 Linear 0.1-> ; y = mouseY KR 0 0.3 Linear 0.1-> ; f0 = 40 -> ; f = henonN AR f0 x y 0 0 * 800 + 900 }-> in audition (out 0 (sinOsc AR f 0 * 0.4))
− Help/UGen/Chaos/latoocarfianC.help.lhs
@@ -1,42 +0,0 @@-latoocarfianC rate freq a b c d xi yi-latoocarfianL rate freq a b c d xi yi-latoocarfianN rate freq a b c d xi yi--This is a function given in Clifford Pickover's book Chaos In-Wonderland, pg 26. The function has four parameters a, b, c, and-d. The function is:-- xnew = sin(y * b) + c * sin(x * b)- ynew = sin(x * a) + d * sin(y * a)- x = xnew- y = ynew- output = x--According to Pickover, parameters a and b should be in the range-from -3 to +3, and parameters c and d should be in the range from-0.5 to 1.5. The function can, depending on the parameters given,-give continuous chaotic output, converge to a single value-(silence) or oscillate in a cycle (tone). This UGen is-experimental and not optimized currently, so is rather hoggish of-CPU.--sclang default initial parameters.--> import Sound.SC3--> let x = mouseX KR 20 sampleRate Linear 0.1-> in audition (out 0 (latoocarfianC AR x 1 3 0.5 0.5 0.5 0.5 * 0.2))--Randomly modulate all parameters.--> import Control.Monad-> import Sound.SC3.Monadic--> do { [n0, n1, n2, n3] <- replicateM 4 (lfNoise2 KR 5)-> ; let { f = sampleRate / 4-> ; a = n0 * 1.5 + 1.5-> ; b = n1 * 1.5 + 1.5-> ; c = n2 * 0.5 + 1.5-> ; d = n3 * 0.5 + 1.5 -> ; o = latoocarfianC AR f a b c d 0.5 0.5 * 0.2 }-> in audition (out 0 o) }
− Help/UGen/Chaos/linCongC.help.lhs
@@ -1,36 +0,0 @@-linCongC rate freq a c m xi-linCongL rate freq a c m xi-linCongN rate freq a c m xi--Linear congruential chaotic generator.--freq - iteration frequency in Hertz-a - multiplier amount-c - increment amount-m - modulus amount-xi - initial value of x--A cubic-interpolating sound generator based on the difference-equation:-- xn+1 = (axn + c) % m--The output signal is automatically scaled to a range of [-1, 1].---Default initial parameters.--> import Sound.SC3--> let x = mouseX KR 20 sampleRate Linear 0.1-> in audition (out 0 (linCongC AR x 1.1 0.13 1 0 * 0.2))--Randomly modulate parameters.--> import Sound.SC3.Monadic--> do { [n0, n1, n2, m] <- mapM (lfNoise2 KR) [1.0, 0.1, 0.1, 0.1]-> ; let { f = n0 * 1e4 + 1e4-> ; a = n1 * 0.5 + 1.4-> ; c = n2 * 0.1 + 0.1 }-> in audition (out 0 (linCongC AR f a c m 0 * 0.2)) }
− Help/UGen/Chaos/linCongL.help.lhs
@@ -1,1 +0,0 @@-See linCongC.
− Help/UGen/Chaos/linCongN.help.lhs
@@ -1,1 +0,0 @@-See linCongC.
− Help/UGen/Chaos/logistic.help.lhs
@@ -1,9 +0,0 @@-logistic rate chaosParam freq--UNDOCUMENTED.--Implements the equation: y1 = param * y1 * (1.0 - y1)--> import Sound.SC3--> audition (out 0 (logistic AR 3.5699457 1000.0 0.01))
− Help/UGen/Chaos/lorenzL.help.lhs
@@ -1,45 +0,0 @@-lorenzL rate freq s r b h xi yi zi--freq - iteration frequency in Hertz-s, r, b - equation variables-h - integration time step-xi - initial value of x-yi - initial value of y-zi - initial value of z--Lorenz chaotic generator. A strange attractor discovered by Edward-N. Lorenz while studying mathematical models of the atmosphere.-The system is composed of three ordinary differential equations:--x' = s(y - x)-y' = x(r - z) - y-z' = xy - bz--The time step amount h determines the rate at which the ODE is-evaluated. Higher values will increase the rate, but cause more-instability. A safe choice is the default amount of 0.05.--Vary frequency--> import Sound.SC3--> let x = mouseX KR 20 sampleRate Linear 0.1-> in audition (out 0 (lorenzL AR x 10 27 2.667 0.05 0.1 0 0 * 0.3))--Randomly modulate params--> import Sound.SC3.Monadic--> let { madd a m = return . (+ a) . (* m)-> ; n = lfNoise0 KR 1 }-> in do { n0 <- madd 10 2 =<< n-> ; n1 <- madd 38 20 =<< n-> ; n2 <- madd 2 1.5 =<< n-> ; let o = lorenzL AR sampleRate n0 n1 n2 0.05 0.1 0 0 * 0.2-> in audition (out 0 o) }--As frequency control--> let { x = mouseX KR 1 200 Linear 0.1-> ; n = lorenzL AR x 10 28 2.667 0.05 0.1 0 0 }-> in audition (out 0 (sinOsc AR (lag n 0.003 * 800 + 900) 0 * 0.4))
− Help/UGen/Chaos/quadC.help.lhs
@@ -1,1 +0,0 @@-See quadN.
− Help/UGen/Chaos/quadL.help.lhs
@@ -1,1 +0,0 @@-See quadN.
− Help/UGen/Chaos/quadN.help.lhs
@@ -1,22 +0,0 @@-quadN rate freq a b c xi-quadL rate freq a b c xi-quadC rate freq a b c xi--freq - iteration frequency in Hertz-a, b, c - equation variables-xi - initial value of x--General quadratic map chaotic generator. Non-, linear- and cubic--interpolating sound generators based on the difference equation:-xn+1 = axn2 + bxn + c--> import Sound.SC3--> audition (out 0 (quadC AR 4000 1 (-1) (-0.75) 0 * 0.2))--> let x = mouseX KR 3.5441 4 Linear 0.1-> in audition (out 0 (quadC AR 4000 (negate x) x 0 0.1 * 0.4))--> let { x = mouseX KR 3.5441 4 Linear 0.1-> ; f = quadC AR 4 (negate x) x 0 0.1 * 800 + 900 }-> in audition (out 0 (sinOsc AR f 0 * 0.4))
− Help/UGen/Chaos/rossler.help.lhs
@@ -1,9 +0,0 @@-rossler rate chaosParam dt--The Rossler attractor is a well known chaotic function. The-chaosParam can be varied from 1.0 to 25.0 with a dt of 0.04. Valid-ranges for chaosParam vary depending on dt.--> import Sound.SC3--> audition (out 0 (rossler AR 4 0.08))
− Help/UGen/Control/mrg2.help.lhs
@@ -1,28 +0,0 @@-mrg2 left right--mrg2 defines a node indicating a multiple root graph.--> import Sound.SC3--> let { l = out 0 (sinOsc AR 300 0 * 0.1)-> ; r = out 1 (sinOsc AR 900 0 * 0.1) }-> in audition (mrg2 l r)--there is a leftmost rule, so that mrg nodes need not-be terminal.--> let { l = sinOsc AR 300 0 * 0.1-> ; r = out 1 (sinOsc AR 900 0 * 0.1) }-> in audition (out 0 (mrg2 l r))--the leftmost node may be an mce node--> let { l = sinOsc AR (mce2 300 400) 0 * 0.1-> ; r = out 1 (sinOsc AR 900 0 * 0.1) }-> in audition (out 0 (mrg2 l r))--the implementation is not thorough--> let { l = sinOsc AR (mce2 300 400) 0 * 0.1-> ; r = out 1 (sinOsc AR 900 0 * 0.1) }-> in audition (out 0 (mrg2 l r + mrg2 l r))
− Help/UGen/Demand/dbrown.help.lhs
@@ -1,21 +0,0 @@-dbrown length lo hi step-dibrown length lo hi step--Demand rate brownian movement generators.--lo - minimum value-hi - maximum value-step - maximum step for each new value-length - number of values to create--Dbrown returns numbers in the continuous range between lo and hi,-Dibrown returns integer values. The arguments can be a number or-any other ugen.--> import Sound.SC3.Monadic--> do { n <- dbrown dinf 0 15 1-> ; let { x = mouseX KR 1 40 Exponential 0.1-> ; t = impulse KR x 0-> ; f = demand t 0 n * 30 + 340 }-> in audition (out 0 (sinOsc AR f 0 * 0.1)) }
− Help/UGen/Demand/dbufrd.help.lhs
@@ -1,40 +0,0 @@-dbufrd bufnum phase loop--Buffer demand ugen.--bufnum - buffer number to read from-phase - index into the buffer (demand ugen or any other ugen)-loop - loop when phase exceeds number of frames in buffer--> import Sound.SC3.Monadic-> import System.Random--> let n = randomRs (200.0, 500.0) (mkStdGen 0)-> in do { withSC3 (\fd -> do { async fd (b_alloc 10 24 1)-> ; send fd (b_setn 10 [(0, take 24 n)]) })-> ; s <- dseq 3 (mce [0, 3, 5, 0, 3, 7, 0, 5, 9])-> ; b <- dbrown 5 0 23 1-> ; p <- dseq dinf (mce [s, b])-> ; t <- dust KR 10-> ; r <- dbufrd 10 p Loop-> ; audition (out 0 (sinOsc AR (demand t 0 r) 0 * 0.1)) }--Buffer as a time pattern (requires buffer 10 as allocated above).--> let { i = randomRs (0, 2) (mkStdGen 0)-> ; n = map ([1, 0.5, 0.25] !!) i }-> in do { withSC3 (\fd -> do { async fd (b_alloc 11 24 1)-> ; send fd (b_setn 11 [(0, take 24 n)]) })-> ; s <- dseq 3 (mce [0, 3, 5, 0, 3, 7, 0, 5, 9])-> ; b <- dbrown 5 0 23 1-> ; p <- dseq dinf (mce [s, b])-> ; j <- dseries dinf 0 1-> ; d <- dbufrd 11 j Loop-> ; l <- dbufrd 10 p Loop-> ; let f = duty KR (d * 0.5) 0 DoNothing l-> in audition (out 0 (sinOsc AR f 0 * 0.1)) }--Free buffers--> withSC3 (\fd -> do { async fd (b_free 10)-> ; async fd (b_free 11) })
− Help/UGen/Demand/dbufwr.help.lhs
@@ -1,31 +0,0 @@-dbufwr bufnum phase input loop--Buffer demand ugen. All inputs can be either -demand ugen or any other ugen.--bufnum - buffer number to read from (single channel buffer)-phase - index into the buffer-input - single channel input-loop - when phase exceeds number of frames in buffer, - loops when set to 1 (default :1)--> import Sound.SC3.Monadic--> do { s1 <- dseries 30 0 3-> ; s2 <- dseries 30 0 1-> ; s3 <- dseries 16 1 1-> ; s4 <- dwhite 8 1 16 -> ; s5 <- dseq dinf (mce2 s3 s4)-> ; wt <- dust KR 1 {- write trigger -}-> ; rp <- dseries dinf 0 1 {- read pointer -}-> ; wp <- dseq dinf (mce2 s1 s2) {- write pointer -}-> ; r <- dbufrd 0 rp Loop {- reader -}-> ; w <- dbufwr 0 wp (s5 * 60) Loop {- writer -}-> ; let { d = demand wt 0 w-> ; f = lag (demand (impulse KR 16 0) 0 r) 0.01-> ; o = sinOsc AR (f * mce2 1 1.01) 0 * 0.1-> ; g = mrg [d, out 0 o]-> ; run fd = do { async fd (b_alloc 0 24 1)-> ; send fd (b_setn 0 [(0, (replicate 24 210))])-> ; play fd g } }-> in withSC3 run }
− Help/UGen/Demand/demand.help.lhs
@@ -1,31 +0,0 @@-demand trig reset ugens--Demand results from demand rate ugens.--When there is a trigger at the trig input, a value is demanded from-each ugen in the list and output. The unit generators in the list-should be 'demand' rate.--When there is a trigger at the reset input, the demand rate ugens-in the list are reset.--trig - Trigger can be any signal. A trigger happens when- the signal changes from non-positive to positive.--reset - Resets the list of ugens when triggered.--> import Sound.SC3.Monadic--> do { r <- dust KR 1-> ; s <- dgeom dinf (midiCPS 72) (midiRatio 1)-> ; let { t = impulse KR 10 0-> ; f = demand t r s -> ; o = sinOsc AR (mce [f, f + 0.7]) 0 }-> in audition (out 0 (max (cubed o) 0 * 0.1)) }--> do { n <- diwhite dinf 60 72-> ; let { t = impulse KR 10 0-> ; s = midiCPS n-> ; f = demand t 0 s-> ; o = sinOsc AR (mce [f, f + 0.7]) 0 }-> in audition (out 0 (cubed (cubed o) * 0.1)) }
− Help/UGen/Demand/demandEnvGen.help.lhs
@@ -1,41 +0,0 @@-demandEnvGen rate levels times shapes curves gate reset- levelScale levelOffset timeScale doneAction--levels - a demand ugen or any other ugen--times - a demand ugen or any other ugen if one of these ends,- the doneAction is evaluated--shapes - a demand ugen or any other ugen, the number given is- the shape number according to Env--curves - a demand ugen or any other ugen, if shape is 5, this- is the curve factor some curves/shapes don't work if- the duration is too short. have to see how to improve- this. also some depend on the levels obviously, like- exponential cannot cross zero.--gate - if gate is x >= 1, the ugen runs, if gate is 0 > x > 1,- the ugen is released at the next level (doneAction), if- gate is x < 0, the ugen is sampled and held--reset - if reset crosses from nonpositive to positive, the ugen- is reset at the next level, if it is > 1, it is reset- immediately.--Frequency ramp, exponential curve.--> import Sound.SC3.Monadic--> do { l <- dseq dinf (mce2 440 9600)-> ; let { y = mouseY KR 0.01 3 Exponential 0.1-> ; f = demandEnvGen AR l y 2 0 1 1 1 0 1 DoNothing }-> in audition (out 0 (sinOsc AR f 0 * 0.1)) }--Frequency envelope with random times.--> do { l <- dseq dinf (mce [204, 400, 201, 502, 300, 200])-> ; t <- drand dinf (mce [1.01, 0.2, 0.1, 2.0])-> ; let { y = mouseY KR 0.01 3 Exponential 0.1-> ; f = demandEnvGen AR l (t * y) 7 0 1 1 1 0 1 DoNothing }-> in audition (out 0 (sinOsc AR (f * mce2 1 1.01) 0 * 0.1)) }
− Help/UGen/Demand/dgeom.help.lhs
@@ -1,17 +0,0 @@-dgeom length start grow--Demand rate geometric series ugen.--start - start value-grow - value by which to grow ( x = x[-1] * grow )-length - number of values to create--The arguments can be a number or any other ugen--> import Sound.SC3.Monadic--> do { n <- dgeom 15 1 1.2-> ; let { x = mouseX KR 1 40 Exponential 0.1-> ; t = impulse KR x 0-> ; f = demand t 0 n * 30 + 340 }-> in audition (out 0 (sinOsc AR f 0 * 0.1)) }
− Help/UGen/Demand/dibrown.help.lhs
@@ -1,1 +0,0 @@-See dbrown.
− Help/UGen/Demand/diwhite.help.lhs
@@ -1,1 +0,0 @@-See dwhite.
− Help/UGen/Demand/drand.help.lhs
@@ -1,18 +0,0 @@-drand length array-dxrand length array--Demand rate random sequence generators.--length - number of values to return-array - array of values or other ugens--Dxrand never plays the same value twice, whereas Drand chooses any-value in the list.--> import Sound.SC3.Monadic--> do { n <- drand dinf (mce [1, 3, 2, 7, 8])-> ; let { x = mouseX KR 1 400 Exponential 0.1-> ; t = impulse KR x 0-> ; f = demand t 0 n * 30 + 340 }-> in audition (out 0 (sinOsc AR f 0 * 0.1)) }
− Help/UGen/Demand/dseq.help.lhs
@@ -1,22 +0,0 @@-dseq length array--Demand rate sequence generator.--array - array of values or other ugens-length - number of repeats--> import Sound.SC3.Monadic--> do { n <- dseq 3 (mce [1, 3, 2, 7, 8])-> ; let { x = mouseX KR 1 40 Exponential 0.1-> ; t = impulse KR x 0-> ; f = demand t 0 n * 30 + 340 }-> in audition (out 0 (sinOsc AR f 0 * 0.1)) }--At audio rate.--> do { n <- dseq dinf (mce [1,3,2,7,8,32,16,18,12,24])-> ; let { x = mouseX KR 1 10000 Exponential 0.1-> ; t = impulse AR x 0-> ; f = demand t 0 n * 30 + 340 }-> in audition (out 0 (sinOsc AR f 0 * 0.1)) }
− Help/UGen/Demand/dser.help.lhs
@@ -1,14 +0,0 @@-dser length array--Demand rate sequence generator.--array - array of values or other ugens-length - number of values to return--> import Sound.SC3.Monadic--> do { a <- dser 7 (mce [1, 3, 2, 7, 8])-> ; let { x = mouseX KR 1 40 Exponential 0.1-> ; t = impulse KR x 0-> ; f = demand t 0 a * 30 + 340 }-> in audition (out 0 (sinOsc AR f 0 * 0.1)) }
− Help/UGen/Demand/dseries.help.lhs
@@ -1,17 +0,0 @@-dseries length start step--Demand rate arithmetic series ugen.--length - number of values to create-start - start value-step - step value--The arguments can be a number or any other ugen--> import Sound.SC3.Monadic--> do { n <- dseries 15 0 1-> ; let { x = mouseX KR 1 40 Exponential 0.1-> ; t = impulse KR x 0-> ; f = demand t 0 n * 30 + 340 }-> in audition (out 0 (sinOsc AR f 0 * 0.1)) }
− Help/UGen/Demand/dstutter.help.lhs
@@ -1,15 +0,0 @@-dstutter n in--Demand rate input replicator.--n - number of repeats (can be a demand ugen)-in - input ugen--> import Sound.SC3.Monadic--> do { inp <- dseq dinf (mce [1, 2, 3])-> ; nse <- diwhite dinf 2 8-> ; rep <- dstutter nse inp-> ; let { trg = impulse KR (mouseX KR 1 40 Exponential 0.2) 0-> ; frq = demand trg 0 rep * 30 + 340 }-> in audition (out 0 (sinOsc AR frq 0 * 0.1)) }
− Help/UGen/Demand/dswitch.help.lhs
@@ -1,34 +0,0 @@-dswitch index array--Demand rate generator for embedding different inputs--array - array of values or other ugens-index - which of the inputs to return--In difference to dswitch1, dswitch embeds all items of -an input demand ugen first before looking up the next index.--> import Sound.SC3.Monadic--> do { a0 <- dwhite 2 3 4-> ; a1 <- dwhite 2 0 1-> ; a2 <- dseq 2 (mce [1, 1, 1, 0])-> ; i <- dseq 2 (mce [0, 1, 2, 1, 0])-> ; d <- dswitch i (mce [a0, a1, a2])-> ; let { t = impulse KR 4 0-> ; f = demand t 0 d * 300 + 400-> ; o = sinOsc AR f 0 * 0.1 }-> in audition (out 0 o) }--compare with dswitch1--> do { a0 <- dwhite 2 3 4-> ; a1 <- dwhite 2 0 1-> ; a2 <- dseq 2 (mce [1, 1, 1, 0])-> ; i <- dseq 2 (mce [0, 1, 2, 1, 0])-> ; d <- dswitch1 i (mce [a0, a1, a2])-> ; let { t = impulse KR 4 0-> ; f = demand t 0 d * 300 + 400-> ; o = sinOsc AR f 0 * 0.1 }-> in audition (out 0 o) }-
− Help/UGen/Demand/dswitch1.help.lhs
@@ -1,16 +0,0 @@-dswitch1 index array--Demand rate generator for switching between inputs--index - which of the inputs to return-array - array of values or other ugens--> import Sound.SC3.Monadic--> let { x = mouseX KR 0 4 Linear 0.1-> ; y = mouseY KR 1 15 Linear 0.1-> ; t = impulse KR 3 0 }-> in do { w <- dwhite dinf 20 23-> ; n <- dswitch1 x (mce [1, 3, y, 2, w])-> ; let f = demand t 0 n * 30 + 340-> in audition (out 0 (sinOsc AR f 0 * 0.1)) }
− Help/UGen/Demand/duty.help.lhs
@@ -1,35 +0,0 @@-duty rate duration reset doneAction level--Demand results from demand rate ugens--A value is demanded from each ugen in the list and output according-to a stream of duration values. The unit generators in the list-should be 'demand' rate. When there is a trigger at the reset-input, the demand rate ugens in the list and the duration are-reset. The reset input may also be a demand ugen, providing a-stream of reset times.--duration - time values. Can be a demand ugen or any signal. The next-value is acquired after the duration provided by the last time value.--reset - trigger or reset time values. Resets the list of ugens and-the duration ugen when triggered. The reset input may also be a-demand ugen, providing a stream of reset times.--doneAction - action evaluated when the duration stream ends.--level - demand ugen providing the output values.--> import Sound.SC3.Monadic--> do { n0 <- drand dinf (mce [0.01, 0.2, 0.4])-> ; n1 <- dseq dinf (mce [204, 400, 201, 502, 300, 200])-> ; let f = duty KR n0 0 RemoveSynth n1-> in audition (out 0 (sinOsc AR (f * mce2 1 1.01) 0 * 0.1)) }--Using control rate signal, mouseX, to determine duration.--> do { n <- dseq dinf (mce [204, 400, 201, 502, 300, 200])-> ; let { x = mouseX KR 0.001 2 Linear 0.1-> ; f = duty KR x 0 RemoveSynth n }-> in audition (out 0 (sinOsc AR (f * mce2 1 1.01) 0 * 0.1)) }
− Help/UGen/Demand/dwhite.help.lhs
@@ -1,20 +0,0 @@-dwhite length lo hi-diwhite length lo hi--Demand rate white noise random generators.--length - number of values to create-lo - minimum value-hi - maximum value--Dwhite returns numbers in the continuous range between lo and hi,-Diwhite returns integer values. The arguments can be a number or-any other ugen--> import Sound.SC3.Monadic--> do { n <- dwhite dinf 0 15-> ; let { x = mouseX KR 1 40 Exponential 0.1-> ; t = impulse KR x 0-> ; f = demand t 0 n * 30 + 340 }-> in audition (out 0 (sinOsc AR f 0 * 0.1)) }
− Help/UGen/Demand/dxrand.help.lhs
@@ -1,1 +0,0 @@-See drand.
− Help/UGen/Demand/tDuty.help.lhs
@@ -1,55 +0,0 @@-tDuty rate duration reset doneAction level gap--Demand results as trigger from demand rate ugens.--A value is demanded each ugen in the list and output as a trigger-according to a stream of duration values. The unit generators in-the list should be 'demand' rate. When there is a trigger at the-reset input, the demand rate ugens in the list and the duration are-reset. The reset input may also be a demand ugen, providing a-stream of reset times.--duration - time values. Can be a demand ugen or any signal.- The next trigger value is acquired after the- duration provided by the last time value.--reset - trigger or reset time values. Resets the list of ugens- and the duration ugen when triggered. The reset input- may also be a demand ugen, providing a stream of reset- times.--doneAction - a doneAction that is evaluated when the duration- stream ends.--level - demand ugen providing the output values.--gap - if true the dirst duration precedes the first level,- else it follows it.--Play a little rhythm--> import Sound.SC3.Monadic--> do { d <- dseq dinf (mce [0.1, 0.2, 0.4, 0.3])-> ; audition (out 0 (tDuty AR d 0 DoNothing 1 1)) }--Amplitude changes--> do { d0 <- dseq dinf (mce [0.1, 0.2, 0.4, 0.3])-> ; d1 <- dseq dinf (mce [0.1, 0.4, 0.01, 0.5, 1.0])-> ; let s = ringz (tDuty AR d0 0 DoNothing d1 1) 1000 0.1-> in audition (out 0 s) }--Mouse control.--> do { d <- dseq dinf (mce [0.1, 0.4, 0.01, 0.5, 1.0])-> ; let { x = mouseX KR 0.003 1 Exponential 0.1-> ; s = ringz (tDuty AR x 0 DoNothing d 1) 1000 0.1 }-> in audition (out 0 s) }--Note that the 440 is the shorter pitch, since gap is set to false--> do { d0 <- dser 12 (mce [0.1, 0.3])-> ; d1 <- dser 12 (mce [440, 880])-> ; let t = tDuty AR d0 0 RemoveSynth d1 0-> in audition (out 0 (sinOsc AR (latch t t) 0 * 0.1)) }
− Help/UGen/DiskIO/diskIn.help.lhs
@@ -1,23 +0,0 @@-diskIn nc b l-- nc - number of channels- b - buffer number- l - loop indicator--Continously play a soundfile from disk. This requires a buffer to-be preloaded with one buffer size of sound. The buffer size must-be a multiple of twice the synth block size. The default block size-is 64.--> import Sound.SC3--> let { f = "/home/rohan/audio/metal.wav"-> ; n = 1-> ; g = out 0 (diskIn n 0 Loop) }-> in withSC3 (\fd -> do { async fd (b_alloc 0 8192 n)-> ; async fd (b_read 0 f 0 (-1) 0 1)-> ; play fd g })--> withSC3 (\fd -> do { reset fd-> ; async fd (b_close 0)-> ; async fd (b_free 0) })
− Help/UGen/DiskIO/vDiskIn.help.lhs
@@ -1,24 +0,0 @@-vDiskIn nc b r l-- nc - number of channels- b - buffer number- r - playback rate- l - loop indicator--Continously play a soundfile from disk with variable playback-rate. This requires a buffer to be preloaded with one buffer size of-sound. The buffer size must be a multiple of twice the synth block-size. The default block size is 64.--> import Sound.SC3--> let { f = "/home/rohan/audio/metal.wav"-> ; n = 1-> ; g = out 0 (vDiskIn n 0 (sinOsc KR 0.25 0 * 0.25 + 1) Loop) }-> in withSC3 (\fd -> do { async fd (b_alloc 0 8192 n)-> ; async fd (b_read 0 f 0 (-1) 0 1)-> ; play fd g })--> withSC3 (\fd -> do { reset fd-> ; async fd (b_close 0)-> ; async fd (b_free 0) })
− Help/UGen/Envelope/detectSilence.help.lhs
@@ -1,10 +0,0 @@-detectSilence in amp time doneAction--If the signal at `in' falls below `amp' for `time' seconds then-`doneAction' is raised.--> import Sound.SC3--> let { s = sinOsc AR 440 0 * mouseY KR 0 0.4 Linear 0.1-> ; d = detectSilence s 0.1 0.2 RemoveSynth }-> in audition (mrg [out 0 s, d])
− Help/UGen/Envelope/done.help.lhs
@@ -1,12 +0,0 @@-done src--Outputs a unit signal if the 'done' flag of the unit at `src' is-set, else output zero.--> import Sound.SC3--> let { x = mouseX KR (-1) 1 Linear 0.1-> ; e = linen x 0.1 0.1 0.5 DoNothing -> ; o1 = sinOsc AR 880 0 * 0.1-> ; o2 = sinOsc AR 440 0 * e }-> in audition (out 0 (mce [ done e * o1, o2 ]))
− Help/UGen/Envelope/envCoord.help.lhs
@@ -1,11 +0,0 @@-envCoord :: [(UGen, UGen)] -> UGen -> UGen -> EnvCurve -> [UGen]--Co-ordinate (break-point) envelope--> import Sound.SC3--> let { c = EnvLin-> ; p = envCoord [(0,0), (0.5, 0.1), (0.55, 1), (1, 0)] 9 0.1 c-> ; e = envGen KR 1 1 0 1 RemoveSynth p }-> in audition (out 0 (sinOsc AR 440 0 * e))-
− Help/UGen/Envelope/envGen.help.lhs
@@ -1,32 +0,0 @@-envGen rate gate levelScale levelBias timeScale doneAction envelope--A segment based envelope generator. Note that the SC3 language-reorders the inputs to this UGen so that the envelope is the first-argument.--There are utilities for contructing the envelope argument.--The arguments for levelScale, levelBias, and timeScale are polled-when the EnvGen is triggered and remain constant for the duration-of the envelope.--envelope - an breakpoint set--gate - this triggers the envelope and holds it open while > 0. If- the Env is fixed-length (e.g. Env.linen, Env.perc), the gate- argument is used as a simple trigger. If it is an sustaining- envelope (e.g. Env.adsr, Env.asr), the envelope is held open- until the gate becomes 0, at which point is released.--levelScale - scales the levels of the breakpoints.--levelBias - offsets the levels of the breakpoints.--timeScale - scales the durations of the segments.--doneAction - an integer representing an action to be executed when- the env is finished playing. This can be used to free- the enclosing synth, etc.--The following envelope constructors are provided: envPerc, envSine,-envCoord, envTrapezoid, and envLinen.
− Help/UGen/Envelope/envLinen.help.lhs
@@ -1,9 +0,0 @@-envLinen :: UGen -> UGen -> UGen -> UGen -> [UGen]--Linear envelope parameter constructor.--> import Sound.SC3--> let { t = envLinen 0.4 2 0.4 0.1-> ; e = envGen KR 1 1 0 1 RemoveSynth t }-> in audition (out 0 (sinOsc AR 440 0 * e))
− Help/UGen/Envelope/envPerc.help.lhs
@@ -1,9 +0,0 @@-envPerc :: UGen -> UGen -> [UGen]--Percussive envelope--> import Sound.SC3--> let { p = envPerc 0.01 1-> ; e = envGen KR 1 0.1 0 1 RemoveSynth p }-> in audition (out 0 (sinOsc AR 440 0 * e))
− Help/UGen/Envelope/envSine.help.lhs
@@ -1,10 +0,0 @@-envSine :: UGen -> UGen -> [UGen]--Sine envelope--> import Sound.SC3--> let { s = envSine 9 0.1-> ; e = envGen KR 1 1 0 1 RemoveSynth s }-> in audition (out 0 (sinOsc AR 440 0 * e))-
− Help/UGen/Envelope/envTrapezoid.help.lhs
@@ -1,9 +0,0 @@-envTrapezoid :: UGen -> UGen -> UGen -> UGen -> [UGen]--Trapezoidal envelope data.--> import Sound.SC3--> let { t = envTrapezoid 0.05 0.95 3 0.1-> ; e = envGen KR 1 1 0 1 RemoveSynth t }-> in audition (out 0 (sinOsc AR 440 0 * e))
− Help/UGen/Envelope/free.help.lhs
@@ -1,17 +0,0 @@-free trig nodeID--When triggered frees a node.--trig - when triggered, frees node-nodeID - node to be freed--> import Sound.SC3.Monadic--> let { a = out 0 (sinOsc AR 880 0 * 0.1) -> ; b = do { n0 <- pinkNoise AR-> ; n1 <- dust AR 20-> ; return (mrg [out 1 (n0 * 0.1), free n1 1001]) } }-> in withSC3 (\fd -> do { async fd (d_recv (synthdef "a" a))-> ; async fd . d_recv . synthdef "b" =<< b-> ; send fd (s_new "a" 1001 AddToTail 0 [])-> ; send fd (s_new "b" (-1) AddToTail 0 []) } )
− Help/UGen/Envelope/freeSelf.help.lhs
@@ -1,11 +0,0 @@-freeSelf src--Free enclosing synth when the input signal crosses from non-positive-to positive.--> import Sound.SC3.Monadic--> do { n <- dust KR 0.5-> ; let { a = freeSelf n-> ; b = out 0 (sinOsc AR 440 0 * 0.1) }-> in audition (mrg [a, b]) }
− Help/UGen/Envelope/freeSelfWhenDone.help.lhs
@@ -1,13 +0,0 @@-freeSelfWhenDone src--Free the synth when the 'done' flag of the unit at `src' is set.--> import Sound.SC3--> let { x = mouseX KR (-1) 1 Linear 0.1-> ; e = linen x 1 0.1 1 RemoveSynth }-> in audition (out 0 (sinOsc AR 440 0 * e))--> let { x = mouseX KR (-1) 1 Linear 0.1-> ; e = linen x 1 0.1 1 DoNothing }-> in audition (mrg [freeSelfWhenDone e, out 0 (sinOsc AR 440 0 * e)])
− Help/UGen/Envelope/line.help.lhs
@@ -1,15 +0,0 @@-line rate start end dur doneAction--Generates a line from the start value to the end value.--start - starting value-end - ending value-dur - duration in seconds--Note: The SC3 UGen reorders the mul and add inputs to precede the-doneAction input.--> import Sound.SC3--> let f = line KR 200 17000 5 RemoveSynth-> in audition (out 0 (sinOsc AR f 0 * 0.1))
− Help/UGen/Envelope/linen.help.lhs
@@ -1,17 +0,0 @@-linen gate attackTime susLevel releaseTime doneAction--A linear envelope generator. The done flag is set when the-envelope reaches zero.--Note that the sustain level input is consulted only at the instant-when the gate is opened.--> import Sound.SC3--> let e = linen (impulse KR 2 0) 0.01 0.6 0.4 DoNothing-> in audition (out 0 (e * sinOsc AR 440 0 * 0.1))--> let { x = mouseX KR (-1) 1 Linear 0.1-> ; y = mouseY KR 0.1 0.5 Linear 0.1-> ; e = linen x 1 y 1.0 DoNothing }-> in audition (out 0 (sinOsc AR 440 0 * e))
− Help/UGen/Envelope/pause.help.lhs
@@ -1,24 +0,0 @@-pause gate nodeID--When triggered pauses a node.--gate - when gate is 0, node is paused, when 1 it runs-nodeID - node to be paused--> import Sound.SC3--> let { f = control KR "f" 440-> ; g = control KR "g" 1-> ; a = mrg [out 0 (sinOsc AR f 0 * 0.1), pause g 1001]-> ; a' = synthdef "a" a }-> in withSC3 (\fd -> do { async fd (d_recv a')-> ; send fd (s_new "a" 1001 AddToTail 0 [])-> ; send fd (s_new "a" 1002 AddToTail 0 [("f", 880)]) } )--Request that node 1002 pause node 1001.--> withSC3 (\fd -> send fd (n_set 1002 [("g", 0)]))--Restart node 1001.--> withSC3 (\fd -> send fd (n_set 1002 [("g", 1)]))
− Help/UGen/Envelope/pauseSelf.help.lhs
@@ -1,14 +0,0 @@-pauseSelf src--Pause enclosing synth when input signal crosses from non-positive to-positive.--> import Sound.SC3--> let { x = mouseX KR (-1) 1 Linear 0.1-> ; o = sinOsc AR 440 0 * 0.1 }-> in audition (mrg [pauseSelf x, out 0 o])--Run paused node (assuming no intermediate node is created).--> withSC3 (\fd -> send fd (n_run [(-1, True)]))
− Help/UGen/Envelope/pauseSelfWhenDone.help.lhs
@@ -1,18 +0,0 @@-pauseSelfWhenDone src--Pauses the synth when the 'done' flag of the unit at `src' is set.--> import Sound.SC3--> let { x = mouseX KR (-1) 1 Linear 0.1-> ; e = linen x 1 0.1 1 PauseSynth }-> in audition (out 0 (sinOsc AR 440 0 * e))--Run paused node (assuming no intermediate node is created).--> withSC3 (\fd -> send fd (n_run [(-1, True)]))--> let { x = mouseX KR (-1) 1 Linear 0.1-> ; e = linen x 1 0.1 1 DoNothing -> ; o = sinOsc AR 440 0 * e }-> in audition (mrg [pauseSelfWhenDone e, out 0 o])
− Help/UGen/Envelope/xLine.help.lhs
@@ -1,20 +0,0 @@-xLine rate start end dur doneAction--Exponential line generator. Generates an exponential curve from the-start value to the end value. Both the start and end values must be-non-zero and have the same sign.--start - starting value-end - ending value-dur - duration in seconds-doneAction - a doneAction to be evaluated when the XLine is- completed. See EnvGen for details.--Note: The sclang interface reorders the mul and add inputs to precede-the doneAction input.--> import Sound.SC3--> let { f = xLine KR 200 17000 10 RemoveSynth-> ; o = sinOsc AR f 0 * 0.1 }-> in audition (out 0 o)
− Help/UGen/External/atsNoiSynth.help.lhs
@@ -1,38 +0,0 @@-atsNoiSynth b nPartials partialStart partialSkip ptr sinP noiseP - freqMul freqAdd nBands bandStart bandSkip--Resynthesize sine data from an ATS analysis file-- b - buffer containing ATS data- nPartials - number of partials to synthesize-partialStart - partial in the analysis to start the - synthesis on (zero indexed)- partialSkip - increment indicating partials to synthesize- ptr - index into data set (0, 1)- sineP - scaler on sinusoidal portion of the resynthesis- noiseP - scaler on noise portion of the resynthesis- freqMul - multiplier on the sinusoidal frequency information.- freqAdd - value to add to frequency information.- nBands - number of critical bands (noise) to synthesize. - There are 25 critical bands.- bandStart - critical band to start resynthesis on. - 0 is the first band.- bandSkip - increment indicating bands to synthesize.--> let { load_data fd b i d = -> if length d < 512 -> then send fd (b_setn1 b i d) -> else do { send fd (b_setn1 b i (take 512 d))-> ; load_data fd b (i + 512) (drop 512 d) } }-> in do { ats <- atsRead "/home/rohan/tn/tn-56/ats/metal.ats"-> ; let { d = atsSC3 ats-> ; h = atsHeader ats-> ; x = mouseX KR 0.05 1.5 Linear 0.2-> ; y = mouseY KR 0 1 Linear 0.2-> ; np = constant (atsNPartials h)-> ; f = x / constant (atsAnalysisDuration h)-> ; ptr = clip (lfSaw AR f 1 * 0.5 + 0.5) 0 1-> ; rs = atsNoiSynth 10 np 0 1 ptr (1 - y) y 1 0 25 0 1 }-> in withSC3 (\fd -> do { async fd (b_alloc 10 (length d) 1)-> ; load_data fd 10 0 d-> ; play fd (out 0 rs) }) }
− Help/UGen/External/atsSynth.help.lhs
@@ -1,29 +0,0 @@-atsSynth b nPartials partialStart partialSkip ptr freqMul freqAdd--Resynthesize sine data from an ATS analysis file.-- b - buffer containing ATS data- nPartials - number of partials to synthesize- partialStart - partial to start the synthesis at (zero indexed)- partialSkip - increment indicating partials to synthesize- ptr - data index (0, 1)- freqMul - multiplier for sinusoidal frequency data- freqAdd - value to add to frequency data--> let { load_data fd b i d = -> if length d < 512 -> then send fd (b_setn1 b i d) -> else do { send fd (b_setn1 b i (take 512 d))-> ; load_data fd b (i + 512) (drop 512 d) } }-> in do { ats <- atsRead "/home/rohan/tn/tn-56/ats/metal.ats"-> ; let { d = atsSC3 ats-> ; h = atsHeader ats-> ; x = mouseX KR 0.05 1.5 Linear 0.2-> ; y = mouseY KR 0.25 2.0 Linear 0.2-> ; np = constant (atsNPartials h)-> ; f = x / constant (atsAnalysisDuration h)-> ; ptr = lfSaw AR f 1 * 0.5 + 0.5-> ; rs = atsSynth 10 np 0 1 (clip ptr 0 1) y 0 }-> in withSC3 (\fd -> do { async fd (b_alloc 10 (length d) 1)-> ; load_data fd 10 0 d-> ; play fd (out 0 rs) }) }
− Help/UGen/External/ay.help.lhs
@@ -1,68 +0,0 @@-ay tonea toneb tonec noise ctl vola volb volc envfreq envstyle chiptype--Emulates the General Instrument AY-3-8910 (a.k.a. the Yamaha-YM2149) 3-voice sound chip, as found in the ZX Spectrum-128, the Atari ST, and various other home computers during-the 1980s.--The inputs are as follows:-- * tonea, toneb, tonec - integer "tone" value for each of- the 3 voices, from 0 to 4095 (i.e. 12-bit range). Higher- value = lower pitch. For convenience, the AY.freqtotone- method converts a frequency value to something- appropriate for these inputs.-- * noise - the period of the pseudo-random noise generator, - 0 to 31-- * control - controls how the noise is mixed into the- tone(s), 0 to 32 (0 is mute). This is a binary mask value- which masks the noise/tone mixture in each channel, so- it's not linear.-- * vola, volb, volc - volume of the three channels, 0 to 15- (or 0 to 31 if using YM chiptype)-- * envfreq - envelope frequency, 0 to 4095-- * envstyle - type of envelope used, 0 to 15-- * chiptype - 0 for AY (default), 1 for YM. The models- behave slightly differently. This input cannot be- modulated - its value is only handled at the moment the- UGen starts.--The chip's inputs are integer values, so non-integer values-will be rounded off.--The emulation is provided by the libayemu library:-http://sourceforge.net/projects/libayemu.--> audition (out 0 (ay 1777 1666 1555 1 7 15 15 15 4 1 0))--> let { tonea = mouseY KR 10 3900 Exponential 0.2-> ; toneb = mouseX KR 10 3900 Exponential 0.2-> ; ctl = 3-> ; vola = 14-> ; volb = 14-> ; volc = 0 -> ; s = ay tonea toneb 1555 1 ctl vola volb volc 4 1 0 }-> in audition (out 0 (pan2 s 0 0.25))--> let { rate = mouseX KR 0.1 10 Linear 0.2-> ; rng l r i = return (linLin i (-1) 1 l r)-> ; mk_ctl l r = lfdNoise3 KR rate >>= rng l r-> ; mk_ctl_0 l r = lfdNoise0 KR rate >>= rng l r }-> in do { tonea <- mk_ctl 10 3900-> ; toneb <- mk_ctl 10 3900-> ; tonec <- mk_ctl 10 3900-> ; n <- mk_ctl 0 31-> ; ctl <- mk_ctl_0 0 31-> ; vola <- mk_ctl 0 15-> ; volb <- mk_ctl 0 15-> ; volc <- mk_ctl 0 15-> ; envfreq <- mk_ctl 0 4095-> ; envstyle <- mk_ctl 0 15-> ; let s = ay tonea toneb tonec n ctl vola volb volc envfreq envstyle 0-> in audition (out 0 (pan2 s 0 0.5)) }
− Help/UGen/External/fm7.help.lhs
@@ -1,109 +0,0 @@-fm7 ctl mod-- fm7, stefan kersten, phase modulation oscillator matrix.- http://darcs.k-hornz.de/repos/skUG/--fm7 implements a 6x6 oscillator matrix, where each-oscillator's phase can be modulated by any of the-other oscillators' output.--The UGen expects two (flattened) matrices: one for-specifying the oscillator parameters frequency-(control rate), phase (initialization only) and-amplitude (control rate):--[ [ 300, 0, 1 ],- [ 400, pi/2, 1 ],- [ 730, 0, 0.5 ],- [ 0, 0, 0 ],- [ 0, 0, 0 ],- [ 0, 0, 0 ] ]--The modulation matrix specifies the amount of-modulation each oscillator output has on another-oscillator's phase. Row i in the matrix refer to-oscillator i's phase input and the columns denote-the amount of phase modulation in radians.--The UGen outputs the six individual oscillator-signals.--> import Sound.SC3--> let { c = [ [xLine KR 300 310 4 DoNothing, 0, 1]-> , [xLine KR 300 310 8 DoNothing, 0, 1]-> , [0, 0, 1]-> , [0, 0, 1]-> , [0, 0, 1]-> , [0, 0, 1] ]-> ; m = [ [line KR 0 0.001 2 DoNothing, line KR 0.1 0 4 DoNothing, 0, 0, 0, 0]-> , [line KR 0 6 1 DoNothing, 0, 0, 0, 0, 0]-> , [0, 0, 0, 0, 0, 0]-> , [0, 0, 0, 0, 0, 0]-> , [0, 0, 0, 0, 0, 0]-> , [0, 0, 0, 0, 0, 0] ]-> ; MCE [l, r, _, _, _, _] = fm7 c m }-> in audition (out 0 (mce2 l r * 0.1))--An algorithmically generated graph courtesy f0.--> let { x = [ [ [ 0.0, -0.33333333333333, -1.0, 0.0 ]-> , [ 0.75, 0.75, 0.0, -0.5 ]-> , [ -0.5, -0.25, 0.25, -0.75 ]-> , [ -0.5, 1.0, 1.0, 1.0 ]-> , [ 0.0, 0.16666666666667, -0.75, -1.0 ]-> , [ 0.5, 0.5, -0.5, 0.33333333333333 ] ]-> , [ [ -0.33333333333333, 0.5, -0.5, -0.5 ]-> , [ 0.5, 0.75, 0.25, 0.75 ]-> , [ -0.83333333333333, 0.25, -1.0, 0.5 ]-> , [ 1.5, 0.25, 0.25, -0.25 ]-> , [ -0.66666666666667, -0.66666666666667, -1.0, -0.5 ]-> , [ -1.0, 0.0, -0.83333333333333, -0.33333333333333 ] ]-> , [ [ 0.25, -0.5, -0.5, -1.0 ]-> , [ -0.5, 1.0, -1.5, 0.0 ]-> , [ -1.0, -1.5, -0.5, 0.0 ]-> , [ 0.5, -1.0, 1.1666666666667, -0.5 ]-> , [ 0.83333333333333, -0.75, -1.5, 0.5 ]-> , [ 0.25, -1.0, 0.5, 1.0 ] ]-> , [ [ 1.0, 0.33333333333333, 0.0, -0.75 ]-> , [ -0.25, 0.0, 0.0, -0.5 ]-> , [ -0.5, -0.5, 0.0, 0.5 ]-> , [ 1.0, 0.75, 0.5, 0.5 ]-> , [ 0.0, 1.5, -0.5, 0.0 ]-> , [ 1.0, 0.0, -0.25, -0.5 ] ]-> , [ [ 0.5, -0.25, 0.0, 0.33333333333333 ]-> , [ 0.25, -0.75, 0.33333333333333, -1.0 ]-> , [ -0.25, -0.5, 0.25, -1.1666666666667 ]-> , [ 0.0, 0.25, 0.5, 0.16666666666667 ]-> , [ -1.0, -0.5, 0.83333333333333, -0.5 ]-> , [ 0.83333333333333, -0.75, -0.5, 0.0 ] ]-> , [ [ 0.0, -0.75, -0.16666666666667, 0.0 ]-> , [ 1.0, 0.5, 0.5, 0.0 ]-> , [ -0.5, 0.0, -0.5, 0.0 ]-> , [ -0.5, -0.16666666666667, 0.0, 0.5 ]-> , [ -0.25, 0.16666666666667, -0.75, 0.25 ]-> , [ -1.1666666666667, -1.3333333333333, -0.16666666666667, 1.5 ] ] ]-> ; y = [ [ [ 0.0, -0.5, 1.0, 0.0 ]-> , [ -0.5, 1.0, 0.5, -0.5 ]-> , [ 0.0, 0.33333333333333, 1.0, 1.0 ] ]-> , [ [ -0.5, 0.5, 1.0, 1.0 ]-> , [ 0.0, 0.33333333333333, 0.0, 1.5 ]-> , [ -0.5, 0.83333333333333, 1.0, 0.0 ] ]-> , [ [ 0.25, -0.66666666666667, 0.25, 0.0 ]-> , [ 0.5, -0.5, -0.5, -0.5 ]-> , [ 0.5, -0.5, -0.75, 0.83333333333333 ] ]-> , [ [ -0.25, 1.0, 0.0, 0.33333333333333 ]-> , [ -1.25, -0.25, 0.5, 0.0 ]-> , [ 0.0, -1.25, -0.25, -0.5 ] ]-> , [ [ 0.75, -0.25, 1.5, 0.0 ]-> , [ 0.25, -1.5, 0.5, 0.5 ]-> , [ -0.5, -0.5, -0.5, -0.25 ] ]-> , [ [ 0.0, 0.5, -0.5, 0.25 ]-> , [ 0.25, 0.5, -0.33333333333333, 0.0 ]-> , [ 1.0, 0.5, -0.16666666666667, 0.5 ] ] ]-> ; cs = map (map (\[f, p, m, a] -> sinOsc AR f p * m + a)) x-> ; ms = map (map (\[f, w, m, a] -> pulse AR f w * m + a)) y-> ; MCE [c1, c2, c3, _, c4, c5] = fm7 cs ms -> ; g3 = linLin (lfSaw KR 0.1 0) (-1) 1 0 (dbAmp (-12))-> ; g5 = dbAmp (-3) }-> in audition (out 0 (mce [c1 + c3 * g3 + c5 * g5, c2 + c4 + c5 * g5]))
− Help/UGen/External/lpcSynth.help.lhs
@@ -1,44 +0,0 @@-lpcSynth buffer excitation ptr-lpcVals rate buffer ptr--lpcSynth uses data from a LPC data file to filter a signal.-lpcVals returns pitch, rms and error data from the LPC data-file.-- buffer - the buffer LPC data is stored- ptr - index into LPC data (0,1)- excitation - the signal to filter--lpcVals reads LPC data and extracts frequency (cps), -amplitude (rmso) and error signals.--The LPC analysis files read are those generated by -lpanal (see csound).--Note: since the LPC data set will likely exceed the UDP packet -limit, load_data splits the LPC data into 512*4 byte packets.-Alternately use TCP, or write the LPC data to a disk file and use-b_allocRead.--> let { load_data fd b i d = -> if length d < 512 -> then send fd (b_setn1 b i d) -> else do { send fd (b_setn1 b i (take 512 d))-> ; load_data fd b (i + 512) (drop 512 d) }-> ; lpc_instr b n lpc = -> let { x = mouseX KR 0.05 1.5 Linear 0.2-> ; y = mouseY KR 0.25 2.0 Linear 0.2-> ; f = x / constant (lpcAnalysisDuration (lpcHeader lpc))-> ; ptr = lfSaw AR f 1 * 0.5 + 0.5-> ; MCE [cps, rms, err] = lpcVals AR b ptr-> ; nh = floorE (22000 / cps)-> ; voc = blip AR (cps * y) nh * (1 - err)-> ; s = lpcSynth b (voc + (n * err * 20)) ptr }-> in s * 1e-5 * rms }-> in do { lpc <- lpcRead "/home/rohan/tn/tn-56/lpc/fate.lpc"-> ; n <- pinkNoise AR-> ; let { d = lpcSC3 lpc -> ; s = lpc_instr 10 n lpc }-> in withSC3 (\fd -> do { async fd (b_alloc 10 (length d) 1)-> ; load_data fd 10 0 d-> ; play fd (out 0 s) }) }
− Help/UGen/External/lpcVals.help.lhs
@@ -1,1 +0,0 @@-See lpcSynth
− Help/UGen/External/membraneCircle.help.lhs
@@ -1,27 +0,0 @@-membraneCircle input tension loss-membraneHexagon input tension loss--Triangular waveguide meshes of a drum-like membrane. Input is-an excitation signal, such as a pulse of noise. Tension and-loss are k-rate.--The variants are named after the shape made out of triangular -meshes.--Excite the mesh with some pink noise, triggered by an -impulse generator. mouseX is tension and impulse frequency, -mouseY is duration of excitation, release-time and amplitude.--> import Sound.SC3--> let { x = mouseX KR 0 1 Linear 0.2-> ; y = mouseY KR 1e-9 1 Exponential 0.2-> ; loss = linLin y 0 1 0.999999 0.999-> ; wobble = sinOsc KR 2 0-> ; tension = linLin x 0 1 0.01 0.1 + (wobble * 0.0001)-> ; p = envPerc 0.0001 y-> ; tr = impulse KR (linLin x 0 1 3 9) 0-> ; e = envGen KR tr (linLin y 0 1 0.05 0.25) 0 0.1 DoNothing p-> ; m = membraneCircle }-> in do { n <- pinkNoise AR-> ; audition (out (mce2 0 1) (m (n * e) tension loss)) }
− Help/UGen/External/membraneHexagon.help.lhs
@@ -1,1 +0,0 @@-See membraneCircle.
− Help/UGen/External/pv_Invert.help.lhs
@@ -1,12 +0,0 @@-pv_Invert buffer--> import Sound.SC3--> let { s = sinOsc AR 440 0 * 0.4-> ; n = Sound.SC3.UGen.Base.pinkNoise 'a' AR * 0.1-> ; i = s + n-> ; c0 = fft' 10 i-> ; c1 = pv_Invert c0 -> ; run fd = do { async fd (b_alloc 10 2048 1)-> ; audition (out 0 (mce2 i (ifft' c1) * 0.5)) } }-> in withSC3 run
− Help/UGen/External/stkBowed.help.lhs
@@ -1,4 +0,0 @@-stkBowed rt freq bowPressure bowPosition vibFreq vibGain loudness gate--> let g = toggleFF (impulse KR 1 0)-> in audition (out 0 (stkBowed AR 220 64 64 64 64 64 g))
− Help/UGen/External/stkFlute.help.lhs
@@ -1,5 +0,0 @@-stkFlute rate freq jetDelay noisegain vibFreq vibGain breathPressure tr--> let { bp = line KR 76 32 3 RemoveSynth-> ; ng = line KR 16 64 3 DoNothing }-> in audition (out 0 (stkFlute AR 400 64 ng 16 16 bp 1))
− Help/UGen/External/stkMandolin.help.lhs
@@ -1,25 +0,0 @@-stkMandolin rate f bs pp dm dt at tr-- f - frequency- bs - body size- pp - pick position- dm - string damping- dt - string detune- at - after touch--> let { x = mouseX KR 0.25 4 Linear 0.2 -> ; tr = impulse KR x 0 - 0.5 }-> in do { mn <- tRand 54 66 tr-> ; [bs, pp, dm, dt, at] <- replicateM 5 (tRand 0 127 tr)-> ; audition (out 0 (stkMandolin AR (midiCPS mn) bs pp dm dt at tr)) }--> let { x = mouseX KR 3 16 Linear 0.2 -> ; t = impulse KR x 0 - 0.5 -> ; tr = pulseDivider t 6 0 }-> in do { mn <- tiRand 54 66 t-> ; bs <- tRand 72 94 tr-> ; pp <- tRand 32 42 tr-> ; dm <- tRand 64 72 tr-> ; dt <- tRand 0 4 tr-> ; at <- tRand 2 8 tr-> ; audition (out 0 (stkMandolin AR (midiCPS mn) bs pp dm dt at t)) }
− Help/UGen/External/stkModalBar.help.lhs
@@ -1,25 +0,0 @@-stkModalBar freq instrument stickHardness stickPosition - vibratoGain vibratoFreq directStickMix volume trig-- Marimba=0, Vibraphone=1, Agogo=2, Wood1=3, Reso=4,- Wood2=5, Beats=6, Two Fixed=7, Clump=8--> let { x = mouseX KR 0.25 4 Linear 0.2 -> ; tr = impulse KR x 0 - 0.5-> ; tR = tRand 0 127 tr }-> in do { i <- tRand 0 9 tr-> ; mn <- tiRand 25 96 tr-> ; [sh, sp, vg, vf, mx, v] <- replicateM 6 tR-> ; audition (out 0 (stkModalBar AR (midiCPS mn) i sh sp vg vf mx v tr)) }--> let { x = mouseX KR 1 6 Linear 0.2 -> ; t = impulse KR x 0 - 0.5-> ; tr = pulseDivider t 6 0 }-> in do { mn <- tiRand 52 64 t-> ; sh <- tRand 4 8 tr-> ; sp <- tRand 54 68 tr-> ; vg <- tRand 66 98 tr-> ; vf <- tRand 4 12 tr-> ; mx <- tRand 0 1 tr-> ; v <- tRand 16 48 tr-> ; audition (out 0 (stkModalBar AR (midiCPS mn) 1 sh sp vg vf mx v t)) }
− Help/UGen/External/stkShakers.help.lhs
@@ -1,24 +0,0 @@-stkShakers rt instr energy decay nObjects rfreq tr-- instr - model type- energy - initial energy- decay - rate of decay of system- nObjects - number of particles / elements- rfreq - resonance frequency- tr - reset trigger-- Maraca=0, Cabasa=1, Sekere=2, Guiro=3, Water Drops =4,- Bamboo Chimes=5, Tambourine=6, Sleigh Bells=7, Sticks=8,- Crunch=9, Wrench=10, Sand Paper=11, Coke Can=12, Next- Mug=13, Penny + Mug=14, Nickle + Mug = 15, Dime + Mug=16,- Quarter + Mug=17, Franc + Mug=18, Peso + Mug=19, Big- Rocks=20, Little Rocks=21, Tuned Bamboo Chimes=22--> let { x = mouseX KR 0.25 4 Linear 0.2 -> ; tr = impulse KR x 0 - 0.5 }-> in do { i <- tRand 0 23 tr-> ; [e, sd, no, rf] <- replicateM 4 (tRand 0 127 tr)-> ; audition (out 0 (stkShakers AR i e sd no rf tr)) }--> let tr = impulse KR 1 0 - 0.5-> in audition (out 0 (stkShakers AR 4 64 64 64 64 tr))
− Help/UGen/External/vosim.help.lhs
@@ -1,34 +0,0 @@-vosim tr freq nCycles decay-- trig - starts a vosim pulse when a transition from- non-positive to positive occurs and no other- vosim is still going. a-rate will produce- sample accurate triggering.-- freq - sets the frequency of the squared sinewave.-- nCycles - sets the number of squared sinewaves to use- in one vosim pulse. nCycles gets checked- when VOSIM receives a trigger.-- decay - sets the decay factor.--> import Sound.SC3--> do { p <- tRand 0 1 (impulse AR 6 0)-> ; let { t = impulse AR (9 * ( 1 + ( p >* 0.95))) 0-> ; x = mouseX KR 0.25 2 Linear 0.2-> ; y = mouseY KR 0.25 1.5 Linear 0.2-> ; z = 9 -> ; range i l r = linLin i (-1) 1 l r-> ; mk_n = lfNoise2 KR z >>= return . range 0.25 2 -> ; tR l r = tRand (mce l) (mce r) }-> in do { f <- tR [40, 120, 220] [440, 990, 880] t-> ; n <- tR [4] [8, 16, 32] t-> ; d <- tR [0.2, 0.4, 0.6] [0.6, 0.8, 1] t-> ; a <- tR [0] [0.2, 0.6, 1] t-> ; l <- tR [-1] [1] t-> ; xn <- mk_n-> ; yn <- mk_n-> ; let v = vosim t (f * x * xn) n (d * y * yn) * a-> in audition (out 0 (pan2 (mix v) l 1)) } }
− Help/UGen/FFT/convolution.help.lhs
@@ -1,13 +0,0 @@-convolution in kernel frameSize--Strict convolution of two continuously changing inputs. Also see-[Convolution2] for a cheaper CPU cost alternative for the case of a-fixed kernel which can be changed with a trigger message.--in - processing target-kernel - processing kernel.-framesize - size of FFT frame, must be a power of two--> do { k <- whiteNoise AR-> ; let i = in' 2 AR numOutputBuses-> in audition (out 0 (convolution i k 2048 * 0.1)) }
− Help/UGen/FFT/fft.help.lhs
@@ -1,23 +0,0 @@-fft buffer in hopSize windowType active-fft' buffer in--Fast fourier transform. The fast fourier transform analyzes the-frequency content of a signal. fft uses a local buffer for holding-the buffered audio. The inverse transform, ifft, reconstructs an-audio signal.--The fft and pv_* UGens run at control rate, the ifft UGen at audio-rate.--fft' is a variant FFT constructor with default values for hop size,-window type, and active status--> withSC3 (\fd -> async fd (b_alloc 10 2048 1))--> do { n <- whiteNoise AR-> ; audition (out 0 (ifft' (fft' 10 (n * 0.05)))) }--> let { s0 = sinOsc KR 0.08 0 * 6 + 6.2-> ; s1 = sinOsc KR (squared s0) 0 * 100 + 800-> ; s2 = sinOsc AR s1 0 }-> in audition (out 0 (ifft' (fft' 10 s2) * 0.25))
− Help/UGen/FFT/ifft.help.lhs
@@ -1,9 +0,0 @@-ifft buffer windowType-ifft' buffer--Inverse Fast Fourier Transform. The inverse fast fourier transform-converts from frequency content to a signal.--ifft' is a variant with the default window type.--See fft.
− Help/UGen/FFT/packFFT.help.lhs
@@ -1,54 +0,0 @@-packFFT chain bufsize frombin tobin zeroothers magsphases--Pack separate demand-rate FFT bin streams into an FFT chain buffer--Takes a length-prefixed array of magnitudes and phases, and packs-them into an FFT buffer ready for transforming back into-time-domain audio using IFFT.--Most people won't need to use this directly - instead, use-pvcollect, pvcalc, or pvcalc2.--The input data is magsphases, which should be a flat array-containing magnitude and phase of all bins in ascending order.-e.g. [mag0, phase0, mag1, phase1, mag2, phase2, ... magN, phaseN]-This input is typically demand-rate.--This is technically similar to Demand or Duty in that it calls-demand-rate UGens further up the graph to process the values,-eventually calling UnpackFFT. These two ends of the process must in-most cases see the same chain...! Otherwise behaviour is undefined-and, who knows, possibly unpleasant.--frombin and tobin allow you to fill the supplied data only into a-subset of the FFT bins (i.e. a single delimited frequency band),-set zeroothers to 1 to zero all the magnitudes outside this band-(otherwise they stay intact).--For usage examples, see UnpackFFT, but also pvcollect, pvcalc,-pvcalc2.--Here's an unusual example which uses PackFFT without using-UnpackFFT first - essentially creating our FFT data from scratch.--> withSC3 (\fd -> send fd (b_alloc 10 512 1))--> let n = 100-> range :: UGen -> UGen -> UGen -> UGen-> range u l r = linLin u (-1) 1 l r-> square :: Num n => n -> n-> square a = a * a-> r1 = do f <- expRand 0.1 1-> return (range (fSinOsc KR f 0) 0 1)-> m1 <- replicateM n r1-> let m2 = zipWith (*) m1 (map square [1.0, 0.99 ..])-> r2 = do r <- iRand (-3) 5-> return (lfPulse KR (2 ** r) 0 0.3)-> i <- replicateM n r2-> let m3 = zipWith (*) m2 i-> p = replicate n 0.0-> c1 = fft' 10 (fSinOsc AR 440 0)-> ci = constant . fromIntegral-> c2 = packFFT c1 512 0 (ci n - 1) 1 (packFFTSpec m3 p)-> s = ifft' c2-> audition (out 0 (mce [s, s]))
− Help/UGen/FFT/partConv.help.lhs
@@ -1,57 +0,0 @@-partConv in fft_size ir_bufnum--Partitioned convolution. Various additional buffers-must be supplied.--Mono impulse response only! If inputting multiple-channels, you'll need independent PartConvs, one-for each channel.--But the charm is: impulse response can be as large-as you like (CPU load increases with IR-size. Various tradeoffs based on fftsize choice,-due to rarer but larger FFTs. This plug-in uses-amortisation to spread processing and avoid-spikes).--Normalisation factors difficult to anticipate;-convolution piles up multiple copies of the input-on top of itself, so can easily overload.-- in - processing target-- fftsize - spectral convolution partition size- (twice partition size). You must- ensure that the blocksize divides the- partition size and there are at least- two blocks per partition (to allow- for amortisation)-- irbufnum - Prepared buffer of spectra for each - partition of the impulse response--preparation; essentially, allocate an impulse-response buffer, then follow some special buffer-preparation steps below to set up the data the-plugin needs. --> import Sound.SC3--> let { fft_size = 2048-> ; ir_file = "/home/rohan/audio/church.ir.wav"-> ; ir_length = 82756-> ; accum_size = pc_calcAccumSize fft_size ir_length-> ; ir_td_b = 10 {- time domain -}-> ; ir_fd_b = 11 {- frequency domain -}-> ; target_b = 12 {- source signal -}-> ; target_file = "/home/rohan/audio/text.snd"-> ; c = constant-> ; g = let { i = playBuf 1 (c target_b) 1 0 0 Loop DoNothing-> ; pc = partConv i (c fft_size) (c ir_fd_b) }-> in out 0 (pc * 0.1) }-> in withSC3 (\fd -> do -> { async fd (b_allocRead ir_td_b ir_file 0 ir_length)-> ; async fd (b_alloc ir_fd_b accum_size 1)-> ; send fd (pc_preparePartConv ir_fd_b ir_td_b fft_size)-> ; async fd (b_allocRead target_b target_file 0 0)-> ; play fd g })
− Help/UGen/FFT/pv_BinScramble.help.lhs
@@ -1,23 +0,0 @@-pv_BinScramble buffer wipe width trig--Randomizes the order of the bins. The trigger will select a new-random ordering.--buffer - fft' buffer.-wipe - scrambles more bins as wipe moves from zero to one.-width - a value from zero to one, indicating the maximum randomized- distance of a bin from its original location in the spectrum.-trig - a trigger selects a new random ordering.--> import Sound.SC3--> let fileName = "/home/rohan/audio/metal.wav"-> in withSC3 (\fd -> do { async fd (b_alloc 10 2048 1)-> ; async fd (b_allocRead 12 fileName 0 0) })--> let { a = playBuf 1 12 (bufRateScale KR 12) 1 0 Loop DoNothing-> ; f = fft' 10 a-> ; x = mouseX KR 0.0 1.0 Linear 0.1-> ; y = mouseY KR 0.0 1.0 Linear 0.1 }-> in do { g <- pv_BinScramble f x y (impulse KR 4 0)-> ; audition (out 0 (pan2 (ifft' g) 0 0.5)) }
− Help/UGen/FFT/pv_BinShift.help.lhs
@@ -1,15 +0,0 @@-pv_BinShift buffer stretch shift--Shift and scale the positions of the bins. Can be used as a very-crude frequency shifter/scaler. Shifts the leftmost bin at `buffer'-by `shift' places, the distance between subsequent bins is `stretch'.--> withSC3 (\fd -> async fd (b_alloc 10 2048 1))--> let { x = mouseX KR (-10) 100 Linear 0.1-> ; y = mouseY KR 1 4 Linear 0.1-> ; s0 = sinOsc KR 0.08 0 * 6 + 6.2-> ; s1 = sinOsc KR (squared s0) 0 * 100 + 800-> ; s2 = sinOsc AR s1 0-> ; pv = pv_BinShift (fft' 10 s2) y x }-> in audition (out 0 (pan2 (ifft' pv) 0 0.1))
− Help/UGen/FFT/pv_BinWipe.help.lhs
@@ -1,27 +0,0 @@-pv_BinWipe bufferA bufferB wipe--Combine low and high bins from two inputs. Copies low bins from one-input and the high bins of the other.--bufferA - fft buffer A.-bufferB - fft buffer B.-wipe - can range between -1 and +1.--if wipe == 0 then the output is the same as inA.-if wipe > 0 then it begins replacing with bins from inB from the bottom up.-if wipe < 0 then it begins replacing with bins from inB from the top down.--> import Sound.SC3--> let fileName = "/home/rohan/audio/metal.wav"-> in withSC3 (\fd -> do { async fd (b_alloc 10 2048 1)-> ; async fd (b_alloc 11 2048 1)-> ; async fd (b_allocRead 12 fileName 0 0) })--> do { n <- whiteNoise AR-> ; let { b = playBuf 1 12 (bufRateScale KR 12) 0 0 Loop DoNothing-> ; f = fft' 10 (n * 0.2)-> ; g = fft' 11 b-> ; x = mouseX KR 0.0 1.0 Linear 0.1-> ; h = pv_BinWipe f g x }-> in audition (out 0 (pan2 (ifft' h) 0 0.5)) }
− Help/UGen/FFT/pv_BrickWall.help.lhs
@@ -1,11 +0,0 @@-pv_BrickWall buffer wipe--Clears bins above or below a cutoff point. `wipe' = a unit signal,-from -1 to 0 the UGen acts as a low-pass filter, from 0 to 1 it acts-as a high pass filter.--> withSC3 (\fd -> async fd (b_alloc 10 2048 1))--> do { n <- whiteNoise AR-> ; let x = mouseX KR (-1) 1 Linear 0.1-> in audition (out 0 (ifft' (pv_BrickWall (fft' 10 (n * 0.2)) x))) }
− Help/UGen/FFT/pv_ConformalMap.help.lhs
@@ -1,30 +0,0 @@-pv_ConformalMap buffer real imag--Applies the conformal mapping z -> (z-a)/(1-za*) to the phase vocoder-bins z with a given by the real and imag imputs to the UGen.--See http://mathworld.wolfram.com/ConformalMapping.html--buffer - buffer number of buffer to act on, passed in through a chain-real - real part of a.-imag - imaginary part of a.--> withSC3 (\fd -> async fd (b_alloc 10 1024 1))--> let { i = in' 1 AR numOutputBuses * 0.5-> ; x = mouseX KR (-1) 1 Linear 0.1-> ; y = mouseY KR (-1) 1 Linear 0.1 }-> in audition (out 0 (pan2 (ifft' (pv_ConformalMap (fft' 10 i) x y)) 0 1))--With filtering.--> withSC3 (\fd -> async fd (b_alloc 0 2048 1))--> let { o = mce [1, 1.1, 1.5, 1.78, 2.45, 6.7, 8] * 220-> ; f = sinOsc KR (mce [0.16, 0.33, 0.41]) 0 * 10 + o-> ; s = mix (lfSaw AR f 0) * 0.3-> ; x = mouseX KR 0.01 2.0 Linear 0.1-> ; y = mouseY KR 0.01 10.0 Linear 0.1-> ; c = fft' 0 s-> ; m = ifft' (pv_ConformalMap c x y) }-> in audition (out 0 (pan2 (combN m 0.1 0.1 10 * 0.5 + m) 0 1))
− Help/UGen/FFT/pv_Copy.help.lhs
@@ -1,20 +0,0 @@-pv_Copy bufferA bufferB--Copies the spectral frame in bufferA to bufferB at that point in the-chain of PV UGens. This allows for parallel processing of spectral-data without the need for multiple FFT' UGens, and to copy out data at-that point in the chain for other purposes. bufferA and bufferB must-be the same size.--bufferA - source buffer.-bufferB - destination buffer.--Proof of concept, silence--> withSC3 (\fd -> do { async fd (b_alloc 0 2048 1)-> ; async fd (b_alloc 1 2048 1) })--> do { i <- lfClipNoise AR 100-> ; let { c0 = fft' 0 i-> ; c1 = pv_Copy c0 1 }-> in audition (out 0 (ifft' c0 - ifft' c1)) }
− Help/UGen/FFT/pv_Diffuser.help.lhs
@@ -1,19 +0,0 @@-pv_Diffuser buffer trig--Adds a different constant random phase shift to each bin.-The trigger will select a new set of random phases.--buffer - fft buffer.-trig - a trigger selects a new set of random values.--> import Sound.SC3--> let fileName = "/home/rohan/audio/metal.wav"-> in withSC3 (\fd -> do { async fd (b_alloc 10 2048 1)-> ; async fd (b_allocRead 12 fileName 0 0) })--> let { a = playBuf 1 12 (bufRateScale KR 12) 0 0 Loop DoNothing-> ; f = fft' 10 a-> ; x = mouseX KR 0 1 Linear 0.1-> ; h = pv_Diffuser f (x >* 0.5) }-> in audition (out 0 (ifft' h * 0.5))
− Help/UGen/FFT/pv_LocalMax.help.lhs
@@ -1,19 +0,0 @@-pv_LocalMax buffer threshold--Pass bins which are a local maximum. Passes only bins whose magnitude-is above a threshold and above their nearest neighbors.--buffer - fft buffer.-threshold - magnitude threshold.--> import Sound.SC3--> let fileName = "/home/rohan/audio/metal.wav"-> in withSC3 (\fd -> do { async fd (b_alloc 10 2048 1)-> ; async fd (b_allocRead 12 fileName 0 0) })--> let { a = playBuf 1 12 (bufRateScale KR 12) 0 0 Loop DoNothing-> ; f = fft' 10 a-> ; x = mouseX KR 0 100 Linear 0.1-> ; h = pv_LocalMax f x }-> in audition (out 0 (ifft' h * 0.5))
− Help/UGen/FFT/pv_MagAbove.help.lhs
@@ -1,26 +0,0 @@-pv_MagAbove buffer threshold--Pass bins above a threshold. Pass only bands where the magnitude is-above `threshold'. This value is not normalized and is therefore-dependant on the buffer size.--> import Sound.SC3--> let fileName = "/home/rohan/audio/metal.wav"-> in withSC3 (\fd -> do { async fd (b_alloc 10 2048 1)-> ; async fd (b_allocRead 12 fileName 0 0) })--> let { a = playBuf 1 12 (bufRateScale KR 12) 0 0 Loop DoNothing-> ; f = fft' 10 a-> ; x = mouseX KR 0 100 Linear 0.1-> ; h = pv_MagAbove f x }-> in audition (out 0 (ifft' h * 0.5))--Synthesised input.--> let { a = sinOsc KR (squared (sinOsc KR 0.08 0 * 6 + 6.2)) 0 * 100 + 800-> ; b = sinOsc AR a 0-> ; f = fft' 10 b-> ; x = mouseX KR 0 1024 Linear 0.1-> ; h = pv_MagAbove f x }-> in audition (out 0 (ifft' h * 0.5))
− Help/UGen/FFT/pv_MagBelow.help.lhs
@@ -1,26 +0,0 @@-pv_MagBelow buffer threshold--Pass bins below a threshold. Pass only bands where the magnitude is-below `threshold'. This value is not normalized and is therefore-dependant on the buffer size.--> import Sound.SC3--> let fileName = "/home/rohan/audio/metal.wav"-> in withSC3 (\fd -> do { async fd (b_alloc 10 2048 1)-> ; async fd (b_allocRead 12 fileName 0 0) })--> let { a = playBuf 1 12 (bufRateScale KR 12) 0 0 Loop DoNothing-> ; f = fft' 10 a-> ; x = mouseX KR 0 100 Linear 0.1-> ; h = pv_MagBelow f x }-> in audition (out 0 (ifft' h * 0.5))--Synthesised input.--> let { a = sinOsc KR (squared (sinOsc KR 0.08 0 * 6 + 6.2)) 0 * 100 + 800-> ; b = sinOsc AR a 0-> ; f = fft' 10 b-> ; x = mouseX KR 0 1024 Linear 0.1-> ; h = pv_MagBelow f x }-> in audition (out 0 (ifft' h * 0.5))
− Help/UGen/FFT/pv_MagClip.help.lhs
@@ -1,25 +0,0 @@-pv_MagClip buffer threshold--Clip bins to a threshold. Clips bin magnitudes to a maximum-threshold.--> import Sound.SC3--> let fileName = "/home/rohan/audio/metal.wav"-> in withSC3 (\fd -> do { async fd (b_alloc 10 2048 1)-> ; async fd (b_allocRead 12 fileName 0 0) })--> let { a = playBuf 1 12 (bufRateScale KR 12) 0 0 Loop DoNothing-> ; f = fft' 10 a-> ; x = mouseX KR 0 5 Linear 0.1-> ; h = pv_MagBelow f x }-> in audition (out 0 (ifft' h * 0.5))--Synthesised input.--> let { a = sinOsc KR (squared (sinOsc KR 0.08 0 * 6 + 6.2)) 0 * 100 + 800-> ; b = sinOsc AR a 0-> ; f = fft' 10 b-> ; x = mouseX KR 0 128 Linear 0.1-> ; h = pv_MagClip f x }-> in audition (out 0 (ifft' h * 0.5))
− Help/UGen/FFT/pv_MagFreeze.help.lhs
@@ -1,25 +0,0 @@-pv_MagClip buffer threshold--Clip bins to a threshold. Clips bin magnitudes to a maximum-threshold.--> import Sound.SC3--> let fileName = "/home/rohan/audio/metal.wav"-> in withSC3 (\fd -> do { async fd (b_alloc 10 2048 1)-> ; async fd (b_allocRead 12 fileName 0 0) })--> let { a = playBuf 1 12 (bufRateScale KR 12) 0 0 Loop DoNothing-> ; f = fft' 10 a-> ; x = mouseX KR 0 1 Linear 0.1-> ; h = pv_MagFreeze f (x >* 0.5) }-> in audition (out 0 (ifft' h * 0.5))--Synthesised input.--> let { a = sinOsc KR (squared (sinOsc KR 0.08 0 * 6 + 6.2)) 0 * 100 + 800-> ; b = sinOsc AR a 0-> ; f = fft' 10 b-> ; x = mouseX KR 0 1 Linear 0.1-> ; h = pv_MagFreeze f (x >* 0.5) }-> in audition (out 0 (ifft' h * 0.5))
− Help/UGen/FFT/pv_RandComb.help.lhs
@@ -1,14 +0,0 @@-pv_RandComb buffer wipe trig--Randomly clear bins.--buffer = fft buffer. wipe = clear bins from input in a random-order (0, 1). trig = select new random ordering.--> withSC3 (\fd -> async fd (b_alloc 10 2048 1))--> let { x = mouseX KR 0.6 0.95 Linear 0.1-> ; t = impulse KR 0.4 0 }-> in do { n <- whiteNoise AR-> ; c <- pv_RandComb (fft' 10 (n * 0.5)) x t-> ; audition (out 0 (pan2 (ifft' c) 0 1)) }
− Help/UGen/FFT/pv_RandWipe.help.lhs
@@ -1,25 +0,0 @@-pv_RandWipe bufferA bufferB wipe trig--Cross fades between two sounds by copying bins in a random order.--bufferA = fft buffer A. bufferB = fft buffer B. wipe = copies-bins from bufferB in a random order (0, 1). trig = select new-random ordering.--> withSC3 (\fd -> do { async fd (b_alloc 10 2048 1)-> ; async fd (b_alloc 11 2048 1) })--> let { n0 = randomRs (400.0, 1000.0) (mkStdGen 0)-> ; n1 = randomRs (80.0, 400.0) (mkStdGen 1)-> ; n2 = randomRs (0.0, 8.0) (mkStdGen 2)-> ; o0 = map (\n -> lfSaw AR n 0 * 0.1) (take 6 n0)-> ; o1 = map (\n -> lfPulse AR n 0.0 0.2) (take 6 n1)-> ; o2 = map (\n -> sinOsc KR n 0 * 0.2) (take 6 n2)-> ; a = mix (mce o0)-> ; b = mix (mce (zipWith (\p s -> p * (max s 0.0)) o1 o2))-> ; f = fft' 10 a-> ; g = fft' 11 b-> ; x = mouseX KR 0 1 Linear 0.1-> ; y = mouseY KR 0 1 Linear 0.1 }-> in do { h <- pv_RandWipe f g x (y >* 0.5)-> ; audition (out 0 (pan2 (ifft' h) 0 0.5)) }
− Help/UGen/FFT/pv_RectComb.help.lhs
@@ -1,15 +0,0 @@-pv_RectComb buffer numTeeth phase width--> withSC3 (\fd -> async fd (b_alloc 10 2048 1))--> do { n <- whiteNoise AR-> ; let { x = mouseX KR 0 0.5 Linear 0.1-> ; y = mouseY KR 0 0.5 Linear 0.1-> ; c = pv_RectComb (fft' 10 (n * 0.3)) 8 x y }-> in audition (out 0 (pan2 (ifft' c) 0 1)) }--> do { n <- whiteNoise AR-> ; let { p = lfTri KR 0.097 0 * 0.4 + 0.5-> ; w = lfTri KR 0.240 0 * (-0.5) + 0.5-> ; c = pv_RectComb (fft' 10 (n * 0.3)) 8 p w }-> in audition (out 0 (pan2 (ifft' c) 0 1)) }
− Help/UGen/FFT/pvcollect.help.lhs
@@ -1,40 +0,0 @@-pvcollect chain numframes func frombin tobin zeroothers--Process each bin of an FFT chain separately.--pvcollect applies function func to each bin of an FFT chain. func-should be a function that takes magnitude, phase, index as inputs-and returns a resulting [magnitude, phase].--The "index" is the integer bin number, starting at 0 for DC. You-can optionally ignore the phase and only return a single-(magnitude) value, in which case the phase is assumed to be left-unchanged.--frombin, tobin, and zeroothers are optional arguments which limit-the processing to a specified integer range of FFT bins. If-zeroothers is set to 1 then bins outside of the range being-processed are silenced.--Note that this procedure can be relatively CPU-heavy, depending on-how you use it.--> import Sound.SC3--> let fileName = "/home/rohan/audio/metal.wav"-> in withSC3 (\fd -> do { async fd (b_alloc 10 1024 1)-> ; async fd (b_allocRead 11 fileName 0 0) })--> let { no_op m p _ = (m, p)-> ; combf m p i = ((modE i 7.0 ==* 0) * m, p)-> ; spectral_delay m p _ = let { l = lfPar KR 0.5 0-> ; v = linLin l (-1) 1 0.1 1 }-> in (m + delayN m 1 v, p)-> ; nf = 1024-> ; bpf_sweep m p i = let { l = lfPar KR 0.1 0-> ; e = abs (i - (linLin l (-1) 1 2 (nf / 20))) }-> in ((e <* 10) * m, p)-> ; sf = playBuf 1 11 (bufRateScale KR 11) 1 0 Loop DoNothing-> ; c1 = fft' 10 sf-> ; c2 = pvcollect c1 nf spectral_delay 0 250 0 }-> in audition (out 0 (0.1 * ifft' c2))
− Help/UGen/Filter/allpassC.help.lhs
@@ -1,1 +0,0 @@-See allPassN
− Help/UGen/Filter/allpassL.help.lhs
@@ -1,1 +0,0 @@-See allPassN
− Help/UGen/Filter/allpassN.help.lhs
@@ -1,45 +0,0 @@-allpassN in maxDelayTime delayTime decayTime--All pass delay line. AllpassN uses no interpolation, AllpassL uses-linear interpolation, AllpassC uses all pass interpolation. All time-values are in seconds. The decay time is the time for the echoes to-decay by 60 decibels. If this time is negative then the feedback-coefficient will be negative, thus emphasizing only odd harmonics at-an octave lower.--Since the allpass delay has no audible effect as a resonator on steady-state sound ...--> import Sound.SC3.ID--> let { dly = xLine KR 0.0001 0.01 20 RemoveSynth-> ; n = whiteNoise 'a' AR }-> in audition (out 0 (allpassC (n * 0.1) 0.01 dly 0.2))--...these examples add the input to the effected sound so that you-can hear the effect of the phase comb.--> let { n = whiteNoise 'a' AR-> ; dly = xLine KR 0.0001 0.01 20 RemoveSynth }-> in audition (out 0 ((n + allpassN (n * 0.1) 0.01 dly 0.2) * 0.1))--Linear variant--> let { n = whiteNoise 'a' AR-> ; dly = xLine KR 0.0001 0.01 20 RemoveSynth }-> in audition (out 0 ((n + allpassL (n * 0.1) 0.01 dly 0.2) * 0.1))--Cubic variant--> let { n = whiteNoise 'a' AR-> ; dly = xLine KR 0.0001 0.01 20 RemoveSynth }-> in audition (out 0 ((n + allpassC (n * 0.1) 0.01 dly 0.2) * 0.1))--Used as an echo - doesn't really sound different than Comb, but it-outputs the input signal immediately (inverted) and the echoes are-lower in amplitude.--> let { n = whiteNoise 'a' AR-> ; d = dust 'a' AR 1-> ; src = decay (d * 0.5) 0.2 * n }-> in audition (out 0 (allpassN src 0.2 0.2 3))
− Help/UGen/Filter/bBandPass.help.lhs
@@ -1,13 +0,0 @@-bBandPass i f bw--- i - input signal to be processed- f - center frequency- bw - the bandwidth in octaves between -3 dB frequencies--> import Sound.SC3--> let { i = soundIn (mce2 0 1)-> ; f = mouseX KR 20 20000 Exponential 0.2 -> ; bw = mouseY KR 0 10 Linear 0.2 }-> in audition (out 0 (bBandPass i f bw))
− Help/UGen/Filter/bBandStop.help.lhs
@@ -1,13 +0,0 @@-bBandStop i f bw--- i - input signal to be processed- f - center frequency- bw - the bandwidth in octaves between -3 dB frequencies--> import Sound.SC3--> let { i = soundIn (mce2 0 1)-> ; f = mouseX KR 20 20000 Exponential 0.2 -> ; bw = mouseY KR 0 10 Linear 0.2 }-> in audition (out 0 (bBandStop i f bw))
− Help/UGen/Filter/bHiPass.help.lhs
@@ -1,14 +0,0 @@-bHiPass i f rq-- i - input signal to be processed- f - cutoff frequency- rq - the reciprocal of Q, ie. bandwidth / cutoffFreq--12db/oct rolloff - 2nd order resonant high pass filter.--> import Sound.SC3--> let { i = soundIn (mce2 0 1)-> ; f = mouseX KR 10 20000 Exponential 0.2 -> ; rq = mouseY KR 0 1 Linear 0.2 }-> in audition (out 0 (bHiPass i f rq))
− Help/UGen/Filter/bHiShelf.help.lhs
@@ -1,22 +0,0 @@-bHiShelf i f rs db-- i - input signal to be processed- f - center frequency- rs - the reciprocal of S. Shell boost/cut slope. When S = 1, the- shelf slope is as steep as it can be and remain monotonically- increasing or decreasing gain with frequency. The shelf slope,- in dB/octave, remains proportional to S for all other values- for a fixed freq/SampleRate.ir and db.- db - gain. boost/cut the center frequency in decibels.--> import Sound.SC3--> let { i = soundIn (mce2 0 1)-> ; f = mouseX KR 2200 18000 Exponential 0.2 -> ; db = mouseY KR 18 (-18) Linear 0.2 }-> in audition (out 0 (bHiShelf i f 1 db))--> let { i = soundIn (mce2 0 1)-> ; f = mouseX KR 2200 18000 Exponential 0.2 -> ; rs = mouseY KR 0.1 1 Linear 0.2 }-> in audition (out 0 (bHiShelf i f rs 6))
− Help/UGen/Filter/bLowPass.help.lhs
@@ -1,30 +0,0 @@-bLowPass i f rq-bLowPassCoef sr f rq-- i - input signal to be processed- sr - sample rate- f - cutoff frequency- rq - the reciprocal of Q, ie. bandwidth / cutoffFreq--12db/oct rolloff - 2nd order resonant low pass filter.--> import Sound.SC3--> let { i = soundIn (mce2 0 1)-> ; f = mouseX KR 10 20000 Exponential 0.2-> ; rq = mouseY KR 0 1 Linear 0.2 }-> in audition (out 0 (bLowPass i f rq))--> let { i = mix (saw AR (mce [0.99, 1, 1.01] * 440) * 0.3)-> ; f = mouseX KR 100 20000 Exponential 0.2-> ; rq = mouseY KR 0.1 1 Linear 0.2 }-> in audition (out 0 (bLowPass i f rq))--Calculate coefficients and use sos.--> let { i = mix (saw AR (mce [0.99, 1, 1.01] * 440) * 0.3)-> ; f = mouseX KR 100 20000 Exponential 0.2-> ; rq = mouseY KR 0.1 1 Linear 0.2-> ; (a0, a1, a2, b1, b2) = bLowPassCoef sampleRate f rq-> ; flt ip = sos ip a0 a1 a2 b1 b2 }-> in audition (out 0 (flt (flt i)))
− Help/UGen/Filter/bLowShelf.help.lhs
@@ -1,24 +0,0 @@-bLowShelf i f rs db-- i - input signal to be processed- f - center frequency- rs - the reciprocal of S. Shelf boost/cut slope. When S = 1, the- shelf slope is as steep as it can be and remain monotonically- increasing or decreasing gain with frequency. The shelf slope,- in dB/octave, remains proportional to S for all other values- for a fixed freq/SampleRate.ir and db.- db - gain. boost/cut the center frequency in decibels.--> import Sound.SC3--> let { i = soundIn (mce2 0 1)-> ; f = mouseX KR 40 6000 Exponential 0.2-> ; rs = 1-> ; db = mouseY KR 24 (-24) Linear 0.2 }-> in audition (out 0 (bLowShelf i f rs db))--> let { i = soundIn (mce2 0 1)-> ; f = mouseX KR 20 6000 Exponential 0.2 -> ; rs = mouseY KR 0.1 1 Linear 0.2 -> ; db = 6}-> in audition (out 0 (bLowShelf i f rs db))
− Help/UGen/Filter/bPeakEQ.help.lhs
@@ -1,20 +0,0 @@-bPeakEQ i f rq db-- i - input signal to be processed- f - center frequency- rq - the reciprocal of Q, ie. bandwidth / cutoffFreq- db - boost/cut the center frequency (in dBs)--Parametric equalizer.--> import Sound.SC3--> let { i = soundIn (mce2 0 1)-> ; f = mouseX KR 2200 18000 Exponential 0.2 -> ; db = mouseY KR 12 (-12) Linear 0.2 }-> in audition (out 0 (bPeakEQ i f 0.8 db))--> let { i = soundIn (mce2 0 1)-> ; f = mouseX KR 2200 18000 Exponential 0.2 -> ; rq = mouseY KR 10 0.4 Linear 0.2 }-> in audition (out 0 (bPeakEQ i f rq 6))
− Help/UGen/Filter/bpf.help.lhs
@@ -1,17 +0,0 @@-bpf in freq rq--Second order Butterworth bandpass filter--in - input signal to be processed-freq - cutoff frequency in Hertz-rq - the reciprocal of Q, ie. bandwidth / cutoffFreq--> import Sound.SC3--> let f = fSinOsc KR (xLine KR 0.7 300 20 RemoveSynth) 0 * 3600 + 4000-> in audition (out 0 (bpf (saw AR 200 * 0.5) f 0.3 ))--> do { n <- whiteNoise AR-> ; let { x = mouseX KR 220 440 Exponential 0.1-> ; y = mouseY KR 0.01 0.2 Linear 0.1 }-> in audition (out 0 (bpf n (mce [x, 550 - x]) y)) }
− Help/UGen/Filter/bpz2.help.lhs
@@ -1,7 +0,0 @@-bpz2 in--Two zero fixed midpass. This filter cuts out 0 Hz and the Nyquist-frequency.--> do { n <- whiteNoise AR-> ; audition (out 0 (bpz2 (n * 0.25))) }
− Help/UGen/Filter/brf.help.lhs
@@ -1,6 +0,0 @@-brf in freq rq--Second order Butterworth band reject filter.--> let f = fSinOsc KR (xLine KR 0.7 300 20 RemoveSynth) 0 * 3800 + 4000-> in audition (out 0 (brf (saw AR 200 * 0.1) f 0.3))
− Help/UGen/Filter/clip.help.lhs
@@ -1,6 +0,0 @@-clip in lo hi--Clip `in' to lie between `lo' and `hi', which are instantiate time-inputs.--> audition (out 0 (clip (sinOsc AR 440 0 * 0.4) (-0.25) 0.25))
− Help/UGen/Filter/combC.help.lhs
@@ -1,1 +0,0 @@-See combN.
− Help/UGen/Filter/combL.help.lhs
@@ -1,1 +0,0 @@-See combN.
− Help/UGen/Filter/combN.help.lhs
@@ -1,36 +0,0 @@-combN in maxDelayTime delayTime decayTime--Comb delay line. CombN uses no interpolation, CombL uses linear-interpolation, CombC uses all pass interpolation. All times are in-seconds. The decay time is the time for the echoes to decay by 60-decibels. If this time is negative then the feedback coefficient-will be negative, thus emphasizing only odd harmonics at an octave-lower.--Comb used as a resonator. The resonant fundamental is equal to-reciprocal of the delay time.--> do { n <- whiteNoise AR-> ; let dt = xLine KR 0.0001 0.01 20 RemoveSynth-> in audition (out 0 (combN (n * 0.1) 0.01 dt 0.2)) }--> do { n <- whiteNoise AR-> ; let dt = xLine KR 0.0001 0.01 20 RemoveSynth-> in audition (out 0 (combL (n * 0.1) 0.01 dt 0.2)) }--> do { n <- whiteNoise AR-> ; let dt = xLine KR 0.0001 0.01 20 RemoveSynth-> in audition (out 0 (combC (n * 0.1) 0.01 dt 0.2)) }--With negative feedback:--> do { n <- whiteNoise AR-> ; let dt = xLine KR 0.0001 0.01 20 RemoveSynth-> in audition (out 0 (combC (n * 0.1) 0.01 dt (-0.2))) }--Used as an echo.--> do { d <- dust AR 1-> ; n <- whiteNoise AR-> ; let i = decay (d * 0.5) 0.2 * n-> in audition (out 0 (combC i 0.2 0.2 3)) }
− Help/UGen/Filter/decay.help.lhs
@@ -1,13 +0,0 @@-decay in decayTime--Exponential decay. This is essentially the same as Integrator-except that instead of supplying the coefficient directly, it is-caculated from a 60 dB decay time. This is the time required for-the integrator to lose 99.9 % of its value or -60dB. This is useful-for exponential decaying envelopes triggered by impulses.--Used as an envelope.--> do { n <- pinkNoise AR-> ; let s = impulse AR (xLine KR 1 50 20 RemoveSynth) 0.25-> in audition (out 0 (decay s 0.2 * n)) }
− Help/UGen/Filter/decay2.help.lhs
@@ -1,19 +0,0 @@-decay2 in attackTime decayTime--Exponential decay. Decay has a very sharp attack and can produce-clicks. Decay2 rounds off the attack by subtracting one Decay from-another.--decay2 AR i a d is equivalent to decay AR i d - decay AR i a--Used as an envelope--> let { s = fSinOsc AR 600 0 * 0.25-> ; f = xLine KR 1 50 20 RemoveSynth }-> in audition (out 0 (decay2 (impulse AR f 0) 0.01 0.2 * s))--Compare the above with Decay used as the envelope.--> let { s = fSinOsc AR 600 0 * 0.25-> ; f = xLine KR 1 50 20 RemoveSynth }-> in audition (out 0 (decay (impulse AR f 0) 0.2 * s))
− Help/UGen/Filter/degreeToKey.help.lhs
@@ -1,25 +0,0 @@-degreeToKey bufnum in octave--Convert signal to modal pitch--The input signal value is truncated to an integer value and used-as an index into an octave repeating table of note values.-Indices wrap around the table and shift octaves as they do.--bufnum - index of the buffer which contains the steps for each- scale degree.-in - the input signal.-octave - the number of steps per octave in the scale.--> withSC3 (\fd -> do { async fd (b_alloc 0 7 1)-> ; send fd (b_setn 0 [(0, [0, 2, 3.2, 5, 7, 9, 10])]) })--> do { n <- lfNoise1 KR (mce [3, 3.05])-> ; let { x = mouseX KR 0 15 Linear 0.1-> ; k = degreeToKey 0 x 12-> ; f b = let { o = sinOsc AR (midiCPS (b + k + n * 0.04)) 0 * 0.1-> ; t = lfPulse AR (midiCPS (mce [48, 55])) 0.15 0.5-> ; d = rlpf t (midiCPS (sinOsc KR 0.1 0 * 10 + b)) 0.1 * 0.1-> ; m = o + d }-> in combN m 0.31 0.31 2 + m }-> in audition (out 0 ((f 48 + f 72) * 0.25)) }
− Help/UGen/Filter/delay1.help.lhs
@@ -1,6 +0,0 @@-delay1 in--Fixed Single sample delay.--> let s = impulse AR 1 0-> in audition (out 0 (s + (delay1 s)))
− Help/UGen/Filter/delay2.help.lhs
@@ -1,6 +0,0 @@-delay2 in--Fixed two sample delay.--> let s = impulse AR 1 0-> in audition (out 0 (s + (delay2 s)))
− Help/UGen/Filter/delayC.help.lhs
@@ -1,1 +0,0 @@-See delayN.
− Help/UGen/Filter/delayL.help.lhs
@@ -1,1 +0,0 @@-See delayN.
− Help/UGen/Filter/delayN.help.lhs
@@ -1,25 +0,0 @@-delayN in maxDelayTime delayTime--Simple delay line. There are three forms, delayN uses no-interpolation, delayL uses linear interpolation, delayA uses-all pass interpolation. The maximum delay length is set at-initialization time and cannot be extended.--Dust randomly triggers Decay to create an exponential decay-envelope for the WhiteNoise input source. The input is-mixed with the delay.--> do { d <- dust AR 1-> ; n <- whiteNoise AR-> ; let { z = decay d 0.3 * n-> ; x = mouseX KR 0.0 0.2 Linear 0.1 }-> in audition (out 0 (z + delayN z 0.2 x)) }--The delay time can be varied at control rate.-An oscillator either reinforcing or cancelling-with the delayed copy of itself.--> let { o = sinOsc AR 320 0 * 0.1-> ; l = 0.005-> ; x = mouseX KR 0.0 l Linear 0.15 }-> in audition (out 0 (o + delayN o l x))
− Help/UGen/Filter/formlet.help.lhs
@@ -1,13 +0,0 @@-formlet in freq attackTime decayTime--FOF-like filter--> audition (out 0 (formlet (impulse AR 20 0.5) 1000 0.01 0.1))--> let f = xLine KR 10 400 8 RemoveSynth-> in audition (out 0 (formlet (blip AR f 1000 * 0.1) 1000 0.01 0.1))--Modulating formant frequency.--> let s = blip AR (sinOsc KR 5 0 * 20 + 300) 1000 * 0.1-> in audition (out 0 (formlet s (xLine KR 1500 700 8 RemoveSynth) 0.005 0.04))
− Help/UGen/Filter/fos.help.lhs
@@ -1,13 +0,0 @@-fos in a0 a1 b1--First order filter section.--Same as OnePole.--> let x = lfTri AR 0.4 0 * 0.99-> in audition (out 0 (fos (lfSaw AR 200 0 * 0.2) (1 - (abs x)) 0 x))--Same as OneZero--> let x = lfTri AR 0.4 0 * 0.99-> in audition (out 0 (fos (lfSaw AR 200 0 * 0.2) (1 - (abs x)) x 0))
− Help/UGen/Filter/freeVerb.help.lhs
@@ -1,24 +0,0 @@-freeVerb in mix room damp-freeVerb2 in1 in2 mix room damp--A simple reverb.-- in, in1, in2 - input signal- mix - dry/wet balance (0,1)- room - room size (0,1)- damp - reverb high frequency damping (0,1)--> let { i = impulse AR 1 0-> ; c = lfCub AR 1200 0-> ; s = decay i 0.25 * c * 0.1-> ; x = mouseX KR 0 1 Linear 0.1-> ; y = mouseY KR 0 1 Linear 0.1-> ; r = freeVerb s y x 0.5 }-> in audition (out 0 r)--> let { i = soundIn (mce2 0 1)-> ; c = mceChannel-> ; x = mouseX KR 0 1 Linear 0.1-> ; y = mouseY KR 0 1 Linear 0.1-> ; r = freeVerb2 (c 0 i) (c 1 i) y x 0.5 }-> in audition (out 0 r)
− Help/UGen/Filter/freqShift.help.lhs
@@ -1,40 +0,0 @@-freqShift input shift phase--Single sideband amplitude modulation, also known as frequency-shifting, but not to be confused with pitch shifting. Frequency-shifting moves all the components of a signal by a fixed amount but-does not preserve the original harmonic relationships.-- input - audio input- shift - amount of shift in cycles per second- phase - phase of the frequency shift (0 - 2pi)--> import Sound.SC3--shifting a 100Hz tone by 1 Hz rising to 500Hz--> let { i = sinOsc AR 100 0-> ; s = xLine KR 1 500 5 RemoveSynth }-> in audition (out 0 (freqShift i s 0 * 0.1))--shifting a complex tone by 1 Hz rising to 500Hz--> let { d = klangSpec [101, 303, 606, 808] [1, 1, 1, 1] [1, 1, 1, 1]-> ; i = klang AR 1 0 d-> ; s = xLine KR 1 500 5 RemoveSynth }-> in audition (out 0 (freqShift i s 0 * 0.1))--modulating shift and phase--> do { s <- lfNoise2 AR 0.3-> ; let { i = sinOsc AR 10 0-> ; p = linLin (sinOsc AR 500 0) (-1) 1 0 (2 * pi) }-> in audition (out 0 (freqShift i (s * 1500) p * 0.1)) }--shifting bandpassed noise--> do { n1 <- whiteNoise AR-> ; n2 <- lfNoise0 AR 5.5-> ; let { i = bpf n1 1000 0.001-> ; s = n2 * 1000 }-> in audition (out 0 (freqShift i s 0 * 32)) }
− Help/UGen/Filter/hasher.help.lhs
@@ -1,8 +0,0 @@-hasher in--Returns a unique output value from zero to one for each input value-according to a hash function. The same input value will always-produce the same output value. The input need not be from zero to-one.--> audition (out 0 (hasher (line AR 0 1 1 RemoveSynth) * 0.2))
− Help/UGen/Filter/hpf.help.lhs
@@ -1,6 +0,0 @@-hpf in freq--Second order Butterworth highpass filter.--> let f = fSinOsc KR (xLine KR 0.7 300 20 RemoveSynth) 0 * 3600 + 4000-> in audition (out 0 (hpf (saw AR 200 * 0.2) f))
− Help/UGen/Filter/hpz1.help.lhs
@@ -1,6 +0,0 @@-hpz1 in--Two point difference filter.--> do { n <- whiteNoise AR-> ; audition (out 0 (hpz1 (n * 0.25))) }
− Help/UGen/Filter/hpz2.help.lhs
@@ -1,6 +0,0 @@-hpz2 in--Two zero fixed highpass filter.--> do { n <- whiteNoise AR-> ; audition (out 0 (hpz2 (n * 0.25))) }
− Help/UGen/Filter/klank.help.lhs
@@ -1,39 +0,0 @@-klank in freqScale freqOffset decayScale spec--Klank is a bank of fixed frequency resonators which can be used to-simulate the resonant modes of an object. Each mode is given a ring-time, which is the time for the mode to decay by 60 dB.--The UGen assistant Klank.spec can help create the 'spec' entry.-Note that the SC3 language reorders the inputs, the Hsc client does-not.--input - the excitation input to the resonant filter bank.--freqscale - a scale factor multiplied by all frequencies at- initialization time.--freqoffset - an offset added to all frequencies at initialization- time.--decayscale - a scale factor multiplied by all ring times at- initialization time.--> import Sound.SC3--> let s = klankSpec [800, 1071, 1153, 1723] [1, 1, 1, 1] [1, 1, 1, 1]-> in audition (out 0 (klank (impulse AR 2 0 * 0.1) 1 0 1 s))--There is a limited form of multiple channel expansion possible-at 'specification' input, below three equal dimensional -specifications are tranposed and force expansion in a sensible manner.--> let { u = [1, 1, 1, 1]-> ; p = [200, 171, 153, 172]-> ; q = [930, 971, 953, 1323]-> ; r = [8900, 16062, 9013, 7892]-> ; k = mce [klankSpec p u u, klankSpec q u u, klankSpec r u u]-> ; s = mceTranspose k-> ; i = mce [2, 2.07, 2.13]-> ; t = impulse AR i 0 * 0.1 }-> in audition (out 0 (mix (klank t 1 0 1 s)))
− Help/UGen/Filter/lag.help.lhs
@@ -1,6 +0,0 @@-lag in lagTime--A simple averaging filter.--> let x = mouseX KR 220 440 Linear 0.2-> in audition (out 0 (sinOsc AR (mce [x, lag x 1]) 0 * 0.1))
− Help/UGen/Filter/lag2.help.lhs
@@ -1,6 +0,0 @@-lag2 in lagTime--Lag2 is the same as lag KR (lag KR s t) t.--> let x = mouseX KR 220 440 Exponential 0.1-> in audition (out 0 (sinOsc AR (mce [x, lag2 x 1]) 0 * 0.1))
− Help/UGen/Filter/lag3.help.lhs
@@ -1,6 +0,0 @@-lag3 in lagTime--Lag3 is the same as lag KR (lag KR (lag KT s t) t) t.--> let x = mouseX KR 220 440 Exponential 0.1-> in audition (out 0 (sinOsc AR (mce [x, lag3 x 1]) 0 * 0.1))
− Help/UGen/Filter/latch.help.lhs
@@ -1,26 +0,0 @@-latch in trig--Sample and hold. Holds input signal value when triggered.--in - input signal.-trig - trigger. The trigger can be any signal. A trigger happens when the- signal changes from non-positive to positive.--> do { n <- whiteNoise AR-> ; let { i = impulse AR 9 0-> ; l = latch n i }-> in audition (out 0 (blip AR (l * 400 + 500) 4 * 0.2)) }--The above is just meant as example. LFNoise0 is a faster way to-generate random steps :--> do { n <- lfNoise0 KR 9-> ; audition (out 0 (blip AR (n * 400 + 500) 4 * 0.2)) }--http://create.ucsb.edu/pipermail/sc-users/2006-December/029991.html--> do { n0 <- lfNoise2 KR 8-> ; n1 <- lfNoise2 KR 3-> ; let { s = blip AR (n0 * 200 + 300) (n1 * 10 + 20)-> ; x = mouseX KR 1000 (sampleRate * 0.1) Exponential 0.1 }-> in audition (out 0 (latch s (impulse AR x 0))) }
− Help/UGen/Filter/leakDC.help.lhs
@@ -1,7 +0,0 @@-leakDC in coef--Remove DC. This filter removes a DC offset from a signal. in --input signal. coef - leak coefficient.--> let a = lfPulse AR 800 0.5 0.5 * 0.1-> in audition (out 0 (mce [a, leakDC a 0.995]))
− Help/UGen/Filter/limiter.help.lhs
@@ -1,7 +0,0 @@-limiter input level lookAheadTime--Peak limiter. Limits the input amplitude to the given-level. Limiter will not overshoot like Compander will, but it needs-to look ahead in the audio. Thus there is a delay equal to twice-the lookAheadTime. Limiter, unlike Compander, is completely-transparent for an in range signal.
− Help/UGen/Filter/linExp.help.lhs
@@ -1,20 +0,0 @@-linExp in srclo srchi dstlo dsthi--Map a linear range to an exponential range. The dstlo and dsthi-arguments must be nonzero and have the same sign.--in - input to convert.-srclo - lower limit of input range.-srchi - upper limit of input range.-dstlo - lower limit of output range.-dsthi - upper limit of output range.--> let f = linExp (mouseX KR 0 1 Linear 0.2) 0 1 440 660-> in audition (out 0 (sinOsc AR f 0 * 0.1))--The destination range may be k-rate.--> let { x = mouseX KR 0 1 Linear 0.2-> ; y = mouseY KR 220 440 Linear 0.2-> ; f = linExp x 0 1 y 660 }-> in audition (out 0 (sinOsc AR f 0 * 0.1))
− Help/UGen/Filter/linLin.help.lhs
@@ -1,19 +0,0 @@-linLin in srclo srchi dstlo dsthi--Map a linear range to another linear range.--in - input to convert.-srclo - lower limit of input range.-srchi - upper limit of input range.-dstlo - lower limit of output range.-dsthi - upper limit of output range.--> let f = linLin (mouseX KR 0 1 Linear 0.2) 0 1 440 660-> in audition (out 0 (sinOsc AR f 0 * 0.1))--The destination range may be k-rate.--> let { x = mouseX KR 0 1 Linear 0.2-> ; y = mouseY KR 220 440 Linear 0.2-> ; f = linLin x 0 1 y 660 }-> in audition (out 0 (sinOsc AR f 0 * 0.1))
− Help/UGen/Filter/lpf.help.lhs
@@ -1,11 +0,0 @@-lpf in freq--Second order Butterworth lowpass filter.--> let f = xLine KR 0.7 300 20 RemoveSynth-> in audition (out 0 (lpf (saw AR 200 * 0.1) (fSinOsc KR f 0 * 3600 + 4000)))--Control rate filtering.--> let ctl = lpf (lfPulse KR 8 0 0.5) (mouseX KR 2 50 Exponential 0.1)-> in audition (out 0 (sinOsc AR (ctl * 200 + 400) 0 * 0.1))
− Help/UGen/Filter/lpz1.help.lhs
@@ -1,6 +0,0 @@-lpz1 in--Two point average filter--> do { n <- whiteNoise AR-> ; audition (out 0 (lpz1 (n * 0.25))) }
− Help/UGen/Filter/lpz2.help.lhs
@@ -1,6 +0,0 @@-lpz2 in--Two zero fixed lowpass filter--> do { n <- whiteNoise AR-> ; audition (out 0 (lpz2 (n * 0.25))) }
− Help/UGen/Filter/mantissaMask.help.lhs
@@ -1,11 +0,0 @@-mantissaMask in bits--Masks off bits in the mantissa of the floating point sample-value. This introduces a quantization noise, but is less severe-than linearly quantizing the signal.--in - input signal-bits - the number of mantissa bits to preserve. a number from 0 to 23.--> let s = sinOsc AR (sinOsc KR 0.2 0 * 400 + 500) 0 * 0.4-> in audition (out 0 (mantissaMask s 3))
− Help/UGen/Filter/median.help.lhs
@@ -1,25 +0,0 @@-median length in--Median filter.--Signal with impulse noise.--> do { n <- dust2 AR 100-> ; audition (out 0 (median 3 (saw AR 500 * 0.1 + n * 0.9))) }--The median length can be increased for longer duration noise.--> do { n <- dust2 AR 100-> ; audition (out 0 (median 5 (saw AR 500 * 0.1 + lpz1 (n * 0.9)))) }--Long Median filters begin chopping off the peaks of the waveform--> let x = sinOsc AR 1000 0 * 0.2-> in audition (out 0 (mce [x, median 31 x]))--Another noise reduction application. Use Median filter for high-frequency noise. Use LeakDC for low frequency noise.--> do { n <- whiteNoise AR-> ; let s = median 31 (n * 0.1 + sinOsc AR 800 0 * 0.1)-> in audition (out 0 (leakDC s 0.9)) }
− Help/UGen/Filter/moogFF.help.lhs
@@ -1,36 +0,0 @@-moogFF in freq gain reset--Moog VCF implementation, designed by Federico Fontana. A digital-implementation of the Moog VCF (filter).-- in - the input signal- freq - the cutoff frequency- gain - the filter resonance gain, between zero and 4- reset - when greater than zero, this will reset the- state of the digital filters at the beginning- of a computational block.--The design of this filter is described in the conference paper-Fontana, F. (2007) Preserving the Digital Structure of the Moog-VCF. In Proc. ICMC07, Copenhagen, 25-31 August 2007--> import Sound.SC3--> do { n <- whiteNoise AR-> ; let { y = mouseY KR 100 10000 Exponential 0.1-> ; x = mouseX KR 0 4 Linear 0.1 }-> in audition (out 0 (moogFF (n * 0.1) y x 0)) }--Note distortion at high gain.--> let { x = mouseX KR 100 20000 Exponential 0.1-> ; y = mouseY KR 0.1 4.0 Linear 0.1-> ; i = mix (saw AR (mce [0.99, 1, 1.01] * 440)) * 0.3 }-> in audition (out 0 (moogFF i x y 0))--> do { n <- lfNoise0 KR 0.43-> ; let { p = pulse AR (mce [40, 121]) (mce [0.3, 0.7])-> ; f0 = linLin n 0 1 0.001 2.2-> ; f = linLin (sinOsc KR f0 0) (-1) 1 30 4200-> ; y = mouseY KR 1 4 Linear 0.1 }-> in audition (out 0 (moogFF p f (0.83 * y) 0)) }
− Help/UGen/Filter/normalizer.help.lhs
@@ -1,11 +0,0 @@-normalizer i l d-- i - input signal- l - level- d - duration (0.01)--Flattens dynamics.--> let { s = fSinOsc AR 500 0-> ; z = decay2 (impulse AR 8 (lfSaw KR 0.25 (-0.6) * 0.7)) 0.001 0.3 * s }-> in audition (out 0 (mce [z, normalizer z 0.4 0.01]))
− Help/UGen/Filter/onePole.help.lhs
@@ -1,17 +0,0 @@-onePole in coef--A one pole filter. Implements the formula: out(i) = ((1 --abs(coef)) * in(i)) + (coef * out(i-1)).--in - input signal to be processed-coef - feedback coefficient. Should be between -1 and +1--> do { n <- whiteNoise AR-> ; audition (out 0 (onePole (n * 0.5) 0.95)) }--> do { n <- whiteNoise AR-> ; audition (out 0 (onePole (n * 0.5) (-0.95))) }--> do { n <- whiteNoise AR-> ; let c = line KR (-0.99) 0.99 10 RemoveSynth-> in audition (out 0 (onePole (n * 0.5) c)) }
− Help/UGen/Filter/oneZero.help.lhs
@@ -1,13 +0,0 @@-oneZero in coef--One zero filter--> do { n <- whiteNoise AR-> ; audition (out 0 (oneZero (n * 0.5) 0.5)) }--> do { n <- whiteNoise AR-> ; audition (out 0 (oneZero (n * 0.5) (-0.5))) }--> do { n <- whiteNoise AR-> ; let c = line KR (-0.5) 0.5 10 RemoveSynth-> in audition (out 0 (oneZero (n * 0.5) c)) }
− Help/UGen/Filter/pitchShift.help.lhs
@@ -1,7 +0,0 @@-pitchShift in winSize pchRatio pchDispersion timeDispersion--A simple time domain pitch shifter.--> let { r = mouseX KR 0.5 2.0 Linear 0.1-> ; d = mouseY KR 0.0 0.1 Linear 0.1 }-> in audition (out 0 (pitchShift (sinOsc AR 440 0) 0.2 r d 0))
− Help/UGen/Filter/pluck.help.lhs
@@ -1,45 +0,0 @@-pluck in tr maxdelaytime delaytime decaytime coef--Karplus-Strong synthesis.--in - an excitation signal--tr - upon a negative to positive transition, the excitation signal- will be fed into the delay line--maxdelaytime - the max delay time in seconds (initializes the- internal delay buffer).--delaytime - delay time in seconds.--decaytime - time for the echoes to decay by 60 decibels. Negative- times emphasize odd partials.--coef - the coef of the internal OnePole filter. Values should be- between -1 and +1 (larger values will be unstable... so be- careful!).--Excitation signal is WhiteNoise, triggered twice a second with-varying OnePole coef.--> import Sound.SC3.Monadic--> do { n <- whiteNoise AR-> ; let { t = impulse KR 9 0-> ; x = mouseX KR (-0.999) 0.999 Linear 0.1-> ; y = mouseY KR 0.1 1 Linear 0.1-> ; dl = 1 / 440 }-> in audition (out 0 (pluck (n * 0.25) t dl (dl * y) 10 x)) }--> let n = 25-> in do { f <- clone n (rand 0.05 0.2)-> ; p <- clone n (rand 0 1)-> ; w <- clone n (whiteNoise AR)-> ; fi <- clone n (rand 10 12)-> ; coef <- rand 0.01 0.2-> ; l <- clone n (rand (-1) 1)-> ; let { x = mouseX KR 60 1000 Exponential 0.1-> ; o = linLin (sinOsc KR f p) (-1) 1 x 3000-> ; i = impulse KR fi 0-> ; ks = pluck (w * 0.1) i 0.01 (1 / o) 2 coef }-> in audition (out 0 (leakDC (mix (pan2 ks l 1)) 0.995)) }
− Help/UGen/Filter/ramp.help.lhs
@@ -1,16 +0,0 @@-ramp in lagTime--Linear lag. This is similar to Lag but with a linear rather than-exponential lag. This is useful for smoothing out control signals.-- in - input signal- lagTime - 60 dB lag time in seconds--Used to lag pitch--> import Sound.SC3--> let { o = lfPulse KR 4 0 0.5 * 50 + 400-> ; l = line KR 0 1 15 DoNothing-> ; f = ramp o l }-> in audition (out 0 (sinOsc AR f 0 * 0.3))
− Help/UGen/Filter/resonz.help.lhs
@@ -1,37 +0,0 @@-resonz in freq bwr--Resonant filter.--A two pole resonant filter with zeroes at z = +/- 1. Based on-K. Steiglitz, "A Note on Constant-Gain Digital Resonators,"-Computer Music Journal, vol 18, no. 4, pp. 8-10, Winter 1994. The-reciprocal of Q is used rather than Q because it saves a divide-operation inside the unit generator.-- in - input signal to be processed- freq - resonant frequency in Hertz- rq - bandwidth ratio (reciprocal of Q). - rq = bandwidth / centerFreq--> import Sound.SC3.ID--> let n = whiteNoise 'a' AR-> in audition (out 0 (resonz (n * 0.5) 2000 0.1))--Modulate frequency--> let { n = whiteNoise 'a' AR-> ; f = xLine KR 1000 8000 10 RemoveSynth }-> in audition (out 0 (resonz (n * 0.5) f 0.05))--Modulate bandwidth--> let { n = whiteNoise 'a' AR-> ; bw = xLine KR 1 0.001 8 RemoveSynth }-> in audition (out 0 (resonz (n * 0.5) 2000 bw))--Modulate bandwidth opposite direction--> let { n = whiteNoise 'a' AR-> ; bw = xLine KR 0.001 1 8 RemoveSynth }-> in audition (out 0 (resonz (n * 0.5) 2000 bw))
− Help/UGen/Filter/rhpf.help.lhs
@@ -1,8 +0,0 @@-rhpf in freq rq--A resonant high pass filter.--> import Sound.SC3--> let f = fSinOsc KR (xLine KR 0.7 300 20 RemoveSynth) 0 * 3600 + 4000-> in audition (out 0 (rhpf (saw AR 200 * 0.1) f 0.2))
− Help/UGen/Filter/ringz.help.lhs
@@ -1,33 +0,0 @@-ringz in freq decayTime--Ringing filter. This is the same as Resonz, except that instead of-a resonance parameter, the bandwidth is specified in a 60dB ring-decay time. One Ringz is equivalent to one component of the Klank-UGen.--> import Sound.SC3.Monadic--> do { n <- dust AR 3-> ; audition (out 0 (ringz (n * 0.3) 2000 2)) }--> do { n <- whiteNoise AR-> ; audition (out 0 (ringz (n * 0.005) 2000 0.5)) }--Modulate frequency--> do { n <- whiteNoise AR-> ; let f = xLine KR 100 3000 10 RemoveSynth-> in audition (out 0 (ringz (n * 0.005) f 0.5)) }--> let f = xLine KR 100 3000 10 RemoveSynth-> in audition (out 0 (ringz (impulse AR 6 0.3) f 0.5))--Modulate ring time--> let rt = xLine KR 4 0.04 8 RemoveSynth-> in audition (out 0 (ringz (impulse AR 6 0.3) 2000 rt))--Modulate ring time opposite direction--> let rt = xLine KR 0.04 4 8 RemoveSynth-> in audition (out 0 (ringz (impulse AR 6 0.3) 2000 rt))
− Help/UGen/Filter/rlpf.help.lhs
@@ -1,13 +0,0 @@-rlpf in freq rq--A resonant low pass filter.--> import Sound.SC3.ID--> let { n = whiteNoise 'a' AR-> ; f = sinOsc AR 0.5 0 * 40 + 220-> ; r = rlpf n f 0.1 }-> in audition (out 0 r)--> let f = fSinOsc KR (xLine KR 0.7 300 20 RemoveSynth) 0 * 3600 + 4000-> in audition (out 0 (rlpf (saw AR 200 * 0.1) f 0.2))
− Help/UGen/Filter/select.help.lhs
@@ -1,20 +0,0 @@-select which array--The output is selected from an array of inputs.--> import Sound.SC3--> let { n = 3/2-> ; a = mce [sinOsc AR 440 0, saw AR 440, pulse AR 440 0.1] }-> in audition (out 0 (select (lfSaw KR 1 0 * n + n) a * 0.2))--Note: all input ugens are continously running. This may not be the-most efficient way if each input is cpu-expensive.--Here used as a sequencer:--> let { n = 10-> ; a = mce [517, 403, 89, 562, 816, 107, 241, 145, 90, 224]-> ; c = n / 2 -> ; f = select (lfSaw KR 0.5 0 * c + c) a }-> in audition (out 0 (saw AR f * 0.2))
− Help/UGen/Filter/shaper.help.lhs
@@ -1,16 +0,0 @@-shaper bufnum in--Wave shaper. Performs waveshaping on the input signal by indexing-into the table.--bufnum - the number of a buffer filled in wavetable format- containing the transfer function.--in - the input signal.--> import Sound.SC3--> let s = sinOsc AR 300 0 * line KR 0 1 6 RemoveSynth-> in withSC3 (\fd -> do { async fd (b_alloc 10 512 1)-> ; async fd (b_gen 10 "cheby" [0, 1, 0, 1, 1, 0, 1])-> ; audition (out 0 (shaper 10 s * 0.5)) })
− Help/UGen/Filter/slew.help.lhs
@@ -1,7 +0,0 @@-slew in up dn--Has the effect of removing transients and higher frequencies.--> import Sound.SC3--> audition (out 0 (slew (saw AR 800 * 0.2) 400 400))
− Help/UGen/Filter/sos.help.lhs
@@ -1,15 +0,0 @@-sos in a0 a1 a2 b1 b2--Second order filter section (biquad). A standard second order-filter section. Filter coefficients are given directly rather than-calculated for you.--Same as TwoPole--> import Sound.SC3--> let { theta = line KR (0.2 * pi) pi 5 RemoveSynth-> ; rho = line KR 0.6 0.99 5 RemoveSynth-> ; b1 = 2 * rho * cos theta-> ; b2 = - (rho * rho) }-> in audition (out 0 (sos (lfSaw AR 200 0 * 0.1) 1 0 0 b1 b2))
− Help/UGen/Filter/twoPole.help.lhs
@@ -1,14 +0,0 @@-twoPole in freq radius--Two pole filter. A two pole filter. This provides lower level-access to setting of pole location. For general purposes Resonz is-better.--> import Sound.SC3.Monadic--> do { n <- whiteNoise AR-> ; audition (out 0 (twoPole (n * 0.005) 2000 0.95)) }--> do { n <- whiteNoise AR-> ; let f = xLine KR 800 8000 8 RemoveSynth-> in audition (out 0 (twoPole (n * 0.005) f 0.95)) }
− Help/UGen/Filter/twoZero.help.lhs
@@ -1,9 +0,0 @@-twoZero in freq radius--Two zero filter--> import Sound.SC3.Monadic--> do { n <- whiteNoise AR-> ; let f = xLine KR 20 20000 8 RemoveSynth-> in audition (out 0 (twoZero (n * 0.125) f 1)) }
− Help/UGen/Filter/wrapIndex.help.lhs
@@ -1,19 +0,0 @@-wrapIndex bufnum in--Index into a table with a signal.--The input signal value is truncated to an integer value and used as-an index into the table. Out of range index values are wrapped-cyclically to the valid range.--bufnum - index of the buffer-in - the input signal.--> import Sound.SC3--> withSC3 (\fd -> do { async fd (b_alloc 0 6 1)-> ; send fd (b_setn 0 [(0, [200, 300, 400, 500, 600, 800])]) })--> let { x = mouseX KR 0 18 Linear 0.1-> ; f = wrapIndex 0 x }-> in audition (out 0 (sinOsc AR f 0 * 0.5))
− Help/UGen/Granular/grainBuf.help.lhs
@@ -1,46 +0,0 @@-grainBuf nc tr dur sndbuf rate pos interp pan envbuf--Granular synthesis with sound stored in a buffer--nc - the number of channels to output. If 1, mono is returned and- pan is ignored.--tr - a kr or ar trigger to start a new grain. If ar, grains after- the start of the synth are sample accurate.--The following args are polled at grain creation time--dur - size of the grain.--sndbuf - the buffer holding an audio signal--rate - the playback rate of the sampled sound--pos - the playback position for the grain to start with (0 is- beginning, 1 is end of file)--interp - the interpolation method used for pitchshifting grains.- 1 = no interpolation. 2 = linear. 4 = cubic interpolation- (more computationally intensive).--pan - a value from -1 to 1. Determines where to pan the output in- the same manner as PanAz.--envb - the buffer number containing a signal to use for the- grain envelope. -1 uses a built-in Hanning envelope.--> import Sound.SC3.Monadic--> let { fn = "/home/rohan/audio/metal.wav"-> ; b = 10-> ; e = -1-> ; x = mouseX KR (-1) 1 Linear 0.1-> ; y = mouseY KR 10 45 Linear 0.1-> ; i = impulse KR y 0-> ; r n = linLin n (-1) 1 0.5 2-> ; p n = linLin n (-1) 1 0 1-> ; g n1 n2 = grainBuf 2 i 0.1 b (r n1) (p n2) 2 x e }-> in withSC3 (\fd -> do { send fd (b_allocRead 10 fn 0 0)-> ; n1 <- lfNoise1 KR 500-> ; n2 <- lfNoise2 KR 0.1-> ; play fd (out 0 (g n1 n2)) })
− Help/UGen/Granular/grainFM.help.lhs
@@ -1,38 +0,0 @@-grainFM nc tr dur carfreq modfreq index pan envbuf--Granular synthesis with frequency modulated sine tones--nc - the number of channels to output. If 1, mono is returned and- pan is ignored.--tr - a kr or ar trigger to start a new grain. If ar, grains after- the start of the synth are sample accurate.--The following args are polled at grain creation time--dur - size of the grain.--carfreq - the carrier freq of the grain generators internal- oscillator--modfreq - the modulating freq of the grain generators internal- oscillator--index - the index of modulation--pan - a value from -1 to 1. Determines where to pan the output in- the same manner as PanAz.--envbuf - the buffer number containing a singal to use for the grain- envelope. -1 uses a built-in Hanning envelope.--> import Sound.SC3.Monadic--> do { n1 <- whiteNoise KR-> ; n2 <- lfNoise1 KR 500-> ; let { x = mouseX KR (-0.5) 0.5 Linear 0.1-> ; y = mouseY KR 0 400 Linear 0.1-> ; f = n1 * y + 440-> ; t = impulse KR 10 0 -> ; i = linLin n2 (-1) 1 1 10 }-> in audition (out 0 (grainFM 2 t 0.1 f 200 i x (-1) * 0.1)) }
− Help/UGen/Granular/grainIn.help.lhs
@@ -1,30 +0,0 @@-grainIn nc tr dur in pan envbuf--Granulate an input signal--nc - the number of channels to output. If 1, mono is- returned and pan is ignored.--tr - a kr or ar trigger to start a new grain. If ar, grains- after the start of the synth are sample accurate.--The following args are polled at grain creation time--dur - size of the grain.--in - the input to granulate--pan - a value from -1 to 1. Determines where to pan the output in- the same manner as PanAz.--envbuf - the buffer number containing a singal to use for the- grain envelope. -1 uses a built-in Hanning envelope.--> import Sound.SC3.Monadic--> do { n <- pinkNoise AR-> ; let { x = mouseX KR (-0.5) 0.5 Linear 0.1-> ; y = mouseY KR 5 25 Linear 0.1-> ; t = impulse KR y 0 -> ; g = grainIn 2 t 0.1 n x (-1) * 0.1 }-> in audition (out 0 g) }
− Help/UGen/Granular/grainSin.help.lhs
@@ -1,30 +0,0 @@-grainSin nc tr dur freq pan envbuf--Granular synthesis with sine tones--nc - the number of channels to output. If 1, mono is returned and- pan is ignored.--tr - a kr or ar trigger to start a new grain. If ar, grains after- the start of the synth are sample accurate.--The following args are polled at grain creation time--dur - size of the grain.--freq - the input to granulate--pan - a value from -1 to 1. Determines where to pan the output in- the same manner as PanAz.--envbuf - the buffer number containing a singal to use for the grain- envelope. -1 uses a built-in Hanning envelope.--> import Sound.SC3.Monadic--> do { n <- whiteNoise KR-> ; let { x = mouseX KR (-0.5) 0.5 Linear 0.1-> ; y = mouseY KR 0 400 Linear 0.1-> ; f = n * y + 440-> ; t = impulse KR 10 0 }-> in audition (out 0 (grainSin 2 t 0.1 f x (-1) * 0.1)) }
− Help/UGen/Granular/warp1.help.lhs
@@ -1,43 +0,0 @@-warp1 nc buf ptr freqScale windowSize envbuf overlaps windowRandRatio interp--Warp a buffer with a time pointer--Inspired by Chad Kirby's SuperCollider2 Warp1 class, which was-inspired by Richard Karpen's sndwarp for CSound. A granular time-strecher and pitchshifter.--nc - the number of channels in the soundfile used in bufnum.--buf - the buffer number of a mono soundfile.--ptr - the position in the buffer. The value should be between 0- and 1, with 0 being the begining of the buffer, and 1 the- end.--freqScale - the amount of frequency shift. 1.0 is normal, 0.5 is- one octave down, 2.0 is one octave up. Negative values- play the soundfile backwards.--windowSize - the size of each grain window.--envbuf - the buffer number containing a singal to use for the grain- envelope. -1 uses a built-in Hanning envelope.--overlaps - the number of overlaping windows.--windowRandRatio - the amount of randomness to the windowing- function. Must be between 0 (no randomness) to- 1.0 (probably to random actually)--interp - the interpolation method used for pitchshifting grains. 1- = no interpolation. 2 = linear. 4 = cubic interpolation- (more computationally intensive).--> import Sound.SC3--> let { fn = "/home/rohan/audio/metal.wav"-> ; p = linLin (lfSaw KR 0.05 0) (-1) 1 0 1-> ; x = mouseX KR 0.5 2 Linear 0.1-> ; w = warp1 1 10 p x 0.1 (-1) 8 0.1 2 }-> in withSC3 (\fd -> do { send fd (b_allocRead 10 fn 0 0)-> ; play fd (out 0 w) })
− Help/UGen/IO/in.help.lhs
@@ -1,32 +0,0 @@-in' numChannels rate bus--Read signal from an audio or control bus.--Patching input to output.--> import Sound.SC3--> audition (out 0 (in' 2 AR numOutputBuses))--Patching input to output, with delay.--> let { i = in' 2 AR numOutputBuses-> ; d = delayN i 0.5 0.5 }-> in audition (out 0 (i + d))--Write noise to bus 10, then read it out. The multiple root graph is ordered.--> import Sound.SC3.ID--> let { n = pinkNoise 'a' AR-> ; wr = out 10 (n * 0.3)-> ; rd = out 0 (in' 1 AR 10) }-> in audition (mrg [rd, wr])--Reading a control bus.--> withSC3 (\fd -> send fd (c_set [(0, 300)]))--> audition (out 0 (sinOsc AR (in' 1 KR 0) 0 * 0.1))--> withSC3 (\fd -> send fd (c_set [(0, 600)]))
− Help/UGen/IO/inFeedback.help.lhs
@@ -1,61 +0,0 @@-inFeedback numChannels bus--Read signal from a bus without erasing it.--The output (Out) ugens overwrite data on the bus, giving this bus a-new timestamp so that any input (In) ugen can check if the data was-written within the current cycle. The next cycle this data is still-there, but in case of audio one normally doesn't want an in ugen to-read it again, as it might cause feedback.--This is the reason why In ar checks the timestamp and ignores-everything that was not written within this cycle. This means that-nodes can only read data from a bus that was written by a-preceeding node when using the In ar ugen which overwrites the old-data. This is good for audio, but for control data it is more-convenient to be able to read a bus from any place in the node-order.--This is why In kr behaves differently and reads also data with a-timestamp that is one cycle old. Now in some cases we want to be-able to read audio from a bus independant of the current node-order, which is the use of InFeedback. The delay introduced by-this is at a maximum one block size, which equals about 0.0014 sec-at the default block size and sample rate.--Audio feedback modulation.--> import Sound.SC3--> let { f = inFeedback 1 0 * 1300 + 300-> ; s = sinOsc AR f 0 * 0.4 }-> in audition (out 0 s)--Evaluate these in either order and hear both tones.--> let { b = numInputBuses + numOutputBuses-> ; s = inFeedback 1 b }-> in audition (out 0 s)--> let { b = numInputBuses + numOutputBuses-> ; s0 = out b (sinOsc AR 220 0 * 0.1)-> ; s1 = out 0 (sinOsc AR 660 0 * 0.1) }-> in audition (mrg [s0, s1])--Doubters consult this.--> let { b = numInputBuses + numOutputBuses-> ; s = in' 1 AR b }-> in audition (out 0 s)--Resonator, see localOut for variant.--> let { b = numInputBuses + numOutputBuses-> ; p = inFeedback 1 b-> ; i = impulse AR 1 0-> ; d = delayC (i + (p * 0.995)) 1 (recip 440 - recip controlRate) }-> in audition (mrg [offsetOut b d, offsetOut 0 p])--Compare with oscillator.--> audition (out 1 (sinOsc AR 440 0 * 0.2))
− Help/UGen/IO/inTrig.help.lhs
@@ -1,19 +0,0 @@-inTrig numChannels bus--Generate a trigger anytime a bus is set.--Any time the bus is "touched" ie. has its value set (using "/c_set"-etc.), a single impulse trigger will be generated. Its amplitude-is the value that the bus was set to.--Run an oscillator with the trigger at bus 10.--> import Sound.SC3--> let { t = inTrig 1 10-> ; e = envGen KR t t 0 1 DoNothing (envPerc 0.01 1) }-> in audition (out 0 (sinOsc AR 440 0 * e))--Set bus 10, each set will trigger a ping.--> withSC3 (\fd -> send fd (c_set1 10 0.1))
− Help/UGen/IO/keyState.help.lhs
@@ -1,11 +0,0 @@-keyState KR keyNum minVal maxVal lag--Report the status of a particular key. A key is either pressed, or-not pressed.--The keycode 38 is the A key on my keyboard. Under X the xev(1)-command is useful in determining your keyboard layout.--> import Sound.SC3--> audition (out 0 (sinOsc AR 800 0 * keyState KR 38 0 0.1 0.5))
− Help/UGen/IO/lagIn.help.lhs
@@ -1,12 +0,0 @@-lagIn numChannels bus lag--Smooth a control rate input signal.--> import Control.Concurrent-> import Sound.SC3--> withSC3 (\fd -> do -> { send fd (c_set [(10, 200)])-> ; play fd (out 0 (sinOsc AR (lagIn 1 10 1) 0 * 0.1))-> ; threadDelay 500000-> ; send fd (c_set [(10, 2000)]) })
− Help/UGen/IO/localBuf.help.lhs
@@ -1,81 +0,0 @@-localBuf id nf nc-maxLocalBufs n-setBuf b xs o-asLocalBuf id xs-- id - node identifier- nf - number of frames (default: 1)- nc - number of channels for multiple channel buffers (default: 1)- n - maximum number of local buffers per graph- b - buffer identifier- xs - sequential values to store at buffer--Allocate a buffer local to the synthesis graph.--> import Sound.SC3.Monadic--> do { n <- whiteNoise AR-> ; let { m = maxLocalBufs 1-> ; b = mrg2 (localBuf 'α' 2048 1) m-> ; f = fft' b n-> ; c = pv_BrickWall f (sinOsc KR 0.1 0 * 0.75) }-> in audition (out 0 (ifft' c * 0.1)) }--> do { n <- clone 2 (whiteNoise AR)-> ; let { m = maxLocalBufs 2-> ; b = mrg2 (mce (map (\i -> localBuf i 2048 1) ['α', 'β'])) m-> ; f = fft' b n-> ; c = pv_BrickWall f (sinOsc KR (mce2 0.1 0.11) 0 * 0.75) }-> in audition (out 0 (ifft' c * 0.1)) }--not clearing the buffer accesses old data:-slowly overwrite data with noise--> let { m = maxLocalBufs 1-> ; b = mrg2 (localBuf 'α' 2048 2) m-> ; nf = bufFrames KR b-> ; x = mouseX KR 1 2 Linear 0.2-> ; r = playBuf 2 b x 1 0 Loop DoNothing * 0.1-> ; wr ph i = bufWr b (linLin ph (-1) 1 0 nf) Loop i }-> in do { n <- clone 2 (whiteNoise AR)-> ; ph <- lfNoise0 AR 530-> ; audition (mrg2 (out 0 r) (wr ph n)) }--bufCombC needs no clearing, because the delay line is filled by the ugen--> do { d <- clone 2 (dust AR 1)-> ; n <- whiteNoise AR-> ; let { z = decay d 0.3 * n-> ; l = xLine KR 0.0001 0.01 20 DoNothing-> ; sr = sampleRate-> ; m = maxLocalBufs 2-> ; b = mrg2 (mce (map (\i -> localBuf i sr 2) ['α', 'β'])) m }-> in audition (out 0 (bufCombC b z l 0.2)) }--asLocalBuf combines localBuf and setBuf--> let { b = asLocalBuf 'α' [2, 1, 5, 3, 4, 0]-> ; x = mouseX KR 0 (bufFrames KR b) Linear 0.2-> ; f = indexL b x * 100 + 40-> ; o = saw AR (f * mce2 1 1.1) * 0.1 }-> in audition (out 0 o)--> let { b = asLocalBuf 'α' [2, 3, 4, 0, 1, 5]-> ; n = bufFrames KR b-> ; x = floorE (mouseX KR 0 n Linear 0.1)-> ; i = detectIndex b x }-> in audition (out 0 (sinOsc AR (linExp i 0 n 200 700) 0 * 0.1))--> do { n <- lfNoise1 KR (mce [3, 3.05])-> ; let { x = mouseX KR 0 15 Linear 0.1-> ; b = asLocalBuf 'α' [0, 2, 3.2, 5, 7, 9, 10]-> ; k = degreeToKey b x 12-> ; mk_c bf = let { f0 = midiCPS (bf + k + n * 0.04)-> ; o = sinOsc AR f0 0 * 0.1-> ; f1 = midiCPS (mce [48, 55])-> ; t = lfPulse AR f1 0.15 0.5-> ; f2 = midiCPS (sinOsc KR 0.1 0 * 10 + bf)-> ; d = rlpf t f2 0.1 * 0.1-> ; m = o + d }-> in combN m 0.31 0.31 2 + m }-> in audition (out 0 ((mk_c 48 + mk_c 72) * 0.25)) }
− Help/UGen/IO/localIn.help.lhs
@@ -1,20 +0,0 @@-localIn numChannels rate--Define and read from buses local to a SynthDef--numChannels - the number of channels of local buses.--LocalIn defines buses that are local to the SynthDef. These are like-the global buses, but are more convenient if you want to implement a-self contained effect that uses a feedback processing loop. There can-only be one audio rate and one control rate LocalIn per SynthDef. The-audio can be written to the bus using LocalOut.--> import Sound.SC3.ID--> let { n = whiteNoise 'a' AR-> ; a0 = decay (impulse AR 0.3 0) 0.1 * n * 0.2-> ; a1 = localIn 2 AR + mce [a0, 0]-> ; a2 = delayN a1 0.2 0.2 -> ; a3 = mceEdit reverse a2 * 0.8 }-> in audition (mrg [localOut a3, out 0 a2])
− Help/UGen/IO/localOut.help.lhs
@@ -1,38 +0,0 @@-localOut signal--Write to buses local to a synth.--LocalOut writes to buses that are local to the enclosing synth. The-buses should have been defined by a LocalIn ugen. The channelsArray-must be the same number of channels as were declared in the-LocalIn. These are like the global buses, but are more convenient if-you want to implement a self contained effect that uses a feedback-processing loop. See [LocalIn].--N.B. Audio written to a LocalOut will not be read by a corresponding-LocalIn until the next cycle, i.e. one block size of samples-later. Because of this it is important to take this additional delay-into account when using LocalIn to create feedback delays with delay-times shorter than the threshold of pitch (i.e. < 0.05 seconds or >-20Hz), or where sample accurate alignment is required. See the-resonator example below.--> import Sound.SC3.ID--> let { n = whiteNoise 'a' AR-> ; a0 = decay (impulse AR 0.3 0) 0.1 * n * 0.2-> ; a1 = localIn 2 AR + mce [a0, 0]-> ; a2 = delayN a1 0.2 0.2-> ; a3 = mceEdit reverse a2 * 0.8 }-> in audition (mrg [localOut a3, out 0 a2])--Resonator, must subtract blockSize for correct tuning--> let { p = localIn 1 AR-> ; i = impulse AR 1 0-> ; d = delayC (i + (p * 0.995)) 1 (recip 440 - recip controlRate) }-> in audition (mrg [offsetOut 0 p, localOut d])--Compare with oscillator.--> audition (out 1 (sinOsc AR 440 0 * 0.2))
− Help/UGen/IO/mouseButton.help.lhs
@@ -1,8 +0,0 @@-mouseButton KR minval maxval lag--Report the status of the first pointer button. The button is either-pressed, or not pressed.--> import Sound.SC3--> audition (out 0 (sinOsc AR 800 0 * mouseButton KR 0 0.1 0.1))
− Help/UGen/IO/mouseX.help.lhs
@@ -1,9 +0,0 @@-mouseX KR minval maxval warp lag--Report mouse location on root window of the machine that the synthesis-server is running on.--> import Sound.SC3--> let x = mouseX KR 40 10000 Exponential 0.2-> in audition (out 0 (sinOsc AR x 0 * 0.1))
− Help/UGen/IO/mouseY.help.lhs
@@ -1,10 +0,0 @@-mouseY KR minval maxval warp lag--Report mouse location on root window of the machine that the-synthesis server is running on.--> import Sound.SC3--> let { freq = mouseX KR 20 2000 Exponential 0.1-> ; ampl = mouseY KR 0.01 0.1 Linear 0.1 }-> in audition (out 0 (sinOsc AR freq 0 * ampl))
− Help/UGen/IO/offsetOut.help.lhs
@@ -1,14 +0,0 @@-offsetOut bufferIndex inputs- -Output signal to a bus, the sample offset within the bus is kept-exactly. This ugen is used where sample accurate output is needed.--> import Sound.SC3--> let { a = offsetOut 0 (impulse AR 5 0)-> ; b = out 0 (sinOsc AR 60 0 * 0.1) }-> in audition (mrg [a, b])--> let { a = out 0 (impulse AR 5 0)-> ; b = out 0 (sinOsc AR 60 0 * 0.1) }-> in audition (mrg [a, b])
− Help/UGen/IO/out.help.lhs
@@ -1,9 +0,0 @@-out bufferIndex inputs--Send signal to an audio or control buss, mix with existing signal.-The user is responsible for making sure that the number of channels-match and that there are no conflicts.--> import Sound.SC3--> audition (out 0 (sinOsc AR (mce [330, 331]) 0 * 0.1))
− Help/UGen/IO/replaceOut.help.lhs
@@ -1,17 +0,0 @@-replaceOut bufferIndex inputs--Send signal to a bus, overwrite existing signal.--> import Sound.SC3--> let { a = out 0 (sinOsc AR (mce [330, 331]) 0 * 0.1)-> ; b = replaceOut 0 (sinOsc AR (mce [880, 881]) 0 * 0.1)-> ; c = out 0 (sinOsc AR (mce [120, 121]) 0 * 0.1) }-> in audition (mrg [a, b, c])--Compare to:--> let { a = out 0 (sinOsc AR (mce [330, 331]) 0 * 0.1)-> ; b = out 0 (sinOsc AR (mce [880, 881]) 0 * 0.1)-> ; c = out 0 (sinOsc AR (mce [120, 121]) 0 * 0.1) }-> in audition (mrg [a, b, c])
− Help/UGen/IO/soundIn.help.lhs
@@ -1,14 +0,0 @@-soundIn channel--Read audio from the sound input hardware.--channel - input channel number to read, - indexed from zero, can be mce.--> import Sound.SC3--> audition (out 0 (soundIn 0))--> audition (out 0 (soundIn (mce2 0 1)))--> audition (out 0 (soundIn (mce [0, 2, 1, 3])))
− Help/UGen/IO/xOut.help.lhs
@@ -1,13 +0,0 @@-xOut bufferIndex xFade inputs- -Send signal to a bus, crossfading with existing contents.--> import Sound.SC3--> let { p a b = sinOsc AR (mce [a, b]) 0 * 0.1-> ; x = mouseX KR 0 1 Linear 0.1-> ; y = mouseY KR 0 1 Linear 0.1 }-> in audition (mrg [ out 0 (p 220 221)-> , xOut 0 x (p 330 331)-> , xOut 0 y (p 440 441)-> , out 0 (p 120 121)])
− Help/UGen/Information/controlRate.help.lhs
@@ -1,1 +0,0 @@-controlRate
− Help/UGen/Information/numAudioBuses.help.lhs
@@ -1,1 +0,0 @@-numAudioBuses
− Help/UGen/Information/numBuffers.help.lhs
@@ -1,1 +0,0 @@-numBuffers
− Help/UGen/Information/numControlBuses.help.lhs
@@ -1,1 +0,0 @@-numControlBuses
− Help/UGen/Information/numInputBuses.help.lhs
@@ -1,1 +0,0 @@-numInputBuses
− Help/UGen/Information/numOutputBuses.help.lhs
@@ -1,1 +0,0 @@-numOutputBuses
− Help/UGen/Information/numRunningSynths.help.lhs
@@ -1,5 +0,0 @@-numRunningSynths--Number of currently running synths.--> audition (out 0 (sinOsc AR (numRunningSynths * 200 + 400) 0 * 0.1))
− Help/UGen/Information/radiansPerSample.help.lhs
@@ -1,2 +0,0 @@-radiansPerSample-
− Help/UGen/Information/sampleDur.help.lhs
@@ -1,3 +0,0 @@-sampleDur--Duration of one sample. Equivalent to 1 / sampleRate.
− Help/UGen/Information/sampleRate.help.lhs
@@ -1,15 +0,0 @@-sampleRate--Server sample rate.--Compare a sine tone derived from sample rate with a 440Hz tone.--> let f = mce [sampleRate * 0.01, 440]-> in audition (out 0 (sinOsc AR f 0 * 0.1))--The server status command can extract nominal and-actual sample rates from a running server.--> withSC3 (\fd -> liftM2 (,)-> (serverSampleRateNominal fd)-> (serverSampleRateActual fd))
− Help/UGen/Information/subsampleOffset.help.lhs
@@ -1,34 +0,0 @@-subsampleOffset--Offset from synth start within one sample.--When a synth is created from a time stamped osc-bundle, it starts-calculation at the next possible block (normally 64 samples). Using-an OffsetOut ugen, one can delay the audio so that it matches-sample accurately. For some synthesis methods, one needs subsample-accuracy. SubsampleOffset provides the information where, within-the current sample, the synth was scheduled. It can be used to-offset envelopes or resample the audio output.--See also OffsetOut.--Demonstrate cubic subsample interpolation. An impulse train that can-be moved between samples. Create two pulse trains one sample apart,-move one relative to the other. When cursor is at the left, the-impulses are adjacent, on the right, they are exactly 1 sample apart.-View this with an oscilloscope.--> let { a = control KR "a" 0-> ; i = impulse AR 2000 0 * 0.3-> ; d = sampleDur-> ; x = 4-> ; o = (1 - subsampleOffset) + mouseX KR 0 a Linear 0.1-> ; r = delayC i (d * (1 + x)) (d * (o + x))-> ; g = offsetOut 0 r }-> in withSC3 (\fd -> do { async fd (d_recv (synthdef "s" g))-> ; t <- utcr-> ; let { t' = t + 0.2-> ; dt = 1 / 44100.0-> ; m n = s_new "s" (-1) AddToTail 1 [("a", n)] }-> in do { send fd (Bundle (UTCr t') [m 3])-> ; send fd (Bundle (UTCr (t' + dt)) [m 0]) } })
− Help/UGen/MachineListening/beatTrack.help.lhs
@@ -1,60 +0,0 @@-beatTrack c lock-- c - Audio input to track, already passed through an FFT- UGen; the expected size of FFT is 1024 for 44100- and 48000 sampling rate, and 2048 for double- those. No other sampling rates are supported.-- lock - If this argument is greater than 0.5, the tracker- will lock at its current periodicity and continue- from the current phase. Whilst it updates the- model's phase and period, this is not reflected in- the output until lock goes back below 0.5.--Autocorrelation based beat tracker; the underlying model-assumes 4/4, but it should work on any isochronous beat-structure, though there are biases to 100-120 bpm; a fast-7/8 may not be tracked in that sense. There are four k-rate-outputs, being ticks at quarter, eighth and sixteenth level-from the determined beat, and the current detected-tempo. Note that the sixteenth note output won't necessarily-make much sense if the music being tracked has swing; it is-provided just as a convenience.--This beat tracker determines the beat, biased to the-midtempo range by weighting functions. It does not determine-the measure level, only a tactus. It is also slow reacting,-using a 6 second temporal window for its autocorrelation-maneouvres. Don't expect human musician level predictive-tracking.--On the other hand, it is tireless, relatively general-(though obviously best at transient 4/4 heavy material-without much expressive tempo variation), and can form the-basis of computer processing that is decidedly faster than-human.--> import Sound.SC3--> let { i = soundIn 0-> ; x = mouseX KR (-1) 1 Linear 0.2-> ; MCE [b, h, q, t] = beatTrack (fft' 10 i) x-> ; f = mce [440, 660, 880]-> ; a = mce [0.4, 0.2, 0.1]-> ; s = mix (sinOsc AR f 0 * a * decay (mce [b, h, q]) 0.05) }-> in withSC3 (\fd -> do { async fd (b_alloc 10 1024 1)-> ; play fd (out 0 (i + s)) })--Davies, M. E. P. and Plumbley, M. D. Beat Tracking With A-Two State Model. Proceedings of the IEEE International-Conference on Acoustics, Speech and Signal Processing-(ICASSP 2005), Philadelphia, USA, March 19-23, 2005--The UGen was converted by Nick Collins for beat tracking-research in the course of his PhD and uses an original C-implementation of Matthew Davies' MATLAB model. It first-appeared as part of BBCut2 as AutoTrack but has now been-added to core to enhance SuperCollider's realtime machine-listening options.--
− Help/UGen/MachineListening/loudness.help.lhs
@@ -1,44 +0,0 @@-loudness chain smask tmask--Extraction of instantaneous loudness in sones.-- chain [fft] - Audio input to track, which has been pre-analysed by- the FFT UGen; see examples below for the expected FFT- size-- smask [sk] - Spectral masking param: lower bins mask higher bin- power within ERB bands, with a power falloff (leaky- integration multiplier) of smask per bin. (=0.25)-- tmask [sk] - Temporal masking param: the phon level let through in- an ERB band is the maximum of the new measurement, and- the previous minus tmask phons (=6)--A perceptual loudness function which outputs loudness in sones; this-is a variant of an MP3 perceptual model, summing excitation in ERB-bands. It models simple spectral and temporal masking, with equal-loudness contour correction in ERB bands to obtain phons (relative-dB), then a phon to sone transform. The final output is typically in-the range of 0 to 64 sones, though higher values can occur with-specific synthesised stimuli-- given a sinOsc at 1000hz: gain 0.001 => loudness 1 sone- gain 0.010 => loudness 4 sone- gain 0.100 => loudness 16 sone- gain 1.000 => loudness 64 sone--Assume hop of half fftsize.--> import Sound.SC3--> let { b = 10-> ; x = mouseX KR 0.001 0.1 Exponential 0.2-> ; i = sinOsc AR 1000 0 * x-> ; f = fft' (constant b) i-> ; l = loudness f 0.25 6-> ; o = sinOsc AR (mce2 900 (l * 300 + 600)) 0 * 0.1 }-> in withSC3 (\fd -> do { async fd (b_alloc b 1024 1)-> ; audition (out 0 o) })--Research note: This UGen is an informal juxtaposition of perceptual-coding, and a Zwicker and Glasberg/Moore/Stone loudness model.
− Help/UGen/MachineListening/onsets.help.lhs
@@ -1,102 +0,0 @@-onsets c threshold odftype relaxtime floor mingap medianspan whtype rawodf-onsets' c threshold odftype--An onset detector for musical audio signals - detects the-beginning of notes/drumbeats/etc. Outputs a control-rate-trigger signal which is 1 when an onset is detected, and 0-otherwise.-- c - an FFT chain-- threshold - the detection threshold, typically between 0- and 1, although in rare cases you may find- values outside this range useful-- odftype - the function used to analyse the signal- (options described below; OK to leave this at- its default value)-- relaxtime - specifies the time (in seconds) for the- normalisation to "forget" about a recent- onset. If you find too much re-triggering- (e.g. as a note dies away unevenly) then you- might wish to increase this value.-- floor - is a lower limit, connected to the idea of how- quiet the sound is expected to get without- becoming indistinguishable from noise. For- some cleanly-recorded classical music with- wide dynamic variations, I found it helpful to- go down as far as 0.000001.-- mingap - specifies a minimum gap (in seconds) between- onset detections, a brute-force way to prevent- too many doubled detections.-- medianspan - specifies the size (in FFT frames) of the- median window used for smoothing the detection- function before triggering.--For the FFT chain, you should typically use a frame size of-512 or 1024 (at 44.1 kHz sampling rate) and 50% hop size-(which is the default setting in SC). For different sampling-rates choose an FFT size to cover a similar time-span-(around 10 to 20 ms).--The onset detection should work well for a general range of-monophonic and polyphonic audio signals. The onset detection-is purely based on signal analysis and does not make use of-any "top-down" inferences such as tempo.--> import Sound.SC3--> let { x = mouseX KR 0 1 Linear 0.2-> ; i = soundIn 0-> ; c = fft' 10 i-> ; o = onsets' c x (onsetType "rcomplex")-> ; s = sinOsc AR 440 0 * 0.2-> ; e = envGen KR o 1 0 1 DoNothing (envPerc 0.001 0.1) }-> in withSC3 (\fd -> do { async fd (b_alloc 10 512 1)-> ; play fd (out 0 (s * e)) })--The type argument chooses which onset detection function is-used. In many cases the default will be fine. The following-choices are available:-- power - generally OK, good for percussive input, and- also very efficient-- magsum - generally OK, good for percussive input, and- also very efficient-- complex - performs generally very well, but more- CPU-intensive-- rcomplex - performs generally very well, and slightly more- efficient than complex-- phase - generally good, especially for tonal input,- medium efficiency-- wphase - generally very good, especially for tonal input,- medium efficiency-- mkl - generally very good, medium efficiency, pretty- different from the other methods--Which of these should you choose? The differences aren't-large, so I'd recommend you stick with the default \rcomplex-unless you find specific problems with it. Then maybe try-\wphase. The \mkl type is a bit different from the others so-maybe try that too. They all have slightly different-characteristics, and in tests perform at a similar quality-level.--For more details of all the processes involved, the-different onset detection functions, and their evaluation,-see--D. Stowell and M. D. Plumbley. Adaptive whitening for-improved real-time audio onset detection. Proceedings of the-International Computer Music Conference (ICMC’07),-Copenhagen, Denmark, August 2007.
− Help/UGen/Math/abs.help.lhs
@@ -1,7 +0,0 @@-abs a--Absolute value.--> import Sound.SC3--> audition (out 0 (abs (syncSaw AR 100 440 * 0.1)))
− Help/UGen/Math/absDif.help.lhs
@@ -1,10 +0,0 @@-absDif a b--Calculates the value of (abs (- a b). Finding the magnitude of the-difference of two values is a common operation.--> import Sound.SC3--> let { p = fSinOsc AR 440 0-> ; q = fSinOsc AR 2 0 * 0.5 }-> in audition (out 0 (p * absDif 0.2 q))
− Help/UGen/Math/add.help.lhs
@@ -1,11 +0,0 @@-a + b--> import Sound.SC3.ID--> let { o = fSinOsc AR 800 0-> ; n = pinkNoise 'a' AR }-> in audition (out 0 ((o + n) * 0.1))--DC offset.--> audition (out 0 ((fSinOsc AR 440 0 * 0.1) + 0.5))
− Help/UGen/Math/amClip.help.lhs
@@ -1,8 +0,0 @@-amClip a b--0 when b <= 0, a*b when b > 0--> import Sound.SC3.ID--> let n = whiteNoise 'a' AR-> in audition (out 0 (amClip n (fSinOsc KR 1 0 * 0.2)))
− Help/UGen/Math/atan2.help.lhs
@@ -1,20 +0,0 @@-atan2 x y--Returns the arctangent of y/x.--See also hypot.--Add a pan to the hypot doppler examples by using atan2 to find the-azimuth, or direction angle, of the sound source. Assume speakers-at +/- 45 degrees and clip the direction to between those.--> import Sound.SC3--> let { x = 10-> ; y = lfSaw KR (1 / 6) 0 * 100-> ; d = hypot x y-> ; a = 40 / (squared d)-> ; s = rlpf (fSinOsc AR 200 0 * lfPulse AR 31.3 0 0.4) 400 0.3-> ; z = atan2E y x-> ; l = clip2 (z / (pi / 2)) 1 }-> in audition (out 0 (pan2 (delayL s (110 / 344) (d / 344)) l a))
− Help/UGen/Math/clip2.help.lhs
@@ -1,10 +0,0 @@-clip2 a b--Bilateral clipping. Clips a to +/- b--> import Sound.SC3--> audition (out 0 (clip2 (fSinOsc AR 400 0) 0.2))--> let l = line KR 0 1 8 RemoveSynth-> in audition (out 0 (clip2 (fSinOsc AR 400 0) l))
− Help/UGen/Math/dbAmp.help.lhs
@@ -1,9 +0,0 @@-dbAmp a--Convert decibels to linear amplitude.--> import Sound.SC3--> let { a = dbAmp (line KR (-6) (-40) 10 RemoveSynth)-> ; o = fSinOsc AR 800 0 * a }-> in audition (out 0 o)
− Help/UGen/Math/difSqr.help.lhs
@@ -1,17 +0,0 @@-difSqr a b--Difference of squares. Return the value of (a*a) - (b*b). This is-more efficient than using separate unit generators for each-operation.--> import Sound.SC3--> let { a = fSinOsc AR 800 0-> ; b = fSinOsc AR (xLine KR 200 500 5 DoNothing) 0 }-> in audition (out 0 (difSqr a b * 0.125))--Written out:--> let { a = fSinOsc AR 800 0-> ; b = fSinOsc AR (xLine KR 200 500 5 DoNothing) 0 }-> in audition (out 0 ((a * a - b * b) * 0.125))
− Help/UGen/Math/distort.help.lhs
@@ -1,9 +0,0 @@-distort a--Nonlinear distortion.--> import Sound.SC3--> let { e = xLine KR 0.1 10 10 DoNothing-> ; o = fSinOsc AR 500 0.0 }-> in audition (out 0 (distort (o * e) * 0.25))
− Help/UGen/Math/eq.help.lhs
@@ -1,2 +0,0 @@-See gt (>)-
− Help/UGen/Math/excess.help.lhs
@@ -1,14 +0,0 @@-excess a b--Clipping residual. Returns the difference of the original signal and-its clipped form: (a - clip2(a,b)).--> import Sound.SC3--> let { o = fSinOsc AR 1000 0-> ; l = line KR 0 1 8 DoNothing }-> in audition (out 0 (excess o l))--> let { o = fSinOsc AR 1000 0-> ; l = line KR 0 1 8 DoNothing }-> in audition (out 0 (o - (clip2 o l)))
− Help/UGen/Math/fdiv.help.lhs
@@ -1,11 +0,0 @@-a / b--Division, written '/'.--Division can be tricky with signals because of division by zero.--> import Sound.SC3.ID--> let { o = fSinOsc KR 10 0.5-> ; n = pinkNoise 'a' AR }-> in audition (out 0 ((n * 0.1) / (o * 0.75)))
− Help/UGen/Math/fold2.help.lhs
@@ -1,9 +0,0 @@-fold2 a b--Bilateral folding. Folds a to +/- b.--> import Sound.SC3--> let { o = fSinOsc AR 1000 0-> ; l = line KR 0 1 8 DoNothing }-> in audition (out 0 (fold2 o l))
− Help/UGen/Math/gt.help.lhs
@@ -1,25 +0,0 @@-a >* b-a >=* b-a <* b-a <=* b-a ==* b--Greater than, written '>*'. The star extensions are because the-result of the operatros is not of type Bool, as is required by the-signature for the class Ord.--The resulting signal is 1.0 if a > b, otherwise it is 0.0. Similarly-less than is <*, greater than or equal to is >=*, and so on. --These operators can be useful for triggering purposes, among other-things.--> import Sound.SC3--> let { o = sinOsc KR 1 0-> ; t = [o >* 0, o >=* 0, o <* 0, o <=* 0, o ==* 0-> ,(o <* 0.001) * (o >* (-0.001))]-> ; f = [220, 330, 440, 550, 660, 770]-> ; p = envPerc 0.01 1-> ; e = envGen KR (mce t) 0.1 0 1 DoNothing p }-> in audition (out 0 (mix (sinOsc AR (mce f) 0 * e)))
− Help/UGen/Math/hypot.help.lhs
@@ -1,28 +0,0 @@-hypot x y--Returns the square root of the sum of the squares of a and b. Or-equivalently, the distance from the origin to the point (x, y).--> import Sound.SC3--> let { x = mouseX KR 0 0.1 Linear 0.1-> ; y = mouseY KR 0 0.1 Linear 0.1 }-> in audition (out 0 (sinOsc AR 440 0 * hypot x y))--Object travels 200 meters in 6 secs (=120kph) passing 10 meters-from the listener. The speed of sound is 344 meters/sec.--> let { x = 10-> ; y = lfSaw KR (1 / 6) 0 * 100-> ; d = hypot x y-> ; v = slope d-> ; r = (344 - v) / 344-> ; a = 10 / (squared d) }-> in audition (out 0 (fSinOsc AR (1000 * r) 0 * a))--> let { x = 10-> ; y = lfSaw KR (1 / 6) 0 * 100-> ; d = hypot x y-> ; a = 40 / (squared d)-> ; s = rlpf (fSinOsc AR 200 0 * lfPulse AR 31.3 0 0.4) 400 0.3 }-> in audition (out 0 (delayL s (110 / 344) (d / 344) * a))
− Help/UGen/Math/max.help.lhs
@@ -1,9 +0,0 @@-max a b--Maximum.--> import Sound.SC3--> let { p = fSinOsc AR 500 0 * 0.25-> ; q = fSinOsc AR 0.5 0 }-> in audition (out 0 (p `max` q))
− Help/UGen/Math/mod.help.lhs
@@ -1,7 +0,0 @@-a `mod` b--Modulo, written % in sclang. outputs a modulo b.--> import Sound.SC3--> audition (out 0 (fSinOsc AR 100 4 `mod` 1))
− Help/UGen/Math/mul.help.lhs
@@ -1,20 +0,0 @@-a * b--Multiplication.--> import Sound.SC3--> audition (out 0 (sinOsc AR 440 0 * 0.5))--Creates a beating effect (subaudio rate).--> import Sound.SC3.ID--> let n = pinkNoise 'a' AR-> in audition (out 0 (fSinOsc kr 10 0 * n * 0.5))--Ring modulation.--> let { p = sinOsc AR (xLine KR 100 1001 10 DoNothing) 0-> ; q = syncSaw AR 100 200 }-> in audition (out 0 (p * q * 0.25))
− Help/UGen/Math/pow.help.lhs
@@ -1,24 +0,0 @@-a ** b--Exponentiation. When the signal is negative this function extends the-usual definition of exponentiation and returns neg(neg(a) ** b). This-allows exponentiation of negative signal values by noninteger-exponents.--> import Sound.SC3--> let a = fSinOsc AR 100 0 * 0.1-> in audition (out 0 (mce2 a (a ** 10)))--http://create.ucsb.edu/pipermail/sc-users/2006-December/029998.html--> import Sound.SC3.Monadic--> do { n0 <- lfNoise2 KR 8-> ; n1 <- lfNoise2 KR 3-> ; let { s = blip AR (n0 * 200 + 300) (n1 * 10 + 20)-> ; x = mouseX KR 1000 (sampleRate * 0.5) Exponential 0.1-> ; y = mouseY KR 1 24 Exponential 0.1-> ; d = latch s (impulse AR x 0)-> ; b = roundUp d (0.5 ** y) }-> in audition (out 0 (mce2 d b)) }
− Help/UGen/Math/ring1.help.lhs
@@ -1,19 +0,0 @@-ring1 a b--Ring modulation plus first source. Return the value of ((a*b) +-a). This is more efficient than using separate unit generators for the-multiply and add.--See also Mul, Ring1, Ring2, Ring3, Ring4.--> import Sound.SC3--> let { a = fSinOsc AR 800 0-> ; b = fSinOsc AR (xLine KR 200 500 5 DoNothing) 0 }-> in audition (out 0 (ring1 a b * 0.125))--is equivalent to:--> let { a = fSinOsc AR 800 0-> ; b = fSinOsc AR (xLine KR 200 500 5 DoNothing) 0 }-> in audition (out 0 (((a * b) + a) * 0.125))
− Help/UGen/Math/roundUp.help.lhs
@@ -1,12 +0,0 @@-roundUp a b--Rounds a up to the nearest multiple of b.--> import Sound.SC3--> let { x = mouseX KR 60 4000 Linear 0.1-> ; f = roundUp x 100 }-> in audition (out 0 (sinOsc ar f 0 * 0.1))--> let n = line KR 24 108 6 RemoveSynth-> in audition (out 0 (saw AR (midiCPS (roundUp n 1)) * 0.2))
− Help/UGen/Math/scaleNeg.help.lhs
@@ -1,9 +0,0 @@-scaleNeg a b--Scale negative part of input wave. a * b when a < 0, otherwise a.--> import Sound.SC3--> let { o = fSinOsc AR 1000 0-> ; l = line AR 1 (-1) 4 RemoveSynth }-> in audition (out 0 (scaleNeg o l))
− Help/UGen/Math/softClip.help.lhs
@@ -1,10 +0,0 @@-softClip a--Nonlinear distortion. Distortion with a perfectly linear region-from -0.5 to +0.5.--> import Sound.SC3--> let { e = xLine KR 0.1 10 10 DoNothing-> ; o = fSinOsc AR 500 0.0 }-> in audition (out 0 (softClip (o * e) * 0.25))
− Help/UGen/Math/sumSqr.help.lhs
@@ -1,16 +0,0 @@-sumSqr a b--Return the value of (a*a) + (b*b). This is more efficient than-using separate unit generators for each operation.--> import Sound.SC3--> let { a = fSinOsc AR 800 0-> ; b = fSinOsc AR (xLine KR 200 500 5 DoNothing) 0 }-> in audition (out 0 (sumSqr a b * 0.125))--Written out:--> let { a = fSinOsc AR 800 0-> ; b = fSinOsc AR (xLine KR 200 500 5 DoNothing) 0 }-> in audition (out 0 ((a * a + b * b) * 0.125))
− Help/UGen/Math/thresh.help.lhs
@@ -1,8 +0,0 @@-thresh a b--Signal thresholding. 0 when a < b, otherwise a.--> import Sound.SC3.ID--> let n = lfNoise0 'a' AR 50-> in audition (out 0 (thresh (n * 0.5) 0.45))
− Help/UGen/Noise/brownNoise.help.lhs
@@ -1,14 +0,0 @@-brownNoise rate--Generates noise whose spectrum falls off in power by 6 dB per-octave.--> import Sound.SC3.ID--> let n = brownNoise 'a' AR-> in audition (out 0 (n * 0.1))--> let { n = brownNoise 'a' KR-> ; o = sinOsc AR (linExp n (-1) 1 64 9600) 0 * 0.1 }-> in audition (out 0 o)-
− Help/UGen/Noise/clipNoise.help.lhs
@@ -1,10 +0,0 @@-clipNoise rate--Generates noise whose values are either -1 or 1. This produces the-maximum energy for the least peak to peak amplitude.--> import Sound.SC3.Monadic--> audition . (out 0) . (* 0.1) =<< clipNoise AR--> audition . (out 0) . (* 0.1) =<< whiteNoise AR
− Help/UGen/Noise/coinGate.help.lhs
@@ -1,10 +0,0 @@-coinGate prob in--When it receives a trigger, it tosses a coin, and either passes the-trigger or doesn't.--> import Sound.SC3.Monadic--> do { g <- coinGate 0.2 (impulse KR 10 0)-> ; f <- tRand 300.0 400.0 g-> ; audition (out 0 (sinOsc AR f 0 * 0.1)) }
− Help/UGen/Noise/dust.help.lhs
@@ -1,11 +0,0 @@-dust rate density--Generates random impulses from 0 to +1 at a rate determined by the-density argument.--> import Sound.SC3.Monadic--> audition . (out 0) . (* 0.25) =<< dust AR 200--> let d = xLine KR 20000 2 10 RemoveSynth-> in audition . (out 0) . (* 0.15) =<< dust AR d
− Help/UGen/Noise/dust2.help.lhs
@@ -1,12 +0,0 @@-dust2 rate density--Generates random impulses from -1 to +1. The `density' is in-impulses per second.--> import Sound.SC3.Monadic--> do { n <- dust2 AR 200-> ; audition (out 0 (n * 0.5)) }--> let d = xLine KR 20000 2 10 RemoveSynth-> in audition . (out 0 ) . (* 0.15) =<< dust2 AR d
− Help/UGen/Noise/expRand.help.lhs
@@ -1,10 +0,0 @@-expRand lo hi--Generates a single random float value in an exponential-distributions from `lo' to `hi'.--> import Sound.SC3.ID--> let { a = line KR 0.5 0 0.01 RemoveSynth-> ; f = expRand 'a' 100.0 8000.0 }-> in audition (out 0 (fSinOsc AR f 0 * a))
− Help/UGen/Noise/grayNoise.help.lhs
@@ -1,9 +0,0 @@-grayNoise rate--Generates noise which results from flipping random bits in a word.-This type of noise has a high RMS level relative to its peak to-peak level. The spectrum is emphasized towards lower frequencies.--> import Sound.SC3.Monadic--> audition . (out 0) . (* 0.1) =<< grayNoise AR
− Help/UGen/Noise/iRand.help.lhs
@@ -1,10 +0,0 @@-iRand lo hi--Generates a single random integer value in uniform distribution-from `lo' to `hi'.--> import Sound.SC3.ID--> let { f = iRand 'a' 200 1200-> ; e = line KR 0.2 0 0.1 RemoveSynth }-> in audition (out 0 (fSinOsc AR f 0 * e))
− Help/UGen/Noise/lfClipNoise.help.lhs
@@ -1,20 +0,0 @@-lfClipNoise rate freq--Randomly generates the values -1 or +1 at a rate given by the-nearest integer division of the sample rate by the freq argument.-It is probably pretty hard on your speakers. The freq argument is-the approximate rate at which to generate random values.--> import Sound.SC3.Monadic--> audition . (out 0) . (* 0.05) =<< lfClipNoise AR 1000--Modulate frequency--> let f = xLine KR 1000 10000 10 RemoveSynth-> in audition . (out 0) . (* 0.05) =<< lfClipNoise AR f--Use as frequency control--> do { n <- lfClipNoise KR 4 -> ; audition (out 0 (sinOsc AR (n * 200 + 600) 0 * 0.1)) }
− Help/UGen/Noise/lfNoise0.help.lhs
@@ -1,19 +0,0 @@-lfNoise0 rate freq--Step noise. Generates random values at a rate given by the nearest-integer division of the sample rate by the freq argument.--> import Sound.SC3.Monadic--> audition . (out 0) . (* 0.05) =<< lfNoise0 AR 1000--Modulate frequency.--> let f = xLine KR 1000 10000 10 RemoveSynth-> in do { n <- lfNoise0 AR f-> ; audition (out 0 (n * 0.05)) }--Use as frequency control.--> do { f <- lfNoise0 KR 4-> ; audition (out 0 (sinOsc AR (f * 400 + 450) 0 * 0.1)) }
− Help/UGen/Noise/lfNoise1.help.lhs
@@ -1,23 +0,0 @@-lfNoise1 rate freq--Ramp noise. Generates linearly interpolated random values at a-rate given by the nearest integer division of the sample rate by-the freq argument.--freq - approximate rate at which to generate random values.--> import Sound.SC3.Monadic--> audition . (out 0) . (* 0.05) =<< lfNoise1 AR 1000--Modulate frequency.--> let f = xLine KR 1000 10000 10 RemoveSynth-> in do { n <- lfNoise1 AR f-> ; audition (out 0 (n * 0.05)) }--Use as frequency control.--> do { n <- lfNoise1 KR 4 -> ; let f = n * 400 + 450-> in audition (out 0 (sinOsc AR f 0 * 0.1)) }
− Help/UGen/Noise/lfNoise2.help.lhs
@@ -1,20 +0,0 @@-lfNoise2 rate freq--Quadratic noise. Generates quadratically interpolated random-values at a rate given by the nearest integer division of the-sample rate by the freq argument.--> import Sound.SC3.Monadic--> audition . (out 0) . (* 0.05) =<< lfNoise2 AR 1000--Modulate frequency.--> let f = xLine KR 1000 10000 10 RemoveSynth-> in do { n <- lfNoise2 AR f-> ; audition (out 0 (n * 0.05)) }--Use as frequency control.--> do { f <- lfNoise2 KR 4 -> ; audition (out 0 (sinOsc AR (f * 400 + 450) 0 * 0.1)) }
− Help/UGen/Noise/lfdClipNoise.help.lhs
@@ -1,34 +0,0 @@-lfdClipNoise rate freq--Like LFClipNoise, it generates the values -1 or +1 at a rate given-by the freq argument, with two differences: no time quantization,-and fast recovery from low freq values.--LFClipNoise, as well as LFNoise0,1,2 quantize to the nearest-integer division of the samplerate, and they poll the freq argument-only when scheduled, and thus seem to hang when freqs get very-low.--If you don't need very high or very low freqs, or use fixed freqs,-LFClipNoise is more efficient.--Try wiggling mouse quickly; lfClipNoise frequently seems stuck,-lfdClipNoise changes smoothly.--> import Sound.SC3.Monadic--> let x = mouseX KR 0.1 1000 Exponential 0.2-> in do { n <- lfdClipNoise AR x-> ; audition (out 0 (sinOsc AR (n * 200 + 500) 0 * 0.05)) }--> let x = mouseX KR 0.1 1000 Exponential 0.2-> in do { n <- lfClipNoise AR x-> ; audition (out 0 (sinOsc AR (n * 200 + 500) 0 * 0.05)) }--lfClipNoise quantizes time steps at high freqs, lfdClipNoise does not:--> let f = xLine KR 1000 20000 10 RemoveSynth-> in audition . (out 0) . (* 0.05) =<< lfdClipNoise AR f--> let f = xLine KR 1000 20000 10 RemoveSynth-> in audition . (out 0) . (* 0.05) =<< lfClipNoise AR f
− Help/UGen/Noise/lfdNoise0.help.lhs
@@ -1,39 +0,0 @@-lfdNoise0 rate freq--Dynamic step noise. Like lfNoise0, it generates random values at a-rate given by the freq argument, with two differences: no time-quantization, and fast recovery from low freq values.--lfNoise0,1,2 quantize to the nearest integer division of the-samplerate, and they poll the freq argument only when scheduled, and-thus seem to hang when freqs get very low.--If you don't need very high or very low freqs, or use fixed freqs,-LFNoise0 is more efficient.--Try wiggling mouse quickly; LFNoise frequently seems stuck,-LFDNoise changes smoothly.--> import Sound.SC3.Monadic--> let x = mouseX KR 0.1 1000 Exponential 0.2-> in audition . (out 0) . (* 0.1) =<< lfdNoise0 AR x--> let x = mouseX KR 0.1 1000 Exponential 0.2-> in audition . (out 0) . (* 0.1) =<< lfNoise0 AR x--silent for 2 secs before going up in freq--> let f = xLine KR 0.5 10000 3 RemoveSynth-> in audition . (out 0) . (* 0.1) =<< lfdNoise0 AR f--> let f = xLine KR 0.5 10000 3 RemoveSynth-> in audition . (out 0) . (* 0.1) =<< lfNoise0 AR f--LFNoise quantizes time steps at high freqs, LFDNoise does not:--> let f = xLine KR 1000 20000 10 RemoveSynth-> in audition . (out 0) . (* 0.1) =<< lfdNoise0 AR f--> let f = xLine KR 1000 20000 10 RemoveSynth-> in audition . (out 0) . (* 0.1) =<< lfNoise0 AR f
− Help/UGen/Noise/lfdNoise1.help.lhs
@@ -1,5 +0,0 @@-lfdNoise1 rate freq--Dynamic ramp noise. --See lfdNoise0 and lfNoise1.
− Help/UGen/Noise/lfdNoise3.help.lhs
@@ -1,5 +0,0 @@-lfdnoise3 rate freq--Dynamic cubic noise. --See lfNoise3 and lfdNoise0.
− Help/UGen/Noise/linRand.help.lhs
@@ -1,11 +0,0 @@-linRand lo hi minmax--Generates a single random float value in linear distribution from-lo to hi, skewed towards lo if minmax < 0, otherwise skewed towards-hi.--> import Sound.SC3.Monadic--> do { f <- linRand 200.0 10000.0 (mce [-1, 1])-> ; let e = line KR 0.4 0 0.01 RemoveSynth-> in audition (out 0 (fSinOsc AR f 0 * e)) }
− Help/UGen/Noise/nRand.help.lhs
@@ -1,15 +0,0 @@-nRand lo hi n--Generates a single random float value in a sum of `n' uniform-distributions from `lo' to `hi'.--n = 1 : uniform distribution - same as Rand-n = 2 : triangular distribution-n = 3 : smooth hump-as n increases, distribution converges towards gaussian--> import Sound.SC3.Monadic--> do { n <- nRand 1200.0 4000.0 (mce [2, 5])-> ; let e = line KR 0.2 0 0.01 RemoveSynth-> in audition (out 0 (fSinOsc AR n 0 * e)) }
− Help/UGen/Noise/pinkNoise.help.lhs
@@ -1,13 +0,0 @@-pinkNoise rate--Generates noise whose spectrum falls off in power by 3 dB per-octave. This gives equal power over the span of each octave. This-version gives 8 octaves of pink noise.--> import Sound.SC3.Monadic--> audition . (out 0) . (* 0.05) =<< pinkNoise AR--> audition . (out 0) . (* 0.05) =<< whiteNoise AR--> audition . (out 0) . (* 0.05) =<< brownNoise AR
− Help/UGen/Noise/rand.help.lhs
@@ -1,13 +0,0 @@-rand lo hi--Generates a single random value in uniform distribution from lo to-hi. It generates this when the SynthDef first starts playing, and-remains fixed for the duration of the synth's existence.--> import Sound.SC3.Monadic--> do { f <- rand 200 1200-> ; l <- rand (-1) 1-> ; let { e = line KR 0.2 0 0.1 RemoveSynth-> ; o = fSinOsc AR f 0 }-> in audition (out 0 (pan2 (o * e) l 1)) }
− Help/UGen/Noise/randID.help.lhs
@@ -1,8 +0,0 @@-randID id--Choose which random number generator to use for this synth. All-synths that use the same generator reproduce the same sequence of-numbers when the same seed is set again.--See also: RandSeed.-
− Help/UGen/Noise/randSeed.help.lhs
@@ -1,8 +0,0 @@-randSeed trig seed--When the trigger signal changes from nonpositive to positve, the-synth's random generator seed is reset to the given value. All-other synths that use the same random number generator reproduce-the same sequence of numbers again.--See also: RandID.
− Help/UGen/Noise/tExpRand.help.lhs
@@ -1,11 +0,0 @@-tExpRand lo hi trig--Generates a random float value in exponential distribution from lo-to hi each time the trig signal changes from nonpositive to-positive values lo and hi must both have the same sign and be-non-zero.--> import Sound.SC3.Monadic--> do { f <- tExpRand 300.0 3000.0 =<< dust KR 10-> ; audition (out 0 (sinOsc AR f 0 * 0.1)) }
− Help/UGen/Noise/tRand.help.lhs
@@ -1,10 +0,0 @@-tRand lo hi trig--Generates a random float value in uniform distribution from lo each-time the trig signal changes from nonpositive to positive values--> import Sound.SC3.Monadic--> do { t <- dust KR (mce [5, 12])-> ; f <- tRand (mce [200, 1600]) (mce [500, 3000]) t-> ; audition (out 0 (sinOsc AR f 0 * 0.2)) }
− Help/UGen/Noise/tiRand.help.lhs
@@ -1,15 +0,0 @@-tiRand lo hi trig--Generates a random integer value in uniform distribution from lo to-hi each time the trig signal changes from nonpositive to positive-values--> import Sound.SC3.Monadic--> do { l <- tiRand (-1) 1 =<< dust KR 10-> ; n <- pinkNoise AR-> ; audition (out 0 (pan2 (n * 0.1) l 1)) }--> do { n <- tiRand 4 12 =<< dust KR 10-> ; let f = n * 150 + (mce [0,1])-> in audition (out 0 (sinOsc AR f 0 * 0.1)) }
− Help/UGen/Noise/whiteNoise.help.lhs
@@ -1,29 +0,0 @@-whiteNoise rate--Generates noise whose spectrum has equal power at all frequencies.--> import Sound.SC3.Monadic--> audition . (out 0) . (* 0.05) =<< whiteNoise AR--Random filtered noise bursts.--> do { n <- whiteNoise AR-> ; t <- dust AR (mce [3, 7])-> ; f <- tExpRand 20 1800 t-> ; bw <- tExpRand 0.001 1 t-> ; let { e = decay2 t 0.01 0.2-> ; r = resonz (n * e) f bw }-> in audition (out 0 r) }--The same graph, without using do notation.--> whiteNoise AR >>= \n -> -> dust AR (mce [3, 7]) >>= \t -> -> tExpRand 20 1800 t >>= \f ->-> tExpRand 0.001 1 t >>= \bw -> -> let { e = decay2 t 0.01 0.2-> ; r = resonz (n * e) f bw }-> in audition (out 0 r)--
− Help/UGen/Oscillator/blip.help.lhs
@@ -1,31 +0,0 @@-blip AR freq numHarm--Band Limited ImPulse generator. All harmonics have equal amplitude.--This is the equivalent of 'buzz' in MusicN languages. WARNING: This-waveform in its raw form could be damaging to your ears at high-amplitudes or for long periods.--Implementation notes: It is improved from other implementations in-that it will crossfade in a control period when the number of-harmonics changes, so that there are no audible pops. It also-eliminates the divide in the formula by using a 1/sin table (with-special precautions taken for 1/0). The lookup tables are linearly-interpolated for better quality.--The number of harmonics may be lowered internally if it would cause-aliasing.--> import Sound.SC3--> audition (out 0 (blip AR 440 200 * 0.1))--Modulate frequency--> let f = xLine KR 20000 200 6 RemoveSynth-> in audition (out 0 (blip AR f 100 * 0.1))--Modulate number of harmonics.--> let nh = line KR 1 100 20 RemoveSynth-> in audition (out 0 (blip AR 200 nh * 0.2))
− Help/UGen/Oscillator/fSinOsc.help.lhs
@@ -1,26 +0,0 @@-fSinOsc rate freq iPhase--Very fast sine wave generator implemented using a ringing filter.-This generates a much cleaner sine wave than a table lookup oscillator-and is a lot faster. However, the amplitude of the wave will vary-with frequency. Generally the amplitude will go down as you raise the-frequency and go up as you lower the frequency.--WARNING: In the current implementation, the amplitude can blow up if-the frequency is modulated by certain alternating signals.--freq - frequency in Hertz-iPhase - initial phase--Note the phase argument, which was not in the SC2 variant.--> import Sound.SC3--> audition (out 0 (fSinOsc AR (mce [440, 550]) 0 * 0.05))--> audition (out 0 (fSinOsc AR (xLine KR 200 4000 1 RemoveSynth) 0 * 0.1))--Loses amplitude towards the end--> let f = fSinOsc AR (xLine KR 4 401 8 RemoveSynth)-> in audition (out 0 (fSinOsc AR (f 0 * 200 + 800) 0 * 0.1))
− Help/UGen/Oscillator/formant.help.lhs
@@ -1,22 +0,0 @@-formant AR fundFreq formFreq bwFreq--Formant oscillator. Generates a set of harmonics around a formant-frequency at a given fundamental frequency.--Modulate fundamental frequency, formant frequency stays constant.--> import Sound.SC3--> let f = xLine KR 400 1000 8 RemoveSynth-> in audition (out 0 (formant AR f 2000 800 * 0.125))--Modulate formant frequency, fundamental frequency stays constant.--> let { f = mce [200, 300, 400, 500]-> ; ff = xLine KR 400 4000 8 RemoveSynth }-> in audition (out 0 (formant AR f ff 200 * 0.125))--Modulate width frequency, other frequencies stay constant.--> let bw = xLine KR 800 8000 8 RemoveSynth-> in audition (out 0 (formant AR 400 2000 bw * 0.1))
− Help/UGen/Oscillator/gendy1.help.lhs
@@ -1,178 +0,0 @@-gendy1 rate ampDist durDist adParam ddParam minFreq maxFreq - ampScale durScale initCPs kNum--An implementation of the dynamic stochastic synthesis generator-conceived by Iannis Xenakis and described in Formalized Music-(1992, Stuyvesant, NY: Pendragon Press) chapter 9 (pp 246-254) and-chapters 13 and 14 (pp 289-322). The BASIC program in the book was-written by Marie-Helene Serra so I think it helpful to credit her-too.--ampdist - Choice of probability distribution for the next- perturbation of the amplitude of a control point.--The distributions are (adapted from the GENDYN program in-Formalized Music):-- 0- LINEAR- 1- CAUCHY- 2- LOGIST- 3- HYPERBCOS- 4- ARCSINE- 5- EXPON- 6- SINUS--Where the sinus (Xenakis' name) is in this implementation taken as-sampling from a third party oscillator. See example below.--durdist - Choice of distribution for the perturbation of the- current inter control point duration.--adparam - A parameter for the shape of the amplitude probability- distribution, requires values in the range 0.0001 to 1- (there are safety checks in the code so don't worry too- much if you want to modulate.)--ddparam - A parameter for the shape of the duration probability- distribution, requires values in the range 0.0001 to 1--minfreq - Minimum allowed frequency of oscillation for the Gendy1- oscillator, so gives the largest period the duration is- allowed to take on.--maxfreq - Maximum allowed frequency of oscillation for the Gendy1- oscillator, so gives the smallest period the duration is- allowed to take on.--ampscale - Normally 0.0 to 1.0, multiplier for the distribution's- delta value for amplitude. An ampscale of 1.0 allows the- full range of -1 to 1 for a change of amplitude.--durscale - Normally 0.0 to 1.0, multiplier for the distribution's- delta value for duration. An ampscale of 1.0 allows the- full range of -1 to 1 for a change of duration.--initCPs - Initialise the number of control points in the- memory. Xenakis specifies 12. There would be this number- of control points per cycle of the oscillator, though the- oscillator's period will constantly change due to the- duration distribution.--knum - Current number of utilised control points, allows- modulation.---sclang defaults: ampdist=1, durdist=1, adparam=1.0, ddparam=1.0,-minfreq=440, maxfreq=660, ampscale= 0.5, durscale=0.5, initCPs= 12,-knum=12.--> import Sound.SC3--> let g = gendy1 AR 1 1 1 1 440 660 0.5 0.5 12 12-> in audition (out 0 (pan2 g 0 0.15))--Wandering bass--> let g = gendy1 AR 1 1 1.0 1.0 30 100 0.3 0.05 5 5-> in audition (out 0 (pan2 g 0 0.15))--Play me --> let { x = mouseX KR 100 1000 Exponential 0.1-> ; g = gendy1 AR 1 1 1.0 1.0 30 100 0.3 0.05 5 5 }-> in audition (out 0 (pan2 (rlpf g 500 0.3 * 0.2) 0 0.25))--Scream!--> let { x = mouseX KR 220 440 Exponential 0.1-> ; y = mouseY KR 0.0 1.0 Linear 0.1 }-> in audition (out 0 (pan2 (gendy1 AR 2 3 1 1 x (8 * x) y y 7 7) 0.0 0.3))--1 CP = random noise--> let g = gendy1 AR 1 1 1 1 440 660 0.5 0.5 1 1-> in audition (out 0 (pan2 g 0 0.15))--2 CPs = an oscillator--> let g = gendy1 AR 1 1 1 1 440 660 0.5 0.5 2 2 -> in audition (out 0 (pan2 g 0 0.15))--Used as an LFO--> let { ad = sinOsc KR 0.10 0 * 0.49 + 0.51-> ; dd = sinOsc KR 0.13 0 * 0.49 + 0.51-> ; as = sinOsc KR 0.17 0 * 0.49 + 0.51-> ; ds = sinOsc KR 0.19 0 * 0.49 + 0.51-> ; g = gendy1 KR 2 4 ad dd 3.4 3.5 as ds 10 10 }-> in audition (out 0 (pan2 (sinOsc AR (g * 50 + 350) 0) 0.0 0.3))--Wasp--> let ad = sinOsc KR 0.1 0 * 0.1 + 0.9-> in audition (out 0 (pan2 (gendy1 AR 0 0 ad 1.0 50 1000 1 0.005 12 12) 0.0 0.2))--Modulate distributions. Change of pitch as distributions change-the duration structure and spectrum--> let { x = mouseX KR 0 7 Linear 0.1-> ; y = mouseY KR 0 7 Linear 0.1-> ; g = gendy1 AR x y 1 1 440 660 0.5 0.5 12 12 }-> in audition (out 0 (pan2 g 0 0.2))--Modulate number of CPs.--> let { x = mouseX KR 1 13 Linear 0.1-> ; g = gendy1 AR 1 1 1 1 440 660 0.5 0.5 12 x }-> in audition (out 0 (pan2 g 0 0.2))--Self modulation.--> let { x = mouseX KR 1 13 Linear 0.1-> ; y = mouseY KR 0.1 10 Linear 0.1-> ; g0 = gendy1 AR 5 4 0.3 0.7 0.1 y 1.0 1.0 5 5-> ; g1 = gendy1 AR 1 1 1 1 440 (g0 * 500 + 600) 0.5 0.5 12 x }-> in audition (out 0 (pan2 g1 0 0.2))--Use SINUS to track any oscillator and take CP positions from it use-adParam and ddParam as the inputs to sample.--> let { p = lfPulse KR 100 0 0.4-> ; s = sinOsc KR 30 0 * 0.5-> ; g = gendy1 AR 6 6 p s 440 660 0.5 0.5 12 12 }-> in audition (out 0 (pan2 g 0 0.2))--Near the corners are interesting.--> let { x = mouseX KR 0 200 Linear 0.1-> ; y = mouseY KR 0 200 Linear 0.1-> ; p = lfPulse KR x 0 0.4-> ; s = sinOsc KR y 0 * 0.5-> ; g = gendy1 AR 6 6 p s 440 660 0.5 0.5 12 12 }-> in audition (out 0 (pan2 g 0 0.2))--Texture--> import Sound.SC3.Monadic-> import Control.Monad--> let node = do { f <- rand 130 160.3-> ; r0 <- rand 0 6-> ; r1 <- rand 0 6-> ; l <- rand (-1) 1-> ; let { ad = sinOsc KR 0.10 0 * 0.49 + 0.51-> ; dd = sinOsc KR 0.13 0 * 0.49 + 0.51-> ; as = sinOsc KR 0.17 0 * 0.49 + 0.51-> ; ds = sinOsc KR 0.19 0 * 0.49 + 0.51-> ; g = gendy1 AR r0 r1 ad dd f f as ds 12 12-> ; o = sinOsc AR (g * 200 + 400) 0 }-> in return (pan2 o l 0.1) }-> in do { m <- replicateM 9 node-> ; audition (out 0 (mix (mce m))) }--Try durscale 10.0 and 0.0 too.--> let { x = mouseX KR 10 700 Linear 0.1-> ; y = mouseY KR 50 1000 Linear 0.1-> ; g = gendy1 AR 2 3 1 1 1 x 0.5 0.1 10 10 }-> in audition (out 0 (pan2 (combN (resonz g y 0.1) 0.1 0.1 5) 0.0 0.6))
− Help/UGen/Oscillator/impulse.help.lhs
@@ -1,17 +0,0 @@-impulse rate freq iPhase--Impulse oscillator. Outputs non band limited single sample impulses.--freq - frequency in Hertz-phase - phase offset in cycles (0..1)--> import Sound.SC3--> audition (out 0 (impulse AR 800 0 * 0.1))--> let f = xLine KR 800 10 5 RemoveSynth-> in audition (out 0 (impulse AR f 0.0 * 0.1))--> let { f = mouseY KR 4 8 Linear 0.1- ; x = mouseX KR 0 1 Linear 0.1 }-> in audition (out 0 (impulse AR f (mce [0, x]) * 0.1))
− Help/UGen/Oscillator/klang.help.lhs
@@ -1,11 +0,0 @@-klang rate freqScale freqOffset spec--Bank of fixed oscillators. spec is constructed using klangSpec, which-takes lists of frequency, amplitude and phase.--> import Sound.SC3--> let { f = [440,550..1100]-> ; a = take 7 (cycle [0.05, 0.02])-> ; p = replicate 7 0 }-> in audition (out 0 (klang AR 1 0 (klangSpec f a p)))
− Help/UGen/Oscillator/lfCub.help.lhs
@@ -1,31 +0,0 @@-lfCub rate freq iphase- -A sine like shape made of two cubic pieces. Smoother than lfPar.--> import Sound.SC3--> audition (out 0 (lfCub AR (lfCub KR (lfCub KR 0.2 0 * 8 + 10) 0 * 400 + 800) 0 * 0.1))-> audition (out 0 (lfCub AR (lfCub KR 0.2 0 * 400 + 800) 0 * 0.1))-> audition (out 0 (lfCub AR 800 0 * 0.1))-> audition (out 0 (lfCub AR (xLine KR 100 8000 30 DoNothing) 0 * 0.1))--Compare (lfPar):--> audition (out 0 (lfPar AR (lfPar KR (lfPar KR 0.2 0 * 8 + 10) 0 * 400 + 800) 0 * 0.1))-> audition (out 0 (lfPar AR (lfPar KR 0.2 0 * 400 + 800) 0 * 0.1))-> audition (out 0 (lfPar AR 800 0 * 0.1))-> audition (out 0 (lfPar AR (xLine KR 100 8000 30 DoNothing) 0 * 0.1))--Compare (sinOsc):--> audition (out 0 (sinOsc AR (sinOsc KR (sinOsc KR 0.2 0 * 8 + 10) 0 * 400 + 800) 0 * 0.1))-> audition (out 0 (sinOsc AR (sinOsc KR 0.2 0 * 400 + 800) 0 * 0.1))-> audition (out 0 (sinOsc AR 800 0 * 0.1))-> audition (out 0 (sinOsc AR (xLine KR 100 8000 30 DoNothing) 0 * 0.1))--Compare (lfTri):--> audition (out 0 (lfTri AR (lfTri KR (lfTri KR 0.2 0 * 8 + 10) 0 * 400 + 800) 0 * 0.1))-> audition (out 0 (lfTri AR (lfTri KR 0.2 0 * 400 + 800) 0 * 0.1))-> audition (out 0 (lfTri AR 800 0 * 0.1))-> audition (out 0 (lfTri AR (xLine KR 100 8000 30 DoNothing) 0 * 0.1))
− Help/UGen/Oscillator/lfPar.help.lhs
@@ -1,5 +0,0 @@-lfPar rate freq iphase--A sine-like shape made of two parabolas. Has audible odd harmonics.--See lfCub.
− Help/UGen/Oscillator/lfPulse.help.lhs
@@ -1,17 +0,0 @@-lfPulse rate freq iphase width--A non-band-limited pulse oscillator. Outputs a high value of one-and a low value of zero. Note that the iphase argument was not-present in SC2.--freq - frequency in Hertz-iphase - initial phase offset in cycles ( 0..1 )-width - pulse width duty cycle from zero to one.--> import Sound.SC3--> let f = lfPulse KR 3 0 0.3 * 200 + 200-> in audition (out 0 (lfPulse AR f 0 0.2 * 0.1))--> let x = mouseX KR 0 1 Linear 0.2-> in audition (out 0 (lfPulse AR 220 0 x * 0.1))
− Help/UGen/Oscillator/lfSaw.help.lhs
@@ -1,21 +0,0 @@-lfSaw rate freq iphase--Sawtooth oscillator. A non-band-limited sawtooth-oscillator. Output ranges from -1 to +1.--freq - frequency in Hertz-iphase - initial phase [0,2]--> import Sound.SC3--> audition (out 0 (lfSaw AR 500 1 * 0.1))--Used as both Oscillator and LFO.--> audition (out 0 (lfSaw AR (lfSaw KR 4 0 * 400 + 400) 0 * 0.1))--Output range is bi-polar.--> let { f = mce [linLin (lfSaw KR 0.5 0) (-1) 1 200 1600, 200, 1600]-> ; a = mce [0.1, 0.05, 0.05] }-> in audition (out 0 (mix (sinOsc AR f 0 * a)))
− Help/UGen/Oscillator/lfTri.help.lhs
@@ -1,12 +0,0 @@-lfTri rate freq iphase--A non-band-limited triangular waveform oscillator. Output ranges-from -1 to +1.--> import Sound.SC3--> audition (out 0 (lfTri AR 500 1 * 0.1))--Used as both Oscillator and LFO.--> audition (out 0 (lfTri AR (lfTri KR 4 0 * 400 + 400) 0 * 0.1))
− Help/UGen/Oscillator/oscN.help.lhs
@@ -1,10 +0,0 @@-oscN rate bufnum freq phase--Noninterpolating wavetable lookup oscillator with frequency and-phase modulation inputs. It is usually better to use the-interpolating oscillator.--The buffer size must be a power of 2. The buffer should NOT be-filled using Wavetable format (b_gen commands should set wavetable-flag to false.-
− Help/UGen/Oscillator/pmOsc.help.lhs
@@ -1,23 +0,0 @@-pmOsc rate cf mf pm mp--phase modulation oscillator (composite UGen)-- cf = carrier frequency- mf = modulation frequency- pm = modulator amplitude- mp = modulator phase--The definition is:-- pmOsc r cf mf pm mp = sinOsc r cf (sinOsc r mf mp * pm)--> import Sound.SC3.Monadic--> do { cf <- rand 0 2000-> ; mf <- rand 0 800-> ; pm' <- rand 0 12-> ; l <- rand (-1) 1-> ; let { t = envLinen' 2 5 2 1 (EnvLin, EnvLin, EnvLin)-> ; e = envGen KR 1 0.1 0 1 RemoveSynth t-> ; pm = line KR 0 pm' 9 DoNothing }-> in audition (out 0 (linPan2 (pmOsc AR cf mf pm 0) l e)) }
− Help/UGen/Oscillator/pulse.help.lhs
@@ -1,26 +0,0 @@-pulse AR f w-- r - operating rate- f - frequency (hz)- w - width (0.5)--Bandlimited pulse wave generator.--Modulate frequency--> import Sound.SC3--> let f = xLine KR 40 4000 6 RemoveSynth-> in audition (out 0 (pulse AR f 0.1 * 0.1))--Modulate pulse width--> let w = line KR 0.01 0.99 8 RemoveSynth-> in audition (out 0 (pulse AR 200 w * 0.1))--Two band limited square waves through a resonant -low pass filter--> let { p = pulse AR (mce [100, 250]) 0.5 * 0.1-> ; f = xLine KR 8000 400 5 RemoveSynth }-> in audition (out 0 (rlpf p f 0.05))
− Help/UGen/Oscillator/saw.help.lhs
@@ -1,12 +0,0 @@-saw AR freq--Band limited sawtooth wave generator.--> import Sound.SC3--> audition (out 0 (saw AR (xLine KR 40 4000 6 RemoveSynth) * 0.1))--Two band limited sawtooth waves thru a resonant low pass filter--> let f = xLine KR 8000 400 5 DoNothing-> in audition (out 0 (rlpf (saw AR (mce [100, 250]) * 0.1) f 0.05))
− Help/UGen/Oscillator/silent.help.lhs
@@ -1,7 +0,0 @@-silent numberOfChannels--Generate a silent (zero) signal.--> import Sound.SC3--> audition (out 0 (silent 1))
− Help/UGen/Oscillator/sinOsc.help.lhs
@@ -1,33 +0,0 @@-sinOsc rate freq phase--Interpolating sine wavetable oscillator. This is the same as osc-except that the table is a sine table of 8192 entries.--freq - frequency in Hertz-phase - phase offset or modulator in radians--> import Sound.SC3--> audition (out 0 (sinOsc AR 440 0 * 0.25))--Modulate freq--> audition (out 0 (sinOsc AR (xLine KR 2000 200 9 RemoveSynth) 0 * 0.5))--Modulate freq--> let f = sinOsc AR (xLine KR 1 1000 9 RemoveSynth) 0 * 200 + 800-> in audition (out 0 (sinOsc AR f 0 * 0.1))--Modulate phase--> let p = sinOsc AR (xLine KR 20 8000 10 RemoveSynth) 0 * 2 * pi-> in audition (out 0 (sinOsc AR 800 p * 0.1))--Simple bell-like tone.--> let { f = mce [0.5, 1, 1.19, 1.56, 2, 2.51, 2.66, 3.01, 4.1]-> ; a = mce [0.25, 1, 0.8, 0.5, 0.9, 0.4, 0.3, 0.6, 0.1]-> ; o = sinOsc AR (500 * f) 0 * a-> ; e = envGen KR 1 0.1 0 1 RemoveSynth (envPerc 0.01 10) }-> in audition (out 0 (mix o * e))
− Help/UGen/Oscillator/syncSaw.help.lhs
@@ -1,14 +0,0 @@-syncSaw rate syncFreq sawFreq--A sawtooth wave that is hard synched to a fundamental pitch. This-produces an effect similar to moving formants or pulse width-modulation. The sawtooth oscillator has its phase reset when the-sync oscillator completes a cycle. This is not a band limited-waveform, so it may alias.--The frequency of the slave synched sawtooth wave should always be-greater than the syncFreq.--> import Sound.SC3--> audition (out 0 (syncSaw AR 100 (line KR 100 800 12 RemoveSynth) * 0.1))
− Help/UGen/Oscillator/tChoose.help.lhs
@@ -1,19 +0,0 @@-tChoose trig inputs--The output is selected randomly on recieving a trigger from an-array of inputs. tChoose is a composite of tiRand and select.--> import Control.Monad-> import Sound.SC3.Monadic--> let x = mouseX kr 1 1000 Exponential 0.1-> in do { t <- dust AR x-> ; f <- liftM midiCPS (tiRand 48 60 t)-> ; o <- let a = mce [ sinOsc AR f 0-> , saw AR (f * 2)-> , pulse AR (f * 0.5) 0.1 ]-> in tChoose t a-> ; audition (out 0 (o * 0.1)) }--;; Note: all the ugens are continously running. This may not be the-;; most efficient way if each input is cpu-expensive.
− Help/UGen/Oscillator/tGrains.help.lhs
@@ -1,67 +0,0 @@-tGrains numChannels trigger bufnum rate centerPos dur pan amp interp--Buffer granulator. Triggers generate grains from a buffer. Each-grain has a Hanning envelope (sin^2(x) for x from 0 to pi) and is-panned between two channels of multiple outputs.--numChannels - number of output channels.--trigger - at each trigger, the following arguments are sampled and- used as the arguments of a new grain. A trigger occurs- when a signal changes from <= 0 to > 0. If the trigger- is audio rate then the grains will start with sample- accuracy.--bufnum - the index of the buffer to use. It must be a one channel- (mono) buffer.--rate - 1.0 is normal, 2.0 is one octave up, 0.5 is one octave down- and -1.0 is backwards normal rate ... etc. Unlike PlayBuf,- the rate is multiplied by BufRate, so you needn't do that- yourself.--centerPos - the position in the buffer in seconds at which the- grain envelope will reach maximum amplitude.--dur - duration of the grain in seconds.--pan - a value from -1 to 1. Determines where to pan the output in- the same manner as PanAz.--amp - amplitude of the grain.--interp - 1, 2, or 4. Determines whether the grain uses (1) no- interpolation, (2) linear interpolation, or (4) cubic- interpolation.--> import Sound.SC3--> let fn = "/home/rohan/audio/metal.wav"-> in withSC3 (\fd -> async fd (b_allocRead 10 fn 0 0))--> let { tRate = mouseY KR 2 200 Exponential 0.1-> ; ctr = mouseX KR 0 (bufDur KR 10) Linear 0.1-> ; tr = impulse AR tRate 0 }-> in audition (out 0 (tGrains 2 tr 10 1 ctr (4 / tRate) 0 0.1 2))--> import Sound.SC3.Monadic--> let { b = 10-> ; trate = mouseY KR 8 120 Exponential 0.1-> ; dur = 4 / trate }-> in do { clk <- dust AR trate-> ; r <- tRand 0 0.01 clk-> ; pan <- return . (* 0.6) =<< whiteNoise KR-> ; let { x = mouseX KR 0 (bufDur KR b) Linear 0.1-> ; pos = x + r }-> in audition (out 0 (tGrains 2 clk b 1 pos dur pan 0.1 2)) }--> let { b = 10-> ; trate = mouseY KR 2 120 Exponential 0.1-> ; dur = 1.2 / trate-> ; clk = impulse AR trate 0-> ; pos = mouseX KR 0 (bufDur KR b) Linear 0.1 }-> in do { n0 <- whiteNoise KR-> ; n1 <- whiteNoise KR-> ; let rate = shiftLeft 1.2 (roundE (n0 * 3) 1)-> in audition (out 0 (tGrains 2 clk b rate pos dur (n1 * 0.6) 0.25 2)) }
− Help/UGen/Oscillator/twChoose.help.lhs
@@ -1,23 +0,0 @@-twChoose trig array weights normalize--The output is selected randomly on recieving a trigger from an-array of inputs. The weights of this choice are determined from-the weights array. If normalize is set to 1 the weights are-continuously normalized, which means an extra calculation overhead.-When using fixed values the normalizeSum method can be used to-normalize the values. TWChoose is a composite of TWindex and-Select--> import Sound.SC3.Monadic--> let x = mouseX KR 1 1000 Exponential 0.1-> in do { d <- dust AR x-> ; let { a = mce [ sinOsc AR 220 0-> , saw AR 440-> , pulse AR 110 0.1] -> ; w = mce [0.5, 0.35, 0.15] }-> in do { o <- twChoose d a w 0-> ; audition (out 0 (o * 0.1)) } }--Note: all the ugens are continously running. This may not be the-most efficient way if each input is cpu-expensive.
− Help/UGen/Oscillator/twindex.help.lhs
@@ -1,23 +0,0 @@-twindex in normalize array--Triggered windex. When triggered, returns a random index value based-on array as a list of probabilities. By default the list of-probabilities should sum to 1, when the normalize flag is set to 1,-the values get normalized by the ugen (less efficient) Assuming-normalized values--> import Sound.SC3.Monadic--> let { p = mce [1/5, 2/5, 2/5]-> ; a = mce [400, 500, 600]-> ; t = impulse KR 6 0 }-> in do { i <- twindex t 0 p-> ; audition (out 0 (sinOsc AR (select i a) 0 * 0.1)) }--Modulating probability values--> let { p = mce [1/4, 1/2, sinOsc KR 0.3 0 * 0.5 + 0.5]-> ; a = mce [400, 500, 600]-> ; t = impulse KR 6 0 }-> in do { i <- twindex t 1 p-> ; audition (out 0 (sinOsc AR (select i a) 0 * 0.1)) }
− Help/UGen/Oscillator/varSaw.help.lhs
@@ -1,13 +0,0 @@-varSaw rate freq iphasewidth--Variable duty saw--freq - frequency in Hertz-iphase - initial phase offset in cycles ( 0..1 )-width - duty cycle from zero to one.--> import Sound.SC3--> let { f = lfPulse KR (mce2 3 3.03) 0 0.3 * 200 + 200-> ; w = linLin (lfTri KR 1 0) (-1) 1 0 1 }-> in audition (out 0 (varSaw AR f 0 w * 0.1))
− Help/UGen/Panner/linPan2.help.lhs
@@ -1,10 +0,0 @@-linPan2 in pos level--Two channel linear pan. See Pan2.--> import Sound.SC3.ID--> let n = pinkNoise 'a' AR-> in audition (out 0 (linPan2 n (fSinOsc KR 2 0) 0.1))--> audition (out 0 (linPan2 (fSinOsc AR 800 0) (fSinOsc KR 3 0) 0.1))
− Help/UGen/Panner/pan2.help.lhs
@@ -1,14 +0,0 @@-pan2 in pos level--Two channel equal power panner. The pan position is bipolar, -1 is-left, +1 is right. The level is a control rate input.--> import Sound.SC3.ID--> let n = pinkNoise 'a' AR-> in audition (out 0 (pan2 n (fSinOsc KR 2 0) 0.3))--> let { n = pinkNoise 'a' AR-> ; x = mouseX KR (-1) 1 Linear 0.2-> ; y = mouseY KR 0 1 Linear 0.2 }-> in audition (out 0 (pan2 n x y))
− Help/UGen/Panner/rotate2.help.lhs
@@ -1,35 +0,0 @@-rotate2 x y pos--Rotate a sound field. Rotate2 can be used for rotating an-ambisonic B-format sound field around an axis. Rotate2 does an-equal power rotation so it also works well on stereo sounds. It-takes two audio inputs (x, y) and an angle control (pos). It-outputs two channels (x, y).--It computes:-- xout = cos(angle) * xin + sin(angle) * yin- yout = cos(angle) * yin - sin(angle) * xin--where angle = pos * pi, so that -1 becomes -pi and +1 becomes +pi.-This allows you to use an LFSaw to do continuous rotation around a-circle.--The control pos is the angle to rotate around the circle from -1-to +1. -1 is 180 degrees, -0.5 is left, 0 is forward, +0.5 is-right, +1 is behind.--Rotation of stereo sound, via LFO.--> import Sound.SC3.ID--> let { x = pinkNoise 'a' AR-> ; y = lfTri AR 800 0 * lfPulse KR 3 0 0.3 * 0.2 }-> in audition (out 0 (rotate2 x y (lfSaw KR 0.1 0)))--Rotation of stereo sound, via mouse.--> let { x = mix (lfSaw AR (mce [198..201]) 0 * 0.1)-> ; y = sinOsc AR 900 0 * lfPulse KR 3 0 0.3 * 0.2 -> ; p = mouseX KR 0 2 Linear 0.2 }-> in audition (out 0 (rotate2 x y p))
− Help/UGen/Panner/splay.help.lhs
@@ -1,19 +0,0 @@-splay in spread level center--splay spreads an array of channels across the stereo field.-- spread - 0 = mono, 1 = stereo- level - 0 = silent, 1 = unit gain (equal power level compensated)- center - negate 1 = left, 1 = right--> import Sound.SC3.Monadic-> import Control.Monad--> do { i <- return 6-> ; r <- replicateM i (rand 10 20)-> ; n <- lfNoise2 KR (mce r)-> ; let { ci = constant . fromIntegral-> ; x = mouseX KR (-1) 1 Linear 0.1-> ; y = mouseY KR 1 0 Linear 0.1-> ; o = sinOsc AR (n * 200 + (mce [1 .. ci i] + 3 * 100)) 0 }-> in audition (out 0 (splay o y 0.2 x)) }
− Help/UGen/Trigger/gate.help.lhs
@@ -1,8 +0,0 @@-gate in trig--The signal at `in' is passed while `trig' is greater than zero.--> import Sound.SC3--> let t = lfPulse AR 1 0 0.1-> in audition (out 0 (gate (fSinOsc AR 500 0 * 0.25) t))
− Help/UGen/Trigger/inRange.help.lhs
@@ -1,17 +0,0 @@-inRange in lo hi--Tests if a signal is within a given range.--If in is >= lo and <= hi output 1.0, otherwise output 0.0. Output-is initially zero.--in - signal to be tested-lo - low threshold-hi - high threshold--> import Sound.SC3.ID--> let { n = brownNoise 'α' AR-> ; x = mouseX KR 1 2 Linear 0.1 -> ; o = sinOsc KR x 0 * 0.2 }-> in audition (out 0 (inRange o (-0.15) 0.15 * n * 0.1))
− Help/UGen/Trigger/lastValue.help.lhs
@@ -1,12 +0,0 @@-lastValue in diff--Output the last value before the input changed more than a threshhold.--> import Sound.SC3--> let x = mouseX KR 100 400 Linear 0.1-> in audition (out 0 (sinOsc AR (lastValue x 40) 0 * 0.1))--> let { x = mouseX KR 0.1 4 Linear 0.1-> ; f = abs (lastValue x 0.5 - x) * 400 + 200 }-> in audition (out 0 (sinOsc AR f 0 * 0.2))
− Help/UGen/Trigger/mostChange.help.lhs
@@ -1,10 +0,0 @@-mostChange a b--Output the input that changed most.--> import Sound.SC3.ID--> let { n = lfNoise0 'α' KR 1-> ; x = mouseX KR 200 300 Linear 0.1-> ; f = mostChange (n * 400 + 900) x }-> in audition (out 0 (sinOsc AR f 0 * 0.1))
− Help/UGen/Trigger/peak.help.lhs
@@ -1,11 +0,0 @@-peak trig reset--Outputs the maximum value read at the `trig' input until `reset' is-triggered.--> import Sound.SC3.ID--> let { t = dust 'α' AR 20-> ; r = impulse AR 0.4 0-> ; f = peak t r * 500 + 200 }-> in audition (out 0 (sinOsc AR f 0 * 0.2))
− Help/UGen/Trigger/phasor.help.lhs
@@ -1,23 +0,0 @@-phasor rate trig rate start end resetPos--Triggered linear ramp between two levels. Starts a linear ramp-when trig input crosses from non-positive to positive.--trig - sets phase to resetPos (default: 0, equivalent to start)-rate - rate value in 1 / frameDur (at 44.1 kHz sample rate: rate- 1 is eqivalent to 44100/sec)-start, end - start and end points of ramp-resetPos - determines where to jump to on recieving a trigger. the- value at that position can be calculated as follows:- (end - start) * resetPos--phasor controls sine frequency: end frequency matches a second sine wave.--> import Sound.SC3--> let { rate = mouseX KR 0.2 2 Exponential 0.1-> ; tr = impulse AR rate 0-> ; sr = sampleRate-> ; x = phasor AR tr (rate / sr) 0 1 0 -> ; f = mce [linLin x 0 1 600 1000, 1000] }-> in audition (out 0 (sinOsc AR f 0 * 0.2))
− Help/UGen/Trigger/pulseCount.help.lhs
@@ -1,9 +0,0 @@-pulseCount trig reset--This outputs the number of pulses received at `trig' and outputs-that value until `reset' is triggered.--> import Sound.SC3--> let c = pulseCount (impulse AR 10 0) (impulse AR 0.4 0)-> in audition (out 0 (sinOsc AR (c * 200) 0 * 0.05))
− Help/UGen/Trigger/pulseDivider.help.lhs
@@ -1,13 +0,0 @@-pulseDivider trig div start--Outputs one impulse each time it receives a certain number of triggers-at its input. A trigger happens when the signal changes from-non-positive to positive.--> import Sound.SC3--> let { p = impulse AR 8 0-> ; d = pulseDivider p (mce [4,7]) 0-> ; a = sinOsc AR 1200 0 * decay2 p 0.005 0.1-> ; b = sinOsc AR 600 0 * decay2 d 0.005 0.5 }-> in audition (out 0 (a + b * 0.4))
− Help/UGen/Trigger/runningMax.help.lhs
@@ -1,15 +0,0 @@-runningMax in trig--Track maximum level. Outputs the maximum value received at the-input. When triggered, the maximum output value is reset to the-current value.--in - input signal-trig - reset the output value to the current input value--> import Sound.SC3.ID--> let { n = dust 'α' AR 20-> ; t = impulse AR 0.4 0-> ; f = runningMax n t * 500 + 200 }-> in audition (out 0 (sinOsc AR f 0 * 0.2))
− Help/UGen/Trigger/runningMin.help.lhs
@@ -1,23 +0,0 @@-runningMin in trig--Track maximum level. Outputs the maximum value received at the-input. When triggered, the maximum output value is reset to the-current value.--in - input signal-trig - reset the output value to the current input value--> import Sound.SC3--> let { o = sinOsc KR 2 0-> ; x = mouseX KR 0.01 10 Exponential 0.1-> ; t = impulse AR x 0 -> ; f = runningMin o t * 500 + 200 }-> in audition (out 0 (sinOsc AR f 0 * 0.2))--> import Sound.SC3.ID--> let { n = dust 'α' AR 20-> ; t = impulse AR 0.4 0-> ; f = runningMin n t * 500 + 200 }-> in audition (out 0 (sinOsc AR f 0 * 0.2))
− Help/UGen/Trigger/sendTrig.help.lhs
@@ -1,26 +0,0 @@-sendTrig in id value--On receiving a trigger (0 to non-zero transition), send a trigger-message from the server back to all registered clients. Clients-register by sending a /notify message to the server.--input - the trigger--id - an integer that will be passed with the trigger message. This- is useful if you have more than one SendTrig in a SynthDef--value - a UGen or float that will be polled at the time of trigger,- and its value passed with the trigger message--> import Sound.SC3.ID--> let { s = lfNoise0 'α' KR 5-> ; o = sinOsc AR (s * 200 + 500) 0 * 0.1 }-> in audition (mrg [sendTrig s 0 s, out 0 o])--> import Sound.OpenSoundControl--> withSC3 (\fd -> do { async fd (notify True)-> ; tr <- wait fd "/tr"-> ; putStrLn (show tr)-> ; async fd (notify False) })
− Help/UGen/Trigger/setResetFF.help.lhs
@@ -1,17 +0,0 @@-setResetFF trig reset--Set-reset flip flop. Output is set to 1.0 upon receiving a trigger-in the set input, and to 0.0 upon receiving a trigger in the reset-input. Once the flip flop is set to zero or one further triggers in-the same input are have no effect. One use of this is to have some-precipitating event cause something to happen until you reset it.--trig - trigger sets output to one-reset - trigger resets output to zero--> import Sound.SC3.ID--> let { n = brownNoise 'α' AR-> ; d0 = dust 'α' AR 5-> ; d1 = dust 'β' AR 5 }-> in audition (out 0 (setResetFF d0 d1 * n * 0.2))
− Help/UGen/Trigger/stepper.help.lhs
@@ -1,57 +0,0 @@-stepper trig reset min max step resetval--Stepper pulse counter. Each trigger increments a counter which is-output as a signal. The counter wraps between min and max.-- trig - trigger. Trigger can be any signal. A trigger happens when- the signal changes from non-positive to positive.-- reset - resets the counter to resetval when triggered.-- min - minimum value of the counter.-- max - maximum value of the counter.-- step - step value each trigger. May be negative.--resetval - value to which the counter is reset when it receives a- reset trigger. If nil, then this is patched to min.--> import Sound.SC3--> let { i = impulse KR 10 0-> ; f = stepper i 0 4 16 (-3) 4 * 100 }-> in audition (out 0 (sinOsc AR f 0 * 0.1))--> import System.Random--> let { compose = foldl (flip (.)) id-> ; noisec n l r = randomRs (l,r) (mkStdGen n)-> ; rvb s r0 r1 r2 = let f dl1 dl2 dc i = allpassN i 0.05 (mce [dl1,dl2]) dc-> in compose (take 5 (zipWith3 f r0 r1 r2)) s-> ; rvb' s = rvb s (noisec 0 0 0.05) (noisec 1 0 0.05) (noisec 2 1.5 2.0)-> ; stpr = let { rate = mouseX KR 1 5 Exponential 0.1-> ; clock = impulse KR rate 0-> ; envl = decay2 clock 0.002 2.5-> ; indx = stepper clock 0 0 15 1 0-> ; freq = bufRdN 1 KR 10 indx Loop-> ; ffreq = lag2 freq 0.1 + mce [0, 0.3]-> ; lfo = sinOsc KR 0.2 (mce [0, pi/2]) * 0.0024 + 0.0025-> ; top = mix (lfPulse AR (freq * mce [1, 1.5, 2]) 0 0.3)-> ; chn = [ \s -> rlpf s ffreq 0.3 * envl-> , \s -> rlpf s ffreq 0.3 * envl-> , \s -> s * 0.5-> , \s -> combL s 1 (0.66 / rate) 2 * 0.8 + s-> , \s -> s + (rvb' s * 0.3)-> , \s -> leakDC s 0.1-> , \s -> delayL s 0.1 lfo + s-> , \s -> onePole s 0.9 ] }-> in compose chn top-> ; stprInit fd = let n = [ 97.999, 195.998, 523.251, 466.164, 195.998-> , 233.082, 87.307, 391.995, 87.307, 261.626-> , 195.998, 77.782, 233.082, 195.998, 97.999-> , 155.563]-> in do { async fd (b_alloc 10 128 1)-> ; send fd (b_setn 10 [(0, n)]) } }-> in withSC3 (\fd -> do { stprInit fd-> ; audition (out 0 stpr) })
− Help/UGen/Trigger/sweep.help.lhs
@@ -1,42 +0,0 @@-sweep trig rate--Triggered linear ramp. Starts a linear raise by rate/sec from zero-when trig input crosses from non-positive to positive.- -Using sweep to modulate sine frequency--> import Sound.SC3--> let { x = mouseX KR 0.5 20 Exponential 0.1-> ; t = impulse KR x 0 -> ; f = sweep t 700 + 500 }-> in audition (out 0 (sinOsc AR f 0 * 0.2))--Using sweep to index into a buffer--> let fn = "/home/rohan/audio/metal.wav"-> in withSC3 (\fd -> send fd (b_allocRead 0 fn 0 0))--> let { x = mouseX KR 0.5 20 Exponential 0.1-> ; t = impulse AR x 0-> ; p = sweep t (bufSampleRate KR 0) }-> in audition (out 0 (bufRdL 1 AR 0 p NoLoop))--Backwards, variable offset--> import Sound.SC3.ID--> let { n = lfNoise0 'a' KR 15-> ; x = mouseX KR 0.5 10 Exponential 0.1-> ; t = impulse AR x 0-> ; r = bufSampleRate KR 0-> ; p = sweep t (negate r) + (bufFrames KR 0 * n) }-> in audition (out 0 (bufRdL 1 AR 0 p NoLoop))--Raising rate--> let { x = mouseX KR 0.5 10 Exponential 0.1-> ; t = impulse AR x 0-> ; r = sweep t 2 + 0.5-> ; p = sweep t (bufSampleRate KR 0 * r) }-> in audition (out 0 (bufRdL 1 AR 0 p NoLoop))
− Help/UGen/Trigger/tDelay.help.lhs
@@ -1,14 +0,0 @@-tDelay trigger delayTime--Delays a trigger by a given time. Any triggers which arrive in the-time between an input trigger and its delayed output, are ignored.--trigger - input trigger signal.-delayTime - delay time in seconds.--> import Sound.SC3--> let { z = impulse AR 2 0-> ; z' = tDelay z 0.5 -> ; o = sinOsc AR 440 0 * 0.1 }-> in audition (out 0 (mce [z * 0.1, toggleFF z' * o]))
− Help/UGen/Trigger/timer.help.lhs
@@ -1,11 +0,0 @@-timer trig--Returns time since last triggered- -Using timer to modulate sine frequency: the slower the trigger is-the higher the frequency--> import Sound.SC3--> let t = impulse KR (mouseX KR 0.5 20 Exponential 0.1) 0-> in audition (out 0 (sinOsc AR (timer t * 500 + 500) 0 * 0.2))
− Help/UGen/Trigger/toggleFF.help.lhs
@@ -1,12 +0,0 @@-toggleFF trig--Toggle flip flop. Toggles between zero and one upon receiving a-trigger.--trig - trigger input--> import Sound.SC3.ID--> let { t = dust 'a' AR (xLine KR 1 1000 60 DoNothing)-> ; t' = toggleFF t * 400 + 800 }-> in audition (out 0 (sinOsc AR t' 0 * 0.1))
− Help/UGen/Trigger/trig.help.lhs
@@ -1,9 +0,0 @@-trig in dur--When `in' is trigerred output the trigger value for `dur' seconds.--> import Sound.SC3.ID--> let { d = dust 'a' AR 1-> ; o = fSinOsc AR 800 0 * 0.5 }-> in audition (out 0 (trig d 0.2 * o))
− Help/UGen/Trigger/trig1.help.lhs
@@ -1,8 +0,0 @@-trig1 in dur--When `in' is trigered output a unit signal for `dur' seconds.--> import Sound.SC3.ID--> let d = dust 'a' AR 1-> in audition (out 0 (trig1 d 0.2 * fSinOsc AR 800 0 * 0.2))
+ Help/Ugen/abs.help.hs view
@@ -0,0 +1,2 @@+-- abs+abs (syncSaw ar 100 440 * 0.1)
+ Help/Ugen/absDif.help.hs view
@@ -0,0 +1,2 @@+-- absdif+fSinOsc ar 440 0 * (0.1 `absDif` (fSinOsc ar 2 0 * 0.2))
+ Help/Ugen/acos.help.hs view
@@ -0,0 +1,3 @@+---- ; drawings+Sound.Sc3.is_unary Sound.Sc3.Common.Base.CS "ArcCos"+Sound.Sc3.Plot.plot_fn_r1_ln acos (-1,1)
+ Help/Ugen/add.help.hs view
@@ -0,0 +1,13 @@+-- add (+)+let o = fSinOsc ar 800 0+ n = pinkNoiseId 'α' ar+in (o + n) * 0.1++-- add ; dc offset+fSinOsc ar 440 0 * 0.1 + 0.5++-- add ; optimise identity (rhs)+(sinOsc ar 440 0 + 0) * 0.1++-- add ; optimise identity (lhs)+(0 + sinOsc ar 440 0) * 0.1
+ Help/Ugen/allpassC.help.hs view
@@ -0,0 +1,10 @@+-- allpassC ; allpass delay has no audible effect as a resonator on steady state sound+let dly = xLine kr 0.0001 0.01 20 RemoveSynth+ n = whiteNoiseId 'α' ar * 0.05+in allpassC n 0.01 dly 0.2++-- allpassC ; cubic variant+let dly = xLine kr 0.0001 0.01 20 RemoveSynth+ n = whiteNoiseId 'δ' ar * 0.05+in n + allpassC n 0.01 dly 0.2+
+ Help/Ugen/allpassL.help.hs view
@@ -0,0 +1,4 @@+-- allpassL ; linear variant+let n = whiteNoiseId 'γ' ar * 0.05+ dly = xLine kr 0.0001 0.01 20 RemoveSynth+in n + allpassL n 0.01 dly 0.2
+ Help/Ugen/allpassN.help.hs view
@@ -0,0 +1,16 @@+-- allpassN ; add input to the filtered sound to hear the effect of the phase comb+let n = whiteNoiseId 'β' ar * 0.05+ dly = xLine kr 0.0001 0.01 20 RemoveSynth+in n + allpassN n 0.01 dly 0.2++-- allpassN ; used as an echo, c.f. comb ; outputs signal immediately (inverted), lower amplitude+let n = whiteNoiseId 'ε' ar+ d = dustId 'ζ' ar 1+ src = decay (d * 0.25) 0.2 * n+in allpassN src 0.2 0.2 3++-- allpassN ; phasing ; warning=feedback+let i = soundIn (mce2 0 1) -- two channels of input signal+ f = mouseX kr 0.1 1.0 Linear 0.2 -- phaser freq+ e = allpassN i 0.02 (sinOsc kr f 0 * 0.01 + 0.01) 1 -- max delay of 20msec+in i + e -- sum phase-shifted signal to original signal
+ Help/Ugen/amClip.help.hs view
@@ -0,0 +1,2 @@+-- amClip+amClip (whiteNoiseId 'α' ar) (fSinOsc kr 1 0 * 0.05)
+ Help/Ugen/ampComp.help.hs view
@@ -0,0 +1,12 @@+-- ampComp ; mouse frequency control+let freq = mouseX kr 300 15000 Exponential 0.2+in sinOsc ar freq 0 * 0.1 * ampComp kr freq 300 0.3333++-- ampComp ; modified exponent+let freq = mouseX kr 300 15000 Exponential 0.2+in pulse ar freq 0.5 * 0.1 * ampComp kr freq 300 1.3++-- ampComp ; in frequency modulation+let freq1 = mouseX kr 300 15000 Exponential 0.2+ freq2 = freq1 * (sinOsc ar (mouseY kr 3 200 Exponential 0.2) 0 * 0.5 + 1)+in sinOsc ar freq2 0 * 0.1 * ampComp ar freq2 300 0.3333
+ Help/Ugen/ampDb.help.hs view
@@ -0,0 +1,2 @@+-- ambDb+sinOsc ar (ampDb (line kr 0 1 5 DoNothing) * 2 + 180) 0 * dbAmp (-45)
+ Help/Ugen/amplitude.help.hs view
@@ -0,0 +1,14 @@+-- amplitude ; control gain+let s = soundIn 0+ a = amplitude kr s 0.01 0.01+in pulse ar 90 0.3 * a++-- amplitude ; control frequency+let s = soundIn 0+ f = amplitude kr s 0.5 0.5 * 1200 + 400+in sinOsc ar f 0 * 0.1++-- amplitude+let s = soundIn 0+ a = amplitude ar s 0.5 0.05+in s * a
+ Help/Ugen/analogBassDrum.help.hs view
@@ -0,0 +1,20 @@+-- analogBassDrum+let trig = dust2Id 'α' kr 8+ infsustain = 0.0+ accent = 0.25+ freq = tExpRandId 'β' 40 120 trig+ tone = tRandId 'γ' 0.0 0.35 trig+ decay = 0.15+ attackfm = tRandId 'δ' 0.1 0.2 trig+ selffm = tRandId 'ε' 0.1 0.9 trig+ sig = X.analogBassDrum ar trig infsustain accent freq tone decay attackfm selffm+in pan2 sig (tRandId 'ζ' (-1) 1 trig) 1++-- analogBassDrum ; event control+let f (_,g,x,y,z,o,rx,ry,_,_,_) =+ let freq = midiCps (x * 25 + 24)+ tr = trig g controlDur+ selffm = tRandId 'α' 0.1 0.9 tr+ sig = X.analogBassDrum ar tr 0 z freq y rx (ry `in_range` (0.1,0.2)) selffm+ in pan2 sig (o * 2 - 1) 1+in mix (voicer 16 f) * control kr "gain" 2
+ Help/Ugen/analogPhaser.help.hs view
@@ -0,0 +1,25 @@+-- analogPhaser+let drywet = 0+ amp = 0.01+ pan = 0+ osc = X.varShapeOsc ar 110 0.5 (sinOsc kr 0.0915 0 `in_range` (0,1)) 1 151+ skew = sinOsc kr 0.059 0+ feedback = sinOsc kr 0.005 pi `in_range` (0,0.85)+ modulation = sinOsc kr 0.0192 two_pi `in_range` (0,1)+ stages = 50+ flt = X.analogPhaser osc (sinOsc ar 0.22 0) skew feedback modulation stages+in pan2 (xFade2 osc flt drywet 1) pan amp++-- analogPhaser ; controls+let k = control kr+ drywet = k "drywet" 0+ amp = k "amp" 0.01+ pan = k "pan" 0+ freq = k "freq" 110+ osc = X.varShapeOsc ar freq 0.5 (sinOsc kr 0.0915 0 `in_range` (0,1)) 1 151+ skew = sinOsc kr 0.059 0+ feedback = sinOsc kr 0.005 pi `in_range` (0,0.85)+ modulation = sinOsc kr 0.0192 two_pi `in_range` (0,1)+ stages = control_m kr "stage" 50 (8,50,"lin")+ flt = X.analogPhaser osc (sinOsc ar 0.22 0) skew feedback modulation stages+in pan2 (xFade2 osc flt drywet 1) pan amp
+ Help/Ugen/analogPhaserMod.help.hs view
@@ -0,0 +1,7 @@+-- analogPhaserMod+let amp = 0.25+ osc = sinOsc ar (lfNoise2Id 'α' ar 10 * 1000) 0+ flt = X.analogPhaserMod osc 0 1.0 50+ drywet = lfSaw ar 0.1 0+ sig = xFade2 (sinOsc ar (osc * 401.0) 0) (sinOsc ar (flt * 401.0) 0) drywet amp+in pan2 sig 0 1
+ Help/Ugen/analogSnareDrum.help.hs view
@@ -0,0 +1,18 @@+-- analogSnareDrum+let trig = dust2Id 'α' kr 8+ infsustain = 0.0+ accent = 0.25+ freq = tExpRandId 'β' 40 220 trig+ tone = tRandId 'γ' 0.0 0.4 trig+ decay = tRandId 'δ' 0.1 0.8 trig+ snappy = tRandId 'ε' 0.0 0.9 trig+ sig = X.analogSnareDrum ar trig infsustain accent freq tone decay snappy+in pan2 sig (tRandId 'ζ' (-1) 1 trig) 0.1++-- analogSnareDrum ; event control+let f (_,g,x,y,z,o,rx,ry,_,_,_) =+ let freq = midiCps (x * 25 + 36)+ tr = trig g controlDur+ sig = X.analogSnareDrum ar tr 0 z freq y rx (ry * 2)+ in pan2 sig (o * 2 - 1) (lagUD g 0 2)+in mix (voicer 16 f) * control kr "gain" 0.25
+ Help/Ugen/analogTape.help.hs view
@@ -0,0 +1,22 @@+-- analogTape+let freq = control kr "freq" 110+ width = control kr "width" 0.5+ bias = control kr "bias" 0.5+ saturation = control kr "saturation" 0.5+ drive = control kr "drive" 0.5+ sig = varSaw ar freq 0 width+in mce2 (sig * 0.05) (X.analogTape sig bias saturation drive 1 0 * 0.1)++-- analogTape ; event control+let bias = control kr "bias" 0.25+ saturation = control kr "saturation" 0.25+ drive = control kr "drive" 0.25+ f (_,g,x,y,z,o,rx,ry,_,_,_) =+ let freq = midiCps (x * 12 + 48)+ width = y+ sig = varSaw ar freq 0 width+ in pan2 (X.analogTape sig (bias + rx) (saturation + ry) (drive + o) 1 0) (o * 2 - 1) (z * g)+in mix (voicer 12 f) * control kr "gain" 1++---- ; drawings+UI.ui_sc3_scope 2 0 (2 ^ 14) 0.75 "audio" 0
+ Help/Ugen/analogVintageDistortion.help.hs view
@@ -0,0 +1,14 @@+-- analogVintageDistortion+let amp = control kr "amp" 0.025+ drivegain = control kr "drivegain" 0.85+ bias = control kr "bias" 0.1+ lowgain = control kr "lowgain" (dbAmp (-3))+ highgain = control kr "highgain" (dbAmp (-9))+ shelvingfreq = control_m kr "shelvingfreq" 600 (200,800,"exp")+ oversample = control_m kr "oversample" 1 (0,1,"switch")+ sig = sinOsc ar (sinOsc kr 1 0 `in_exprange` (80,1000)) 0+ flt = X.analogVintageDistortion sig drivegain bias lowgain highgain shelvingfreq oversample+in mce2 (sig * 0.5) flt * amp++---- ; drawings+UI.ui_sc3_scope 2 0 (2 ^ 14) 0 "audio" 0
+ Help/Ugen/arrayMax.help.hs view
@@ -0,0 +1,4 @@+-- arrayMax+let son = sinOsc ar (mce [100, 100.3 .. 110]) 0+ (val,_ix) = unmce2 (X.arrayMax son)+in mce2 (son * 0.02) (leakDC val 0.995 * 0.02) -- the operation tends to induce DC offset
+ Help/Ugen/arrayMin.help.hs view
@@ -0,0 +1,4 @@+-- arrayMin+let son = sinOsc ar (mce [100, 100.3 .. 110]) 0+ (val,_ix) = unmce2 (X.arrayMin son)+in mce2 (son * 0.02) (leakDC val 0.995 * 0.02) -- the operation tends to induce DC offset
+ Help/Ugen/asin.help.hs view
@@ -0,0 +1,3 @@+---- ; drawings+Sound.Sc3.is_unary Sound.Sc3.Common.Base.CS "ArcSin"+Sound.Sc3.Plot.plot_fn_r1_ln asin (-1,1)
+ Help/Ugen/atan.help.hs view
@@ -0,0 +1,2 @@+-- atan ; Sound.Sc3.Plot.plot_fn_r1_ln atan (-5,5)+sinOsc ar (atan (sinOsc kr 0.5 0) * 200 + 300) 0 * 0.05
+ Help/Ugen/atan2.help.hs view
@@ -0,0 +1,9 @@+-- atan2 ; pan hypot doppler example, atan2 finds direction of source, speakers at +/- 45 degrees+let x = 10+ y = lfSaw kr (1 / 6) 0 * 100+ d = hypot x y+ a = 40 / (squared d)+ s = rlpf (fSinOsc ar 200 0 * lfPulse ar 31.3 0 0.4) 400 0.3+ z = atan2E y x+ l = clip2 (z / (pi / 2)) 1+in pan2 (delayL s (110 / 344) (d / 344)) l a
+ Help/Ugen/atari2600.help.hs view
@@ -0,0 +1,27 @@+-- atari2600+X.atari2600 ar 1 2 3 4 5 5 1++-- atari2600+X.atari2600 ar 2 3 10 10 5 5 1++-- atari2600+let x = mouseX kr 0 15 Linear 0.1+ y = mouseY kr 0 15 Linear 0.1+in X.atari2600 ar x y 10 10 5 5 1++-- atari2600+let x = mouseX kr 0 31 Linear 0.1+ y = mouseY kr 0 31 Linear 0.1+in X.atari2600 ar 2 3 x y 5 5 1++-- atari2600+let x = mouseX kr 0 15 Linear 0.1+ y = mouseY kr 0 15 Linear 0.1+in X.atari2600 ar 2 3 10 10 x y 1++-- atari2600+let x = mouseX kr 0 15 Linear 0.1+ o1 = sinOsc kr 0.35 0 * 7.5 + 7.5+ y = mouseY kr 0 31 Linear 0.1+ o2 = sinOsc kr 0.3 0 * 5.5 + 5.5+in X.atari2600 ar x o1 10 y o2 5 1
+ Help/Ugen/audioMSG.help.hs view
@@ -0,0 +1,5 @@+-- audioMSG+X.audioMSG (sinOsc ar 220 0 * 0.05) (mouseX kr 0 (2 * pi) Linear 0.2)++-- audioMSG ; warning=feedback+X.audioMSG (soundIn 0) (mouseX kr 0 (2 * pi) Linear 0.2)
+ Help/Ugen/ay.help.hs view
@@ -0,0 +1,30 @@+-- ay ; default parameters+X.ay ar 1777 1666 1555 1 7 15 15 15 4 1 0++-- ay ; mouse control+let tonea = mouseY kr 10 3900 Exponential 0.2+ toneb = mouseX kr 10 3900 Exponential 0.2+ ctl = 3+ vola = 14+ volb = 14+ volc = 0+ s = X.ay ar tonea toneb 1555 1 ctl vola volb volc 4 1 0+in pan2 s 0 0.25++-- ay ; auto-pilot+let rate = mouseX kr 0.1 10 Linear 0.2+ rng l r i = linLin i (-1) 1 l r+ mk_ctlId e l r = rng l r (lfdNoise3Id e kr rate)+ mk_ctl_0Id e l r = rng l r (lfdNoise0Id e kr rate)+ tonea = mk_ctlId 'α' 10 3900+ toneb = mk_ctlId 'β' 10 3900+ tonec = mk_ctlId 'γ' 10 3900+ n = mk_ctlId 'δ' 0 31+ ctl = mk_ctl_0Id 'ε' 0 31+ vola = mk_ctlId 'ζ' 0 15+ volb = mk_ctlId 'η' 0 15+ volc = mk_ctlId 'θ' 0 15+ efreq = mk_ctlId 'ι' 0 4095+ estyle = mk_ctlId 'κ' 0 15+ s = X.ay ar tonea toneb tonec n ctl vola volb volc efreq estyle 0+in pan2 s 0 0.5
+ Help/Ugen/bAllPass.help.hs view
@@ -0,0 +1,15 @@+-- bAllPass ; thoughpass ; warning=feedback+let i = soundIn (mce2 0 1)+ f = mouseX kr 10 18000 Exponential 0.2+in bAllPass i f 0.8 * 0.2++-- bAllPass ; bandpass ; warning=feedback+let i = soundIn (mce2 0 1) * 0.5+ f = mouseX kr 100 18000 Exponential 0.2+in bAllPass i f 0.8 + negate i++-- bAllPass ; calculate coefficients and use sos ; warning=feedback+let i = soundIn (mce2 0 1) * 0.5+ f = mouseX kr 100 18000 Exponential 0.2+ (a0, a1, a2, b1, b2) = Sound.Sc3.Common.Math.Filter.Beq.bAllPassCoef sampleRate f 0.8+in sos i a0 a1 a2 b1 b2 + negate i
+ Help/Ugen/bBandPass.help.hs view
@@ -0,0 +1,12 @@+-- bBandPass ; warning=feedback+let i = soundIn 0+ f = mouseX kr 20 20000 Exponential 0.2+ bw = mouseY kr 0 10 Linear 0.2+in bBandPass i f bw++-- bBandPass ; calculate coefficients and use sos ; warning=feedback+let i = soundIn 0+ f = mouseX kr 20 20000 Exponential 0.2+ bw = mouseY kr 0 10 Linear 0.2+ (a0, a1, a2, b1, b2) = Sound.Sc3.Common.Math.Filter.Beq.bBandPassCoef sampleRate f bw+in sos i a0 a1 a2 b1 b2
+ Help/Ugen/bBandStop.help.hs view
@@ -0,0 +1,18 @@+-- bBandStop ; warning=feedback+let i = soundIn (mce2 0 1)+ f = mouseX kr 20 20000 Exponential 0.2+ bw = mouseY kr 0 10 Linear 0.2+in bBandStop i f bw++-- bBandStop ; drill+let i = sinOsc ar 1000 0+ f = mouseX kr 800 1200 Exponential 0.2+ bw = mouseY kr 0 10 Linear 0.2+in bBandStop i f bw * 0.1++-- calculate coefficients and use sos ; warning=feedback+let i = soundIn (mce2 0 1)+ f = mouseX kr 800 1200 Exponential 0.2+ bw = mouseY kr 0 10 Linear 0.2+ (a0, a1, a2, b1, b2) = Sound.Sc3.Common.Math.Filter.Beq.bBandStopCoef sampleRate f bw+in sos i a0 a1 a2 b1 b2
+ Help/Ugen/bGen.help.hs view
@@ -0,0 +1,20 @@+-- bGenSin1Tbl ; osc+let tbl = bGenSine1Tbl ("tbl", 0, 8192) [1, 1/2, 1/3, 1/4, 1/5]+in osc ar tbl 220 0 * 0.1++-- bGenSin1Tbl ; bufRd+let tbl = bGenSine1Tbl ("tbl", 0, 8192) [1, 1/2, 1/3, 1/4, 1/5]+ x = mouseX kr 220 440 Exponential 0.2+ phase = linLin (lfSaw ar x 0) (-1) 1 0 1 * bufFrames kr tbl+in bufRdC 1 ar tbl phase Loop * 0.1++-- bGenCheby ; shaper ; mouse control+let z = sinOsc ar 400 (pi / 2) * mouseY kr 0.01 1 Exponential 0.2+ t = bGenChebyTbl ("tbl", 0, 4096) [1, 0, 1, 1, 0, 1]+in shaper t z * 0.1++---- ; sine1 table setup ; allocate and generate wavetable buffer ; sin harmonics+withSc3 (mapM_ maybe_async [b_alloc 0 8192 1, b_gen_sine1 0 [Normalise,Wavetable,Clear] [1, 1/2, 1/3, 1/4, 1/5]])++---- ; print scsynth, the interpreter value that holds the reference that stores the end brackets+scsynthPrint scsynth
+ Help/Ugen/bHiPass.help.hs view
@@ -0,0 +1,12 @@+-- bHiPass+let i = pinkNoiseId 'α' ar+ f = mouseX kr 10 20000 Exponential 0.2+ rq = mouseY kr 0 1 Linear 0.2+in bHiPass i f rq * 0.05++-- bHiPass ; calculate coefficients and use sos (see also bHiPass4)+let i = pinkNoiseId 'α' ar+ f = mouseX kr 10 20000 Exponential 0.2+ rq = mouseY kr 0 1 Linear 0.2+ (a0, a1, a2, b1, b2) = Sound.Sc3.Common.Math.Filter.Beq.bHiPassCoef sampleRate f rq+in sos i a0 a1 a2 b1 b2 * 0.05
+ Help/Ugen/bHiPass4.help.hs view
@@ -0,0 +1,5 @@+-- bHiPass4+let i = mix (saw ar (mce [0.99, 1, 1.01] * 440) * 0.3)+ f = mouseX kr 20 20000 Exponential 0.2+ rq = mouseY kr 0.1 1 Linear 0.2+in bHiPass4 i f rq
+ Help/Ugen/bHiShelf.help.hs view
@@ -0,0 +1,18 @@+-- bHiShelf ; warning=feedback+let i = soundIn 0+ f = mouseX kr 2200 18000 Exponential 0.2+ db = mouseY kr 18 (-18) Linear 0.2+in bHiShelf i f 1 db * 0.25++-- bHiShelf ; warning=feedback+let i = soundIn 0+ f = mouseX kr 2200 18000 Exponential 0.2+ rs = mouseY kr 0.1 1 Linear 0.2+in bHiShelf i f rs 6 * 0.25++-- bHiShelf ; calculate coefficients and use sos ; warning=feedback+let i = soundIn 0+ f = mouseX kr 2200 18000 Exponential 0.2+ rs = mouseY kr 0.1 1 Linear 0.2+ (a0, a1, a2, b1, b2) = Sound.Sc3.Common.Math.Filter.Beq.bHiShelfCoef sampleRate f rs 6+in sos i a0 a1 a2 b1 b2
+ Help/Ugen/bLowPass.help.hs view
@@ -0,0 +1,24 @@+-- bLowPass ; warning=feedback+let i = soundIn (mce2 0 1)+ f = mouseX kr 10 20000 Exponential 0.2+ rq = mouseY kr 0 1 Linear 0.2+in bLowPass i f rq++-- bLowPass+let i = mix (saw ar (mce [0.99, 1, 1.01] * 440) * 0.05)+ cf = mouseX kr 100 20000 Exponential 0.2 -- center-frequency+ rq = mouseY kr 0.1 1 Linear 0.2 -- reciprocal of Q+in bLowPass i cf rq++-- bLowPass ; calculate coefficients and use sos (see also bLowPass4)+let i = mix (saw ar (mce [0.99, 1, 1.01] * 440) * 0.05)+ cf = mouseX kr 100 20000 Exponential 0.2+ rq = mouseY kr 0.1 1 Linear 0.2+ (a0, a1, a2, b1, b2) = Sound.Sc3.Common.Math.Filter.Beq.bLowPassCoef sampleRate cf rq+in sos i a0 a1 a2 b1 b2++-- bLowPass ; modulate center-frequency+bLowPass (whiteNoiseId 'α' ar) (xLine kr 24000 20 10 DoNothing) 1 * 0.05++-- bLowPass ; modulate reciprocal of Q+bLowPass (whiteNoiseId 'α' ar) 1200 (xLine kr 0.5 100 10 DoNothing) * 0.05
+ Help/Ugen/bLowPass4.help.hs view
@@ -0,0 +1,5 @@+-- bLowPass4+let i = mix (saw ar (mce [0.99, 1, 1.01] * 440) * 0.3)+ f = mouseX kr 100 20000 Exponential 0.2+ rq = mouseY kr 0.1 1 Linear 0.2+in bLowPass4 i f rq
+ Help/Ugen/bLowShelf.help.hs view
@@ -0,0 +1,21 @@+-- bLowShelf ; warning=feedback+let i = soundIn (mce2 0 1)+ freq = mouseX kr 40 6000 Exponential 0.2+ rs = 1+ db = mouseY kr 24 (-24) Linear 0.2+in bLowShelf i freq rs db * 0.5++-- bLowShelf ; warning=feedback+let i = soundIn (mce2 0 1)+ freq = mouseX kr 20 6000 Exponential 0.2+ rs = mouseY kr 0.1 1 Linear 0.2+ db = 6+in bLowShelf i freq rs db * 0.5++-- bLowShelf ; calculate coefficients and use sos ; warning=feedback+let i = soundIn (mce2 0 1)+ freq = mouseX kr 20 6000 Exponential 0.2+ rs = mouseY kr 0.1 1 Linear 0.2+ db = 6+ (a0, a1, a2, b1, b2) = Sound.Sc3.Common.Math.Filter.Beq.bLowShelfCoef sampleRate freq rs db+in sos i a0 a1 a2 b1 b2 * 0.5
+ Help/Ugen/bMoog.help.hs view
@@ -0,0 +1,19 @@+-- bMoog ; modes are: 0 = lowpass, 1 = highpass, 2 = bandpass+let md = control kr "mode" 0+ dup u = mce2 u u+ x = mouseX kr 20 12000 Exponential 0.2+ o = dup (lfSaw ar (mce2 (x * 0.99) (x * 1.01)) 0 * 0.1)+ cf = sinOsc kr (sinOsc kr 0.1 0) (1.5 * pi) * 1550 + 1800+ y = mouseY kr 1 0 Linear 0.2+ sig = X.bMoog o cf y md 0.95+in (combN sig 0.5 (mce2 0.4 0.35) 2 * 0.4) + (sig * 0.5)++-- bMoog ; event control+let f (c,g,x,y,z,o,rx,ry,_,_,_) =+ let md = constant c `modE` 3+ f0 = linExp x 0 1 20 12000+ sig = lfSaw ar (mce2 (f0 * 0.99) (f0 * 1.01)) 0 * ry * 0.4+ cf = sinOsc kr (sinOsc kr 0.1 0) (1.5 * pi) * rx * 1550 + 1800+ flt = X.bMoog sig cf y md 0.95+ in pan2 ((combN flt 0.5 (mce2 0.4 0.35) 2 * 0.4) + (flt * 0.5)) (o * 2 - 1) (lagUD g 0 3 * z)+in mix (voicer 16 f) * control kr "gain" 1
+ Help/Ugen/bPeakEQ.help.hs view
@@ -0,0 +1,40 @@+-- bPeakEQ+let i = pinkNoiseId 'α' ar * 0.1+ freq = mouseX kr 2200 18000 Exponential 0.2+ db = mouseY kr (-12) 12 Linear 0.2+in bPeakEQ i freq 0.8 db * 0.5++-- bPeakEQ+let i = pinkNoiseId 'α' ar * 0.1+ freq = mouseX kr 2200 18000 Exponential 0.2+ rq = mouseY kr 10 0.4 Linear 0.2+in bPeakEQ i freq rq 6 * 0.5++-- bPeakEQ ; calculate coefficients and use sos (see also bLowPass4)+let i = pinkNoiseId 'α' ar * 0.1+ freq = mouseX kr 2200 18000 Exponential 0.2+ rq = mouseY kr 10 0.4 Linear 0.2+ (a0, a1, a2, b1, b2) = Sound.Sc3.Common.Math.Filter.Beq.bPeakEqCoef sampleRate freq rq 6+in sos i a0 a1 a2 b1 b2 * 0.5++-- bPeakEQ ; parametric+let hf z = bPeakEQ+ z+ (control_m kr "hfFreq" 4000 (800,20000,"exp"))+ (control_m kr "hfRQ" 1 (0.01,2,"lin"))+ (control_m kr "hfGain" 0 (-15,15,"lin"))+ mf z = bPeakEQ+ z+ (control_m kr "mfFreq" 1000 (200,5000,"exp"))+ (control_m kr "mfRQ" 1 (0.01,2,"lin"))+ (control_m kr "mfGain" 0 (-15,15,"lin"))+ lf z = bPeakEQ+ z+ (control_m kr "lfFreq" 100 (20,500,"exp"))+ (control_m kr "lfRQ" 1 (0.01,2,"lin"))+ (control_m kr "lfGain" 0 (-15,15,"lin"))+ sig = pinkNoiseId 'α' ar * 0.1+in hf (mf (lf sig))++---- ; drawings+UI.ui_sc3_scope_freq (600,400) 0
+ Help/Ugen/balance2.help.hs view
@@ -0,0 +1,33 @@+-- balance2+let l = lfSaw ar 44 0+ r = pulse ar 33 0.5+ p = fSinOsc kr 0.5 0+in balance2 l r p 0.1++-- balance2+let [s0,s1] = mceChannels (sinOsc ar (mce2 440 550) 0)+ n = lfNoise0Id 'α' kr 4+in balance2 s0 s1 n 0.3++-- balance2+let s = sinOsc ar 440 0+ p = sinOsc kr 0.2 0+in balance2 s s p 1 * 0.2++-- balance2+let s = sinOsc ar 440 0+ p = sinOsc kr 0.2 0+in balance2 s s p 0.2++-- balance2+let s0 = sinOsc ar 440 0+ s1 = sinOsc ar 550 0+ x = mouseX kr (-1) 1 Linear 0.2+in balance2 s0 s1 x 0.2++-- balance2+let s = pinkNoiseId 'α' ar+ l = lpf s 500+ h = s - l+ n = lfNoise2Id 'β' kr 4+in balance2 l h n 0.1
+ Help/Ugen/beatTrack.help.hs view
@@ -0,0 +1,11 @@+-- beatTrack+let c = localBufId 'α' 1 1024+ i = soundIn 0+ x = mouseX kr (-1) 1 Linear 0.2+ [b, h, q, t] = mceChannels (beatTrack kr (fft' c i) x)+ f = mce [440, 660, 880]+ a = mce [0.4, 0.2, 0.1]+ s = mix (sinOsc ar f 0 * a * decay (mce [b, h, q]) 0.05)+in i + s++
+ Help/Ugen/bezier.help.hs view
@@ -0,0 +1,52 @@+-- bezier ; reference sine tone+sinOsc ar 440 0 * 0.1++-- bezier ; bezier approximation of sin function+X.bezier ar 100 0.0001 440 0 (mce [0,0,0.2,-1.3,0.3,-1.3,0.5,0,0.7,1.3,0.8,1.3,1,0]) * 0.1++-- bezier+let x = mouseX kr 40 4000 Exponential 0.2+in X.bezier ar 100 0.0001 x 0 (mce [0,0,0.2,-1.3,0.3,-1.3,0.5,0,0.7,1.3,0.8,1.3,1,0]) * 0.1++-- bezier+let x = mouseX kr 40 4000 Exponential 0.2+ y = mouseY kr 0.1 0.2 Linear 0.2+in X.bezier ar 100 0.0001 x 0 (mce [0,0,y,-1.3,0.3,-1.3,0.5,0,0.7,1.3,0.8,1.3,1,0]) * 0.1++-- bezier ; dynamic shifting of control points, oscillator+let rt = ar+ (f0,f1) = (200,205)+ f2 = 2+ wId z l r = range l r (lfdNoise3Id z rt f2)+ s = X.bezier rt 100 0.0001 (wId 'α' f0 f1) 0 (mce [0,0,wId 'β' 0.05 0.25,-1.3,wId 'γ' 0.25 0.45,-1.3+ ,0.5,0,wId 'δ' 0.55 0.75,1.3,wId 'ε' 0.75 0.95,1.3+ ,1,0])+in pan2 s (iRandId 'α' (-1) 1) 0.1++-- bezier ; dynamic shifting of control points, amplitude modulator+let rt = kr+ (f0,f1) = (0.15,16)+ f2 = 0.5+ wId z l r = range l r (lfdNoise3Id z rt f2)+ s = X.bezier rt 100 0.0001 (wId 'α' f0 f1) 0 (mce [0,0,wId 'β' 0.05 0.25,-1.3,wId 'γ' 0.25 0.45,-1.3+ ,0.5,0,wId 'δ' 0.55 0.75,1.3,wId 'ε' 0.75 0.95,1.3+ ,1,0])+in soundIn 0 * range 0.25 1 s++-- bezier ; event control+let f (_,g,_,y,z,o,rx,ry,p,px,_) =+ let w i l r = linLin i 0 1 l r+ freq = midiCps (p * 127 + leakDC px 0.995)+ s = X.bezier ar 20 0.004 freq 0 (mce [0,0,w y 0.05 0.25,-1.3,w rx 0.25 0.45,-1.3+ ,0.5,0,w ry 0.55 0.75,1.3,w o 0.75 0.95,1.3+ ,1,0])+ in pan2 s (o * 2 - 1) (z * lagUD g 0 (1 + y * 0.65))+in mix (voicer 16 f) * control kr "gain" 0.5++---- ; drawings+import Sound.Sc3.Plot {- hsc3-plot -}+let u = X.bezier ar 440 0 (mce [0,0,0.2,-1.3,0.3,-1.3,0.5,0,0.7,1.3,0.8,1.3,1,0]) * 0.1+plot_ugen_nrt (48000,64) 0.012 u+plot_ugen1 0.01 u++---- ; see hcg-minus:Data.CG.Minus.Bezier for rendering bezier curves as wavetable
+ Help/Ugen/blOsc.help.hs view
@@ -0,0 +1,18 @@+-- blOsc+let freq = randId 'α' 55 220+ width = randId 'β' 0 1+ waveform = iRandId 'γ' 0 2+in pan2 (X.blOsc ar freq width waveform) (randId 'δ' (-1) 1) (randId 'ε' 0.02 0.1)++-- blOsc ; k-rate (not implemented for width/waveform)+let tr = dustId 'α' kr 2+ freq = tRandId 'β' 55 220 tr+ width = tRandId 'γ' 0 1 tr+ waveform = tiRandId 'δ' 0 2 tr+in pan2 (X.blOsc ar freq width waveform) (tRandId 'ε' (-1) 1 tr) (tRandId 'ζ' 0.02 0.1 tr)++-- blOsc ; k-rate (not implemented for width/waveform)+let freq = control_m kr "freq" 110 (55,880,"exp")+ width = control_m kr "width" 0.5 (0,1,"lin")+ waveform = control_m kr "waveform" 0 (0,2,"lin")+in X.blOsc ar freq width waveform * 0.1
+ Help/Ugen/blip.help.hs view
@@ -0,0 +1,28 @@+-- blip+blip ar 440 200 * 0.1++-- blip ; modulate frequency+let f = xLine kr 20000 200 6 RemoveSynth in blip ar f 100 * 0.1++-- blip ; modulate number of harmonics+let nh = line kr 1 100 20 RemoveSynth in blip ar 200 nh * 0.2++-- blip ; self-modulation at control rate+let fr = blip kr 0.25 3 * 300 + 500+ nh = blip kr 0.15 2 * 20 + 21+in blip ar fr nh * 0.2++-- blip ; event control+let f (_,g,x,y,z,o,_,_,_,_,_) = pan2 (blip ar (midiCps (x * 13 + 48)) (y * 10 + 1)) (o * 2 - 1) (g * z)+in mix (voicer 16 f) * control kr "gain" 0.5++-- blip ; event control (p)+let f (_,g,_,_,z,o,rx,_,p,px,_) =+ let f0 = midiCps (p * 127 + px)+ nh = max 0 rx * 10 + 1+ in pan2 (blip ar f0 nh) (o * 2 - 1) (g * z)+in mix (voicer 16 f) * control kr "gain" 0.5++---- ; drawings+Sound.Sc3.Plot.plot_ugen1 0.1 (blip ar 1000 20)+Sound.Sc3.Plot.FFT.plot_ugen_fft1 0.1 (blip ar 1000 20)
+ Help/Ugen/blitB3.help.hs view
@@ -0,0 +1,13 @@+-- blitB3+X.blitB3 ar (xLine kr 10000 20 10 DoNothing) * 0.2++-- blitB3 ; spot the aliasing+impulse ar (xLine kr 10000 20 10 DoNothing) 0 * 0.2++-- blitB3 ; sawtooth+let x = mouseX kr 20 1000 Exponential 0.2+in leakDC (integrator (X.blitB3 ar x * 0.2) 0.99) 0.995++-- blitB3 ; sawtooth, super-saw, can integrate, accumulates DC+let x = mouseX kr 1 4 Linear 0.2+in mix (leakDC (integrator (X.blitB3 ar (x * mce [220,221,223,224]) * 0.125) 0.99) 0.995)
+ Help/Ugen/blitB3Saw.help.hs view
@@ -0,0 +1,11 @@+-- blitB3Saw+let f = xLine kr 1000 20 10 DoNothing+in X.blitB3Saw ar f 0.99 * 0.1++-- blitB3Saw ; aliasing suddenly appears for very high frequencies+let f = mouseX kr 10 10000 Exponential 0.2+ c = mouseY kr 0.01 0.99 Linear 0.2+in X.blitB3Saw ar f c * 0.1++-- blitB3Saw ; comparison+mce2 (saw ar 20) (X.blitB3Saw ar 20 0.99) * 0.1
+ Help/Ugen/blitB3Square.help.hs view
@@ -0,0 +1,19 @@+-- blitB3Square+let x = mouseX kr 20 400 Exponential 0.2+in X.blitB3Square ar x 0.99 * 0.1++-- blitB3Square+let f = xLine kr 1000 20 10 DoNothing+in X.blitB3Square ar f 0.99 * 0.1++-- blitB3Square ; aliasing at high frequencies+let f = mouseX kr 20 10000 Exponential 0.2+ c = mouseY kr 0.001 0.999 Linear 0.2+in X.blitB3Square ar f c * 0.1++-- blitB3Square ; consider difference in CPU usage (excessive wire use,-w 1024)+let sqr_osc rt freq = X.blitB3Square rt freq 0.99 -- pulse rt f 0.5+ f z = midiCps (range 36 72 (lfNoise0Id z kr (randId z 2 3)))+ l z = randId z (-1) 1+ o z = pan2 (sqr_osc ar (f z) * 0.1) (l z) 0.1+in sum (map o [0::Int .. 99])
+ Help/Ugen/blitB3Tri.help.hs view
@@ -0,0 +1,27 @@+-- blitB3Tri+X.blitB3Tri ar (xLine kr 1000 20 10 DoNothing) 0.99 0.99 * 0.1++-- blitB3Tri ; aliasing at higher frequencies (over 5000Hz or so) is very beautiful in point scope+let x = mouseX kr 20 8000 Exponential 0.2+ y = mouseY kr 0.001 0.99 Linear 0.2+in X.blitB3Tri ar x 0.99 y * 0.1++-- blitB3Tri ; aliasing at higher frequencies (over 5000Hz or so) is very beautiful in point scope+let x = mouseX kr 20 8000 Exponential 0.2+ y = mouseY kr 0.001 0.99 Linear 0.2+ z = X.blitB3Tri ar x 0.99 y * 0.1+in mce2 z (delayN z 0.2 (sampleDur * control_m kr "sampleDelay" 12 (0,64,"lin")))++-- c.f. lfTri ; more efficient, some aliasing from 3000hz ; less harmonics for lower fundamentals+let x = mouseX kr 20 8000 Exponential 0.2+in lfTri ar x 0 * 0.1++-- blitB3Tri ; event control+let f (_,g,x,y,z,o,rx,ry,_,_,_) =+ let freq = midiCps (x * 12 + 48)+ in pan2 (X.blitB3Tri ar freq (1 - (rx * 0.05)) y) (o * 2 - 1) (z * g)+in mix (voicer 16 f) * control kr "gain" 0.25++----- ; drawings+UI.ui_sc3_scope 2 0 (2 ^ 14) 0 "audio" 2+UI.ui_scope_rju 512 100.0 ("embed",9) 2 (512,512) 4.0
+ Help/Ugen/blockSize.help.hs view
@@ -0,0 +1,5 @@+-- blockSize ; default block size is 64 samples+sinOsc ar (mce2 (blockSize * 3) (64 * 3 + 1)) 0 * 0.1++-- blockSize+sinOsc ar (mce2 (blockSize * 3) ((controlDur * sampleRate * 3) + 1)) 0 * 0.1
+ Help/Ugen/bpf.help.hs view
@@ -0,0 +1,26 @@+-- bpf+let f = fSinOsc kr (xLine kr 0.7 300 20 RemoveSynth) 0 * 3600 + 4000+in bpf (saw ar 200 * 0.5) f 0.3++-- bpf+let x = mouseX kr 100 10000 Exponential 0.2+in bpf (saw ar 200 * 0.5) x 0.3++-- bpf+let n = whiteNoiseId 'α' ar+ x = mouseX kr 220 440 Exponential 0.1+ y = mouseY kr 0.01 0.2 Linear 0.1+in bpf n (mce [x, 550 - x]) y++-- bpf ; of control signals+let vib = bpf (pinkNoiseId 'α' kr) (mouseX kr 1 100 Exponential 0.2) 0.3 * 10+in sinOsc ar (vib * 200 + 600) 0 * 0.1++-- bpf ; ln 2021-04-11 https://lukasnowok.github.io/spectrology/+let n = bpf (whiteNoiseId 'α' ar) 10000 (xLine ar 2 0.002 20 DoNothing)+ o = sinOsc ar 10000 0 * xLine ar 0.001 0.3 20 DoNothing+in (n + o) * 0.1++---- ; drawings+Ui.ui_baudline 4096 50 "linear" 2+Sound.Sc3.Plot.Fft.plot_ugen_fft1 0.05 (bpf (whiteNoiseId 'α' ar) 440 0.01)
+ Help/Ugen/bpz2.help.hs view
@@ -0,0 +1,2 @@+-- bpz2+let n = whiteNoiseId 'α' ar in bpz2 (n * 0.1)
+ Help/Ugen/brf.help.hs view
@@ -0,0 +1,5 @@+-- brf+let i = saw ar 200 * 0.1+ freq = fSinOsc kr (xLine kr 0.7 300 20 RemoveSynth) 0 * 3800 + 4000+ rq = 0.3+in brf i freq rq
+ Help/Ugen/brownNoise.help.hs view
@@ -0,0 +1,11 @@+-- brownNoise+brownNoiseId 'α' ar * 0.1++-- brownNoise ; kr rate noise as frequency control+let n = brownNoiseId 'α' kr+in sinOsc ar (linExp n (-1) 1 64 9600) 0 * 0.1++---- ; drawings+Sound.Sc3.Plot.plot_ugen1 0.1 (brownNoiseId 'γ' ar)+Sound.Sc3.Plot.FFT.plot_ugen_fft1 0.1 (brownNoiseId 'γ' ar)+UI.ui_sc3_scope_freq (600,400) 0
+ Help/Ugen/brz2.help.hs view
@@ -0,0 +1,4 @@+-- brz2+let n = whiteNoiseId 'α' ar * 0.05+ x = mouseX kr (-1) 1 Linear 0.1+in xFade2 n (brz2 n) x 1
+ Help/Ugen/bufAllpassC.help.hs view
@@ -0,0 +1,6 @@+-- bufAllpassC ; filtered decaying noise bursts+let b = localBufId 'α' 1 44100+ d = dustId 'β' ar 1+ n = whiteNoiseId 'γ' ar+ x = decay d 0.2 * n * 0.25+in bufAllpassC b x 0.25 6
+ Help/Ugen/bufAllpassL.help.hs view
@@ -0,0 +1,6 @@+-- bufAllpassL ; filtered decaying noise bursts+let b = localBufId 'α' 1 44100+ d = dustId 'β' ar 1+ n = whiteNoiseId 'γ' ar+ x = decay d 0.2 * n * 0.25+in bufAllpassL b x 0.25 6
+ Help/Ugen/bufAllpassN.help.hs view
@@ -0,0 +1,6 @@+-- bufAllpassN ; filtered decaying noise bursts+let b = localBufId 'α' 1 44100+ d = dustId 'β' ar 1+ n = whiteNoiseId 'γ' ar+ x = decay d 0.2 * n * 0.25+in bufAllpassN b x 0.25 6
+ Help/Ugen/bufChannels.help.hs view
+ Help/Ugen/bufCombC.help.hs view
@@ -0,0 +1,19 @@+-- bufCombC ; comb filter as resonator ; resonant fundamental is reciprocal of the delay time+let b = localBufId 'α' 1 44100+ n = whiteNoiseId 'β' ar+ dt = xLine kr 0.0001 0.01 20 RemoveSynth+in bufCombC b (n * 0.1) dt 0.2 * 0.05++-- bufCombC ; with negative feedback+let b = localBufId 'α' 1 44100+ n = whiteNoiseId 'β' ar+ dt = xLine kr 0.0001 0.01 20 RemoveSynth+in bufCombC b (n * 0.1) dt (-0.2) * 0.05++-- bufCombC ; used as an echo (filtered decaying noise bursts)+let b = localBufId 'α' 1 44100+ d = dustId 'β' ar 1+ n = whiteNoiseId 'γ' ar+ i = decay (d * 0.5) 0.2 * n+in bufCombC b i 0.2 3+
+ Help/Ugen/bufCombL.help.hs view
@@ -0,0 +1,6 @@+-- bufCombL ; comb filter as resonator ; resonant fundamental is reciprocal of the delay time+let b = localBufId 'α' 1 44100+ n = whiteNoiseId 'β' ar+ dt = xLine kr 0.0001 0.01 20 RemoveSynth+in bufCombL b (n * 0.1) dt 0.2 * 0.05+
+ Help/Ugen/bufCombN.help.hs view
@@ -0,0 +1,6 @@+-- bufCombN ; comb filter as resonator ; resonant fundamental is reciprocal of the delay time+let b = localBufId 'α' 1 44100+ n = whiteNoiseId 'β' ar+ dt = xLine kr 0.0001 0.01 20 RemoveSynth+in bufCombN b (n * 0.1) dt 0.2 * 0.05+
+ Help/Ugen/bufDelayC.help.hs view
@@ -0,0 +1,20 @@+-- bufDelayC ; dust randomly triggers decay to create an envelope+let b = localBufId 'α' 1 44100+ t = dustId 'β' ar 1+ n = whiteNoiseId 'γ' ar+ d = decay t 0.5 * n * 0.2+in bufDelayC b d 0.2 + d++-- bufDelayC ; mouse control for delay time+let b = localBufId 'α' 1 44100+ t = dustId 'β' ar 1+ n = whiteNoiseId 'γ' ar+ d = decay t 0.3 * n * 0.2+ x = mouseX kr 0.0 0.2 Linear 0.1+in d + bufDelayC b d x++-- bufDelayC+let b = localBufId 'α' 1 44100+ o = sinOsc ar (lfNoise2Id 'β' kr 0.5 * 100 + 110) 0 * 0.05+ d = abs (lfNoise2Id 'γ' kr 0.25)+in mce2 o (bufDelayC b o d)
+ Help/Ugen/bufDelayL.help.hs view
@@ -0,0 +1,5 @@+-- bufDelayL+let b = localBufId 'α' 1 44100+ o = sinOsc ar (lfNoise2Id 'β' kr 0.5 * 100 + 110) 0 * 0.05+ d = abs (lfNoise2Id 'γ' kr 0.25)+in mce2 o (bufDelayL b o d)
+ Help/Ugen/bufDelayN.help.hs view
@@ -0,0 +1,5 @@+-- bufDelayN+let b = localBufId 'α' 1 44100+ o = sinOsc ar (lfNoise2Id 'β' kr 0.5 * 100 + 110) 0 * 0.05+ d = abs (lfNoise2Id 'γ' kr 0.25)+in mce2 o (bufDelayN b o d)
+ Help/Ugen/bufDur.help.hs view
@@ -0,0 +1,14 @@+-- bufDur ; requires=buf ; read without loop, trigger reset based on buffer duration+let (b, nc) = (control kr "buf" 100, 2)+ t = impulse ar (recip (bufDur kr b)) 0+ p = sweep ar t (bufSampleRate kr b)+in bufRd nc ar b p NoLoop LinearInterpolation * 0.1++-- bufDur ; requires=buf ; bufDur = bufFrames / bufSampleRate+let (b, nc) = (control kr "buf" 100, 2)+ t = impulse ar (bufSampleRate kr b / bufFrames kr b) 0+ p = sweep ar t (bufSampleRate kr b)+in bufRd nc ar b p NoLoop LinearInterpolation * 0.1++---- ; buffer setup+withSc3 (async (b_allocRead 0 (sfResolve "pf-c5.aif") 0 0))
+ Help/Ugen/bufFrames.help.hs view
@@ -0,0 +1,13 @@+-- bufFrames ; requires=buf ; read without loop, trigger reset based on buffer duration+let (b, nc) = (control kr "buf" 100, 2)+ p = phasor ar 0 (bufRateScale kr b) 0 (bufFrames kr b) 0+in bufRdL nc ar b p NoLoop * 0.1++-- bufFrames ; requires=buf ; mouse location drags play head+let (b, nc) = (control kr "buf" 100, 2)+ r = mce [0.05, 0.075 .. 0.15]+ p = k2a (mouseX kr 0 (bufFrames kr b) Linear r)+in mix (bufRdL nc ar b p NoLoop) * 0.1++---- ; buffer setup+withSc3 (async (b_allocRead 0 (sfResolve "pf-c5.aif") 0 0))
+ Help/Ugen/bufGrain.help.hs view
@@ -0,0 +1,9 @@+-- bufGrain ; requires=buf+let b = control kr "buf" 100+ x = mouseX kr 0.5 8 Linear 0.2+ y = mouseY kr 0.05 0.2 Linear 0.2+ e = envGen kr 1 1 0 1 RemoveSynth (envelope [0, 1, 0] [3, 2] [EnvSin, EnvSin])+in X.bufGrain ar (impulse kr 10 0) y b x e 2++---- ; load buffer+withSc3 (async (b_allocRead 0 (sfResolve "instr/celeste/long/13-C4-long.wav") 0 0))
+ Help/Ugen/bufRateScale.help.hs view
@@ -0,0 +1,23 @@+-- bufRateScale ; requires=buf ; read without loop, trigger reset based on buffer duration+let b = control kr "buf" 100+ r = bufRateScale kr b+ p = phasor ar 0 r 0 (bufFrames kr b) 0+in bufRdL 1 ar b p NoLoop * 0.5++-- bufRateScale ; requires=buf ; read buffer at ~ 3/4 reported sample rate+let b = control kr "buf" 100+ r = midiRatio (-5) * bufRateScale kr b+ p = phasor ar 0 r 0 (bufFrames kr b) 0+in bufRdL 1 ar b p NoLoop * 0.5++-- bufRateScale ; requires=buf ; bufRateScale = bufSampleRate / sampleRate+let b = control kr "buf" 100+ r = midiRatio (-5) * (bufSampleRate kr b / sampleRate)+ p = phasor ar 0 r 0 (bufFrames kr b) 0+in bufRdL 1 ar b p NoLoop * 0.5++-- bufRateScale ; requires=buf ; bufRateScale = bufSampleRate * sampleDur+let b = control kr "buf" 100+ r = midiRatio (-5) * (bufSampleRate kr b * sampleDur)+ p = phasor ar 0 r 0 (bufFrames kr b) 0+in bufRdL 1 ar b p NoLoop * 0.5
+ Help/Ugen/bufRd.help.hs view
@@ -0,0 +1,39 @@+-- bufRd ; requires=buf ; phasor as phase input ; constructors bufRd{N|L|C} preset interpolation type+let (buf, nc) = (control kr "buf" 100, 2)+ tr = impulse ar (recip (bufDur kr buf)) 0+ ph = phasor ar tr (bufRateScale kr buf) 0 (bufFrames kr buf) 0+in bufRdL nc ar buf ph NoLoop++-- bufRd ; requires=buf ; audio rate sine oscillator as phase input+let (buf, nc) = (control kr "buf" 100, 2)+ phase = sinOsc ar 0.1 0 * bufFrames kr buf * bufRateScale kr buf+in bufRdL nc ar buf phase Loop++-- bufRd ; requires=buf ; mouse control+let (buf, nc) = (control kr "buf" 100, 2)+ x = mouseX kr (mce [5, 10]) 100 Linear 0.1+ n = lfNoise1Id 'α' ar x+in mix (bufRdL nc ar buf (n * bufFrames kr buf * bufRateScale kr buf) Loop)++-- bufRd ; fixed frequency wavetable oscillator ; c.f. osc+let (buf, nc) = (asLocalBuf (Gen.sine1_nrm 256 [1, 1/2, 1/3, 1/4, 1/5]), 1)+ x = mouseX kr 220 440 Exponential 0.2+ phase = linLin (lfSaw ar x 0) (-1) 1 0 1 * bufFrames kr buf+in bufRdC nc ar buf phase Loop * 0.1++-- bufRd ; requires=buf ; fixed frequency wavetable oscillator ; c.f. osc+let (buf, nc) = (control kr "tbl" 0, 1)+ x = mouseX kr 220 440 Exponential 0.2+ phase = linLin (lfSaw ar x 0) (-1) 1 0 1 * bufFrames kr buf+in bufRdC nc ar buf phase Loop * 0.1++---- ; setup ; nc=1+withSc3 (async (b_allocRead 0 (sfResolve "metal.wav") 0 0))++---- ; setup ; nc=2+withSc3 (async (b_allocRead 0 (sfResolve "pf-c5.aif") 0 0))+withSc3 (async (b_allocRead 0 (sfResolve "instr/bosendorfer/008/C5.aif") 0 0))+withSc3 (async (b_allocRead 0 (sfResolve "instr/bosendorfer/032/C4.aif") 0 0))++---- ; setup ; nc=1 gen=sine1 ; allocate and generate (non-wavetable) buffer+withSc3 (mapM_ maybe_async [b_alloc 0 256 1,b_gen_sine1 0 [Normalise, Clear] [1, 1/2, 1/3, 1/4, 1/5]])
+ Help/Ugen/bufSampleRate.help.hs view
@@ -0,0 +1,7 @@+-- bufSampleRate ; requires=buf ; frequency as fraction of buffer sample-rate (ie. 48000 / 100 == 480)+let b = control kr "buf" 100+ f = mce [bufSampleRate kr b * 0.01, 440]+in sinOsc ar f 0 * 0.1++---- ; buffer setup+withSc3 (async (b_allocRead 0 (sfResolve "pf-c5.aif") 0 0))
+ Help/Ugen/bufWr.help.hs view
@@ -0,0 +1,19 @@+-- bufWr+let b = localBufId 'α' 1 (sampleRate * 2)+ o = sinOsc ar (lfNoise1Id 'β' kr 2 * 300 + 400) 0 * 0.1+ ph z = phasor ar 0 (bufRateScale kr b * z) 0 (bufFrames kr b) 0+ w = bufWr b (ph (mouseX kr 0.25 1 Linear 0.2)) Loop o+ r = bufRdL 1 ar b (ph (mouseY kr 0.25 16 Linear 0.2)) Loop+in mrg2 r w++-- bufWr+let wr_rt = control kr "wr-rate" 1+ rd_rt = control kr "rd-rate" 1+ b = localBufId 'α' 1 (sampleRate * 2)+ o = sinOsc ar (lfNoise1Id 'β' kr 2 * 300 + 400) 0 * 0.1+ w = bufWr b (phasor ar 0 (bufRateScale kr b * wr_rt) 0 (bufFrames kr b) 0) Loop o+in bufRdL 1 ar b (phasor ar 0 (bufRateScale kr b * rd_rt) 0 (bufFrames kr b) 0) Loop++---- ; set read & write rates independently+withSc3 (Sound.OSC.sendMessage (n_set1 1 "wr-rate" 0.5))+withSc3 (Sound.OSC.sendMessage (n_set1 1 "rd-rate" 13.0))
+ Help/Ugen/cOsc.help.hs view
@@ -0,0 +1,29 @@+-- cOsc ; fixed beat frequency+let tbl = asLocalBuf (Gen.sine1Tbl 256 [1, 1/2, 1/3, 1/4, 1/5, 1/6, 1/7, 1/8, 1/9, 1/10])+in cOsc ar tbl 200 0.7 * 0.1++-- cOsc ; modulate beat frequency with mouseX+let tbl = asLocalBuf (Gen.sine1Tbl 256 [1, 1/2, 1/3, 1/4, 1/5, 1/6, 1/7, 1/8, 1/9, 1/10])+in cOsc ar tbl 200 (mouseX kr 0 4 Linear 0.2) * 0.1++-- cOsc ; compare with plain osc+let tbl = asLocalBuf (Gen.sine1Tbl 256 [1, 1/2, 1/3, 1/4, 1/5, 1/6, 1/7, 1/8, 1/9, 1/10])+ f g = g ar tbl 200 (mouseX kr 0 4 Linear 0.2)+in xFade2 (f cOsc) (f osc) (lfTri kr 0.1 0) 0.1++-- cOsc ; fixed beat frequency ; requires=tbl+cOsc ar (control kr "tbl" 0) 200 0.7 * 0.1++-- cOsc ; modulate beat frequency with mouseX ; requires=tbl+cOsc ar (control kr "tbl" 0) 200 (mouseX kr 0 4 Linear 0.2) * 0.1++-- cOsc ; compare with plain osc ; requires=tbl+let f g = g ar (control kr "tbl" 0) 200 (mouseX kr 0 4 Linear 0.2)+in xFade2 (f cOsc) (f osc) (lfTri kr 0.1 0) 0.1++---- ; setup ; allocate and fill wavetable+withSc3 (mapM_ maybe_async [b_alloc 0 512 1,b_gen_sine1 0 [Normalise,Wavetable,Clear] [1,1/2,1/3,1/4,1/5,1/6,1/7,1/8,1/9,1/10]])++---- ; drawings+withSc3 (mapM_ maybe_async [b_alloc 1 512 1,b_gen_sine1 1 [Normalise,Wavetable,Clear] [1]])+Sound.Sc3.Plot.plot_ugen1 0.1 (cOsc ar 1 100 5)
+ Help/Ugen/changed.help.hs view
@@ -0,0 +1,15 @@+-- changed ; simple composition of hpz1 and greater_than (pseudo ugen)+let s = lfNoise0Id 'α' kr 2+ c = changed s 0+ c' = decay2 c 0.01 0.5+in sinOsc ar (440 + mce2 s c' * 440) 0 * 0.1++-- changed ; sinOsc is constantly changing+let s = sinOsc ar 440 0+ c = changed s 0+in s * c * 0.2++-- changed ; fixed number of sample impulses ; https://fredrikolofsson.com/f0blog/impulse-train/+let dur = 1+ num = 8+in changed (min (ceil (sweep ar 0 (num / dur))) num) 0
+ Help/Ugen/checkBadValues.help.hs view
@@ -0,0 +1,4 @@+-- checkBadValues ; when frequency is nan set gain to zero+let freq = tChoose (impulse kr 1 0) (mce2 440 (0 / 0))+ isNormal = checkBadValues freq 0 0 `equal_to` 0+in sinOsc ar freq 0 * 0.1 * isNormal
+ Help/Ugen/chen.help.hs view
@@ -0,0 +1,21 @@+-- chen+let amp = 0.5+ chen_speed_max = 0.01+ chen_sig = X.chen ar (lfCub kr 0.1 0 `in_range` (0.001,chen_speed_max)) 0.5 0.3 0.28+ minfreq = 20+ maxfreq = 2500+ sig = sinOsc ar (linExp chen_sig 0 1 minfreq maxfreq) 0+in splay sig (mceChannel 0 chen_sig) amp 0 True++-- chen+let tr = control kr "scramble" 1+ amp = 0.5+ chen_speed_max = 0.009+ chen_sig = let s = lfCub kr (lfNoise2Id 'α' kr (chen_speed_max * 2) * 0.1) 0+ b = lfCub kr 0.35 0 `in_range` (0,1)+ in X.chen ar (s `in_range` (0.001,chen_speed_max)) 0.192 b 0.22+ minfreq = 40+ maxfreq = 500+ sig1 = varSaw ar (linExp chen_sig 0 1 minfreq maxfreq) 0 (lag (mceReverse chen_sig) 0.1)+ sig2 = freqShift sig1 (lag3 (X.tScrambleId 'β' tr chen_sig) 0.1) 0 * 0.5+in splay (sig1 + sig2) (sum (mceChannels chen_sig) / 4) amp 0 True
+ Help/Ugen/choose.help.hs view
@@ -0,0 +1,3 @@+-- choose ; a composite of iRand and select+let f = mceFillId 'α' 2 (\z _ -> chooseId z (mce [440,460 .. 880]))+in sinOsc ar f 0 * 0.1
+ Help/Ugen/chromagram.help.hs view
@@ -0,0 +1,5 @@+-- chromagram+let sig = soundIn 0+ chn = fft' (localBufId 'α' 1 2048) sig+ chroma = X.chromagram kr chn 2048 12 (midiCps 24) 8 0 0.9 2 0+in splay (sinOsc ar (mce (map midiCps [60 .. 71])) 0 * lag chroma 0.1 * 0.2) 1 1 0 True
+ Help/Ugen/circleRamp.help.hs view
@@ -0,0 +1,9 @@+-- circleRamp ; fast x-axis movements from edges will wrap outside (no discontinuity)+let x = mouseX kr 0 2 Linear 0.2+ c = X.circleRamp kr x 0.1 (-1) 1+in pan2 (sinOsc ar 440 0) c 0.1++-- circleRamp ; editing lagTime to alter path taken+let p = lfPulse kr (line kr 20 0.1 10 DoNothing) 0 0.75 + 0.25+ c = X.circleRamp kr p (mouseX kr 0.01 0.1 Linear 0.1) (-1) 1+in pan2 (sinOsc ar 440 0) c 0.1
+ Help/Ugen/clearBuf.help.hs view
@@ -0,0 +1,14 @@+-- clearBuf+let buf = clearBuf (localBuf 1 2048)+ x = mouseX kr 1 2 Linear 0.2+ r = playBuf 1 ar buf x 1 0 Loop DoNothing * 0.1+ wr p i = bufWr buf (p `in_range` (0,bufFrames kr buf)) Loop i+in mrg2 r (wr (lfNoise0 ar 530) (whiteNoise ar))++-- clearBuf ; id+let buf = clearBuf (localBufId 'α' 1 2048)+ x = mouseX kr 1 2 Linear 0.2+ r = playBuf 1 ar buf x 1 0 Loop DoNothing * 0.1+ wr p i = bufWr buf (p `in_range` (0,bufFrames kr buf)) Loop i+in mrg2 r (wr (lfNoise0Id 'β' ar 530) (whiteNoiseId 'γ' ar))+
+ Help/Ugen/clip.help.hs view
@@ -0,0 +1,2 @@+-- clip+clip (sinOsc ar 440 0 * 0.4) (-0.25) 0.25
+ Help/Ugen/clip2.help.hs view
@@ -0,0 +1,8 @@+-- clip2 ; clipping distortion+clip2 (fSinOsc ar 400 0) 0.01++-- clip2+clip2 (fSinOsc ar 400 0) (line kr 0 1 8 RemoveSynth) * 0.1++---- ; drawings+Sound.Sc3.Plot.plot_fn_r1_ln (\x -> clip2 x 1) (-2,2)
+ Help/Ugen/clipNoise.help.hs view
@@ -0,0 +1,5 @@+-- clipNoise+clipNoiseId 'α' ar * 0.1++---- ; drawings+Sound.Sc3.Plot.plot_ugen1 0.01 (clipNoiseId 'α' ar)
+ Help/Ugen/coinGate.help.hs view
@@ -0,0 +1,4 @@+-- coinGate+let g = coinGateId 'α' 0.2 (impulse kr 10 0)+ f = tRandId 'β' 300.0 400.0 g+in sinOsc ar f 0 * 0.1
+ Help/Ugen/combC.help.hs view
@@ -0,0 +1,15 @@+-- combC ; c.f. combN+let n = whiteNoiseId 'α' ar * 0.02+ dt = xLine kr 0.0001 0.01 20 RemoveSynth+in combC n 0.01 dt 0.2++-- combC ; with negative feedback+let n = whiteNoiseId 'α' ar * 0.02+ dt = xLine kr 0.0001 0.01 20 RemoveSynth+in combC n 0.01 dt (-0.2)++-- combC ; as an echo+let d = dustId 'α' ar 1+ n = whiteNoiseId 'β' ar * 0.1+ i = decay d 0.2 * n+in combC i 0.2 0.2 3
+ Help/Ugen/combL.help.hs view
@@ -0,0 +1,5 @@+-- combL ; c.f. combN+let n = whiteNoiseId 'α' ar * 0.02+ dt = xLine kr 0.0001 0.01 20 RemoveSynth+in combL n 0.01 dt 0.2+
+ Help/Ugen/combN.help.hs view
@@ -0,0 +1,4 @@+-- combN ; comb filter as resonator, the resonant fundamental is equal to reciprocal of the delay time+let n = whiteNoiseId 'α' ar * 0.02+ dt = xLine kr 0.0001 0.01 20 RemoveSynth+in combN n 0.01 dt 0.2
+ Help/Ugen/compander.help.hs view
@@ -0,0 +1,24 @@+-- compander ; noise gate (no hold, no hysteresis) ; x = threshold+let z = mix (pulse ar (mce2 80 81) 0.3) * decay2 (impulse ar 8 0 * lfSaw kr 0.3 0 * 0.3) 0.001 0.3+ x = mouseX kr 0.01 0.15 Linear 0.1+in mce [z, compander z z x 10 1 0.002 0.15]++-- compander ; compressor+let z = mix (pulse ar (mce2 80 81) 0.3) * decay2 (impulse ar 8 0 * lfSaw kr 0.3 0 * 0.3) 0.001 0.3+ x = mouseX kr 0.01 1 Linear 0.1+in mce [z, compander z z x 1 (1/3) 0.01 0.01]++-- compander ; expander+let z = mix (pulse ar (mce2 80 81) 0.3) * decay2 (impulse ar 8 0 * lfSaw kr 0.3 0 * 0.3) 0.001 0.3+ x = mouseX kr 0.01 1 Linear 0.1+in mce [z, compander z z x 1 3 0.01 0.1]++-- compander ; limiter+let z = mix (pulse ar (mce2 80 81) 0.3) * decay2 (impulse ar 8 0 * lfSaw kr 0.3 0 * 0.3) 0.001 0.3+ x = mouseX kr 0.01 1 Linear 0.1+in mce [z, compander z z x 1 (1/10) 0.01 0.01]++-- compander ; sustainer+let z = mix (pulse ar (mce2 80 81) 0.3) * decay2 (impulse ar 8 0 * lfSaw kr 0.3 0 * 0.3) 0.001 0.3+ x = mouseX kr 0.01 0.15 Linear 0.1+in mce [z, compander z z x (1/3) 1.0 0.01 0.05]
+ Help/Ugen/complexRes.help.hs view
@@ -0,0 +1,5 @@+-- complexRes+let s = pulse ar 0.1 0.001 * 0.1+ fr = 50 + 5000 * sinOsc ar 50 0+ dt = 0.5+in X.complexRes s fr dt
+ Help/Ugen/concat.help.hs view
@@ -0,0 +1,14 @@+-- concat ; requires=buf ; granulator+let (b, nc) = (control kr "buf" 100, 2)+ y0 = mouseY kr 0.01 1 Linear 0.2+ y1 = mouseY kr b 100 Linear 0.2+ n = lfNoise0Id 'α' kr y0 * 3 + 4.5+ k = saw ar (sinOsc kr n 0 * 10 + y1)+ i = playBuf nc ar b (bufRateScale kr b) 0 0 Loop DoNothing+ x0 = mouseX kr 0.01 0.1 Linear 0.2+ y2 = mouseY kr 0 0.1 Linear 0.2+ c = X.concat ar k i 2 2 2 x0 0 y2 1 0.5 0 0+in pan2 c 0 1++---- ; buffer setup+withSc3 (async (b_allocRead 0 (sfResolve "pf-c5.aif") 0 0))
+ Help/Ugen/control.hs view
@@ -0,0 +1,44 @@+-- control+out 0 (sinOsc ar (control kr "freq" 440) 0 * 0.1)++-- control+sinOsc ar (control kr "freq" 440) 0 * control kr "amp" 0.1++-- control ; ir and kr and tr controls ; setting amp also triggers an envelope+let phase1 = control ir "phase1" 0+ phase2 = control ir "phase2" (pi / 4)+ freq1 = control kr "freq1" 450+ freq2 = control kr "freq2" 900+ amp1 = trigControl "amp1" 0+ amp2 = trigControl "amp2" 0+ env = decay2 (impulse kr 1 0 * 0.1 + mce2 amp1 amp2) 0.01 0.2+in sinOsc ar (mce2 freq1 freq2) (mce2 phase1 phase2) * env++-- control ; constructor setting index sequence+let [f,a] = control_set [control kr "freq" 440+ ,control kr "amp" 0.1]+in sinOsc ar f 0 * a++-- control ; contructor with control index input ; this will fail if n /= 1 (ie. 0 or 2)+let n = 1+ f = control_f64 kr (Just 0) "freq" 440+ a = control_f64 kr (Just n) "amp" 0.1+ p = control_f64 kr Nothing "phase" 0+in sinOsc ar f p * a++---- ; set frequency and gate controls+withSc3 (sendMessage (n_set1 1 "freq" 2200))+withSc3 (sendMessage (n_set1 1 "gate" 1))++---- ; command list ui to send messages to set oscillator frequency+UI.ui_scsynth_command_list (map (\x -> n_set 1 [("freq1",55 * (x ** 2)),("amp1",0.1 * (1 / x))]) [1 .. 7])++---- ; control ; printing+ugen_dump_ugens (out 0 (sinOsc ar (control kr "freq" 440) 0 * 0.1))++---- ; control ; encoding+import qualified Data.ByteString.Lazy as L+L.unpack (synthdefData (Synthdef "LocalControls" (out 0 (sinOsc ar (control kr "freq" 440) 0 * 0.1))))++-- ; control ; printing+putStrLn $ synthstat (out 0 (sinOsc ar (control kr "freq" 440) 0 * 0.1))
+ Help/Ugen/controlDur.help.hs view
@@ -0,0 +1,5 @@+-- controlDur ; default block size = 64, default sample rate = 48000+sinOsc ar (mce2 (recip controlDur) (controlRate + 1)) 0 * 0.1++-- controlDur+sinOsc ar (mce2 (recip controlDur) (recip (blockSize / sampleRate) + 1)) 0 * 0.1
+ Help/Ugen/controlRate.help.hs view
@@ -0,0 +1,3 @@+-- controlRate ; play a sine tone at control rate, the reciprocal of controlDur+let f = mce2 controlRate (recip controlDur)+in sinOsc ar f 0 * 0.1
+ Help/Ugen/convolution.help.hs view
@@ -0,0 +1,14 @@+-- convolution ; warning=feedback+let k = pinkNoise ar * 0.1+ i = soundIn 0+in convolution i k 2048++-- convolution ; warning=feedback+let k = mix (lfSaw ar (mce [300,500,800,1000] * mouseX kr 1.0 2.0 Linear 0.2) 0 * 0.1)+ i = soundIn 0+in convolution i k 1024 * 0.5++-- convolution ; warning=feedback ; id+let k = pinkNoiseId 'α' ar * 0.1+ i = soundIn 0+in convolution i k 2048
+ Help/Ugen/cos.help.hs view
@@ -0,0 +1,3 @@+---- ; drawings+Sound.Sc3.is_unary Sound.Sc3.Common.Base.CS "Cos"+Sound.Sc3.Plot.plot_fn_r1_ln cos (0,2 * pi)
+ Help/Ugen/cosh.help.hs view
@@ -0,0 +1,3 @@+---- ; drawings+Sound.Sc3.is_unary Sound.Sc3.Common.Base.CS "CosH"+Sound.Sc3.Plot.plot_fn_r1_ln cosh (-4,4)
+ Help/Ugen/coyote.help.hs view
@@ -0,0 +1,5 @@+-- coyote+let i = soundIn 0+ c = X.coyote kr i 0.2 0.2 0.01 0.5 0.05 0.1+ o = pinkNoiseId 'α' ar * decay c 1 * 0.25+in mce2 (i * 0.25) o
+ Help/Ugen/crackle.help.hs view
@@ -0,0 +1,9 @@+-- crackle+crackle ar 1.95 * 0.2++-- crackle ; modulate chaos parameter+crackle ar (line kr 1.0 2.0 3 RemoveSynth) * 0.2++---- ; drawings+Sound.Sc3.Plot.plot_ugen1 0.01 (crackle ar 1.95)+Sound.Sc3.Plot.plot_ugen1 0.025 (crackle ar (line kr 1.0 2.0 0.025 DoNothing))
+ Help/Ugen/crest.help.hs view
@@ -0,0 +1,4 @@+-- crest ; mouse varies from sinewave (left) to almost-square (right)+let sig = (sinOsc ar (mouseY kr 100 1000 Exponential 0.1) 0 * mouseX kr 1 10 Linear 0.2) `clip2` 1+ val = X.crest kr sig 440 1+in mce2 sig (sinOsc ar (lag val 0.2 * 400) 0) * 0.1
+ Help/Ugen/crossoverDistortion.help.hs view
@@ -0,0 +1,9 @@+-- crossoverDistortion+let x = mouseX kr 0 1 Linear 0.2+ y = mouseY kr 0 1 Linear 0.2+in X.crossoverDistortion (sinOsc ar (mce2 400 404) 0 * 0.2) x y++-- crossoverDistortion+let x = mouseX kr 0 1 Linear 0.2+ y = mouseY kr 0 1 Linear 0.2+in X.crossoverDistortion (soundIn 0) x y
+ Help/Ugen/ctl8Voicer.help.hs view
@@ -0,0 +1,36 @@+-- ctl8Voicer ; 16 voices of 8 control inputs ; control inputs are (0-1)+let f _ (c1,c2,c3,c4,c5,c6,c7,_) =+ let freq = midiCps (48 + c1 * 24)+ nh = c2 * 200+ pan = sinOsc kr (c3 * 2) 0 * c4+ amp = c5 + (sinOsc kr c6 0 * c7)+ in pan2 (blip ar freq nh) pan amp+in mix (ctl8Voicer 16 f) * control kr "gain" 0.1++-- control inputs calculated as offsets per voice ; equivalent to above+let f i =+ let cc n = in' 1 kr (11000 + constant (i * 8 + n - 1))+ freq = midiCps (48 + cc 1 * 24)+ nh = cc 2 * 200+ pan = sinOsc kr (cc 3 * 2) 0 * cc 4+ amp = cc 5 + (sinOsc kr (cc 6) 0 * cc 7)+ in pan2 (blip ar freq nh) pan amp+in sum (map f [0 .. 15]) * control kr "gain" 0.1++-- ctl16Voicer ; 8 voices of 16 control inputs ; applied at inputs as above ignores every other 8-block+let f _ ((c1,c2,c3,c4,c5,c6,c7,_),_) =+ let freq = midiCps (48 + c1 * 24)+ nh = c2 * 200+ pan = sinOsc kr (c3 * 2) 0 * c4+ amp = c5 + (sinOsc kr c6 0 * c7)+ in pan2 (blip ar freq nh) pan amp+in mix (ctl16Voicer 8 f) * control kr "gain" 0.1++---- ; initial settings ; 16 groups of eight+x = [[0.483,0.008,0.396,0.006,0.128,0.331,0.196,0],[0.005,0.015,0.194,0.481,0.037,0.052,0.189,0],[0.008,0.014,0.925,0.064,0.269,0.117,0.357,0],[0.79,0.009,0.187,0.216,0.14,0.064,0.046,0],[0.036,0.015,0.15,1,0.139,0.106,0.142,0],[0.065,0.014,0.683,1,0.208,0.108,0.042,0],[0.464,0.01,0.824,1,0.024,0.171,0.06,0],[0.498,0.018,0.828,0.066,0,0,0,0],[0.011,0.012,0.129,0,0,0,0,0],[0.07,0.015,0.309,0.162,0,0,0,0],[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0],[0.479,0.01,0.173,0.29,0,0.015,0.265,0],[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0],[0.286,0.011,0.027,0.39,0.238,0,0,0]]++---- ; send initial settings+import Sound.OSC {- hosc -}+withSc3 (sendMessage (c_setn1 (11000, replicate (16 * 8) 0)))+withSc3 (sendBundle (bundle immediately (map c_setn1 (zip [11000, 11008..] x))))+(length x == 16, map length x == replicate 16 8, 16 * 8 == 128)
+ Help/Ugen/cuspL.help.hs view
@@ -0,0 +1,24 @@+-- cuspL ; default values+cuspL ar 22050 1.0 1.9 0.0 * 0.1++-- cuspL ; vary frequency+let x = mouseX kr 20 (sampleRate / 2) Linear 0.1+in cuspL ar x 1.0 1.99 0 * 0.1++-- cuspL ; mouse-controlled parameters+let x = mouseX kr 0.9 1.1 Linear 0.1+ y = mouseY kr 1.8 2.0 Linear 0.1+in cuspL ar (sampleRate / 4) x y 0 * 0.1++-- cuspL ; frequency control+let x = mouseX kr 0.9 1.1 Linear 0.1+ y = mouseY kr 1.8 2.0 Linear 0.1+ n = cuspL ar 40 x y 0 * 0.3+in sinOsc ar (n * 800 + 900) 0 * 0.1++---- ; drawings+Sound.Sc3.Plot.plot_ugen_nrt (600,1) 1.0 (cuspL ar 600 1.0 1.9 0)++---- ; haskell implementation of equation+cusp_hs a b = iterate (Sound.Sc3.Common.Math.Noise.cusp_f a b) 0+Sound.Sc3.Plot.plot_p1_ln [take 600 (cusp_hs 1.0 1.9)]
+ Help/Ugen/cuspN.help.hs view
@@ -0,0 +1,3 @@+-- cuspN ; vary frequency+let x = mouseX kr 20 (sampleRate / 2) Linear 0.1+in cuspN ar x 1.0 1.99 0 * 0.1
+ Help/Ugen/dNoiseRing.help.hs view
@@ -0,0 +1,7 @@+-- dNoiseRing+let tr = impulse ar 10 0+ x = mouseX kr 0 1 Linear 0.2+ y = mouseY kr 0 1 Linear 0.2+ nr = demand tr 0 (X.dNoiseRingId 'α' x y 1.0 32.0 0.0)+ freq = midiCps (linLin nr 0 (2 ** 32) 40 (40 + 48))+in sinOsc ar freq 0 * 0.1
+ Help/Ugen/dbAmp.help.hs view
@@ -0,0 +1,5 @@+-- dbAmp ; linear db motion is exponential amplitude decay+fSinOsc ar 800 0 * dbAmp (line kr (-24) (-48) 10 RemoveSynth)++---- ; there is a non-UGen variant+dbAmp (-26::Double) == 0.05011872336272722
+ Help/Ugen/dbrown.help.hs view
@@ -0,0 +1,11 @@+-- dbrown+let n = dbrownId 'α' dinf 0 15 1+ x = mouseX kr 1 40 Exponential 0.1+ t = impulse kr x 0+ f = demand t 0 n * 30 + 340+in sinOsc ar f 0 * 0.1++-- dbrown+let n = demand (impulse kr 10 0) 0 (dbrownId 'α' dinf (-1) 1 0.05)+ f = linExp n (-1) 1 64 9600+in sinOsc ar f 0 * 0.1
+ Help/Ugen/dbufrd.help.hs view
@@ -0,0 +1,21 @@+-- dbufrd ; pattern as frequency input+let n = System.Random.randomRs (200.0,500.0) (System.Random.mkStdGen 0)+ b = asLocalBufId 'α' (take 24 n)+ s = dseqId 'β' 3 (mce [0,3,5,0,3,7,0,5,9])+ p = dseqId 'γ' dinf (mce [s,dbrownId 'δ' 5 0 23 1])+ t = dustId 'ε' kr 10+ r = dbufrdId 'ζ' b p Loop+in sinOsc ar (demand t 0 r) 0 * 0.1++-- dbufrd ; time pattern+let n1 = System.Random.randomRs (200.0,500.0) (System.Random.mkStdGen 0)+ b1 = asLocalBufId 'α' (take 24 n1)+ n2 = map ([1,0.5,0.25] !!) (System.Random.randomRs (0,2) (System.Random.mkStdGen 1))+ b2 = asLocalBufId 'β' (take 24 n2)+ s = dseqId 'γ' 3 (mce [0,3,5,0,3,7,0,5,9])+ p = dseqId 'δ' dinf (mce [s,dbrownId 'ε' 5 0 23 1])+ j = dseriesId 'ζ' dinf 0 1+ d = dbufrdId 'η' b2 j Loop+ l = dbufrdId 'θ' b1 p Loop+ f = duty kr (d * 0.5) 0 DoNothing l+in sinOsc ar f 0 * 0.1
+ Help/Ugen/dbufwr.help.hs view
@@ -0,0 +1,38 @@+-- dbufwr ; monadic graph+uid_st_eval (do+ let b = asLocalBufId 'α' (replicate 24 210)+ s1 <- dseriesM 30 0 3+ s2 <- dseriesM 30 0 1+ s3 <- dseriesM 16 1 1+ s4 <- dwhiteM 8 1 16+ s5 <- dseqM dinf (mce2 s3 s4)+ wt <- dustM kr 1 {- write trigger -}+ rp <- dseriesM dinf 0 1 {- read pointer -}+ wp <- dseqM dinf (mce2 s1 s2) {- write pointer -}+ r <- dbufrdM b rp Loop {- reader -}+ w <- dbufwrM b wp (s5 * 60) Loop {- writer -}+ let d = demand wt 0 w+ f = lag (demand (impulse kr 16 0) 0 r) 0.01+ o = sinOsc ar (f * mce2 1 1.01) 0 * 0.1+ return (mrg [d, out 0 o]))++-- dbufwr ; uid graph+let b = asLocalBufId 'α' (replicate 24 210)+ s = dseqId 'β' dinf (mce2 (dseriesId 'γ' 16 1 1) (dwhiteId 'δ' 8 1 16))+ rp = dseriesId 'ε' dinf 0 1 {- read pointer -}+ wp = dseqId 'ζ' dinf (mce2 (dseriesId 'η' 30 0 3) (dseriesId 'θ' 30 0 1)) {- write pointer -}+ r = dbufrdId 'ι' b rp Loop {- reader -}+ w = dbufwrId 'κ' b wp (s * 60) Loop {- writer -}+ d = demand (dustId 'λ' kr 1) 0 w+ f = lag (demand (impulse kr 16 0) 0 r) 0.01+ o = sinOsc ar (f * mce2 1 1.01) 0 * 0.1+in mrg2 d (out 0 o)++-- dbufrd ; demand rate single memory recurrence relation ; simple counter+let rec1Id z k t f =+ let b = asLocalBufId z [k]+ r = dbufrdId z b 0 Loop {- reader -}+ w = dbufwrId z b 0 (f r) Loop {- writer -}+ in mrg2 (demand t 0 r) (demand t 0 w)+ f = rec1Id 'α' 0 (impulse kr 6 0) (\r -> (r + 1) `modE` 24)+in sinOsc ar (midiCps (60 + f)) 0 * 0.1
+ Help/Ugen/dc.help.hs view
@@ -0,0 +1,11 @@+-- dc ; zero+dc ar 0++-- dc ; offset, clicks on start and finish+dc ar 0.5++-- dc ; offset, clicks on start and finish+dc ar 0.5 + sinOsc ar 440 0 * 0.1++-- dc ; transient before LeakDC adapts and suppresses the offset+leakDC (dc ar 1) 0.995
+ Help/Ugen/dconst.help.hs view
@@ -0,0 +1,5 @@+-- dconst ; fast notes of random duration for 0.5 seconds, then a single note for 0.5 seconds+let dexprandId z rp l r = lin_exp (dwhiteId z rp 0 1) 0 1 l r -- there is no Dexprand+ t = dconstId 'α' 0.5 (dwhiteId 'β' dinf 0.05 0.08) 0.001+ f = duty kr (dseqId 'γ' dinf (mce2 t 0.5)) 0 DoNothing (dexprandId 'δ' dinf 200 600)+in varSaw ar (lag f 0.02) 0 0.3 * 0.1
+ Help/Ugen/decay.help.hs view
@@ -0,0 +1,7 @@+-- decay ; as envelope+let n = pinkNoiseId 'α' ar + sinOsc ar 11000 0+ s = impulse ar (xLine kr 1 50 20 RemoveSynth) 0.25+in decay s 0.05 * n++---- ; drawings+Sound.Sc3.Plot.plot_ugen1 0.05 (decay (impulse ar 1 0) 0.01)
+ Help/Ugen/decay2.help.hs view
@@ -0,0 +1,13 @@+-- decay2 ; used as an envelope+let s = fSinOsc ar 600 0 * 0.25 -- sinOsc ar 11000 0 * 0.25+ f = xLine kr 1 50 20 RemoveSynth+in decay2 (impulse ar f 0) 0.01 0.2 * s++-- decay2 ; compare with decay used as the envelope+let s = fSinOsc ar 600 0 * 0.25+ f = xLine kr 1 50 20 RemoveSynth+in decay (impulse ar f 0) 0.2 * s++---- ; drawings ; attack and decay are a difference of two decays, hence inversion+Sound.Sc3.Plot.plot_ugen1 0.05 (decay2 (impulse ar 1 0) 0.001 0.01)+Sound.Sc3.Plot.plot_ugen1 0.05 (decay2 (impulse ar 1 0) 0.01 0.001)
+ Help/Ugen/degreeToKey.help.hs view
@@ -0,0 +1,11 @@+-- degreeToKey ; modal space, mouse x controls discrete pitch in dorian mode+let buf = (asLocalBufId 'β' [0,2,3.2,5,7,9,10])+ x = mouseX kr 0 15 Linear 0.1+ k = degreeToKey buf x 12+ f b = let n = lfNoise1Id 'α' kr (mce [3,3.05])+ o = sinOsc ar (midiCps (b + k + n * 0.04)) 0 * 0.1+ t = lfPulse ar (midiCps (mce [48,55])) 0.15 0.5+ d = rlpf t (midiCps (sinOsc kr 0.1 0 * 10 + b)) 0.1 * 0.1+ m = o + d+ in combN m 0.31 0.31 2 + m+in (f 48 + f 72) * 0.25
+ Help/Ugen/delTapWr.help.hs view
@@ -0,0 +1,6 @@+-- delTapWr+let b = localBufId 'α' 1 48000+ src = whiteNoiseId 'β' ar * 0.2 * decay (dustId 'γ' kr 3) 0.2+ tapPhase = delTapWr b src+ (tap1,tap2,tap3) = unmce3 (delTapRd b tapPhase (mce3 0.2 0.27 0.303) 1 * mce3 1 0.4 0.2)+in mce2 (src + tap2) (tap1 + tap3)
+ Help/Ugen/delay1.help.hs view
@@ -0,0 +1,5 @@+-- delay1+let s = impulse ar 1 0 * 0.25 in s + (delay1 s)++-- delay1 ; left=original, right=subtract delayed from original+let z = dustId 'α' ar 1000 * 0.1 in mce2 z (z - delay1 z)
+ Help/Ugen/delay2.help.hs view
@@ -0,0 +1,2 @@+-- delay2+let s = impulse ar 1 0 * 0.25 in s + (delay2 s)
+ Help/Ugen/delayC.help.hs view
@@ -0,0 +1,5 @@+-- delayC ; c.f. delayN ; no zipper noise+let i = sinOsc ar 320 0 * 0.1+ maxdelaytime = 0.005+ delaytime = mouseX kr 0.0 maxdelaytime Linear 0.15+in i + delayC i maxdelaytime delaytime
+ Help/Ugen/delayL.help.hs view
@@ -0,0 +1,5 @@+-- delayL ; c.f. delayN & delayC+let t = mouseX kr 0.001 0.2 Exponential 0.2+ s = impulse ar 1 0+ d = delayL s 0.6 t+in mce2 d s
+ Help/Ugen/delayN.help.hs view
@@ -0,0 +1,19 @@+-- delayN ; dust randomly triggers decay to envelope WhiteNoise ; input is left, delay right+let i = decay (dustId 'α' ar 1) 0.3 * whiteNoiseId 'β' ar * 0.1+in mce2 i (delayN i 0.1 0.1)++-- delayN ; delay time varied at control rate ; sinOsc reinforcing or cancelling with delayed copy+let i = sinOsc ar 320 0 * 0.1+ maxdelaytime = 0.005+ delaytime = mouseX kr 0.0 maxdelaytime Linear 0.15+in i + delayN i maxdelaytime delaytime++-- delayN ; flanging ; warning=feedback+let f = 0.1 -- flanger freq+ g = 0.1 -- feedback+ i = soundIn (mce2 0 1) -- two channels of input signal+ fb = i + localIn 2 ar 0 -- add feedback+ e = delayN fb 0.02 (sinOsc kr f 0 * 0.005 + 0.005) -- max delay of 20msec+ lp_f x = bpf x (mouseX kr 1000 10000 Linear 0.2) 0.1 -- filter in the feedback loop+ o = localOut (lp_f e * g)+in mrg2 (i + e) o
+ Help/Ugen/demand.help.hs view
@@ -0,0 +1,41 @@+-- demand ; monadic form+uid_st_eval (+ do r <- dustM kr 1+ s <- dgeomM dinf (midiCps 72) (midiRatio 1)+ let t = impulse kr 10 0+ f = demand t r s+ o = sinOsc ar (mce [f,f + 0.7]) 0+ return (max (cubed o) 0 * 0.1))++-- demand+let n = diwhiteId 'α' dinf 60 72+ t = impulse kr 10 0+ s = midiCps n+ f = demand t 0 s+ o = sinOsc ar (mce [f,f + 0.7]) 0+in cubed (cubed o) * 0.1++-- demand ; audio rate (poll output is equal for x1 and x2)+let i = lfNoise2Id 'α' ar 8000+ d = dseqId 'β' dinf (mce [i])+ x = mouseX kr 1 3000 Exponential 0.2+ t = impulse ar x 0+ x1 = demand t 0 d+ x2 = latch i t+ s = mce2 x1 x2+ p = poll t s 0 (mce2 (label "x1") (label "x2"))+ o = sinOsc ar (s * 300 + 400) 0 * 0.1+in mrg2 o p++-- demand+let t = impulse ar 5 0+ d1 = dseqId 'α' dinf (mce [1,0,1,1,0,1,0,0,1,0,1])+ d2 = dseqId 'β' dinf (mce [0,1,0,0,1,0,1,1,0,1,0])+ x = demand t 0 (mce2 d1 d2) * t+in decay x 1 * brownNoiseId 'γ' ar * 0.1++-- demand+let t = impulse ar 5 0+ d = drandId 'α' dinf (mce [dseqId 'β' 1 (mce [1,1,1,1]),dseqId 'γ' 1 (mce [1,0,0,0])])+ x = demand t 0 d * t+in decay x 1 * brownNoiseId 'δ' ar * 0.1
+ Help/Ugen/demandEnvGen.help.hs view
@@ -0,0 +1,76 @@+-- demandEnvGen ; frequency ramp, exponential curve+let l = dseqId 'α' dinf (mce2 440 9600)+ y = mouseY kr 0.01 3 Exponential 0.2+ s = env_curve_shape EnvExp+ f = demandEnvGen ar l y s 0 1 1 1 0 1 DoNothing+in sinOsc ar f 0 * 0.1++-- demandEnvGen ; frequency envelope with random times+let l = dseqId 'α' dinf (mce [204,400,201,502,300,200])+ t = drandId 'β' dinf (mce [1.01,0.2,0.1,2.0])+ y = mouseY kr 0.01 3 Exponential 0.2+ s = env_curve_shape EnvCub+ f = demandEnvGen ar l (t * y) s 0 1 1 1 0 1 DoNothing+in sinOsc ar (f * mce2 1 1.01) 0 * 0.1++-- demandEnvGen ; Frequency modulation+let n = dwhiteId 'α' dinf 200 1000+ x = mouseX kr (-0.01) (-4) Linear 0.2+ y = mouseY kr 1 3000 Exponential 0.2+ s = env_curve_shape (EnvNum undefined)+ f = demandEnvGen ar n (sampleDur * y) s x 1 1 1 0 1 DoNothing+in sinOsc ar f 0 * 0.1++-- demandEnvGen ; Short sequence with doneAction, linear+let l = dseqId 'α' 1 (mce [1300,500,800,300,400])+ s = env_curve_shape EnvLin+ f = demandEnvGen kr l 2 s 0 1 1 1 0 1 RemoveSynth+in sinOsc ar (f * mce2 1 1.01) 0 * 0.1++-- demandEnvGen ; Gate, mouse x on right side of screen toggles gate+let n = roundTo (dwhiteId 'α' dinf 300 1000) 100+ x = mouseX kr 0 1 Linear 0.2+ g = x >** 0.5+ f = demandEnvGen ar n 0.1 5 0.3 g 1 1 0 1 DoNothing+in sinOsc ar (f * mce2 1 1.21) 0 * 0.1++-- demandEnvGen ; gate, mouse x toggles sample and hold, mouse button does hard reset+let l = dseqId 'α' 2 (mce [dseriesId 'β' 5 400 200,500,800,530,4000,900])+ x = mouseX kr 0 1 Linear 0.2+ g = (x >** 0.5) - 0.1+ b = mouseButton kr 0 1 0.2+ r = (b >** 0.5) * 2+ s = env_curve_shape EnvSin+ f = demandEnvGen kr l 0.1 s 0 g r 1 0 1 DoNothing+in sinOsc ar (f * mce2 1 1.001) 0 * 0.1++-- demandEnvGen ; coordinate buffer, layout is (initial-level,duration,level,..,loop-duration)+let b = asLocalBufId 'α' [0,0.5,0.1,0.5,1,0.01]+ l_i = dseriesId 'β' dinf 0 2+ d_i = dseriesId 'γ' dinf 1 2+ l = dbufrdId 'δ' b l_i Loop+ d = dbufrdId 'ε' b d_i Loop+ s = env_curve_shape EnvLin+ e = demandEnvGen kr l d s 0 1 1 1 0 5 RemoveSynth+ f = midiCps (60 + (e * 12))+in sinOsc ar (f * mce2 1 1.01) 0 * 0.1++-- demandEnvGen ; read envelope break-points from buffer, here simply duration/level pairs.+-- ; the behavior is odd if the curve is zero (ie. flat segments).+let b = asLocalBufId 'α' [61,1,60,2,72,1,55,5,67,9,67]+ lvl = dbufrdId 'β' b (dseriesId 'γ' 6 0 2) Loop+ dur = dbufrdId 'δ' b (dseriesId 'ε' 5 1 2) Loop+ e = demandEnvGen kr lvl dur 1 0 1 1 1 0 1 RemoveSynth+in sinOsc ar (midiCps e) 0 * 0.1++-- demandEnvGen ; lfNoise1+let y = mouseY kr 0.5 20 Linear 0.2+ lvl = dwhiteId 'β' dinf (-0.1) 0.1+ dur = sampleDur * y+in demandEnvGen ar lvl dur 5 (-4) 1 1 1 0 1 RemoveSynth++-- demandEnvGen ; lfBrownNoise+let y = mouseY kr 1 100 Exponential 0.2+ lvl = dbrownId 'β' dinf (-0.1) 0.1 0.1+ dur = sampleDur * y+in demandEnvGen ar lvl dur 1 0 1 1 1 0 1 RemoveSynth
+ Help/Ugen/detectIndex.help.hs view
@@ -0,0 +1,5 @@+-- detectIndex ; find indexes and map to an audible frequency range+let n = 6+ x = floorE (mouseX kr 0 n Linear 0.1)+ i = detectIndex (asLocalBufId 'α' [2,3,4,0,1,5]) x+in sinOsc ar (linExp i 0 n 200 700) 0 * 0.1
+ Help/Ugen/detectSilence.help.hs view
@@ -0,0 +1,4 @@+-- detectSilence+let s = sinOsc ar 440 0 * mouseY kr 0 0.2 Linear 0.1+ d = detectSilence s 0.01 0.1 RemoveSynth+in mrg [s,d]
+ Help/Ugen/dfm1.help.hs view
@@ -0,0 +1,10 @@+-- dfm1 ; mouse control+let n = pinkNoiseId 'α' ar * 0.5+ x = mouseX kr 80 5000 Exponential 0.1+ y = mouseY kr 0.1 1.2 Linear 0.1+in X.dfm1 n x y 1 0 3e-4++-- dfm1 ; bass+let i = mix (pulse ar (mce2 100 100.1) 0.5) * 0.4+ f = range 80 2000 (sinOsc kr (range 0.2 5 (sinOsc kr 0.3 0)) 0)+in X.dfm1 i f 1.1 2 0 0.0003 * 0.1
+ Help/Ugen/dgeom.help.hs view
@@ -0,0 +1,6 @@+-- dgeom+let n = dgeomId 'α' 15 1 1.2+ x = mouseX kr 1 40 Exponential 0.1+ t = impulse kr x 0+ f = demand t 0 n * 30 + 340+in sinOsc ar f 0 * 0.1
+ Help/Ugen/dibrown.help.hs view
@@ -0,0 +1,6 @@+-- dibrown ; c.f. dbrown+let n = dibrownId 'α' dinf 0 15 1+ x = mouseX kr 1 40 Exponential 0.1+ t = impulse kr x 0+ f = demand t 0 n * 30 + 340+in sinOsc ar f 0 * 0.1
+ Help/Ugen/difSqr.help.hs view
@@ -0,0 +1,9 @@+-- difSqr+let o1 = fSinOsc ar 800 0+ o2 = fSinOsc ar (xLine kr 200 500 5 DoNothing) 0+in difSqr o1 o2 * 0.1++-- difSqr ; written out+let o1 = fSinOsc ar 800 0+ o2 = fSinOsc ar (xLine kr 200 500 5 DoNothing) 0+in (o1 * o1 - o2 * o2) * 0.1
+ Help/Ugen/diodeRingMod.help.hs view
@@ -0,0 +1,39 @@+-- diodeRingMod+let o1 = sinOsc ar 440 0+ o2 = sinOsc ar (xLine kr 1 100 10 DoNothing) 0+in mce2 (X.diodeRingMod o1 o2) (o1 * o2) * 0.125++-- diodeRingMod+let o1 = sinOsc ar 440 0+ o2 = sinOsc ar (xLine kr 200 500 5 DoNothing) 0+in mce2 (X.diodeRingMod o1 o2) (o1 * o2) * 0.125++-- diodeRingMod+let s1 = sinOsc ar (3700 * mce [1, 1.1, 1.2] * range 1 2 (sinOsc ar 200 0)) 0+ s2 = sinOsc ar (100 * mce [0.75, 1, 0.5]) 0+ s3 = X.diodeRingMod s1 s2+in mix s3 * lfPulse ar (10.3 * 0.5) 0 0.04 * 0.1++-- diodeRingMod+let mf_sin = sinOsc ar+ mf_square f _ = X.blitB3Square ar f 0.99+ mf_ring_mod (lfo_ph,car_ph) car_freq lfo_type lfo_freq lfo_amp drive x_mix mod_sig =+ let range_2oct = range 0.25 2+ lfo = range_2oct (lfo_type lfo_freq lfo_ph * lfo_amp)+ car_sig = sinOsc ar (car_freq * lfo) car_ph+ mod_sig_post = mod_sig * drive+ in xFade2 mod_sig_post (X.diodeRingMod car_sig mod_sig_post) x_mix 1+ y = mouseY kr 0 1 Linear 0.2+ x = mouseX kr (-1) 1 Linear 0.2+in mf_ring_mod (0,0) 6.25 mf_sin 0.1 y 1 x (soundIn 0)++{---- ; moog++c_freq = carrier frequency (mf = six-octave range, 2-130 and 60-4000 hz)+lfo_type = LFO signal function, ie. mf_sin or mf_square+lfo_freq = LFO frequency (mf = 0.1 - 25.0 hz)+lfo_amp = the amount that the LFO output sweeps the carrier sin oscillator+drive = pre-multiplier for mod_sig+x_mix = crossfade from unmodulated to modulated audio (-1 to 1)++-}
+ Help/Ugen/disintegrator.help.hs view
@@ -0,0 +1,5 @@+-- disintegrator+let x = mouseX kr 0 1 Linear 0.2+ y = mouseY kr 0 1 Linear 0.2+ s = sinOsc ar (mce2 400 404) 0 * 0.05+in X.disintegratorId 'α' s x y
+ Help/Ugen/diskIn.help.hs view
@@ -0,0 +1,7 @@+-- diskIn ; requires=dsk ; c.f. sndfileIn+let (buf, nc) = (control kr "dsk" 0, 2) in diskIn nc buf Loop++---- ; setup & cleanup+{fn = sfResolve "20.2-LW+RD.flac";nc = 2;dsk = 0}+withSc3 (mapM_ async [b_alloc dsk 65536 2,b_read dsk fn 0 (-1) 0 True])+withSc3 (mapM_ async [b_close dsk,b_free dsk])
+ Help/Ugen/distort.help.hs view
@@ -0,0 +1,2 @@+-- distort+distort (fSinOsc ar 500 0.0 * xLine kr 0.1 10 10 RemoveSynth) * 0.25
+ Help/Ugen/div.help.hs view
@@ -0,0 +1,12 @@+-- / ; division (floating point)+sinOsc ar 440 0 / 6++-- / ; creates a beating effect (subaudio rate)+(pinkNoiseId 'α' ar / fSinOsc kr 5 0) * 0.05++-- / ; optimises identity+sinOsc ar 440 0 / 1 * 0.1++-- div ; integer division+let d f = (sinOsc kr 0.25 0 * 200 + 500) `f` 17+in sinOsc ar (midiCps (mce2 (d div) (d (/)) * 3)) 0 * mce2 0.1 0.05
+ Help/Ugen/diwhite.help.hs view
@@ -0,0 +1,6 @@+-- dwhite ; c.f. dwhite+let n = diwhiteId 'α' dinf (-7) 7+ x = mouseX kr 1 40 Exponential 0.1+ t = impulse kr x 0+ f = midiCps (demand t 0 n + 60)+in sinOsc ar f 0 * 0.1
+ Help/Ugen/dneuromodule.help.hs view
@@ -0,0 +1,6 @@+-- dneuromodule+let dt = 0.001+ theta = mce2 (mouseX kr (-2) 2 Linear 0.2) (mouseY kr (-2) 2 Linear 0.2)+ md = X.dneuromoduleId 2 'α' 2 theta (mce2 0.1 0.3) (mce [-3,2,-2,0])+ m = lag3 (duty ar dt 0 DoNothing md) dt+in sinOsc ar (m * 400 + 600) 0 * 0.05
+ Help/Ugen/done.help.hs view
@@ -0,0 +1,6 @@+-- done ; high tone left or low tone right+let x = mouseX kr (-1) 1 Linear 0.1+ e = linen x 0.1 0.1 0.5 DoNothing+ o1 = sinOsc ar 880 0 * 0.1+ o2 = sinOsc ar 440 0 * e+in mce [done e * o1,o2]
+ Help/Ugen/doubleWell3.help.hs view
@@ -0,0 +1,10 @@+-- doubleWell3 ; bass synth+let x = mouseX kr 0 200 Linear 0.2+ y = mouseY kr 0.5 4.0 Linear 0.2+ f = sinOsc ar x 0 * y+in X.doubleWell3 ar 0 0.01 f 0.25 0 0++-- doubleWell3 ; gradually changing+let f = lfSaw ar (line kr 10 1000 10 DoNothing) 0+ delta = line kr 0.0 0.3 20 DoNothing+in X.doubleWell3 ar 0 0.05 f delta 0 0 * 0.2
+ Help/Ugen/dpw3Tri.help.hs view
@@ -0,0 +1,18 @@+-- dpw3Tri ; distortion creeps in under 200Hz+X.dpw3Tri ar (xLine kr 2000 20 10 DoNothing) * 0.1++-- dpw3Tri ; very fast sweeps can have transient distortion effects ; c.f. lfTri+X.dpw3Tri ar (mouseX kr 200 12000 Exponential 0.2) * 0.1++-- dpw3Tri ; less efficient than LFTri+let f = X.randNId 50 'α' 50 5000+in splay (X.dpw3Tri ar f) 1 0.1 0 True++-- dpw3Tri ; differentiation of triangle is square+let f = mouseX kr 440 8800 Exponential 0.2+ o = X.dpw3Tri ar f+in hpz1 (o * 2) * 0.25++-- dpw3Tri ; c.f. pulse+let f = mouseX kr 440 8800 Exponential 0.2+in mce2 (X.dpw3Tri ar f) (pulse ar f 0.5) * 0.05
+ Help/Ugen/dpw4Saw.help.hs view
@@ -0,0 +1,6 @@+-- dpw4Saw+X.dpw4Saw ar (xLine kr 2000 20 10 DoNothing) * 0.1++-- dpw4Saw ; c.f. saw+let x = mouseX kr 200 12000 Exponential 0.2+in mce2 (X.dpw4Saw ar x * 0.1) (saw ar x * 0.05)
+ Help/Ugen/drand.help.hs view
@@ -0,0 +1,21 @@+-- drand+let n = drandId 'α' dinf (mce [1, 3, 2, 7, 8])+ x = mouseX kr 1 400 Exponential 0.1+ t = impulse kr x 0+ f = demand t 0 n * 30 + 340+in sinOsc ar f 0 * 0.1++-- drand+let d = drandId 'α' dinf+ (mce [dseqId 'β' 1 (mce [2, 0, 2, 0, 1, 0, 1, 1])+ ,dseqId 'γ' 1 (mce [2, 0, 1, 0, 1, 0, 1, 0])+ ,dseqId 'δ' 1 (mce [2, 0, 1, 1, 1, 1, 1, 0])+ ,dseqId 'ε' 1 (mce [2, 0.3, 0.3, 1, 0.3, 0.3, 1, 0.3])+ ,dseqId 'ζ' 1 (mce [2, 0, 0.3, 0, 0.3, 0, 0.3, 0])+ ,dseqId 'η' 1 (mce [2, 0, 0, 1, 0, 0, 0, 0])+ ,dseqId 'θ' 1 (mce [2, 0, 0, 0, 0, 0, 0, 0])+ ,dseqId 'ι' 1 (mce [0, 1, 0, 1, 0, 1, 0, 1])+ ,dseqId 'κ' 1 (mce [1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0])])+ t = impulse ar 10 0+ x = demand t 0 d * t+in decay x 1 * pinkNoiseId 'λ' ar * 0.1
+ Help/Ugen/dseq.help.hs view
@@ -0,0 +1,54 @@+-- dseq ; at control rate+let n = dseqId 'α' 3 (mce [1,3,2,7,8])+ x = mouseX kr 1 40 Exponential 0.1+ t = impulse kr x 0+ f = demand t 0 n * 30 + 340+in sinOsc ar f 0 * 0.1++-- dseq ; at audio rate+let n = dseqId 'α' dinf (mce [1,3,2,7,8,32,16,18,12,24])+ x = mouseX kr 1 10000 Exponential 0.1+ t = impulse ar x 0+ f = demand t 0 n * 30 + 340+in sinOsc ar f 0 * 0.1++-- dseq ; the SC2 Sequencer UGen is somewhat like the sequ function below+let sequId e s tr = demand tr 0 (dseqId e dinf (mce s))+ t = impulse ar 6 0+ n0 = sequId 'α' [60,62,63,58,48,55] t+ n1 = sequId 'β' [63,60,48,62,55,58] t+in lfSaw ar (midiCps (mce2 n0 n1)) 0 * 0.05++-- dseq ; rather than MCE expansion at tr, it can be clearer to view tr as a functor+let tr = impulse kr (mce [2,3,5]) 0+ f (z,t) = demand t 0 (dseqId z dinf (mce [60,63,67,69]))+ m = mce_map_ix f tr+ o = sinOsc ar (midiCps m) 0 * 0.1+in splay o 1 1 0 True++-- dseq ; ln 2021-04-06 https://lukasnowok.github.io/spectrology/+let geom k z m = mce (take k (iterate (* m) z))+ d = demand (impulse ar 8 0) 0 (dseqId 'α' dinf (geom 9 1 1.25))+ e = xLine ar 1 0.7 20 DoNothing+in mix (sinOsc ar (geom 8 60 2 * d * e) 0) * 1/5 * 0.1++-- dseq ; mce+let d = demand (impulse ar 8 0) 0 (dseqId 'α' dinf (mce (map mce [[60,67],[59,62]])))+in sinOsc ar (midiCps d) 0 * 0.1++-- dseq ; shared dseq, different patterns+uid_st_eval+(do a <- dseqM 3 (mce [1,3,2,7,8])+ let t = impulse kr 5 0+ f = demand t 0 (mce [a,a]) * 30 + 340+ return (sinOsc ar f 0 * 0.1))++-- dseq ; distinct dseq, equal patterns+uid_st_eval+(do a <- replicateM 2 (dseqM 3 (mce [1,3,2,7,8]))+ let t = impulse kr 5 0+ f = demand t 0 (mce a) * 30 + 340+ return (sinOsc ar f 0 * 0.1))++---- ; drawings+UI.ui_baudline 4096 50 "linear" 2
+ Help/Ugen/dser.help.hs view
@@ -0,0 +1,6 @@+-- dser+let a = dserId 'α' 7 (mce [1, 3, 2, 7, 8])+ x = mouseX kr 1 40 Exponential 0.1+ t = impulse kr x 0+ f = demand t 0 a * 30 + 340+in sinOsc ar f 0 * 0.1
+ Help/Ugen/dseries.help.hs view
@@ -0,0 +1,6 @@+-- dseries+let n = dseriesId 'α' 15 0 1+ x = mouseX kr 1 40 Exponential 0.1+ t = impulse kr x 0+ f = demand t 0 n * 30 + 340+in sinOsc ar f 0 * 0.1
+ Help/Ugen/dshuf.help.hs view
@@ -0,0 +1,13 @@+-- dshuf+let a = dseqId 'α' dinf (dshufId 'β' 3 (mce [1,3,2,7,8.5]))+ x = mouseX kr 1 40 Exponential 0.1+ t = impulse kr x 0+ f = demand t 0 a * 30 + 340+in sinOsc ar f 0 * 0.1++-- dshuf+let a = dseqId 'α' dinf (dshufId 'β' 5 (X.randNId 81 'γ' 0 10))+ x = mouseX kr 1 10000 Exponential 0.1+ t = impulse ar x 0+ f = demand t 0 a * 30 + 340+in sinOsc ar f 0 * 0.1
+ Help/Ugen/dstutter.help.hs view
@@ -0,0 +1,19 @@+-- dstutter+let inp = dseqId 'α' dinf (mce [1,2,3])+ nse = diwhiteId 'β' dinf 2 8+ rep = dstutterId 'γ' nse inp+ trg = impulse kr (mouseX kr 1 40 Exponential 0.2) 0+ frq = demand trg 0 rep * 30 + 340+in sinOsc ar frq 0 * 0.1++-- dstutter ; see also <https://www.listarc.bham.ac.uk/lists/sc-users/msg14775.html>+let a z = let xr = dxrandId z dinf (mce [0.1,0.2,0.3,0.4,0.5])+ lf = dstutterId z 2 xr+ du = duty ar lf 0 DoNothing lf+ tr = abs (hpz1 du) `greater_than` 0+ ph = sweep ar tr (1/du)+ in linExp ph 0 1 (randId z 50 100) (randId z 500 2000)+ f = mce (map a (id_seq 8 'α'))+ [s0,s1] = mceChannels (splay (sinOsc ar f 0) 1 1 0 True)+ o = limiter (rotate2 s0 s1 (lfSaw kr 0.1 0)) 1 0.01+in o * 0.1
+ Help/Ugen/dswitch.help.hs view
@@ -0,0 +1,10 @@+-- dswitch ; c.f. dswitch1+uid_st_eval (+ do a0 <- dwhiteM 2 3 4+ a1 <- dwhiteM 2 0 1+ a2 <- dseqM 2 (mce [1,1,1,0])+ i <- dseqM 2 (mce [0,1,2,1,0])+ d <- dswitchM i (mce [a0,a1,a2])+ let t = impulse kr 4 0+ f = demand t 0 d * 300 + 400+ return (sinOsc ar f 0 * 0.1))
+ Help/Ugen/dswitch1.help.hs view
@@ -0,0 +1,8 @@+-- dswitch1 ; c.f. dswitch+let x = mouseX kr 0 4 Linear 0.1+ y = mouseY kr 1 15 Linear 0.1+ t = impulse kr 3 0+ w = dwhiteId 'α' dinf 20 23+ n = dswitch1Id 'β' x (mce [1, 3, y, 2, w])+ f = demand t 0 n * 30 + 340+in sinOsc ar f 0 * 0.1
+ Help/Ugen/dust.help.hs view
@@ -0,0 +1,17 @@+-- dust+dustId 'α' ar 2 * 0.25++-- dust+let d = xLine kr 20000 2 10 RemoveSynth+in dustId 'β' ar d * 0.15++-- dust ; illustrate monadic constructor+uid_st_eval (fmap (* 0.25) (dustM ar 200))++-- dust ; illustrate monadic constructor+uid_st_eval (fmap (* 0.15) (dustM ar (xLine kr 20000 2 10 RemoveSynth)))++---- ; drawings+Sound.Sc3.Plot.plot_ugen_nrt (48000,64) 0.1 (dustId 'γ' ar 300)+Sound.Sc3.Plot.plot_ugen_nrt (48000,64) 0.1 (dustId 'δ' ar (xLine kr 5000 100 0.1 RemoveSynth))+
+ Help/Ugen/dust2.help.hs view
@@ -0,0 +1,14 @@+-- dust2+dust2Id 'α' ar 200 * 0.5++-- dust2+let d = xLine kr 20000 2 10 RemoveSynth+in dust2Id 'β' ar d * 0.15++-- dust2 ; velvet noise (approx.)+let samplesPerPeriod = 20+in signum (dust2Id 'α' ar (sampleRate / samplesPerPeriod)) * 0.1++---- ; drawings+Sound.Sc3.Plot.plot_ugen1 0.1 (dust2Id 'γ' ar 400)+Sound.Sc3.Plot.plot_ugen1 0.1 (dust2Id 'γ' ar (xLine kr 5000 100 0.1 RemoveSynth))
+ Help/Ugen/dustRange.help.hs view
@@ -0,0 +1,21 @@+-- dustRange ; inter-offset times generated randomly in range (seconds) ; uniform distribution+-- ; audio rate impulse train of varying amplitude (min = max)+mce2 (X.dustRangeId 'α' ar 0.1 0.1 * 0.1) (impulse ar 10 0 * 0.1)++-- dustRange ; mean iot=0.0005 is equivalent to density=2000 at dust, dustRange spacing is more uniform+mce2 (X.dustRangeId 'β' ar 0.0001 0.001 * 0.1) (dustId 'γ' ar 2000 * 0.05)++-- dustRange ; velvet noise (approx.)+let iot = 20 / sampleRate+ x = mouseX kr 1 16 Exponential 0.1+ d = X.dustRangeId 'α' ar (iot / x) (iot * x)+ s = tRandId 'β' (-1) 1 d+in trig d sampleDur * signum s * 0.1++---- ; drawings+import Sound.Sc3.Plot {- hsc3-plot -}+plot_ugen_nrt (48000,64) 1.0 (X.dustRangeId 'δ' ar 0.1 0.1)+plot_ugen_nrt (48000,64) 1.0 (X.dustRangeId 'ε' ar 0.1 0.1 + impulse ar 10 0 * 0.5)+plot_ugen_nrt (48000,64) 0.1 (X.dustRangeId 'ζ' ar 0.0001 0.001)+plot_ugen_nrt (48000,64) 0.1 (dustId 'ζ' ar 2000)+plot_ugen_nrt (48000,64) 0.1 (let tr = X.dustRangeId 'β' ar 0.001 0.005 in trig tr sampleDur * signum (tRandId 'α' (-1) 1 tr))
+ Help/Ugen/duty.help.hs view
@@ -0,0 +1,17 @@+-- duty+uid_st_eval (+ do n0 <- drandM dinf (mce [0.01,0.2,0.4])+ n1 <- dseqM dinf (mce [204,400,201,502,300,200])+ let f = duty kr n0 0 RemoveSynth n1+ return (sinOsc ar (f * mce2 1 1.01) 0 * 0.1))++-- duty ; mouseX (control rate signal) determines duration+let n = dseqId 'α' dinf (mce [204,400,201,502,300,200])+ x = mouseX kr 0.001 2 Linear 0.1+ f = duty kr x 0 RemoveSynth n+in sinOsc ar (f * mce2 1 1.01) 0 * 0.1++-- duty ; fixed number of sample impulses ; https://fredrikolofsson.com/f0blog/impulse-train/+let dur = 1+ num = 8+in duty ar (dseqId 'α' dinf (mce [sampleDur, dur / num - sampleDur])) 0 DoNothing (dseqId 'β' num (mce [1, 0]))
+ Help/Ugen/dwgBowed.help.hs view
@@ -0,0 +1,30 @@+-- dwgBowed+let k = control kr+ freq = k "freq" 440+ amp = k "amp" 0.5+ force = k "force" 1+ gate_ = k "gate" 1+ pos = k "pos" 0.07+ c1 = k "c1" 0.25+ c3 = k "c3" 31+ pan = k "pan" 0+ vib = gendy1Id 'α' kr 1 1 1 1 0.1 4 0.5 0.5 12 0 * 0.003 + 1+ s1 = X.dwgBowed ar (freq * vib) amp force gate_ pos 0.1 c1 c3 0.55 2+ s2 = X.dwgSoundBoard s1 20 20 0.8 199 211 223 227 229 233 239 241+ s3 = bpf s2 118 1 + s2+ s4 = bpf s3 430 1 + s3+ s5 = bpf s4 490 1 + s4+ s6 = lpf s5 6000+in pan2 (s6 * 0.1) pan 1++-- dwgBowed ; event control+let f (_,g,_,y,z,o,rx,ry,p,_,_) =+ let freq = unitCps p+ s1 = X.dwgBowed ar freq z (0.5 + rx) 1 y 0.1 0.25 31 (0.55 + ry) 2 * g * z+ s2 = X.dwgSoundBoard s1 20 20 0.8 199 211 223 227 229 233 239 241+ s3 = bpf s2 118 1 + s2+ s4 = bpf s3 430 1 + s3+ s5 = bpf s4 490 1 + s4+ s6 = lpf s5 6000+ in pan2 s6 (o * 2 - 1) 1+in mix (voicer 16 f) * control kr "gain" 0.25
+ Help/Ugen/dwgBowedTor.help.hs view
@@ -0,0 +1,30 @@+-- dwgBowedTor+let k = control kr+ freq = k "freq" 440+ amp = k "amp" 0.5+ force = k "force" 1+ gate_ = k "gate" 1+ pos = k "pos" 0.07+ c1 = k "c1" 0.25+ c3 = k "c3" 31+ pan = k "pan" 0+ vib = gendy1Id 'α' kr 1 1 1 1 0.1 4 0.5 0.5 12 0 * 0.003 + 1+ s1 = X.dwgBowedTor ar (freq * vib) amp force gate_ pos 0.1 c1 c3 0.55 2 5.2 1 3000 1.8+ s2 = X.dwgSoundBoard s1 20 20 0.8 199 211 223 227 229 233 239 241+ s3 = bpf s2 118 1 + s2+ s4 = bpf s3 430 1 + s3+ s5 = bpf s4 490 1 + s4+ s6 = lpf s5 6000+in pan2 (s6 * 0.1) pan 1++-- dwgBowedTor ; event control+let f (_,g,_,y,z,o,rx,ry,p,_,_) =+ let freq = unitCps p+ s1 = X.dwgBowedTor ar freq z (0.5 + rx) 1 y 0.1 0.25 31 (0.55 + ry) 2 (5.2 + z) 1 3000 1.8 * g * z+ s2 = X.dwgSoundBoard s1 20 20 0.8 199 211 223 227 229 233 239 241+ s3 = bpf s2 118 1 + s2+ s4 = bpf s3 430 1 + s3+ s5 = bpf s4 490 1 + s4+ s6 = lpf s5 6000+ in pan2 s6 (o * 2 - 1) 1+in mix (voicer 16 f) * control kr "gain" 0.25
+ Help/Ugen/dwgClarinet3.help.hs view
@@ -0,0 +1,30 @@+-- dwgClarinet3+let freq = control_m kr "freq" 440 (220,880,"exp")+ att = 0.01+ amp = linLin (control_m kr "amp" 0.5 (0,1,"amp")) 0 1 0.76 1+ ampn = 1+ pc = control_m kr "pc" 1 (0.25,1.05,"lin")+ m = control_m kr "m" 0.8 (0.4,1.25,"lin")+ gate_ = control_m kr "gate" 1 (0,1,"switch")+ release = 0.01+ c1 = control_m kr "c1" 0.2 (0,1,"lin")+ c3 = control_m kr "c3" 7 (5,9,"lin")+ pan = control_m kr "pan" 0 (-1,1,"lin")+ vib = sinOsc kr 4 0 * 0.001 + 1+ pm = envGen ar gate_ 1 0 1 DoNothing (envAsr att 1 0.2 (EnvNum 1)) * amp+ signal = X.dwgClarinet3 ar (lag freq 0 * vib) pm pc m 1 release c1 c3+in pan2 (hpf signal 200) pan amp++-- dwgClarinet3 ; event control+let f (_,g,x,y,z,o,rx,ry,_,_,_) =+ let freq = midiCps (x * 25 + 42)+ vib = sinOsc kr (y * 4) 0 * (z * 0.005) + 1+ amp = linLin z 0 1 0.65 1+ pm = k2a (amp * g)+ pc = linLin y 0 1 0.25 0.85+ m = linLin rx 0 1 0.4 1.25+ c1 = ry+ c3 = linLin o 0 1 5 9+ signal = X.dwgClarinet3 ar (freq * vib) pm pc m 1 0.01 c1 c3+ in pan2 (hpf signal 200) (o * 2 - 1) 1+in mix (voicer 16 f) * control kr "gain" 0.25
+ Help/Ugen/dwgFlute.help.hs view
@@ -0,0 +1,27 @@+-- dwgFlute+let freq = control_m kr "freq" 440 (220,880,"exp")+ att = 0.01+ amp = control_m kr "amp" 0.25 (0,1,"amp")+ endr = 0.5+ jetr = control_m kr "jetr" 0.24 (0,1,"lin")+ jetRa = control_m kr "jetRa" 0.33 (0,1,"lin")+ gate_ = control_m kr "gate" 1 (0,1,"switch")+ release = 0.01+ noisegain = control_m kr "noisegain" 12 (1,36,"lin")+ pan = control_m kr "pan" 0 (-1,1,"lin")+ vib = sinOsc kr 4 0 + (0.001 * noisegain * whiteNoiseId 'α' ar)+ pm = envGen ar gate_ 1 0 1 DoNothing (envAsr att 1 0.2 (EnvNum 1)) * (1.1 + (amp * 0.2)) * vib+ signal = X.dwgFlute ar freq pm endr jetr jetRa 1 release+in pan2 (hpf (lpf signal 6000) 200) pan (0.2 * amp)++-- dwgFlute ; event control+let f (c,g,x,y,z,o,rx,ry,_,_,_) =+ let freq = midiCps (x * 25 + 42)+ vib = sinOsc kr 4 0 + (0.01 * z * whiteNoiseId c ar)+ pm = k2a ((0.1 + z) * vib * g)+ endr = linLin ry 0 1 0.35 0.65+ jetr = linLin y 0 1 0.65 0.85 * lagUD g 0.001 0.25+ jetRa = linLin rx 0 1 0.25 0.85 * lagUD g 0.001 0.25+ signal = X.dwgFlute ar freq pm endr jetr jetRa 1 0.01+ in pan2 (hpf (lpf signal 6000) 200) (o * 2 - 1) 1+in mix (voicer 16 f) * control kr "gain" 0.25
+ Help/Ugen/dwgPlucked2.help.hs view
@@ -0,0 +1,47 @@+-- dwgPlucked2 ; self deleting+let freq = 440+ amp = 0.5+ gate_ = 1+ c3 = 20+ inp = let e = envelope [0,1,1,0] [0.001,0.006,0.0005] (map EnvNum [5,-5,-8])+ in amp * lfClipNoiseId 'α' ar 2000 * envGen ar gate_ 1 0 1 DoNothing e+ ps = X.dwgPlucked2 ar freq amp gate_ 0.1 1 c3 inp 0.1 1.008 0.55 0.01+ pan = 0+ z = detectSilence ps 0.001 0.1 RemoveSynth+in mrg2 (pan2 ps pan 0.1) z++-- dwgPlucked2 ; re-sounding+let dur = mce [1,1,2,1,1,1,2,3,1,1,1,1,2,3,4] * 0.175+ sequId e s tr = demand tr 0 (dseqId e dinf (mce s))+ t = let d = dseqId 'α' dinf dur+ in tDuty ar d 0 DoNothing 1 0+ freq = let n0 = sequId 'β' [60,62,63,58,48,55] t+ n1 = sequId 'γ' [63,60,48,62,55,58] t+ in midiCps (mce2 n0 n1)+ amp = tRandId 'δ' 0.01 0.35 t -- pulse amplitude (0 - 1, def = 0.5)+ gate_ = 1 -- synth release+ pos = tRandId 'ε' 0.05 0.25 t -- pluck position (0 - 1, def = 0.14)+ c1 = 1 / tRandId 'ζ' 0.25 1.75 t -- reciprocal of decay time (def = 1.0)+ c3 = tRandId 'η' 10 1400 t -- high frequency loss factor (def = 30)+ inp = let e_dt = tRandId 'θ' 0.05 0.150 t+ env = decay2 t 0.001 e_dt * lfClipNoiseId 'ι' ar 2000+ in amp * lfClipNoiseId 'κ' ar 2000 * env -- pluck signal+ release = tRandId 'λ' 0.05 0.15 t -- release time (seconds, def = 0.1)+ mistune = tRandId 'μ' 0.992 1.008 t -- factor for detuning second string (def = 1.008)+ mp = tRandId 'ν' 0.35 0.65 t -- excitation mixer (def = 0.55)+ gc = tRandId 'ξ' 0.001 0.020 t -- coupling string factor (def = 0.01)+ ps = X.dwgPlucked2 ar freq amp gate_ pos c1 c3 inp release mistune mp gc+ pan = tRandId 'ο' (-1) 1 t+in pan2 ps pan 0.1++-- dwgPlucked2 ; event control+let f (_,g,x,y,z,o,rx,_,p,_,_) =+ let c3 = 20+ (gt,tr) = ccEventGateReset g p+ dx = latch x tr - x+ freq = midiCps (p * 127 + dx)+ inp = let e = envelope [0,1,1,0] [0.001,0.006,0.0005] (map EnvNum [5,-5,-8])+ in z * lfClipNoiseId 'α' ar 2000 * envGen ar gt 1 0 1 DoNothing e+ ps = X.dwgPlucked2 ar freq 1 y 0.1 1 c3 inp 0.1 (1 + rx * 0.05) 0.55 (0.1 * z)+ in pan2 ps (o * 2 - 1) 1+in mix (voicer 16 f) * control kr "gain" 0.75
+ Help/Ugen/dwgPluckedStiff.help.hs view
@@ -0,0 +1,46 @@+-- dwgPluckedStiff ; self deleting+let freq = 440+ amp = 0.5+ gate_ = 1+ pos = 0.14+ c1 = 1+ c3 = 30+ inp = let e = envelope [0,1,1,0] [0.001,0.006,0.0005] (map EnvNum [5,-5,-8])+ in amp * lfClipNoiseId 'α' ar 2000 * envGen ar gate_ 1 0 1 DoNothing e+ release = 0.1+ fB = 2.0+ ps = X.dwgPluckedStiff ar freq amp gate_ pos c1 c3 inp release fB+ pan = 0+ z = detectSilence ps 0.001 0.1 RemoveSynth+in mrg2 (pan2 ps pan 0.1) z++-- dwgPluckedStiff ; re-sounding+let sequId e s tr = demand tr 0 (dseqId e dinf (mce s))+ t = let d = dseqId 'α' dinf (mce [1,1,2,1,1,1,2,3,1,1,1,1,2,3,4] * 0.175)+ in tDuty ar d 0 DoNothing 1 0+ freq = let n0 = sequId 'β' [60,62,63,58,48,55] t+ n1 = sequId 'γ' [63,60,48,62,55,58] t+ in midiCps (mce2 n0 n1)+ amp = tRandId 'δ' 0.05 0.65 t -- pulse amplitude (0 - 1, def = 0.5)+ gate_ = 1 -- synth release+ pos = tRandId 'ε' 0.05 0.25 t -- pluck position (0 - 1, def = 0.14)+ c1 = 1 / tRandId 'ζ' 0.25 1.75 t -- reciprocal of decay time (def = 1.0)+ c3 = tRandId 'η' 10 1400 t -- high frequency loss factor (def = 30)+ inp = let e_dt = tRandId 'θ' 0.05 0.150 t+ env = decay2 t 0.001 e_dt * lfClipNoiseId 'ι' ar 2000+ in amp * lfClipNoiseId 'κ' ar 2000 * env -- pluck signal+ release = tRandId 'λ' 0.05 0.15 t -- release time (seconds, def = 0.1)+ fB = tRandId 'μ' 1.0 4.0 t -- inharmonicity factor (def = 2.0)+ ps = X.dwgPluckedStiff ar freq amp gate_ pos c1 c3 inp release fB+ pan = tRandId 'ο' (-1) 1 t+in mix (pan2 ps pan 0.1)++-- dwgPluckedStiff ; event control+let f (_,g,_,y,z,o,rx,_,p,_,_) =+ let freq = unitCps p+ c3 = 20+ inp = let e = envelope [0,1,1,0] [0.001,0.006,0.0005] (map EnvNum [5,-5,-8])+ in z * lfClipNoiseId 'α' ar 2000 * envGen ar g 1 0 1 DoNothing e+ ps = X.dwgPluckedStiff ar freq 1 y 0.1 (1 - rx * 0.01) c3 inp 0.1 (z * 4)+ in pan2 ps (o * 2 - 1) 1+in mix (voicer 16 f) * control kr "gain" 0.5
+ Help/Ugen/dwgSoundBoard.help.hs view
@@ -0,0 +1,49 @@+-- dwgSoundBoard+let sig = decay2 (dustId 'α' ar 4) 0.01 1+ sb inp mul =+ let c1 = control_m kr "c1" 20.0 (1,40,"lin")+ c3 = control_m kr "c3" 20.0 (1,40,"lin")+ mix = control_m kr "mix" 0.8 (0,1,"lin")+ d1 = 199.0 * mul+ d2 = 211.0 * mul+ d3 = 223.0 * mul+ d4 = 227.0 * mul+ d5 = 229.0 * mul+ d6 = 233.0 * mul+ d7 = 239.0 * mul+ d8 = 241.0 * mul+ in X.dwgSoundBoard inp c1 c3 mix d1 d2 d3 d4 d5 d6 d7 d8+in sb sig (mce2 1 (control_m kr "mul" 2.8 (0.25,4,"lin")))++-- dwgSoundBoard ; event control+let f (c,g,x,y,z,o,rx,ry,_,_,_) =+ let env = decay2 (trig g controlDur * z) 0.01 (0.05 + y * 0.15)+ sig = pinkNoiseId c ar * env+ c1_min = control_m kr "c1_min" 5 (1,5,"lin")+ c3_min = control_m kr "c3_min" 5 (1,5,"lin")+ c1 = linLin rx 0 1 c1_min 20+ c3 = linLin ry 0 1 c3_min 20+ mix = linLin y 0 1 0.75 1+ mul = linLin (1 - x) 0 1 0.05 0.75+ d1 = 199.0 * mul+ d2 = 211.0 * mul+ d3 = 223.0 * mul+ d4 = 227.0 * mul+ d5 = 229.0 * mul+ d6 = 233.0 * mul+ d7 = 239.0 * mul+ d8 = 241.0 * mul+ in pan2 (X.dwgSoundBoard sig c1 c3 mix d1 d2 d3 d4 d5 d6 d7 d8) (o * 2 - 1) 1+in mix (voicer 16 f) * control kr "gain" 1++-- dwgSoundBoard ; pluck ; event control+let f (_,g,x,y,z,o,rx,_,_,_,_) =+ let n = whiteNoiseId 'α' ar * (z + y * 0.75)+ dl_max = 1 / 220 -- 110+ dl = dl_max * (1 - x * 0.9)+ sig = pluck n g dl_max dl 10 (linLin y 0 1 0.65 0.80) -- 0.75 1.0+ flt = let m = y * 2+ in X.dwgSoundBoard sig 20 20 (rx * 0.35)+ (199 * m) (211 * m) (223 * m) (227 * m) (229 * m) (233 * m) (239 * m) (241 * m)+ in pan2 flt (o * 2 - 1) 1+in mix (voicer 16 f) * control kr "gain" 1
+ Help/Ugen/dwhite.help.hs view
@@ -0,0 +1,17 @@+-- dwhite+let n = dwhiteId 'α' dinf 0 15+ x = mouseX kr 1 40 Exponential 0.1+ t = impulse kr x 0+ f = demand t 0 n * 30 + 340+in sinOsc ar f 0 * 0.1++-- dwhite ; bias uniform noise to lower range+let n = dwhiteId 'α' dinf 0 1+ l = control_m kr "l" 48 (0,127,"lin")+ r = control_m kr "r" 96 (0,127,"lin")+ t = impulse kr (control_m kr "trigFreq" 2 (0.01,12,"lin")) 0+ m = exp (demand t 0 n * (log r - log l) + log l)+in sinOsc ar (midiCps m) 0 * 0.1++---- ; drawings+UI.ui_sc3_scope 2 0 4096 1 "audio" 0
+ Help/Ugen/dwrand.help.hs view
@@ -0,0 +1,6 @@+-- dwrand+let n = dwrandId 'α' dinf (mce [0.3,0.2,0.1,0.2,0.2]) (mce [1,3,2,7,8])+ x = mouseX kr 1 400 Exponential 0.1+ t = impulse kr x 0+ f = demand t 0 n * 30 + 340+in sinOsc ar f 0 * 0.1
+ Help/Ugen/dx7.help.hs view
@@ -0,0 +1,104 @@+-- dx7 ; texture node ; data at local buffer+let vc = [[25,21,98,38,99, 0,99, 0,36,17,87,2,1,0,0,0,59,0, 1,1,8]+ ,[66,69,60,35, 0, 0,98, 0, 0, 0, 4,0,0,0,0,1,90,0, 1,0,8]+ ,[25,21,98,38,99, 0,99, 2,35,15,79,3,1,1,0,0,91,1, 0,0,6]+ ,[97,69,60,35,99,91,98, 0, 0, 0, 0,0,0,0,0,1,68,0,22,0,7]+ ,[78,63,53,28,99,52,62, 3,38,11,80,3,0,0,0,0,77,0, 7,0,0]+ ,[98,56,63,23,99,89,74, 2, 0, 4, 1,0,0,0,0,0,99,0, 1,0,7]+ ,[99,99,99,99,50,50,50,50,3,2,1,29,99,1,0,0,0,1,24]]+ dur = randId 'α' 0.1 10.0+ mnn = iRandId 'β' 48 72+ vel = iRandId 'γ' 10 69+ loc = randId 'δ' (-1) 1+ gate_ = line kr 1 0 dur DoNothing+ reset_ = 0+ data_ = 0+ buf = asLocalBufId 'ε' (map constant (concat vc))+ s = pan2 (X.dx7 ar buf gate_ reset_ data_ 0 mnn vel 0x2000 0 0 0) loc 1+ d = detectSilence s 0.001 0.1 RemoveSynth+in mrg [out 0 s,d]++-- dx7 ; event control ; data at local buffer+let f (_,g,x,_,z,o,_,_,p,_,_) =+ let vc = [[25,21,98,38,99, 0,99, 0,36,17,87,2,1,0,0,0,59,0, 1,1,8]+ ,[66,69,60,35, 0, 0,98, 0, 0, 0, 4,0,0,0,0,1,90,0, 1,0,8]+ ,[25,21,98,38,99, 0,99, 2,35,15,79,3,1,1,0,0,91,1, 0,0,6]+ ,[97,69,60,35,99,91,98, 0, 0, 0, 0,0,0,0,0,1,68,0,22,0,7]+ ,[78,63,53,28,99,52,62, 3,38,11,80,3,0,0,0,0,77,0, 7,0,0]+ ,[98,56,63,23,99,89,74, 2, 0, 4, 1,0,0,0,0,0,99,0, 1,0,7]+ ,[99,99,99,99,50,50,50,50,3,2,1,29,99,1,0,0,0,1,24]]+ buf = asLocalBufId 'ε' (map constant (concat vc))+ x0 = latch x g+ in pan2 (X.dx7 ar buf g 0 0 0 (p * 100) z (0x2000 * (x - x0)) 0 0 0) (o * 2 - 1) 1+in mix (voicer 16 f) * control kr "gain" 1++-- dx7 ; data at shared buffer ; external control+let buf = control kr "dat" 400+ gate_ = control kr "gate" 0+ reset = control kr "reset" 0+ data_ = control kr "data" 0+ vc = control kr "vc" 0+ mnn = control kr "mnn" 60+ vel = control kr "vel" 99+ pw = 0x2000+ mw = 0+ bc = 0+ fc = 0+in X.dx7 ar buf gate_ reset data_ vc mnn vel pw mw bc fc++-- dx7 ; data at shared buffer+let nv = 32 -- 221+ buf = control kr "dat" 400+ tr = dustId 'α' kr 2.0+ gate_ = toggleFF tr+ reset_ = 0+ data_ = 0+ vc = tRandId 'β' 0 (nv - 1) tr+ mnn = tRandId 'γ' 56.5 57.5 tr -- fractional midi note number -- 60 61+ vel = tRandId 'δ' 10 29 tr+ loc = tRandId 'ε' (-1) 1 tr+in pan2 (X.dx7 ar buf gate_ reset_ data_ vc mnn vel 0x2000 0 0 0) loc 1++-- dx7 ; event control ; data at shared buffer+let f (_,g,x,_,z,o,_,_,p,_,_) =+ let buf = control kr "buf" 400+ vc = control_m kr "vc" 0 (0,31,"lin")+ x0 = latch x g+ pw = 0x2000 * (1 + (x - x0) * 2)+ s = X.dx7 ar buf g 0 0 vc (p * 127) (z * 99) pw 0 0 0+ in pan2 s (o * 2 - 1) 1+in mix (voicer 16 f) * control_m kr "gain" 1 (0,4,"amp")++---- ; send init voice+import qualified Sound.Sc3.Data.Yamaha.DX7 as DX7 {- hsc3-data -}+import qualified Sound.Sc3.Data.Yamaha.DX7.Sc3 as DX7 {- hsc3-data -}+DX7.dx7_sc3_data_load 400 [DX7.dx7_init_voice]++---- ; load patch data from .hex.text file+hex_fn = "/home/rohan/uc/the-center-is-between-us/trees/text/dx7/tc.hex.text"+v <- DX7.dx7_load_hex hex_fn+DX7.dx7_sc3_data_load 400 v+length v == 221++---- ; load patch data from .syx sysex file+syx_fn = "/home/rohan/sw/hsc3-data/data/yamaha/dx7ii/rom/DX7II-32A.syx"+bnk <- DX7.dx7_load_fmt9_sysex_err syx_fn+DX7.dx7_sc3_data_load 400 bnk+length bnk == 32++---- ; send external control messages+import Sound.OSC {- hosc -}+withSc3 (sendMessage (n_set1 1 "vc" 0))+withSc3 (sendMessage (n_set1 1 "gate" 1.0))+withSc3 (sendMessage (n_set1 1 "gate" 0.0))+withSc3 (sendMessage (n_set1 1 "data" 0.0))+withSc3 (sendMessage (n_set1 1 "mnn" 69.0))+withSc3 (sendMessage (n_set1 1 "vel" 10.0))++{---- DX7++An Sc3 UGen of the+[Levien](https://github.com/google/music-synthesizer-for-android) /+[Gauthier](https://github.com/asb2m10/dexed) DX7 emulator codes.++-}
+ Help/Ugen/dxrand.help.hs view
@@ -0,0 +1,29 @@+-- dxrand ; c.f. drand ; dxrand never plays the same value twice in a row+let i = mce [0.2,0.4,dseqId 'α' 2 (mce [0.1,0.1])]+ d = dxrandId 'β' dinf i+in tDuty ar d 0 DoNothing (dwhiteId 'γ' dinf 0.5 1) 0++-- dxrand+let i0 = mce [0.2,0.4,dseqId 'α' 2 (mce [0.1,0.1])]+ i1 = mceMap (* 0.5) i0+ i2 = i0 * 0.5+ d = dxrandId 'β' dinf i2 -- compare i1 & i2+in tDuty ar d 0 DoNothing (dwhiteId 'γ' dinf 0.5 1) 0++-- dxrand+let n = dxrandId 'α' dinf (mce [1, 3, 2, 7, 8])+ x = mouseX kr 1 400 Exponential 0.1+ t = impulse kr x 0+ f = demand t 0 n * 30 + 340+in sinOsc ar f 0 * 0.1++{---- ; note++The list inputs to demand rate ugens may operate at different rates.+The variants i' and i'' above ought to generate the same graph. A+simple-minded mce rule sets the rate of the operator primitive to the+maximum rate of the inputs and then does not revise this after mce+transformation, where it may be lower. The hsc3 constructors attempt+to get this right!+-}+
+ Help/Ugen/dynKlang.help.hs view
@@ -0,0 +1,22 @@+-- dynKlang ; fixed+let s = klangSpec [800,1000,1200] [0.3,0.3,0.3] [pi,pi,pi]+in dynKlang ar 1 0 s * 0.4++-- dynKlang ; fixed randomised+let f = map (\z -> randId z 600 1000) ['a'..'l']+ s = klangSpec f (replicate 12 1) (replicate 12 0)+in dynKlang ar 1 0 s * 0.05++-- dynKlang ; dynamic frequency modulation+let f = mce3 800 1000 1200 + sinOsc kr (mce3 2 3 4.2) 0 * mce3 13 24 12+ a = mce3 0.3 0.3 0.3+ p = mce3 pi pi pi+in dynKlang ar 1 0 (klangSpec_mce f a p) * 0.1++-- dynKlang ; https://www.listarc.bham.ac.uk/lists/sc-users/msg66911.html+let k = 16 :: Int+ f i = (((fromIntegral i ** range_hs (0.3,0.7) (lag (lfNoise0Id i kr 1) 0.1)) + 1) * 99+ ,max 0 (lfNoise1Id i kr (linRandId i 0 10 0)))+ (frq,amp) = unzip (map f [0 .. k - 1])+ s = dynKlang ar 1 0 (klangSpec frq amp (replicate k 0)) * 0.01+in pan2 s 0 1
+ Help/Ugen/dynKlank.help.hs view
@@ -0,0 +1,24 @@+-- dynKlank+let s = klankSpec [800,1071,1153,1723] [1,1,1,1] [1,1,1,1]+in dynKlank (impulse ar 2 0 * 0.1) 1 0 1 s++-- dynKlank+let s = klankSpec [800,1071,1353,1723] [1,1,1,1] [1,1,1,1]+in dynKlank (dustId 'α' ar 8 * 0.1) 1 0 1 s++-- dynKlank+let s = klankSpec [800,1071,1353,1723] [1,1,1,1] [1,1,1,1]+in dynKlank (pinkNoiseId 'α' ar * 0.007) 1 0 1 s++-- dynKlank+let s = klankSpec [200,671,1153,1723] [1,1,1,1] [1,1,1,1]+in dynKlank (pinkNoiseId 'α' ar * 0.004) 1 0 1 s++-- dynKlank ; change frequencies (x) and ring-times (y) with mouse.+let x = mouseX kr 0.5 2 Exponential 0.2+ f = map (* x) [800,1071,1153,1723]+ y = mouseY kr 0.1 10 Exponential 0.2+ d = map (* y) [1,1,1,1]+ s = klankSpec f [1,1,1,1] d+ i = impulse ar 2 0 * 0.1+in dynKlank i 1 0 1 s
+ Help/Ugen/envAdsr.help.hs view
@@ -0,0 +1,57 @@+-- envAdsr ; random release time+let g = setResetFF 1 (dustId 'α' kr 1)+ p = envAdsr 0.01 0.25 0.15 0.75 1 (EnvNum (-4)) 0+ e = envGen kr g 0.1 0 1 RemoveSynth p+in sinOsc ar 440 0 * e++-- envAdsr+let c = control kr "gate" 1+ p = envAdsr 0.75 2.75 0.1 7.25 1 (EnvNum (-4)) 0+ e = envGen kr c 1 0 1 RemoveSynth p+in sinOsc ar 440 0 * e * 0.1++-- envAdsr ; record variant+let g = control kr "gate" 1+ c = EnvNum (-4)+ r = Adsr {adsr_attackTime = 0.75+ ,adsr_decayTime = 0.75+ ,adsr_sustainLevel = 0.5+ ,adsr_releaseTime = 0.75+ ,adsr_peakLevel = 1+ ,adsr_curve = (c,c,c)+ ,adsr_bias = 0}+ p = envAdsr_r r+ e = envGen kr g 0.1 0 1 DoNothing p+in sinOsc ar 440 0 * e++-- envAdsr ; adsr_def+let g = control kr "gate" 1+ p = envAdsr_r adsr_def+ e = envGen kr g 0.1 0 1 DoNothing p+in sinOsc ar 440 0 * e++---- ; close gate message+withSc3 (Sound.OSC.sendMessage (n_set1 (-1) "gate" 0))++---- ; drawings+import Sound.Sc3.Plot {- hsc3 -}+plotEnvelope [envAdsr 0.75 0.75 0.5 0.75 1 (EnvNum (-4)) 0+ ,envAdsr 0.02 0.2 0.25 1 1 (EnvNum (-4)) 0+ ,envAdsr 0.001 0.2 0.25 1 1 (EnvNum (-4)) 0+ ,envAdsr 0 2 1 0.1 0.5 EnvSin 0+ ,envAdsr 0.001 1.54 1 0.001 0.4 EnvSin 0]++---- ; help+Sound.Sc3.Lang.Help.viewSc3Help "Env.*adsr"++---- ; coord ; [0,3,2,-99,1,0.01,5,-4,0.5,0.3,5,-4,0,1,5,-4]+envelope_sc3_array (envAdsr 0.01 0.3 0.5 1 1 (EnvNum (-4)) 0)++---- ; coord ; [0,3,2,-99,1,0.3,5,-4,0.1,0.4,5,-4,0,1.2,5,-4]+envelope_sc3_array (envAdsr 0.3 0.4 0.1 1.2 1 (EnvNum (-4)) 0)++---- ; sc3+Env.adsr.asArray == [0,3,2,-99,1,0.01,5,-4,0.5,0.3,5,-4,0,1,5,-4];+x = {|gate=0, freq=440 | EnvGen.kr(Env.adsr,gate) * SinOsc.ar(freq,0) * 0.1}.play+x.set(\gate,1);+x.set(\gate,0);
+ Help/Ugen/envAsr.help.hs view
@@ -0,0 +1,30 @@+-- envAsr ; random release time+let g = setResetFF 1 (dustId 'α' kr 1)+ p = envAsr 0.01 1 1 (EnvNum (-4))+ e = envGen kr g 0.1 0 1 RemoveSynth p+in sinOsc ar 440 0 * e++-- envAsr ; control+let g = control kr "env-gate" 1+ p = envAsr 0.01 1 1 (EnvNum (-4))+ e = envGen kr g 0.1 0 1 RemoveSynth p+in sinOsc ar 440 0 * e++---- ; close gate message+withSc3 (Sound.OSC.sendMessage (n_set1 (-1) "env-gate" 0))++---- ; help+Sound.Sc3.Lang.Help.viewSc3Help "Env.*asr"+:i Sound.Sc3.Asr++---- ; drawings+import Sound.Sc3.Plot {- hsc3-plot -}+plotEnvelope [envAsr 0.1 1 1 (EnvNum (-4))+ ,envAsr 0.3 0.25 1 EnvSin+ ,envAsr 0.01 0.5 1.25 EnvLin]++---- ; drawings ; an envelope with a long release time that mostly sustains and then decays quickly+plotEnvelope [envAsr_c 0.01 1 0.75 (EnvNum (-4),EnvNum 4)+ ,envAsr_c 0.15 1 1.25 (EnvNum (-4),EnvNum (-4))+ ,envAsr_c 0.15 1 1.25 (EnvNum (-4),EnvNum 64)]+
+ Help/Ugen/envCoord.help.hs view
@@ -0,0 +1,43 @@+-- envCoord ; co-ordinate (break-point) envelope+let c = EnvLin+ p = envCoord [(0,0),(0.5,0.1),(0.55,1),(1,0)] 9 0.1 c+ e = envGen kr 1 1 0 1 RemoveSynth p+in sinOsc ar 440 0 * e++-- envCoord ; line segments ; internal graph triggers and randomises line end points+let tr = dustId 'α' kr 2+ st = 440+ en = tRandId 'β' 300 900 tr+ tm = tRandId 'γ' 0.5 1.5 tr+ p = envCoord [(0,st),(tm,en)] 1 1 EnvLin+ e = envGen kr tr 1 0 1 DoNothing p+in sinOsc ar e 0 * 0.2++-- envCoord ; line segments ; external control+let tr = trigControl "tr" 1+ st = control kr "st" 440+ en = control kr "en" 880+ tm = control kr "tm" 2+ p = envCoord [(0,st),(tm,en)] 1 1 EnvLin+ e = envGen kr tr 1 0 1 DoNothing p+in sinOsc ar e 0 * 0.2++-- envCoord ; start and end reset randomly every 4 seconds, ramp every trigger+let tr = impulse kr (1/4) 0+ f0 = tExpRandId 'α' 110 450 tr+ f1 = tExpRandId 'β' 110 440 tr+ p = envCoord [(0,0),(0,f0),(4,f1)] 1 1 EnvExp+ e = envGen kr tr 1 0 1 DoNothing p+in splay (sinOsc ar (mce [f0,e,f1]) 0) 1 1 0 True * mce [0.05,0.1,0.05]++---- ; set target value & transition time and trigger+withSc3 (sendMessage (n_set 1 [("en",550),("tm",4),("tr",1)]))+withSc3 (sendMessage (n_set 1 [("en",990),("tm",1),("tr",1)]))+withSc3 (sendMessage (n_set 1 [("en",110),("tm",2),("tr",1)]))++---- ; plotting+Sound.Sc3.Plot.plotEnvelope [envCoord [(0,0),(0.35,0.1),(0.55,1),(1,0)] 9 0.1 EnvLin]+Sound.Sc3.Plot.plotEnvelope [envCoord [(0,0),(0.15,0.6),(0.35,0.2),(1,0)] 6 0.1 EnvSin]+Sound.Sc3.Plot.plotEnvelope [envCoord [(0,0),(0.65,0.3),(0.85,0.7),(1,0)] 5 0.1 EnvCub]+Sound.Sc3.Plot.plotEnvelope [envCoord [(0,0.1),(0.25,0.6),(0.5,0.4),(1,0.4)] 7 0.1 EnvStep]+Sound.Sc3.Plot.plotEnvelope [envCoord (zip [-1,-0.7,0.7,1] [0,0.45,0.55,1]) 1 1 EnvLin]
+ Help/Ugen/envDetect.help.hs view
@@ -0,0 +1,8 @@+-- envDetect+let i = soundIn 0+ c = X.envDetect ar i 0.01 0.1+ p = pitch i 440 60 4000 100 16 1 0.01 0.5 1 0+ f = mceChannel 0 p * 3+ e = lagUD (mceChannel 1 p) 0 0.1+ o = pinkNoiseId 'α' ar * c + sinOsc ar f 0 * c * e+in mce2 i o
+ Help/Ugen/envFollow.help.hs view
@@ -0,0 +1,6 @@+-- envFollow+let z = soundIn 0+ d = mouseX kr 0.990 0.999 Linear 0.2+ c = X.envFollow kr z d+ o = pinkNoiseId 'α' ar * c+in mce2 z o
+ Help/Ugen/envGate.help.hs view
@@ -0,0 +1,20 @@+-- envGate ; default arguments, as used by envGate_def+let k = control kr+ e = envGate 1 (k "gate" 1) (k "fadeTime" 0.02) RemoveSynth EnvSin+in lpf (saw ar 200) 600 * 0.1 * e++-- envGate ; defaults arguments+let e = envGate_def+in lpf (saw ar 200) 600 * 0.1 * e++-- envGate ; several envGate nodes can coexist, if they are the same they are shared+let e = envGate_def+ s1 = lpf (saw ar 80) 600 * e+ s2 = rlpf (saw ar 200 * 0.5) (6000 * e + 60) 0.1 * e+in mce2 s1 s2 * 0.1++---- ; set fade time, then release gate+import Sound.OSC {- hosc -}+withSc3 (sendMessage (n_set1 (-1) "fadeTime" 5))+withSc3 (sendMessage (n_set1 (-1) "gate" 0))+
+ Help/Ugen/envGen.help.hs view
@@ -0,0 +1,54 @@+-- envGen ; https://www.listarc.bham.ac.uk/lists/sc-users/msg14815.html+let n = range 0.01 0.15 (lfNoise1Id 'α' kr 2)+ e = Envelope [0,1] [n] [EnvLin] Nothing (Just 0) 0+ c = env_circle_0 e+ a = envGen ar 1 1 0 1 DoNothing c+in sinOsc ar (a * 400 + 500) 0 * 0.1++-- envGen ; env_circle joins the end of the envelope to the start+let e = envelope [6000,700,100] [1,1] [EnvExp,EnvLin]+ c = env_circle_z 0 1 EnvLin e+ f = envGen kr 1 1 0 1 DoNothing c+in (sinOsc ar f 0 + impulse ar 1 0) * 0.1++-- envGen ; c.f. envXyc ; non-linear Phasor ; positive half traversed more quickly than negative+let e = envXyc [(0,0,EnvNum (-0.5)),(0.4,pi,EnvNum 0.5),(1,two_pi,EnvLin)]+ o = sinOsc kr 0 (envGen kr 1 1 0 2 DoNothing (env_circle_0 e))+in (soundIn 0 + pinkNoiseId 'α' ar * 0.1) * range 0.25 1 o++-- envGen ; impulse train with curvature ; see below for control messages ; https://fredrikolofsson.com/f0blog/impulse-train/+let go = trigControl "go" 1 -- trigger+ dur = control kr "dur" 1 -- total duration in seconds (also frequency)+ cur = control kr "cur" 0 -- curvature or 'shape'. 0 = pulses at regular intervals+ num = control kr "num" 8 -- number of impulses per duration+ amp = control kr "amp" 1 -- gain+ env = envGen ar go 1 0 1 DoNothing (envelope [0, 0, 1] [0, dur] [EnvNum cur])+in changed (ceil (env * num)) 0 * amp++{---- ; see also help files for the following envelope constructors++- envAdsr+- envAsr+- envCoord+- envGate+- envLinen+- envPairs+- envPerc+- envSine+- envStep+- envTrapezoid+- envTriangle+- envXyc++-}++---- ; set impulse train controls+set = withSc3 . sendMessage . n_set (-1)+set [("go", 1), ("cur", 3), ("num", 18)] -- start slow and go faster+set [("go", 1), ("cur", -2), ("num", 18)] -- slower and slower+set [("go", 1), ("amp", 0.2), ("cur", 0), ("dur", 0.5), ("num", 200)] -- 200 for half a second = 400 Hz++---- ; drawings+let e = envelope [6000,700,100] [1,1] [EnvExp,EnvLin]+envelope_sc3_array e == Just [6000,2,-99,-99,700,1,2,0,100,1,1,0]+Sound.Sc3.Plot.plotEnvelope [e]
+ Help/Ugen/envLinen.help.hs view
@@ -0,0 +1,26 @@+-- envLinen+let t = envLinen 0.4 2 0.4 0.1+ e = envGen kr 1 1 0 1 RemoveSynth t+in sinOsc ar 440 0 * e++---- ; drawings+import Sound.Sc3.Plot {- hsc3-plot -}+plotEnvelope [envLinen 0.4 2 0.4 0.6,envLinen 0.6 1 1.2 0.7]+plotEnvelope [envLinen 0 1 0 0.4]+plotEnvelope [envelope_normalise (envLinen 0 2 0 0.5)]++---- ; help+Sound.Sc3.UGen.Help.viewSc3Help "Env.*linen"+:i Sound.Sc3.LINEN++---- ; language access+let e = envLinen 0 1 0 1 :: Envelope Double+in (envelope_duration e+ ,envelope_segment_ix e 0+ ,envelope_segment_ix e 1+ ,envelope_segment e 0+ ,envelope_segment e 1+ ,envelope_at e 0+ ,envelope_at e 1+ ,envelope_render 10 e)+
+ Help/Ugen/envPairs.help.hs view
@@ -0,0 +1,14 @@+-- envPairs+let c = EnvLin+ p = envPairs [(0,0),(5,0.01),(5.5,0.1),(10,0)] c+ e = envGen kr 1 1 0 1 RemoveSynth p+in sinOsc ar 440 0 * e++---- ; plot+import Sound.Sc3.Plot {- hsc3-plot -}+plotEnvelope [envPairs [(0,0),(5,0.01),(5.5,0.1),(10,0)] EnvLin]+plotEnvelope [envPairs [(0,1),(2.1,0.5),(3,1.4),(5,0.001)] EnvExp]+plotEnvelope [envPairs [(0,110),(4,220),(9,440),(11,220),(13,880),(19,110),(23,55),(27,55)] EnvExp]++---- ; help+Sound.Sc3.Common.Help.sc3_scdoc_help_open False (sc3_scdoc_help_path "Env.*pairs")
+ Help/Ugen/envPerc.help.hs view
@@ -0,0 +1,23 @@+-- envPerc+let a = 0.1+ p = envPerc 0.01 1+ e = envGen kr 1 a 0 1 RemoveSynth p+in sinOsc ar 440 0 * e++-- envPerc+let a = 0.1+ c = EnvNum (-4)+ p = envPerc_c 0.01 1 a (c,c)+ e = envGen kr 1 1 0 1 RemoveSynth p+in sinOsc ar 440 0 * e++---- ; drawings+Sound.Sc3.Plot.plotEnvelope [envPerc 0.05 1,envPerc 0.2 0.75]+Sound.Sc3.Plot.plotEnvelope [envPerc 0.1 1,envPerc_c 0.1 1 1 (EnvSin,EnvSin)]+Sound.Sc3.Plot.plotEnvelope [envPerc_c 0.01 5 1 (EnvNum (-40), EnvNum (-40))]++---- ; help+Sound.Sc3.Lang.Help.viewSc3Help "Env.*perc"++---- ; coordinates+envelope_sc3_array (envPerc 0.01 1) == Just [0,2,-99,-99,1,0.01,5,-4,0,1,5,-4]
+ Help/Ugen/envSine.help.hs view
@@ -0,0 +1,10 @@+-- envSine+let s = envSine 9 0.1+ e = envGen kr 1 1 0 1 RemoveSynth s+in sinOsc ar 440 0 * e++---- ; drawings+Sound.Sc3.Plot.plotEnvelope [envSine 9 1,envSine 3 0.25]++---- ; help+Sound.Sc3.Lang.Help.viewSc3Help "Env.*sine"
+ Help/Ugen/envStep.help.hs view
@@ -0,0 +1,16 @@+-- envStep+let env = envStep [0.0,0.5,0.7,1.0,0.9,0.0] [0.5,0.1,0.2,1.0,1.5,3] Nothing Nothing+ envgen = envGen ar 1 1 0 1 RemoveSynth env+in sinOsc ar (envgen * 1000 + 440) 0 * (envgen + 1) * 0.1++-- envStep ; major scale, accelerating, with loop & release nodes+let env = envStep [0,2,4,5,7,9,11,12,0] (take 9 (iterate (* 0.75) 1)) (Just 8) (Just 0)+ envgen = envGen ar 1 1 0 1 DoNothing env+in sinOsc ar (midiCps (envgen + 60)) 0 * 0.1++---- ; drawings+Sound.Sc3.Plot.plotEnvelope [envStep [0,2,4,5,7,9,11,12] (take 8 (iterate (* 0.75) 1)) Nothing Nothing]++---- ; help+Sound.Sc3.Lang.Help.viewSc3Help "Env.*step"+
+ Help/Ugen/envTrapezoid.help.hs view
@@ -0,0 +1,10 @@+-- envTrapezoid+let t = envTrapezoid 0.05 0.95 3 0.1+ e = envGen kr 1 1 0 1 RemoveSynth t+in sinOsc ar 440 0 * e++---- ; drawings+Sound.Sc3.Plot.plotEnvelope [envTrapezoid 0.75 0.25 2 1,envTrapezoid 0.25 0.75 3 0.5]++---- ; coord+envelope_sc3_array (envTrapezoid 0 0.25 2 0.1) == Just [0,3,-99,-99,0.1,0.5,1,0,0.1,0,1,0,0,1.5,1,0]
+ Help/Ugen/envTriangle.help.hs view
@@ -0,0 +1,10 @@+-- envTriangle+let t = envTriangle 1 0.1+ e = envGen kr 1 1 0 1 RemoveSynth t+in sinOsc ar 440 0 * e++---- ; drawings+Sound.Sc3.Plot.plotEnvelope [envTriangle 1 1,envTriangle 0.25 0.5]++---- ; help+Sound.Sc3.Lang.Help.viewSc3Help "Env.*triangle"
+ Help/Ugen/envXyc.help.hs view
@@ -0,0 +1,5 @@+---- ; drawing+Sound.Sc3.Plot.plotEnvelope [envXyc [(0, 330, EnvExp), (0.5, 440, EnvExp), (1.0, 1760, EnvLin)]]++---- ; help+Sound.Sc3.Common.Help.sc3_scdoc_help_open False (sc3_scdoc_help_path "Env.*xyc")
+ Help/Ugen/equal_to.help.hs view
@@ -0,0 +1,33 @@+-- equal_to+let o = sinOsc kr 1 0+ t = [o `greater_than` 0+ ,o `greater_than_or_equal_to` 0+ ,o `less_than` 0+ ,o `less_than_or_equal_to` 0+ ,o `equal_to` 0+ ,(o `less_than` 0.001) * (o `greater_than` (-0.001))]+ f = [220, 330, 440, 550, 660, 770]+ p = envPerc 0.01 1+ e = envGen kr (mce t) 0.1 0 1 DoNothing p+in mix (sinOsc ar (mce f) 0 * e)++-- equal_to ; operators+let o = sinOsc kr 1 0+ t = [o >** 0+ ,o >=** 0+ ,o <** 0+ ,o <=** 0+ ,o ==** 0+ ,(o <** 0.001) * (o >** (-0.001))]+ f = [220, 330, 440, 550, 660, 770]+ p = envPerc 0.01 1+ e = envGen kr (mce t) 0.1 0 1 DoNothing p+in mix (sinOsc ar (mce f) 0 * e)++{---- ; operators++The star suffixes (==**,/=**,<**,<=**,>**,>=**) are because the result of the+operators is not of type Bool, as is required by the signature for the+classes Eq and Ord.++-}
+ Help/Ugen/eventVoicer.help.hs view
@@ -0,0 +1,81 @@+-- event ; c=freq ; harmonics of A2+let f (c,g,_,_,_,_,_,_,_,_,_) = sinOsc ar (110 * (constant c + 1)) 0 * g+in mix (voicer 16 f) * control kr "gain" 0.05++-- event ; x=freq ; 0-1 = full range ; i.e. mpe controller or large touch controller+let f (_,g,x,_,_,_,_,_,_,_,_) = sinOsc ar (midiCps (x * 127)) 0 * g+in mix (voicer 16 f) * control kr "gain" 0.1++-- event ; x=freq ; 0-1 = partial range ; i.e. small touch controller+let f (_,g,x,_,_,_,_,_,_,_,_) = sinOsc ar (midiCps (x * 24 + 48)) 0 * g+in mix (voicer 16 f) * control kr "gain" 0.1++-- event ; y=freq ; 0-1 = partial range+let f (_,g,_,y,_,_,_,_,_,_,_) = sinOsc ar (midiCps (y * 24 + 48)) 0 * g+in mix (voicer 16 f) * control kr "gain" 0.1++-- event ; z=freq ; 0-1 = partial range+let f (_,g,_,_,z,_,_,_,_,_,_) = sinOsc ar (midiCps (z * 24 + 48)) 0 * g+in mix (voicer 16 f) * control kr "gain" 0.1++-- event ; o=freq ; 0-1 = partial range+let f (_,g,_,_,_,o,_,_,_,_,_) = sinOsc ar (midiCps (o * 24 + 48)) 0 * g+in mix (voicer 16 f) * control kr "gain" 0.1++-- event ; rx=freq ; 0-1 = partial range+let f (_,g,_,_,_,_,rx,_,_,_,_) = sinOsc ar (midiCps (rx * 24 + 48)) 0 * g+in mix (voicer 16 f) * control kr "gain" 0.1++-- event ; ry=freq ; 0-1 = partial range+let f (_,g,_,_,_,_,_,ry,_,_,_) = sinOsc ar (midiCps (ry * 24 + 48)) 0 * g+in mix (voicer 16 f) * control kr "gain" 0.1++-- event ; p=freq ; p is a pitch value in (0,1) calculated by the control input system+let f (_,g,_,_,_,_,_,_,p,_,_) = sinOsc ar (unitCps p) 0 * g+in mix (voicer 16 f) * control kr "gain" 0.1++-- event ; p+px=freq+let f (_,w,_,_,_,_,_,_,p,px,_) = sinOsc ar (midiCps (p * 127 + px)) 0 * w+in mix (voicer 16 f) * control kr "gain" 0.1++-- event ; p+px=freq ; z*z=ampl ; w=gate+let f (_,w,_,_,z,_,_,_,p,px,_) = sinOsc ar (midiCps (p * 127 + px)) 0 * w * z * z * 4+in mix (voicer 16 f) * control kr "gain" 1++-- event ; x=freq y=amp ; 0-1 = partial range+let f (_,g,x,y,_,_,_,_,_,_,_) = sinOsc ar (midiCps (x * 12 + 48)) 0 * y * lagUD g 0.05 1+in mix (voicer 16 f) * control kr "gain" 0.2++-- event ; x=freq z=amp ; 0-1 = partial range ; 24ET+let f (_,g,x,_,z,_,_,_,_,_,_) = sinOsc ar (midiCps ((x * 12 + 48) `roundTo` 0.5)) 0 * z * g+in mix (voicer 16 f) * control kr "gain" 0.5++-- event ; p=freq z=amp+let f (_,g,_,_,z,_,_,_,p,_,_) = sinOsc ar (unitCps p * 2) 0 * g * z+in mix (voicer 16 f) * control kr "gain" 1.0++-- event ; x=freq y=pan z=amp ; 0-1 = partial range ; 24ET+let f (_,g,x,y,z,_,_,_,_,_,_) =+ pan2 (sinOsc ar (midiCps ((x * 12 + 48) `roundTo` 0.5)) 0) (y * 2 - 1) (z * g)+in mix (voicer 16 f) * control kr "gain" 0.5++-- event ; p=freq y=pan z=amp ; 0-1 = partial range ; 24ET+let f (_,g,_,y,z,_,_,_,p,_,_) =+ pan2 (sinOsc ar (unitCps p `roundTo` 0.5) 0) (y * 2 - 1) (z * g)+in mix (voicer 16 f) * control kr "gain" 0.5++-- event ; simple frequency modulation+let f (_,g,x,y,z,o,_,_,_,_,_) =+ let cR = 1 -- carrier ratio+ mR = 2 -- modulation ratio+ mI = y * 3 -- modulation index+ f0 = midiCps (x * 25 + 48)+ f1 = f0 * cR+ f2 = f0 * mR+ o2 = sinOsc ar f2 0+ o1 = sinOsc ar (f1 + (o2 * mI * f2)) 0+ in pan2 o1 (o * 2 - 1) (z * z * g)+in mix (voicer 16 f) * control kr "gain" 4++---- ; reference tones+mix (sinOsc ar (midiCps (mce [48,60,72])) 0 * mce [0.1,0.01,0.1])
+ Help/Ugen/excess.help.hs view
@@ -0,0 +1,10 @@+-- excess+(fSinOsc ar 1000 0 `excess` line kr 0 1 8 DoNothing) * 0.1++-- excess ; written out in terms of clip2+let o = fSinOsc ar 1000 0+ l = line kr 0 1 8 DoNothing+in (o - clip2 o l) * 0.1++---- ; drawings+Sound.Sc3.Plot.plot_fn_r1_ln (\x -> excess x 1) (-2,2)
+ Help/Ugen/expRand.help.hs view
@@ -0,0 +1,4 @@+-- expRand+let a = line kr 0.5 0 0.01 RemoveSynth+ f = expRandId 'α' 100.0 8000.0+in fSinOsc ar f 0 * a
+ Help/Ugen/expRandN.help.hs view
@@ -0,0 +1,13 @@+-- expRandN ; two channel sin tones+sinOsc ar (X.expRandNId 2 'α' 440 880) 0 * 0.1++-- expRandN ; n node klang synthesis+let n = 240+ f = X.expRandNId n 'α' 40 18000+ a = X.expRandNId n 'β' 0.1 0.3+ p = X.randNId n 'γ' (-1) 1+ s = klangSpec_mce f a p+in klang ar 1 0 s * 0.01++-- expRandN ; mce...+let f = X.expRandNId 2 'α' (mce2 440 441) 442 in sinOsc ar f 0 * 0.1
+ Help/Ugen/fSinOsc.help.hs view
@@ -0,0 +1,9 @@+-- fSinOsc ; note SC2 did not have the initial phase argument+fSinOsc ar (mce2 440 550) 0 * 0.05++-- fSinOsc ; modulate frequency+fSinOsc ar (xLine kr 200 4000 1 RemoveSynth) 0 * 0.1++-- fSinOsc ; loses amplitude towards the end+let f = fSinOsc ar (xLine kr 4 401 8 RemoveSynth)+in fSinOsc ar (f 0 * 200 + 800) 0 * 0.1
+ Help/Ugen/fbSineC.help.hs view
@@ -0,0 +1,31 @@+-- fbSineC ; Sc3 default values+fbSineC ar (sampleRate / 2) 1 0.1 1.1 0.5 0.1 0.1 * 0.1++-- fbSineC ; fb generating noise+fbSineC ar (sampleRate / 2) 1 4 1.1 0.5 0.1 0.1 * 0.1++-- fbSineC ; increase feedback+let fb = line kr 0.01 4 10 DoNothing+in fbSineC ar sampleRate 1 fb 1.1 0.5 0.1 0.1 * 0.1++-- fbSineC ; increase phase multiplier+let a = line kr 1 2 10 DoNothing+in fbSineC ar sampleRate 1 0 a 0.5 0.1 0.1 * 0.1++-- fbSineC ; randomly modulate parameters+let x = mouseX kr 1 12 Linear 0.1+ nId e = lfNoise2Id e kr x+ n0 = nId 'α' * 10000 + 10000+ n1 = nId 'β' * 32 + 33+ n2 = nId 'γ' * 0.5+ n3 = nId 'δ' * 0.05 + 1.05+ n4 = nId 'ε' * 0.3 + 0.3+in fbSineC ar n0 n1 n2 n3 n4 0.1 0.1 * 0.1++---- ; drawings+Sound.Sc3.Plot.plot_ugen_nrt (600,1) 1.0 (fbSineC ar 600 1.0 4.0 1.1 0.5 0.1 0.1)++---- ; haskell implementation of equation+import Sound.Sc3.Common.Math.Noise {- hsc3 -}+fbSineC_hs im fb a c = map fst (iterate (fbSine_f im fb a c) (0.1,0.1))+Sound.Sc3.Plot.plot_p1_ln [take 600 (fbSineC_hs 1.0 4.0 1.1 0.5)]
+ Help/Ugen/fbSineL.help.hs view
@@ -0,0 +1,1 @@+---- c.f fbSineC
+ Help/Ugen/fbSineN.help.hs view
@@ -0,0 +1,1 @@+---- c.f. fbSineC
+ Help/Ugen/fdiv.help.hs view
@@ -0,0 +1,4 @@+-- fdiv+let o = fSinOsc kr 10 0.5+ n = pinkNoiseId 'α' ar+in (n * 0.1) / (o * 0.75)
+ Help/Ugen/fft.help.hs view
@@ -0,0 +1,9 @@+-- fft ; variant with default values+let n = whiteNoiseId 'α' ar+in ifft' (fft' (localBufId 'β' 1 2048) (n * 0.05))++-- fft ; local buffer allocating variant+let s0 = sinOsc kr 0.08 0 * 6 + 6.2+ s1 = sinOsc kr (squared s0) 0 * 100 + 800+ s2 = sinOsc ar s1 0+in ifft (fftAllocId 'α' 2048 s2 0.5 0 1 0) 0 0 * 0.1
+ Help/Ugen/fftTrigger.help.hs view
@@ -0,0 +1,1 @@+---- c.f. packFFT
+ Help/Ugen/fm7.help.hs view
@@ -0,0 +1,94 @@+-- fm7 ; two of six ; direct form+let c = mce [xLine kr 300 310 4 DoNothing,0,1+ ,xLine kr 300 310 8 DoNothing,0,1+ ,0,0,1+ ,0,0,1+ ,0,0,1+ ,0,0,1]+ m = mce [line kr 0 0.001 2 DoNothing,line kr 0.1 0 4 DoNothing,0,0,0,0+ ,line kr 0 6 1 DoNothing,0,0,0,0,0+ ,0,0,0,0,0,0+ ,0,0,0,0,0,0+ ,0,0,0,0,0,0+ ,0,0,0,0,0,0]+ [l,r,_,_,_,_] = mceChannels (X.fm7 ar c m)+in mce2 l r * 0.1++-- fm7 ; two of six ; matrix form ; inputs may be audio or control or initialization rate+let rt = ar+ c = [[xLine rt 300 310 4 DoNothing,0,1]+ ,[xLine rt 300 310 8 DoNothing,0,1]+ ,[0,0,1]+ ,[0,0,1]+ ,[0,0,1]+ ,[0,0,1] ]+ m = [[line rt 0 0.001 2 DoNothing,line rt 0.1 0 4 DoNothing,0,0,0,0]+ ,[line rt 0 6 1 DoNothing,0,0,0,0,0]+ ,[0,0,0,0,0,0]+ ,[0,0,0,0,0,0]+ ,[0,0,0,0,0,0]+ ,[0,0,0,0,0,0] ]+ [l,r,_,_,_,_] = mceChannels (X.fm7_mx c m)+in mce2 l r * 0.1++-- fm7 ; an algorithmically generated graph courtesy f0+let x = [[[0.0,-1/3,-1.0,0.0]+ ,[0.75,0.75,0.0,-0.5]+ ,[-0.5,-0.25,0.25,-0.75]+ ,[-0.5,1.0,1.0,1.0]+ ,[0.0,1/6,-0.75,-1.0]+ ,[0.5,0.5,-0.5,1/3]]+ ,[[-1/3,0.5,-0.5,-0.5]+ ,[0.5,0.75,0.25,0.75]+ ,[-15/18,0.25,-1.0,0.5]+ ,[1.5,0.25,0.25,-0.25]+ ,[-2/3,-2/3,-1.0,-0.5]+ ,[-1.0,0.0,-15/18,-1/3]]+ ,[[0.25,-0.5,-0.5,-1.0]+ ,[-0.5,1.0,-1.5,0.0]+ ,[-1.0,-1.5,-0.5,0.0]+ ,[0.5,-1.0,7/6,-0.5]+ ,[15/18,-0.75,-1.5,0.5]+ ,[0.25,-1.0,0.5,1.0]]+ ,[[1.0,1/3,0.0,-0.75]+ ,[-0.25,0.0,0.0,-0.5]+ ,[-0.5,-0.5,0.0,0.5]+ ,[1.0,0.75,0.5,0.5]+ ,[0.0,1.5,-0.5,0.0]+ ,[1.0,0.0,-0.25,-0.5]]+ ,[[0.5,-0.25,0.0,1/3]+ ,[0.25,-0.75,1/3,-1.0]+ ,[-0.25,-0.5,0.25,-7/6]+ ,[0.0,0.25,0.5,1/6]+ ,[-1.0,-0.5,15/18,-0.5]+ ,[15/18,-0.75,-0.5,0.0]]+ ,[[0.0,-0.75,-1/6,0.0]+ ,[1.0,0.5,0.5,0.0]+ ,[-0.5,0.0,-0.5,0.0]+ ,[-0.5,-1/6,0.0,0.5]+ ,[-0.25,1/6,-0.75,0.25]+ ,[-7/6,-4/3,-1/6,1.5]]]+ y = [[[0.0,-0.5,1.0,0.0]+ ,[-0.5,1.0,0.5,-0.5]+ ,[0.0,1/3,1.0,1.0]]+ ,[[-0.5,0.5,1.0,1.0]+ ,[0.0,1/3,0.0,1.5]+ ,[-0.5,15/18,1.0,0.0]]+ ,[[0.25,-2/3,0.25,0.0]+ ,[0.5,-0.5,-0.5,-0.5]+ ,[0.5,-0.5,-0.75,15/18]]+ ,[[-0.25,1.0,0.0,1/3]+ ,[-1.25,-0.25,0.5,0.0]+ ,[0.0,-1.25,-0.25,-0.5]]+ ,[[0.75,-0.25,1.5,0.0]+ ,[0.25,-1.5,0.5,0.5]+ ,[-0.5,-0.5,-0.5,-0.25]]+ ,[[0.0,0.5,-0.5,0.25]+ ,[0.25,0.5,-1/3,0.0]+ ,[1.0,0.5,-1/6,0.5]]]+ cs = map (map (\[f,p,m,a] -> sinOsc ar f p * m + a)) x+ ms = map (map (\[f,w,m,a] -> pulse ar f w * m + a)) y+ [c1,c2,c3,c4,c5,c6] = mceChannels (X.fm7_mx cs ms)+ g3 = linLin (lfSaw kr 0.1 0) (-1) 1 0 (dbAmp (-12))+ g6 = dbAmp (-3)+in mce [c1 + c3 * g3 + c5,c2 + c4 + c6 * g6]
+ Help/Ugen/fmGrain.help.hs view
@@ -0,0 +1,6 @@+-- fmGrain+let t = impulse ar 20 0+ n = linLin (lfNoise1Id 'α' kr 1) (-1) 1 1 10+ s = envSine 9 0.1+ e = envGen kr 1 1 0 1 RemoveSynth s+in X.fmGrain t 0.2 440 220 n * e
+ Help/Ugen/fmGrainB.help.hs view
@@ -0,0 +1,10 @@+-- fmGrainB+let b = control kr "tbl" 10+ t = impulse ar 20 0+ n = linLin (lfNoise1Id 'α' kr 1) (-1) 1 1 10+ s = envSine 9 0.1+ e = envGen kr 1 1 0 1 RemoveSynth s+in X.fmGrainB t 0.2 440 220 n b * e++---- ; alloc table+withSc3 (mapM_ maybe_async [b_alloc 10 512 1,b_gen_sine2 10 [Normalise,Wavetable,Clear] [(0.5,0.1)]])
+ Help/Ugen/fold2.help.hs view
@@ -0,0 +1,5 @@+-- fold2+(fSinOsc ar 1000 0 `fold2` line kr 0 1 8 DoNothing) * 0.1++---- ; drawings+Sound.Sc3.Plot.plot_fn_r1_ln (\x -> fold2 x 1) (-2,2)
+ Help/Ugen/formant.help.hs view
@@ -0,0 +1,21 @@+-- formant ; default values+formant ar 440 1760 880 * 0.125++-- formant ; modulate fundamental frequency, formant frequency stays constant+formant ar (xLine kr 400 1000 8 RemoveSynth) 2000 800 * 0.125++-- formant ; modulate formant frequency, fundamental frequency stays constant+let f = mce [200, 300, 400, 500]+ ff = xLine kr 400 4000 8 RemoveSynth+in splay (formant ar f ff 200) 1 1 0 True * 0.125++-- formant ; modulate width frequency, other frequencies stay constant+let bw = xLine kr 800 8000 8 RemoveSynth+in formant ar 400 2000 bw * 0.1++-- formant ; event control+let f (_,g,x,y,z,o,_,_,_,_,_) =+ let f0 = mce [200, 300, 400, 500] * x+ ff = linExp y 0 1 400 1200+ in splay (formant ar f0 ff 200) 1 (g * z) (o * 2 - 1) True+in mix (voicer 16 f) * control kr "gain" 0.5
+ Help/Ugen/formlet.help.hs view
@@ -0,0 +1,30 @@+-- formlet+formlet (impulse ar 20 0.5) 1000 0.01 0.1++-- formlet+let f = xLine kr 10 400 8 RemoveSynth+in formlet (blip ar f 1000 * 0.1) 1000 0.01 0.1++-- formlet ; modulating formant frequency+let s = blip ar (sinOsc kr 5 0 * 20 + 300) 1000 * 0.1+ ff = xLine kr 1500 700 8 RemoveSynth+in formlet s ff 0.005 0.04++-- formlet ; mouse control of frequency and decay time+let s = blip ar (sinOsc kr 5 0 * 20 + 300) 1000 * 0.1+ x = mouseX kr 0.01 0.2 Exponential 0.2+ y = mouseY kr 700 2000 Exponential 0.2+in formlet s y 0.005 x++-- formlet ; and again (control-rate)+let s = dustId 'α' kr (mce2 10 11)+ x = mouseX kr 0.1 2 Exponential 0.2+ y = mouseY kr 7 200 Exponential 0.2+ f = formlet s y 0.005 x+in k2a f + sinOsc ar (f * 200 + mce2 500 600 - 100) 0 * 0.1++-- formlet ; event control+let f (c,g,x,y,z,o,rx,_,_,_,_) =+ let s = blip ar (sinOsc kr 5 0 * 20 * constant (c + 1) + 300) (2000 * rx)+ in pan2 (formlet s (linExp y 0 1 700 2000) 0.005 (linExp x 0 1 0.01 0.2)) (o * 2 - 1) (g * z)+in mix (voicer 16 f) * control kr "gain" 1
+ Help/Ugen/fos.help.hs view
@@ -0,0 +1,7 @@+-- fos ; same as OnePole+let x = lfTri ar 0.4 0 * 0.99+in fos (lfSaw ar 200 0 * 0.1) (1 - (abs x)) 0 x++-- fos ;same as OneZero+let x = lfTri ar 0.4 0 * 0.99+in fos (lfSaw ar 200 0 * 0.1) (1 - (abs x)) x 0
+ Help/Ugen/frac.help.hs view
@@ -0,0 +1,10 @@+-- frac ; fractional part ; jrhb ; https://www.listarc.bham.ac.uk/lists/sc-users/msg68991.html+let x = mouseX kr (-10) 10 Linear 0.1+ y = mouseY kr 0 5 Linear 0.1+ i = (lfSaw kr 0.062 0 `in_range` (-10,10)) + (y * mce [0 .. 8])+ d = frac i+ a = 0.8 - modDif d 0.5 1+ z1 = gcdE i x + d+ z2 = lcmE i x + d+ freq = (abs (mceTranspose (mce [z1,z2])) + 1) * 120+in mix (sinOsc ar freq 0 * ampComp kr freq 261.625 (1/3)) * a * 0.01
+ Help/Ugen/free.help.hs view
@@ -0,0 +1,5 @@+-- free+let n0 = pinkNoiseId 'α' ar * 0.05+ n1 = dustId 'β' kr 1+in mrg [n0,free n1 (-1)]+
+ Help/Ugen/freeSelf.help.hs view
@@ -0,0 +1,3 @@+-- freeSelf+let n = dustId 'α' kr 0.5+in mrg [sinOsc ar 440 0 * 0.1,freeSelf n]
+ Help/Ugen/freeSelfWhenDone.help.hs view
@@ -0,0 +1,9 @@+-- freeSelfWhenDone ; mouseX is trigger+let x = mouseX kr (-1) 1 Linear 0.1+ e = linen x 1 0.1 1 DoNothing+in mrg [sinOsc ar 440 0 * e,freeSelfWhenDone e]++-- freeSelfWhenDone ; mouseX is trigger ; using RemoveSynth doneAction+let x = mouseX kr (-1) 1 Linear 0.1+ e = linen x 1 0.1 1 RemoveSynth+in sinOsc ar 440 0 * e
+ Help/Ugen/freeVerb.help.hs view
@@ -0,0 +1,14 @@+-- freeVerb2 ; mouse control+let i = impulse ar 1 0+ c = lfCub ar 1200 0+ s = decay i 0.25 * c * 0.1+ x = mouseX kr 0 1 Linear 0.1+ y = mouseY kr 0 1 Linear 0.1+in freeVerb s y x 0.5++-- freeVerb2 ; process input channels ; warning=feedback+let i = soundIn (mce2 0 1)+ c = mceChannel+ x = mouseX kr 0 1 Linear 0.1+ y = mouseY kr 0 1 Linear 0.1+in freeVerb2 (c 0 i) (c 1 i) y x 0.5
+ Help/Ugen/freezer.help.hs view
@@ -0,0 +1,80 @@+-- freezer ; check buffer+let b = control kr "buf" 100+ s = bufRateScale kr b+in playBuf 1 ar b s 1 0 NoLoop RemoveSynth * 0.1++-- freezer ; static instance+let b = control kr "buf" 100+in X.freezer b 0.35 0.4 0.6 0.1 0.05 0.02 0.1 0 0 6++-- freezer ; static instance+let b = control kr "buf" 100+in X.freezer b 0.3 0.4 0.6 1 0 0 0 0 0 6++-- freezer ; static instance+let b = control kr "buf" 100+in X.freezer b 0.3 0.7 0.6 0.35 0 0.5 0.5 0 0 6++-- freezer ; static instance+let b = control kr "buf" 100+in X.freezer b 0.2500 0.2505 0.1 1 0 0.050 0.005 0 0 24++-- freezer ; k-rate instance+let b = control kr "buf" 100+ n f i j = linLin (lfNoise2 kr f) (-1) 1 i j+ left = n 1 0.3 0.8+ right = left + n 1 0.01 0.05+in X.freezer b left right 0.1 0.5 0.1 0.5 0.05 0 0 24++-- freezer ; k-rate instance ; id+let b = control kr "buf" 100+ nId z f i j = linLin (lfNoise2Id z kr f) (-1) 1 i j+ left = nId 'α' 1 0.3 0.8+ right = left + nId 'β' 1 0.01 0.05+in X.freezer b left right 0.1 0.5 0.1 0.5 0.05 0 0 24++-- freezer ; k-rate instance+let b = control kr "buf" 100+ n i j = linLin (lfNoise2 kr 0.1) (-1) 1 i j+in X.freezer b (n 0.3 0.4) (n 0.5 0.6) (n 0.3 0.6) (n 0.95 1.05) (n 0.05 0.15) (n 0.05 0.15) (n 0.05 0.15) 0 0 36++-- freezer ; k-rate instance ; id+let b = control kr "buf" 100+ nId z i j = linLin (lfNoise2Id z kr 0.1) (-1) 1 i j+in X.freezer b (nId 'α' 0.3 0.4) (nId 'β' 0.5 0.6) (nId 'γ' 0.3 0.6) (nId 'δ' 0.95 1.05) (nId 'ε' 0.05 0.15) (nId 'ζ' 0.05 0.15) (nId 'η' 0.05 0.15) 0 0 36++-- freezer ; controls+let b = control_m kr "buf" 100 (0,0,"lin")+ (lhs,rhs) = control_rng kr "wnd" (0,1) (0,1,"lin")+ amp = control_m kr "amp" 0.1 (0,1,"amp")+ incr = control_m kr "incr" 1 (0,4,"lin")+ incrO = control_m kr "incrO" 0 (0,1,"lin")+ incrR = control_m kr "incrR" 0 (0,1,"lin")+ wndR = control_m kr "wndR" 0 (0,1,"lin")+ syncPh = control_m kr "syncPh" 0 (0,1,"trigger")+ randPh = control_m kr "randPh" 0 (0,1,"trigger")+ dgr = control_m kr "numLp" 24 (1,64,"lin")+in X.freezer b lhs rhs amp incr incrO incrR wndR syncPh randPh dgr++---- ; allocate buffer 100, required for examples+import Sound.Sc3.Server.Command.MemCpy {- sc3-rdu -}+ld fn = b_allocReadOrSend 100 (sfResolve fn) 0 0 >>= (withSc3 . async)+ld "instr/crotales/crotale05(D).wav"+ld "saron-panerus-S-0-5.flac"+ld "saron-panerus-S-0-6.flac"+ld "saron-barung-S-0-1.flac"+ld "saron-demung-S-1-3.flac"+ld "saron-demung-S-1-5.flac"+ld "saron-demung-S-1-6.flac"+ld "bonang-barung-S-0-2.flac"+ld "bonang-barung-S-2-1.flac"+ld "gender-barung-S-1-2.flac"+ld "gender-barung-S-2-5.flac"+ld "gender-barung-S-3-3.flac"++{---- ; RFreeze ; concurrent loops at a signal buffer++Create a set of concurrent loops at a signal buffer. This is the+dynamic and gestural variant of RLoopSet. It was written after+reading the manual for the Grm Tools 'Freeze' plugin.+-}
+ Help/Ugen/freqShift.help.hs view
@@ -0,0 +1,31 @@+-- freqShift ; shifting a 100Hz tone by 1 Hz rising to 500Hz+let i = sinOsc ar 100 0+ s = xLine kr 1 500 5 RemoveSynth+in freqShift i s 0 * 0.1++-- freqShift ; Shifting a complex tone by 1 Hz rising to 500Hz+let d = klangSpec [101, 303, 606, 808] [1, 1, 1, 1] [1, 1, 1, 1]+ i = klang ar 1 0 d+ s = xLine kr 1 500 5 RemoveSynth+in freqShift i s 0 * 0.1++-- freqShift ; Modulating shift and phase+let s = lfNoise2Id 'α' ar 0.3+ i = sinOsc ar 10 0+ p = linLin (sinOsc ar 500 0) (-1) 1 0 (2 * pi)+in freqShift i (s * 1500) p * 0.1++-- freqShift ; Shifting bandpassed noise+let n1 = whiteNoiseId 'α' ar+ n2 = lfNoise0Id 'β' ar 5.5+ i = bpf n1 1000 0.001+ s = n2 * 1000+in freqShift i s 0 * 32++-- freqShift+let e = lfGauss ar 4 (1/8) 0 Loop DoNothing+ o = blip ar 60 4 * e+ a = o / 4 + localIn 2 ar 0+ s = freqShift a (lfNoise0Id 'α' kr (1/4) * 90) 0+ z = delayC s 1 0.1 * 0.9+in mrg2 s (localOut z)
+ Help/Ugen/friction.help.hs view
@@ -0,0 +1,30 @@+-- friction ; filters a sine wave ; chaotic result+let o = sinOsc ar 660 0+ s = X.friction ar o 0.0000541322 0.414 0.313 8.05501 1.0+in pan2 s 0 0.1++-- friction ; mouse control+let o = lag (sinOsc ar ((lfPulse kr 0.5 0 0.5 + lfPulse kr 0.33 0 0.5) * 440 + 220) 0) 0.1+ x = mouseX kr 0.00001 0.03 Exponential 0.2+ y = mouseY kr 0.2 10 Exponential 0.2+ s = X.friction ar o x 0.414 0.313 y 1.0+in (mce2 o s) * 0.5++-- friction ; control rate+let s = lfPar kr 33 0 + mouseX kr 0.01 10 Exponential 0.2+ y = mouseY kr 0 1 Linear 0.2+ o = X.friction kr s 0.0000541322 y 0.318 8.05501 1.0+in pan2 (sinOsc ar (o * 350 + 150) 0) 0 0.1++-- friction ; event control+let f (_,w,x,y,z,o,_,_,_,_,_) =+ let im = trig1 (k2a w) sampleDur * 0.1+ kl = ringz im (x * mce [800, 1071, 1153, 1723]) 1+ ru = X.friction ar kl (y * 0.000175584) 0.414 0.313 2.69789 1.0+ in pan2 (mix ru) (o * 2 - 1) 1+in mix (voicer 16 f) * control kr "gain" 1++-- mutantsounds 05 https://swiki.hfbk-hamburg.de/MusicTechnology/899+let x = mceFillInt 5 (\i -> clip (lfNoise2Id i kr 3) 0 1 * 0.03 + 0.00001)+ s = X.friction ar (lfTri ar 50 0) x 0.414 0.313 (x * 30000) 1+in splay s 1 1 0 True
+ Help/Ugen/gVerb.help.hs view
@@ -0,0 +1,17 @@+-- gVerb ; mono reverb+let i = impulse ar (mce2 1 2) 0+ c = lfCub ar (mce2 900 1200) 0+ s = decay i (mce2 0.05 0.25) * c * 0.05+in mix (gVerb s 10 3 0.5 0.5 15 1 0.7 0.5 300)++-- gVerb ; controls+let roomsize = control kr "roomsize" 10.0+ revtime = control kr "revtime" 3.0+ damping = control kr "damping" 0.5+ inputbw = control kr "inputbw" 0.5+ spread = control kr "spread" 15.0+ drylevel = control kr "drylevel" 1.0+ earlyreflevel = control kr "earlyreflevel" 0.7+ taillevel = control kr "taillevel" 0.5+ maxroomsize = control kr "maxroomsize" 300.0+in gVerb (soundIn 0) roomsize revtime damping inputbw spread drylevel earlyreflevel taillevel maxroomsize
+ Help/Ugen/gammatone.help.hs view
@@ -0,0 +1,101 @@+-- gammatone+X.gammatone (whiteNoiseId 'α' ar) 440 200 * 0.5++-- gammatone ; sweeping frequency of sine input+X.gammatone (sinOsc ar (mouseX kr 100 2000 Linear 0.2) 0) 1000 500 * 0.5++-- gammatone ; filters centered on 88 piano keys+let freqs = take 88 (map midiCps [21..])+ to_bw f = 24.7 * (f * 0.00437 + 1)+ bandwidths = map to_bw freqs+ -- calculated from ISO2002 100dB phon curve as approximation to sensitivity of outer ear+ outereargain = [0.080993772688853+ ,0.089237063418603+ ,0.097970525722848+ ,0.10876266808815+ ,0.12105360022674+ ,0.13407538922284+ ,0.14787149408674+ ,0.16167718172822+ ,0.17551213214451+ ,0.19016975152285+ ,0.20569895830538+ ,0.22220242493157+ ,0.2397154127401+ ,0.2582697769952+ ,0.27792744116278+ ,0.29856170337058+ ,0.32031587344117+ ,0.34336361377938+ ,0.36778184407609+ ,0.39203618886184+ ,0.41615498938524+ ,0.44170796842+ ,0.46878040665827+ ,0.49446634124901+ ,0.52001934250193+ ,0.54709180427952+ ,0.57577407840633+ ,0.60165721569576+ ,0.62782392863276+ ,0.6555465952902+ ,0.68491773749099+ ,0.72411898089945+ ,0.77354432147194+ ,0.82590864573464+ ,0.88138671475204+ ,0.90157113760596+ ,0.90157113760596+ ,0.90157113760596+ ,0.90157113760596+ ,0.91510438365248+ ,0.93321426408541+ ,0.95240101404735+ ,0.97272866753273+ ,0.98926474289463+ ,1.0053814152966+ ,1.0224564349105+ ,1.0405467880267+ ,1.052760426677+ ,1.061847894439+ ,1.071475731154+ ,1.0816760688321+ ,1.0839269140212+ ,1.0839269140212+ ,1.0839269140212+ ,1.0839269140212+ ,1.0817917022137+ ,1.0789305551391+ ,1.0758992754061+ ,1.0726877464002+ ,1.0605734918597+ ,1.0429115831426+ ,1.0241994426808+ ,1.0043746204451+ ,0.95672713285027+ ,0.89882037142901+ ,0.83747029478932+ ,0.77247215275345+ ,0.75895909569467+ ,0.74934344623004+ ,0.73915602049396+ ,0.72836281890006+ ,0.75972195442662+ ,0.81665861045357+ ,0.87698089623035+ ,0.94089013177825+ ,1.022563004048+ ,1.1129841925092+ ,1.2087821046319+ ,1.3102764570426+ ,1.3485952672556+ ,1.3833144995125+ ,1.4200982447533+ ,1.4590692653081+ ,1.4180204618623+ ,1.3674299412878+ ,1.3138311518147+ ,1.2570452124657+ ,1.1677392221542]+in mix (X.gammatone (whiteNoiseId 'α' ar) (mce freqs) (mce bandwidths) * mce outereargain)+
+ Help/Ugen/gate.help.hs view
@@ -0,0 +1,2 @@+-- gate+let t = lfPulse ar 1 0 0.1 in gate (fSinOsc ar 500 0 * 0.25) t
+ Help/Ugen/gateReset.help.hs view
@@ -0,0 +1,6 @@+-- gateReset+let gt = 1+ tr = trig1 (dustId 'α' kr 1) 0+ e = envGen kr (gateReset gt tr) 1 0 1 DoNothing (envPerc 0.01 1)+in sinOsc ar 440 0 * e * 0.1+
+ Help/Ugen/gaussTrig.help.hs view
@@ -0,0 +1,6 @@+-- gaussTrig+let x = mouseX kr 0 0.9 Linear 0.2+ t1 = X.gaussTrig kr 10 x * abs (whiteNoiseId 'α' kr) * 0.5+ t2 = dustId 'β' kr 10 * 0.5+ n = pinkNoiseId 'γ' ar * decay (mce2 t1 t2) 0.02 * 0.5+in fold2 (ringz n 2000 0.02) 0.5
+ Help/Ugen/gbmanL.help.hs view
@@ -0,0 +1,1 @@+---- c.f. GbmanN
+ Help/Ugen/gbmanN.help.hs view
@@ -0,0 +1,15 @@+-- gbmanN ; default initial params+let x = mouseX kr 20 sampleRate Linear 0.2+in gbmanN ar x 1.2 2.1 * 0.05++-- gbmanN ; change initial params+let x = mouseX kr 20 sampleRate Linear 0.2+in gbmanN ar x (-0.7) (-2.7) * 0.05++-- gbmanN ; wait+let x = mouseX kr 20 sampleRate Linear 0.2+in gbmanN ar x 1.2 2.0002 * 0.05++-- gbmanN ; as a frequency control+let f = gbmanN ar 40 1.2 2.1 * 400 + 500+in sinOsc ar f 0 * 0.1
+ Help/Ugen/gcd.help.hs view
@@ -0,0 +1,19 @@+-- gcd+let x = mouseX kr (-200) 200 Linear 0.2+ y = mouseY kr (-200) 200 Linear 0.2+in sinOsc ar ((sinOsc kr 0.3 0 * 20) `gcdE` mce2 x y * 30 + 500) 0 * 0.1++-- https://www.listarc.bham.ac.uk/lists/sc-users/msg68916.html (jrhb)+let a = lfSaw ar 0.02 0 * 300 + 1+ b = lfSaw ar (1.24 + mce2 0 0.1) 0 * 200 + 1+in sinOsc ar (gcdE a b * 30 + 300) 0 * 0.1++-- https://www.listarc.bham.ac.uk/lists/sc-users/msg68916.html (jrhb)+let a = lfSaw ar 0.012 0 * 300 + 1+ b = lfSaw ar (0.24 + mce2 0 0.01) 0 * 200 + 1+in sinOsc ar (gcdE a b * 30 + 300) 0 * 0.1++-- https://www.listarc.bham.ac.uk/lists/sc-users/msg68916.html (jrhb)+let a = lfSaw kr 0.002 0 * 300 + 1+ b = lfSaw kr (0.024 + mce2 0 0.001) 0 * 200 + 1+in sinOsc ar (gcdE a b * 43 + 300) 0 * 0.1
+ Help/Ugen/gendy1.help.hs view
@@ -0,0 +1,80 @@+-- gend1 ; sc3 default parameters+gendy1Id 'α' ar 1 1 1 1 440 660 0.5 0.5 12 12 * 0.15++-- gendy1 ; wandering bass+gendy1Id 'α' ar 1 1 1.0 1.0 30 100 0.3 0.05 5 5 * 0.15++-- gendy1 ; play me+let x = mouseX kr 100 1000 Exponential 0.1+ g = gendy1Id 'α' ar 1 1 1.0 1.0 30 100 0.3 0.05 5 5+in rlpf g 500 0.3 * 0.1++-- gendy1 ; scream+let x = mouseX kr 220 440 Exponential 0.1+ y = mouseY kr 0.0 1.0 Linear 0.1+in gendy1Id 'α' ar 2 3 1 1 x (8 * x) y y 7 7 *0.3++-- gendy1 ; 1 CP = random noise+gendy1Id 'α' ar 1 1 1 1 440 660 0.5 0.5 1 1 * 0.15++-- gendy1 ; 2 CPs = an oscillator+gendy1Id 'α' ar 1 1 1 1 440 660 0.5 0.5 2 2 * 0.15++-- gendy1 ; used as an LFO+let ad = sinOsc kr 0.10 0 * 0.49 + 0.51+ dd = sinOsc kr 0.13 0 * 0.49 + 0.51+ as = sinOsc kr 0.17 0 * 0.49 + 0.51+ ds = sinOsc kr 0.19 0 * 0.49 + 0.51+ g = gendy1Id 'α' kr 2 4 ad dd 3.4 3.5 as ds 10 10+in sinOsc ar (g * 50 + 350) 0 * 0.3++-- gendy1 ; wasp+let ad = sinOsc kr 0.1 0 * 0.1 + 0.9+in gendy1Id 'α' ar 0 0 ad 1.0 50 1000 1 0.005 12 12 * 0.2++-- gendy1 ; modulate distributions ; distributions change the duration structure and spectrum+let x = mouseX kr 0 7 Linear 0.1+ y = mouseY kr 0 7 Linear 0.1+in gendy1Id 'α' ar x y 1 1 440 660 0.5 0.5 12 12 * 0.2++-- gendy1 ; modulate number of CPs+let x = mouseX kr 1 13 Linear 0.1+in gendy1Id 'α' ar 1 1 1 1 440 660 0.5 0.5 12 x * 0.2++-- gendy1 ; self modulation+let x = mouseX kr 1 13 Linear 0.1+ y = mouseY kr 0.1 10 Linear 0.1+ g0 = gendy1Id 'α' ar 5 4 0.3 0.7 0.1 y 1.0 1.0 5 5+in gendy1Id 'α' ar 1 1 1 1 440 (g0 * 500 + 600) 0.5 0.5 12 x * 0.2++-- gendy1 ; use SINUS to track oscillator and take CP positions from it ; use adParam and ddParam+let p = lfPulse kr 100 0 0.4+ s = sinOsc kr 30 0 * 0.5+in gendy1Id 'α' ar 6 6 p s 440 660 0.5 0.5 12 12 * 0.2++-- gendy1 ; near the corners are interesting+let x = mouseX kr 0 200 Linear 0.1+ y = mouseY kr 0 200 Linear 0.1+ p = lfPulse kr x 0 0.4+ s = sinOsc kr y 0 * 0.5+in gendy1Id 'α' ar 6 6 p s 440 660 0.5 0.5 12 12 * 0.2++-- gendy1 ; texture+let node e = let f = randId e 130 160.3+ r0 = randId ('α',e) 0 6+ r1 = randId ('β',e) 0 6+ l = randId e (-1) 1+ ad = sinOsc kr 0.10 0 * 0.49 + 0.51+ dd = sinOsc kr 0.13 0 * 0.49 + 0.51+ as = sinOsc kr 0.17 0 * 0.49 + 0.51+ ds = sinOsc kr 0.19 0 * 0.49 + 0.51+ g = gendy1Id 'γ' ar r0 r1 ad dd f f as ds 12 12+ o = sinOsc ar (g * 200 + 400) 0+ in pan2 o l 0.1+in mix (mce (map node (id_seq 10 'δ')))++-- gendy1 ; try durscale 10 and 0 too+let x = mouseX kr 10 700 Linear 0.1+ y = mouseY kr 50 1000 Linear 0.1+ g = gendy1Id 'α' ar 2 3 1 1 1 x 0.5 0.1 10 10+in combN (resonz g y 0.1) 0.1 0.1 5 * 0.6
+ Help/Ugen/grainBuf.help.hs view
@@ -0,0 +1,40 @@+-- grainBuf ; requires=buf+let (buf, nc) = (control kr "buf" 100, 2)+ dur = 15+ lin a b = line kr a b dur RemoveSynth+ tr = impulse kr (lin 7.5 15) 0+ gd = lin 0.05 0.1+ r = lin 1 0.5 {- rate -}+ i = lin 0 1 {- read-location -}+ l = lin (-0.5) 0.5 {- stereo-location -}+in grainBuf nc tr gd buf r i 2 l (-1) 512 * control kr "gain" 0.25++-- grainBuf ; requires=buf ; mouse control+let (buf, nc) = (control kr "buf" 100, 2)+ e = -1+ x = mouseX kr (-1) 1 Linear 0.1+ y = mouseY kr 10 45 Linear 0.1+ i = impulse kr y 0+ r = linLin (lfNoise1Id 'α' kr 500) (-1) 1 0.5 2+ p = linLin (lfNoise2Id 'β' kr 0.1) (-1) 1 0 1+in grainBuf 2 i 0.1 buf r p 2 x e 512 * control kr "gain" 0.25++-- grainBuf ; requires=buf ; event control+let f (_,g,x,y,z,o,rx,ry,_,_,_) =+ let (buf, nc) = (control kr "buf" 100, 2)+ e = -1+ tr = impulse ar (y * 60 + 10) 0+ in grainBuf nc tr (ry * 0.5) buf (1 + (rx * 0.1)) x 2 o e 512 * z * g+in mix (voicer 16 f) * control kr "gain" 2++---- ; load buffer+ld fn = withSc3 (async (b_allocRead 0 (sfResolve fn) 0 0))+ld "pf-c5.aif" -- mono+ld "metal.wav" -- mono+ld "instr/celeste/long/13-C4-long.wav" -- mono+ld "instr/celeste/long/25-C5-long.wav"+ld "instr/celeste/long/37-C6-long.wav"+ld "instr/celeste/long/49-C7-long.wav"++fn = "/home/rohan/uc/the-center-is-between-us/visitants/flac/f/y.flac"+withSc3 (async (b_allocRead 0 fn (48000 * 45) (48000 * 1)))
+ Help/Ugen/grainFM.help.hs view
@@ -0,0 +1,26 @@+-- grainFM+let d = 15+ lin a b = line kr a b d RemoveSynth+ l = lin (-0.5) 0.5+ f = lin 200 800+ t = impulse kr (lin 7.5 15) 0+ i = lin (-1) 1+in grainFM 2 t 0.1 f 200 i l (-1) 512 * 0.1++-- grainFM ; mouse control+let n1 = whiteNoiseId 'α' kr+ n2 = lfNoise1Id 'β' kr 500+ x = mouseX kr (-0.5) 0.5 Linear 0.1+ y = mouseY kr 0 400 Linear 0.1+ f = n1 * y + 440+ t = impulse kr 12.5 0+ i = linLin n2 (-1) 1 1 10+in grainFM 2 t 0.1 f 200 i x (-1) 512 * 0.1++-- grainFM ; event control+let f (_,g,x,y,z,o,rx,ry,p,px,_) =+ let tr = impulse ar (y * 64 + 10) 0+ cf = midiCps (p * 127 + px)+ mf = (cf * 1.5) + ((1 - x) * z * cf)+ in grainFM 2 tr (ry * 0.25) cf mf (1 + (rx * 0.25)) o (-1) 512 * z * lagUD g 0 2+in mix (voicer 16 f) * control kr "gain" 0.5
+ Help/Ugen/grainIn.help.hs view
@@ -0,0 +1,5 @@+-- grainIn ; warning=feedback+let x = mouseX kr (-0.5) 0.5 Linear 0.1+ y = mouseY kr 5 25 Linear 0.1+ t = impulse kr y 0+in grainIn 2 t 0.1 (soundIn 0 + pinkNoiseId 'α' ar * 0.05) x (-1) 512 * 0.5
+ Help/Ugen/grainSin.help.hs view
@@ -0,0 +1,26 @@+-- grainSin ; mouse control+let n = whiteNoiseId 'α' kr+ x = mouseX kr (-0.5) 0.5 Linear 0.1+ y = mouseY kr 0 400 Linear 0.1+ f = n * y + 440+ t = impulse kr 10 0+in grainSin 2 t 0.1 f x (-1) 512 * 0.1++-- grainSin ; f0 https://www.listarc.bham.ac.uk/lists/sc-users/msg66911.html+let k = 16+ t = impulse ar (mouseY kr 1 999 Linear 0.2) 0+ f i = ((fromIntegral i ** range_hs (0.3,0.7) (lfNoise0Id i kr 1)) + 1) * 99+ l = mce (map f [0::Int .. k - 1])+in grainSin 2 t (mouseX kr 0.001 0.5 Exponential 0.2) (tChooseId 'α' t l) 0 (-1) 512 * 0.1++-- grainSin ; event control+let f (_,g,_,y,z,o,rx,ry,p,_,_) =+ let tr = impulse ar (linLin y 0 1 6 72) 0+ du = linLin rx 0 1 0.01 0.15+ in grainSin 2 tr du (midiCps ((p * 127) + (ry * 2 - 1))) (o * 2 - 1) (-1) 512 * z * g+in mix (voicer 16 f) * control kr "gain" 1++-- grainSin ; mouse control+let overlap = mouseY kr 0 2 Linear 0.2+ f = mouseX kr 1 220 Linear 0.2+in grainSin 2 (impulse ar f 0) (overlap / f) 440 0 (-1) 512 * 0.1
+ Help/Ugen/grayNoise.help.hs view
@@ -0,0 +1,6 @@+-- grayNoise+grayNoiseId 'α' ar * 0.1++---- ; drawings+Sound.Sc3.Plot.plot_ugen1 0.025 (grayNoiseId 'γ' ar)+Sound.Sc3.Plot.Fft.plot_ugen_fft1 0.1 (grayNoiseId 'γ' ar)
+ Help/Ugen/greater_than.help.hs view
@@ -0,0 +1,3 @@+-- greater_than ; c.f. equal_to ; trigger an envelope+let e = envGen kr (sinOsc ar 1 0 `greater_than` 0) 1 0 1 DoNothing (envPerc 0.01 1)+in sinOsc ar 440 0 * e * 0.1
+ Help/Ugen/greyholeRaw.help.hs view
@@ -0,0 +1,3 @@+-- greyholeRaw+let (i1,i2) = (soundIn 0,soundIn 1)+in X.greyholeRaw i1 i2 0.0 2.0 0.5 0.9 0.1 2.0 1.0
+ Help/Ugen/hairCell.help.hs view
@@ -0,0 +1,5 @@+-- hairCell ; constantly self oscillates at 5 Hz+pan2 (X.hairCell (soundIn 0) 5.0 100 1000 0.99) 0 0.1++-- hairCell+pan2 (X.hairCell (saw ar (mouseX kr 1 10 Linear 0.2)) 0 (mouseY kr 0 10000 Linear 0.2) 1000 0.99) 0 0.5
+ Help/Ugen/harmonicOsc.help.hs view
@@ -0,0 +1,13 @@+-- harmonicOsc+let modulator = sinOsc kr 0.1 0+ freq = modulator `in_exprange` (10,1000)+ firstharmonic = 3+ amplitudes = X.randNId 16 'β' 0.01 0.1+ sig = X.harmonicOsc ar freq firstharmonic amplitudes+in pan2 sig modulator 0.2++-- harmonicOsc ; event control+let f (_,g,x,_,z,o,_,_,_,_,_) =+ let amplitudes = X.tRandNId 16 'α' 0.01 0.1 g+ in pan2 (X.harmonicOsc ar (midiCps (x * 25 + 36)) 1 amplitudes) (o * 2 - 1) (g * z)+in mix (voicer 16 f) * control kr "gain" 0.5
+ Help/Ugen/hasher.help.hs view
@@ -0,0 +1,11 @@+-- hasher ; noise+hasher (line ar 0 1 1 RemoveSynth) * 0.2++-- hasher ; remap x+let x = mouseX kr 0 10 Linear 0.2+ f = hasher (roundTo x 1) * 300 + 500+in sinOsc ar f 0 * 0.1++---- ; drawings+Sound.Sc3.Plot.plot_ugen_nrt (400,1) 1.0 (hasher (line ar 0 1 1 RemoveSynth))+
+ Help/Ugen/henonC.help.hs view
@@ -0,0 +1,1 @@+---- c.f. henonN
+ Help/Ugen/henonL.help.hs view
@@ -0,0 +1,1 @@+---- c.f. henonN
+ Help/Ugen/henonN.help.hs view
@@ -0,0 +1,29 @@+-- henonN ; with Sc3 default initial parameters+let x = mouseX kr 20 sampleRate Linear 0.1+in henonN ar x 1.4 0.3 0 0 * 0.1++-- henonN ; with mouse-control of parameters+let x = mouseX kr 1 1.4 Linear 0.1+ y = mouseY kr 0 0.3 Linear 0.1+in henonN ar (sampleRate / 4) x y 0 0 * 0.1++-- henonN ; with randomly modulated parameters+let n0 = lfNoise2Id 'α' kr 1 * 0.20 + 1.20+ n1 = lfNoise2Id 'β' kr 1 * 0.15 + 0.15+in henonN ar (sampleRate / 8) n0 n1 0 0 * 0.1++-- henonN ; as a frequency control+let x = mouseX kr 1 1.4 Linear 0.1+ y = mouseY kr 0 0.3 Linear 0.1+ f0 = 40+ f = henonN ar f0 x y 0 0 * 800 + 900+in sinOsc ar f 0 * 0.4++---- ; drawings+Sound.Sc3.Plot.plot_ugen1 0.1 (henonN ar 2500 1.4 0.3 0 0 * 0.1)++---- ; haskell+import qualified Sound.Sc3.Common.Math.Noise as Math {- hsc3 -}+henon_hs a b = map snd (iterate (Math.henon_f a b) (0.0,0.0))+Sound.Sc3.Plot.plot_p1_ln [take 600 (henon_hs 1.4 0.3)]+Sound.Sc3.Plot.plot_ugen_nrt (600,1) 1.0 (henonN ar 600 1.4 0.3 0 0)
+ Help/Ugen/hilbert.help.hs view
@@ -0,0 +1,3 @@+-- hilbert+hilbert (sinOsc ar 100 0) * 0.1+
+ Help/Ugen/hilbertFIR.help.hs view
@@ -0,0 +1,2 @@+-- hilbertFir+hilbertFIR (sinOsc ar 100 0 * dbAmp (-20)) (localBufId 'α' 2048 1)
+ Help/Ugen/hpf.help.hs view
@@ -0,0 +1,9 @@+-- hpf+let f = fSinOsc kr (xLine kr 0.7 300 20 RemoveSynth) 0 * 3600 + 4000+in hpf (saw ar 200 * 0.1) f++-- hpf ; cutoff at one hertz+hpf (whiteNoiseId 'α' ar) 1 * 0.1++---- ; drawings+Sound.Sc3.Plot.FFT.plot_ugen_fft1 0.05 (hpf (whiteNoiseId 'α' ar) 12000)
+ Help/Ugen/hpz1.help.hs view
@@ -0,0 +1,15 @@+-- hpz1 ; violet noise (one point difference of white noise)+hpz1 (whiteNoiseId 'α' ar) * 0.1++-- hpz1 ; blue noise (one point difference of pink noise)+hpz1 (pinkNoiseId 'α' ar) * 0.2++-- hpz1 ; detect changes in a signal (see also hpz2)+let n = lfNoise0Id 'α' ar 1000+ h = hpz1 n+in mce [h,h `greater_than` 0,abs h `greater_than` 0]++---- ; drawings+Sound.Sc3.Plot.FFT.plot_ugen_fft1 0.05 (hpz1 (whiteNoiseId 'α' ar))++
+ Help/Ugen/hpz2.help.hs view
@@ -0,0 +1,2 @@+-- hpz2+hpz2 (whiteNoiseId 'α' ar) * 0.1
+ Help/Ugen/hypot.help.hs view
@@ -0,0 +1,21 @@+-- hypot+let x = mouseX kr 0 0.1 Linear 0.1+ y = mouseY kr 0 0.1 Linear 0.1+in sinOsc ar 440 0 * hypot x y++-- hypot ; object travels 200 meters in 6 secs (=120kph) passing 10 meters from the listener+let x = 10+ y = lfSaw kr (1 / 6) 0 * 100+ d = hypot x y+ a = 10 / (squared d)+ v = slope d+ r = (344 - v) / 344 -- the speed of sound is 344 meters/sec+in fSinOsc ar (1000 * r) 0 * a++-- hypot+let x = 10+ y = lfSaw kr (1 / 6) 0 * 100+ d = hypot x y+ a = 40 / (squared d)+ s = rlpf (fSinOsc ar 200 0 * lfPulse ar 31.3 0 0.4) 400 0.3+in delayL s (110 / 344) (d / 344) * a
+ Help/Ugen/iEnvGen.help.hs view
@@ -0,0 +1,31 @@+-- iEnvGen+let e = let l = [0,0.6,0.3,1.0,0]+ t = [0.1,0.02,0.4,1.1]+ c = [EnvLin,EnvExp,EnvNum (-6),EnvSin]+ in Envelope l t c Nothing Nothing 0+ x = mouseX kr 0 (envelope_duration e) Linear 0.2+ g = iEnvGen kr x e+in sinOsc ar (g * 500 + 440) 0 * 0.1++-- iEnvGen ; index with sinOsc ; mouse controls amplitude ; offset negative values of SinOsc+let e = let l = [-1,-0.7,0.7,1]+ t = [0.8666,0.2666,0.8668]+ c = [EnvLin,EnvLin]+ in Envelope l t c Nothing Nothing (-1)+ x = mouseX kr 0 1 Linear 0.2+ o = (sinOsc ar 440 0) * x+in iEnvGen ar o e * 0.1++-- iEnvGen ; index with amplitude of input ; control freq of SinOsc+let e = envXyc [(0, 330, EnvExp), (0.5, 440, EnvExp), (1.0, 1760, EnvLin)]+ pt = amplitude ar (soundIn 0) 0.01 0.2+in sinOsc ar (iEnvGen kr pt e) 0 * 0.2++-- iEnvGen ; using line to generate time signal ; ie. time can move faster and start near the end+let param = envPairs [(0,110),(4,220),(9,440),(11,220),(13,880),(19,110),(23,55),(27,55)] EnvExp+ (start,end,scale) = (11,27,1.5)+ time = line kr start end ((end - start) / scale) DoNothing+ freq = iEnvGen kr time param+ print_time = poll (impulse kr 1 0) time 0 (label "time")+ print_freq = poll (impulse kr 1 0) freq 0 (label "freq")+in mrg [pan2 (sinOsc ar 220 0 + sinOsc ar freq 0) 0 0.1,print_time,print_freq]
+ Help/Ugen/iRand.help.hs view
@@ -0,0 +1,4 @@+-- iRand+let f = iRandId 'α' 200 1200+ e = line kr 0.2 0 0.1 RemoveSynth+in fSinOsc ar f 0 * e
+ Help/Ugen/iRandN.help.hs view
@@ -0,0 +1,17 @@+-- riRandN ; two channel sin tones ; harmonic series+sinOsc ar (55 * X.randN 2 1 17) 0 * 0.1++-- riRandN ; 5-channel sin tones ; harmonic series+splay (sinOsc ar (55 * X.randN 15 1 5) 0) 1 0.1 0 True++-- riRandN ; 15-channel sin tones ; harmonic series+splay (sinOsc ar (55 * X.randN 12 1 17) 0) 1 0.1 0 True++-- riRandN ; two channel sin tones ; harmonic series ; id+sinOsc ar (55 * X.randNId 2 'α' 1 17) 0 * 0.1++-- riRandN ; 5-channel sin tones ; harmonic series ; id+splay (sinOsc ar (55 * X.randNId 15 'α' 1 5) 0) 1 0.1 0 True++-- riRandN ; 15-channel sin tones ; harmonic series ; id+splay (sinOsc ar (55 * X.randNId 12 'α' 1 17) 0) 1 0.1 0 True
+ Help/Ugen/ifft.help.hs view
@@ -0,0 +1,9 @@+-- ifft ; no modification+let z = whiteNoiseId 'α' ar+ c = fft (localBufId 'β' 1 2048) z 0.5 0 1 0+in ifft c 0 0 * 0.05++-- ifft ; variants with the default parameters+let z = whiteNoiseId 'α' ar+ c = fft' (localBufId 'β' 1 2048) z+in ifft' c * 0.05
+ Help/Ugen/iirFilter.help.hs view
@@ -0,0 +1,7 @@+-- iirFilter+let x = mouseX kr 20 12000 Exponential 0.2+ y = mouseY kr 0.01 1 Linear 0.2+ o = lfSaw ar (mce [x * 0.99,x * 1.01]) 0 * 0.1+ freq = sinOsc kr (sinOsc kr 0.1 0) (1.5 * pi) * 1550 + 1800+ s = X.iirFilter o freq y+in combN s 0.5 (mce2 0.4 0.35) 2 * 0.4 + s * 0.5
+ Help/Ugen/impulse.help.hs view
@@ -0,0 +1,21 @@+-- impulse ; note SC2 had no phase input+impulse ar 800 0 * 0.1++-- impulse+let f = xLine kr 800 10 5 RemoveSynth+in impulse ar f 0.0 * 0.1++-- impulse+let f = mouseY kr 4 8 Linear 0.1+ x = mouseX kr 0 1 Linear 0.1+in impulse ar f (mce [0,x]) * 0.1++-- impulse ; frequency 0 returns a single impulse+decay (impulse ar 0 0) 1 * brownNoiseId 'α' ar * 0.1++-- impulse ; non-bandlimited+let f = sinOsc ar 0.25 0.0 * 2500.0 + 2505.0+in impulse ar f 0.0 * 0.1++---- ; drawings+Sound.Sc3.Plot.plot_ugen_nrt (48000,64) 1.0 (impulse ar 10 0)
+ Help/Ugen/in.help.hs view
@@ -0,0 +1,40 @@+-- in ; patching input to output (see also soundIn) ; in haskellId 'in' is a reserved keyword+in' 2 ar numOutputBuses++-- in ; patching input to output, with delay+let i = in' 2 ar numOutputBuses+ d = delayN i 0.5 0.5+in i + d++-- in ; write noise to first private bus, then read it out ; the multiple root graph is ordered+let n = pinkNoiseId 'α' ar * 0.1+ b = numOutputBuses + numInputBuses+ wr = out b n+ rd = out 0 (in' 1 ar b)+in mrg [rd,wr]++-- in ; there are functions to encapsulate the offset calculation, c.f. firstPrivateBus+let n = pinkNoiseId 'α' ar+ wr = privateOut 0 (n * 0.1)+ rd = out 0 (privateIn 1 ar 0)+in mrg [rd,wr]++-- in ; read control bus+let b = control kr "bus" 0+in sinOsc ar (in' 1 kr b) 0 * 0.1++-- in ; audio graph reading control buses 0 & 1 ; control graph writing buses+let wr = out 0 (mce2 (tRandId 'α' 220 2200 (dustId 'β' kr 1)) (dustId 'γ' kr 3))+in mrg2 (sinOsc ar (in' 1 kr 0) 0 * decay (in' 1 kr 1) 0.2 * 0.1) wr++-- in ; patch mono input to stereo output+pan2 (in' 1 ar numOutputBuses) 0 1++-- in ; make a control rate graph to write freq and gate values+let wr = out 10 (mce2 (tRandId 'α' 220 2200 (dustId 'β' kr 1)) (dustId 'γ' kr 3))+ rd = sinOsc ar (in' 1 kr 10) 0 * decay2 (in' 1 kr 11) 0.01 1 * 0.25+in mrg2 rd wr++---- ; set value on a control bus+withSc3 (Sound.OSC.sendMessage (c_set1 0 300))+withSc3 (Sound.OSC.sendMessage (c_set1 0 600))
+ Help/Ugen/inFeedback.help.hs view
@@ -0,0 +1,25 @@+-- inFeedback ; audio feedback modulation+let f = inFeedback 1 0 * 1300 + 300+in sinOsc ar f 0 * 0.2++-- inFeedback ; the two graphs below can be started in either order and both tones will sound+out 0 (inFeedback 1 firstPrivateBus)++-- inFeedback+let b = firstPrivateBus+ s0 = out b (sinOsc ar 220 0 * 0.1)+ s1 = out 0 (sinOsc ar 660 0 * 0.1)+in mrg [s0, s1]++-- inFeedback ; in (no feed-back)+let b = firstPrivateBus in in' 1 ar b++-- inFeedback ; resonator at 440hz, see localOut for variant+let b = firstPrivateBus+ p = inFeedback 1 b+ i = impulse ar 1 0+ d = delayC (i + (p * 0.995)) 1 (recip 440 - recip controlRate)+in mrg [offsetOut b d, offsetOut 0 p]++-- inFeedback ; compare resonator tone with oscillator (at right)+out 1 (sinOsc ar 440 0 * 0.1)
+ Help/Ugen/inRange.help.hs view
@@ -0,0 +1,8 @@+-- inRange ; trigger noise burst+let n = brownNoiseId 'α' ar * 0.1+ x = mouseX kr 1 2 Linear 0.1+ o = sinOsc kr x 0 * 0.2+in inRange o (-0.15) 0.15 * n++-- inRange ; i-rate+sinOsc ar 440 0 * inRange (randId 'α' 0 1) 0.5 1.0 * 0.1
+ Help/Ugen/inTrig.help.hs view
@@ -0,0 +1,5 @@+-- inTrig ; oscillator with the trigger at bus ; dust & mouse button both set bus+let b = control kr "bus" 10+ t = inTrig 1 b+ e = envGen kr t t 0 1 DoNothing (envPerc 0.01 1)+in mrg2 (sinOsc ar 440 0 * e) (out b (mouseButton kr 0 1 0 + dustId 'α' kr 0.5))
+ Help/Ugen/index.help.hs view
@@ -0,0 +1,9 @@+-- index ; index buffer for frequency values+let b = asLocalBufId 'α' [50,100,200,400,800,1600]+ f = index b (range 0 6 (lfSaw kr 2 0))+in sinOsc ar (mce [f,f * 9]) 0 * 0.1++-- index ; mouse control+let b = asLocalBufId 'α' [200, 300, 400, 500, 600, 800]+ f = index b (mouseX kr 0 7 Linear 0.2)+in sinOsc ar f 0 * 0.1
+ Help/Ugen/indexInBetween.help.hs view
@@ -0,0 +1,15 @@+-- indexInBetween ; index into buffer for frequency values+let f0 = mouseX kr 200 900 Linear 0.1+ b = asLocalBufId 'α' [200,210,400,430,600,800]+ i = indexInBetween b f0+ l0 = index b i+ l1 = index b (i + 1)+ f1 = linLin (frac i) 0 1 l0 l1+in sinOsc ar (mce [f0,f1]) 0 * 0.1++-- indexInBetween+let from = asLocalBufId 'α' [1, 2, 4, 8, 16]+ to = asLocalBufId 'β' [0, 1, 0, -1, 0]+ x = mouseX kr 1 16 Linear 0.1+ i = indexL to (indexInBetween from x)+in sinOsc ar (linLin i (-1) 1 440 880) 0 * 0.1
+ Help/Ugen/indexL.help.hs view
@@ -0,0 +1,10 @@+-- indexL ; index buffer for frequency values+let b = asLocalBufId 'α' [50,100,200,400,800,1600]+ ph = 1 -- 0+ i = range 0 7 (lfSaw kr 0.1 ph)+in sinOsc ar (mce2 (indexL b i) (index b i)) 0 * 0.1++-- indexL ; mouse control+let b = asLocalBufId 'α' [200,300,400,500,600,800]+ x = mouseX kr 0 7 Linear 0.2+in sinOsc ar (mce2 (indexL b x) (index b x)) 0 * 0.1
+ Help/Ugen/integrator.help.hs view
@@ -0,0 +1,23 @@+-- integrator+let x = mouseX kr 0.001 0.999 Exponential 0.2+ o = lfPulse ar 300 0.2 0.1 * 0.1+in integrator o x++-- integrator ; used as an envelope+let i = lfPulse ar 3 0.2 0.0004+ o = sinOsc ar 700 0 * 0.1+in integrator i 0.999 * o++-- integrator ; scope+let x = mouseX kr 0.01 0.999 Exponential 0.2+ o = lfPulse ar (1500 / 4) 0.2 0.1+in integrator o x * 0.1++-- integrator ; a triangle wave is the integration of square wave+let f = mouseX kr 440 8800 Exponential 0.2+ o = pulse ar f 0.5+in integrator o 0.99 * 0.05++---- ; drawings+UI.ui_sc3_scope 2 0 (2 ^ 14) 0 "audio" 0+Sound.Sc3.Plot.plot_ugen 0.006 (integrator (lfPulse ar (1500 / 4) 0.2 0.1) (mce [0.1,0.4,0.7]))
+ Help/Ugen/jPverbRaw.help.hs view
@@ -0,0 +1,14 @@+-- jPverbRaw ; default values+let (i1,i2) = (soundIn 0,soundIn 1)+in X.jPverbRaw i1 i2 0 0.707 2000 1 500 1 0.1 2 1 1 1++-- jPverbRaw ; dreamverb+let (i1,i2) = (soundIn 0,soundIn 1)+ rvb = X.jPverbRaw i1 i2 0.314 0.421 1024.0219 0.0 2450.082 0.843 4.639 0.103 0.706 2.793 60.0+in mce2 i1 i2 + rvb++-- ; jPverbRaw ; dreamverb ; controls+let k = control kr+ (i1,i2) = (soundIn 0,soundIn 1)+ rvb = X.jPverbRaw i1 i2 (k "damp" 0.314) (k "earlydiff" 0.421) (k "highband" 1024.02) (k "highx" 0.0) (k "lowband" 2450.08) (k "lowx" 0.844) (k "mdepth" 4.639) (k "mfreq" 0.103) (k "midx" 0.706) (k "size" 2.794) (k "t60" 60)+in mce2 i1 i2 + rvb
+ Help/Ugen/k2a.help.hs view
@@ -0,0 +1,11 @@+-- k2a+k2a (whiteNoiseId 'α' kr * 0.3)++-- k2a ; compare+mce2 (k2a (whiteNoiseId 'α' kr * 0.3)) (whiteNoiseId 'β' ar * 0.1)++-- k2a+let freq = (mouseX kr 0.1 40 Exponential 0.2) / blockSize * sampleRate;+ o1 = k2a (lfNoise0Id 'α' kr freq)+ o2 = lfNoise0Id 'β' ar freq+in mce2 o1 o2 * 0.1
+ Help/Ugen/keyState.help.hs view
@@ -0,0 +1,2 @@+-- keyState ; keycode 38 is the A key on some keyboards ; under X11 see xev(1) to determine layout+sinOsc ar 800 0 * keyState kr 38 0 0.1 0.5
+ Help/Ugen/keyTrack.help.hs view
@@ -0,0 +1,6 @@+-- keyTrack+let s = soundIn (mce2 0 1)+ t = fft' (localBufId 'α' 1 4096) (mix s)+ k = keyTrack kr t 2.0 0.5+ p = poll (impulse kr 1 0) k 0 (label "key")+in mrg2 s p
+ Help/Ugen/klang.help.hs view
@@ -0,0 +1,22 @@+-- klang ; note SC2 had mul/add inputs+let f = [440,550..1100]+ a = take 7 (cycle [0.05, 0.02])+ p = replicate 7 0+in klang ar 1 0 (klangSpec f a p)++-- klang+let s = klangSpec [800,1000,1200] [0.3,0.3,0.3] [pi,pi,pi]+in klang ar 1 0 s * 0.4++-- klang+let s = klangSpec [800,1000,1200] [1,1,1] [0,0,0]+in klang ar 1 0 s * 0.1++-- klang+let s = klangSpec_mce (X.randN 12 600 1000) (mceConst 12 1) (mceConst 12 0)+in klang ar 1 0 s * 0.02++-- klang ; id+let f = map (\z -> randId z 600 1000) ['a'..'l']+ s = klangSpec f (replicate 12 1) (replicate 12 0)+in klang ar 1 0 s * 0.02
+ Help/Ugen/klank.help.hs view
@@ -0,0 +1,26 @@+-- klank ; the klankSpec family of functions can help create the 'spec' entry+let impulse_freq = 0.125+ mk reson_freq = let ampl = 1+ decay_time = 16+ rp = replicate (length reson_freq)+ k = klankSpec_k reson_freq (rp ampl) (rp decay_time)+ in klank (impulse ar impulse_freq 0 * 0.1) 1 0 1 k+in mce (map mk [[221,614,1145,1804,2577,3456,4419]+ ,[977,1003,1390,1414,1432,1465,1748,1834,1919,1933,1987,2096,2107+ ,2202,2238,2280,2400,2435,2507,2546,2608,2652,2691,2708]]) * 0.1++-- klank ; there is a limited form of mce+let u = [1,1,1,1]+ p = [200,171,153,172]+ q = [930,971,953,1323]+ r = [8900,16062,9013,7892]+ k = mce [klankSpec_k p u u,klankSpec_k q u u,klankSpec_k r u u]+ s = mceTranspose k+ i = mce [2,2.07,2.13]+ t = impulse ar i 0 * 0.1+ l = mce [-1,0,1]+in mix (pan2 (klank t 1 0 1 s) l 0.25)++---- ; modal data+import Sound.Sc3.Data.Modal {- hsc3-data -}+Just reson_freq = lookup "Spinel sphere (diameter=3.6675mm)" modal_frequencies
+ Help/Ugen/ladspa.help.hs view
@@ -0,0 +1,244 @@+-- ladspa ; caps ; # 1767 C* ChorusI - Mono chorus/flanger+let s = soundIn 0+ x = mouseX kr 0 1 Linear 0.2+ y = mouseY kr 0 1 Linear 0.2+ n1 = range 2.5 40 (lfNoise2Id 'α' kr 0.2)+ n2 = range 0.5 10 (lfNoise2Id 'β' kr 0.2)+in X.ladspa 1 ar 1767 [n1,n2,0.5,0.5,x,y,s]++-- ladspa ; caps ; # 1769 C* Click - Metronome+let x = roundE (mouseX kr 0 3 Linear 0.2)+ y = mouseY kr 4 240 Linear 0.2+in X.ladspa 1 ar 1769 [x,y,0.5,0.5]++-- ladspa ; caps ; # 1773 C* Eq10 - 10-band equaliser+let s = soundIn 0+ enumN n e = take n (enumFrom e)+ n = map (\z -> range (-24) 48 (lfNoise2Id z kr 0.2)) (enumN 10 'α')+in X.ladspa 1 ar 1773 (n ++ [s]) * 0.1++-- ladspa ; caps ; # 1771 C* Saturate - Various static nonlinearities, 8x oversampled+let s = soundIn 0+in X.ladspa 1 ar 1771 [1,0,0,s]++-- ladspa ; caps ; # 1771 C* Saturate - Various static nonlinearities, 8x oversampled+let s = soundIn 0+ x = roundE (mouseX kr 0 11 Linear 0.2)+ y = mouseY kr (-24) 72 Linear 0.2+in X.ladspa 1 ar 1771 [x,y,0.0,s]++-- ladspa ; caps ; # 1772 C* Compress - Compressor and saturating limiter+let s = soundIn 0+ x = roundE (mouseX kr 0 2 Linear 0.2)+ y = mouseY kr 0 1 Linear 0.2+in X.ladspa 1 ar 1772 [0.5,x,y,0.5,0.5,0.1,0,s]++-- ladspa ; caps ; # 1779 C* Plate - Versatile plate reverb+let s = soundIn 0+ x = mouseX kr 0 1 Linear 0.2+ y = mouseY kr 0 1 Linear 0.2+in X.ladspa 2 ar 1779 [x,y,0.5,0.5,s]++-- ladspa ; caps ; # 1788 C* Wider - Stereo image synthesis+let s = soundIn 0+ x = mouseX kr (-1) 1 Linear 0.2+ y = mouseY kr 0 1 Linear 0.2+in X.ladspa 2 ar 1788 [x,y,s]++-- ladspa ; caps ; # 2586 C* PhaserII - Mono phaser+let s = soundIn 0+ x = mouseX kr 0 1 Linear 0.2+ y = mouseY kr 0 1 Linear 0.2+in X.ladspa 1 ar 2586 [0.3,x,0.5,y,0.8,s]++-- ladspa ; caps ; # 2592 C* AmpVTS - Idealised guitar amplification+X.ladspa 1 ar 2592 [1,0.25,0.75,0.5,1,0.25,1,0.75,0.75,0.25,0.5,soundIn 0] * 0.1++-- ladspa ; caps ; # 2592 C* AmpVTS - Idealised guitar amplification+let s = soundIn 0+ x = roundE (mouseX kr 0 8 Linear 0.2)+ y = mouseY kr 0 1 Linear 0.2+ enumN n e = take n (enumFrom e)+ [n1,n2,n3,n4,n5,n6,n7,n8] = map (\z -> lfNoise2Id z kr 0.2) (enumN 8 'α')+in X.ladspa 1 ar 2592 [1,y,n1,n2,x,n3,n4,n5,n6,n7,n8,s]++-- ladspa ; caps ; # 2609 C* EqFA4p - 4-band parametric eq+let s = soundIn 0+ fId z m l r = m (lfNoise2Id z kr 0.2) (-1) 1 l r+ p = [fId 'α' linLin 0 1+ ,fId 'β' linExp 20 14000+ ,fId 'γ' linExp 0.125 8+ ,fId 'δ' linLin (-24) 24+ ,fId 'ε' linLin 0 1+ ,fId 'ζ' linExp 20 14000+ ,fId 'η' linExp 0.125 8+ ,fId 'θ' linLin (-24) 24+ ,fId 'ι' linLin 0 1+ ,fId 'κ' linExp 20 14000+ ,fId 'λ' linExp 0.125 8+ ,fId 'μ' linLin (-24) 24+ ,fId 'ν' linLin 0 1+ ,fId 'ξ' linExp 20 14000+ ,fId 'ο' linExp 0.125 8+ ,fId 'π' linLin (-24) 24+ ,0+ ,s]+in pan2 (X.ladspa 1 ar 2609 p) (fId 'ρ' linLin (-1) 1) 0.25++{---- ; Note: debian sc3-plugins doesn't build ladspalist, to build type:++ cd opt/src/sc3-plugins/source/LadspaUGen+ gcc -ldl search.c ladspalist.c -o ladspalist++CAPS = http://quitte.de/dsp/caps.html, http://packages.debian.org/stable/caps++ # 1767 C* ChorusI - Mono chorus/flanger+ > k: t (ms) (2.5 to 40)+ > k: width (ms) (0.5 to 10)+ > k: rate (Hz) (0.02 to 5)+ > k: blend (0 to 1)+ > k: feedforward (0 to 1)+ > k: feedback (0 to 1)+ > a: in (0 to 0)+ < a: out++ # 1769 C* Click - Metronome+ > k: model (0 to 3)+ > k: bpm (4 to 240)+ > k: volume (0 to 1)+ > k: damping (0 to 1)+ < a: out++ # 1773 C* Eq10 - 10-band equaliser+ > k: 31 Hz (-48 to 24)+ > k: 63 Hz (-48 to 24)+ > k: 125 Hz (-48 to 24)+ > k: 250 Hz (-48 to 24)+ > k: 500 Hz (-48 to 24)+ > k: 1 kHz (-48 to 24)+ > k: 2 kHz (-48 to 24)+ > k: 4 kHz (-48 to 24)+ > k: 8 kHz (-48 to 24)+ > k: 16 kHz (-48 to 24)+ > a: in (0 to 0)+ < a: out++ # 1771 C* Saturate - Various static nonlinearities, 8x oversampled+ > k: mode (0 to 11)+ > k: gain (dB) (-24 to 72)+ > k: bias (0 to 1)+ > a: in (0 to 0)+ < a: out++ # 1772 C* Compress - Compressor and saturating limiter+ > k: measure (0 to 1)+ > k: mode (0 to 2)+ > k: threshold (0 to 1)+ > k: strength (0 to 1)+ > k: attack (0 to 1)+ > k: release (0 to 1)+ > k: gain (dB) (-12 to 18)+ < k: state (dB)+ > a: in (-1 to 1)+ < a: out++ # 1779 C* Plate - Versatile plate reverb+ > k: bandwidth (0 to 1)+ > k: tail (0 to 1)+ > k: damping (0 to 1)+ > k: blend (0 to 1)+ > a: in (0 to 0)+ < a: out.l+ < a: out.r++ # 1788 C* Wider - Stereo image synthesis+ > k: pan (-1 to 1)+ > k: width (0 to 1)+ > a: in (0 to 0)+ < a: out.l+ < a: out.r++ # 2586 C* PhaserII - Mono phaser+ > k: rate (0 to 1)+ > k: lfo (0 to 1)+ > k: depth (0 to 1)+ > k: spread (0 to 1)+ > k: resonance (0 to 1)+ > a: in (0 to 0)+ < a: out++ # 2588 C* Scape - Stereo delay with chromatic resonances+ > k: bpm (30 to 164)+ > k: divider (2 to 4)+ > k: feedback (0 to 1)+ > k: dry (0 to 1)+ > k: blend (0 to 1)+ > k: tune (Hz) (415 to 467)+ > a: in (0 to 0)+ < a: out.l+ < a: out.r++ # 2592 C* AmpVTS - Idealised guitar amplification+ > k: over (0 to 2)+ > k: gain (0 to 1)+ > k: bright (0 to 1)+ > k: power (0 to 1)+ > k: tonestack (0 to 8)+ > k: bass (0 to 1)+ > k: mid (0 to 1)+ > k: treble (0 to 1)+ > k: attack (0 to 1)+ > k: squash (0 to 1)+ > k: lowcut (0 to 1)+ > a: in (0 to 0)+ < a: out++ # 2603 C* Spice - Not an exciter+ > k: lo.f (Hz) (50 to 400)+ > k: lo.compress (0 to 1)+ > k: lo.gain (0 to 1)+ > k: hi.f (Hz) (400 to 5000)+ > k: hi.gain (0 to 1)+ > a: in (0 to 0)+ < a: out++ # 2609 C* EqFA4p - 4-band parametric eq+ > k: a.act (0 to 1)+ > k: a.f (Hz) (20 to 14000)+ > k: a.bw (0.125 to 8)+ > k: a.gain (dB) (-24 to 24)+ > k: b.act (0 to 1)+ > k: b.f (Hz) (20 to 14000)+ > k: b.bw (0.125 to 8)+ > k: b.gain (dB) (-24 to 24)+ > k: c.act (0 to 1)+ > k: c.f (Hz) (20 to 14000)+ > k: c.bw (0.125 to 8)+ > k: c.gain (dB) (-24 to 24)+ > k: d.act (0 to 1)+ > k: d.f (Hz) (20 to 14000)+ > k: d.bw (0.125 to 8)+ > k: d.gain (dB) (-24 to 24)+ > k: gain (-24 to 24)+ < k: _latency+ > a: in (0 to 0)+ < a: out+-}++---- ladspa ; caps ; # 2588 C* Scape - Stereo delay with chromatic resonances+let s = soundIn 0 * 0.1+in X.ladspa 2 ar 2588 [30,2,0,0.1,0.5,415,s] * 0.1++---- ladspa ; caps ; # 2588 C* Scape - Stereo delay with chromatic resonances+let s = soundIn 0 * 0.1+ x = mouseX kr 30 164 Linear 0.2+ y = roundE (mouseY kr 2 4 Linear 0.2)+ n1 = lfNoise2Id 'α' kr 0.2 * 0.5 + 0.5+ n2 = lfNoise2Id 'β' kr 0.2 * 0.5 + 0.5+in X.ladspa 2 ar 2588 [x,y,n1,n2,0.5,440,s]++---- ladpsa ; caps ; # 2603 C* Spice - Not an exciter+let s = soundIn 0+ x = mouseX kr 50 400 Exponential 0.2+ y = mouseY kr 400 5000 Exponential 0.2+in X.ladspa 1 ar 2603 [x,0.5,0.5,y,0.5,s]
+ Help/Ugen/lag.help.hs view
@@ -0,0 +1,17 @@+-- lag ; mouse+let x = mouseX kr 220 440 Linear 0.2+in sinOsc ar (mce [x, lag x 1]) 0 * 0.1++-- lag ; noise+let n = lfNoise0Id 'α' kr 0.5+in sinOsc ar (220 + (lag n 1 * 220)) 0 * (lag n 2 * 0.1)++-- lag+lag (impulse ar 100 0) (mouseX kr 0.0 0.01 Linear 0.2)++-- lag+lag (lfPulse ar 50 0 0.5) (mouseX kr 0.0 (1/50) Linear 0.2) * 0.2++-- lag ; frequency plain at left and smoothed at right+let f = sinOsc kr 0.05 0.0 `in_range` (220,440)+in sinOsc ar (mce2 f (lag f 1)) 0 * 0.1
+ Help/Ugen/lag2.help.hs view
@@ -0,0 +1,6 @@+-- lag2 ; control+let x = mouseX kr 220 440 Exponential 0.1+in sinOsc ar (mce [x, lag2 x 1]) 0 * 0.1++-- lag2 ; audio+lag2 (impulse ar 100 0) (mouseX kr 0.0 0.01 Linear 0.2)
+ Help/Ugen/lag3.help.hs view
@@ -0,0 +1,13 @@+-- lag3 ; mouse control+let x = mouseX kr 220 440 Exponential 0.1+in sinOsc ar (mce [x, lag3 x 1]) 0 * 0.1++-- lag3 ; audio+lag3 (impulse ar 100 0) (mouseX kr 0.0 0.01 Linear 0.2)++-- lag3+lag3 (lfPulse ar 100 0 0.5 * 0.2) (mouseX kr 0.0 0.01 Linear 0.2)++-- lag3 ; written out+let x = mouseX kr 0.0 0.01 Linear 0.2+in lag (lag (lag (lfPulse ar 100 0 0.5 * 0.2) x) x) x
+ Help/Ugen/lagIn.help.hs view
@@ -0,0 +1,7 @@+-- lagIn ; oscillator reading frequency at control bus+sinOsc ar (lagIn 1 (control kr "bus" 10) 1) 0 * 0.1++---- ; set/reset frequency at control bus+import Sound.OSC {- hosc -}+withSc3 (sendMessage (c_set1 10 200))+withSc3 (sendMessage (c_set1 10 2000))
+ Help/Ugen/lagUD.help.hs view
@@ -0,0 +1,28 @@+-- lagUD ; lag pitch, slower down (5 seconds) than up (1 second)+let x = mouseX kr 220 440 Linear 0.2+in sinOsc ar (mce2 x (lagUD x 1 5)) 0 * 0.1++-- lagUD ; as signal filter+let x = mouseX kr 0.0001 0.01 Exponential 0.2+ y = mouseY kr 0.0001 0.01 Exponential 0.2+in lagUD (0 - saw ar 440) x y * 0.15++-- lagUD ; as signal filter+let x = mouseX kr 0.0001 0.01 Exponential 0.2+ y = mouseY kr 0.0001 0.01 Exponential 0.2+in lagUD (impulse ar (range 6 24 (lfNoise2Id 'α' kr 4)) 0) x y * 0.5++-- lagUD ; as signal filter+let x = mouseX kr 0.0001 0.01 Exponential 0.2+ y = mouseY kr 0.0001 0.01 Exponential 0.2+in lagUD (lfPulse ar 800 0 0.5 * 2 - 1) x y * 0.05++-- lagUD ; as signal filter+let x = mouseX kr 0.0001 0.01 Exponential 0.2+ y = mouseY kr 0.0001 0.01 Exponential 0.2+in lagUD (varSaw ar 220 0 (range 0 1 (sinOsc kr 0.25 0))) x y * 0.1++-- lagUD+let x = mouseX kr 0.0 (1/100) Linear 0.2+ y = mouseY kr 0.0 (3/100) Linear 0.2+in lagUD (lfPulse ar 50 0 0.25) x y * 0.1
+ Help/Ugen/lastValue.help.hs view
@@ -0,0 +1,8 @@+-- lastValue+let x = mouseX kr 100 400 Linear 0.1+in sinOsc ar (lastValue x 40) 0 * 0.1++-- lastValue ; difference between currrent and the last changed+let x = mouseX kr 0.1 4 Linear 0.1+ f = abs (lastValue x 0.5 - x) * 400 + 200+in sinOsc ar f 0 * 0.2
+ Help/Ugen/latch.help.hs view
@@ -0,0 +1,32 @@+-- latch ; sample & hold+let n = whiteNoiseId 'α' ar+ i = impulse ar 9 0+ l = latch n i+in blip ar (l * 400 + 500) 4 * 0.2++-- latch ; c.f. LFNoise0+let n1 = latch (whiteNoiseId 'α' ar) (impulse ar 9 0)+ n2 = lfNoise0Id 'α' kr 9+in blip ar (mce2 n1 n2 * 400 + 500) 4 * 0.2++-- latch ; http://create.ucsb.edu/pipermail/sc-users/2006-December/029991.html+let n0 = lfNoise2Id 'α' kr 8+ n1 = lfNoise2Id 'β' kr 3+ s = blip ar (n0 * 200 + 300) (n1 * 10 + 20)+ x = mouseX kr 1000 (sampleRate * 0.1) Exponential 0.1+in latch s (impulse ar x 0)++-- latch ; density control for sample and hold of noise signal (c.f. dust)+let n0 = whiteNoiseId 'α' ar+ n1 = whiteNoiseId 'β' ar+ k = 1000+ c = control_m kr "density" 26 (0.01,k,"exp")+in latch n0 (n1 `greater_than` ((constant k - c) / constant k)) * 0.1++-- latch ; density control for sample and hold of noise signal+let n = whiteNoiseId 'α' ar+ c = control_m kr "density" 26 (0.01,8000,"exp")+in latch n (dustId 'γ' ar c) * 0.1++---- ; drawings+UI.ui_sc3_scope 2 0 4096 1 "audio" 0
+ Help/Ugen/latoocarfianC.help.hs view
@@ -0,0 +1,19 @@+-- latoocarfianC ; Sc3 default initial parameters+let x = mouseX kr 20 sampleRate Linear 0.1+in latoocarfianC ar x 1 3 0.5 0.5 0.5 0.5 * 0.1++-- latoocarfianC ; randomly modulate all parameters+let [n0,n1,n2,n3] = map (\e -> lfNoise2Id e kr 5) ['α','β','γ','δ']+ f = sampleRate / 4+ a = n0 * 1.5 + 1.5+ b = n1 * 1.5 + 1.5+ c = n2 * 0.5 + 1.5+ d = n3 * 0.5 + 1.5+in latoocarfianC ar f a b c d 0.5 0.5 * 0.1++---- ; drawings+Sound.Sc3.Plot.plot_ugen_nrt (600,1) 1.0 (latoocarfianC ar 600 1.0 3.0 0.5 0.5 0.5 0.5)++---- ; haskell implementation of equation+latoocarfian_hs a b c d = map fst (iterate (Sound.Sc3.Common.Math.Noise.latoocarfian_f a b c d) (0.5,0.5))+Sound.Sc3.Plot.plot_p1_ln [take 600 (latoocarfian_hs 1.0 3.0 0.5 0.5)]
+ Help/Ugen/lcm.help.hs view
@@ -0,0 +1,10 @@+-- lcm+let x = mouseX kr (-20) 20 Linear 0.2+ y = mouseY kr (-20) 20 Linear 0.2+in sinOsc ar ((sinOsc kr 0.3 0 * 20) `lcmE` mce2 x y * 30 + 500) 0 * 0.1++-- https://www.listarc.bham.ac.uk/lists/sc-users/msg68916.html (jrhb)+let a = lfSaw ar 2 0 * 100+ b = lfSaw ar 1.2 0 * 100+in sinOsc ar (lcmE a b + 300) 0 * 0.1+
+ Help/Ugen/leakDC.help.hs view
@@ -0,0 +1,11 @@+-- leakDC+let a = lfPulse ar 800 0 0.5 * 0.1 + 0.5+in mce [a,leakDC a 0.995]++---- ; frequency response functions and tables+---- ; <http://www.listarc.bham.ac.uk/lists/sc-users/msg69555.html>+leak_dc_coef sample_rate cfreq = exp (-two_pi * (cfreq / sample_rate))+leak_dc_cfreq sample_rate coef = -log(coef) * (sample_rate / two_pi)+import Sound.Sc3.Plot {- hsc3-plot -}+plot_p2_ln [let x = [0,0.5 .. 200] in zip x (map (leak_dc_coef 48000) x)]+plot_p2_ln [let x = [0.9700,0.9725 .. 1.0000] in zip x (map (leak_dc_cfreq 48000) x)]
+ Help/Ugen/lfBrownNoise0.help.hs view
@@ -0,0 +1,4 @@+-- lfBrownNoise0+let n = X.lfBrownNoise0Id 'α' ar 10 0.05 0+ f = linExp n (-1) 1 64 9600+in sinOsc ar f 0 * 0.1
+ Help/Ugen/lfBrownNoise2.help.hs view
@@ -0,0 +1,21 @@+-- lfBrownNoise2+let freq = 1000+ dev = mouseX kr 0 1 Linear 0.2+ dist = mouseY kr 0 5 Linear 0.2+in X.lfBrownNoise2Id 'α' ar freq dev dist * 0.25++-- lfBrownNoise2 ; as frequency control+let freq = 8+ dev = mouseX kr 0 1 Linear 0.2+ dist = mouseY kr 0 5 Linear 0.2+ n1:n2:n3:_ = map (\z -> X.lfBrownNoise2Id z kr freq dev dist) ['α'..]+ o = impulse ar (range 6 24 n1) 0+in lagUD o (range 0.0001 0.001 n2) (range 0.0001 0.001 n3) * 0.5++-- lfBrownNoise2 ; as pan & volume controls ; warning=feedback+let s = soundIn 0+ freq = range 0.5 2 (X.lfBrownNoise2Id 'α' kr 2 0.1 5)+ dev = mouseX kr 0.01 0.35 Linear 0.2+ dist = mouseY kr 0 5 Linear 0.2+ n1:n2:_ = map (\z -> X.lfBrownNoise2Id z kr freq dev dist) ['β'..]+in pan2 s (range (-0.75) 0.75 n1) 1 * range 0.01 0.5 n2
+ Help/Ugen/lfClipNoise.help.hs view
@@ -0,0 +1,22 @@+-- lfClipNoise+lfClipNoiseId 'α' ar 1000 * 0.05++-- lfClipNoise ; modulate frequency+let f = xLine kr 1000 10000 10 RemoveSynth+in lfClipNoiseId 'α' ar f * 0.05++-- lfClipNoise ; use as frequency control+let n = lfClipNoiseId 'α' kr 4+in sinOsc ar (n * 200 + 600) 0 * 0.1++-- lfClipNoise ; c.f. lfDClipNoise+let x = mouseX kr 0.1 1000 Exponential 0.2+ n = lfClipNoiseId 'β' ar x+in sinOsc ar (n * 200 + 500) 0 * 0.05++-- lfClipNoise ; c.f. lfDClipNoise+let f = xLine kr 1000 20000 10 RemoveSynth+in lfClipNoiseId 'δ' ar f * 0.05++---- ; drawings+Sound.Sc3.Plot.plot_ugen1 0.1 (lfClipNoiseId 'α' ar 1000)
+ Help/Ugen/lfCub.help.hs view
@@ -0,0 +1,38 @@+-- lfCub ; c.f. lfPar+let g f = f ar (f kr (f kr 0.2 0 * 8 + 10) 0 * 400 + 800) 0 * 0.1 in mce2 (g lfCub) (g lfPar)++-- lfCub ; c.f. lfPar+let g f = f ar (f kr 0.2 0 * 400 + 800) 0 * 0.1 in mce2 (g lfCub) (g lfPar)++-- lfCub ; c.f. lfPar+mce2 (lfCub ar 800 0 * 0.1) (lfPar ar 800 0 * 0.1)++-- lfCub ; c.f. lfPar+let g f = f ar (xLine kr 100 8000 30 DoNothing) 0 * 0.1 in mce2 (g lfCub) (g lfPar)++-- lfCub ; c.f. sinOsc+let g f = f ar (f kr (f kr 0.2 0 * 8 + 10) 0 * 400 + 800) 0 * 0.1 in mce2 (g lfCub) (g sinOsc)++-- lfCub ; c.f. sinOsc+let g f = f ar (f kr 0.2 0 * 400 + 800) 0 * 0.1 in mce2 (g lfCub) (g sinOsc)++-- lfCub ; c.f. sinOsc+mce2 (lfCub ar 800 0 * 0.1) (sinOsc ar 800 0 * 0.1)++-- lfCub ; c.f. sinOsc+let g f = f ar (xLine kr 100 8000 30 DoNothing) 0 * 0.1 in mce2 (g lfCub) (g sinOsc)++-- lfCub ; c.f. lfTri+let g f = f ar (f kr (f kr 0.2 0 * 8 + 10) 0 * 400 + 800) 0 * 0.1 in mce2 (g lfCub) (g lfTri)++-- lfCub ; c.f. lfTri+let g f = f ar (f kr 0.2 0 * 400 + 800) 0 * 0.1 in mce2 (g lfCub) (g lfTri)++-- lfCub ; c.f. lfTri+mce2 (lfCub ar 800 0 * 0.1) (lfTri ar 800 0 * 0.1)++-- lfCub ; c.f. lfTri+let g f = f ar (xLine kr 100 8000 30 DoNothing) 0 * 0.1 in mce2 (g lfCub) (g lfTri)++---- ; drawings+Sound.Sc3.Plot.plot_ugen 0.1 (mce2 (sinOsc ar 20 0) (lfCub ar 20 0))
+ Help/Ugen/lfGauss.help.hs view
@@ -0,0 +1,47 @@+-- lfGauss ; modulating duration+let d = xLine kr 0.1 0.001 10 DoNothing+in lfGauss ar d 0.03 0 Loop DoNothing * 0.2++-- lfGauss ; modulating width, freq=60Hz+let w = xLine kr 0.1 0.001 10 DoNothing+in lfGauss ar (1 / 60) w 0 Loop DoNothing * 0.2++-- lfGauss ; x=frequency, y=width ; note alisasing at high frequencies+let d = mouseX kr (1/8000) 0.1 Exponential 0.2+ w = mouseY kr 0.001 0.1 Exponential 0.2+in lfGauss ar d w 0 Loop DoNothing * 0.1++-- lfGauss ; amplitude modulator+let d = mouseX kr 1 0.001 Exponential 0.2+ g = lfGauss ar d 0.1 0 Loop DoNothing+ o = sinOsc ar 1000 0+in g * o * 0.1++-- lfGauss ; modulate iphase+let ph = mouseX kr (-1) 1 Linear 0.2+ g = lfGauss ar 0.001 0.2 (mce2 0 ph) Loop DoNothing+in mix g * 0.2++-- lfGauss ; very small width approach dirac function+let w = sampleDur * mouseX kr 10 3000 Exponential 0.2+in lfGauss ar 0.01 w 0 Loop DoNothing * 0.2++-- lfGauss ; dur and width can be modulated at audio rate+let x = mouseX kr 2 1000 Exponential 0.2+ d = range 0.0006 0.01 (sinOsc ar x 0 * mce2 1 1.1)+ w = range 0.01 0.3 (sinOsc ar (0.5 * (mce2 1 1.1)) 0)+in lfGauss ar d w 0 Loop DoNothing * 0.2++-- lfGauss ; several frequencies and widths combined+let x = mouseX kr 1 0.07 Exponential 0.2+ y = mouseY kr 1 3 Linear 0.2+ g = lfGauss ar x (y ** mce [-1,-2 .. -6]) 0 Loop DoNothing+ o = sinOsc ar (200 * (1.3 ** mce [0..5])) 0+in mix (g * o) * 0.1++---- ; drawings+let plot_f tm du ph = Sound.Sc3.Plot.plot_ugen1 tm (lfGauss ar du 0.12 ph Loop DoNothing)+plot_f 0.1 0.1 0 -- centred+plot_f 0.1 0.1 (-1) -- shifting left+plot_f 0.1 0.1 2 -- moving further away from the center+plot_f 0.3 0.065 0 -- several grains
+ Help/Ugen/lfNoise0.help.hs view
@@ -0,0 +1,25 @@+-- lfNoise0+lfNoise0Id 'α' ar 1000 * 0.05++-- lfNoise0 ; modulate frequency+let f = xLine kr 1000 10000 10 RemoveSynth+in lfNoise0Id 'α' ar f * 0.05++-- lfNoise0 ; as frequency control+let f = lfNoise0Id 'α' kr 4+in sinOsc ar (f * 400 + 450) 0 * 0.1++-- lfNoise0 ; lfdNoise0+lfNoise0Id 'α' ar (mouseX kr 0.1 1000 Exponential 0.2) * 0.1++-- lfNoise0 ; lfdNoise0+lfNoise0Id 'α' ar (xLine kr 0.5 10000 3 RemoveSynth)++-- lfNoise0 ; lfdNoise0+lfNoise0Id 'α' ar (xLine kr 1000 20000 10 RemoveSynth)++---- ; drawings+import Sound.Sc3.Plot {- hsc3-plot -}+plot_ugen1 0.1 (lfNoise0Id 'γ' ar 1000)+plot_ugen1 0.1 (lfNoise1Id 'γ' ar 1000)+plot_ugen1 0.1 (lfNoise2Id 'γ' ar 1000)
+ Help/Ugen/lfNoise1.help.hs view
@@ -0,0 +1,11 @@+-- lfNoise1+lfNoise1Id 'α' ar 1000 * 0.05++-- lfNoise1 ; modulate frequency+let f = xLine kr 1000 10000 10 RemoveSynth+in lfNoise1Id 'α' ar f * 0.05++-- lfNoise1 ; as frequency control+let n = lfNoise1Id 'α' kr 4+ f = n * 400 + 450+in sinOsc ar f 0 * 0.1
+ Help/Ugen/lfNoise2.help.hs view
@@ -0,0 +1,13 @@+-- lfNoise2+lfNoise2Id 'α' ar 1000 * 0.05++-- lfNoise2 ; modulate frequency+let f = xLine kr 1000 10000 10 RemoveSynth+in lfNoise2Id 'α' ar f * 0.05++-- lfNoise2 ; as frequency control+let f = lfNoise2Id 'α' kr 4+in sinOsc ar (f * 400 + 450) 0 * 0.1++---- ; drawings ; lfNoise2 is bi-polar+Sound.Sc3.Plot.plot_ugen1 0.1 (lfNoise2Id 'α' ar 1000)
+ Help/Ugen/lfPar.help.hs view
@@ -0,0 +1,2 @@+---- ; drawings+Sound.Sc3.Plot.plot_ugen 0.1 (mce2 (sinOsc ar 20 0) (lfPar ar 20 pi))
+ Help/Ugen/lfPulse.help.hs view
@@ -0,0 +1,31 @@+-- lfPulse ; 50 Hz wave ; note SC2 had no initial phase argument+lfPulse ar 50 0 0.5 * 0.1++-- lfPulse ; modulating frequency+lfPulse ar (xLine kr 1 200 10 DoNothing) 0 0.2 * 0.1++-- lfPulse ; amplitude modulation+lfPulse kr (xLine kr 1 200 10 DoNothing) 0 0.2 * sinOsc ar 440 0 * 0.1++-- lfPulse ; used as both oscillator and lfo+lfPulse ar (lfPulse kr 3 0 0.3 * 200 + 200) 0 0.2 * 0.1++-- lfPulse ; mouse control of width+let x = mouseX kr 0 1 Linear 0.2 in lfPulse ar 220 0 x * 0.1++-- lfPulse ; compare with band limited pulse ugen+mce2 (pulse ar 100 0.3) (lfPulse ar 100 0 0.3) * 0.1++-- lfPulse ; as sum of sines ; for odd partials n amplitude is (1 / n), for even 0 ; phase is 0+let mk_freq f0 n = f0 * fromInteger n+ mk_amp n = if even n then 0 else 1 / fromInteger n+ mk_param f0 n = let m = [1,3 .. n] in zip (map (mk_freq f0) m) (map mk_amp m)+ x = midiCps (mouseX kr 20 72 Linear 0.2)+ y = mouseY kr 0.01 0.1 Exponential 0.2+ e = xLine kr 0.01 1 20 DoNothing -- xfade+ o1 = sum (map (\(fr,am) -> sinOsc ar fr 0 * am) (mk_param x 50)) * (1 - e)+ o2 = lfPulse ar x 0 0.5 * e+in mce2 o1 o2 * y++---- ; drawings ; pulse is unary, ie. range is (0,1)+Sound.Sc3.Plot.plot_ugen1 0.1 (lfPulse ar (line kr 100 800 0.1 DoNothing) 0 0.5)
+ Help/Ugen/lfSaw.help.hs view
@@ -0,0 +1,45 @@+-- lfSaw ; note SC2 did not have the initial phase argument+lfSaw ar 500 1 * 0.025++-- lfSaw ; used as both Oscillator and LFO+lfSaw ar (lfSaw kr 4 0 * 400 + 400) 0 * 0.025++-- lfSaw ; output range is bi-polar+let f = mce [linLin (lfSaw kr 0.5 0) (-1) 1 200 1600, 200, 1600]+ a = mce [0.1,0.05,0.05]+in mix (sinOsc ar f 0 * a)++-- lfSaw ; saw-tooth wave as sum of sines, for all partials n amplitude is (1 / n) ; phase is always 0+let mk_freq f0 n = f0 * fromInteger n+ mk_amp n = 1 / fromInteger n+ mk_param f0 n = let m = [1,2 .. n] in zip (map (mk_freq f0) m) (map mk_amp m)+ x = midiCps (mouseX kr 20 72 Linear 0.2)+ y = mouseY kr 0.01 0.1 Exponential 0.2+ e = xLine kr 0.01 1 20 DoNothing -- cross-fade from sum to lfSaw+ o1 = sum (map (\(fr,am) -> sinOsc ar fr 0 * am) (mk_param x 25)) * (1 - e)+ o2 = lfSaw ar x 0 * e+in mce2 o1 o2 * y++-- lfSaw ; as phasor input to sin function+sin (range 0 two_pi (lfSaw ar 440 0)) * 0.1++-- lfSaw ; mixed with sin, then with distortions+let f = xLine kr 220 440 10 DoNothing+ o1 = sinOsc ar (f + mce2 0 0.7) 0+ o2 = lfSaw ar (f + mce2 0 0.7) 0 * 0.3+ o3 = o1 + o2+ o4 = cubed (distort (log (distort o3)))+in o4 * 0.05++-- lfSaw+let f = sinOsc kr (mce [0.16,0.33,0.41]) 0 * 10 + mce [1,1.1,1.5,1.78,2.45,6.7,8] * 220+in mix (lfSaw ar f 0) * 0.1++-- lfSaw ; ln 2021-04-08 https://lukasnowok.github.io/spectrology/ ; ~= [0.1,0.15,0.225,0.3375]+let o = lfSaw ar (lfSaw ar (mce (take 4 (iterate (* 1.5) 0.1))) 0 * 5000) 0 * 500+in mix (sinOsc ar (1000 + o) 0) * 1/4 * 0.1++---- ; drawings+UI.ui_baudline 4096 50 "linear" 2+Sound.Sc3.Plot.plot_ugen1 0.1 (lfSaw ar 50 0) -- ascending+Sound.Sc3.Plot.plot_ugen1 0.002 (lfSaw ar 5000 0)
+ Help/Ugen/lfTri.help.hs view
@@ -0,0 +1,27 @@+-- lfTri ; see <http://thread.gmane.org/gmane.comp.audio.supercollider.user/84719>+lfTri ar 500 1 * 0.1++-- lfTri ; used as both Oscillator and LFO+lfTri ar (lfTri kr 4 0 * 400 + 400) 0 * 0.1++-- lfTri ; multiple phases+let f = lfTri kr 0.4 (mce [0..3]) * 200 + 400+in mix (lfTri ar f 0 * 0.1)++-- lfTri ; mouse control+let x = midiCps (mouseX kr 20 72 Linear 0.2)+ e = xLine kr 0.01 1 20 DoNothing+ o1 = triAS 25 x * (1 - e)+ o2 = lfTri ar x 0 * e+in mce2 o1 o2 * 0.1++-- lfTri ; c.f. dpw3Tri fast sweeps+lfTri ar (mouseX kr 200 12000 Exponential 0.2) 0 * 0.1++-- lfTri ; c.f. dpw3Tri efficiency+let f = X.randNId 50 'α' 50 5000+in splay (lfTri ar f 0) 1 0.1 0 True++---- ; drawings+Sound.Sc3.Plot.plot_ugen1 0.1 (lfTri ar 40 0)+Sound.Sc3.Plot.plot_ugen1 0.1 (lfTri ar (xLine kr 1 800 0.1 DoNothing) 0)
+ Help/Ugen/lfdClipNoise.help.hs view
@@ -0,0 +1,17 @@+-- lfdClipNoise ; for fast x lfClipNoise frequently seems stuck, lfdClipNoise changes smoothly+let x = mouseX kr 0.1 1000 Exponential 0.2+ n = lfdClipNoise ar x+in sinOsc ar (n * 200 + 500) 0 * 0.05++-- lfdClipNoise ; does not quantize time steps at high frequencies+let f = xLine kr 1000 20000 10 RemoveSynth+in lfdClipNoise ar f * 0.05++-- lfdClipNoise ; for fast x lfClipNoise frequently seems stuck, lfdClipNoise changes smoothly ; id+let x = mouseX kr 0.1 1000 Exponential 0.2+ n = lfdClipNoiseId 'α' ar x+in sinOsc ar (n * 200 + 500) 0 * 0.05++-- lfdClipNoise ; does not quantize time steps at high frequencies ; id+let f = xLine kr 1000 20000 10 RemoveSynth+in lfdClipNoiseId 'γ' ar f * 0.05
+ Help/Ugen/lfdNoise0.help.hs view
@@ -0,0 +1,13 @@+-- lfdNoise0 ; for fast x LFNoise frequently seems stuck, LFDNoise changes smoothly+lfdNoise0Id 'α' ar (mouseX kr 0.1 1000 Exponential 0.2) * 0.1++-- lfdNoise0 ; silent for 2 secs before going up in freq+lfdNoise0Id 'α' ar (xLine kr 0.5 10000 3 RemoveSynth)++-- lfdNoise0 ; LFNoise quantizes time steps at high freqs, LFDNoise does not+lfdNoise0Id 'α' ar (xLine kr 1000 20000 10 RemoveSynth)++---- ; drawings+Sound.Sc3.Plot.plot_ugen1 0.1 (lfdNoise0Id 'γ' ar 1000)+Sound.Sc3.Plot.plot_ugen1 0.1 (lfdNoise1Id 'γ' ar 1000)+Sound.Sc3.Plot.plot_ugen1 0.1 (lfdNoise3Id 'γ' ar 1000)
+ Help/Ugen/lfdNoise1.help.hs view
@@ -0,0 +1,5 @@+-- lfdNoise1 ; c.f. lfdNoise0 & lfdNoise3+lfdNoise1Id 'α' ar (xLine ar 1000 100 0.1 DoNothing)++---- ; drawings ; c.f. lfdNoise0 & lfdNoise3+Sound.Sc3.Plot.plot_ugen1 0.1 (lfdNoise1Id 'α' ar (xLine ar 1000 100 0.1 DoNothing))
+ Help/Ugen/lfdNoise3.help.hs view
@@ -0,0 +1,5 @@+-- lfdNoise3 ; c.f. lfdNoise0+lfdNoise3Id 'α' ar (xLine ar 1000 100 0.1 DoNothing)++---- ; drawings+Sound.Sc3.Plot.plot_ugen1 0.1 (lfdNoise3Id 'α' ar (xLine ar 1000 100 0.1 DoNothing))
+ Help/Ugen/limiter.help.hs view
@@ -0,0 +1,4 @@+-- limiter+let z = let i = impulse ar 8 0 * lfSaw kr 0.25 0 * (-0.6) + 0.7+ in decay2 i 0.001 0.3 * fSinOsc ar 500 0+in mce2 (z * 0.0001) (limiter z 0.4 0.01 * 0.1)
+ Help/Ugen/linCongC.help.hs view
@@ -0,0 +1,21 @@+-- linCongC ; default Sc3 initial parameters+linCongC ar 22050 1.1 0.13 1 0 * 0.1++-- linCongC ; mouse+let x = mouseX kr 20 sampleRate Linear 0.1+in linCongC ar x 1.1 0.13 1 0 * 0.1++-- linCongC ; randomly modulate parameters+let fr = [1,0.1,0.1,0.1]+ [n0,n1,n2,m] = map (\(i,j) -> lfNoise2Id i kr j) (zip ['α'..] fr)+ f = n0 * 1e4 + 1e4+ a = n1 * 0.5 + 1.4+ c = n2 * 0.1 + 0.1+in linCongC ar f a c m 0 * 0.1++---- ; drawings ; haskell implementation of equation+import Sound.Sc3.Common.Math.Noise {- hsc3 -}+import Sound.Sc3.Plot {- hsc3-plot -}+linCong_hs a c m = iterate (linCong_f a c m) 0+plot_p1_ln [take 600 (linCong_hs 1.1 0.13 1.0)]+plot_ugen_nrt (600,1) 1.0 (linCongC ar 600 1.1 0.13 1.0 0.0)
+ Help/Ugen/linCongL.help.hs view
@@ -0,0 +1,1 @@+---- c.f. linCongC
+ Help/Ugen/linCongN.help.hs view
@@ -0,0 +1,1 @@+---- c.f. linCongC
+ Help/Ugen/linExp.help.hs view
@@ -0,0 +1,16 @@+-- linExp+let mod = sinOsc kr (line kr 1 10 10 DoNothing) 0+in sinOsc ar (mce2 (mod * 400 + 500) (linExp mod (-1) 1 100 900)) 0 * 0.05++-- linExp+let f = linExp (mouseX kr 0 1 Linear 0.2) 0 1 440 660+in sinOsc ar f 0 * 0.1++-- linExp ; the destination range may be k-rate+let x = mouseX kr 0 1 Linear 0.2+ y = mouseY kr 220 440 Linear 0.2+ f = linExp x 0 1 y 660+in sinOsc ar f 0 * 0.1++-- linExp ; i-rate+sinOsc ar (linExp (randId 'α' 0 1) 0 1 220 440) 0 * 0.1
+ Help/Ugen/linLin.help.hs view
@@ -0,0 +1,16 @@+-- linLin ; linLin is a function for writing a MulAdd UGen.+let f = linLin (mouseX kr 0 1 Linear 0.2) 0 1 440 660+in sinOsc ar f 0 * 0.1++-- linLin ; the destination range may be k-rate+let x = mouseX kr 0 1 Linear 0.2+ y = mouseY kr 220 440 Linear 0.2+ f = linLin x 0 1 y 660+in sinOsc ar f 0 * 0.1++-- linLin ; modulating source and destination values+let n = lfNoise2Id 'α' ar 80+ x = mouseX kr 200 8000 Linear 0.2+ y = mouseY kr 200 8000 Linear 0.2+ f = linLin n (sinOsc kr 0.2 0) (sinOsc kr 0.2543 0) x y+in sinOsc ar f 0 * 0.1
+ Help/Ugen/linPan2.help.hs view
@@ -0,0 +1,5 @@+-- linPan2+let n = pinkNoiseId 'α' ar in linPan2 n (fSinOsc kr 2 0) 0.05++-- linPan2+linPan2 (fSinOsc ar 800 0) (fSinOsc kr 3 0) 0.05
+ Help/Ugen/linRand.help.hs view
@@ -0,0 +1,6 @@+-- linRand ; c.f. hsc3-lang/Sound/Sc3/Lang/Random/Gen.hs:linrand+let f = linRandId 'α' 200.0 10000.0 (mce [-1, 1])+ e = line kr 0.4 0 0.01 RemoveSynth+in fSinOsc ar f 0 * e++
+ Help/Ugen/linXFade2.help.hs view
@@ -0,0 +1,5 @@+-- linXFade2 ; Sc3 has multiplier pseudo input+linXFade2 (fSinOsc ar 800 0 * 0.1) (pinkNoiseId 'α' ar * 0.1) (fSinOsc kr 1 0) * 1++-- linXFade2+linXFade2 (saw ar 440) (sinOsc ar 440 0) (lfTri kr 0.1 0) * 0.05
+ Help/Ugen/line.help.hs view
@@ -0,0 +1,7 @@+-- line ; NOTE - Sc3 reorders the mul and add inputs to precede the doneAction input+let f = line kr 200 17000 5 RemoveSynth+in sinOsc ar f 0 * 0.05++-- line ; demonstrate RemoveGroup done-action+let f = line kr 200 (mce2 209 211) 5 RemoveGroup+in sinOsc ar f 0 * 0.05
+ Help/Ugen/linen.help.hs view
@@ -0,0 +1,17 @@+-- linen+let e = linen (impulse kr 2 0) 0.01 0.6 0.4 DoNothing+in e * sinOsc ar 440 0 * 0.1++-- linen ; mouseX is envelope trigger+let x = mouseX kr (-1) 1 Linear 0.1+ y = mouseY kr 0.01 0.25 Linear 0.1+ e = linen x 1 y 1.0 DoNothing+in sinOsc ar 440 0 * e++-- linen ; PauseSynth done action+let x = mouseX kr (-1) 1 Linear 0.1+ e = linen x 1 0.1 1 PauseSynth+in sinOsc ar 440 0 * e++---- ; run paused node (assuming no intermediate node is created)+withSc3 (Sound.OSC.sendMessage (n_run [(-1, True)]))
+ Help/Ugen/localBuf.help.hs view
@@ -0,0 +1,70 @@+-- localBuf ; allocate a buffer local to the synthesis graph, 1-channel, 2048+let nc = 1+ nf = 2048+ buf = localBufId 'α' nc nf+ f = fft' buf (whiteNoiseId 'β' ar)+ c = pv_BrickWall f (sinOsc kr 0.1 0 * 0.75)+in ifft' c * 0.1++-- localBuf ; Variant with two local buffers+let dup (p,q) f = mce2 (f p) (f q)+ n = dup ('α','β') (\z -> whiteNoiseId z ar)+ b = dup ('γ','δ') (\z -> localBufId z 1 2048)+ f = fft' b n+ c = pv_BrickWall f (sinOsc kr (mce2 0.1 0.11) 0 * 0.75)+in ifft' c * 0.1++-- localBuf ; not clearing the buffer accesses old data, slowly overwrite data with noise+let dup (p,q) f = mce2 (f p) (f q)+ b = localBufId 'α' 2 2048+ nf = bufFrames kr b+ x = mouseX kr 1 2 Linear 0.2+ r = playBuf 2 ar b x 1 0 Loop DoNothing * 0.1+ wr p i = bufWr b (linLin p (-1) 1 0 nf) Loop i+ n = dup ('β','γ') (\z -> whiteNoiseId z ar)+ ph = lfNoise0Id 'δ' ar 530+in mrg2 r (wr ph n)++-- localBuf ; bufCombC needs no clearing, because the delay line is filled by the ugen+let dup (p,q) f = mce2 (f p) (f q)+ d = dup ('α','β') (\z -> dustId z ar 1)+ n = whiteNoiseId 'γ' ar * 0.1+ z = decay d 0.3 * n+ l = xLine kr 0.0001 0.01 20 DoNothing+ sr = sampleRate+ b = dup ('δ','ε') (\z -> localBufId z 2 sr)+in bufCombC b z l 0.2++-- localBuf ; asLocalBuf combines localBuf and setBuf+let b = asLocalBuf [2,1,5,3,4,0]+ x = mouseX kr 0 (bufFrames kr b) Linear 0.2+ f = indexL b x * 100 + 40+in saw ar (f * mce2 1 1.1) * 0.1++-- localBuf ; asLocalBuf combines localBuf and setBuf ; id+let b = asLocalBufId 'α' [2,1,5,3,4,0]+ x = mouseX kr 0 (bufFrames kr b) Linear 0.2+ f = indexL b x * 100 + 40+in saw ar (f * mce2 1 1.1) * 0.1++-- localBuf ; detectIndex example using local buffer+let b = asLocalBufId 'α' [2,3,4,0,1,5]+ n = bufFrames kr b+ x = floorE (mouseX kr 0 n Linear 0.1)+ i = detectIndex b x+in sinOsc ar (linExp i 0 n 200 700) 0 * 0.1++-- localBuf ; degreeToKey example ('modal space') using local buffer+let n = lfNoise1Id 'α' kr (mce [3,3.05])+ x = mouseX kr 0 15 Linear 0.1+ b = asLocalBufId 'β' [0,2,3.2,5,7,9,10]+ k = degreeToKey b x 12+ mk_c bf = let f0 = midiCps (bf + k + n * 0.04)+ o = sinOsc ar f0 0 * 0.1+ f1 = midiCps (mce [48,55])+ t = lfPulse ar f1 0.15 0.5+ f2 = midiCps (sinOsc kr 0.1 0 * 10 + bf)+ d = rlpf t f2 0.1 * 0.1+ m = o + d+ in combN m 0.31 0.31 2 + m+in (mk_c 48 + mk_c 72) * 0.25
+ Help/Ugen/localIn.help.hs view
@@ -0,0 +1,25 @@+-- localIn ; ping pong ; warning=feedback+let z = soundIn 0+ a1 = localIn 2 ar 0 + mce [z,0]+ a2 = delayN a1 0.2 0.2+ a3 = mceEdit reverse a2 * 0.8+in mrg [z + a2,localOut a3]++-- localIn ; tape-delay ; mouse control ; warning=feedback+let rotate2_mce z p =+ case mceChannels z of+ [l,r] -> rotate2 l r p+ _ -> error "rotate2_mce"+ tape_delay dt fb z =+ let a = amplitude kr (mix z) 0.01 0.01+ z' = z * (a >** 0.02)+ l0 = localIn 2 ar 0+ l1 = onePole l0 0.4+ l2 = onePole l1 (-0.08)+ l3 = rotate2_mce l2 0.2+ l4 = delayN l3 dt dt+ l5 = leakDC l4 0.995+ l6 = softClip ((l5 + z') * fb)+ in mrg2 (l6 * 0.1) (localOut l6)+ y = mouseY kr 0.75 1.25 Linear 0.2+in tape_delay 0.25 y (soundIn 0)
+ Help/Ugen/localOut.help.hs view
@@ -0,0 +1,15 @@+-- localOut ; resonator, must subtract blockSize for correct tuning+let p = localIn 1 ar 0+ i = impulse ar 1 0+ d = delayC (i + (p * 0.995)) 1 (recip 440 - recip controlRate)+in mrg [offsetOut 0 p,localOut d]++-- localOut ; compare with oscillator+sinOsc ar 440 0 * 0.2++-- localOut ; ping pong+let n = decay (impulse ar 0.3 0) 0.1 * whiteNoiseId 'α' ar * 0.2+ l = localIn 2 ar 0 + mce2 n 0+ d = delayN l 0.2 0.2+ o = localOut (mceReverse d * 0.8)+in mrg2 d o
+ Help/Ugen/log.help.hs view
@@ -0,0 +1,2 @@+-- log+sinOsc ar (log (sinOsc kr 0.1 0) * 200 + 300) 0 * 0.05
+ Help/Ugen/logistic.help.hs view
@@ -0,0 +1,13 @@+-- logistic ; Sc3 default parameters+logistic ar 3 1000 0.5++-- logistic ; sample-rate+logistic ar 3.95 sampleRate 0.5++-- logistic ; onset of chaos+logistic ar (line kr 3.55 3.6 5 DoNothing) 1000 0.01 * 0.2++-- logistic ; mouse control+let x = mouseX kr 3 3.99 Linear 0.1+ y = mouseY kr 10 10000 Exponential 0.1+in logistic ar x y 0.25 * 0.2
+ Help/Ugen/loopBuf.help.hs view
@@ -0,0 +1,38 @@+-- loopBuf+let bf = control kr "bufnum" 0+ rt = control kr "rate" 1+ gl = control kr "glide" 0+ gt = control kr "gate" 1+ lr = control kr "loopRel" 0+ sp = control kr "startPos" 0+ sl = control kr "startLoop" 0 -- FRAME+ el = control kr "endLoop" 0 -- FRAME+ ip = control kr "ipol" 2+ am = control kr "amp" 0.1+ rt' = lag rt gl * bufRateScale kr bf+ e = let d = envAdsr 0.1 0.2 1 2 1 (EnvNum (-4)) 0+ in envGen ar gt 1 0 1 RemoveSynth d+ s = X.loopBuf 1 ar bf rt' (gt + lr) sp sl el ip+in s * e * am++---- ; read audio file into memory+let fn = "/home/rohan/rd/j/2019-04-21/FAIRLIGHT/IIX/REEDS/clarmdhi.snd"+withSc3 (async (b_allocRead 0 fn 0 0))++---- ; send control messages+import Sound.OSC {- hosc -}+withSc3 (sendMessage (n_set 1 [("startLoop",5376),("endLoop",5504)]))+withSc3 (sendMessage (n_set1 1 "amp" 0.15)) -- louder+withSc3 (sendMessage (n_set1 1 "rate" (-1))) -- backwards+withSc3 (sendMessage (n_set1 1 "rate" 1)) -- forwards+withSc3 (sendMessage (n_set 1 [("startLoop",11000),("endLoop",11)])) -- change loop points+withSc3 (sendMessage (n_set 1 [("startLoop",5000),("endLoop",15000)])) -- change loop points+withSc3 (sendMessage (n_set1 1 "glide" 5)) -- 5 second glide+withSc3 (sendMessage (n_set1 1 "rate" 2)) -- up an octave+withSc3 (sendMessage (n_set1 1 "rate" (-1))) -- backwards+withSc3 (sendMessage (n_set1 1 "rate" 1)) -- back to normal+withSc3 (sendMessage (n_set1 1 "ipol" 1)) -- no interpolation+withSc3 (sendMessage (n_set1 1 "ipol" 2)) -- linear interpolation+withSc3 (sendMessage (n_set1 1 "ipol" 4)) -- cubic interpolation+withSc3 (sendMessage (n_set1 1 "gate" 0)) -- release gate to hear post-loop+withSc3 (sendMessage (n_set 1 [("loopRel",1),("gate",0)]) -- release instrument without post-loop
+ Help/Ugen/lorenzL.help.hs view
@@ -0,0 +1,23 @@+--lorenzL ; default parameters+lorenzL ar (sampleRate / 2) 10 28 2.667 0.05 0.1 0 0 * 0.2++-- lorenzL ; vary frequency+let x = mouseX kr 20 sampleRate Linear 0.1+in lorenzL ar x 10 27 2.667 0.05 0.1 0 0 * 0.3++-- lorenzL ; randomly modulate params+let nId e = lfNoise0Id e kr 0.5+ n0 = mul_add (nId 'α') 2 10+ n1 = mul_add (nId 'β') 20 38+ n2 = mul_add (nId 'γ') 1.5 2+in lorenzL ar sampleRate n0 n1 n2 0.05 0.1 0 0 * 0.2++-- lorenzL ; frequency control+let x = mouseX kr 1 200 Linear 0.1+ n = lorenzL ar x 10 28 2.667 0.05 0.1 0 0+in sinOsc ar (lag n 0.003 * 800 + 900) 0 * 0.4++-- lorenzL+let x = mouseX kr 1 200 Linear 0.1+ n = lorenzL ar x 10 28 2.667 0.05 0.1 0 0+in impulse ar (n * 4 + 8) 0 * 0.4
+ Help/Ugen/lorenzTrig.help.hs view
@@ -0,0 +1,18 @@+-- lorenzTrig ; randomly modulate params+let minfreq = 11025+ maxfreq = 44100+ s = lfNoise0Id 'α' kr 1 * 2 + 10+ b = lfNoise0Id 'β' kr 1 * 1.5 + 2+ r = 28+ h = 0.02+ x0 = 0.090879182417163+ y0 = 2.97077458055+ z0 = 24.282041054363+in X.lorenzTrig ar minfreq maxfreq s r b h x0 y0 z0 * 0.2++-- lorenzTrig ; as a frequency control+let x0 = 0.090879182417163+ y0 = 2.97077458055+ z0 = 24.282041054363+ n = X.lorenzTrig ar 1 8 10 28 28 0.02 x0 y0 z0+in sinOsc ar (decay n 1.0 * 800 + 900) 0 * 0.2
+ Help/Ugen/lores.help.hs view
@@ -0,0 +1,8 @@+-- lores+X.lores (whiteNoiseId 'α' ar * 0.5) 880 0.5++-- lores ; modulate param+let src = whiteNoiseId 'α' ar * 0.3+ freq = lfNoise0Id 'β' ar 4 * 500 + 600+ res = 0.9+in X.lores src freq res
+ Help/Ugen/loudness.help.hs view
@@ -0,0 +1,7 @@+-- loudness ; assume hop-size of half fft-size+let b = localBufId 'α' 1 1024+ x = mouseX kr 0.001 0.1 Exponential 0.2+ i = sinOsc ar 1000 0 * x+ f = fft' b i+ l = loudness f 0.25 6+in sinOsc ar (mce2 900 (l * 300 + 600)) 0 * 0.1
+ Help/Ugen/lpcAnalyzer.help.hs view
@@ -0,0 +1,17 @@+-- lpcAnalyzer+X.lpcAnalyzer (soundIn 0) (impulse ar 440 0 * 0.2) 256 50 0 0.999 0++-- lpcAnalyzer+X.lpcAnalyzer (soundIn 0) (impulse ar 440 0 * 0.2) 256 50 0 0.999 1++-- lpcAnalyzer+let x = mouseX kr 1 128 Linear 0.2+in X.lpcAnalyzer (soundIn 0) (impulse ar 440 0 * 0.2) 128 x 0 0.999 0++-- lpcAnalyzer+let x = mouseX kr 1 128 Linear 0.2+in X.lpcAnalyzer (soundIn 0) (impulse ar 440 0 * 0.2) 1024 x 0 0.999 1++-- lpcAnalyzer+let x = mouseX kr 1 256 Linear 0.2+in X.lpcAnalyzer (soundIn 0) (whiteNoiseId 'α' ar * 0.1) 256 x 0 0.999 0
+ Help/Ugen/lpf.help.hs view
@@ -0,0 +1,19 @@+-- lpf+let f = xLine kr 0.7 300 20 RemoveSynth+ ff = fSinOsc kr f 0 * 3600 + 4000+in lpf (saw ar 200 * 0.1) ff++-- lpf ; control rate filtering+let ctl = lpf (lfPulse kr 8 0 0.5) (mouseX kr 2 50 Exponential 0.1)+in sinOsc ar (ctl * 200 + 400) 0 * 0.1++-- lpf ; event control+let f (_,g,_,y,z,o,_,_,p,_,_) =+ let f0 = unitCps p+ in pan2 (lpf (blip ar f0 (1 + y * 5)) (f0 * 0.25)) (o * 2 - 1) (lagUD g 0.05 1 * z)+in mix (voicer 16 f) * control kr "gain" 4++-- lpf+let k = 32+ n = mceFill k (\i -> lpf (dust2Id i ar (int_to_ugen i + 1 / 3)) 1500)+in splay n (lfNoise2Id 'α' kr 0.1 `in_range` (0,1)) 1 0 True
+ Help/Ugen/lpg.help.hs view
@@ -0,0 +1,38 @@+-- lpg+let tempo = 8+ envdur = 0.25+ trig = impulse kr tempo 0+ squ = demand trig 0 (dseqId 'α' dinf (mce [400,99,791,2000,200])) `lag` 0.01+ sig = sinOscFB ar squ 1.1 + whiteNoiseId 'β' ar * 0.1+ env = envGen kr trig 1 0 (envdur / tempo) DoNothing (envPerc 0.1 0.9)+ flt = let c_off = lfSaw kr 0.1 0 `in_range` (0,0.2)+ c_mul = lfNoise2Id 'γ' kr 0.1 `in_range` (0.4,0.95)+ vca = lfNoise2Id 'δ' kr 1 `in_range` (0,1)+ in X.lpg sig env c_off c_mul vca 1.1 1 0+in pan2 flt (0.5 * tRandId 'ε' (-1) 1 trig) 0.25++-- lpg+let freq = lfNoise2Id 'α' kr 1 `in_range` (1,4)+ tr = impulse kr freq 0+ env = envGen kr tr 1 0 (1 / freq * 0.05) DoNothing (envPerc 0.1 1.5)+ o1 = sinOsc kr (lag3 env 0.1 `in_range` (100,10)) 0+ o2 = sinOsc ar ((lfNoise2Id 'β' kr 1 `in_exprange` (200,1000)) * o1) 0+ sig = whiteNoiseId 'γ' ar * 0.2 + o2+ flt = let c_mul = lfNoise2Id 'δ' kr 10.1 `in_range` (0.5,0.95)+ in X.lpg sig env 0 c_mul 0.091 1.35 1 1+in pan2 flt (sinOsc kr 0.1 0 * 0.25) 0.25++-- lpg+let tempo = 8+ envdur = 0.91+ tr = impulse kr tempo 0+ squ = demand tr 0 (dseqId 'α' dinf (mce [200,291,420,191,320])) `lag` 0.01+ mdl = tWChooseId 'β' tr (mce [0.5,1.0,1.5]) (mce [0.75, 0.125, 0.125]) 0+ sig = sinOscFB ar (squ * mdl) 1.1 + whiteNoiseId 'γ' ar * 0.1+ rnd = tRandId 'δ' 0 1 tr+ env = envGen kr tr 1 0 (envdur / tempo) DoNothing (envPerc rnd (1 - rnd))+ flt = let c_off = lfSaw kr 0.1 0 `in_range` (0,0.2)+ c_mul = lfNoise2Id 'ε' kr 0.1 `in_range` (0.4,0.95)+ vca = lfNoise2Id 'ζ' kr 1 `in_range` (0,1)+ in X.lpg sig env c_off c_mul vca 1.1 1 0+in pan2 flt (0.5 * tRandId 'η' (-1) 1 tr) 0.25
+ Help/Ugen/lpz1.help.hs view
@@ -0,0 +1,2 @@+-- lpz1+let n = whiteNoiseId 'α' ar * 0.05 in mce2 (n * 0.25) (lpz1 n)
+ Help/Ugen/lpz2.help.hs view
@@ -0,0 +1,2 @@+-- lpz2+let n = whiteNoiseId 'α' ar in lpz2 (n * 0.05)
+ Help/Ugen/lti.help.hs view
@@ -0,0 +1,5 @@+-- lti+let a = [0.02,-0.01]+ b = [1,0.7,0,0,0,0,-0.8,0,0,0,0,0.9,0,0,0,-0.5,0,0,0,0,0,0,0.25,0.1,0.25]+ z = pinkNoiseId 'α' ar * 0.1+in X.lti ar z (asLocalBufId 'β' a) (asLocalBufId 'γ' b)
+ Help/Ugen/mantissaMask.help.hs view
@@ -0,0 +1,2 @@+-- mantissaMask+mantissaMask (sinOsc ar (sinOsc kr 0.2 0 * 400 + 500) 0 * 0.2) 3
+ Help/Ugen/max.help.hs view
@@ -0,0 +1,10 @@+-- max+(sinOsc ar 500 0 `max` sinOsc ar 0.1 0) * 0.1++-- max ; rate selection ; derive from left+let f = (sinOsc ar 0.2 0 `max` sinOsc kr 0.9 0) * 200 + 300+in sinOsc ar f 0 * 0.1++-- max ; rate selection ; derive from right+let f = (sinOsc kr 0.2 0 `max` sinOsc ar 0.9 0) * 200 + 300+in sinOsc ar f 0 * 0.1
+ Help/Ugen/mce.help.hs view
@@ -0,0 +1,24 @@+-- mce ; nested ; channel layout is L=440,441 and R=660,661+let f = mce2 (mce2 440 660) (mce2 441 661)+in mix (sinOsc ar f 0 * 0.1)++-- mceFill ; c.f. uclone_all+mceFillInt 2 (\z -> brownNoiseId z ar * 0.05)++-- mceFillId+mceFillId 'α' 2 (\z i -> brownNoiseId z ar * 0.025 * (i + 1))++-- mce ; one out ; two channels+sinOsc ar (mce2 440 441) 0 * 0.1++-- mce ; two out ; each single channel ; hence mono+sinOsc ar (mce1 (mce2 440 441)) 0 * 0.1++---- mce ; isList ; :set -XOverloadedLists (~/.ghci)+sinOsc ar [440,441] 0 * 0.1++---- mce ; isList ; :set -XOverloadedLists (~/.ghci) ; channel layout is L=440,441 and R=660,661+mix (sinOsc ar [[440,660],[441,661]] 0) * 0.1++---- ; c.f uclone_all+Protect.uclone_allId 'α' 2 (brownNoiseId 'β' ar) * 0.05
+ Help/Ugen/mdaPiano.help.hs view
@@ -0,0 +1,9 @@+-- mdaPiano ; trigger notes, three voices+let trigFreq = mce3 2 3 5+ freq = midiCps (lfNoise0Id 'α' kr trigFreq * 25 + 48) -- random note (internal rounding)+ gate = lfPulse kr trigFreq 0 0.5+ vel = lfPar kr (mce3 0.1 0.2 0.3) 0 * 35 + 55 -- varying velocity (0-127)+ hard = tRand 0.2 0.8 gate+ stereo = 0.5+ random = tRand 0 0.35 gate -- randomness of tuning+in mix (X.mdaPiano ar freq gate vel 0.8 hard 0.8 0.8 0.8 0.8 0.8 stereo 0.5 random 0.1 0) * 0.1
+ Help/Ugen/meddis.help.hs view
@@ -0,0 +1,5 @@+-- meddis ; passing a signal through the hair cell+X.meddis (sinOsc ar 440 0)++-- meddis ; recursive hair cell compression+X.meddis (X.meddis (soundIn 0))
+ Help/Ugen/median.help.hs view
@@ -0,0 +1,16 @@+-- median ; signal with impulse noise+let n = dust2Id 'α' ar 100+in median 3 (saw ar 500 * 0.1 + n * 0.9)++-- median ; length can be increased for longer duration noise+let n = dust2Id 'α' ar 100+in median 5 (saw ar 500 * 0.1 + lpz1 (n * 0.9))++-- median ; long filters begin chopping off the peaks of the waveform+let x = sinOsc ar 1000 0 * 0.2+in mce [x, median 31 x]++-- median ; median = high frequency noise ; leakDC = low frequency noise+let n = whiteNoiseId 'α' ar+ s = median 31 (n * 0.1 + sinOsc ar 800 0 * 0.1)+in leakDC s 0.9
+ Help/Ugen/membraneCircle.help.hs view
@@ -0,0 +1,20 @@+-- membraneCircle ; X = tension and impulse frequency, Y = duration, release-time and amplitude+let x = mouseX kr 0 1 Linear 0.2+ y = mouseY kr 1e-9 1 Exponential 0.2+ loss = linLin y 0 1 0.999999 0.999+ wobble = sinOsc kr 2 0+ tension = linLin x 0 1 0.01 0.1 + (wobble * 0.0001)+ p = envPerc 0.0001 y+ tr = impulse kr (linLin x 0 1 3 9) 0+ e = envGen kr tr (linLin y 0 1 0.05 0.25) 0 0.1 DoNothing p+in X.membraneCircle ar (pinkNoiseId 'α' ar * e) tension loss++-- membraneCircle ; event control+let f (_,g,x,y,z,o,_,_,_,_,_) =+ let loss = linExp y 0 1 0.99999 0.99950+ wobble = sinOsc kr 2 0+ tension = linExp x 0 1 0.01 0.1 + (wobble * 0.0001)+ p = envPerc 0.0001 (1 - z)+ e = envGen kr g (z + y / 4) 0 0.1 DoNothing p+ in pan2 (X.membraneCircle ar (pinkNoiseId 'α' ar * e) tension loss) (o * 2 - 1) 1+in mix (voicer 6 f) * control kr "gain" 1
+ Help/Ugen/membraneHexagon.help.hs view
@@ -0,0 +1,14 @@+-- membraneHexagon ; mouse control+let mb = mouseButton kr 0 1 0.2+ mx = mouseX kr 0.01 0.1 Linear 0.2+ my = mouseY kr 0.999999 0.999 Exponential 0.2+ ex = pinkNoiseId 'α' ar * envGen kr mb 0.4 0 0.1 DoNothing (envPerc 0.01 1)+in X.membraneHexagon ar ex mx my++-- membraneHexagon ; event control ; requires=voicer+let f (_,g,x,y,z,o,rx,_,_,_,_) =+ let ex = pinkNoiseId 'α' ar * envGen kr g z 0 0.1 DoNothing (envPerc (0.02 * rx) 1)+ tn = x * 0.1+ ls = linExp y 0 1 0.999999 0.9999+ in pan2 (X.membraneHexagon ar ex tn ls) (o * 2 - 1) 1+in mix (voicer 16 f) * control kr "gain" 1
+ Help/Ugen/metro.help.hs view
@@ -0,0 +1,13 @@+-- metro+X.metro ar 60 1++-- metro+let b = xLine kr 60 120 5 DoNothing+ m = X.metro kr b 1+ o = sinOsc ar 440 0 * 0.1+in decay m 0.2 * o++-- metro+let b = range 30 240 (lfNoise2Id 'α' kr 0.2)+ n = dseqId 'β' dinf (mce [1,0.25,0.5,0.25])+in decay (X.metro kr b n) 0.2 * sinOsc ar 440 0 * 0.1
+ Help/Ugen/miBraids.help.hs view
@@ -0,0 +1,67 @@+-- MiBraids ; 6:SAW_SUB+X.miBraids ar 60 0.5 0.5 (X.miBraids_mode "SAW_SUB") 0 0 0 0 0 * 0.1++-- MiBraids ; 1:MORPH ; some modulation+let timb = lfNoise1Id 'α' kr 0.5 * 0.5 + 0.5+in X.miBraids ar 40 timb 0 (X.miBraids_mode "MORPH") 0 0 0 0 0 * 0.05++-- MiBraids ; 21:VOSIM+let pit = roundE (range 33 66 (lfNoise0Id 'α' kr 4))+ timb = lfNoise1Id 'α' kr 0.3 * 0.5 + 0.5+ color = lfNoise1Id 'α' kr 0.3 * 0.5 + 0.5+in X.miBraids ar pit timb color (X.miBraids_mode "VOSIM") 0 0 0 0 0 * 0.1++-- MiBraids ; 21:VOSIM ; event control+let f (_,g,x,y,z,o,rx,_,_,_,_) =+ let md = X.miBraids_mode "VOSIM"+ mnn = x * 24 + 36 -- x * 12 + 78+ in pan2 (X.miBraids ar mnn (y * 0.75) rx md 0 0 0 0 0) (o * 2 - 1) (g * z)+in mix (voicer 16 f) * control kr "gain" 1++-- MiBraids ; 31:FLUTED+let pit = 38;+ timb = mouseX kr 0.7 1 Linear 0.2+ color = mouseY kr 0 1 Linear 0.2+in X.miBraids ar pit timb color (X.miBraids_mode "FLUTED") 0 1 0 0 0 * 0.1++-- MiBraids ; scanning+let timb = lfNoise1Id 'α' kr 0.3 * 0.5 + 0.5+ color = lfNoise1Id 'β' kr 0.3 * 0.5 + 0.5+ pit = mouseY kr 33 73 Linear 0.2+ model = mouseX kr 0 47 Linear 0.2+in X.miBraids ar pit timb color model 0 0 0 0 0 * 0.1++-- MiBraids ; 40:WAVE_PARAPHONIC+let timb = lfNoise1Id 'α' kr 0.03 * 0.5 + 0.5+ color = lfNoise1Id 'β' kr 0.05 * 0.5 + 0.5 -- chord+in X.miBraids ar 38 timb color (X.miBraids_mode "WAVE_PARAPHONIC") 0 1 0 0 0 * 0.1++-- MiBraids ; trigger (28:PLUCKED)+let tr = dustId 'α' kr 0.6+ pit = roundE (tRandId 'β' 45 72 tr)+ timb = 0.5+ color = lfNoise1Id 'γ' kr 0.3 * 0.5 + 0.5+in X.miBraids ar pit timb color (X.miBraids_mode "PLUCKED") tr 0 0 0 0 * 0.1++-- MiBraids ; 28:PLUCKED ; event control+let f (_,g,x,y,_,o,rx,_,_,_,_) =+ let tr = trig1 g controlDur+ pit = x * 24 + 45+ timb = latch y tr * 0.5 + 0.25+ color = latch rx tr * 0.25 + 0.65+ md = X.miBraids_mode "PLUCKED"+ in pan2 (X.miBraids ar pit timb color md tr 0 0 0 0) (o * 2 - 1) (trig1 g 16 * 0.1)+in mix (voicer 16 f) * control kr "gain" 1++-- MiBraids ; 34:KICK+let tr = impulse kr 4 0+ pit = roundE (range 30 50 (latch (pinkNoiseId 'α' kr) tr))+ timb = lfNoise1Id 'β' kr 0.4 * 0.5 + 0.5+ color = lfNoise1Id 'γ' kr 0.3 * 0.5 + 0.5+in X.miBraids ar pit timb color (X.miBraids_mode "KICK") tr 0 0 0 0 * 0.2++-- MiBraids ; sample rate, bit reduction and distortion+let tr = coinGateId 'α' 0.3 (impulse kr 4 0)+ decim = tRandId 'β' 1 32 tr+ dist = range 0 1 (lfTri kr 0.2 0)+in X.miBraids ar 40 0.7 0.7 (X.miBraids_mode "KICK") tr 2 decim 3 dist * 0.1
+ Help/Ugen/miClouds.help.hs view
@@ -0,0 +1,45 @@+-- MiClouds ; basic granulation ; requires=buf (stereo) ; 0=GRANULAR+let (buf, nc) = (control kr "buf" 100, 2)+ input = playBuf nc ar buf 1 1 0 Loop DoNothing+ dens = lfNoise1Id 'α' kr 0.3 `in_range` (0.3,0.45)+in X.miClouds ar 0 0 0 dens 0.5 1 1 0.5 0 0 0 (X.miClouds_mode "GRANULAR") 0 0 input++-- MiClouds+let imp = dustId 'α' ar (mce2 0.8 1.1)+ freq = midiCps (latch (pinkNoiseId 'β' ar * 24 + 80) imp)+ input = rlpf imp freq 0.002 * 4+ pit = lfNoise1Id 'γ' kr 0.3 * 12+ pos = lfNoise2Id 'δ' kr 0.4 * 0.5 + 0.5+ size = lfNoise1Id 'ε' kr 0.3 * 0.5 + 0.5+ dens = lfNoise1Id 'ζ' kr 0.3 * 0.5 + 0.5+ tex = lfNoise1Id 'η' kr 0.3 * 0.5 + 0.5+ frez = lfClipNoiseId 'θ' kr 0.3+in X.miClouds ar pit pos size dens tex 0.5 2 0.5 0.3 0.8 frez (X.miClouds_mode "GRANULAR") 1 0 input++-- MiClouds ; using external grain trigger ; requires=buf (stereo)+let (buf, nc) = (control kr "buf" 100, 2)+ input = playBuf nc ar buf 1 1 0 Loop DoNothing+ dens = 0.5+ tr = dustId 'α' kr 10+in X.miClouds ar (-5) 0 0.2 dens 0.5 1 1 0.5 0 0 0 (X.miClouds_mode "GRANULAR") 0 tr input++-- MiClouds ; 3=SPECTRAL ; (this mode causes high CPU peaks)+let (buf, nc) = (control kr "buf" 100, 2)+ input = playBuf nc ar buf 1 1 0 Loop DoNothing+ size = 0.35+ dens = 0.02+ tex = 0.3+in X.miClouds ar 0 0 size dens tex 1 1 0.5 0.8 0.8 0 (X.miClouds_mode "SPECTRAL") 0 0 input * 0.35++-- MiClouds ; spectral again ; watch volume+let (buf, nc) = (control kr "buf" 100, 2)+ input = playBuf nc ar buf 1 1 0 Loop DoNothing+ size = squared (range 0.1 0.5 (lfNoise1Id 'α' kr 0.2))+ dens = lfNoise1Id 'β' kr 0.3 * 0.5 + 0.5+ tex = lfNoise1Id 'γ' kr 0.3 * 0.5 + 0.5+in X.miClouds ar 0 0 size dens tex 1 1 0.5 0.6 0.6 0 (X.miClouds_mode "SPECTRAL") 1 0 input * 0.25++---- ; allocate buffer 0, required for examples+ld fn = withSc3 (async (b_allocRead 0 (sfResolve fn) 0 0))+ld "crotale05(D).wav"+ld "saron-panerus-S-0-5.flac"
+ Help/Ugen/miElements.help.hs view
@@ -0,0 +1,97 @@+-- miElements ; basic ; model=0=Modal+let inp = pinkNoiseId 'α' ar * 0.3+ gat = lfPulse kr 2 0 0.5+in X.miElements ar {-blow_in-} inp 0 gat 45 0.5 0.2 0 0 0 0.5 0.5 0.5 0.5 0.5 0.25 0.5 0.7 0.2 0.3 {-model-} 0 0++-- miElements ; ringing ; useId 'blow' input and contour set to 0.5+let inp = pinkNoiseId 'α' ar * 0.3+in X.miElements ar inp 0 1 48 0.5 {-contour-} 0.5 0 0 0 0.5 0.5 0.5 0.5 0.5 0.25 0.5 0.7 0.2 0.3 0 0++-- miElements ; ringing ; use theId 'strike' input (which bypasses the exciter section)+let inp = pinkNoiseId 'α' ar * 0.3+in X.miElements ar 0 {-strike_in-} inp 0 48 0.5 0.2 0 0 0 0.5 0.5 0.5 0.5 0.5 0.25 0.5 0.7 0.2 0.3 0 0++-- miElements ; bow+let pit = iRandId 'α' 32 44+ bow_timb = lfNoise1Id 'β' kr 0.3 * 0.5 + 0.5+in X.miElements ar 0 0 1 pit 0.5 0.5 1 0 0 0.5 0.5 bow_timb 0.5 0.5 0.25 0.5 0.7 0.2 0.3 0 0 * 0.25++-- miElements ; blow+let mod1 = lfNoise1Id 'α' kr 0.4 * 0.5 + 0.5+ mod2 = lfNoise1Id 'β' kr 0.2 * 0.5 + 0.5+ pit = lfNoise0Id 'γ' kr 0.1 `in_range` (32,44)+in X.miElements ar 0 0 1 pit 0.5 0.5 0 0.6 0 mod1 0.5 0.5 mod2 0.5 0.25 0.5 0.7 0.2 0.3 0 0 * 0.2++-- miElements ; blow ; contour+let gat = lfPulse kr 1 0.01 0.5+ pit = sinOsc kr 5 0 * 0.1 + 53+ cont = sinOsc kr 0.8 0 `in_range` (0,1)+ flow = lfNoise1Id 'α' kr 0.1 `in_range` (0,1)+in X.miElements ar 0 0 gat pit 0.5 cont 0 0.5 0 flow 0.5 0.5 0.3 0.5 0.25 0.3 0.8 0.2 0.3 0 0 * 0.25++-- miElements ; model=0=MODAL ; event control+let f (_,g,x,y,z,o,rx,ry,_,_,_) =+ let tr = trig1 g controlDur+ pit = x * 24 + 56+ stre = ry * 0.5 + 0.25+ cont = y+ flo = o+ geo = 0.15 + (latch y tr * 0.35)+ bri = 0.5 - y * 0.35+ dmp = 1 - x * 0.25+ pos = o * 0.5+ spc = 0.5 - y * 0.5+ md = 0+ in X.miElements ar 0 0 g pit stre cont 0 z 0 flo 0.5 0.5 (0.25 + rx * 0.5) 0.5 geo bri dmp pos spc md 0 * 0.25+in mix (voicer 6 f) * control kr "gain" 1++-- miElements ; metal, bells+let tr = dustId 'α' ar 2.5+ inp = decay tr 0.01+ g = X.tBrownRandId 'β' 0.5 0.9 0.2 0 (coinGateId 'γ' 0.05 tr)+ space = range 0.5 1 (lfNoise1Id 'δ' kr 0.1)+in X.miElements ar 0 inp 0 40 0.5 0.2 0 0 0 0.5 0.5 0.5 0.5 0.5 g 0.4 0.9 0.2 space 0 0 * 0.35++-- miElements ; metal, bells ; event control+let f (_,g,x,y,z,o,_,_,_,_,_) =+ let tr = trig1 (k2a g) sampleDur+ inp = decay (tr * z * 4) 0.01+ pit = latch x g * 12 + 36+ geo = latch y g * 0.4 + 0.5+ spc = o * 0.5 + 0.5+ in X.miElements ar 0 inp 0 pit 0.5 0.2 0 0 0 0.5 0.5 0.5 0.5 0.5 geo 0.4 0.9 0.2 spc 0 0+in mix (voicer 6 f) * control kr "gain" 1++-- miElements ; strike input ; playing chords ; model=2=Strings+let inp = decay (dustId 'α' ar 1) 0.01+ g = lfNoise1Id 'β' kr 0.1 * 0.5 + 0.5+in X.miElements ar 0 inp 0 {-pit-} 53 0.5 0.2 0 0 0 0.5 0.5 0.5 0.5 0.5 {-geom-} g {-bright-} 0.5 {-damp-} 0.9 0.2 0.3 {-model-} 2 0++-- miElements ; metal, bells ; event control+let f (_,g,x,y,z,o,rx,_,_,_,_) =+ let tr = trig1 (k2a g) sampleDur+ inp = decay tr 0.01+ pit = x * 12 + 48+ geo = latch o g -- lfNoise1Id 'β' kr 0.1 * 0.5 + 0.5+ bri = latch y g+ dam = latch (0.9 - z) g+ md = 2+ in X.miElements ar 0 inp 0 pit 0.5 0.2 0 0 0 0.5 0.5 0.5 0.5 0.5 geo bri dam 0.2 0.3 md 0+in mix (voicer 6 f) * control kr "gain" 1++-- miElements ; mallets, strength+let gat = coinGateId 'α' 0.4 (impulse kr 6 0)+ stren = tRandId 'β' 0 1 gat+ strike_timbre = lfNoise1Id 'γ' kr 0.3 * 0.5 + 0.5+in X.miElements ar 0 0 gat {-pit-} 40 stren 0.2 0 0 {-strike_level-} 0.5 0.5 {-mallet-} 0.7 0.5 0.5 strike_timbre 0.25 {-bright-} 0.3 {-damp-} 0.85 0.2 {-space-} 0.6 0 0 * 0.5++-- miElements ; mallets ; particles (mallet type=1 --> use internal model of bouncing particles)+let strike_timbre = lfNoise1Id 'α' kr 0.3 * 0.5 + 0.5+ g = range 0.4 0.7 (lfNoise2Id 'β' kr 0.1)+ maltype = 1+in X.miElements ar 0 0 {-gate-} 1 {-pit-} 40 0.5 {-contour-} 0.5 0 0 {-strike_level-} 0.5 0.5 {-mallet-} maltype 0.5 0.5 strike_timbre {-geom-} g 0.5 0.7 0.2 0.3 0 0++-- miElements ; easteregg: 2x2-op FM synth+let n = lfNoise1Id 'α' kr 0.3 * 0.5 + 0.5+ (r1,r2,r3) = (0.25,0.25,0.51)+in X.miElements ar 0 0 {-gate-} 1 48 {-strength-} 0.9 {-contour-} 0.5 {-bow_level-} r1 {-blow_level-} 0.6 {-strike_level-} 0.5 {-flow-} r2 {-mallet-} r3 {-bow_timb-} n {-blow_timb-} 0.3 {-strike_timb-} 0.6 {-geom-} 0.12 {-bright-} 0.6 {-damp-} 0.5 0.2 {-space-} 0.7 0 {-easteregg-} 1
+ Help/Ugen/miOmi.help.hs view
@@ -0,0 +1,18 @@+-- MiOmi ; basic+X.miOmi ar 0 0 {-pit-} 50 0.2 0.25 {-level1-} 1 {-level2-} 0.5 {-ratio1-} 0.49 0.5 {-fm1-} 0.5 0 0 0 0 0.5 0 0.5 0.5 0.2 0.5 * 0.25++-- MiOmi ; external FM+let fmfreq = mouseX kr 2 1000 Linear 0.2+ fmamp = mouseY kr 0 1 Linear 0.2+ extFM = sinOsc ar fmfreq 0 * fmamp+in X.miOmi ar extFM 0 {-pit-} 40 0.2 0.25 0.5 0.5 0.5 0.5 {-fm1-} 0.5 {-fm2-} 0.5 0 {-xfb-} 0.1 0 {-cutoff-} 0.9 0 0.5 0.5 0.2 0.5 * 0.5++-- MiOmi ; filter and cutoff modulation+let filtmod = range 0 1 (lfTri kr 0.23 0)+ gat = lfPulse kr 6 0 0.2+ cf = range 0 0.5 (lfTri kr 0.2 0)+in X.miOmi ar 0 gat 48 {-contour-} 0.1 0.25 0.5 0.5 0.5 0.5 {-fm1-} 0.5 {-fm2-} 0.5 {-fb-} 0.5 0 filtmod cf 0 {-strength-} 0 0.5 0.2 0.5++-- MiOmi ; cross feedback+let xfb = range 0 1 (lfTri kr 0.2 0)+in X.miOmi ar 0 0 {-pit-} 43 0.2 0.25 0.5 0.5 0.5 0.5 0 0 0 {-xfb-} xfb 0 0.5 0 0.5 0.5 0.2 0.5 * 0.25
+ Help/Ugen/miPlaits.help.hs view
@@ -0,0 +1,82 @@+-- MiPlaits ; basics ; 0=virtual_analog+X.miPlaits ar 35 (X.miPlaits_mode "virtual_analog") 0.252 0.5 0.2 0 0 0 0 0 0.5 0.5 * 0.1++-- MiPlaits ; Mouse control ; 2=fm+let harm = mouseX kr 0 1 Linear 0.2+ timb = mouseY kr 0 1 Linear 0.2+in X.miPlaits ar 48 (X.miPlaits_mode "fm") harm timb 0.5 0 0 0 0 0 0.5 0.5 * 0.1++-- MiPlaits ; some talking ; 7=speech+let ptch = mouseY kr 24 72 Linear 0.2+ harm = mouseX kr 0 1 Linear 0.2+ mrph = lfSaw ar 0.11 0 * 0.5 + 0.5+in X.miPlaits ar ptch (X.miPlaits_mode "speech") harm 0.5 mrph 0 0 0 0 0 0.5 0.5 * 0.1++-- MiPlaits ; scanning through some engines + vibrato+let pit = 50+ vib = sinOsc ar 6 0 * 0.3+ eng = lfNoise0Id 'α' kr 0.5 * 4 + 4+in X.miPlaits ar (pit + vib) eng 0.1 0.5 0.5 0 0 0 0 0 0.5 0.5 * 0.1++-- MiPlaits ; some FM+let harm = mouseX kr 0 1 Linear 0.2+ timbre = mouseY kr 0 1 Linear 0.2+ morph = range 0 1 (lfNoise2Id 'α' kr 0.2)+ trigger = impulse ar 8 0+in X.miPlaits ar 48 (X.miPlaits_mode "fm") harm timbre morph trigger 0 0 0 0 0.5 0.5 * 0.1++-- MiPlaits ; 5=wavetable+let trigger = impulse kr 8 0+ harm = lfNoise2Id 'α' kr 0.3 * 0.25 + 0.25+ timbre = lfNoise1Id 'α' kr 0.4 * 0.5 + 0.5+ dec = range 0.01 0.8 (lfNoise2Id 'α' kr 0.2)+in X.miPlaits ar 44 (X.miPlaits_mode "wavetable") harm timbre 0 trigger 0 0 0 0 dec 0.5 * 0.2++-- MiPlaits ; 6=chord+let harm = mouseY kr 0 1 Linear 0.2 -- select chord+ trigger = impulse kr 6 0+ lev = tRandId 'α' 0 1 trigger+in mceChannel 0 (X.miPlaits ar 40 (X.miPlaits_mode "chord") harm 0.5 0.5 trigger (lev * lev) 0 0.4 0 0.5 0.5) * 0.1++-- MiPlaits ; 8=swarm ; super saw+let pit = tiRandId 'α' 39 49 (dustId 'β' kr 0.5)+in mceChannel 0 (X.miPlaits ar pit (X.miPlaits_mode "swarm") 0.16 0 1 0 0 0 0 0 0.5 0.5) * 0.1++-- MiPlaits ; slow swarm+X.miPlaits ar 48 (X.miPlaits_mode "swarm") 0.9 0 0.5 0 0 0 0 0 0.5 0.5 * mce2 0.04 0.15++-- MiPlaits ; 11=string ; inharmonic+let harm = range 0 1 (lfNoise2Id 'α' kr 0.2)+in mceChannel 0 (X.miPlaits ar 60 (X.miPlaits_mode "string") harm 0 0.85 0 0 0 0 0 0.5 0.5)++-- MiPlaits ; 12=modal+let harm = range 0 1 (lfNoise2Id 'α' kr 0.2)+ trigger = impulse kr 1 0+ lev = squared (tRandId 'β' 0 1 trigger)+in mix (X.miPlaits ar 56 (X.miPlaits_mode "modal") harm 0 0.85 trigger lev 0 0 0 0.5 0.5)++-- MiPlaits ; snare drums+let harm = range 0 0.5 (lfNoise2Id 'α' kr 0.5)+ timbre = 0.173+ morph = 0.827+ trigger = impulse kr 8 0+ lev = squared (tRandId 'β' 0 1 trigger)+in X.miPlaits ar 47 14 harm timbre morph trigger lev 0.2 0.43 0 0.4 0.5 * 0.1++-- MiPlaits ; filtered noise+let harm = 0.575+ timbre = 0.02+ morph = range_hs (0.55,0.9) (lfNoise1Id 'α' kr 0.3) -- filter resonance+in X.miPlaits ar 62 9 harm timbre morph 0 0 0 0 0 0.5 0.5 * 0.25++-- MiPlaits ; something...+let trigger = dustId 'α' kr (range_hs (0.1,7) (lfNoise2Id 'β' kr 0.1))+ harmonics = sinOsc kr 0.03 0 * 0.5 + 0.5+ timbre = lfTri kr 0.07 0 * 0.5 + 0.5+ morph = lfTri kr 0.11 0 * 0.5 + 0.5+ pitch_ = tiRandId 'γ' 24 48 trigger+ engine = roundE (tRandId 'δ' 0 15 trigger)+ sub = sinOsc ar (midiCps pitch_) 0 * 0.1+ mi = X.miPlaits ar pitch_ engine harmonics timbre morph trigger 0 0 0 0 0.8 0.2 * 0.5+in (mi + sub) * 0.2+
+ Help/Ugen/miRings.help.hs view
@@ -0,0 +1,86 @@+-- MiRings ; basics ; 0=MODAL_RESONATOR+X.miRings ar (impulse ar 1 0) 0 60 0.25 0.5 0.7 0.25 (X.miRings_mode "MODAL_RESONATOR") 1 0 0 0++-- MiRings ; basics ; 0=MODAL_RESONATOR ; event control+let f (_,g,x,y,z,o,rx,ry,_,_,_) =+ let tr = trig1 g controlDur+ md = X.miRings_mode "MODAL_RESONATOR"+ in X.miRings ar 0+ tr (x * 24 + 36) (latch o tr * 0.75 + 0.25) (y * 0.65 + 0.15) (0.7 - latch rx tr) (0.25 + latch ry tr)+ md 1 0 0 0 * z+in mix (voicer 16 f) * control kr "gain" 4++-- MiRings ; basics+X.miRings ar (pinkNoiseId 'α' ar * 0.05) 0 40 0.25 0.5 0.7 0.25 (X.miRings_mode "MODAL_RESONATOR") 1 0 0 0++-- MiRings ; using theId 'trig' input to excite the resonator ; 1=SYMPATHETIC_STRING+X.miRings ar 0 (dustId 'α' kr 0.7) 33 0.25 0.5 0.7 0.25 (X.miRings_mode "SYMPATHETIC_STRING") 1 0 0 0 * 0.2++-- MiRings ; basics ; 1=SYMPATHETIC_STRING ; event control+let f (_,g,x,y,z,o,rx,ry,_,_,_) =+ let tr = trig1 g controlDur+ md = X.miRings_mode "SYMPATHETIC_STRING"+ in X.miRings ar 0+ tr (x * 24 + 36) (latch o tr * 0.75 + 0.25) (y * 0.65 + 0.15) (0.7 - latch rx tr) (0.25 + latch ry tr)+ md 1 0 0 0 * z+in mix (voicer 16 f) * control kr "gain" 2++-- MiRings ; using theId 'pit' input to set midi pitch and excite the resonator+X.miRings ar 0 0 (range 30 50 (lfNoise0Id 'α' kr 2)) 0.25 0.5 0.7 0.25 (X.miRings_mode "SYMPATHETIC_STRING") 1 0 0 0 * 0.2++-- MiRings ; 2=MODULATED/INHARMONIC_STRING+X.miRings ar 0 0 (range 30 50 (lfNoise0Id 'α' kr 2)) 0.25 0.5 0.7 0.25 (X.miRings_mode "MODULATED/INHARMONIC_STRING") 1 0 0 0 * 0.2++-- MiRings ; basics ; 2=MODULATED/INHARMONIC_STRING ; event control+let f (_,g,x,y,z,o,rx,ry,_,_,_) =+ let tr = trig1 g controlDur+ md = X.miRings_mode "MODULATED/INHARMONIC_STRING"+ in X.miRings ar 0+ tr (x * 24 + 36) (0.25 + latch o tr * 0.15) (0.25 + y * 0.5) (0.7 - latch rx tr * 0.15) (0.25 + latch ry tr * 0.15)+ md 1 0 0 0 * z+in mix (voicer 16 f) * control kr "gain" 2++-- MiRings ; sympathetic strings+let tr = dustId 'α' kr 1+ pit = roundE (range 30 60 (latch (whiteNoiseId 'β' kr) tr))+ struct = range 0 1 (lfNoise2Id 'γ' kr 0.4)+in X.miRings ar 0 0 pit struct 0.5 0.7 0.25 (X.miRings_mode "SYMPATHETIC_STRING") 4 0 0 0 * 0.25++-- MiRings ; inharmonic string+let tr = dustId 'α' kr 3+ trPit = dustId 'β' kr 0.5+ pit = range 30 60 (latch (whiteNoiseId 'γ' kr) trPit)+ struct = range 0.1 1 (latch (pinkNoiseId 'δ' kr) tr)+in X.miRings ar 0 tr pit struct 0.5 0.8 0.25 (X.miRings_mode "MODULATED/INHARMONIC_STRING") 4 0 0 0 * 0.25++-- MiRings ; simple vibrato+let tr = dustId 'α' kr 0.5+ pit = range 36 48 (latch (whiteNoiseId 'β' kr) tr)+ vib = sinOsc kr 3 0+in X.miRings ar 0 0 (pit + vib) 0.2 0.5 0.7 0.25 (X.miRings_mode "MODAL_RESONATOR") 1 0 0 0++-- MiRings ;Id 'intern_exciter' OFF+X.miRings ar (pinkNoiseId 'α' ar * 0.1) (impulse kr 1 0) 60 0.25 0.5 0.7 0.25 (X.miRings_mode "MODAL_RESONATOR") 2 0 0 0 * 0.25++-- MiRings ;Id 'intern_exciter' ON+X.miRings ar (pinkNoiseId 'α' ar * 0.1) (impulse kr 1 0) 60 0.25 0.5 0.7 0.25 (X.miRings_mode "MODAL_RESONATOR") 2 1 0 0 * 0.25++-- MiRings ; intern_exciter ON+let input = crackle ar 1.999 * 0.2+ tr = dustId 'α' ar 0.7+ bright = range 0.1 0.8 (lfNoise1Id 'β' kr 0.4)+ pos = range 0 1 (lfNoise2Id 'γ' kr 0.1)+in X.miRings ar input tr 56 0.1 bright 0.6 pos (X.miRings_mode "MODAL_RESONATOR") 3 1 0 0 * 0.35++-- MiRings ; 5=STRING_AND_REVERB --> spacey ; forceId 'internal exciter'+let md = X.miRings_mode "STRING_AND_REVERB"+ input = pinkNoiseId 'α' ar * 0.2+ tr = dustId 'β' kr 0.7+ struct = range 0 1 (lfNoise1Id 'γ' kr 0.4)+ pos = range 0 1 (lfNoise2Id 'δ' kr 0.1)+in X.miRings ar input tr 60 struct 0.5 0.7 pos md 4 1 0 0 * 0.25++-- MiRings ; easter egg --> drone ; set damp to 1.0 to get a sustaining sound that doesn't need to be triggered+let struct = range 0 1 (lfNoise2Id 'α' kr 0.2)+ brightness = range 0 1 (lfNoise1Id 'β' kr 0.5)+in X.miRings ar 0 0 40 struct brightness 1 0.9 (X.miRings_mode "MODULATED/INHARMONIC_STRING") 2 0 1 0 * 0.25
+ Help/Ugen/miRipples.help.hs view
@@ -0,0 +1,17 @@+-- MiRipples ; basic+X.miRipples (saw ar 60) 0.4 0.3 1++-- MiRipples+let cf = range 0 1 (lfNoise0Id 'α' kr 4)+in X.miRipples (saw ar 60) cf 0.6 1 * 0.5++-- MiRipples ; filter sweep + distortion+let cf = range 0.1 0.9 (lfTri kr 0.03 0)+in X.miRipples (saw ar 40) cf 0.8 4 * 0.2++-- MiRipples+let tr = impulse ar 4 0+ input = decay tr 0.1+ cf = tRandId 'α' 0.1 0.6 tr+ filt = rlpf cf 80 0.3+in X.miRipples input filt 0.8 3 * 0.5
+ Help/Ugen/miTides.help.hs view
@@ -0,0 +1,84 @@+-- MiTides ; shape+let shape = lfTri ar 0.11 0 `in_range` (0,1)+ c0 = mceChannel 0+in c0 (X.miTides ar 100 shape 0.5 0.5 0.2 0 0 {-output_mode:-} 2 1 9 1) * 0.25++-- MiTides ; slope+let slope = lfTri ar 0.11 0 `in_range` (0,1)+ c0 = mceChannel 0+in c0 (X.miTides ar 100 0.5 slope 0.5 0.2 0 0 {-output_mode:-} 2 1 9 1) * 0.25++-- MiTides ; phasing+let shape = 0.2+ slope_ = 0.0+ shift_ = lfNoise1Id 'α' ar 0.3 `in_range` (0,1) -- slightly shift phases+ smooth = lfNoise1Id 'β' kr 0.02 `in_range` (0.1,0.9)+ sig = X.miTides ar 70 shape slope_ smooth shift_ 0 0 {-output_mode:-} 2 1 9 1 * 0.15+in splay sig 1 1 0 True++-- MiTides ; chords ; tremolo+let shape = lfTri ar 0.11 0 `in_range` (0,1)+ slope_ = lfTri ar 0.2 0 `in_range` (0,1);+ chord = lfNoise1Id 'α' ar 0.1 `in_range` (0.5,1);+ smooth = sinOsc ar (lfNoise1Id 'β' kr 0.2 `in_range` (0.1,10)) 0 `in_range` (0,0.5)+ sig = X.miTides ar 200 shape slope_ smooth chord 0 0 {-output_mode:-} 3 1 9 1 * 0.25+in splay sig 1 1 0 True++-- MiTides ; amplitude mode+let freq = 0.15+ shape = 0.2+ slope_ = 0.2+ level = lfTri ar 0.1 0 `in_range` (0,1)+ env = X.miTides ar freq shape slope_ 0.3 level 0 0 {-output_mode:-} 1 {-ramp_mode:-} 1 9 1+ sines = sinOsc ar (mce [200,300,500,900]) 0+in splay (sines * env) 1 1 0 True++-- MiTides ; amplitude ; trigger input+let freq = lfNoise1Id 'α' ar 0.8 `in_range` (0.2,10)+ shape = 0.2+ slope_ = 0.2+ level = lfNoise1Id 'β' ar 0.3 `in_range` (0,1)+ tr = lfPulse ar 2 0 0.5+ env = X.miTides ar freq shape slope_ 0.3 level tr 0 {-output_mode:-} 1 {-ramp_mode:-} 0 9 1+ sines = sinOsc ar (mce [200,300,500,700]) 0+in splay (sines * env * 0.5) 1 1 0 True++-- MiTides ; phasing envs+let freq = 10+ shape = 0.2+ slope_ = 0.5+ shift_ = lfTri ar 0.1 0 `in_range` (0,1)+ trig = lfPulse ar 5 0 0.5+ env = X.miTides ar freq shape slope_ 0.5 shift_ trig 0 {-output_mode:-} 2 {-ramp_mode:-} 0 9 1+ sines = sinOsc ar (mce [200,300,500,700]) 0+in splay (sines * env * 0.25) 1 1 0 True++-- MiTides ; gate+let freq = 5 -- attack rate+ shape = lfTri ar 0.13 0 `in_range` (0,1)+ slope_ = 0.5+ smooth = lfTri ar 0.1 0 `in_range` (0,1)+ tr = lfPulse ar 1 0 0.5+ env = X.miTides ar freq shape slope_ smooth 0.8 tr 0 {-output_mode:-} 0 {-ramp_mode:-} 0 1 9+ sine = pmOsc ar 150 300 2 0+ c0 = mceChannel 0+in sine * c0 env++-- MiTides ; Lightbath -- Loom 4+let bpm = 140+ period = (60 / bpm) * 6+ speed = 1.0 / period+ del_times = period / mce2 6 8+ tr = impulse kr speed 0+ clock = phasor kr tr 1 0 1 0+ pit = tChooseId 'α' tr (mce [67, 60, 65])+ shape = lfTri kr 0.11 0 `in_range` (0,1)+ slope_ = lfTri kr 0.11 0 `in_range` (0.5,0.8)+ smooth = lfNoise1Id 'β' kr 0.07 `in_range` (0.25,0.7)+ chord = lfNoise1Id 'γ' kr 0.03 `in_range` (0.0,0.5)+ oscs = X.miTides ar (midiCps pit) shape slope_ smooth chord 0 0 3 1 9 1+ envs = X.miTides ar speed 0.35 0 0.46 0.92 0 clock 3 1 {-ratio:-} 9 {-rate:-} 0+ scaler = lfNoise1Id 'δ' kr (mce [0.1, 0.07, 0.11, 0.05])+ sig = splay (oscs * envs * scaler) 1 1 (lfTri kr 0.1 0) True+ del = combL sig 2 del_times 6 * 0.5+in sig + del
+ Help/Ugen/miVerb.help.hs view
@@ -0,0 +1,20 @@+-- MiVerb ; basic+X.miVerb 0.7 0.5 0.5 0.05 0 0.625 (impulse ar 1 0)++-- MiVerb ; stereo ; with freezing+let imp = dustId 'α' ar (mce2 0.7 0.8)+ freq = midiCps (latch (pinkNoiseId 'β' ar * 24 + 80) imp)+ input = rlpf imp freq 0.002 * 3+ freez = tRandId 'γ' (-1) 1 (dustId 'δ' kr 0.7)+ revtime = 0.8+ drywet = 0.5+ damping = 0.3+ diff = lfNoise1Id 'ε' kr 0.1 * 0.5 + 0.5+in X.miVerb revtime drywet damping 0.05 freez 0.625 input++-- MiVerb ; reverb time (> 1)+let freq = lfNoise0Id 'α' kr 0.3 `in_range` (400, 2500)+ input = rlpf (impulse ar 0.3 0) freq 0.1+ time = lfNoise2Id 'β' kr 0.3 * 0.1 + 1.03 -- modulate rev time above and below 1.0!+ damp = lfNoise2Id 'γ' kr 0.2 `in_range` (0, 0.7)+in X.miVerb time 0.9 damp 0.1 0 0.625 input * 0.25
+ Help/Ugen/midEQ.help.hs view
@@ -0,0 +1,8 @@+-- midEQ+let f = midiCps (fSinOsc kr 1 0 * 24 + 84)+in midEQ (saw ar 200 * 0.05) f 0.3 12++-- midEQ+let i = pinkNoiseId 'α' ar * 0.1 + sinOsc ar 600 0 * 0.05+ f = sinOsc kr 0.2 (0.5 * pi) * 2 + 600+in midEQ i f 0.01 (-24)
+ Help/Ugen/midiCPS.help.hs view
@@ -0,0 +1,5 @@+-- midiCps+saw ar (midiCps (line kr 24 108 10 DoNothing)) * 0.05++-- midiCps ; step+saw ar (midiCps (roundE (line kr 24 108 10 DoNothing))) * 0.05
+ Help/Ugen/min.help.hs view
@@ -0,0 +1,2 @@+-- min+(fSinOsc ar 500 0 `min` fSinOsc ar 0.1 0) * 0.1
+ Help/Ugen/mix.help.hs view
@@ -0,0 +1,21 @@+-- mix ; optimized summation (see sum_opt), ie. Sum3+mix (mce [pinkNoiseId 'α' ar,fSinOsc ar 801 0,lfSaw ar 40 0]) * 0.05++-- mix ; c.f. sum4+mix (sinOsc ar (mce (take 10 (iterate (* 2) 36))) 0) * 0.025++-- mix ; mixing stereo signals (mce)+mix (mce [sinOsc ar (mce2 330 990) 0 * 0.05,sinOsc ar (mce2 331 991) 0 * 0.05])++-- mix ; mixing stereo signals (mce) ; sums left with left and right with right+mix (mce2 (sinOsc ar (mce2 440 441) 0) (sinOsc ar (mce2 220 221) 0)) * 0.1++-- mix ; mixing stereo signals (pan) ; sums left with left and right with right+mix (mce2 (pan2 (sinOsc ar 440 0) (-1) 0.1) (pan2 (sinOsc ar 441 0) 1 0.1))++-- mix ; phase cancellation+mix (mce2 (sinOsc ar 440 0) (sinOsc ar 440 pi))++-- mix ; channel layout is L=440,441 and R=660,661+let f = mce2 (mce2 440 660) (mce2 441 661)+in mix (sinOsc ar f 0 * 0.1)
+ Help/Ugen/mod.help.hs view
@@ -0,0 +1,2 @@+-- mod+sinOsc ar 100 4 `modE` 1 * 0.1
+ Help/Ugen/modDif.help.hs view
@@ -0,0 +1,20 @@+-- modDif+fSinOsc ar 440 0 * (modDif 0.2 (fSinOsc ar 2 0 * 0.5) 1)++-- modDif ; different moduli+let sig = lfSaw ar 10 0+ dist = modDif sig 0 (mce [0..8] * mouseX kr 0 (1/5) Linear 0.2)+in splay (sinOsc ar (dist * 4000 + 400) 0) 1 1 0 True * 0.1++-- modDif ; wrapping amplitude crossfade+let nc = 12+ nc_u = constant nc+ x = sinOsc ar (X.randNId nc 'α' 300 800) 0+ d = modDif (mouseX kr 0 (nc_u * 2) Linear 0.2) (mce [0 .. nc_u - 1]) nc_u+in splay (x * max 0 (1 - d)) 1 1 0 True * 0.1++---- ; drawings+import Sound.Sc3.Plot {- hsc3-plot -}+plot_ugen 0.01 (let a = line ar 0 4 0.01 DoNothing in mce2 a (modDif a 0 1))+plot_ugen 0.01 (let a = line ar 0 4 0.01 DoNothing in modDif a 0 (mce [1 .. 4]))+plot_ugen 0.01 (let a = line ar 0 4 0.01 DoNothing in modDif a (mce [0, 0.25 .. 1]) 1)
+ Help/Ugen/monoGrain.help.hs view
@@ -0,0 +1,4 @@+-- monoGrain+let x = mouseX kr 0.1 0.01 Linear 0.2+ y = mouseX kr 10 4 Linear 0.2+in X.monoGrain ar (soundIn 0) x y 0
+ Help/Ugen/moogFF.help.hs view
@@ -0,0 +1,22 @@+-- moogFF+let n = whiteNoiseId 'α' ar * 0.05+ freq = mouseX kr 100 10000 Exponential 0.1+ gain = mouseY kr 0 4 Linear 0.1+in moogFF n freq gain 0++-- moogFF ; note distortion at high gain+let x = mouseX kr 100 20000 Exponential 0.1+ y = mouseY kr 0.1 4.0 Linear 0.1+ i = mix (saw ar (mce [0.99, 1, 1.01] * 440)) * 0.2+in moogFF i x y 0++-- moogFF+let n = lfNoise0Id 'α' kr 0.43+ p = pulse ar (mce [40, 121]) (mce [0.3, 0.7])+ f0 = linLin n 0 1 0.001 2.2+ f = linLin (sinOsc kr f0 0) (-1) 1 30 4200+ y = mouseY kr 1 4 Linear 0.1+in moogFF p f (0.83 * y) 0++---- ; drawings+UI.ui_sc3_scope_freq (600,400) 0
+ Help/Ugen/moogLadder.help.hs view
@@ -0,0 +1,31 @@+-- moogLadder+let o = mix (lfSaw ar (mce2 120 180) 0 * 0.33)+ cf = linExp (lfCub kr 0.1 (0.5 * pi)) (-1) 1 180 8500+in X.moogLadder o cf 0.75++-- moogLadder+let n = dustId 'α' ar 3+in X.moogLadder n 2000 (mouseY kr 0 1 Linear 0.2)++-- moogLadder ; event control+let f (_,g,_,y,z,o,rx,ry,p,_,_) =+ let f0 = unitCps p+ f1 = f0 * (1 + y * 8)+ res = rx + ry+ env = lagUD g 0.05 (2 - y * 2) * (2 - y) * z+ in pan2 (X.moogLadder (lfSaw ar f0 0) f1 res) (o * 2 - 1) env+in mix (voicer 16 f) * control kr "gain" 1++-- moogLadder ; wind (Id)+let mk k = let n = whiteNoiseId k ar+ force = lfNoise2Id k kr 0.25 `in_range` (0.25,0.75)+ freq = pianokey_to_cps (force * 88)+ in X.moogLadder n freq force+in splay (mceFillInt 6 mk) 1 1 0 True++-- moogLadder ; wind (Unsafe)+let mk _ = let n = whiteNoise ar+ force = lfNoise2 kr 0.25 `in_range` (0.25,0.75)+ freq = pianokey_to_cps (force * 88)+ in X.moogLadder n freq force+in splay (mceFill 6 mk) 1 1 0 True
+ Help/Ugen/moogVCF.help.hs view
@@ -0,0 +1,9 @@+-- moogVCF+let o = mix (lfSaw ar (mce2 120 180) 0 * 0.33)+ cf = linExp (lfCub kr 0.1 (0.5 * pi)) (-1) 1 180 8500+in X.moogVCF o cf 0.75++-- moogVCF+let o = pulse ar (mce2 40 121) (mce2 0.3 0.7)+ cf = range 30 4200 (sinOsc kr (range 0.001 2.2 (lfNoise0Id 'α' kr 0.42)) 0)+in X.moogVCF o cf 0.8 * 0.25
+ Help/Ugen/mostChange.help.hs view
@@ -0,0 +1,5 @@+-- mostChange+let n = lfNoise0Id 'α' kr 1+ x = mouseX kr 200 300 Linear 0.1+ f = mostChange (n * 400 + 900) x+in sinOsc ar f 0 * 0.1
+ Help/Ugen/mouseButton.help.hs view
@@ -0,0 +1,5 @@+-- mouseButton ; amplitude envelope+sinOsc ar 800 0 * mouseButton kr 0 0.1 0.1++-- mouseButtonRand ; variant that randomly presses the button+sinOsc ar 800 0 * mouseButtonRand kr 0 0.1 0.1
+ Help/Ugen/mouseX.help.hs view
@@ -0,0 +1,7 @@+-- mouseX ; frequency control+let x = mouseX kr 40 10000 Exponential 0.2+in sinOsc ar x 0 * 0.1++-- mouseX ; variant with equal arguments but random traversal+let x = mouseXRand kr 40 10000 Exponential 0.2+in sinOsc ar x 0 * 0.1
+ Help/Ugen/mouseY.help.hs view
@@ -0,0 +1,9 @@+-- mouseY ; frequency at X axis, amplitude at Y axis+let freq = mouseX kr 20 2000 Exponential 0.1+ ampl = mouseY kr 0.01 0.1 Linear 0.1+in sinOsc ar freq 0 * ampl++-- mouseY ; variant with equal arguments but a random traversal+let freq = mouseXRand kr 20 2000 Exponential 0.1+ ampl = mouseYRand kr 0.01 0.1 Linear 0.1+in sinOsc ar freq 0 * ampl
+ Help/Ugen/mrg2.help.hs view
@@ -0,0 +1,19 @@+-- mrg2 ; defines a node indicating a multiple root graph.+let l = out 0 (sinOsc ar 300 0 * 0.1)+ r = out 1 (sinOsc ar 900 0 * 0.1)+in mrg2 l r++-- mrg2 ; there is a leftmost rule, so that mrg nodes need not be terminal+let l = sinOsc ar 300 0 * 0.1+ r = out 1 (sinOsc ar 900 0 * 0.1)+in mrg2 l r++-- mrg2 ; the leftmost node may be an mce node+let l = sinOsc ar (mce2 300 400) 0 * 0.1+ r = out 1 (sinOsc ar 900 0 * 0.1)+in mrg2 l r++-- mrg2 ; the implementation is not thorough+let l = sinOsc ar (mce2 300 400) 0 * 0.1+ r = out 1 (sinOsc ar 900 0 * 0.1)+in out 0 (mrg2 l r + mrg2 l r)
+ Help/Ugen/mul.help.hs view
@@ -0,0 +1,22 @@+-- mul+sinOsc ar 440 0 * 0.15++-- mul ; creates a beating effect (subaudio rate)+fSinOsc kr 10 0 * pinkNoiseId 'α' ar * 0.1++-- mul ; ring modulation+let p = sinOsc ar (xLine kr 100 1001 10 DoNothing) 0+ q = syncSaw ar 100 200+in p * q * 0.25++-- mul ; optimises identity+sinOsc ar 440 0 * 1 / 10++-- mul ; optimises identity+1 * sinOsc ar 440 0 / 10++-- mul ; gate ; control+let freq = control_m kr "freq" 220 (55,880,"exp")+ amp = control_m kr "amp" 0.1 (0,1,"amp")+ gate_ = control_m kr "gate" 0 (0,1,"switch")+in sinOsc ar freq 0 * amp * lag gate_ 0.1
+ Help/Ugen/mulAdd.help.hs view
@@ -0,0 +1,20 @@+-- mulAdd+mulAdd (sinOsc ar 440 0) 0.1 0.05++-- mulAdd ; optimisation of constant inputs of one and zero+mulAddOptimised (sinOsc ar 440 0) 1 0 * 0.1++-- mulAdd ; optimisation ; of * followed by ++sinOsc ar 440 0 * 0.1 + 0.05++-- mulAdd ; optimisation ; of + followed by * ; ugen at left+0.05 + sinOsc ar 440 0 * 0.1++-- mulAdd ; optimisations ; of + followed by * ; ugen at right+0.05 + 0.1 * sinOsc ar 440 0++-- mulAdd ; all ar inputs optimise ordinarily ; * then ++(sinOsc ar 440 0 * sinOsc ar 441 0 + sinOsc ar 442 0) * 0.1++-- mulAdd ; + then *+(sinOsc ar 440 0 + sinOsc ar 441 0 * sinOsc ar 442 0) * 0.1
+ Help/Ugen/nRand.help.hs view
@@ -0,0 +1,4 @@+-- nRand+let n = nRandId 'α' 1200.0 4000.0 (mce [2,5])+ e = line kr 0.2 0 0.1 RemoveSynth+in fSinOsc ar n 0 * e
+ Help/Ugen/neg.help.hs view
@@ -0,0 +1,2 @@+-- neg ; silence, draw graph to see operator+let o = sinOsc ar 440 0 in o + negate o
+ Help/Ugen/neoFormant.help.hs view
@@ -0,0 +1,15 @@+-- neoFormant+let modulator = sinOsc kr 0.1 0+ formantfreq = 150+ carrierfreq = lfNoise2Id 'α' kr 10 `in_exprange` (100,550)+ phaseshift = modulator `in_range` (0,1)+ sig = X.neoFormant ar formantfreq carrierfreq phaseshift+in pan2 sig modulator 0.1++-- neoFormant ; event control+let f (_,g,x,y,z,o,rx,_,_,_,_) =+ let carrierFreq = midiCps (x * 13 + 36)+ formantFreq = y `in_exprange` (100,550)+ phaseShift = lag rx 0.5 * 2+ in pan2 (X.neoFormant ar formantFreq carrierFreq phaseShift) (o * 2 - 1) (lagUD (z * g) 0 0.2)+in mix (voicer 16 f) * control kr "gain" 0.2
+ Help/Ugen/nestedAllpassC.help.hs view
@@ -0,0 +1,48 @@+-- nestedAllpassL+let sig = soundIn 0+ nc = 2+ nestedAllpassL_def s =+ let d1 = 0.036+ d2 = 0.030+ in X.nestedAllpassL s d1 d1 0.08 d2 d2 0.3+ doubleNestedAllpassL_def s =+ let d1 = 0.0047+ d2 = 0.022+ d3 = 0.0084+ in X.doubleNestedAllpassL s d1 d1 0.15 d2 d2 0.25 d3 d3 0.3+ fb = localIn nc ar 0+ lp0 = lpf sig 6000+ lp1 = delayL lp0 0.024 0.024+ ap1 = doubleNestedAllpassL_def (lp1 + (0.5 * fb))+ ap2 = nestedAllpassL_def ap1+ revout = ap1 * 0.5 + ap2 * 0.6+ locout = localOut (bpf (revout * 0.5) 1600 0.5)+ rev = mrg2 revout locout+in sig + (rev * 0.5)++-- nestedAllpassL+let sig = soundIn 0+ nc = 2+ fb = localIn nc ar 0+ lp = lpf sig 6000+ ap1 = X.doubleNestedAllpassL (lp + (0.5 * fb)) 0.0047 0.0047 0.25 0.0083 0.0083 0.35 0.022 0.022 0.45+ ap2 = delayL (X.nestedAllpassL (delayL ap1 0.05 0.05) 0.03 0.03 0.25952 0.03 0.03 0.3) 0.067 0.067+ ap3 = X.nestedAllpassL (lp + (delayL ap2 0.015 0.015 * 0.4)) 0.0292 0.0292 0.25 0.0098 0.0098 0.35+ revout = sum_opt [ap1,ap2,ap3] * 0.5+ locout = localOut (bpf (revout * 0.4) 1000 0.5)+ rev = mrg2 revout locout+in sig + (rev * 0.5)++-- nestedAllpassL+let sig = soundIn 0+ nc = 2+ fb = localIn nc ar 0+ lp = lpf sig 4000+ ap1 = allpassL (lp + (0.5 * fb)) 0.008 0.008 0.0459+ ap2 = delayL (allpassL ap1 0.012 0.012 0.06885) 0.004 0.004+ ap3 = delayL (X.nestedAllpassL (delayL ap2 0.017 0.017) 0.025 0.025 0.5 0.062 0.062 0.25) 0.031 0.031+ ap4 = X.doubleNestedAllpassL (delayL ap3 0.003 0.003) 0.120 0.120 0.5 0.076 0.076 0.25 0.030 0.030 0.25+ revout = sum_opt [ap4 * 0.8,ap3 * 0.8,ap2 * 1.5]+ locout = localOut (bpf (revout * 0.4) 1000 0.5)+ rev = mrg2 revout locout+in sig + (rev * 0.5)
+ Help/Ugen/nhHall.help.hs view
@@ -0,0 +1,5 @@+-- nhHall+let in1 = soundIn 0+ in2 = soundIn 1+ rt60 = mouseX kr 0.1 10.0 Linear 0.1+in X.nhHall in1 in2 rt60 0.5 200 0.5 4000 0.5 0.5 0.5 0.2 0.3
+ Help/Ugen/nodeId.help.hs view
@@ -0,0 +1,6 @@+-- nodeId ; except that negative nodeId are not reported+sinOsc ar (mce2 (-100) (nodeID ir * 100)) 0 * 0.1++---- ; specify node id+audition_at (-1,AddToHead,1,[]) (sinOsc ar (mce2 (-100) (nodeID ir * 100)) 0 * 0.1)+audition_at (8,AddToHead,1,[]) (sinOsc ar (mce2 (-100) (nodeID ir * 100)) 0 * 0.1)
+ Help/Ugen/normalizer.help.hs view
@@ -0,0 +1,5 @@+-- normalizer+let s = fSinOsc ar 500 0+ t = impulse ar 8 (lfSaw kr 0.25 (-0.6) * 0.7)+ z = decay2 t 0.001 0.3 * s+in mce [z, normalizer z 0.4 0.01]
+ Help/Ugen/numBuffers.help.hs view
@@ -0,0 +1,5 @@+-- numBuffers ; the number of audio buffers available at the server (by default 1024, printing only)+poll (impulse kr 1 0) numBuffers 0 (label "numBuffers")++-- numBuffers+let f = 110 + numBuffers in sinOsc ar f 0 * 0.1
+ Help/Ugen/numRunningSynths.help.hs view
@@ -0,0 +1,2 @@+-- numRunningSynths ; each concurrent audition increases oscillator frequency+sinOsc ar (numRunningSynths * 200 + 400) 0 * 0.1
+ Help/Ugen/obxdFilter.help.hs view
@@ -0,0 +1,42 @@+-- obxdFilter+let cutoff = mouseX kr 110.0 (110.0 * 16) Exponential 0.2+ resonance = 0.0+in X.obxdFilter (pinkNoiseId 'α' ar * 0.5) cutoff resonance 0.0 0.0 0.0++-- obxdFilter+let cutoff = mouseX kr 110.0 (110.0 * 16) Exponential 0.2+ resonance = mouseY kr 0.0 1.10 Linear 0.2+in X.obxdFilter (pinkNoiseId 'α' ar * 0.5) cutoff resonance 0.5 0.0 0.0++-- obxdFilter ; multimode selects the filter mode, the range is (0,1), there are four modes.+let cutoff = mouseX kr 110.0 (110.0 * 16) Exponential 0.2+ multimode = mouseY kr 0.0 1.0 Linear 0.2+ fourpole = 1.0+in X.obxdFilter (pinkNoiseId 'α' ar * 0.5) cutoff 0.0 multimode 0.0 fourpole++-- obxdFilter ; controls+let k = control kr+ c1 = k "cutoff" 440.0+ c2 = k "resonance" 0.0+ c3 = k "multimode" 0.5+ c4 = k "bandpass" 0.0+ c5 = k "fourpole" 0.0+in X.obxdFilter (pinkNoiseId 'α' ar * 0.5) c1 c2 c3 c4 c5++---- ; obxdFilter ; set controls+let set k v = withSc3 (Sound.Osc.sendMessage (n_set1 (-1) k v))+(set "cutoff" 880.0)+(set "resonance" 0.95)+(set "multimode" 0.75)+(set "bandpass" 1.0)+(set "fourpole" 1.0)++{---- RObxdFilter++cutoff : FREQUENCY (CPS) :+resonance : Q (0.0 - 1.0) :+multimode : FILTER MODE (0.0 - 1.0) : LOW-NOTCH/BANDPASS-HIGH | 24DB - 6DB LOWPASS+bandpass : 0 = FALSE, 1 = TRUE : 0 = NOTCH, 1 = BANDPASS+fourpole : 0 = FALSE, 1 = TRUE : 0 = 12/DB MULTI-MODE, 1 = 24/DB LOWPASS++-}
+ Help/Ugen/offsetOut.help.hs view
@@ -0,0 +1,9 @@+-- offsetOut+let a = offsetOut 0 (impulse ar 5 0)+ b = out 0 (sinOsc ar 60 0 * 0.1)+in mrg2 a b++-- offsetOut ; c.f. out+let a = out 0 (impulse ar 5 0)+ b = out 0 (sinOsc ar 60 0 * 0.1)+in mrg [a,b]
+ Help/Ugen/onePole.help.hs view
@@ -0,0 +1,10 @@+-- onePole+let n = whiteNoiseId 'α' ar in onePole (n * 0.1) 0.95++-- onePole+let n = whiteNoiseId 'α' ar in onePole (n * 0.1) (-0.95)++-- onePole+let n = whiteNoiseId 'α' ar+ c = line kr (-0.99) 0.99 10 RemoveSynth+in onePole (n * 0.1) c
+ Help/Ugen/oneZero.help.hs view
@@ -0,0 +1,10 @@+-- oneZero+let n = whiteNoiseId 'α' ar in oneZero (n * 0.1) 0.5++-- oneZero+let n = whiteNoiseId 'α' ar in oneZero (n * 0.1) (-0.5)++-- oneZero+let n = whiteNoiseId 'α' ar+ c = line kr (-0.5) 0.5 10 RemoveSynth+in oneZero (n * 0.1) c
+ Help/Ugen/onsets.help.hs view
@@ -0,0 +1,17 @@+-- onsets ; x varies threshold ; detector triggers new random oscillator frequency+let x = mouseX kr 0 1 Linear 0.2+ i = mix (soundIn (mce2 0 1))+ c = fft' (localBufId 'γ' 1 512) i+ o = onsetsDefault c x (onsetType "rcomplex")+in sinOsc ar (midiCps (tiRandId 'a' 40 72 o)) 0 * 0.1++-- onsets ; generative signal with distinct onsets ; x varies threshold ; detector triggers noise+let e = linLin (saw ar 2) (-1) 1 0 1+ p = let f = midiCps (tiRandId 'α' 63 75 (impulse kr 2 0)) in pulse ar f 0.5 * 0.1+ f = linExp (lfNoise2Id 'β' kr 0.5) (-1) 1 100 10000+ z = lpf p f * e+ c = fft' (localBufId 'γ' 1 512) z+ x = mouseX kr 0 1 Linear 0.2+ o = onsetsDefault c x (onsetType "rcomplex")+ n = let d = envPerc 0.001 0.1 in whiteNoiseId 'δ' ar * envGen kr o 0.2 0 1 DoNothing d+in pan2 z (-0.75) 0.2 + pan2 n 0.75 1
+ Help/Ugen/osc.help.hs view
@@ -0,0 +1,59 @@+-- osc ; fixed frequency wavetable oscillator ; c.f. bGen+let tbl = asLocalBuf (Gen.sine1Tbl 256 [1, 1/2, 1/3, 1/4, 1/5])+in osc ar tbl 220 0 * 0.1++-- osc ; mouse frequency control+let tbl = asLocalBuf (Gen.sine1Tbl 256 [1, 1/2, 1/3, 1/4, 1/5])+in osc ar tbl (mouseX kr 110 220 Exponential 0.2) 0 * 0.1++-- osc ; modulate frequency+let tbl = asLocalBuf (Gen.sine1Tbl 256 [1, 1/2, 1/3, 1/4, 1/5])+in osc ar tbl (xLine kr 2000 200 1 DoNothing) 0 * 0.1++-- osc ; as frequency modulator+let tbl = asLocalBuf (Gen.sine1Tbl 256 [1, 1/2, 1/3, 1/4, 1/5])+in osc ar tbl (osc ar tbl (xLine kr 1 1000 9 RemoveSynth) 0 * 200 + 800) 0 * 0.1++-- osc ; as phase modulator+let tbl = asLocalBuf (Gen.sine1Tbl 256 [1, 1/2, 1/3, 1/4, 1/5])+in osc ar tbl 800 (osc ar tbl (xLine kr 20 8000 10 RemoveSynth) 0 * 2 * pi) * 0.1++-- osc ; requires=tbl ; fixed frequency wavetable oscillator+let b = control kr "tbl" 0+in osc ar b 220 0 * 0.1++-- osc ; requires=tbl ; mouse frequency control+let b = control kr "tbl" 0+in osc ar b (mouseX kr 110 220 Exponential 0.2) 0 * 0.1++-- osc ; requires=tbl ; modulate frequency+let b = control kr "tbl" 0+ f = xLine kr 2000 200 1 DoNothing+in osc ar b f 0 * 0.1++-- osc ; requires=tbl ; as frequency modulator+let b = control kr "tbl" 0+ f = osc ar b (xLine kr 1 1000 9 RemoveSynth) 0 * 200 + 800+in osc ar b f 0 * 0.1++-- osc ; requires=tbl ; as phase modulator+let b = control kr "tbl" 0+ p = osc ar b (xLine kr 20 8000 10 RemoveSynth) 0 * 2 * pi+in osc ar b 800 p * 0.1++---- ; setup ; allocate and generate wavetable buffer ; sin+withSc3 (mapM_ maybe_async [b_alloc 0 8192 1,b_gen_sine1 0 [Normalise,Wavetable,Clear] [1]])++---- ; setup ; allocate and generate wavetable buffer ; sin harmonics+withSc3 (mapM_ maybe_async [b_alloc 0 8192 1,b_gen_sine1 0 [Normalise,Wavetable,Clear] [1, 1/2, 1/3, 1/4, 1/5]])++---- ; setup ; change the wavetable while its playing+withSc3 (maybe_async (b_gen_sine1 0 [Normalise,Wavetable,Clear] [1, 0.6, 1/4]))++---- ; setup ; send calculated wavetable+import Sound.Sc3.Common.Math.Window {- hsc3 -}+let tbl = window_table TableOpen 4096 triangular+withSc3 (maybe_async (b_setn1 0 0 (Sound.Sc3.Common.Buffer.to_wavetable tbl)))++---- ; drawings+withSc3 (Sound.Sc3.Plot.plot_wavetable 0)
+ Help/Ugen/osc1.help.hs view
@@ -0,0 +1,23 @@+-- osc1 ; composite UGen+let tbl0 = asLocalBuf (Gen.sine1Tbl 2048 (map recip [13, 8, 55, 34, 5, 21, 3, 1, 2]))+ tbl1 = asLocalBuf (Gen.sine1Tbl 2048 (map recip [55, 34, 1, 3, 2, 13, 5, 8, 21]))+ env = linLin (osc1 ar (mce2 tbl0 tbl1) 8 RemoveSynth) (-1) 1 0 1+in lfSaw ar (mce2 110 164) 0 * env * 0.1++-- osc1 ; requires=tbl ; composite UGen+let b0 = control kr "tbl0" 0+ b1 = control kr "tbl1" 1+ env = linLin (osc1 ar (mce2 b0 b1) 8 RemoveSynth) (-1) 1 0 1+in lfSaw ar (mce2 110 164) 0 * env * 0.1++---- ; setup+withSc3 (mapM_ maybe_async [b_alloc 0 4096 1, b_gen_sine1 0 [Normalise, Wavetable, Clear] (map recip [13, 8, 55, 34, 5, 21, 3, 1, 2])])+withSc3 (mapM_ maybe_async [b_alloc 1 4096 1, b_gen_sine1 1 [Normalise, Wavetable, Clear] (map recip [55, 34, 1, 3, 2, 13, 5, 8, 21])])++---- ; drawings (buffers)+withSc3 (Sound.Sc3.Plot.plot_wavetable 0)+withSc3 (Sound.Sc3.Plot.plot_wavetable 1)++---- ; drawings (lists, pre wavetable transform)+Sound.Sc3.Plot.plot_p1_ln [Gen.sine1_nrm 2048 (map recip [13, 8, 55, 34, 5, 21, 3, 1, 2])]+Sound.Sc3.Plot.plot_p1_ln [Gen.sine1_nrm 2048 (map recip [55, 34, 1, 3, 2, 13, 5, 8, 21])]
+ Help/Ugen/oscN.help.hs view
@@ -0,0 +1,1 @@+---- c.f. osc
+ Help/Ugen/oteyPianoStrings.help.hs view
@@ -0,0 +1,10 @@+-- oteyPianoStrings+let k = control kr+ freq = k "freq" 440+ gate_ = k "gate" 1+ amp = k "amp" 0.5+ rho = k "rho" 1+ env = envGen ar gate_ 1 0 1 RemoveSynth (envAsr 0 1 0.1 EnvLin)+ loc = linLin freq (midiCps 36) (midiCps 90) (-0.75) 0.75+ s = X.oteyPianoStrings ar freq amp 0 0.35 2 4 8 1 0.07 1.4 (-4) 4 rho 1 1 0 1 0.2 1 1 0.142 1 0.0003 1+in X.oteySoundBoard (pan2 (s * env) loc 0.1) 20 20 0.8
+ Help/Ugen/oteySoundBoard.help.hs view
@@ -0,0 +1,13 @@+-- oteySoundBoard+let loc = mouseX kr (-1) 1 Linear 0.2+in X.oteySoundBoard (pan2 (soundIn 0) loc 0.1) 20 20 0.8++-- oteySoundBoard+let d = dustId 'α' ar 1+ n = whiteNoiseId 'β' ar+ i = decay (d * 0.5) 0.2 * n+ loc = mouseX kr (-1) 1 Linear 0.2+ c1 = 20+ c3 = 20+ mix = 0.8+in X.oteySoundBoard (pan2 i loc 0.1) c1 c3 mix
+ Help/Ugen/out.help.hs view
@@ -0,0 +1,35 @@+-- out ; oscillators at outputs zero (330hz) and one (331hz)+out 0 (sinOsc ar (mce2 330 331) 0 * 0.1)++-- out ; an out node is implicitly added by various hsc3 functions if not given+sinOsc ar (mce2 330 331) 0 * 0.1++-- out ; out is a summing output, see replaceOut for over-writing output+mrg [out 0 (sinOsc ar (mce2 330 990) 0 * 0.05)+ ,out 0 (sinOsc ar (mce2 331 991) 0 * 0.05)]++-- out ; summing (phase cancellation)+mrg [out 0 (sinOsc ar 440 0),out 0 (sinOsc ar 440 pi)]++-- out ; summing ; non phase cancellation+mce [sinOsc ar (mce [440,441]) (mce [0,pi]),sinOsc ar (mce [440,441]) (mce [pi,0])] * 0.1++-- out ; summing / transpose ; phase cancellation+mceTranspose (mce [sinOsc ar (mce [440,441]) (mce [0,pi]),sinOsc ar (mce [440,441]) (mce [pi,0])])++-- out ; multiple out ; channel layout is L=440,660 and R=441,661+let f = mce2 (mce2 440 660) (mce2 441 661)+in out 0 (sinOsc ar f 0 * 0.1)++-- out ; kr ; see drawings section below for UI+let freq = mce [1,2,3,5,7,9,11,13,17,19,23]+ mul = control kr "mul" 0.1+ amp = control kr "amp" 0.1+in out 12000 (sinOsc kr (freq * mul) 0 * amp)++-- out ; nested mce ; multiple out+out 0 (sinOsc ar (mce1 (mce2 110 220)) 0 * 0.1)++---- ; drawings+UI.ui_sc3_scope 12 12000 (2 ^ 14) 0 "control" 0+UI.ui_sc3_ctl_plot 900 11 12000 900 (1/25) 5
+ Help/Ugen/packFFT.help.hs view
@@ -0,0 +1,15 @@+-- packFFT+let b = localBufId 'α' 512 1+ n = 100+ square a = a * a+ r1 z = range 0 1 (fSinOsc kr (expRandId (z,'β') 0.1 1) 0)+ m1 = map r1 (id_seq n 'γ')+ m2 = zipWith (*) m1 (map square [1.0, 0.99 ..])+ r2 z = lfPulse kr (2 ** iRandId (z,'δ') (-3) 5) 0 0.3+ i = map r2 (id_seq n 'ε')+ m3 = zipWith (*) m2 i+ p = replicate n 0.0+ c1 = fft' b (fSinOsc ar 440 0)+ c2 = packFFT c1 512 0 (n - 1) 1 (packFFTSpec m3 p)+ s = ifft' c2+in mce2 s s
+ Help/Ugen/pan2.help.hs view
@@ -0,0 +1,15 @@+-- pan2 ; note level input is control rate only+let n = pinkNoiseId 'α' ar in pan2 n (fSinOsc kr 2 0) 0.1++-- pan2+let n = pinkNoiseId 'α' ar * 0.1+ x = mouseX kr (-1) 1 Linear 0.2+ y = mouseY kr 0 1 Linear 0.2+in pan2 n x y++-- pan2 ; ctl=freq:220,220,440,exp;amp:0.1,0,1,amp;pan:0,-1,1,lin+pan2 (sinOsc ar (control kr "freq" 220) 0) (control kr "pan" 0) (control kr "amp" 0.1)++-- pan2 ; ctl=pan[:-0.1,-1,1,lin;pan]:0.1,-1,1,lin+let loc = sinOsc kr 0.5 0 `in_range` (control kr "pan[" 0,control kr "pan]" 0)+in pan2 (pinkNoiseId 'α' ar) loc 0.05
+ Help/Ugen/panAz.help.hs view
@@ -0,0 +1,5 @@+-- panAz+let o = pinkNoiseId 'α' ar+ nc = 4+ fr = 0.15+in panAz nc o (lfSaw kr fr 0) 0.1 2 0.5
+ Help/Ugen/pause.help.hs view
@@ -0,0 +1,15 @@+-- pause+let f = control kr "f" 440+ g = control kr "g" 1+in mrg [sinOsc ar f 0 * 0.1,pause g 1001]++---- ; control+g = mrg [sinOsc ar (control kr "f" 440) 0 * 0.1,pause (control kr "g" 1) 1001]+audition_at (1001,AddToTail,1,[]) g+audition_at (1002,AddToTail,1,[("f",880)]) g++---- ; request that node 1002 pause node 1001+withSc3 (Sound.OSC.sendMessage (n_set 1002 [("g",0)]))++---- ; restart node 1001+withSc3 (Sound.OSC.sendMessage (n_set 1002 [("g",1)]))
+ Help/Ugen/pauseSelf.help.hs view
@@ -0,0 +1,7 @@+-- pauseSelf+let x = mouseX kr (-1) 1 Linear 0.1+ o = sinOsc ar 440 0 * 0.1+in mrg [o,pauseSelf x]++---- ; run paused node (assuming no intermediate node is created)+withSc3 (Sound.OSC.sendMessage (n_run [(-1, True)]))
+ Help/Ugen/pauseSelfWhenDone.help.hs view
@@ -0,0 +1,8 @@+-- pauseSelfWhenDone+let x = mouseX kr (-1) 1 Linear 0.1+ e = linen x 1 0.1 1 DoNothing+ o = sinOsc ar 440 0 * e+in mrg [o,pauseSelfWhenDone e]++---- ; run paused node (assuming no intermediate node is created)+withSc3 (Sound.OSC.sendMessage (n_run [(-1, True)]))
+ Help/Ugen/peak.help.hs view
@@ -0,0 +1,5 @@+-- peak+let t = dustId 'α' ar 20+ r = impulse ar 0.4 0+ f = peak t r * 500 + 200+in sinOsc ar f 0 * 0.2
+ Help/Ugen/peakFollower.help.hs view
@@ -0,0 +1,17 @@+-- peakFollower ; no decay+let d = dustId 'α' ar 20 * line kr 0 1 4 DoNothing+in sinOsc ar (peakFollower d 1 * 1500 + 200) 0 * 0.1++-- peakFollower ; a little decay+let d = dustId 'α' ar 20 * line kr 0 1 4 DoNothing+in sinOsc ar (peakFollower d 0.999 * 1500 + 200) 0 * 0.1++-- peakFollower ; mouse x controls decay+let dcy = mouseX kr 0.99 1.00001 Linear 0.2 `min` 1+ d = dustId 'α' ar 20+in sinOsc ar (peakFollower d dcy * 1500 + 200) 0 * 0.1++-- peakFollower ; follow a sine lfo, decay controlled by mouse x+let dcy = mouseX kr 0 1.1 Linear 0.2 `min` 1+ sig = sinOsc kr 0.2 0+in sinOsc ar (mce2 sig (peakFollower sig dcy) * 200 + 500) 0 * 0.1
+ Help/Ugen/perlin3.help.hs view
@@ -0,0 +1,4 @@+-- perlin3+let x = integrator (k2a (mouseX kr 0 0.1 Linear 0.2)) 1.0+ y = integrator (k2a (mouseY kr 0 0.1 Linear 0.2)) 1.0+in X.perlin3 ar x y 0 * 0.1
+ Help/Ugen/phasor.help.hs view
@@ -0,0 +1,72 @@+-- phasor ; controls sine frequency, end frequency matches second sine+let rate = mouseX kr 0.2 2 Exponential 0.1+ tr = impulse ar rate 0+ sr = sampleRate+ x = phasor ar tr (rate / sr) 0 1 0+ f = mce [linLin x 0 1 600 1000, 1000]+in sinOsc ar f 0 * 0.1++-- phasor ; control two sine frequencies, mouse y controls resetPos of the second+let rate = mouseX kr 1 200 Linear 0.1+ tr = impulse ar rate 0+ sr = sampleRate+ x = phasor ar tr (rate / sr) 0 1 (mce2 0 (mouseY kr 0 1 Linear 0.2))+in sinOsc ar (x * 500 + 500) 0 * 0.1++-- phasor ; as phase input to bufRd ; requires=buf+let (b, nc) = (control kr "buf" 100, 2)+ ph = phasor ar 0 (bufRateScale kr b) 0 (bufFrames kr b) 0+in bufRd nc ar b ph Loop NoInterpolation++-- phasor ; audio rate oscillator as phase input to bufRd ; requires=buf (non-wavetable format)+let (b, nc) = (control kr "buf" 100, 2)+ f = 440+ fr = bufFrames kr b+ rt = f * (fr / sampleRate)+ ph = phasor ar b (rt * bufRateScale kr b) 0 fr 0+in bufRdL nc ar b ph Loop * 0.1++-- phasor ; as impulse with reset+let impulse_reset freq reset =+ let ph = phasor ar reset (freq / sampleRate) 0 1 0+ in hpz1 ph <** 0+ x = mouseX kr 0 1 Linear 0.2 >** 0.5+ ck = impulse ar 3 0+ im = impulse_reset 3 x+ x' = sinOsc ar 440 0 * x * 0.05+ im' = sinOsc ar 220 0 * decay2 (ck + im) 0.01 0.5 * 0.1+in mce2 x' im'++-- phasor ; as sinOsc+let f0 = midiCps (mouseX kr 36 96 Linear 0.2)+ ph = phasor ar 0 (f0 * sampleDur) 0 1 0 * two_pi+in sin ph * 0.1++-- phasor ; as sinOsc with trigger ; triggers cause discontinuities (precision?)+let f0 = midiCps (mouseX kr 36 96 Linear 0.2)+ ph = phasor ar (impulse ar f0 0) (f0 * sampleDur) 0 1 0 * two_pi+in sin ph * 0.1++-- phasor ; as saw+let f0 = midiCps (mouseX kr 36 96 Linear 0.2)+in phasor ar 0 (f0 * sampleDur) (-1) 1 0 * 0.1++-- phasor ; approximation of square wave ; sync ; http://listarc.bham.ac.uk/lists/sc-users/msg69869.html+let freq = mouseX kr 200 4000 Exponential 0.2+ syncFreq = mouseY kr 50 800 Exponential 0.2+ syncSig = sinOsc ar syncFreq 0+ phase = phasor ar syncSig (freq * sampleDur) 0 1 0 * 2 * pi+ k = 12000 * (sampleRate / 48000) / (freq * log10 freq)+ width = sinOsc kr 0.1 0 `in_range` (0,1)+ sinSig = sinOsc ar 0 phase - (width * 2 - 1)+ squareSig = tanh (sinSig * k)+in pan2 (leakDC squareSig 0.995) 0 0.05++---- ; load sound file to buffer zero+withSc3 (async (b_allocRead 0 (sfResolve "pf-c5.aif") 0 0))++---- ; allocate and generate (non-wavetable) buffer (see osc for wavetable oscillator)+withSc3 (mapM_ maybe_async [b_alloc 0 8192 1,b_gen_sine1 0 [Normalise,Clear] [1]])++---- ; drawings+UI.ui_sc3_scope 2 0 4096 1 "audio" 0
+ Help/Ugen/phasorModal.help.hs view
@@ -0,0 +1,23 @@+-- phasorModal+let input = lpf (dust2Id 'α' ar 3) 1500+ freq = control kr "freq" 100.0+ decay = control kr "decay" 0.25+ damp = control kr "damp" 1.0+ amp = control kr "amp" 0.5+ phase = control kr "phase" 0.0+in X.phasorModal input freq decay damp amp phase++-- phasorModal+let pitchstretch = -0.1+ f0 = 80+ k = 32+ n = mceFill+ k+ (\i -> let sig = lpf (dust2Id i ar (int_to_ugen (i + 1) / 3)) 1500+ freq = (int_to_ugen i + 1) * (pitchstretch + 1) * f0+ decay_ = randId i 0.225 0.35+ damp = 1 -- control kr ("damp" ++ show i) 1+ amp = lfNoise2Id i kr 1 `in_range` (0.25,0.45)+ phase = 0+ in X.phasorModal sig freq decay_ damp amp phase)+in splay n (lfNoise2Id 'α' kr 0.1 `in_range` (0,1)) 1 0 True
+ Help/Ugen/pinkNoise.help.hs view
@@ -0,0 +1,31 @@+-- pinkNoise ; plain+pinkNoiseId 'α' ar * 0.1++-- pinkNoise ; monadic constructor+uid_st_eval (fmap (* 0.05) (pinkNoiseM ar))++-- pinkNoise ; c.f. whiteNoise+uid_st_eval (fmap (* 0.05) (whiteNoiseM ar))++-- pinkNoise ; c.f. whiteNoise+uid_st_eval (fmap (* 0.05) (brownNoiseM ar))++-- pinkNoise ; speaker balance+let n = pinkNoiseId 'γ' ar * 0.05 in mce2 n n++-- pinkNoise ; speaker balance ; mouse control+let x = mouseX kr 0 1 Linear 0.2+ x' = 1 - x+ n = pinkNoiseId 'δ' ar * 0.05+in mce2 (n * x') (n * x)++-- pinkNoise ; identifiers & referential transparency ; L = silence, R = pink-noise+mce2 (pinkNoiseId 'α' ar - pinkNoiseId 'α' ar) (pinkNoiseId 'α' ar - pinkNoiseId 'β' ar) * 0.1++-- pinkNoise ; silence+let n = pinkNoiseId 'α' ar in (n - n) * 0.1++---- ; drawings+Sound.Sc3.Plot.plot_ugen1 0.1 (pinkNoiseId 'ε' ar)+Sound.Sc3.Plot.FFT.plot_ugen_fft1 0.1 (pinkNoiseId 'ζ' ar)+UI.ui_sc3_scope_freq (600,400) 0
+ Help/Ugen/pitch.help.hs view
@@ -0,0 +1,38 @@+-- pitch+let x = mouseX kr 220 660 Linear 0.1+ y = mouseY kr 0.05 0.25 Linear 0.1+ s = sinOsc ar x 0 * y+ a = amplitude kr s 0.05 0.05+ f = pitch s 440 60 4000 100 16 7 0.02 0.5 1 0+in mce [s, sinOsc ar (mceChannel 0 f / 2) 0 * a]++-- pitch ; live input tracking, carelessly+let s = hpf (soundIn 0) 90+ a = lag (amplitude kr s 0.01 0.01) 0.2+ [f,_] = mceChannels (pitch s 440 60 4000 100 16 1 0.02 0.5 1 0)+ fq = midiCps (roundE (lag (cpsMidi f) 0.1))+in mce [s * 0.1, lfTri ar f 0 * lag a 0.2 * lag (f >** 90 * f <** 500) 0.2]++-- pitch ; comparison of input frequency (x) and tracked oscillator frequency (f)+let x = mouseX kr 440 880 Exponential 0.1+ o = sinOsc ar x 0 * 0.1+ [f,_] = mceChannels (pitch o 440 60 4000 100 16 7 0.02 0.5 1 0)+ r = sinOsc ar f 0 * 0.1+ t = impulse kr 4 0+ pf = poll t f 0 (label "f")+ px = poll t x 0 (label "x")+in mce [out 0 (mce2 o r),pf,px]++-- pitch ; control param+let initFreq = control kr "initFreq" 440.0+ minFreq = control kr "minFreq" 60.0+ maxFreq = control kr "maxFreq" 4000.0+ execFreq = control kr "execFreq" 100.0+ maxBinsPerOctave = control kr "maxBinsPerOctave" 16.0+ median = control kr "median" 1.0+ ampThreshold = control kr "ampThreshold" 0.01+ peakThreshold = control kr "peakThreshold" 0.5+ downSample = control kr "downSample" 1.0+ clar = control kr "clar" 0.0+ p = pitch (soundIn 0) initFreq minFreq maxFreq execFreq maxBinsPerOctave median ampThreshold peakThreshold downSample clar+in sinOsc ar (mceChannel 0 p) 0 * 0.1
+ Help/Ugen/pitchShift.help.hs view
@@ -0,0 +1,11 @@+-- pitchShift+let s = sinOsc ar 440 0 * 0.1+ r = mouseX kr 0.5 2.0 Linear 0.1+ d = mouseY kr 0.0 0.1 Linear 0.1+in pitchShift s 0.2 r d 0++-- pitchShift+let s = soundIn 0+ pd = mouseX kr 0.0 0.1 Linear 0.1+ td = mouseY kr 0.0 0.1 Linear 0.1+in pitchShift s 0.2 (mce2 1.0 1.5) pd td
+ Help/Ugen/playBuf.help.hs view
@@ -0,0 +1,55 @@+-- playBuf ; requires=buf ; once only+let (b, nc) = (control kr "buf" 100, 2)+in playBuf nc ar b (bufRateScale kr b) 1 0 NoLoop RemoveSynth++-- playBuf ; requires=buf ; infinite loop+let (b, nc) = (control kr "buf" 100, 2)+in playBuf nc ar b (bufRateScale kr b) 1 0 Loop DoNothing++-- playBuf ; requires=buf ; trigger playback at each pulse+let (b, nc) = (control kr "buf" 100, 2)+ t = impulse kr 2 0+ s = bufRateScale kr 0+in playBuf nc ar b s t 0 NoLoop DoNothing++-- playBuf ; requires=buf ; trigger playback at each pulse (diminishing intervals)+let (b, nc) = (control kr "buf" 100, 2)+ f = xLine kr 0.1 100 10 RemoveSynth+ t = impulse kr f 0+ s = bufRateScale kr b+in playBuf nc ar b s t 0 NoLoop DoNothing++-- playBuf ; requires=buf ; loop playback, accelerating pitch+let (b, nc) = (control kr "buf" 100, 2)+ r = xLine kr 0.1 100 60 RemoveSynth+in playBuf nc ar b r 1 0 Loop DoNothing++-- playBuf ; requires=buf ; sine wave control of playback rate, negative rate plays backwards+let (b, nc) = (control kr "buf" 100, 2)+ f = xLine kr 0.2 8 30 RemoveSynth+ r = fSinOsc kr f 0 * 3 + 0.6+ s = bufRateScale kr b * r+in playBuf nc ar b s 1 0 Loop DoNothing++-- playBuf ; requires=buf ; channel mismatch message in server log ; can acquire second channel (subsequent load)+let (b, nc) = (control kr "buf" 100, 1)+in playBuf (nc + 1) ar b (bufRateScale kr b) 1 0 Loop DoNothing++-- playBuf ; requires=buf ; scan sequence of buffers+let n_buf = 61+ t = impulse kr 1 0+ b = mouseX kr 0 n_buf Linear 0.2+ r = bufRateScale kr b+in playBuf 1 ar b r t 0 Loop DoNothing * 0.5++---- ; setup ; nc=1+withSc3 (async (b_allocRead 0 (sfResolve "metal.wav") 0 0))++---- ; setup ; nc=2+withSc3 (async (b_allocRead 0 (sfResolve "pf-c5.aif") 0 0))++---- ; setup ; dir ; cnt=61+dir = "/home/rohan/data/audio/instr/celeste/long/"+dir_ls <- System.Directory.getDirectoryContents dir+fn_seq = zip [0..] (sort (filter ((== ".wav") . System.FilePath.takeExtension) dir_ls))+withSc3 (mapM_ async (map (\(ix,fn) -> b_allocRead ix (dir System.FilePath.</> fn) 0 0) fn_seq))
+ Help/Ugen/playBufCF.help.hs view
@@ -0,0 +1,20 @@+-- playBufCF ; wslib ; CF = cross-fade ; control-rate trigger and start-position inputs+let b = control kr "buf" 100+ r = bufRateScale kr b+ tr = impulse kr 2 0+ wn = whiteNoiseId 'α' kr+ sp = linLin wn (-1) 1 0 (bufFrames kr b - (0.5 * 44100))+ o = playBufCF 1 b r tr sp NoLoop 0.1 2+ o' = playBuf 1 ar b r tr sp NoLoop DoNothing+in mce2 o o'++-- playBufCF ; demand ugens inputs+let b = control kr "buf" 100+ r = drandId 'α' dinf (mce [0.95,1,1.05])+ tr = dwhiteId 'β' dinf 0.1 0.3+ sp = dbrownId 'γ' dinf 0 0.95 0.1 * bufFrames kr b+in playBufCF 1 b r tr sp NoLoop 2 5++---- ; load sound file to buffer zero (single channel file required for examples)+withSc3 (async (b_allocRead 0 (sfResolve "pf-c5.aif") 0 0))+withSc3 (async (b_allocRead 0 (sfResolve "a11wlk01.wav") 0 0))
+ Help/Ugen/pluck.help.hs view
@@ -0,0 +1,57 @@+-- pluck ; excitation signal is white noise, triggered twice a second with varying OnePole coef+let n = whiteNoiseId 'α' ar+ t = impulse kr 9 0+ x = mouseX kr (-0.999) 0.999 Linear 0.1+ y = mouseY kr 0.1 1 Linear 0.1+ dl = 1 / 440+in pluck (n * 0.25) t dl (dl * y) 10 x++-- pluck+let n = 50+ f = X.randNId n 'α' 0.05 0.2+ p = X.randNId n 'β' 0 1+ w = mceFillId 'γ' n (\z _ -> whiteNoiseId z ar)+ fi = X.randNId n 'δ' 10 12+ coef = randId 'ε' 0.01 0.2+ l = X.randNId n 'ζ' (-1) 1+ x = mouseX kr 60 1000 Exponential 0.1+ o = linLin (sinOsc kr f p) (-1) 1 x 3000+ i = impulse kr fi 0+ ks = pluck (w * 0.1) i 0.01 (1 / o) 2 coef+in leakDC (mix (pan2 ks l 1)) 0.995++-- pluck ; event control+let f (c,g,x,y,z,o,_,_,_,_,_) =+ let n = whiteNoiseId (c,'α') ar * z+ dl_max = 1 / 220+ dl = dl_max * (1 - x * 0.9)+ sig = pluck n g dl_max dl 10 (y / 3)+ in pan2 sig (o * 2 - 1) 1+in mix (voicer 16 f) * control kr "gain" 2++-- pluck ; event control ; gateReset+let f (_,g,x,y,z,o,_,_,p,_,_) =+ let n = whiteNoiseId 'α' ar * z+ dl_max = 1 / 8+ (gt,tr) = ccEventGateReset g p+ dx = x - latch x tr+ dl = 1 / midiCps (p * 127 + dx * 8)+ in pan2 (pluck n gt dl_max dl 10 (y / 3)) (o * 2 - 1) 1+in mix (voicer 16 f) * control kr "gain" 2++-- pluck ; event control ; gateReset ; p+px+let f (_,g,_,y,z,o,_,_,p,px,_) =+ let n = whiteNoiseId 'α' ar * z+ dl_max = 1 / 8+ (gt,tr) = ccEventGateReset g p+ dl = 1 / midiCps (p * 127 + px * 1)+ in pan2 (pluck n gt dl_max dl 10 (y / 3)) (o * 2 - 1) 1+in mix (voicer 16 f) * control kr "gain" 2++-- pluck ; https://scsynth.org/t/4318/17+let tr = impulse ar (lfNoise2 kr 1 `in_exprange` (1,100)) 0+ frq = map (midiCps . (+ 60.5)) [0, 2, 4, 5, 7, 9, 10]+ dlt = 1 / mce frq+ dct = mouseX kr 0.5 2 Linear 0.2+ sig = mix (leakDC (pluck (hasher (sweep ar tr 1) * dbAmp (-10)) tr dlt dlt dct 0.5) 0.995)+in pan2 (moogFF sig (lfNoise2 kr 1 `in_exprange` (500,16000)) 0 0) 0 1
+ Help/Ugen/pmOsc.help.hs view
@@ -0,0 +1,30 @@+-- pmOsc ; composite of sinOsc, ie. sinOsc r cf (sinOsc r mf mp * pm) ; modulate carfreq+pmOsc ar (line kr 600 900 5 DoNothing) 600 3 0 * 0.1++-- pmOsc ; modulate modfreq+pmOsc ar 300 (line kr 600 900 5 DoNothing) 3 0 * 0.1++-- pmOsc ; modulate index+pmOsc ar 300 550 (line kr 0 20 8 DoNothing) 0 * 0.1++-- pmOsc ; random parameters, linear modulation index motion over n seconds+let n = 2+ cf = randId 'α' 0 2000+ mf = randId 'β' 0 800+ pme = randId 'γ' 0 12+ l = randId 'δ' (-1) 1+ pm = line kr 0 pme n DoNothing+in linPan2 (pmOsc ar cf mf pm 0) l 0.05++-- pmOsc ; event control+let f (_,g,x,y,z,_,_,_,_,_,_) =+ let cps = midiCps (x * 24 + 42)+ cps' = vibratoId 'θ' ar (k2a cps) (y * 4 + 4) 0.02 0 0 0.04 0.1 0.0 0.0+ sig = pmOsc ar cps'+ (urange 1.01 2.01 (lfPulse kr (1/8) 0 0.5) * cps)+ (envGen kr g 1 0 1 DoNothing (envelope [3,3,0] [0, 0.2] [EnvNum (-4)]))+ 0+ c = ampCompA kr cps 0 0.32 1+ in sig * c * z * g+ rvb s = xFade2 s (gVerb (bpf s (midiCps 90) 1) 50 8 0.5 0.5 15 0 0.7 0.5 300) 0.2 1+in rvb (mix (voicer 16 f)) * control kr "gain" 1
+ Help/Ugen/poll.help.hs view
@@ -0,0 +1,32 @@+-- poll+let t = impulse kr 10 0+ l = line kr 0 1 1 RemoveSynth+in poll t l 0 (label "polling...")++-- poll ; multichannel expansion (requires labels be equal length...)+let t = impulse kr (mce2 10 5) 0+ l = line kr 0 (mce2 1 5) (mce2 1 2) DoNothing+in poll t l 0 (mce2 (label "t1") (label "t2"))++-- poll ; will not poll once with a trigger of one, use impulse with frequency zero+let k = control kr "k" 0.3+ x = negate (k * 1.1)+ t = impulse kr 0 0 {- 1 -}+in mrg2 x (poll t x (-1) (label "x"))++-- poll ; at trigger control+let t = trigControl "t" 0.3+ f1 = lfNoise2Id 'α' ar 0.25 * 100 + 110+ f2 = lfNoise2Id 'β' ar 0.25 * 200 + 220+ s = gendy1Id 'γ' ar 1 1 1 1 f1 f2 0.5 0.5 12 0 * 0.1+ p = poll t (mce2 f1 f2) (-1) (mce2 (label "f1") (label "f2"))+in mrg2 s p++-- poll ; print oscillator frequency+let x = mouseX kr 200 260 Exponential 0.2+ o = sinOsc ar x 0 * 0.25+ t = impulse kr 2 0+in mrg2 o (poll t x 0 (label "polling..."))++---- ; set t control+withSc3 (Sound.OSC.sendMessage (n_set1 (-1) "t" 1))
+ Help/Ugen/pow.help.hs view
@@ -0,0 +1,15 @@+-- pow+let a = fSinOsc ar 100 0 * 0.1 in mce2 a (a ** 10)++-- pow ; see also http://create.ucsb.edu/pipermail/sc-users/2006-December/029998.html+let n0 = lfNoise2Id 'α' kr 8+ n1 = lfNoise2Id 'β' kr 3+ s = blip ar (n0 * 200 + 300) (n1 * 10 + 20)+ x = mouseX kr 1000 (sampleRate * 0.5) Exponential 0.1+ y = mouseY kr 1 24 Exponential 0.1+ d = latch s (impulse ar x 0)+ b = roundUp d (0.5 ** y)+in mce2 d b * 0.2++-- pow ; optimises identity+(sinOsc ar 440 0 ** 1) * 0.1
+ Help/Ugen/pulse.help.hs view
@@ -0,0 +1,13 @@+-- pulse ; modulate frequency+let f = xLine kr 40 4000 6 RemoveSynth+in pulse ar f 0.1 * 0.1++-- pulse ; modulate width, 0.5 = square wave+let w = line kr 0.01 0.99 8 RemoveSynth+in pulse ar 200 w * 0.1++-- pulse ; two band limited square waves through a resonant low pass filter+let p = pulse ar (mce2 100 250) 0.5 * 0.1+ f = xLine kr 8000 400 5 DoNothing+in rlpf p f 0.05+
+ Help/Ugen/pulseCount.help.hs view
@@ -0,0 +1,17 @@+-- pulseCount+let c = pulseCount (impulse ar 10 0) (impulse ar 0.4 0)+in sinOsc ar (c * 200) 0 * 0.05++-- pulseCount ; printer (silent, see console)+let b = localBuf 11 1+ t = impulse ar 10 0+ p = pulseCount t 0+ d = demand t 0 (dbufwr (-666) b p NoLoop)+in mrg [dc ar 0,poll t p 0 (label "p")]++-- pulseCount ; printer (silent, see console) ; id+let b = localBufId 'α' 11 1+ t = impulse ar 10 0+ p = pulseCount t 0+ d = demand t 0 (dbufwrId 'α' (-666) b p NoLoop)+in mrg [dc ar 0,poll t p 0 (label "p")]
+ Help/Ugen/pulseDPW.help.hs view
@@ -0,0 +1,5 @@+-- pulseDPW+X.pulseDPW ar (xLine kr 2000 20 10 DoNothing) 0.5 * 0.1++-- pulseDPW+X.pulseDPW ar (mouseX kr 200 12000 Exponential 0.2) 0.5 * 0.1
+ Help/Ugen/pulseDivider.help.hs view
@@ -0,0 +1,6 @@+-- pulseDivider+let p = impulse ar 8 0+ d = pulseDivider p (mce [4,7]) 0+ a = sinOsc ar 1200 0 * decay2 p 0.005 0.1+ b = sinOsc ar 600 0 * decay2 d 0.005 0.5+in (a + b) * 0.1
+ Help/Ugen/pv_BinBufRd.help.hs view
@@ -0,0 +1,9 @@+-- pv_BinBufRd ; play analysis back ; c.f. pv_RecordBuf help file+let snd_buf = control kr "buf" 100+ rec_buf = control kr "rec" 10+ fft_buf = localBufId 'α' 1 1024+ x = mouseX kr 0 1 Linear 0.2+ y = mouseY kr 5 100 Linear 0.2+ c0 = fft' fft_buf (playBuf 1 ar snd_buf (bufRateScale kr snd_buf) 1 0 Loop DoNothing)+ c1 = X.pv_BinBufRd c0 rec_buf x 10 3 y 1+in ifft c1 1 0
+ Help/Ugen/pv_BinScramble.help.hs view
@@ -0,0 +1,21 @@+-- pv_BinScramble+let b = control kr "buf" 100+ a = playBuf 1 ar b (bufRateScale kr b) 1 0 Loop DoNothing+ f = fft' (localBufId 'α' 2048 1) a+ x = mouseX kr 0.0 1.0 Linear 0.1+ y = mouseY kr 0.0 1.0 Linear 0.1+ g = pv_BinScrambleId 'β' f x y (impulse kr 4 0)+in pan2 (ifft' g) 0 0.5++-- pv_BinScramble ; warning=feedback+let a = soundIn 0+ f = fft' (localBufId 'γ' 2048 1) a+ x = mouseX kr 0.15 1 Linear 0.1+ y = mouseY kr 0.15 1 Linear 0.1+ i = impulse kr (lfNoise0Id 'δ' kr 2 * 8 + 10) 0+ g = pv_BinScrambleId 'ε' f x y i+ h = ifft' g+in pan2 h 0 1++---- ; load sndfile+withSc3 (async (b_allocRead 0 "/home/rohan/data/audio/pf-c5.aif" 0 0))
+ Help/Ugen/pv_BinShift.help.hs view
@@ -0,0 +1,10 @@+-- pv_BinShift ; default values+ifft' (pv_BinShift (fftAllocId 'α' 2048 (soundIn 0) 0.5 0 1 0) 1 0 0) * 0.25++-- pv_BinShift ; mouse control+let z = soundIn 0+ x = mouseX kr (-10) 100 Linear 0.1 -- shift+ y = mouseY kr 1 4 Linear 0.1 -- stretch+ b = mouseButton kr 0 1 0.2+ pv = pv_BinShift (fftAllocId 'β' 2048 z 0.5 0 1 0) y x b+in ifft' pv * 0.25
+ Help/Ugen/pv_BinWipe.help.hs view
@@ -0,0 +1,8 @@+-- pv_BinWipe+let z = soundIn 0+ n = whiteNoiseId 'α' ar * 0.1+ f = fft' (localBufId 'β' 2048 1) n+ g = fft' (localBufId 'γ' 2048 1) z+ x = mouseX kr 0.0 1.0 Linear 0.1+ h = pv_BinWipe f g x+in pan2 (ifft' h) 0 0.5
+ Help/Ugen/pv_BrickWall.help.hs view
@@ -0,0 +1,28 @@+-- pv_BrickWall+let z = soundIn 0+ x = mouseX kr (-1) 1 Linear 0.1+ c = fft' (localBufId 'α' 2048 1) z+in ifft' (pv_BrickWall c x)++-- pv_BrickWall ; ln 2021-04-12 https://lukasnowok.github.io/spectrology/+let c0 = localBufId 'α' 1 1024+ c1 = fft' c0 (whiteNoiseId 'β' ar)+ c2 = pv_BrickWall c1 (line ar (-1) 1 20 DoNothing)+in ifft' c2 * 0.1++-- pv_BrickWall ; ln 2021-04-18 https://lukasnowok.github.io/spectrology/+let e1 = envGen ar (impulse kr 1.1 0) 1 0 1 DoNothing (envPerc 0 1.2)+ o1 = ifft' (pv_BrickWall (fft' (localBufId 'α' 1 1024) (whiteNoiseId 'β' ar * e1)) 0.601)+ e2 = envGen ar (impulse kr 0.7 0) 1 0 1 DoNothing (envPerc 1 0)+ o2 = ifft' (pv_BrickWall (fft' (localBufId 'γ' 1 1024) (whiteNoiseId 'δ' ar * e2 * xLine ar 0.01 1 20 DoNothing)) (-0.5))+ o3 = lfTri ar 12000 0+in (o1 + o2 + o3) * 0.1++-- pv_BrickWall ; ln 2021-04-19 https://lukasnowok.github.io/spectrology/+let geom k z m = mce (take k (iterate (* m) z))+ s = mix (sinOsc ar (geom 100 20000 1.1 * line ar 1 0 20 DoNothing) 0 * 0.1)+ w = lfSaw ar (xLine ar 4 0.1 20 DoNothing) 0+in ifft' (pv_BrickWall (fft' (localBufId 'α' 1 1024) s) w) * 0.1++---- ; drawings+UI.ui_baudline 4096 50 "linear" 2
+ Help/Ugen/pv_BufRd.help.hs view
@@ -0,0 +1,6 @@+-- pv_BufRd ; play analysis back ; c.f. pv_RecordBuf help file+let rec_buf = control kr "rec" 10+ fft_buf = localBufId 'α' 1 1024+ x = mouseX kr 0 1 Linear 0.2+ c0 = X.pv_BufRd fft_buf rec_buf x+in ifft c0 1 0
+ Help/Ugen/pv_Compander.help.hs view
@@ -0,0 +1,15 @@+-- pv_Compander ; mostly compress+let z = decay2 (impulse ar 8 0 * lfSaw kr 0.3 0 * 0.3) 0.001 0.3 * mix (pulse ar (mce [80, 81]) 0.3)+ x = mouseX kr 1 50 Linear 0.2+in mce [z, ifft' (X.pv_Compander (fft' (localBufId 'α' 2048 1) z) x 1.2 0.25)]++-- pv_Compander ; mostly expand+let z = decay2 (impulse ar 8 0 * lfSaw kr 0.3 0 * 0.3) 0.001 0.3 * mix (pulse ar (mce [80, 81]) 0.3)+ x = mouseX kr 1 50 Linear 0.1+in mce [z, ifft' (X.pv_Compander (fft' (localBufId 'β' 2048 1) z) x 2.0 0.85)]++-- pv_Compander ; sustainer+let z = decay2 (impulse ar 8 0 * lfSaw kr 0.3 0 * 0.3) 0.001 0.3 * mix (pulse ar (mce [80, 81]) 0.3)+ x = mouseX kr 1 80 Linear 0.1+ s = ifft' (X.pv_Compander (fft' (localBufId 'γ' 2048 1) z) x 0.5 1.0)+in mce [z, limiter s 0.999 0.05]
+ Help/Ugen/pv_ConformalMap.help.hs view
@@ -0,0 +1,13 @@+-- pv_ConformalMap+let i = soundIn 0+ x = mouseX kr (-1) 1 Linear 0.1+ y = mouseY kr (-1) 1 Linear 0.1+in pan2 (ifft' (pv_ConformalMap (fft' (localBufId 'α' 1024 1) i) x y)) 0 1++-- pv_ConformalMap ; with filtering+let z = soundIn 0+ x = mouseX kr 0.01 2.0 Linear 0.1+ y = mouseY kr 0.01 10.0 Linear 0.1+ c = fft' (localBufId 'β' 2048 1) z+ m = ifft' (pv_ConformalMap c x y)+in pan2 (combN m 0.1 0.1 10 * 0.5 + m) 0 0.5
+ Help/Ugen/pv_Diffuser.help.hs view
@@ -0,0 +1,12 @@+-- pv_Diffuser ; trigger revised phase shifts with MouseX crossing center of screen+let b = control kr "buf" 100+ z = playBuf 1 ar b (bufRateScale kr b) 0 0 Loop DoNothing+ f = fft' (localBufId 'α' 2048 1) z+ x = mouseX kr 0 1 Linear 0.1+ h = pv_Diffuser f (x `greater_than` 0.5)+in mce2 z (ifft' h * 0.5)++---- ; load buf+let fn = "/usr/share/SuperCollider/sounds/a11wlk01.wav"+let fn = "/home/rohan/data/audio/instr/bosendorfer/064/C5.aif"+withSc3 (async (b_allocRead 0 fn 0 0))
+ Help/Ugen/pv_Freeze.help.hs view
@@ -0,0 +1,5 @@+-- pv_Freeze+let f = fft' (localBufId 'α' 2048 1) (soundIn 0)+ x = mouseX kr 0 1 Linear 0.1+ h = X.pv_Freeze f (x `greater_than` 0.5)+in ifft' h * 0.5
+ Help/Ugen/pv_HainsworthFoote.help.hs view
@@ -0,0 +1,16 @@+-- pv_HainsworthFoote+let i = soundIn 0+ b = localBufId 'α' 2048 1+ f = fft' b i+ x = mouseX kr 0.5 1.25 Linear 0.2+ h = pv_HainsworthFoote f 1 0 x 0.04+ o = sinOsc ar (mrg2 440 445) 0 * decay (h * 0.1) 0.1 * 0.1+in o + i++-- pv_HainsworthFoote ; spot note transitions+let s = lfSaw ar (lfNoise0Id 'β' kr 1 * 90 + 400) 0 * 0.5+ b = localBufId 'γ' 2048 1+ f = fft' b s+ d = pv_HainsworthFoote f 1.0 0.0 0.9 0.5+ t = sinOsc ar 440 0 * decay (d * 0.1) 0.1 * 0.1+in mce2 (s * 0.05) t
+ Help/Ugen/pv_Invert.help.hs view
@@ -0,0 +1,11 @@+-- pv_Invert+let z = sinOsc ar 440 0 * 0.4 + pinkNoiseId 'α' ar * 0.1+ c0 = fft' (localBufId 'β' 2048 1) z+ c1 = X.pv_Invert c0+in mce2 z (ifft' c1) * 0.5++-- pv_Invert+let z = soundIn 0+ c0 = fft' (localBufId 'β' 2048 1) z+ c1 = X.pv_Invert c0+in mce2 z (ifft' c1) * 0.5
+ Help/Ugen/pv_JensenAndersen.help.hs view
@@ -0,0 +1,6 @@+-- pv_JensenAndersen ; propsc=0.25 prophfe=0.25 prophfc=0.25 propsf=0.25 threshold=1.0 waittime=0.04+let i = soundIn 0+ f = fft' (localBufId 'α' 2048 1) i+ x = mouseX kr 0.01 1.0 Linear 0.2+ h = pv_JensenAndersen f 0.25 0.25 0.25 0.25 x 0.04+in sinOsc ar (mrg2 440 445) 0 * decay (h * 0.1) 0.1 * 0.1
+ Help/Ugen/pv_LocalMax.help.hs view
@@ -0,0 +1,6 @@+-- pv_LocalMax+let z = soundIn 0+ f = fft' (localBufId 'α' 2048 1) z+ x = mouseX kr 0 100 Linear 0.1+ h = pv_LocalMax f x+in ifft' h * 0.5
+ Help/Ugen/pv_MagAbove.help.hs view
@@ -0,0 +1,13 @@+-- pv_MagAbove+let z = soundIn 0+ f = fft' (localBufId 'α' 2048 1) z+ x = mouseX kr 0 64 Linear 0.1+ h = pv_MagAbove f x+in ifft' h * 0.5++-- pv_MagAbove ; synthesised input+let z = sinOsc ar (sinOsc kr (squared (sinOsc kr 0.08 0 * 6 + 6.2)) 0 * 100 + 800) 0+ f = fft' (localBufId 'α' 2048 1) z+ x = mouseX kr 0 512 Linear 0.1+ h = pv_MagAbove f x+in ifft' h * 0.1
+ Help/Ugen/pv_MagBelow.help.hs view
@@ -0,0 +1,13 @@+-- pv_MagBelow ; c.f. pv_MagAbove+let z = soundIn 0+ f = fft' (localBufId 'α' 2048 1) z+ x = mouseX kr 0 64 Linear 0.1+ h = pv_MagBelow f x+in ifft' h * 0.5++-- pv_MagBelow ; synthesised input+let z = sinOsc ar (sinOsc kr (squared (sinOsc kr 0.08 0 * 6 + 6.2)) 0 * 100 + 800) 0+ f = fft' (localBufId 'α' 2048 1) z+ x = mouseX kr 0 512 Linear 0.1+ h = pv_MagBelow f x+in ifft' h * 0.1
+ Help/Ugen/pv_MagClip.help.hs view
@@ -0,0 +1,6 @@+-- pv_MagClip+let f = fft' (localBufId 'α' 2048 1) (soundIn 0)+ c = 128+ x = mouseX kr 0 c Linear 0.1+ h = pv_MagClip f x+in ifft' h * 0.5
+ Help/Ugen/pv_MagFreeze.help.hs view
@@ -0,0 +1,14 @@+-- pv_MagFreeze ; mouseX is trigger to freeze+let b = control kr "buf" 100+ z = playBuf 1 ar b (bufRateScale kr b) 0 0 Loop DoNothing+ f = fft' (localBufId 'α' 2048 1) z+ x = mouseX kr 0 1 Linear 0.1+ h = pv_MagFreeze f (x >** 0.5)+in ifft' h * 0.5++-- pv_MagFreeze ; mouseX is trigger to freeze+let z = soundIn 0+ f = fft' (localBufId 'α' 2048 1) z+ x = mouseX kr 0 1 Linear 0.1+ h = pv_MagFreeze f (x >** 0.5)+in ifft' h * 0.5
+ Help/Ugen/pv_MagGate.help.hs view
@@ -0,0 +1,8 @@+-- pv_MagGate+let (lhs,rhs) = (-50,0) -- (0,100)+ i = soundIn 0+ c = fft' (localBufId 'α' 2048 1) i+ x = mouseX kr lhs rhs Linear 0.2+ y = mouseY kr 0 1 Linear 0.2+ h = X.pv_MagGate c x y+in ifft' h * 0.5
+ Help/Ugen/pv_MagMul.help.hs view
@@ -0,0 +1,6 @@+let z = soundIn 0+ y = lfSaw ar (midiCps 43) 0 * 0.2+ c0 = fft' (localBufId 'α' 2048 1) y+ c1 = fft' (localBufId 'β' 2048 1) z+ c2 = pv_MagMul c0 c1+in ifft' c2 * 0.1
+ Help/Ugen/pv_MagSmear.help.hs view
@@ -0,0 +1,6 @@+-- pv_MagSmear+let i = soundIn 0+ c = fft' (localBufId 'α' 2048 1) i+ x = mouseX kr 0 100 Linear 0.2+ h = pv_MagSmear c x+in ifft' h * 0.5
+ Help/Ugen/pv_Morph.help.hs view
@@ -0,0 +1,8 @@+-- pv_Morph+let o1 = pulse ar 180 (lfCub kr 1 0 * 0.1 + 0.3) * 0.2+ o2 = varSaw ar 190 0 (lfCub kr 0.8 0 * 0.4 + 0.5) * 0.5+ c1 = fft' (localBufId 'α' 2048 1) o1+ c2 = fft' (localBufId 'β' 2048 1) o2+ x = mouseX kr 0 1 Linear 0.2+ h = X.pv_Morph c1 c2 x+in ifft' h * 0.5
+ Help/Ugen/pv_Mul.help.hs view
@@ -0,0 +1,7 @@+-- pv_Mul+let o1 = sinOsc ar 500 0+ o2 = sinOsc ar (line kr 50 400 5 RemoveSynth) 0+ c1 = fft' (localBufId 'α' 2048 1) o1+ c2 = fft' (localBufId 'β' 2048 1) o2+ h = pv_Mul c1 c2+in ifft' h * 0.1
+ Help/Ugen/pv_PlayBuf.help.hs view
@@ -0,0 +1,13 @@+-- pv_PlayBuf ; c.f. pv_RecordBuf+let rec_buf = control kr "rec" 10+ fft_buf = localBufId 'α' 1024 1+ x = mouseX kr (-1) 1 Linear 0.2+ c = X.pv_PlayBuf fft_buf rec_buf x 50 1+in ifft c 1 0++-- pv_PlayBuf+let rec_buf = control kr "rec" 10+ fft_buf = localBufId 'β' 1024 1+ n = range (-1) 2 (lfNoise2Id 'γ' kr 0.2)+ c = X.pv_PlayBuf fft_buf rec_buf n 0 1+in ifft c 1 0
+ Help/Ugen/pv_RandComb.help.hs view
@@ -0,0 +1,18 @@+-- pv_RandComb+let z = soundIn 0+ t = impulse kr 0.5 0+ x = mouseX kr 0.6 0.95 Linear 0.1+ c = pv_RandCombId 'α' (fft' (localBufId 'α' 2048 1) z) x t+in pan2 (ifft' c) 0 1++-- pv_RandComb ; ln 2021-04-07 https://lukasnowok.github.io/spectrology/+let c0 = localBufId 'α' 1 1024+ tr = impulse kr 7 0+ env = envGen kr tr 1 0 1 DoNothing (Envelope [0,1,1,0] [0,0.1,0] [] Nothing Nothing 0)+ c1 = fft' c0 (whiteNoiseId 'β' ar)+ c2 = pv_RandCombId 'γ' c1 (line kr 0.6 1 20 DoNothing) tr+ c3 = pv_BrickWall c2 0.05+in (ifft' c3 * env + sinOsc ar 1000 0 * 0.2) * 0.1++---- ; drawings+UI.ui_baudline 4096 50 "linear" 2
+ Help/Ugen/pv_RandWipe.help.hs view
@@ -0,0 +1,15 @@+-- pv_RandWipe+let z1 = let n0 = randomRs (400.0, 1000.0) (mkStdGen 0)+ o0 = map (\n -> lfSaw ar n 0 * 0.1) (take 6 n0)+ in sum_opt o0+ z2 = let n1 = randomRs (80.0, 400.0) (mkStdGen 1)+ n2 = randomRs (0.0, 8.0) (mkStdGen 2)+ o1 = map (\n -> lfPulse ar n 0.0 0.2) (take 6 n1)+ o2 = map (\n -> sinOsc kr n 0 * 0.2) (take 6 n2)+ in sum_opt (zipWith (\p s -> p * (max s 0.0)) o1 o2)+ f1 = fft' (localBufId 'α' 2048 1) z1+ f2 = fft' (localBufId 'β' 2048 1) z2+ x = mouseX kr 0 1 Linear 0.1+ y = mouseY kr 0 1 Linear 0.1+ h = pv_RandWipeId 'γ' f1 f2 x (y `greater_than` 0.5)+in pan2 (ifft' h) 0 0.5
+ Help/Ugen/pv_RecordBuf.help.hs view
@@ -0,0 +1,15 @@+-- pv_RecordBuf ; analyse signal and store to buffer+let snd_buf = control kr "buf" 0+ rec_buf = control kr "rec" 10+ fft_buf = localBufId 'α' 1 1024+ i = playBuf 1 ar snd_buf (bufRateScale kr snd_buf) 1 0 NoLoop RemoveSynth+ c0 = fft fft_buf i 0.25 1 1 0+ c1 = X.pv_RecordBuf c0 rec_buf 0 1 0 0.25 1+in mrg2 i c1++---- ; load soundfile+fn = sfResolve "a11wlk01.wav"+withSc3 (async (b_allocRead 0 fn 0 0))++---- ; allocate analysis buffer ; duration=5, frame-size=1024, hop-size=0.25, sample-rate=48000+withSc3 (async (b_alloc 10 (pv_calcPVRecSize 5 1024 0.25 48000) 1))
+ Help/Ugen/pv_RectComb.help.hs view
@@ -0,0 +1,15 @@+-- pv_RectCommb ; mouse control+let z = soundIn 0+ b = localBufId 'β' 2048 1+ x = mouseX kr 0 0.5 Linear 0.1+ y = mouseY kr 0 0.5 Linear 0.1+ c = pv_RectComb (fft' b z) 8 x y+in pan2 (ifft' c) 0 1++-- pv_RectCommb ; lfo control+let z = soundIn 0+ b = localBufId 'γ' 2048 1+ p = lfTri kr 0.097 0 * 0.4 + 0.5+ w = lfTri kr 0.240 0 * (-0.5) + 0.5+ c = pv_RectComb (fft' b z) 8 p w+in pan2 (ifft' c) 0 1
+ Help/Ugen/pv_SpectralMap.help.hs view
@@ -0,0 +1,21 @@+-- pv_SpectralMap+let y = mouseY kr (-1) 1 Linear 0.2+ x = mouseX kr (-1) 1 Linear 0.2+ b = control kr "buf" 100+ c1 = fft' (localBufId 'α' 2048 1) (soundIn 0)+ c2 = fft' (localBufId 'β' 2048 1) (playBuf 1 ar b 1 1 0 Loop DoNothing)+ c3 = X.pv_SpectralMap c1 c2 0.0 y x 1 0+in ifft' c3++-- pv_SpectralMap ; https://scsynth.org/t/share-your-delay-reverb-designs/2206/6+let freeze = control kr "freeze" 0+ mode = control kr "mode" 1+ roomsize = control kr "roomsize" 10+ revtime = control kr "revtime" 6+ c1 = fft' (localBufId 'α' 2048 1) (soundIn 0)+ c2 = fft' (localBufId 'β' 2048 1) (soundIn 1)+ c3 = X.pv_SpectralMap c1 c2 0.0 freeze mode 1 0+in gVerb (ifft' c3) roomsize revtime 0.5 0.5 15 1 0.7 0.5 300++---- ; load sndfile+withSc3 (async (b_allocRead 0 (sfResolve "metal.wav") 0 0))
+ Help/Ugen/pv_Split.help.hs view
@@ -0,0 +1,63 @@+-- pv_Split+let sz = 1024 * 2+ op = (-)+ z = soundIn 0+ c0 = fft' (localBufId 'α' sz 1) z+ (c1,c2) = X.pv_SplitUnpack c0 (localBufId 'β' sz 1)+in ifft' c1 `op` ifft' c2++-- pv_Split+let sz = 1024 * 16+ op = (+)+ z = soundIn 0+ c0 = fft' (localBufId 'α' sz 1) z+ (c1,c2) = X.pv_SplitUnpack c0 (localBufId 'β' sz 1)+in ifft' c1 `op` ifft' c2++-- pv_Split+let sz = 1024 * 16+ op = (-)+ z = lfClipNoiseId 'α' ar 100 * 0.1+ c0 = fft' (localBufId 'α' sz 1) z+ (c1,c2) = X.pv_SplitUnpack c0 (localBufId 'β' sz 1)+in ifft' c1 `op` ifft' c2++-- pv_Split ; pv_splita is a variant that allocates a local buffer, deriving the size from the input graph+let s = whiteNoiseId 'α' ar * 0.1+ c1 = fftAllocId 'β' 2048 s 0.5 0 1 0+ (c2,c3) = X.pv_SplitAllocUnpackId 'γ' c1+ c4 = pv_BrickWall c2 (-0.85)+ c5 = pv_BrickWall c3 0.45+in ifft c4 0 0 * 0.15 + ifft c5 0 0++-- pv_Split ; pv_splita works with external buffers as well+let b = control kr "buf" 0+ z = soundIn 0+ c1 = fft b z 0.5 0 1 0+ (c2,c3) = X.pv_SplitAllocUnpackId 'γ' c1+ c4 = pv_BrickWall c2 (-0.85)+ c5 = pv_BrickWall c3 0.45+in ifft c4 0 0 * 0.15 + ifft c5 0 0++---- ; pv_Split ; leaving out pv_split gives an invalid graph (ie. this expression is an error)+let s = whiteNoiseId 'α' ar * 0.1+ c1 = fftAllocId 'β' 2048 s 0.5 0 1 0+ c4 = pv_BrickWall c1 (-0.85)+ c5 = pv_BrickWall c1 0.45+in ifft c4 0 0 * 0.15 + ifft c5 0 0++{---- Variant of `PV_Copy` that returns both signal paths.++`PV_Copy` graphs have two linear orderings that are not equivalent.++... -> fft -> ... .-> pv_copy -> pv1 -> ifft -> ...+ |+ .-> pv2 -> ifft -> ...++`PV_Split` graphs also have two _equivalent_ linear orderings.++ .-> pv1 -> ifft1 -> ...+... -> fft -> ... -> pv_split |+ .-> pv2 -> ifft2 -> ...++-}
+ Help/Ugen/pv_xFade.help.hs view
@@ -0,0 +1,8 @@+-- pv_xFade+let o1 = pulse ar 180 (lfCub kr 1 0 * 0.1 + 0.3) * 0.2+ o2 = varSaw ar 190 0 (lfCub kr 0.8 0 * 0.4 + 0.5) * 0.5+ c1 = fft' (localBufId 'α' 2048 1) o1+ c2 = fft' (localBufId 'β' 2048 1) o2+ x = mouseX kr 0 1 Linear 0.2+ h = X.pv_xFade c1 c2 x+in ifft' h * 0.5
+ Help/Ugen/quadC.help.hs view
@@ -0,0 +1,12 @@+-- quadC+quadC ar (sampleRate / 2) 1 (-1) (-0.75) 0 * 0.1++-- quadC+let x = mouseX kr 3.5441 4 Linear 0.1+in quadC ar 4000 (negate x) x 0 0.1 * 0.2++-- quadC+let x = mouseX kr 3.5441 4 Linear 0.1+ f = quadC ar 4 (negate x) x 0 0.1 * 800 + 900+in sinOsc ar f 0 * 0.1+
+ Help/Ugen/quadL.help.hs view
@@ -0,0 +1,1 @@+---- c.f. quadC
+ Help/Ugen/quadN.help.hs view
@@ -0,0 +1,1 @@+---- c.f. quadC
+ Help/Ugen/rDelayMap.help.hs view
@@ -0,0 +1,35 @@+-- rDelayMap+let a = mce [-1,0,0,0.5,1,-1,0,1]+ b = clearBuf (localBufId 'α' 1 88200)+ x = mouseX kr 110 440 Linear 0.1+ y = mouseY kr 0.0 0.2 Linear 0.1+ o = sinOsc ar x 0 * y+in mce [X.rDelayMap b o 0 a,o]++-- rDelayMap ; simple feedback circuit (static)+let n = whiteNoiseId 'α' ar+ b = clearBuf (localBufId 'β' 1 88200)+ s = decay (impulse ar (5/4) 0) 0.1 * n * 0.2+ a = mce [-1,0,0,1,1/9,0,1,8/9,1,-1,0,1]+in X.rDelayMap b s 0 a++-- rDelayMap ; simple feedback circuit (dynamic)+let n = whiteNoiseId 'α' ar -- soundIn 0+ s = decay (impulse ar (mce [1/3,5/4]) 0) 0.1 * n * 0.2+ x = mouseX kr 0.05 1.05 Linear 0.1+ y = mouseY kr 0.05 0.95 Linear 0.1+ a = mce [-1,0,0,1,y,0,1,x,1,-1,0,1]+ b = clearBuf (localBufId 'β' 1 88200)+in X.rDelayMap b s 1 a++---- ; Network of delay line maps++{- Create a network of delay line maps. A map is defined by a+quadruple: source location, destination location, operation and+gain. The locations are specified in seconds, a negative location+specifies theId 'input' location for sources and theId 'output'+location for destinations. The operation is specified as an+integer, zero is move, one is add, two is subtract, three is+multiply, four is divide. The gain is linear. This UGen is+useful for implementing nested filters, as described by William+Gardner in his MS thesis "The Virtual Acoustic Room", MIT 1992. -}
+ Help/Ugen/rDelaySet.help.hs view
@@ -0,0 +1,6 @@+-- rDelaySet; three one second delays+let x = mouseX kr 110 660 Linear 0.2+ y = mouseY kr 0 0.1 Linear 0.2+ s = sinOsc ar x 0 * y+ d = X.rDelaySet s (mce [1,1,1/5,2,1/2,1/10,3,1/3,1/15])+in mce2 s d
+ Help/Ugen/rDelaySetBuf.help.hs view
@@ -0,0 +1,7 @@+-- rDelaySetB ; three one second delays+let x = mouseX kr 110 660 Linear 0.2+ y = mouseY kr 0 1 Linear 0.2+ s = sinOsc ar x 0 * y+ b = clearBuf (localBufId 'α' 1 (5 * 44100))+ d = X.rDelaySetBuf ar b s (mce [1,1,1/5,2,1/2,1/10,3,1/3,1/15])+in mce2 s d * 0.1
+ Help/Ugen/rLagC.help.hs view
@@ -0,0 +1,21 @@+-- ; rLagC+let x = mouseX kr 220 440 Linear 0.2+in sinOsc ar (mce2 x (X.rLagC x 1 0 5 0)) 0 * 0.1++-- ; rLagC+let p = range 220 440 (lfPulse kr 0.1 0 0.5)+ x = mouseX kr (-8) 8 Linear 0.2+ y = mouseY kr (-8) 8 Linear 0.2+in sinOsc ar (mce2 p (X.rLagC p 0.75 x 1.5 y)) 0 * 0.1++---- ; ar is not working+let o = lfPulse ar 50 0 0.25+in mce2 o (rLagC o (1/500) 0 (1/500) 0) * 0.2++let o = lfPulse ar 50 0 0.25+ x = mouseX kr 0.0 (1/100) Linear 0.2+ y = mouseY kr 0.0 (3/100) Linear 0.2+in mce2 o (rLagC o x 0 y 0) * 0.2++let o = sinOsc ar 50 0+in mce2 o (rLagC o 0.01 0 0.01 0) * 0.2
+ Help/Ugen/rLoopSet.help.hs view
@@ -0,0 +1,23 @@+{----++Concurrent loops at a signal buffer++Create a set of concurrent loops at a signal buffer. This is the+static and composed variant of RFreezer. There are five global+inputs, the buffer and then: left, right, gain and increment. The+first two are initialization rate, the second two control rate.+Each loop is defined by a quadruple: left, right, gain and+increment. The left and right values are in the range [0,1) and+refer to the segment of the buffer established by the group left+and right values, which are in the range [0,1) in relation to the+signal buffer.++Buffer Left Buffer Right+| |+| Group Left Group Right |+| | | |+|------|----|-----------------------|----|--------------|+ | |+ Loop Left Loop Right++-}
+ Help/Ugen/rShufflerL.help.hs view
@@ -0,0 +1,28 @@+-- RShufflerL+X.rShufflerL (sinOsc ar 1200 0 * 0.1) 0.02 0.04++-- RShufflerL ; mouse control+let x = mouseX kr 0.0001 0.02 Linear 0.2+ y = mouseY kr 0.001 0.25 Linear 0.2+ o = sinOsc ar (mce2 440 441) 0 * 0.2+in X.rShufflerL o x y++-- RShufflerL ; arrayed+let n = 6+ x = mouseX kr 0.0001 0.02 Linear 0.2+ y = mouseY kr 0.001 0.25 Linear 0.2+ f = x * X.randNId n 'α' 0 4+ d = y * X.randNId n 'β' 0 4+ o = sinOsc ar (mce2 440 441) 0 * 0.1+in splay (X.rShufflerL o f d) 1 1 0 True++---- ; drawings+Sound.Sc3.Plot.plot_ugen_nrt (48000,64) 0.1 (X.rShufflerL (sinOsc ar 1200 0) 0.02 0.04)++{---- Linear input shuffler++A hamming window of durationId 'fragmentSize' is applied to the input signal.+The inter-offset time is a linear random value between 0 andId 'maxDelay'.+c.f. grainIn, monoGrain++-}
+ Help/Ugen/rSmplrIndex.help.hs view
@@ -0,0 +1,57 @@+-- rSmplrIndex ; event control ; stereo ; requires=b0 ; loaded bosendorfer (or equivalent) sample data+let f (_,g,x,y,z,_,_,_,_,_,_) =+ let s_mnn = [21,23,24,26,28,29,31,33,35,36,38,40,41,43,45,47,48,50,52,53,55,57,59+ ,60,62,64,65,67,69,71,72,74,76,77,79,81,83,84,86,88,89,91,93,95,96,98+ ,100,101,103,105,107,108]+ tbl = asLocalBufId 'α' s_mnn+ mnn = x * 88 + 21+ mnn0 = latch mnn g+ rt = midiRatio ((mnn - mnn0) * y)+ (buf,rt0) = unmce2 (X.rSmplrIndex kr tbl (bufFrames kr tbl) mnn0)+ b0 = control kr "b0" 100+ sig = playBuf 2 ar (b0 + buf) (bufRateScale kr (b0 + buf) * rt0 * rt) g 0 NoLoop DoNothing+ in sig * z * lagUD g 0 4+in mix (voicer 16 f) * control kr "gain" 1++-- rSmplrIndex ; event control ; stereo ; requires=tbl,b0 ; data table and loaded sample data+let f (_,g,x,y,z,_,_,_,_,_,_) =+ let tbl = control kr "tbl" 0+ lhs = bufRd 1 kr tbl 0 NoLoop NoInterpolation+ rhs = bufRd 1 kr tbl (bufFrames kr tbl - 1) NoLoop NoInterpolation+ mnn = x * (rhs - lhs) + lhs+ mnn0 = latch mnn g+ rt = midiRatio ((mnn - mnn0) * y)+ (buf,rt0) = unmce2 (X.rSmplrIndex kr tbl (bufFrames kr tbl) mnn0)+ b0 = control kr "b0" 100+ sig = playBuf 2 ar (b0 + buf) (bufRateScale kr (b0 + buf) * rt0 * rt) g 0 NoLoop DoNothing+ in sig * z * lagUD g 0 4+in mix (voicer 16 f) * control kr "gain" 1++-- rSmplrIndex ; event control ; mono ; requires=tbl,b0 data table and loaded sample data+let f (_,g,x,y,z,o,_,_,_,_,_) =+ let tbl = control kr "tbl" 0+ lhs = bufRd 1 kr tbl 0 NoLoop NoInterpolation+ rhs = bufRd 1 kr tbl (bufFrames kr tbl - 1) NoLoop NoInterpolation+ mnn = x * (rhs - lhs) + lhs+ mnn0 = latch mnn g+ rt = midiRatio ((mnn - mnn0) * y)+ (buf,rt0) = unmce2 (X.rSmplrIndex kr tbl (bufFrames kr tbl) mnn0)+ b0 = control kr "b0" 100+ sig = playBuf 1 ar (b0 + buf) (bufRateScale kr (b0 + buf) * rt0 * rt) g 0 NoLoop DoNothing+ in pan2 sig (o * 2 - 1) (z * lagUD g 0.01 0.01)+in mix (voicer 16 f) * control kr "gain" 8++---- ; load bosdendorfer sample data+hsc3-smplr load pf --dyn=008 --b0=100++---- ; load SFZ sample data+import Sound.Osc {- hosc -}+import Sound.Sc3.Data.Sfz {- hsc3-data -}+sfz_fn = sfResolve "instr/bosendorfer/008.sfz"+sfz_fn = sfResolve "instr/farfisa/aad/dolce-8.sfz"+sfz_fn = sfResolve "instr/casacota/zell_1737_415_MeanTone5/8_i.sfz"+(ctl,glb,rgn) <- sfz_load_data sfz_fn+tbl = map ((\(k,_,_) -> k) . sfz_region_key) rgn+withSc3 (sendMessage (b_alloc_setn1 0 0 (map fromIntegral tbl)))+alloc_msg = zipWith (\b fn -> b_allocRead b fn 0 0) [100..] (map (sfz_region_sample_resolve sfz_fn ctl) rgn)+withSc3 (mapM_ async alloc_msg)
+ Help/Ugen/rTracePlay.help.hs view
@@ -0,0 +1,17 @@+-- rTracePlay ; traverse a diamond in equal time increments+let t = [0,-1,1/4,0, 1/4,0,1/2,0, 1/2,1,1/4,0, 3/4,0,0,0, 1,-1,1/4,0]+ b = asLocalBufId 'α' t+ o = sinOsc ar 440 0 * 0.1+ l = X.rTracePlay kr b 4 (mouseX kr 1 20 Linear 0.1) 1+in pan2 o l 1++-- rTracePlay ; X of trace is (-1 0 1 0 -1) ; Y is (1/4 1/2 1/4 0 1/4)+let t = [0,-1,1/4,0, 1/4,0,1/2,0, 1/2,1,1/4,0, 3/4,0,0,0, 1,-1,1/4,0]+ b = asLocalBufId 'α' t+ o = sinOsc ar 440 0 * 0.1+ tr f n = X.rTracePlay kr b 4 (f kr 1 20 Linear 0.1) n+ l = tr mouseX 1+ g = tr mouseY 2+in pan2 o l g++---- Play a buffer that is arranged as a trace. A trace is a sequence of tuples (T,X,Y,Z).
+ Help/Ugen/rTraceRd.help.hs view
@@ -0,0 +1,45 @@+-- rTraceRd ; printing only+let b = asLocalBufId 'α' [0,-1,1/4, 1/4,0,1/2, 1/2,1,1/4, 3/4,0,0, 1,-1,1/4]+ ph = mouseX kr 0 1 Linear 0.05+ tr = X.rTraceRd kr b 3 ph 1+ labels = mce . map label+ pr = poll (impulse kr 5 0) (mce2 ph tr) 0 (labels ["ph","tr"])+in mrg2 (out 0 (dc ar 0)) pr++-- rTraceRd ; listening ; X is (-1 0 1 0 -1)+let b = asLocalBufId 'α' [0,-1,1/4, 1/4,0,1/2, 1/2,1,1/4, 3/4,0,0, 1,-1,1/4]+ o = sinOsc ar 440 0 * 0.1+ x = X.rTraceRd kr b 3 (lfSaw kr 1 0 * 0.5 + 0.5) 1+in pan2 o x 1++-- rTraceRd+let b = asLocalBufId 'α' [0,-1,1/4, 1/4,0,1/2, 1/2,1,1/4, 3/4,0,0, 1,-1,1/4]+ x = X.rTraceRd kr b 3 (lfSaw kr 1 0 * 0.5 + 0.5) 1+ o = sinOsc ar (linLin x (-1) 1 440 880) 0 * 0.1+in pan2 o 0 1++-- rTraceRd ; Y is (1/4 1/2 1/4 0 1/4)+let b = asLocalBufId 'α' [0,-1,1/4, 1/4,0,1/2, 1/2,1,1/4, 3/4,0,0, 1,-1,1/4]+ o = sinOsc ar 440 0 * 0.1+ tr n = X.rTraceRd kr b 3 (lfSaw kr 1 0 * 0.5 + 0.5) n+ l = tr 1+ g = tr 2+in pan2 o l g++---- ; loading data from a CSV trace file+import qualified Sound.Sc3.Data.Trace as T {- hsc3-data -}+let fn = "/home/rohan/sw/hsc3-data/data/csv/trace/b.csv"+tr <- T.trace_load_csv2 fn+length tr == 3017+let tr' = T.trace_normalise_t tr+let d = concatMap (\(t,(x,y)) -> [t,x,y]) tr'+length d == length tr * 3+withSc3 (async (b_alloc_setn1 0 0 d) >> return ())++{----++UGens to read a buffer that is arranged as a trace. A trace is a+sequence of tuples (T,X...) where the number of data points (including+T) is given by theId 'degree' input at the UGen.++-}
+ Help/Ugen/radiansPerSample.help.hs view
@@ -0,0 +1,3 @@+-- radiansPerSample ; two pi divided by the nominal sample rate (ie. a very small number)+let f = mce2 radiansPerSample ((2 * pi) / sampleRate) * 5000000+in sinOsc ar f 0 * 0.1
+ Help/Ugen/ramp.help.hs view
@@ -0,0 +1,20 @@+-- ramp ; lag pitch+let o = lfPulse kr 4 0 0.5 * 50 + 400+ l = line kr 0 1 15 DoNothing+ f = ramp o l+in sinOsc ar f 0 * 0.3++-- ramp ; mouse control+let x1 = mouseX kr 220 440 Exponential 0+ x2 = ramp x1 (300 / 1000)+in sinOsc ar (mce2 x1 x2) 0 * 0.1++-- ramp ; control inputs+let db = control kr "db" (-60)+ dur = control kr "dur" 0.1+in sinOsc ar 110 0 * ramp (dbAmp db) dur++---- ; initiate ramps+withSc3 (Sound.OSC.sendMessage (n_set 1 [("db",-6),("dur",1)]))+withSc3 (Sound.OSC.sendMessage (n_set 1 [("db",-90),("dur",1)]))+
+ Help/Ugen/rand.help.hs view
@@ -0,0 +1,9 @@+-- rand+let f = randId 'α' 200 1200+ l = randId 'β' (-1) 1+ e = line kr 0.2 0 0.1 RemoveSynth+ o = fSinOsc ar f 0+in pan2 (o * e) l 1++-- rand+sinOsc ar (lfNoise1Id 'α' kr (6 + mce2 (randId 'β' (-4) 4) (randId 'γ' (-4) 4)) * 100 + 200) 0 * 0.1
+ Help/Ugen/rand2.help.hs view
@@ -0,0 +1,2 @@+-- rand2 ; composite ugen+sinOsc ar (220 + rand2 110) 0 * 0.1
+ Help/Ugen/randN.help.hs view
@@ -0,0 +1,16 @@+-- randN ; two channel sin tones+sinOsc ar (X.randN 2 440 442) 0 * 0.1++-- randN ; two channel sin tones ; id+sinOsc ar (X.randNId 2 'α' 440 442) 0 * 0.1++-- randN ; n node klang synthesis ; id+let n = 240+ f = X.randNId n 'α' 40 18000+ a = X.randNId n 'β' 0.1 0.3+ p = X.randNId n 'γ' (-1) 1+ s = klangSpec_mce f a p+in klang ar 1 0 s * 0.05++-- randN ; mce...+let f = X.randNId 2 'α' (mce2 440 441) 442 in sinOsc ar f 0 * 0.1
+ Help/Ugen/randSeed.help.hs view
@@ -0,0 +1,20 @@+-- randSeed ; start a sound that includes noise ugens+let n = mceFillId 'α' 2 (\z _ -> whiteNoiseId z ar * 0.05 + dust2Id z ar 70)+ f = lfNoise1Id 'β' kr 3 * 5500 + 6000+in resonz (n * 5) f 0.5 + n * 0.5++---- ; CRASH+----- WidthFirstUGen : LocalBuf SetBuf ClearBuf IFFT PV_ChainUGen RandSeed RandID++-- randSeed ; reset the seed at a variable rate (CRASH)+let s = control kr "seed" 1956+ i = impulse kr (mouseX kr 0.1 100 Linear 0.2) 0+in wrapOut Nothing $ randSeed kr i s++-- randSeed ; always the same (for a given seed)... (CRASH)+let sd = 1957+ n = tiRandId 'α' 4 12 (dustId 'β' kr 1)+ f = n * 150 + (mce [0,1])+ r = randSeed ir 1 sd+in mrg2 (sinOsc ar f 0 * 0.1) r+
+ Help/Ugen/rcd.help.hs view
@@ -0,0 +1,11 @@+-- rcd ; rotating clock divider+let freqs = mce (map (\i -> midiCps (i * 5 + 50)) [0 .. 8])+ amps = mce [1, 0.5, 0.3, 0.3, 0.3, 0.2, 0.2, 0.2]+ tr = lfPulse ar 7 0 0.01+ rot = -2+ spread = tiRandId 'α' 0 1 (impulse kr 0.13 0)+ dv = tiRandId 'β' 0 3 (impulse kr 0.1 0)+ pulses = X.rcd tr rot 0 dv spread 0 0 0 1+ oscs = sinOsc ar freqs 0 * pulses * amps+ sig = splay (mceRotate 3 oscs) 1 0.25 0 True+in sig + combN sig 2 (mce [2, 1]) 3 * 0.3
+ Help/Ugen/rdl.help.hs view
@@ -0,0 +1,30 @@+-- rdl+X.rdl ar 2 (mce2 0 0)++---- ; notes++rdl is a host for [hdf](?t=hdf) generated DSP codes.++rdl codes can read buffers and control signals. Required resources+must be correctly pre-allocated.++rdl nodes are instantiated with a fixed number of channels, it is an+error to load incompatible codes.++Codes are loaded using u_cmd, which requires the ugenIndex of the+rdl node.++> import Sound.Sc3.UGen.Graph {- hsc3 -}+> ug_ugen_indices "RDL" (ugen_to_graph (X.rdl 2 (mce2 0 0))) == [0]++When created, the node has no code loaded.++hdf includes a u_cmd_g_load function. Codes can be replaced while+the rdl node is running. The graphs below are given as examples at+hdf.++> withSc3 (sendMessage (DF.u_cmd_g_load (-1) 0 "/tmp/analog-bubbles.so"))+> withSc3 (sendMessage (DF.u_cmd_g_load (-1) 0 "/tmp/silence.so"))+> withSc3 (sendMessage (DF.u_cmd_g_load (-1) 0 "/tmp/moto-rev.so"))+> withSc3 (sendMessage (DF.u_cmd_g_load (-1) 0 "/tmp/sprinkler.so"))+> withSc3 (sendMessage (DF.u_cmd_g_load (-1) 0 "/tmp/lfo-modulation.so"))
+ Help/Ugen/rdx7Env.help.hs view
@@ -0,0 +1,13 @@+-- rdx7Env+let gate_ = control kr "gate" 0+ data_ = control kr "data" 0+ [r1,r2,r3,r4] = map (\k -> control kr ('r':show k) 99) [1 .. 4]+ [l1,l2,l3,l4] = map (\(k,v) -> control kr ('l':show k) v) (zip [1 .. 4] [99,99,99,00])+ ol = control kr "ol" 99+in sinOsc ar 440 0 * X.rdx7Env ar gate_ data_ r1 r2 r3 r4 l1 l2 l3 l4 ol++---- ; env set+withSc3 (Sound.OSC.sendMessage (n_set (-1) [("r1",35.0),("r2",65),("r3",55),("r4",25)]))+withSc3 (Sound.OSC.sendMessage (n_set (-1) [("l1",99.0),("l2",65),("l3",75),("l4",0)]))+withSc3 (Sound.OSC.sendMessage (n_set1 (-1) "gate" 1.0))+withSc3 (Sound.OSC.sendMessage (n_set1 (-1) "gate" 0.0))
+ Help/Ugen/recordBuf.help.hs view
@@ -0,0 +1,21 @@+-- recordBuf ; requires=buf ; record for four seconds (until end of buffer)+let b = control kr "buf" 0+ o = formant ar (xLine kr 400 1000 4 DoNothing) 2000 800 * 0.125+in mrg2 o (recordBuf ar b 0 1 0 1 NoLoop 1 RemoveSynth o)++-- recordBuf ; requires=buf ; play recorded buffer back (ie. test)+let (b, nc) = (control kr "buf" 0, 1)+in playBuf nc ar b 1 1 0 NoLoop RemoveSynth++-- recordBuf ; mix second signal equally with existing signal, replay to hear+let b = control kr "buf" 0+ o = formant ar (xLine kr 200 1000 4 DoNothing) 2000 800 * 0.125+in mrg2 o (recordBuf ar b 0 0.5 0.5 1 NoLoop 1 RemoveSynth o)++-- recordBuf ; mce+let b = control kr "buf" 0+ o = sinOsc ar (mce2 110 220) 0 * 0.1+in mrg2 o (recordBuf ar (mce2 b b) 0 0.5 0.5 1 NoLoop 1 RemoveSynth (mce1 o))++---- ; setup+withSc3 (async (b_alloc 0 (48000 * 4) 1))
+ Help/Ugen/redPhasor.help.hs view
@@ -0,0 +1,17 @@+-- redPhasor ; no looping & it will play through once ; mouse x acts as trigger+let tr = mouseX kr 0 1 Linear 0.2 `greater_than` 0.5+in sinOsc ar (X.redPhasor kr tr 0.3 400 800 0 500 600) 0 * 0.2++-- redPhasor ; start value greater than end value, positive rate, c.f. redPhasor2+let tr = mouseX kr 0 1 Linear 0.2 `greater_than` 0.5+in sinOsc ar (X.redPhasor kr tr 0.3 800 400 0 500 600) 0 * 0.2++-- redPhasor ; mouse y controls looping on/off, mouse x trigger+let tr = mouseX kr 0 1 Linear 0.2 `greater_than` 0.5+ lp = mouseY kr 0 1 Linear 0.2 `greater_than` 0.5+in sinOsc ar (X.redPhasor kr tr 0.3 400 800 lp 500 600) 0 * 0.2++-- redPhasor ; mouse x controls loop rate, mouse y scales the start loop-point+let x = mouseX kr 0 5 Linear 0.2+ y = mouseY kr 200 500 Linear 0.2+in sinOsc ar (X.redPhasor kr 0 x 400 800 1 y 600) 0 * 0.2
+ Help/Ugen/redPhasor2.help.hs view
@@ -0,0 +1,7 @@+-- redPhasor2 ; no looping & it will play through once ; mouse x acts as trigger+let tr = mouseX kr 0 1 Linear 0.2 `greater_than` 0.5+in sinOsc ar (X.redPhasor2 kr tr 0.3 400 800 0 500 600) 0 * 0.2++-- redPhasor2 ; start value greater than end value, negative rate, c.f. redPhasor+let tr = mouseX kr 0 1 Linear 0.2 `greater_than` 0.5+in sinOsc ar (X.redPhasor2 kr tr (-0.3) 800 400 0 500 600) 0 * 0.2
+ Help/Ugen/replaceOut.help.hs view
@@ -0,0 +1,15 @@+-- replaceOut+replaceOut 0 (sinOsc ar 440 0 * 0.1)++-- replaceOut ; send signal to a bus, overwrite existing signal+-- ; mrg nodes are ordered right to left, so below b replaces c and then a is summed+let a = sinOsc ar (mce [120, 121]) 0 * 0.1+ b = sinOsc ar (mce [330, 331]) 0 * 0.1+ c = sinOsc ar (mce [880, 881]) 0 * 0.1+in mrg [out 0 a, replaceOut 0 b, out 0 c]++-- replaceOut ; a writes noise to bus 24, b reads 24 and replaces with filtered variant, c reads 24 and writes to 0+let a = pinkNoiseId 'α' ar * 0.1+ b = bpf (in' 1 ar 24) 440 1+ c = in' 1 ar 24+in mrg [out 0 c, replaceOut 24 b, out 24 a]
+ Help/Ugen/resonator.help.hs view
@@ -0,0 +1,28 @@+-- resonator+let pan = 0+ trig = impulse kr 1 0+ snare = X.analogSnareDrum ar trig 0 0.1 200 0.5 (tRandId 'α' 0.1 0.5 trig) 0.5+ freq = tExpRandId 'β' 25 250 trig+ position = 0+ resolution = 24+ structure = sinOsc kr 0.01 0 `in_range` (0,1)+ brightness = sinOsc kr 0.01 (0.5 * pi) `in_range` (0,0.5)+ damping = tRandId 'γ' 0.2 0.8 trig+ sig = X.resonator snare freq position resolution structure brightness damping+in pan2 (tanh sig) pan 0.1++-- resonator ; event control+let f (_,g,x,y,z,o,rx,ry,_,_,_) =+ let tr = trig g controlDur+ freq = midiCps (x * 25 + 36)+ snare = X.analogSnareDrum ar tr 0 z 200 0.5 (tRandId 'α' 0.1 0.5 tr) 0.5+ sig = X.resonator snare freq 0 24 y rx (0.2 + ry)+ in pan2 (tanh sig) (o * 2 - 1) (lagUD g 0 6)+in mix (voicer 16 f) * control kr "gain" 0.1++-- resonator ; event control+let f (_,g,x,y,z,o,rx,ry,_,_,_) =+ let freq = midiCps (x * 25 + 36)+ sig = X.resonator (pinkNoiseId 'α' ar * z) freq 0 24 y rx (0.2 + ry)+ in pan2 (tanh sig) (o * 2 - 1) (lagUD g 0 2)+in mix (voicer 16 f) * control kr "gain" 0.1
+ Help/Ugen/resonz.help.hs view
@@ -0,0 +1,60 @@+-- resonz+resonz (whiteNoise ar * 0.5) 2000 0.1++-- resonz ; modulate frequency+let f = xLine kr 1000 8000 10 RemoveSynth+in resonz (whiteNoise ar * 0.5) f 0.05++-- resonz ; modulate bandwidth+let bw = xLine kr 1 0.001 8 RemoveSynth+in resonz (whiteNoise ar * 0.5) 2000 bw++-- resonz ; modulate bandwidth opposite direction+let bw = xLine kr 0.001 1 8 RemoveSynth+in resonz (whiteNoise ar * 0.5) 2000 bw++-- resonz ; mouse control (1/Q = bandwidth / center-frequency)+let m = mouseX kr 36 85 Linear 0.2 {- midi note -}+ w = mouseY kr 0.1 5 Linear 0.2 {- bandwidth -}+ f = midiCps (floorE m) {- centre frequency -}+ rq = w / f {- 1/Q (reciprocal of Q) -}+in resonz (pinkNoise ar) f rq++-- resonz ; pinkNoise ; event control+let f (_,g,_,y,z,o,_,_,p,_,_) =+ pan2 (resonz (pinkNoise ar) (unitCps p) (y * 0.25) * 24) (o * 2 - 1) (z * g)+in mix (voicer 16 f) * control kr "gain" 1++-- resonz ; pinkNoise ; event control+let f (_,g,_,y,z,o,rx,_,p,_,_) =+ let (gt,_) = ccEventGateReset g p+ e = envGen kr gt 1 0 1 DoNothing (envPerc 0.01 (1 + rx))+ f = unitCps p {- centre frequency -}+ rq = linLin y 0 1 0.05 0.25 / f {- 1/Q (reciprocal of Q) -}+ scl = 900+ in pan2 (resonz (pinkNoise ar) f rq * scl * z) (o * 2 - 1) e+in mix (voicer 16 f) * control kr "gain" 1++{---- ; Q+The Q factor of a resonator is defined as the center-frequency (cf) divided by the bandwidth (bw).++> let q cf bw = cf / bw++The higher the Q the narrower the filter.++> let bw_set = [1,4,10,100,200,400]+> map (q 400) bw_set == [400,100,40,4,2,1]++Q multipled by the band-width gives the center-frequency.++> map (\bw -> q 400 bw * bw) bw_set == replicate (length bw_set) 400++The third argument to resonz is the reciprocal of Q (rq).++> let rq cf = recip . q cf+> map (rq 400) [1,4,10,100,200,400] == [1/400,1/100,1/40,1/4,1/2,1]++1/Q multiplied by the center-frequency gives the bandwidth.++> map (\bw -> rq 400 bw * 400) bw_set == bw_set+-}
+ Help/Ugen/rhpf.help.hs view
@@ -0,0 +1,7 @@+-- rhpf+let f = fSinOsc kr (xLine kr 0.7 300 20 RemoveSynth) 0 * 3600 + 4000+in rhpf (saw ar 200 * 0.1) f 0.2++-- rhpf+let c = rhpf (lfSaw kr 2 0) (sinOsc kr (xLine kr 0.7 30 20 RemoveSynth) 0 * 35 + 40) 0.05+in sinOsc ar (c * 200 + 500) 0 * 0.25
+ Help/Ugen/ring1.help.hs view
@@ -0,0 +1,9 @@+-- ring1+let a = fSinOsc ar 800 0+ b = fSinOsc ar (xLine kr 200 500 5 DoNothing) 0+in ring1 a b * 0.125++-- ring1 ; written out+let a = fSinOsc ar 800 0+ b = fSinOsc ar (xLine kr 200 500 5 DoNothing) 0+in ((a * b) + a) * 0.125
+ Help/Ugen/ring2.help.hs view
@@ -0,0 +1,9 @@+-- ring2+let a = fSinOsc ar 800 0+ b = fSinOsc ar (xLine kr 200 500 5 DoNothing) 0+in ring2 a b * 0.125++-- ring2 ; written out+let a = fSinOsc ar 800 0+ b = fSinOsc ar (xLine kr 200 500 5 DoNothing) 0+in ((a * b) + a + b) * 0.125
+ Help/Ugen/ring3.help.hs view
@@ -0,0 +1,9 @@+-- ring3+let a = fSinOsc ar 800 0+ b = fSinOsc ar (xLine kr 200 500 5 DoNothing) 0+in ring3 a b * 0.125++-- ring3 ; written out+let a = fSinOsc ar 800 0+ b = fSinOsc ar (xLine kr 200 500 5 DoNothing) 0+in (a * a * b) * 0.125
+ Help/Ugen/ring4.help.hs view
@@ -0,0 +1,9 @@+-- ring4+let a = fSinOsc ar 800 0+ b = fSinOsc ar (xLine kr 200 500 5 DoNothing) 0+in ring4 a b * 0.125++-- ring4 ; written out+let a = fSinOsc ar 800 0+ b = fSinOsc ar (xLine kr 200 500 5 DoNothing) 0+in (((a * a * b) - (a * b * b))) * 0.125
+ Help/Ugen/ringz.help.hs view
@@ -0,0 +1,22 @@+-- ringz+ringz (dustId 'α' ar 3 * 0.3) 2000 2++-- ringz+ringz (whiteNoiseId 'α' ar * 0.005) 2000 0.5++-- ringz ; modulate frequency+let n = whiteNoiseId 'α' ar+ f = xLine kr 100 3000 10 RemoveSynth+in ringz (n * 0.005) f 0.5 * 0.2++-- ringz+let f = xLine kr 100 3000 10 RemoveSynth+in ringz (impulse ar 6 0.3) f 0.5 * 0.1++-- ringz ; modulate ring time+let rt = xLine kr 4 0.04 8 RemoveSynth+in ringz (impulse ar 6 0.3) 2000 rt * 0.1++-- ringz ; modulate ring time opposite direction+let rt = xLine kr 0.04 4 8 RemoveSynth+in ringz (impulse ar 6 0.3) 2000 rt * 0.1
+ Help/Ugen/rlpf.help.hs view
@@ -0,0 +1,32 @@+-- rlpf+let n = whiteNoiseId 'α' ar+ f = sinOsc ar 0.5 0 * 40 + 220+in rlpf n f 0.1++-- rlpf+let f = fSinOsc kr (xLine kr 0.7 300 20 RemoveSynth) 0 * 3600 + 4000+in rlpf (saw ar 200 * 0.1) f 0.2++-- rlpf+let ctl = rlpf (saw ar 5 * 0.1) 25 0.03+in sinOsc ar (ctl * 200 + 400) 0 * 0.1++-- rlpf ; mouse-control+let x = mouseX kr 2 200 Exponential 0.2+ y = mouseY kr 0.01 1 Exponential 0.2+ ctl = rlpf (saw ar 5 * 0.1) x y+in sinOsc ar (ctl * 200 + 400) 0 * 0.1++-- rlpf ; c.f. rlpfd+let s = mix (lfSaw ar (mce2 120 180) 0 * 0.33)+ f = linExp (lfCub kr 0.1 (0.5 * pi)) (-1) 1 280 1500+ rq = mouseX kr 0.05 0.5 Linear 0.2+in rlpf s f rq * 0.1++-- rlpf ; event control+let f (_,g,_,y,z,o,rx,ry,p,_,_) =+ let f0 = unitCps p+ f1 = f0 * 0.5 * (1 + y * 6)+ rq = linLin (rx * ry) 0 0.25 0.1 0.6+ in pan2 (rlpf (lfTri ar f0 0) f1 rq) (o * 2 - 1) (lagUD g 0.05 (2 - y) * (2 - y) * z)+in mix (voicer 16 f) * control kr "gain" 0.25
+ Help/Ugen/rlpfd.help.hs view
@@ -0,0 +1,4 @@+-- rlpfd+let s = mix (lfSaw ar (mce2 120 180) 0 * 0.33)+ f = linExp (lfCub kr 0.1 (0.5 * pi)) (-1) 1 280 1500+in X.rlpfd s f 0.6 0.5
+ Help/Ugen/rmShelf.help.hs view
@@ -0,0 +1,12 @@+-- rmShelf2 ; default parameters ; rm=regalia-mitra freq=cut-off frequency (hz) k=gain (db)+X.rmShelf2 ar (whiteNoiseId 'α' ar * 0.1) 440 0++-- rmShelf2 ; freq=mouse-x+let freq = mouseX kr 55 3520 Exponential 0.2+in X.rmShelf2 ar (whiteNoiseId 'α' ar * 0.1) freq 0++-- rmShelf2 ; k=mouse-y+let freq = mouseX kr 55 3520 Exponential 0.2+ k = mouseY kr (-12) 12 Linear 0.2+in X.rmShelf2 ar (whiteNoiseId 'α' ar * 0.1) freq k * 0.1+
+ Help/Ugen/rmeq.help.hs view
@@ -0,0 +1,8 @@+-- rmeq ; default param ; rm=regalia-mitra freq=cut-off frequency (hz) rq=reciprocal-of-Q k=gain (db)+X.rmeq (pinkNoiseId 'α' ar * 0.1) 440 1 0++-- rmeq ; rapid param changes fail at low frequencies+let freq = mouseX kr 55 3520 Exponential 0.2+ rq = mouseY kr 0.01 2.0 Linear 0.2+ k = 3+in X.rmeq (pinkNoiseId 'α' ar * 0.1) freq rq k
+ Help/Ugen/rongs.help.hs view
@@ -0,0 +1,32 @@+-- rongs+let tr_freq = sinOsc kr 0.1 (pi/2) `in_exprange` (10.1,1.0)+ tr = dust2Id 'α' kr tr_freq+ sig = let f0 = mce2 1.0 1.01 * tExpRandId 'β' 0.001 0.100 tr * sampleRate / 2+ structure = tRandId 'γ' 0.25 0.75 tr+ brightness = tRandId 'δ' 0.25 0.75 tr+ damping = tRandId 'ζ' 0.15 0.65 tr+ accent = 0.9+ stretch = tRandId 'ε' 0.1 0.99 tr+ position = 0.15+ loss = tRandId 'η' 0.1 0.5 tr+ modeNum = 2+ cosFreq = 0.25+ in X.rongs ar tr tr f0 structure brightness damping accent stretch position loss modeNum cosFreq+in splay (leakDC sig 0.995) 0.25 1 (tRandId 'θ' (-1) 1 tr) True++-- rongs ; event control+let f (_,g,x,y,z,o,rx,ry,_,_,_) =+ let tr = trig1 g controlDur+ f0 = midiCps (x * 88 + 20)+ structure = 0.5 + ry * tRandId 'α' (-1) 1 tr+ brightness = 0.5 + rx * tRandId 'β' (-1) 1 tr+ damping = y * 0.25+ accent = 0.99+ stretch = 0.5 + z * tRandId 'γ' (-0.5) 0.5 tr+ position = y * 0.5+ loss = 0.25 + o * tRandId 'δ' (-0.1) 0.1 tr+ modeNum = 2+ cosFreq = 0.25+ sig = X.rongs ar tr tr f0 structure brightness damping accent stretch position loss modeNum cosFreq+ in pan2 (leakDC sig 0.995) (o * 2 - 1) (lagUD z 0 2)+in mix (voicer 6 f) * control kr "gain" 1
+ Help/Ugen/rotate2.help.hs view
@@ -0,0 +1,10 @@+-- rotate2 ; rotation of stereo sound, via LFO+let x = pinkNoiseId 'α' ar+ y = lfTri ar 800 0 * lfPulse kr 3 0 0.3+in rotate2 x y (lfSaw kr 0.1 0) * 0.1++-- rotate2 ; rotation of stereo sound, via mouse ; rotateStereo is MCE form+let x = mix (lfSaw ar (mce [198..201]) 0) * 0.25+ y = sinOsc ar 900 0 * lfPulse kr 3 0 0.3+ p = mouseX kr 0 2 Linear 0.2+in rotateStereo (mce2 x y) p * 0.1
+ Help/Ugen/roundUp.help.hs view
@@ -0,0 +1,8 @@+-- roundUp+let x = mouseX kr 60 4000 Linear 0.1+ f = roundUp x 100+in sinOsc ar f 0 * 0.1++-- roundUp+let n = line kr 24 108 6 RemoveSynth+in saw ar (midiCps (roundUp n 1)) * 0.2
+ Help/Ugen/rpvDecayTbl.help.hs view
@@ -0,0 +1,11 @@+-- RPVDecayTbl ; random decay multipliers+let b0 = clearBuf (localBuf 1 2048)+ b1 = asLocalBuf (mceChannels (X.randN 1024 0.5 0.975))+ b2 = clearBuf (localBuf 1 1024)+in ifft' (X.rpvDecayTbl (fft' b0 (soundIn 0)) b1 b2)++-- RPVDecayTbl ; random decay multipliers ; id+let b0 = clearBuf (localBufId 'α' 1 2048)+ b1 = asLocalBufId 'β' (mceChannels (X.randNId 1024 'γ' 0.5 0.975))+ b2 = clearBuf (localBufId 'δ' 1 1024)+in ifft' (X.rpvDecayTbl (fft' b0 (soundIn 0)) b1 b2)
+ Help/Ugen/runningMax.help.hs view
@@ -0,0 +1,16 @@+-- runningMax+let n = dust ar 20+ t = impulse ar 0.4 0+ f = runningMax n t * 500 + 200+in t + sinOsc ar f 0 * 0.2++-- runningMax ; follow a sine lfo, reset rate controlled by mouse x+let t = impulse kr (mouseX kr 0.01 2 Linear 0.1) 0+ f = runningMax (sinOsc kr 0.2 0) t * 500 + 200+in t + sinOsc ar f 0 * 0.2++-- runningMax ; id+let n = dustId 'α' ar 20+ t = impulse ar 0.4 0+ f = runningMax n t * 500 + 200+in t + sinOsc ar f 0 * 0.2
+ Help/Ugen/runningMin.help.hs view
@@ -0,0 +1,12 @@+-- runningMin ; follow a sine lfo, reset rate controlled by mouseX+let o = sinOsc kr 2 pi+ x = mouseX kr 0.01 10 Exponential 0.1+ t = impulse ar x 0+ f = runningMin o t * 500 + 200+in t + sinOsc ar f 0 * 0.1++-- runningMin+let n = dustId 'α' ar 20+ t = impulse ar 0.4 0+ f = runningMin n t * 500 + 200+in sinOsc ar f 0 * 0.2
+ Help/Ugen/runningSum.help.hs view
@@ -0,0 +1,18 @@+-- runningSum ; distorts of course, would need scaling+runningSum (soundIn 0 * 0.1) 40++-- runningSum ; running average over x samples+let x = 100 in runningSum (lfSaw ar 440 0 * 0.1) x * recip x++-- runningSum ; rms power+let input = lfSaw ar 440 0 * 0.1+ numsamp = 30+in runningSum (input * input) numsamp / (sqrt numsamp)++-- runningSum ; composite UGen+runningSumRMS (soundIn 0) 40 * 0.1++-- runningSum+let z = soundIn 0+ a = runningSum z 40+in sinOsc ar 440 0 * a * 0.1
+ Help/Ugen/sampleDur.help.hs view
@@ -0,0 +1,3 @@+-- sampleDur ; the reciprocal of the nominal sample rate of the server+let f = mce2 sampleRate (recip sampleDur) * 0.01+in sinOsc ar f 0 * 0.1
+ Help/Ugen/sampleRate.help.hs view
@@ -0,0 +1,7 @@+-- sampleRate ; the current nominal sample rate of the server+let sr = 48000 {- 44100 -}+ f = mce2 sampleRate sr * 0.01+in sinOsc ar f 0 * 0.1++---- ; server status ; extract nominal and actual sample rates from the synthesis server+withSc3 (Control.Monad.liftM2 (,) serverSampleRateNominal serverSampleRateActual)
+ Help/Ugen/sanitize.help.hs view
@@ -0,0 +1,3 @@+-- sanitize ; when frequency is nan set to 220+let freq = tChoose (impulse kr 1 0) (mce2 440 (0 / 0))+in sinOsc ar (sanitize freq 220) 0 * 0.1
+ Help/Ugen/saw.help.hs view
@@ -0,0 +1,25 @@+-- saw ; Sc3 saw is descending+saw ar (xLine kr 40 4000 6 RemoveSynth) * 0.1++-- saw ; negation is ascending+negate (saw ar (xLine kr 40 4000 6 RemoveSynth) * 0.1)++-- saw ; compare to the non-bandlimited lfSaw+lfSaw ar (xLine kr 40 4000 6 RemoveSynth) 0 * 0.1++-- saw ; two band limited sawtooth waves thru a resonant low pass filter+let f = xLine kr 8000 400 5 DoNothing+in rlpf (saw ar (mce2 100 250) * 0.1) f 0.05++-- saw ; not useful as a phasor, see lfSaw or phasor+sin (range 0 two_pi (negate (saw ar 440))) * 0.2++-- saw ; ln 2021-04-16 https://lukasnowok.github.io/spectrology/+let tr = impulse ar (xLine ar 1 1000 20 DoNothing) 0+ e = envGen ar tr 1 0 1 DoNothing (envPerc 0 0.1)+in saw ar (tRandId 'a' 50 (xLine ar 50 5000 20 DoNothing) tr) * e * 0.1++---- ; drawings+UI.ui_baudline 4096 50 "linear" 2+Sound.Sc3.Plot.plot_ugen1 0.1 (saw ar 50) -- descending+Sound.Sc3.Plot.plot_ugen1 0.002 (saw ar 5000) -- ragged
+ Help/Ugen/sawDPW.help.hs view
@@ -0,0 +1,5 @@+-- sawDPW+X.sawDPW ar (xLine kr 2000 20 10 DoNothing) 0 * 0.1++-- sawDPW+X.sawDPW ar (mouseX kr 200 12000 Exponential 0.2) 0 * 0.1
+ Help/Ugen/scaleNeg.help.hs view
@@ -0,0 +1,8 @@+-- scaleNeg+scaleNeg (fSinOsc ar 500 0) (line ar 1 (-1) 4 RemoveSynth) * 0.1++-- scaleNeg ; written out+let o = fSinOsc ar 500 0+ l = line ar 1 (-1) 4 RemoveSynth+ c = o `less_than` 0+in (c * (o * l) + (1 - c) * o) * 0.1
+ Help/Ugen/schmidt.help.hs view
@@ -0,0 +1,4 @@+-- schmidt ; threshold octave jumps+let n = lfNoise1Id 'α' kr 3+ o = schmidt n (-0.15) 0.15 + 1+in sinOsc ar (n * 200 + 500 * o) 0 * 0.1
+ Help/Ugen/select.help.hs view
@@ -0,0 +1,44 @@+-- select+let n = 3/2+ a = mce [sinOsc ar 440 0, saw ar 440, pulse ar 440 0.1]+in select (lfSaw kr 1 0 * n + n) a * 0.1++-- select ; as sequencer+let n = 10+ a = mce [517, 403, 89, 562, 816, 107, 241, 145, 90, 224]+ c = n / 2+ f = select (lfSaw kr 0.5 0 * c + c) a+in saw ar f * 0.1++-- select ; i-rate+let a = mce [rand 110 220,rand 220 440,rand 440 880]+in sinOsc ar (select (rand 0 3) a) 0 * 0.1++-- select ; i-rate ; id+let a = mce [randId 'α' 110 220,randId 'β' 220 440,randId 'γ' 440 880]+in sinOsc ar (select (randId 'δ' 0 3) a) 0 * 0.1++-- select ; nested mce+let n = 10+ a = mce [mce [517, 403, 89], mce [562, 816, 107], mce [241, 145, 90, 224]]+ c = n / 2+ f = select (lfSaw kr (mce [0.5, 0.75]) 0 * c + c) a+in saw ar f * 0.1++-- select ; buffer segment player ; requires=buf+let (buf, nc) = (control kr "buf" 100, 2)+ n_segments = control_m kr "nseg" 32 (1, 64, "lin")+ sel = control_m kr "sel" 0 (0,3,"lin")+ buf_size = bufFrames kr buf+ segment_size = bufFrames kr buf / n_segments+ tr = impulse kr (n_segments / bufDur kr buf) 0+ phase = phasor ar tr (bufRateScale kr buf) 0 (segment_size - 1) 0+ ix = mce [dseriesId 'α' dinf 0 1 `modE` n_segments -- play segments in sequence (reconstruct)+ ,n_segments - 1 - (dseriesId 'β' dinf 0 1 `modE` n_segments) -- play segments in reverse sequence+ ,dbrownId 'γ' dinf 0 (n_segments - 1) 1+ ,dwhiteId 'δ' dinf 0 (n_segments - 1)]+ zero = select sel (demand tr 0 (ix * segment_size))+in bufRdN nc ar buf (zero + phase) NoLoop * 0.1++---- ; buffer setup (nc = 2)+withSc3 (async (b_allocRead 0 (sfResolve "amen.wav") 0 0))
+ Help/Ugen/selectX.help.hs view
@@ -0,0 +1,12 @@+-- selectX ; composite ugen graph+let n = 3/2+ f = mce2 440 441+ a = mce [sinOsc ar f 0, saw ar f, pulse ar f 0.1]+in mix (selectX (lfSaw kr 1 0 * n + n) a * 0.1)++-- selectX ; as sequencer+let n = 10+ a = mce [517, 403, 89, 562, 816, 107, 241, 145, 90, 224]+ c = n / 2+ f = selectX (lfSaw kr 0.5 0 * c + c) a+in saw ar f * 0.1
+ Help/Ugen/sendReply.help.hs view
@@ -0,0 +1,8 @@+-- sendReply+let s0 = lfNoise0Id 'α' kr 5+ s1 = lfNoise0Id 'β' kr 5+ o = sinOsc ar (s0 * 200 + 500) 0 * s1 * 0.1+in mrg [o,sendReply s0 0 "/send-reply" [s0,s1]]++---- ; receive reply+withSc3 (withNotifications (Sound.OSC.waitReply "/send-reply"))
+ Help/Ugen/sensoryDissonance.help.hs view
@@ -0,0 +1,6 @@+-- sensoryDissonance ; noteId 'norm' input calculation+let sig = soundIn 0+ chn = fft' (localBufId 'α' 1 2048) sig+ maxpeaks = 100+ dissonance = X.sensoryDissonance kr chn 100 0.1 (0.01 / maxpeaks) 1+in pan2 (blip ar 100 (sqrt dissonance * 200)) 0 0.1
+ Help/Ugen/setResetFF.help.hs view
@@ -0,0 +1,12 @@+-- setResetFF ; d0 is the set trigger, d1 the reset trigger+let d0 = dustId 'β' ar 5+ d1 = dustId 'γ' ar 5+in brownNoiseId 'α' ar * setResetFF d0 d1 * 0.1++-- setResetFF ; silence+let tr = setResetFF (impulse kr 5 0) (impulse kr 10 0)+in brownNoiseId 'α' ar * decay2 tr 0.01 0.05 * 0.1++-- setResetFF ; duty cycle+let tr = 1 - setResetFF (impulse kr 10 0) (impulse kr 5 0)+in brownNoiseId 'α' ar * decay2 tr 0.01 0.05 * 0.1
+ Help/Ugen/shaper.help.hs view
@@ -0,0 +1,55 @@+-- shaper ; hear waveshaper at pure (sin) tone ; generate table at client and use localBuf+let z = sinOsc ar 300 0 * line kr 0 1 12 DoNothing+ c = Gen.cheby 256 [1, 0, 1, 1, 0, 1]+ t = to_wavetable_nowrap c+ b = asLocalBufId 'α' t+in shaper b z * 0.1++-- shaper ; hear waveshaper at pure (sin) tone ; local wavetable+let z = sinOsc ar 300 0 * line kr 0 1 6 DoNothing+ t = Gen.chebyShaperTbl 256 [1, 0, 1, 1, 0, 1]+in shaper (asLocalBuf t) z * 0.1++-- shaper ; minor variation+let z = sinOsc ar 400 (pi / 2) * line kr 0 1 6 DoNothing+in shaper (asLocalBuf (Gen.chebyShaperTbl 256 [1, 0, 1, 1, 0, 1])) z * 0.1++-- shaper ; mouse control+let z = sinOsc ar 400 (pi / 2) * mouseY kr 0.01 1 Exponential 0.2+ t = asLocalBuf (Gen.chebyShaperTbl 256 [1, 0, 1, 1, 0, 1])+in shaper t z * 0.1++-- shaper ; sound in ; mouse control ; warning=feedback+let z = soundIn 0+ x = mouseX kr (-1) 1 Linear 0.2+ t = asLocalBuf (Gen.chebyShaperTbl 256 [1, 0, 1, 1, 0, 1])+in xFade2 z (shaper t z) x 0.5++-- shaper ; hear waveshaper at pure (sin) tone ; requires=tbl see b_gen_cheby at b_gen help file+let z = sinOsc ar 300 0 * line kr 0 1 6 DoNothing+in shaper (control kr "tbl" 10) z * 0.1++-- shaper ; minor variation ; requires=tbl+let z = sinOsc ar 400 (pi / 2) * line kr 0 1 6 DoNothing+in shaper (control kr "tbl" 10) z * 0.1++-- shaper ; wave shape external signal ; requires=tbl+let z = soundIn 0+ x = sinOsc kr (1/4) 0+in xFade2 z (shaper (control kr "tbl" 10) z) x 0.5++-- shaper ; mouse control ; requires=tbl+let z = soundIn 0+ x = mouseX kr (-1) 1 Linear 0.2+in xFade2 z (shaper (control kr "tbl" 10) z) x 0.5++-- shaper ; event control+let f (_,g,_,y,z,o,_,_,p,_,_) =+ let s = sinOsc ar (unitCps p) 0 * y+ b = asLocalBuf (Gen.chebyShaperTbl 256 [1, 0, 1, 1, 0, 1])+ in pan2 (shaper b s) (o * 2 - 1) (z * g)+in mix (voicer 16 f) * control kr "gain" 1.0++---- ; drawings+Sound.Sc3.Plot.plot_p1_ln [Gen.cheby 256 [1, 0, 1, 1, 0, 1]]+Sound.Sc3.Plot.plot_p1_ln [Gen.chebyShaperTbl 256 [1, 0, 1, 1, 0, 1]]
+ Help/Ugen/shufflerB.help.hs view
@@ -0,0 +1,39 @@+-- playBuf ; check buffer+let b = control kr "buf" 100+ s = bufRateScale kr b+in playBuf 1 ar b s 1 0 NoLoop RemoveSynth * 0.1++-- shufflerB ; static+let b = control kr "buf" 100+in X.shufflerB b 0 0.05 0.95 1.05 0.035 0.05 0.1 0.2 0.4 0.6 0.4 0.6 0 1 0.005 0.01 1 0 0++-- shufflerB ; static, quantized+let b = control kr "buf" 100+in X.shufflerB b 0 1 0.5 2 0.025 0.075 0.2 0.6 0.1 0.9 0.1 0.9 0 1 0.005 0.05 0 0.5 0.005++-- shufflerB ; static, pointilist+let b = control kr "buf" 100+in X.shufflerB b 0.4 0.5 0.5 2 0.05 0.15 0.2 0.5 0.3 0.7 0.3 0.7 0 1 0.05 0.25 0 0 0++-- shufflerB ; controls+let b = control_m kr "buf" 100 (0,10,"lin")+ k nm def = control_m kr nm def+ k2 nm (d1,d2) = control_rng kr nm (d1,d2)+ k2_mul m (c1,c2) = (c1 * m,c2 * m)+ shufflerB_grp p1 (p2,p3) (p4,p5) (p6,p7) (p8,p9) (p10,p11) (p12,p13) (p14,p15) (p16,p17) p18 p19 p20 = X.shufflerB p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 p16 p17 p18 p19 p20+in shufflerB_grp b+ (k2 "loc" (0.0,0.5) (0,1,"lin"))+ (k2 "incr" (0.99975,1.00025) (0.25,4,"lin"))+ (k2_mul 0.001 (k2 "dur" (250,300) (0.1,1000,"exp")))+ (k2 "amp" (0.8,0.9) (0.5,1.0,"amp"))+ (k2 "shape" (0.5,0.6) (0,1,"lin"))+ (k2 "skew" (0.4,0.6) (0,1,"lin"))+ (k2 "pan" (0.0,1.0) (0,1,"lin")) -- ie. not (-1,1)+ (k2_mul 0.001 (k2 "iot" (50,52.5) (0.01,500,"exp")))+ (k "locIncr" 1.0 (0.25,4.0,"lin"))+ (k "incrQ" 0.0 (0,1,"lin"))+ (k "iotQ" 0.0 (0,1,"lin"))++---- ; load buffer+ld fn = withSc3 (async (b_allocRead 0 (sfResolve fn) 0 0))+ld "instr/crotales/crotale05(D).wav"
+ Help/Ugen/silent.help.hs view
@@ -0,0 +1,2 @@+-- silent ; c.f. dc+silent 2
+ Help/Ugen/sin.help.hs view
@@ -0,0 +1,3 @@+---- ; Drawings+Sound.Sc3.is_unary Sound.Sc3.Common.Base.CS "Sin"+Sound.Sc3.Plot.plot_fn_r1_ln sin (0,2 * pi)
+ Help/Ugen/sinGrain.help.hs view
@@ -0,0 +1,13 @@+-- sinGrain+X.sinGrain ar (impulse kr 10 0) 0.1 (range 440 880 (whiteNoiseId 'α' kr)) * 0.1++-- sinGrain ; mouse control+let x = mouseX kr 0.001 0.2 Linear 0.1+ y = mouseX kr 90 600 Linear 0.1+in X.sinGrain ar (dustId 'β' kr 25) x y * 0.1++-- sinGrain ; ln 2021-04-13 https://lukasnowok.github.io/spectrology/+X.sinGrain ar (impulse ar (sinOsc ar (1/6) 0 `in_range` (8,4000)) 0) 0.005 10000++---- ; drawings+UI.ui_baudline 4096 50 "linear" 2
+ Help/Ugen/sinOsc.help.hs view
@@ -0,0 +1,154 @@+-- sinOsc ; fixed frequency (hz) and initial-phase (radians)+sinOsc ar (midiCps 69) 0 * 0.1 -- 415 440++-- sinOsc ; control input for frequency ; ie. withSc3 (Sound.OSC.sendMessage (n_set1 (-1) "mnn" 64))+sinOsc ar (midiCps (control kr "mnn" 69)) 0 * 0.25++-- sinOsc ; modulate freq+sinOsc ar (xLine kr 2000 200 1 RemoveSynth) 0 * 0.5++-- sinOsc ; modulate freq+let f1 = xLine kr 1 1000 9 RemoveSynth+ f2 = sinOsc ar f1 0 * 200 + 800 -- (-1,1) ; (-200,200) ; (600,1000)+in sinOsc ar f2 0 * 0.25++-- sinOsc ; modulate phase ; modulator here is in (-2pi,2pi)+let ph = sinOsc ar (xLine kr 20 8000 10 RemoveSynth) 0 * 2 * pi+in sinOsc ar 800 ph * 0.1++-- sinOsc ; phase input only+let ph = sinOsc ar (xLine kr 20 8000 10 RemoveSynth) 0 * pi+in sinOsc ar 0 ph * 0.1++-- sinOsc ; mouse control+let x = mouseX kr 40 10000 Exponential 0.2+ y = mouseY kr 0.01 0.25 Exponential 0.2+in sinOsc ar x 0 * y++-- sinOsc ; simple bell-like tone+let f = mce [0.5,1,1.19,1.56,2,2.51,2.66,3.01,4.1]+ a = mce [0.25,1,0.8,0.5,0.9,0.4,0.3,0.6,0.1]+ o = sinOsc ar (500 * f) 0 * a+ e = envGen kr 1 0.1 0 1 RemoveSynth (envPerc 0.01 10)+in mix o * e++-- sinOsc ; "When two pure tones of slightly different frequency are superposed, our ears+-- perceive audible beats at a rate given by the difference of the two frequencies."+let f0 = 220+ f1 = 221.25+ d = abs (f1 - f0)+ i = impulse ar d 0 * max (sinOsc kr 0.05 0 * 0.1) 0+in sinOsc ar (mce2 f0 f1) 0 * 0.1 + i++-- sinOsc ; "When two tones are sounded together, a tone of lower frequency is+-- frequently heard. Such a tone is called a combination tone. The most+-- commonly heard combination tone occurs at a frequency f2 - f1."+let f1 = 300+ f2 = 300 * 3/2 {- 450 -}+ f3 = abs (f2 - f1) {- 150 -}+ a3 = max (sinOsc kr 0.05 0 * 0.1) 0+in mix (sinOsc ar (mce3 f1 f2 f3) 0 * mce3 0.1 0.1 a3)++-- sinOsc ; with frequency of zero, operates as table lookup variant of sin+let mk_phasor (l,r) f = phasor ar 0 ((r - l) * f / sampleRate) l r l+ ph = mk_phasor (0,two_pi) 440+ o1 = sinOsc ar 440 0+ o2 = sinOsc ar 0 ph+ o3 = sin ph+in mce2 o1 (xFade2 o2 o3 (lfTri kr 0.1 0) 1) * 0.1++-- sinOsc ; sync ; i.e. <https://www.listarc.bham.ac.uk/lists/sc-dev/msg58316.html>+let dt = mce2 1.0 1.003+ freq = mouseX kr (100 * dt) (3000 * dt) Exponential 0.2+ sync_freq = mouseY kr 100 500 Exponential 0.2+ ph_freq = impulse ar sync_freq 0 + impulse ar freq 0+ o = sinOsc ar 0 (phasor ar ph_freq (freq / sampleRate) 0 1 0 * 2 * pi)+in o * 0.15++-- sinOsc ; reverse sync+let dt = mce2 1.0 1.003+ freq = mouseX kr (100 * dt) (3000 * dt) Exponential 0.2+ sync_freq = mouseY kr 100 500 Exponential 0.2+ direction = toggleFF (impulse ar sync_freq 0) * (-2) + 1+ o = sinOsc ar 0 (wrap (sweep ar (impulse ar freq 0) (direction * freq)) 0 (2 * pi))+in o * 0.15++-- sinOsc ; reverse cycle & reverse sync+let freq = mouseX kr (100 * mce2 1.0 1.003) (3000 * mce2 1.0 1.003) Exponential 0.2+ sync_freq = mouseY kr 100 500 Exponential 0.2+ direction = toggleFF (impulse ar sync_freq 0 + impulse ar freq 0) * (-2) + 1+ o = sinOsc ar 0 (wrap (sweep ar 0 (direction * freq)) 0 (2 * pi))+in o * 0.5++-- sinOsc ; 15.5 khz+pan2 (sinOsc ar 15500 0) 0 0.75++-- sinOsc ; 12 khz - 15.5 khz sweep+pan2 (sinOsc ar (range_hs (12000,15500) (sinOsc kr (1/6) 0)) 0) 0 0.75++-- sinOsc ; fm+let f0 = 220+ cR = 1 -- carrier ratio+ mR = 2 -- modulator ratio+ mA = mouseY kr 0.01 4000 Exponential 0.2 -- moduluation amplitude+in sinOsc ar ((f0 * cR) + (sinOsc ar (f0 * mR) 0 * mA)) 0 * 0.1++-- sinOsc ; fm+let f0 = 220+ cR = 1 -- carrier ratio+ mR = 2 -- modulator ratio+ mI = mouseY kr 0.01 10 Exponential 0.2 -- moduluation index+in sinOsc ar ((f0 * cR) + (sinOsc ar (f0 * mR) 0 * mI * (f0 * mR))) 0 * 0.1++-- sinOsc ; event control+let f (c,g,_,_,z,o,rx,_,p,_,_) =+ let freq_mod = sinOsc kr (tRand 0.02 0.06 g) 0 * tRand 0.1 2 g+ amp_mod = sinOsc kr (tRand 1 3 g / 60) 0 `in_range` (0.2, 0.5)+ s = sinOsc ar (lag (unitCps p) (rx * 2) + freq_mod) (tRand 0 (2 * pi) g)+ l = sinOsc kr o (tRand 0 pi g) * tRand 0.1 0.99 g+ in pan2 s l (lagUD g 0 1 * z * amp_mod)+in mix (voicer 16 f) * control kr "gain" 1.5++-- sinOsc ; event control ; id+let f (c,g,_,_,z,o,rx,_,p,_,_) =+ let freq_mod = sinOsc kr (tRandId (c,'α') 0.02 0.06 g) 0 * tRandId (c,'β') 0.1 2 g+ amp_mod = sinOsc kr (tRandId (c,'γ') 1 3 g / 60) 0 `in_range` (0.2, 0.5)+ s = sinOsc ar (lag (unitCps p) (rx * 2) + freq_mod) (tRandId (c,'δ') 0 (2 * pi) g)+ l = sinOsc kr o (tRandId (c,'ε') 0 pi g) * tRandId (c,'ζ') 0.1 0.99 g+ in pan2 s l (lagUD g 0 1 * z * amp_mod)+in mix (voicer 16 f) * control kr "gain" 1.5++-- sinOsc ; control_m inputs+let f = control_m kr "mnn" 69 (0,127,"lin")+ a = control_m kr "amp" 0.25 (0,1,"amp")+in sinOsc ar (midiCps f) 0 * a++-- sinOsc ; ln 2021-04-05 https://lukasnowok.github.io/spectrology/+let geom k z m = mce (take k (iterate (* m) z))+ o1 = sinOsc ar 10000 0 * geom 4 0.01 8+ o2 = sinOsc ar (lfSaw ar (geom 4 0.05 2) 0 * geom 4 1000 2) 0+in mix (o1 * o2) * 1/4 * 0.1++-- sinOsc ; ln 2021-04-17 https://lukasnowok.github.io/spectrology/+let geom k z m = mce (take k (iterate (* m) z))+ mkenv l t = envGen ar 1 1 0 1 DoNothing (envelope l t [EnvSin,EnvSin])+ o1 = mix (sinOsc ar (geom 10 1000 1.4) 0 * mkenv [1,0,1] [10,10]) * 0.2+ o2 = mix (sinOsc ar (geom 10 800 1.4) 0 * mkenv [0,1,0] [10,10]) * 0.2+ o3 = pulse ar (1/4) 0.5+in (o1 + o2 + o3) * 0.1++-- sinOsc ; https://scsynth.org/t/what-kind-of-synthesis-is-this/4318/30+let mratio = 4+ amp = 0.2+ boost = 2+ tr = impulse ar (lfNoise2 kr 1 `in_exprange` (1, 100)) 0+ envgen x = let c = EnvNum (-8) in envGen ar tr 1 0 1 DoNothing (envPerc_c 0.0001 x 1 (c,c))+ freq = (midiCps 60.5 / 16) * (linExp (envgen 0.4) 0 1 1 40)+ ix = mouseY kr 0 2 Linear 0.1+ sig = sinOsc ar freq (sinOsc ar (freq * mratio) 0 * ix)+in tanh (pan2 sig 0 boost) * envgen 1 * amp++---- ; drawings+Ui.ui_baudline (4096 * 1) 50 "linear" 2+Sound.Sc3.Plot.plot_ugen_nrt (48000,64) 1.0 (sinOsc ar 1 0)+(midiCps 60.5 / 16)
+ Help/Ugen/sinOscFB.help.hs view
@@ -0,0 +1,13 @@+-- sinOscFB+let x = mouseX kr 0 4 Linear 0.2+in sinOscFB ar (mce2 400 301) x * 0.1++-- sinOscFB+let y = mouseY kr 10 1000 Exponential 0.2+ x = mouseX kr (pi/2) pi Linear 0.2+in sinOscFB ar y x * 0.1++-- sinOscFB+let y = mouseY kr 1 1000 Exponential 0.2+ x = mouseX kr (pi/2) pi Linear 0.2+in sinOscFB ar (100 * sinOscFB ar y 0 + 200) x * 0.1
+ Help/Ugen/sineShaper.help.hs view
@@ -0,0 +1,5 @@+-- sineShaper+X.sineShaper (sinOsc ar (mce2 400 404) 0 * 0.2) (mouseX kr 0 1 Linear 0.2)++-- sineShaper+X.sineShaper (soundIn 0) (mouseX kr 0 1 Linear 0.2)
+ Help/Ugen/sinh.help.hs view
@@ -0,0 +1,3 @@+---- ; drawings+Sound.Sc3.is_unary Sound.Sc3.Common.Base.CS "SinH"+Sound.Sc3.Plot.plot_fn_r1_ln sinh (-4,4)
+ Help/Ugen/slew.help.hs view
@@ -0,0 +1,15 @@+-- slew+let z = lfPulse ar 800 0 0.5 * 0.1 in mce2 z (slew z 4000 4000)++-- slew+let z = saw ar 800 * 0.1 in mce2 z (slew z 400 400)++-- slew+let x = mouseX kr 200 12000 Exponential 0.2+ y = mouseY kr 200 12000 Exponential 0.2+in mce2 (slew (0 - saw ar 440) x y * 0.05) (slew (lfPulse ar 800 0 0.5) x y * 0.1)++---- ; drawings+Sound.Sc3.Plot.plot_ugen1 0.025 (lfPulse ar 800 0 0.5)+Sound.Sc3.Plot.plot_ugen1 0.025 (slew (lfPulse ar 800 0 0.5) 4000 4000)+Sound.Sc3.Plot.plot_ugen1 0.025 (slew (lfPulse ar 800 0 0.5) 500 500)
+ Help/Ugen/slope.help.hs view
@@ -0,0 +1,11 @@+-- slope+let a = lfNoise2Id 'α' ar 2 {- quadratic noise -}+ b = slope a {- first derivative, line segments -}+ c = slope b {- second derivative, constant segments -}+ s = 0.0002+ f = mce [a, b * s, c * s * s] * 220 + 220+in mix (sinOsc ar f 0 * 0.1)++---- ; drawings+let {a = lfNoise2Id 'α' ar 2000;b = slope a;c = slope b;m = 0.0002}+Sound.Sc3.Plot.plot_ugen 0.05 (mce [a,b * m,c * m * m])
+ Help/Ugen/sms.help.hs view
@@ -0,0 +1,9 @@+-- sms ; sine reconstruction left channel, noises on right (sample rate must be 44100)+let z = soundIn 0+ y = mouseY kr 1 50 Linear 0.2+ x = mouseX kr 0.5 4 Linear 0.2+in X.sms {- ar -} z 50 y 8 0.3 x 0 0 0 1 (-1)++-- sms ; default param+let z = soundIn 0+in X.sms {- ar -} z 80 80 4 0.2 1 0 0 0 1 (-1)
+ Help/Ugen/sndfileIn.help.hs view
@@ -0,0 +1,14 @@+-- sndfileDiskIn ; either diskIn or vDiskIn with "brackets" to allocate and read and then close and free the sndfile buffer+sinOsc ar 440 0 * 0.05 + sndfileDiskIn ("dsk", 0, [0, 1]) "20.2-LW+RD.flac" Nothing Loop++-- sndfileIn ; diskIn form of sndfileDiskIn+sinOsc ar 440 0 * 0.05 + sndfileIn ("dsk", 0, []) "20.2-LW+RD.flac" Loop++-- sndfileVarIn ; vDiskIn with "brackets" ; if readChan is empty all channels are read+sinOsc ar 440 0 * 0.05 + sndfileVarIn ("dsk", 0, []) "20.2-LW+RD.flac" (sinOsc kr 0.1 0 * 0.015 + 1) Loop++-- sndfileIn ; requires=buf ; a sndfileIn graph is equal to the below, excepting that here the number of channels is written out+sinOsc ar 440 0 * 0.05 + diskIn 2 (control kr "dsk" 0) Loop++---- ; print scsynth, the interpreter value that holds the reference that stores the end brackets+scsynthPrint scsynth
+ Help/Ugen/sndfileRead.help.hs view
@@ -0,0 +1,21 @@+---- sndfileRead ; buffer identifier with "brackets" to hold b_allocRead and b_free messages+let (buf, nc, _, _) = sndfileRead ("buf", 0, []) "metal.wav" -- metal.wav is mono ; pf-c5.aif is stereo+ tr = impulse ar (bufSampleRate kr buf / bufFrames kr buf) 0+ ph = phasor ar tr (bufSampleRate kr buf / sampleRate) 0 (bufFrames kr buf) 0+in bufRdL nc ar buf ph NoLoop++---- sndfileRead ; as above but use constants for sample rate and frame count+let (buf, nc, sr, nf) = sndfileRead ("buf", 0, []) "pf-c5.aif" -- metal.wav is mono ; pf-c5.aif is stereo+ tr = impulse ar (sr / nf) 0+ ph = phasor ar tr (sr / sampleRate) 0 nf 0+in bufRdL nc ar buf ph NoLoop++-- sndfileRead ; sine wave control of playback rate, negative rate plays backwards+let (buf, nc, _, _) = sndfileRead ("buf", 0, []) "pf-c5.aif"+ f = xLine kr 0.2 8 30 RemoveSynth+ r = fSinOsc kr f 0 * 3 + 0.6+ s = bufRateScale kr buf * r+in playBuf nc ar buf s 1 0 Loop DoNothing++---- ; print scsynth, the interpreter value that holds the reference that stores the end brackets+scsynthPrint scsynth
+ Help/Ugen/softClip.help.hs view
@@ -0,0 +1,2 @@+-- softClip+softClip (fSinOsc ar 500 0 * xLine kr 0.1 10 10 RemoveSynth) * 0.25
+ Help/Ugen/softClipAmp.help.hs view
@@ -0,0 +1,6 @@+-- softClipAmp4+X.softClipAmp4 (sinOsc ar 220 0 * 0.1) (mouseX kr 1 16 Linear 0.2)++-- softClipAmp4+X.softClipAmp4 (soundIn 0) (mouseX kr 1 8 Linear 0.2)+
+ Help/Ugen/sonLPC.help.hs view
@@ -0,0 +1,21 @@+-- sonLPC+let nf = 1024 * 2+ hop = 1 / 4+ poles = mouseY kr 4 80 Linear 0.2 -- MAXPOLES=80+ sig = soundIn 0+ chain = X.sonLPC ar (localBufId 'α' 1 nf) sig hop poles+ freq = mouseX kr 50 200 Linear 0.2+ exci = saw ar freq+in pan2 (X.sonLPCSynthIn ar chain exci) 0 1++-- sonLPC ; event control+let f (c,g,x,y,z,o,_,_,_,_,_) =+ let nf = 1024 * 2+ hop = 1 / 4+ poles = linLin y 0 1 5 80+ sig = soundIn 0 * 4+ chain = X.sonLPC ar (localBufId c 1 nf) sig hop poles+ freq = midiCps (x * 24 + 36)+ exci = saw ar freq * z * g+ in pan2 (X.sonLPCSynthIn ar chain exci) (o * 2 - 1) 1+in mix (voicer 4 f) * control kr "gain" 1
+ Help/Ugen/sortBuf.help.hs view
@@ -0,0 +1,7 @@+-- sortBuf ; gradual erosion+let bufnum = 0+in pan2 (X.sortBuf ar bufnum (lfNoise0 kr 5 * 50000 + 60000) 0) 0 0.1++---- ; load sndfile+withSc3 (async (b_allocRead 0 (sfResolve "pf-c5.aif") 0 0))+withSc3 (async (b_allocRead 0 (sfResolve "a11wlk01.wav") 0 0))
+ Help/Ugen/sos.help.hs view
@@ -0,0 +1,45 @@+-- sos ; same as twopole+let theta = line kr (0.2 * pi) pi 5 RemoveSynth+ rho = line kr 0.6 0.99 5 RemoveSynth+ b1 = 2 * rho * cos theta+ b2 = - (rho * rho)+in sos (lfSaw ar 200 0 * 0.1) 1 0 0 b1 b2++-- sos ; http://www.earlevel.com/main/2011/01/02/biquad-formulas/+let fc = 100+ sr = 48000+ k = tan (pi * fc / sr)+ q = 0.707+ norm = 1 / (1 + k / q + k * k)+ a0 = k * k * norm+ a1 = 2 * a0+ a2 = a0+ b1 = 2 * (k * k - 1) * norm+ b2 = (1 - k / q + k * k) * norm+in sos (whiteNoiseId 'α' ar * 0.2) a0 a1 a2 (- b1) (- b2)++-- sos+let b1 = mouseY kr 1.45 1.998 Linear 0.2+ b2 = mouseX kr (-0.999) (-0.9998) Linear 0.2+in sos (impulse ar 2 0) 0.0 0.05 0.0 b1 b2++-- sos+let f (_,w,x,y,z,o,_,_,_,_,_) =+ let b1 = linLin y 0 1 1.45 1.998+ b2 = linLin x 0 1 (-0.999) (-0.9998)+ in pan2 (sos (trig (k2a w) 0) 0.0 0.05 0.0 b1 b2) (o * 2 - 1) 8+in mix (voicer 16 f) * control kr "gain" 1++-- sos+let f (_,w,x,y,z,o,_,_,_,_,_) =+ let freq = midiCps (x * 25 + 48)+ rq = 0.002 + (y * 0.004)+ b1 = 1.987 * 0.9889999999 * cos 0.09+ b2 = -0.998057+ im = decay (trig1 (k2a w) sampleDur) 0.1+ s1 = sos im 0.3 0.0 0.0 b1 b2+ s2 = rhpf (s1 * 0.8) freq rq+ s3 = s2 + delayC (rhpf (s1 * 0.9) (freq * 0.99999) (rq * 0.999)) 0.02 0.01223+ s4 = decay2 s3 0.4 0.3 * s2+ in pan2 s4 (o * 2 - 1) 0.1+in mix (voicer 16 f) * control kr "gain" 0.5
+ Help/Ugen/soundIn.help.hs view
@@ -0,0 +1,14 @@+-- soundIn ; composite of in' and numOutputBuses+soundIn 0 * 0.5++-- soundIn ; copy input from 1 & 0 to outputs 0 & 1.+soundIn (mce2 1 0) * 0.5++-- ; io matrix (0->0,1->2,2->1,3->3)+--+-- 0 1 2 3+-- 0 *+-- 1 *+-- 2 *+-- 3 *+soundIn (mce [0, 2, 1, 3])
+ Help/Ugen/specCentroid.help.hs view
@@ -0,0 +1,8 @@+-- specCentroid ; as the number of harmonics increases, the centroid is pushed higher+let f0 = mouseY kr 1000 100 Exponential 0.2+ nh = mouseX kr 1 100 Exponential 0.2+ z = blip ar f0 nh+ f = fft' (localBufId 'α' 2048 1) z+ c = specCentroid kr f+ p = pollExt (impulse kr 1 0) c 0 (label "c")+in sinOsc ar p 0 * 0.1
+ Help/Ugen/specFlatness.help.hs view
@@ -0,0 +1,8 @@+-- specFlatness+let z = soundIn 0+ g = 1 {- gain, set as required -}+ a = pollExt 1 (X.wAmp kr z 0.05) 0 (label "a")+ f = fft' (localBufId 'α' 2048 1) z+ c = pollExt 1 (specCentroid kr f) 0 (label "c")+ w = pollExt 1 (specFlatness kr f) 0 (label "w")+in bpf (pinkNoiseId 'a' ar) c w * a * g
+ Help/Ugen/spectralEntropy.help.hs view
@@ -0,0 +1,12 @@+-- spectralEntropy ; note numChannels and numBands must be equal+let sig = soundIn 0+ chn = fft' (localBufId 'α' 1 2048) sig+ entropy = X.spectralEntropy 1 kr chn 2048 1+in pan2 (blip ar 100 (sqrt entropy * 10)) 0 0.1++-- spectralEntropy+let sig = soundIn 0+ amp = amplitude kr sig 0.01 0.01+ chn = fft' (localBufId 'α' 1 1024) sig+ entropy = X.spectralEntropy 10 kr chn 1024 10 * (min amp 0.2) * 5+in splay (blip ar (sqrt entropy * 200) (sqrt entropy)) 1 0.1 0 True
+ Help/Ugen/splay.help.hs view
@@ -0,0 +1,41 @@+-- splay+splay (sinOsc ar (mce [110,220,440,880]) 0 * 0.1) 1 1 0 True++-- splay+mix (splay (pan2 (sinOsc ar (mce [110,220,440,880]) 0) 0 0.075) 1 1 0 True)++-- splay ; composite UGen ; inArray spread=1 level=1 center=0 levelComp=true ; mouse control+let i = 6+ r = map (\e -> randId e 10 20) (take i ['α'..])+ n = lfNoise2Id 'β' kr (mce r)+ x = mouseX kr (-1) 1 Linear 0.1+ y = mouseY kr 1 0 Linear 0.1+ ci = constant . fromIntegral+ f = mce [1 .. ci i] + 3 * 100+ o = sinOsc ar (n * 200 + f) 0+in splay o y 0.2 x True++-- splay ; single channel input+let x = mouseX kr (-1) 1 Linear 0.1+ y = mouseY kr 1 0 Linear 0.1+ o = sinOsc ar (lfNoise2Id 'α' kr 6 * 9 + 440) 0 * 0.1+in splay o y 0.2 x True++-- splay ; n_set control+let i = 10+ s = control kr "spread" 1+ l = control kr "level" 0.2+ c = control kr "center" 0+ r = map (\e -> randId e 10 20) (take i ['α'..])+ ci = constant . fromIntegral+ f = mce [1 .. ci i] + 3 * 100+ n = lfNoise2Id 'β' kr (mce r) * 200 + f+in splay (sinOsc ar n 0) s l c True++---- ; n_set control+import Sound.OSC {- hosc -}+withSc3 (sendMessage (n_set (-1) [("spread",1),("center",0)])) -- full stereo+withSc3 (sendMessage (n_set (-1) [("spread",0.5),("center",0)])) -- less wide+withSc3 (sendMessage (n_set (-1) [("spread",0),("center",0)])) -- mono center+withSc3 (sendMessage (n_set (-1) [("spread",0.5),("center",0.5)])) -- from center to right+withSc3 (sendMessage (n_set (-1) [("spread",0),("center",-1)])) -- all left
+ Help/Ugen/spreader.help.hs view
@@ -0,0 +1,15 @@+-- spreader+let theta = pi / 2+ filtsPerOctave = 8+in X.spreader ar (pinkNoiseId 'α' ar * 0.1) theta filtsPerOctave++-- spreader+let theta = mouseX kr 0 (pi / 2) Linear 0.2+ filtsPerOctave = 8+in X.spreader ar (pinkNoiseId 'α' ar * 0.1) theta filtsPerOctave++-- spreader+let in_ = sinOsc ar (mouseX kr 110 880 Exponential 0.2) 0 * 0.1+ theta = pi / 2+ filtsPerOctave = 8+in X.spreader ar in_ theta filtsPerOctave
+ Help/Ugen/spring.help.hs view
@@ -0,0 +1,51 @@+-- spring ; mouse control ; button=gate ; x=spring-constant ; y=damping+let inforce = k2a (mouseButton kr 0 1 0) `greater_than` 0+ k = mouseX kr 0.1 20 Exponential 0.2+ d = mouseY kr 0.00001 0.1 Exponential 0.2+ outforce = spring ar inforce k d+ freq = outforce * 400 + 500 -- modulate frequency with the force+in sinOsc ar freq 0 * 0.1++-- spring ;several springs in series+let inforce = k2a (mouseButton kr 0 1 0) `greater_than` 0+ k = mouseX kr 0.1 20 Exponential 0.2+ d = mouseY kr 0.00001 0.1 Exponential 0.2+ m0 = spring ar inforce k 0.01+ m1 = spring ar m0 (0.5 * k) d+ m2 = spring ar m0 (0.6 * k + 0.2) d+ m3 = spring ar (m1 - m2) 0.4 d+in sinOsc ar (m3 * 200 + 500) 0 * 0.1 -- modulate frequency with the force++-- spring ; modulating a resonating string+let k = mouseX kr 0.5 100 Exponential 0.2+ d = mouseY kr 0.0001 0.1 Exponential 0.2+ t = dustId 'α' ar 2+ m0 = spring ar (toggleFF t) k 0.01+ m1 = spring ar m0 (0.5 * k) d+ m2 = spring ar m0 (0.6 * k) d+ m3 = spring ar (mce2 m1 m2) (0.4 * k) d+ m4 = spring ar (m3 - m1 + m2) (0.1 * k) d+in combL t 0.1 (linLin m4 (-10) 10 (1/8000) (1/100)) 12++-- spring ; event control+let f (_,w,x,y,z,o,rx,_,_,_,_) =+ let k = linExp x 0 1 0.1 20+ d = linExp y 0 1 0.00001 0.065+ s = spring ar (k2a w) k d+ freq = midiCps (x * 24 + 48) + (s * 800 * rx) -- modulate frequency with the force+ in pan2 (sinOsc ar freq 0) (o * 2 - 1) (w * z * z)+in mix (voicer 16 f) * control kr "gain" 2++-- spring ; event control+let f (_,w,x,y,z,_,_,_,_,_,_) =+ let k = linExp x 0 1 0.5 100+ d = linExp y 0 1 0.0001 0.1+ t = trig (k2a w) 0+ m0 = spring ar (k2a w) k 0.01+ m1 = spring ar m0 (0.5 * k) d+ m2 = spring ar m0 (0.6 * k) d+ m3 = spring ar (mce2 m1 m2) (0.4 * k) d+ m4 = spring ar (m3 - m1 + m2) (0.1 * k) d+ dt = linLin m4 (-10) 10 (x/8000) (x/100)+ in combL (trig (k2a w) (z * 0.05)) 0.1 dt ((latch y w + 1) * 9)+in mix (voicer 16 f) * control kr "gain" 2
+ Help/Ugen/sqrDif.help.hs view
@@ -0,0 +1,2 @@+-- sqrDif+(fSinOsc ar 800 0 `sqrDif` fSinOsc ar (xLine kr 200 500 5 DoNothing) 0) * 0.1
+ Help/Ugen/sqrSum.help.hs view
@@ -0,0 +1,2 @@+-- sqrSum+(fSinOsc ar 800 0 `sqrSum` fSinOsc ar (xLine kr 200 500 5 DoNothing) 0) * 0.1
+ Help/Ugen/squiz.help.hs view
@@ -0,0 +1,25 @@+-- squiz ; of sin oscillator+let zmax = 10+ x = mouseX kr 1 10 Exponential 0.2+ y = mouseY kr 1 zmax Linear 0.2+in X.squiz (sinOsc ar 440 0) x y 0.1 * 0.1++-- squiz ; of soundin+let zmax = 100+ s = sinOsc ar 440 0+ x = mouseX kr 1 10 Exponential 0.2+ y = mouseY kr 1 zmax Linear 0.2+in X.squiz (soundIn 0) x y 0.1 * 0.1++-- squiz ; of buffer ; requires=buf+let (b, nc) = (control kr "buf" 100, 2)+ zmax = 100+ s = sinOsc ar 440 0+ x = mouseX kr 1 10 Exponential 0.2+ y = mouseY kr 1 zmax Linear 0.2+ r = bufRateScale kr b+ p = playBuf nc ar b (r * 0.5) 1 0 Loop DoNothing+in X.squiz p x y 0.1 * 0.1++---- ; setup ; nc=2+withSc3 (async (b_allocRead 0 (sfResolve "pf-c5.aif") 0 0))
+ Help/Ugen/standard2DL.help.hs view
@@ -0,0 +1,11 @@+-- standard2DL ; mouse-controlled param+let x0 = 4.9789799812499+ y0 = 5.7473416156381+in X.standard2DL ar 11025 44100 (mouseX kr 0.9 4 Linear 0.2) x0 y0 * 0.3++-- standard2DL ; as a frequency control+let x0 = 4.9789799812499+ y0 = 5.7473416156381+ k = mouseX kr 0.9 4 Linear 0.2+ f = X.standard2DL ar 10 20 k x0 y0 * 800 + 900+in sinOsc ar f 0 * 0.3
+ Help/Ugen/standardL.help.hs view
@@ -0,0 +1,11 @@+-- standardL+standardL ar (sampleRate / 2) 1.0 0.5 0 * 0.1++-- standardL ; vary frequency+standardL ar (mouseX kr 20 sampleRate Linear 0.2) 1 0.5 0 * 0.1++-- standardL ; mouse-controlled param+standardL ar (sampleRate / 2) (mouseX kr 0.9 4 Linear 0.2) 0.5 0 * 0.1++-- standardL ; frequency control+sinOsc ar (standardL ar 40 (mouseX kr 0.9 4 Linear 0.2) 0.5 0 * 800 + 900) 0 * 0.1
+ Help/Ugen/stepper.help.hs view
@@ -0,0 +1,40 @@+-- stepper+let i = impulse kr 10 0+ f = stepper i 0 4 16 (-3) 4 * 100+in sinOsc ar f 0 * 0.1++-- stepper ; mouse button press increments integer frequency multiplier+let tr = trig1 (mouseButton kr 0 1 0) controlDur+ fr = 55 * stepper tr 0 1 17 1 1+in sinOsc ar fr 0 * 0.1++-- stepper ; with bufRd for sequencing+let compose = foldl (flip (.)) id+ rvbId z0 s =+ let f z1 i =+ let dly = mce [randId ((z0,z1),'α') 0 0.5+ ,randId ((z0,z1),'β') 0 0.5]+ in allpassN i 0.05 dly (randId z1 1.5 2)+ in compose (map f (id_seq 5 'γ')) s+ rate = mouseX kr 1.75 2.25 Exponential 0.1+ clock = impulse kr rate 0+ envl = decay2 clock 0.002 2.5+ indx = stepper clock 0 0 15 1 0+ freq_l = [97.999,195.998,523.251,466.164,195.998+ ,233.082,87.307,391.995,87.307,261.626+ ,195.998,77.782,233.082,195.998,97.999+ ,155.563]+ freq_b = asLocalBufId 'a' freq_l+ freq = bufRdN 1 kr freq_b indx Loop+ ffreq = lag2 freq 0.1 + mce [0,0.3]+ lfo = sinOsc kr 0.2 (mce [0,pi/2]) * 0.0024 + 0.0025+ top = mix (lfPulse ar (freq * mce [1,1.5,2]) 0 0.3)+ chn = [\s -> rlpf s ffreq 0.3 * envl+ ,\s -> rlpf s ffreq 0.3 * envl+ ,\s -> s * 0.5+ ,\s -> combL s 1 (0.66 / rate) 2 * 0.8 + s+ ,\s -> s + (rvbId 'γ' s * 0.3)+ ,\s -> leakDC s 0.1+ ,\s -> delayL s 0.1 lfo + s+ ,\s -> onePole s 0.9]+in compose chn top
+ Help/Ugen/stkBandedWG.help.hs view
@@ -0,0 +1,23 @@+-- stkBandedWG ; default param+X.stkBandedWG ar 440.0 0.0 0.0 0.0 0.0 64.0 0.0 0.0 1.0++-- stkBandedWG ; default param ; instr=3+X.stkBandedWG ar 440.0 3.0 0.0 0.0 0.0 64.0 0.0 0.0 1.0++-- stkBandedWG+let tr = impulse kr (mouseX kr 0.5 12 Linear 0.2) 0 - 0.5+ freq = midiCps (tExpRandId 'α' 24 96 tr)+ instr = 3 -- Uniform Bar = 0, Tuned Bar = 1, Glass Harmonica = 2, Tibetan Bowl = 3+ modalresonance = tRandId 'ζ' 0 127 tr+in X.stkBandedWG ar freq instr 0 0 0 modalresonance 0 0 tr++-- stkBandedWG ; texture=overlap,4,3,4,inf+let freq = randId 'α' 110 440+ instr = iRandId 'β' 1 3+ bowpressure = iRandId 'γ' 32 96+ bowmotion = randId 'δ' 32 96+ integration = randId 'ε' 0 64+ modalresonance = randId 'ζ' 32 96+ bowvelocity = randId 'η' 64 96+ setstriking = 127 -- setstriking: 0 = Plucked, 127 = Bowed+in X.stkBandedWG ar freq instr bowpressure bowmotion integration modalresonance bowvelocity setstriking 1
+ Help/Ugen/stkInst.help.hs view
@@ -0,0 +1,119 @@+-- stkInst ; bowed ; event control ; https://ccrma.stanford.edu/software/stk/classstk_1_1Bowed.html+let f (_,g,_,y,z,o,rx,_,p,_,_) =+ let kBowPressure = 2+ kBowPosition = 4+ kVibratoFrequency = 11+ kVibratoGain = 1+ kVolume = 128+ args = [kBowPressure,1 + z * 127+ ,kBowPosition,1 + y * 127+ ,kVibratoFrequency,50+ ,kVibratoGain,1+ ,kVolume,1 + z * 127]+ s = X.stkInst ar (unitCps p) g (1 - rx) 0.5 (X.stkAt "Bowed") (mce args)+ in pan2 s (o * 2 - 1) g+in mix (voicer 16 f) * control kr "gain" 1++-- stkInst ; brass ; event control ; https://ccrma.stanford.edu/software/stk/classstk_1_1Brass.html+let f (_,g,_,y,z,o,rx,ry,p,_,_) =+ let kLipTension = 2+ kSlideLength = 4+ kVibratoFrequency = 11+ kVibratoGain = 1+ kVolume = 128+ args = [kLipTension,latch rx g * 127+ ,kSlideLength,latch y g * 127+ ,kVibratoFrequency,ry * 48+ ,kVibratoGain,1+ ,kVolume,6 + z * 24]+ s = X.stkInst ar (unitCps p) g (1 - rx) 0.5 (X.stkAt "Brass") (mce args)+ in pan2 s (o * 2 - 1) g+in mix (voicer 16 f) * control kr "gain" 2++-- stkInst ; clarinet ; event control ; https://ccrma.stanford.edu/software/stk/classstk_1_1Clarinet.html+let f (_,g,_,y,z,o,rx,ry,p,_,_) =+ let kReedStiffness = 2+ kNoiseGain = 4+ kVibratoFrequency = 11+ kVibratoGain = 1+ kBreathPressure = 128+ args = [kReedStiffness,y * 32+ ,kNoiseGain,rx * 32+ ,kVibratoFrequency,50+ ,kVibratoGain,1+ ,kBreathPressure,linLin z 0 1 48 64]+ s = X.stkInst ar (unitCps p) g (1 - ry) 0.5 (X.stkAt "Clarinet") (mce args)+ in pan2 s (o * 2 - 1) g+in mix (voicer 16 f) * control kr "gain" 1++-- stkInst ; flute ; event control ; https://ccrma.stanford.edu/software/stk/classstk_1_1Flute.html+let f (_,g,_,y,z,o,rx,ry,p,_,_) =+ let kJetDelay = 2+ kNoiseGain = 4+ kVibratoFrequency = 11+ kVibratoGain = 1+ kBreathPressure = 128+ args = [kJetDelay,y * 128+ ,kNoiseGain,rx * 64+ ,kVibratoFrequency,(1 - ry) * 64+ ,kVibratoGain,ry * 16+ ,kBreathPressure,linLin z 0 1 48 96]+ s = X.stkInst ar (unitCps p) g 0.75 0.5 (X.stkAt "Flute") (mce args)+ in pan2 s (o * 2 - 1) g+in mix (voicer 16 f) * control kr "gain" 0.5++-- stkInst ; mandolin ; event control ; https://ccrma.stanford.edu/software/stk/classstk_1_1Mandolin.html+let f (_,g,_,y,z,o,rx,ry,p,_,_) =+ let kBodySize = 2+ kPluckPosition = 4+ kStringDetuning = 1+ args = [kBodySize,ry * 127+ ,kPluckPosition,y * 127+ ,kStringDetuning,rx * 127]+ s = X.stkInst ar (unitCps p * 1.5) g (z * 2) 0.5 (X.stkAt "Mandolin") (mce args)+ in pan2 s (o * 2 - 1) (lagUD g 0 5)+in mix (voicer 16 f) * control kr "gain" 2++-- stkInst ; mesh2D ; event control ; https://ccrma.stanford.edu/software/stk/classstk_1_1Mesh2D.html+let f (_,g,x,y,z,o,rx,ry,p,_,_) =+ let kXDimension = 2+ kYDimension = 4+ kMeshDecay = 11+ kXYInputPosition = 1+ args = [kXDimension,latch x g * 127+ ,kYDimension,latch y g * 127+ ,kMeshDecay,(1 - z) * 127+ ,kXYInputPosition,rx * 127]+ s = X.stkInst ar (unitCps p) g (z * 2) 0 (X.stkAt "Mesh2D") (mce args)+ in pan2 s (o * 2 - 1) 1+in mix (voicer 16 f) * control kr "gain" 2++-- stkInst ; plucked ; event control ; https://ccrma.stanford.edu/software/stk/classstk_1_1Plucked.html+let f (_,g,_,y,z,o,_,_,p,_,_) =+ let args = [0] -- cannot be []...+ s = X.stkInst ar (unitCps p) g (0.5 + z * 0.5) (y * 0.01) (X.stkAt "Plucked") (mce args)+ in pan2 s (o * 2 - 1) 1+in mix (voicer 16 f) * control kr "gain" 1++-- stkInst ; sitar ; event control ; https://ccrma.stanford.edu/software/stk/classstk_1_1Sitar.html+let f (_,g,_,y,z,o,_,_,p,_,_) =+ let args = [0] -- cannot be []...+ s = X.stkInst ar (unitCps (latch p g)) g (0.5 + z * 0.5) (y * 0.01) (X.stkAt "Sitar") (mce args)+ in pan2 s (o * 2 - 1) 1+in mix (voicer 16 f) * control kr "gain" 1++-- stkInst ; voicForm ; event control ; https://ccrma.stanford.edu/software/stk/classstk_1_1VoicForm.html+let f (_,g,_,y,z,o,rx,ry,p,_,_) =+ let kVoicedUnvoicedMix = 2+ kVowelPhonemeSelection = 4+ kVibratoFrequency = 11+ kVibratoGain = 1+ kLoudness = 128+ args = [kVoicedUnvoicedMix,lag rx 0.2 * 127+ ,kVowelPhonemeSelection,lag y 0.2 * 16]+ s = X.stkInst ar (unitCps p) g 1 0 (X.stkAt "VoicForm") (mce args)+ in pan2 s (o * 2 - 1) (z * lagUD g 0.1 2)+in mix (voicer 16 f) * control kr "gain" 1++---- ; set globals+X.stkGlobals ar 1 1 (label "/home/rohan/opt/src/supercollider/sc3-plugins/external_libraries/stk/rawwaves")
+ Help/Ugen/stkMandolin.help.hs view
@@ -0,0 +1,25 @@+-- stkMandolin+let x = mouseX kr 0.25 16 Linear 0.2+ tr = impulse kr x 0 - 0.5+ freq = midiCps (tiRandId 'α' 32 96 tr)+ bodysize = tRandId 'β' 0 127 tr+ pickposition = tRandId 'γ' 0 127 tr+ stringdamping = tRandId 'δ' 0 127 tr+ stringdetune = tRandId 'ε' 0 127 tr+ aftertouch = tRandId 'ζ' 0 127 tr+ m = X.stkMandolin ar freq bodysize pickposition stringdamping stringdetune aftertouch tr+in pan2 m (tRandId 'η' (-1) 1 tr) 0.5++-- stkMandolin+let x = mouseX kr 3 16 Linear 0.2+ tr = impulse kr x 0 - 0.5 -- trig+ tr3 = pulseDivider tr 3 0+ freq = midiCps (tiRandId 'α' 54 66 tr)+ bodysize = tRandId 'β' 72 94 tr3+ pickposition = tRandId 'γ' 32 42 tr3+ stringdamping = tRandId 'δ' 64 72 tr3+ stringdetune = tRandId 'ε' 0 4 tr3+ aftertouch = tRandId 'ζ' 2 8 tr3+ m = X.stkMandolin ar freq bodysize pickposition stringdamping stringdetune aftertouch tr+in pan2 m (tRandId 'η' (-1) 1 tr) 0.5+
+ Help/Ugen/stkModalBar.help.hs view
@@ -0,0 +1,35 @@+-- stkModalBar ; https://ccrma.stanford.edu/software/stk/classstk_1_1ModalBar.html+let x = mouseX kr 0.25 12 Linear 0.2+ tr = impulse kr x 0 - 0.5+ freq = midiCps (tiRandId 'α' 25 96 tr)+ instrument = tiRandId 'β' 0 9 tr -- Marimba, Vibraphone, Agogo, Wood1, Reso, Wood2, Beats, Two Fixed, Clump+ stickhardness = tRandId 'γ' 0 127 tr+ stickposition = tRandId 'δ' 0 127 tr+ vibratogain = tRandId 'ε' 0 127 tr+ vibratofreq = tRandId 'ζ' 0 127 tr+ directstickmix = tRandId 'η' 0 127 tr+ volume = tRandId 'θ' 0 127 tr+in X.stkModalBar ar freq instrument stickhardness stickposition vibratogain vibratofreq directstickmix volume tr++-- stkModalBar+let x = mouseX kr 1 12 Linear 0.2+ tr = impulse kr x 0 - 0.5+ tr3 = pulseDivider tr 3 0+ freq = midiCps (tiRandId 'α' 52 64 tr)+ instrument = 1+ stickhardness = tRandId 'β' 10 50 tr3+ stickposition = tRandId 'γ' 40 80 tr3+ vibratogain = tRandId 'δ' 66 98 tr3+ vibratofreq = tRandId 'ε' 4 12 tr3+ directstickmix = tRandId 'ζ' 0 1 tr3+ volume = tRandId 'η' 16 48 tr3+in X.stkModalBar ar freq instrument stickhardness stickposition vibratogain vibratofreq directstickmix volume tr++-- stkModalBar ; event control+let f (_,g,_,y,z,o,rx,_,p,_,_) =+ let tr = g - 0.5+ freq = unitCps p+ instr = control kr "instrument" 4+ sig = X.stkModalBar ar freq instr ((1 - y) * 127) (y * 127) 64 64 (rx * 127) 127 tr+ in pan2 sig (o * 2 - 1) (latch z g * 3)+in mix (voicer 16 f) * control kr "gain" 1
+ Help/Ugen/stkMoog.help.hs view
@@ -0,0 +1,44 @@+-- stkMoog ; mouse trigger+let tr = mouseButton kr 0 1 0 - 0.5+ freq = midiCps (tiRandId 'α' 12 96 tr)+ filterQ = tRandId 'β' 0 127 tr+ sweeprate = tRandId 'γ' 0 127 tr+ vibfreq = tRandId 'δ' 0 127 tr+ vibgain = tRandId 'ε' 0 127 tr+ gain = tRandId 'ζ' 0 127 tr+in X.stkMoog ar freq filterQ sweeprate vibfreq vibgain gain tr * 0.5++-- stkMoog ; mouse control+let x = mouseX kr 0.25 16 Linear 0.2+ tr = impulse kr x 0 - 0.5+ freq = midiCps (tiRandId 'α' 24 72 tr)+ filterQ = tRandId 'β' 0 32 tr+ sweeprate = tRandId 'γ' 0 32 tr+ vibfreq = tRandId 'δ' 0 96 tr+ vibgain = tRandId 'ε' 0 16 tr+ gain = tRandId 'ζ' 0 127 tr+in X.stkMoog ar freq filterQ sweeprate vibfreq vibgain gain tr * 0.5++-- stkMoog ; sequence+let nsigId z l r f = range l r (lfNoise2Id z kr f)+ scl = asLocalBufId 'α' [0,2,3.2,5,7,9,10]+ mnn = 48 + degreeToKey scl (nsigId 'β' 0 15 0.35) 12+ freq = midiCps mnn+ filterQ = nsigId 'γ' 0 64 0.5+ sweeprate = nsigId 'δ' 0 64 0.5+ vibfreq = nsigId 'ε' 0 64 0.5+ vibgain = nsigId 'ζ' 0 16 0.5+ gain = nsigId 'η' 16 96 0.5+in X.stkMoog ar freq filterQ sweeprate vibfreq vibgain gain 1++-- stkMoog ; event control+let f (_,g,_,y,z,o,rx,ry,p,px,_) =+ let freq = midiCps (p * 127 + px)+ filterQ = y * 128+ sweeprate = rx * 16+ vibfreq = y * 64+ vibgain = ry * 4+ gain = linLin z 0 1 16 96+ sig = X.stkMoog ar freq filterQ sweeprate vibfreq vibgain gain 1+ in pan2 sig (o * 2 - 1) (lagUD g 0.01 0.25)+in mix (voicer 16 f) * control kr "gain" 1
+ Help/Ugen/stkPluck.help.hs view
@@ -0,0 +1,9 @@+-- stkPluck ; default param+let delete_when_silent s a t = mrg2 s (detectSilence s a t RemoveSynth)+in delete_when_silent (X.stkPluck ar 440 0.99) 0.001 0.5++-- stkPluck ; rand param ; texture=spawn,1,inf+let freq = midiCps (iRandId 'α' 32 96)+ decay_ = randId 'β' 0.95 0.99+ s = leakDC (X.stkPluck ar freq decay_) 0.995+in mrg2 s (detectSilence s 0.001 0.5 RemoveSynth)
+ Help/Ugen/stkShakers.help.hs view
@@ -0,0 +1,21 @@+-- stkShakers ; default param ; https://ccrma.stanford.edu/software/stk/classstk_1_1Shakers.html+X.stkShakers ar 0.0 64.0 64.0 64.0 64.0++-- stkShakers ; random param+let x = mouseX kr 0.25 4 Linear 0.2+ tr = impulse kr x 0 - 0.5+ instr = tRandId 'α' 0 23 tr+ energy = tRandId 'β' 0 127 tr+ decay_ = tRandId 'γ' 0 127 tr+ objects = tRandId 'δ' 0 127 tr+ resfreq = tRandId 'ε' 0 127 tr+in X.stkShakers ar instr energy decay_ objects resfreq++-- stkShakers ; noise param+let walkId z = linLin (lfNoise2Id z kr 0.75) (-1) 1+ instr = walkId 'α' 0 23+ energy = walkId 'β' 0 127+ decay_ = walkId 'γ' 0 127+ objects = walkId 'δ' 0 127+ resfreq = walkId 'ε' 0 127+in pan2 (X.stkShakers ar instr energy decay_ objects resfreq) (lfNoise2Id 'ζ' kr 0.75) 1
+ Help/Ugen/streson.help.hs view
@@ -0,0 +1,11 @@+-- streson ; http://www.csounds.com/manual/html/streson.html+let z = lfSaw ar (mce2 220 180) 0 * 0.2+ dt = recip (linExp (lfCub kr 0.1 (0.5 * pi)) (-1) 1 280 377)+in X.streson z dt 0.9 * 0.1++-- streson ; c.f. Sound.Sc3.Data.Modal.modal_frequency_ratios+let dt = recip (linExp (lfCub kr 0.1 (0.5 * pi)) (-1) 1 280 377)+in X.streson (soundIn 0) dt 0.9 * 0.1++---- ; drawings+Sound.Sc3.Plot.plot_ugen_nrt (20,1) 16.0 (recip (linExp (lfCub kr 0.1 (0.5 * pi)) (-1) 1 280 377))
+ Help/Ugen/stringVoice.help.hs view
@@ -0,0 +1,19 @@+-- stringVoice+let pan = 0+ freq = 100+ trig = dust2Id 'α' kr 7+ infsustain = 0+ accent = tRandId 'β' 0 1 trig+ structure = tRandId 'γ' 0 1 trig+ brightness = tRandId 'δ' 0 0.5 trig+ damping = tRandId 'ε' 0.1 0.5 trig+ sig = X.stringVoice ar trig infsustain freq accent structure brightness damping+in pan2 sig pan 1++-- stringVoice ; event control+let f (_,g,x,y,z,o,rx,ry,_,_,_) =+ let freq = midiCps (x * 25 + 36)+ tr = trig g controlDur+ sig = X.stringVoice ar tr 0 freq z y rx (ry * 2)+ in pan2 sig (o * 2 - 1) 1+in mix (voicer 16 f) * control kr "gain" 1
+ Help/Ugen/sub.help.hs view
@@ -0,0 +1,10 @@+-- sub (-)+let o = fSinOsc ar 800 0+ n = pinkNoiseId 'α' ar+in (o - n) * 0.1++-- sub ; dc offset+fSinOsc ar 440 0 * 0.1 - 0.5++-- sub ; optimise identity+(sinOsc ar 440 0 - 0) * 0.1
+ Help/Ugen/subsampleOffset.help.hs view
@@ -0,0 +1,13 @@+-- subsampleOffset; impulse train that can be moved between samples+let i = impulse ar 2000 0+ z = 4+ o = (1 - subsampleOffset) + mouseX kr 0 (z - 1) Linear 0.1+ r = delayC i (sampleDur * z) (sampleDur * o)+in mrg2 (out 0 (pan2 i (-1) 0.1)) (offsetOut 0 (pan2 r 1 0.1))++---- ; drawings+UI.ui_sc3_scope 2 0 (2 ^ 14) 100 "audio" 0++{- Create two pulse trains and move one relative to the other. When+cursor is at the left, the impulses are adjacent, on the right, they+are z samples apart. View this with an oscilloscope. -}
+ Help/Ugen/sum3.help.hs view
@@ -0,0 +1,8 @@+-- sum3+sum3 (sinOsc ar 440 0) (sinOsc ar 441 0) (sinOsc ar 442 0) * 0.1++-- sum3 ; optimiser/re-writer applicable at ADD+(sinOsc ar 440 0 + sinOsc ar 441 0 + sinOsc ar 442 0) * 0.1++-- sum3+mix (sinOsc ar (mce [440 .. 442]) 0) * 0.1
+ Help/Ugen/sum4.help.hs view
@@ -0,0 +1,5 @@+-- sum4+sum4 (sinOsc ar 440 0) (sinOsc ar 441 0) (sinOsc ar 442 0) (sinOsc ar 443 0) * 0.1++-- sum4 ; optimiser/re-writer applicable at ADD+mix (sinOsc ar (mce [440 .. 443]) 0) * 0.1
+ Help/Ugen/sumSqr.help.hs view
@@ -0,0 +1,9 @@+-- sumSqr+let o1 = fSinOsc ar 800 0+ o2 = fSinOsc ar (xLine kr 200 500 5 DoNothing) 0+in sumSqr o1 o2 * 0.125++-- sumSqr ; written out+let o1 = fSinOsc ar 800 0+ o2 = fSinOsc ar (xLine kr 200 500 5 DoNothing) 0+in (o1 * o1 + o2 * o2) * 0.125
+ Help/Ugen/summer.help.hs view
@@ -0,0 +1,7 @@+-- summer+sinOsc ar (X.summer (impulse kr 5 0) 1.5 0 0 * 100) 0 * 0.1++-- summer+let s_trig = dustId 'α' kr 5+ s_reset = impulse kr 0.5 0+in sinOsc ar (X.summer s_trig (mce2 0.5 0.25) s_reset 1 * 100) 0 * 0.1
+ Help/Ugen/svf.help.hs view
@@ -0,0 +1,33 @@+-- svf ; state variable filter+let signal = lfSaw ar (range 110 35 (lfSaw kr 2 0)) 0+ cutoff = mouseX kr 20 20000 Exponential 0.2+ res = mouseY kr 1 0 Linear 0.2+ k = control kr+ low = k "low" 0.1+ band = k "band" 0.0+ high = k "high" 0.0+ notch = k "notch" 0.0+ peak_ = k "peak" 0.0+in X.svf signal cutoff res low band high notch peak_++-- svf ; event control+let f (c,g,x,y,z,o,rx,_,p,px,_) =+ let signal = lfSaw ar (midiCps (p * 127 + px)) 0+ cutoff = linExp x 0 1 20 20000+ res = y+ ty = constant c+ low = (ty + 0) `modE` 5 * z+ band = (ty + 1) `modE` 5 * z+ high = (ty + 2) `modE` 5 * z+ notch = (ty + 3) `modE` 5 * z+ peak_ = (ty + 4) `modE` 5 * z+ in pan2 (X.svf signal cutoff res low band high notch peak_) (o * 2 - 1) (lagUD g 0.1 (rx * 9))+in mix (voicer 16 f) * control kr "gain" 0.2++---- ; control edits+msg k v = withSc3 (Sound.OSC.sendMessage (n_set1 (-1) k v))+msg "low" 0.0+msg "band" 0.0+msg "high" 0.0+msg "notch" 0.0+msg "peak" 0.1
+ Help/Ugen/svfBp.help.hs view
@@ -0,0 +1,17 @@+-- svfBp ; changing F+let f = xLine kr 20 20000 20 DoNothing+in X.svfBp (whiteNoiseId 'α' ar * 0.1) f 1++-- svfBp ; changing Q+let q = line kr 10 0.0001 20 RemoveSynth+in X.svfBp (whiteNoiseId 'α' ar * 0.1) 400 q++-- svfBp ; controls+X.svfBp (saw ar 200 * control kr "amp" 0.1) (control kr "freq" 440) (control kr "q" 1)++-- svfBp+let f = sinOsc kr (xLine kr 0.7 300 20 RemoveSynth) 0 * 3600 + 4000+in X.svfBp (saw ar 200 * 0.1) f (control kr "q" 1)++---- ; drawings+Sound.Sc3.Plot.FFT.plot_ugen_fft1 0.05 (X.svfBp (whiteNoiseId 'α' ar) 900 1)
+ Help/Ugen/svfHp.help.hs view
@@ -0,0 +1,17 @@+-- svfHp ; changing F+let f = xLine kr 20000 20 20 RemoveSynth+in X.svfHp (whiteNoiseId 'α' ar * 0.1) f 1++-- svfHp ; changing Q+let q = line kr 2 0.0001 20 RemoveSynth+in X.svfHp (whiteNoiseId 'α' ar * 0.1) 12000 q++-- svfHp ; controls+X.svfHp (saw ar 200 * control kr "amp" 0.1) (control kr "freq" 440) (control kr "q" 1)++-- svfHp+let f = sinOsc kr (xLine kr 0.7 300 20 RemoveSynth) 0 * 3600 + 4000+in X.svfHp (saw ar 200 * 0.1) f (control kr "q" 1)++---- ; drawings+Sound.Sc3.Plot.FFT.plot_ugen_fft1 0.05 (X.svfHp (whiteNoiseId 'α' ar) 12000 1)
+ Help/Ugen/svfLp.help.hs view
@@ -0,0 +1,17 @@+-- svfLp ; changing F+let f = xLine kr 20 20000 20 RemoveSynth+in X.svfLp (whiteNoiseId 'α' ar * 0.1) f 1++-- svfLp ; changing Q+let q = line kr 2 0.0001 20 RemoveSynth+in X.svfLp (whiteNoiseId 'α' ar * 0.1) 400 q++-- svfLp ; controls+X.svfLp (saw ar 200 * control kr "amp" 0.1) (control kr "freq" 440) (control kr "q" 1)++-- svfLp+let f = sinOsc kr (xLine kr 0.7 300 20 RemoveSynth) 0 * 3600 + 4000+in X.svfLp (saw ar 200 * 0.1) f (control kr "q" 1)++---- ; drawings+Sound.Sc3.Plot.FFT.plot_ugen_fft1 0.05 (X.svfLp (whiteNoiseId 'α' ar) 900 1)
+ Help/Ugen/sweep.help.hs view
@@ -0,0 +1,54 @@+-- sweep ; using sweep to modulate sine frequency+let x = mouseX kr 0.5 20 Exponential 0.1+ t = impulse kr x 0+ f = sweep kr t 700 + 500+in sinOsc ar f 0 * 0.2++-- sweep ; using sweep to index into a buffer ; requires=buf+let (b, nc) = (control kr "buf" 100, 2)+ x = mouseX kr 0.5 20 Exponential 0.1+ t = impulse ar x 0+ p = sweep ar t (bufSampleRate kr b)+in bufRdL nc ar b p NoLoop++-- sweep ; backwards, variable offset ; requires=buf+let (b, nc) = (control kr "buf" 100, 2)+ n = lfNoise0Id 'α' kr 15+ x = mouseX kr 0.5 10 Exponential 0.1+ t = impulse ar x 0+ r = bufSampleRate kr b+ p = sweep ar t (negate r) + (bufFrames kr b * n)+in bufRdL nc ar b p NoLoop++-- sweep ; raising rate ; requires=buf+let (b, nc) = (control kr "buf" 100, 2)+ x = mouseX kr 0.5 10 Exponential 0.1+ t = impulse ar x 0+ r = sweep ar t 2 + 0.5+ p = sweep ar t (bufSampleRate kr b * r)+in bufRdL nc ar b p NoLoop++-- sweep ; f0 (sc-users, 2012-02-09)+let lf = range 0.01 1.25 (lfNoise2Id 'α' kr 1)+ du = duty ar lf 0 DoNothing lf+ tr = abs (hpz1 du) `greater_than` 0+ ph = sweep ar tr (1/du)+ fr = linExp ph 0 1 400 800+in sinOsc ar fr 0 * 0.2++-- sweep ; line segments, set start & end values, transition time and trigger, stops at end time+let tr = trigControl "tr" 1+ st = control kr "st" 440+ en = control kr "en" 880+ tm = control kr "tm" 2+ rt = ((en - st) / tm)+ sw = gate (sweep kr tr rt + st) (trig tr tm)+in sinOsc ar sw 0 * 0.2++---- ; send new line segments to running sweeper+withSc3 (Sound.Osc.sendMessage (n_set 1 [("st",660),("en",550),("tm",4),("tr",1)]))+withSc3 (Sound.Osc.sendMessage (n_set 1 [("st",110),("en",990),("tm",1),("tr",1)]))+withSc3 (Sound.Osc.sendMessage (n_set 1 [("tr",1)]))++---- ; buffer setup+withSc3 (async (b_allocRead 0 (sfResolve "pf-c5.aif") 0 0))
+ Help/Ugen/switchDelay.help.hs view
@@ -0,0 +1,10 @@+-- switchDelay ; simple feedback delay+X.switchDelay (soundIn 0) 1 1 1 0.99 20++-- switchDelay ; simple feedback delay+X.switchDelay (soundIn 0) 1 0.7 0.4 0.6 20++-- switchDelay ; change the buffer read pointer periodically.+let ix = stepper (impulse kr 0.5 0) 0 0 3 1 0+ dt = select ix (mce [0.02,0.1,0.725,0.25])+in X.switchDelay (soundIn 0) 1 0.6 dt 0.7 20
+ Help/Ugen/syncSaw.help.hs view
@@ -0,0 +1,8 @@+-- syncSaw+let f = line kr 100 800 12 RemoveSynth+in syncSaw ar 100 f * 0.1++-- syncSaw ; mouse control+let sy_f = mouseY kr 80 220 Exponential 0.2+ sw_f = sy_f * mouseX kr 1 3 Linear 0.2+in syncSaw ar sy_f sw_f * 0.1
+ Help/Ugen/t2a.help.hs view
@@ -0,0 +1,15 @@+-- t2a+let tr = impulse kr (mouseX kr 1 100 Exponential 0.2) 0+in ringz (t2a tr 0) 800 0.01 * 0.4++-- t2a ; compare with k2a (oscilloscope)+let tr = impulse kr 200 0+in lag (mce2 (t2a tr 0) (k2a tr)) 0.001++-- t2a ; removing jitter by randomising offset+let tr = impulse kr (mouseX kr 1 100 Exponential 0.2) 0+ o = range 0 (blockSize - 1) (whiteNoiseId 'α' kr)+in ringz (t2a tr o) 880 0.1 * 0.4++---- ; drawings+UI.ui_sc3_scope 2 0 (2 ^ 14) 0 "audio" 0
+ Help/Ugen/t2k.help.hs view
@@ -0,0 +1,2 @@+-- t2k+trig (t2k (dustId 'α' ar 4)) 0.1 * sinOsc ar 800 0 * 0.1
+ Help/Ugen/tBall.help.hs view
@@ -0,0 +1,19 @@+-- tBall ; x = step noise modulation rate ; y = gravity+let sf = lfNoise0Id 'α' ar (mouseX kr 0.5 100 Exponential 0.2)+ g = mouseY kr 0.01 10 Exponential 0.2+ t = tBall ar sf g 0.01 0.002+in ringz (t * 4) (mce2 600 645) 0.3++-- tBall ; x = sine modulation rate ; y = friction+let fr = mouseX kr 1 1000 Exponential 0.2+ h = mouseY kr 0.0001 0.001 Exponential 0.2+ g = lfNoise0Id 'α' kr 0.1 * 3 + 5+ f = tBall ar (sinOsc ar fr 0) g 0.01 h+in pan2 (ringz f 1400 0.04) 0 5++-- tBall ; x = friction ; y = gravity+let fr = linExp (sinOsc kr 0.1 0) (-1) 1 1 600+ h = mouseY kr 0.0001 0.001 Exponential 0.2+ g = mouseX kr 1 10 Exponential 0.2+ f = tBall ar (sinOsc ar fr 0) g 0.01 h+in pan2 (ringz f 1400 0.04) 0 5
+ Help/Ugen/tBetaRand.help.hs view
@@ -0,0 +1,17 @@+-- tBetaRand+let t = dustId 'α' kr 10+ f = X.tBetaRandId 'β' 300 3000 0.1 0.1 t+in sinOsc ar f 0 * 0.1++---- ; ERROR ; tBetaRand ; mouse control of parameters (...scsynth -> 100% CPU -> CRASH)+let t = dustId 'α' ar 10+ p1 = mouseX kr 1 5 Linear 0.2+ p2 = mouseY kr 1 5 Linear 0.2+ f = X.tBetaRandId 'β' 300 3000 p1 p2 t+in sinOsc ar f 0 * 0.1++---- ; ERROR ; audio rate crashes server+let t = dustId 'α' ar 100+ p1 = mouseX kr 1 5 Linear 0.2+ p2 = mouseY kr 1 5 Linear 0.2+in lag (X.tBetaRandId 'β' (-1) 1 p1 p2 t) (10 / 48000)
+ Help/Ugen/tBrownRand.help.hs view
@@ -0,0 +1,19 @@+-- tBrownRand+let t = dustId 'α' kr 10+ dist = mouseX kr 0 5 Linear 0.2+ f = X.tBrownRandId 'β' 300 3000 1 dist t+in sinOsc ar f 0 * 0.1++-- tBrownRand+let t = dustId 'α' kr 10+ n = X.tBrownRandId 'β' 0 1 0.2 0 t+ f = linExp n 0 1 300 3000+ o = sinOsc ar f 0+ l = X.tBrownRandId 'γ' (-1) 1 1 4 t+in pan2 o l 0.1++-- tBrownRand ; audio rate noise+let x = mouseX kr 500 5000 Exponential 0.2+ y = mouseY kr 10 500 Exponential 0.2+ t = dustId 'α' ar x+in lag (X.tBrownRandId 'β' (-1) 1 0.2 0 t) (y / 48000)
+ Help/Ugen/tChoose.help.hs view
@@ -0,0 +1,9 @@+-- tChoose ; composite of tiRand and select+let x = mouseX kr 1 1000 Exponential 0.1+ t = dustId 'a' ar x+ f = midiCps (tiRandId 'b' 48 60 t)+ o = let a = mce [sinOsc ar f 0+ ,saw ar (f * 2)+ ,pulse ar (f * 0.5) 0.1]+ in tChooseId 'c' t a+in o * 0.1
+ Help/Ugen/tDelay.help.hs view
@@ -0,0 +1,5 @@+-- tDelay+let z = impulse ar 2 0+ z' = tDelay z 0.5+ o = sinOsc ar 440 0 * 0.1+in mce [z * 0.1,toggleFF z' * o]
+ Help/Ugen/tDuty.help.hs view
@@ -0,0 +1,30 @@+-- tDuty ; rhythm+let d = dseqId 'α' dinf (mce [0.1, 0.2, 0.4, 0.3])+in tDuty ar d 0 DoNothing 1 0++-- tDuty ; amplitude changes+let d0 = dseqId 'α' dinf (mce [0.1, 0.2, 0.4, 0.3])+ d1 = dseqId 'β' dinf (mce [0.1, 0.4, 0.01, 0.5, 1.0])+in ringz (tDuty ar d0 0 DoNothing d1 1) 1000 0.1++-- tDuty ; mouse control+let d = dseqId 'α' dinf (mce [0.1, 0.4, 0.01, 0.5, 1.0])+ x = mouseX kr 0.003 1 Exponential 0.1+in ringz (tDuty ar x 0 DoNothing d 1) 1000 0.1 * 0.5++-- tDuty ; note that the 440 is the shorter pitch, since gap is set to false+let d0 = dserId 'α' 12 (mce [0.1, 0.3])+ d1 = dserId 'β' 12 (mce [440, 880])+ t = tDuty ar d0 0 RemoveSynth d1 0+in sinOsc ar (latch t t) 0 * 0.1++-- tDuty ; abstraction+let bp n d act = let (e,t) = unzip d+ mkId z l = dserId z n (mce l)+ sq = tDuty ar (mkId 'α' t) 0 act (mkId 'β' e) 0+ in latch sq sq+ bp' d = bp (genericLength d) d+ tm m = let f (e,t) = (e,t * m) in map f+ f1 = midiCps (bp 35 (tm 0.125 [(60,1),(63,1),(67,2),(68,1),(62,1)]) RemoveSynth)+ f2 = midiCps (bp' [(60,1),(63,0.5),(67,0.5),(68,1),(62,1)] DoNothing)+in sinOsc ar (mce2 f1 f2) 0 * 0.1
+ Help/Ugen/tExpRand.help.hs view
@@ -0,0 +1,8 @@+-- tExpRand+let f = tExpRandId 'α' 300.0 3000.0 (dustId 'β' kr 10)+in sinOsc ar f 0 * 0.1++-- tExpRand ; monadic form+uid_st_eval+ (do f <- tExpRandM 300.0 3000.0 =<< dustM kr 10+ return (sinOsc ar f 0 * 0.1))
+ Help/Ugen/tExpRandN.help.hs view
@@ -0,0 +1,4 @@+-- tExpRandN ; n sine tones, set to exponentially-distributed random frequencies on trigger+let n = 12+ tr = impulse kr 1 0+in splay (sinOsc ar (X.tExpRandNId n 'α' 440 880 tr) 0) 1 0.1 0 True
+ Help/Ugen/tGaussRand.help.hs view
@@ -0,0 +1,7 @@+-- tGaussRand ; c.f. tRand+let t = dustId 'α' kr 10+ f = X.tGaussRandId 'β' 300 3000 t+ o = sinOsc ar f 0+ l = X.tGaussRandId 'γ' (-1) 1 t+in pan2 o l 0.1+
+ Help/Ugen/tGrains.help.hs view
@@ -0,0 +1,74 @@+-- tGrains ; mouse control ; requires=buf+let b = control kr "buf" 100+ tRate = mouseY kr 2 200 Exponential 0.1+ ctr = mouseX kr 0 (bufDur kr b) Linear 0.1+ tr = impulse ar tRate 0+in tGrains 2 tr b 1 ctr (4 / tRate) 0 0.25 2++-- tGrains ; mouse control ; requires=buf+let b = control kr "buf" 100+ rt = mouseY kr 8 120 Exponential 0.1+ dur = 4 / rt+ clk = dustId 'α' ar rt+ r = tRandId 'β' 0 0.01 clk+ pan = whiteNoiseId 'γ' kr * 0.6+ x = mouseX kr 0 (bufDur kr b) Linear 0.1+ pos = x + r+in tGrains 2 clk b 1 pos dur pan 0.25 2++-- tGrains ; mouse control ; requires=buf+let b = control kr "buf" 100+ rt = mouseY kr 2 120 Exponential 0.1+ dur = 1.2 / rt+ clk = impulse ar rt 0+ pos = mouseX kr 0 (bufDur kr b) Linear 0.1+ n0 = whiteNoiseId 'α' kr+ n1 = whiteNoiseId 'β' kr+ rate = 1.2 ** (roundTo (n0 * 3) 1) -- or shiftLeft in place of **+in tGrains 2 clk b rate pos dur (n1 * 0.6) 0.25 2++-- tGrains ; demand UGens as inputs ; requires=buf+-- ; (Warning: empty sequence in Dseq - ServerId 'localhost' exited with exit code 0)+-- ; (also at sclang graph)+let b = control kr "buf" 100+ rt = mouseX kr 1 100 Exponential 0.2+ dId uid = dwhiteId uid 1 0.1 0.2+ zId u0 u1 u2 u3 u4 u5 u6 u7 = drandId u1 1 (mce [dgeomId u2 (diwhiteId u3 1 20 40) 0.1 (1 + dId u4)+ ,dgeomId u5 (diwhiteId u6 1 20 40) 1 (1 - dId u7)])+ clk = impulse ar rt 0+ dsqId e xs = dseqId e dinf (mce xs)+ rate = dsqId 'α' [1,1,zId 'β' 'γ' 'δ' 'ε' 'ζ' 'η' 'θ' 'ι',0.5,0.5,0.2,0.1,0.1,0.1,0.1] * 2 + 1+ pos = dsqId 'κ' (Protect.uclone_seq (const False) 'λ' 8 (zId 'μ' 'ν' 'ξ' 'ο' 'π' 'ρ' 'σ' 'τ'))+ dur = dsqId 'υ' [1,dId 'φ',1,zId 'χ' 'ψ' 'ω' 'Α' 'Β' 'Γ' 'Δ' 'Ε',0.5,0.5,0.1,zId 'Ζ' 'Η' 'Θ' 'Ι' 'Κ' 'Λ' 'Μ' 'Ν'] * 2 / rt+ pan = dsqId 'Ξ' [1,1,1,0.5,0.2,0.1,0,0,0] * 2 - 1+ amp = dsqId 'Ο' [1,0,zId 'Π' 'Ρ' 'Σ' 'Τ' 'Υ' 'Φ' 'Χ' 'Ψ',0,2,1,1,0.1,0.1]+in tGrains 2 clk b rate pos dur pan amp 2++-- tGrains ; sync oscillator ; requires=buf+-- ; http://sc-users.bham.ac.narkive.com/sj4Tw3ub/sync-osc#post5 (jmcc)+-- ; "A wavetable windowed sync oscillator could be written.+-- ; You can actually do a version of this with TGrains."+let b = control kr "buf" 100+ freq = 100+ dur = 2 / freq+ clk = impulse ar freq 0+ x = mouseX kr 0.5 16 Exponential 0.2+in tGrains 2 clk b x (0.3 * bufDur kr b) dur 0 0.1 2++-- tGrains ; requires=buf ; event control+let f (_,g,x,y,z,o,rx,ry,_,_,_) =+ let b = control kr "buf" 100+ tRate = linExp y 0 1 2 200+ ctr = x * bufDur kr b+ du = (ry * 8) / tRate+ tr = impulse ar (y * 60 + 10) 0+ in tGrains 2 tr b (1 + (rx * 0.5)) ctr du o (z * g) 4+in mix (voicer 16 f) * control kr "gain" 2++---- ; setup+ld fn = withSc3 (async (b_allocRead 0 (sfResolve fn) 0 0))+ld "instr/crotales/crotale05(D).wav"+ld "metal.wav" -- mono+ld "instr/celeste/long/22-A4-long.wav" -- mono+ld "instr/celeste/long/25-C5-long.wav" -- mono+ld "instr/celeste/long/37-C6-long.wav" -- mono
+ Help/Ugen/tLine.help.hs view
@@ -0,0 +1,5 @@+-- tLine ; start and end reset randomly every 4 seconds, ramp every trigger+let tr = impulse kr (1/4) 0+ f0 = tExpRandId 'α' 110 450 tr+ f1 = tExpRandId 'β' 110 440 tr+in splay (sinOsc ar (mce [f0,tLine kr f0 f1 4 tr,f1]) 0) 1 1 0 True * mce [0.05,0.1,0.05]
+ Help/Ugen/tRand.help.hs view
@@ -0,0 +1,22 @@+-- tRand+let t = dustId 'α' kr (mce2 5 12)+ f = tRandId 'β' (mce2 200 1600) (mce2 500 3000) t+in sinOsc ar f 0 * 0.1++-- tRand ; monadic variant+uid_st_eval (+ do t <- dustM kr (mce2 5 12)+ f <- tRandM (mce2 200 1600) (mce2 500 3000) t+ return (sinOsc ar f 0 * 0.1))++-- tRand ; c.f. X.tGaussRand+let t = dustId 'α' kr 10+ f = tRandId 'β' 300 3000 t+ o = sinOsc ar f 0+ l = tRandId 'γ' (-1) 1 t+in pan2 o l 0.1++-- tRand ; equal (sanity)+let t = dustId 'α' kr 1+ f = tRandId 'β' 120 240 t+in sinOsc ar (mce2 f f) 0 * 0.1
+ Help/Ugen/tRandN.help.hs view
@@ -0,0 +1,4 @@+-- tRandN ; n sine tones, set to uniform-random frequencies on trigger+let n = 12+ tr = impulse kr 1 0+in splay (sinOsc ar (X.tRandNId n 'α' 440 880 tr) 0) 1 0.1 0 True
+ Help/Ugen/tScramble.help.hs view
@@ -0,0 +1,8 @@+-- tScramble ; two channel sin tones, channels scramble on impulse, scramble may be identity+let tr = impulse kr 1 0+in sinOsc ar (X.tScrambleId 'α' tr (mce2 440 880)) 0 * 0.1++-- tScramble ; c-major sin tones across stereo field, scrambles on impulse+let tr = impulse kr 1 0+ f = X.tScrambleId 'α' tr (mce (map midiCps [60,62,64,65,67,69,71,72]))+in splay (sinOsc ar f 0 * 0.1) 1 1 0 True
+ Help/Ugen/tWindex.help.hs view
@@ -0,0 +1,13 @@+-- tWindex+let p = mce [1/5, 2/5, 2/5]+ a = mce [400, 500, 600]+ t = impulse kr 6 0+ i = tWindexId 'α' t 0 p+in sinOsc ar (select i a) 0 * 0.1++-- tWindex ; modulating probability values+let p = mce [1/4, 1/2, sinOsc kr 0.3 0 * 0.5 + 0.5]+ a = mce [400, 500, 600]+ t = impulse kr 6 0+ i = tWindexId 'α' t 1 p+in sinOsc ar (select i a) 0 * 0.1
+ Help/Ugen/tXLine.help.hs view
@@ -0,0 +1,5 @@+-- tXLine ; start and end reset randomly every 4 seconds, ramp every trigger+let tr = impulse kr (1/4) 0+ f0 = tExpRandId 'α' 110 450 tr+ f1 = tExpRandId 'β' 110 440 tr+in splay (sinOsc ar (mce [f0,tXLine kr f0 f1 4 tr,f1]) 0) 1 1 0 True * mce [0.05,0.1,0.05]
+ Help/Ugen/tan.help.hs view
@@ -0,0 +1,3 @@+---- ; drawings+Sound.Sc3.is_unary Sound.Sc3.Common.Base.CS "Tan"+Sound.Sc3.Plot.plot_fn_r1_ln (Sound.Sc3.clip_hs (-6,6) . tan) (0,2 * pi)
+ Help/Ugen/tanh.help.hs view
@@ -0,0 +1,8 @@+-- tanh+let e = xLine kr 0.1 10 10 DoNothing+ o = fSinOsc ar 500 0.0+in tanh (o * e) * 0.25++---- ; drawings+Sound.Sc3.is_unary Sound.Sc3.Common.Base.CS "TanH"+Sound.Sc3.Plot.plot_fn_r1_ln tanh (-4,4)
+ Help/Ugen/tap.help.hs view
@@ -0,0 +1,6 @@+-- tap+let b = clearBuf (localBufId 'α' 1 48000) -- sample-rate+ src = soundIn 0 -- use headphones+ put = bufWr b (phasor ar 0 1 0 (bufFrames kr b) 1) Loop src+ get = tap 1 ar b (mce2 0.1 0.9)+in mrg2 get put
+ Help/Ugen/tartini.help.hs view
@@ -0,0 +1,24 @@+-- tartini ; comparison of input frequency (x) and tracked oscillator frequency (f).+let x = mouseX kr 440 880 Exponential 0.1+ o = lfSaw ar x 0 * 0.05 {- sinOsc ar x 0 * 0.1 -}+ [f,_e] = mceChannels (X.tartini kr o 0.2 2048 0 1024 0.5)+ r = sinOsc ar f 0 * 0.1+ t = impulse kr 4 0+ pf = poll t f 0 (label "f")+ px = poll t x 0 (label "x")+in mrg [out 0 (mce2 o r),pf,px]++-- tartini ; test live pitch tracking, not careful with amplitude of input+let z = hpf (soundIn 0) 90+ [f,e] = mceChannels (X.tartini kr z 0.2 2048 0 1024 0.5)+in mce2 (z * 0.1) (lfTri ar f 0 * 0.2 * lag e 0.2 * lag (f >** 90 * f <** 500) 0.2)++-- tartini ; printer for pitch tracker+let i = soundIn 0+ [f,_e] = mceChannels (X.tartini kr i 0.2 2048 0 1024 0.5)+ r = sinOsc ar f 0 * 0.1+ t = impulse kr 4 0+ pf = poll t f 0 (label "f")+in mrg [out 0 (mce2 i r),pf]++---- ; ZELL = C4 - C5 = 247 259 277 295 309 331 345 369 387 415 441 462 493 (hz)
+ Help/Ugen/thresh.help.hs view
@@ -0,0 +1,2 @@+-- thresh+(lfNoise0Id 'α' ar 50 * 0.15) `thresh` 0.1
+ Help/Ugen/tiRand.help.hs view
@@ -0,0 +1,15 @@+-- tiRand+let l = tiRandId 'α' (-1) 1 (dustId 'β' kr 10)+in pan2 (pinkNoiseId 'γ' ar * 0.1) l 1++-- tiRand ; monadic variant+uid_st_eval+ (do l <- tiRandM (-1) 1 =<< dustM kr 10+ n <- pinkNoiseM ar+ return (pan2 (n * 0.1) l 1))++-- tiRand ; osc frequency+uid_st_eval+ (do n <- tiRandM 4 12 =<< dustM kr 10+ let f = n * 150 + (mce [0,1])+ return (sinOsc ar f 0 * 0.1))
+ Help/Ugen/timer.help.hs view
@@ -0,0 +1,3 @@+-- timer+let t = impulse kr (mouseX kr 0.5 20 Exponential 0.1) 0+in sinOsc ar (timer t * 500 + 500) 0 * 0.2
+ Help/Ugen/toggleFF.help.hs view
@@ -0,0 +1,4 @@+-- toggleFF ; c.f. setResetFF+let tr = dustId 'α' ar (xLine kr 1 1000 60 DoNothing)+ fr = toggleFF tr * 400 + 800+in sinOsc ar fr 0 * 0.1
+ Help/Ugen/trig.help.hs view
@@ -0,0 +1,8 @@+-- trig+let d = dustId 'α' ar 1+ o = fSinOsc ar 800 0 * 0.5+in o * trig d 0.2++-- trig ; if duration is set to zero it is reset to one frame (at ar & kr) ; 3.11.2+let env = decay2 (trig (mce2 (sinOsc kr 10 0 * 10) (sinOsc ar 9 0 * 1000)) 0) 0.01 0.2+in sinOsc ar (mce2 440 441) 0 * env * 0.1
+ Help/Ugen/trig1.help.hs view
@@ -0,0 +1,11 @@+-- trig1 ; timed gate, duration in seconds+let d = dustId 'α' ar 1+ o = fSinOsc ar 800 0 * 0.1+in o * trig1 d 1.25++-- trig1+sinOsc ar 440 0 * trig1 (impulse kr 10 0) 0.1 * 0.1++-- trig1 ; if duration is set to zero it is reset to one frame (at ar & kr) ; 3.11.2+let env = decay2 (trig1 (mce2 (sinOsc kr 10 0) (sinOsc ar 9 0)) 0) 0.01 0.2+in sinOsc ar (mce2 440 441) 0 * env * 0.1
+ Help/Ugen/trigAvg.help.hs view
@@ -0,0 +1,9 @@+-- trigAvg+let x = mouseX kr 0 1000 Linear 0.2+ b = mouseButton kr 0 1 0.2+ n = X.trigAvg kr (roundTo x 100) b+in sinOsc ar n 0 * 0.1++-- trigAvg+let n = X.trigAvg kr (sinOsc ar 0.1 0) (impulse kr 0.2 0)+in sinOsc ar 220 0 * n * 0.25
+ Help/Ugen/trigControl.help.hs view
@@ -0,0 +1,7 @@+-- trigControl ; graph with the three types of non-audio controls ; trigger controls are drawn cyan+let freq = control kr "freq" 440+ phase = control ir "phase" 0+ gate' = trigControl "gate" 1+ amp = control kr "amp" 0.1+ e = envGen kr gate' amp 0 1 DoNothing (envAsr 0.01 1 1 EnvLin)+in sinOsc ar freq phase * e
+ Help/Ugen/twChoose.help.hs view
@@ -0,0 +1,9 @@+-- tWChoose ; composite of tWindex and select+let x = mouseX kr 1 1000 Exponential 0.1+ d = dustId 'α' ar x+ a = mce [sinOsc ar 220 0+ ,saw ar 440+ ,pulse ar 110 0.1]+ w = mce [0.5, 0.35, 0.15]+ o = tWChooseId 'β' d a w 0+in o * 0.1
+ Help/Ugen/twoPole.help.hs view
@@ -0,0 +1,7 @@+-- twoPole+let n = whiteNoiseId 'α' ar in twoPole (n * 0.005) 2000 0.95++-- twoPole+let n = whiteNoiseId 'α' ar+ f = xLine kr 800 8000 8 RemoveSynth+in twoPole (n * 0.005) f 0.95
+ Help/Ugen/twoTube.help.hs view
@@ -0,0 +1,20 @@+-- twoTube+let dly1 = 100+ dly2 = 40+ env = envelope [1,1,0] [(dly1 + dly2) / sampleRate,0.0] [EnvLin]+ x = mouseX kr (-1) 1 Linear 0.2+ y = mouseY kr 1 4 Linear 0.2+ src = whiteNoiseId 'α' ar * envGen ar (impulse kr y 0) 1 0 1 DoNothing env+in X.twoTube ar src x 0.99 dly1 dly2 * 0.5++-- twoTube+let tr = impulse kr (mouseX kr 1 16 Linear 0.2) 0+ dly1 = tRandId 'α' 1 300 tr+ dly2 = tRandId 'β' 1 300 tr+ loss = tRandId 'γ' 0.9 0.999 tr+ dur = tRandId 'δ' 0.1 5 tr+ pan = tRandId 'ε' (-1) 1 tr+ k = tRandId 'ζ' (-1) 1 tr+ env = envelope [1,1,0,0] [(dly1 + dly2) / sampleRate,0,1] [EnvLin]+ src = whiteNoiseId 'η' ar * envGen ar tr 1 0 1 DoNothing env+in pan2 (X.twoTube ar src k loss dly1 dly2) pan (mouseY kr 0.1 0.4 Exponential 0.2)
+ Help/Ugen/twoZero.help.hs view
@@ -0,0 +1,4 @@+-- twoZero+let n = whiteNoiseId 'α' ar * 0.1+ f = xLine kr 20 20000 8 RemoveSynth+in twoZero (n * 0.125) f 1
+ Help/Ugen/vDiskIn.help.hs view
@@ -0,0 +1,10 @@+-- vDiskIn+let b = control kr "buf" 0+ nc = 2+in vDiskIn nc 0 (sinOsc kr 0.25 0 * 0.25 + 1) Loop 0++---- ; allocate and read file, leave open+let fn = sfResolve "pf-c5.aif"+let nc = sfNumChannels fn+withSc3 (mapM_ async [b_alloc 0 8192 nc,b_read 0 fn 0 (-1) 0 True])+
+ Help/Ugen/vOsc.help.hs view
@@ -0,0 +1,18 @@+-- vOsc ; oscillator at eight consecutive wavetable buffers, mouse selects ; requires=tbl+let n = 8+ b = control kr "tbl" 0+ x = mouseX kr b (b + n - 1) Linear 0.1+ y = mouseY kr 0.01 0.2 Exponential 0.2+in vOsc ar x (mce [120, 121]) 0 * y++---- ; setup ; allocate and fill tables 0 to 7+gen_harm i = let {square a = a * a ; n = square (fromIntegral i + 1) ; f j = square ((n - j) / n) } in map f [0 .. n - 1]+gen_setup i = [b_alloc i 1024 1,b_gen_sine1 i [Normalise,Wavetable,Clear] (gen_harm i)]+withSc3 (mapM_ maybe_async (concatMap gen_setup [0 .. 7]))++---- ; drawings+Sound.Sc3.Plot.plot_p1_imp [gen_harm 7]++---- ; setup ; reallocate buffers while oscillator is running+resetTable i = do {h <- Sound.Sc3.Lang.Random.IO.nrrand 12 0 1; Sound.OSC.sendMessage (b_gen_sine1 i [Normalise,Wavetable,Clear] h)}+withSc3 (mapM_ resetTable [0 .. 7])
+ Help/Ugen/vOsc3.help.hs view
@@ -0,0 +1,19 @@+-- vOsc3 ; mouse selects buffer and set amplitude ; see vOsc help for setup+let n = 8+ b = control kr "tbl" 0+ x = mouseX kr b (b + n - 1) Linear 0.1+ y = mouseY kr 0.01 0.2 Exponential 0.2+ o1 = vOsc3 ar x 120 121 129+ o2 = vOsc3 ar x 119 123 127+in mce2 o1 o2 * y++-- vOsc3 ; event control ; see vOsc help for setup+let f (_,g,_,y,z,_,_,_,p,_,_) =+ let n = 8+ f0 = unitCps p+ b = control kr "tbl" 0+ pos = linLin y 0 1 b (b + n - 1)+ o1 = vOsc3 ar pos f0 (f0 + 1) (f0 + 9)+ o2 = vOsc3 ar pos (f0 - 1) (f0 + 3) (f0 + 4)+ in mce2 o1 o2 * g * z+in mix (voicer 16 f) * control kr "gain" 0.25
+ Help/Ugen/varLag.help.hs view
@@ -0,0 +1,4 @@+-- varLag ; the varLag UGen is not working ; there is varLag_env instead+let sqr = linLin (lfPulse kr 1 0 0.5) 0 1 100 400+ crv = varLag_env sqr 0.2 (EnvNum (line kr (-8) 8 15 RemoveSynth)) Nothing+in sinOsc ar crv 0 * 0.3
+ Help/Ugen/varSaw.help.hs view
@@ -0,0 +1,43 @@+-- varSaw+let x = mouseX kr 0 1 Linear 0.2 in varSaw ar 220 0 x * 0.1++-- varSaw+let f = lfPulse kr (mce2 3 3.03) 0 0.3 * 200 + 200+ w = linLin (lfTri kr 1 0) (-1) 1 0 1+in varSaw ar f 0 w * 0.1++-- varSaw ; compare with lfPulse at ar+let f = lfPulse kr 3 0 0.3 * 200 + 200+in mce [varSaw ar f 0 0.2+ ,lfPulse ar f 0 0.2] * 0.1++-- varSaw ; per-note width modulation+let d = linLin (lfNoise2Id 'α' kr 0.1) (-1) 1 0.05 0.5+ t = impulse ar (1 / d) 0+ w0 = tRandId 'β' 0 0.35 t+ w1 = tRandId 'γ' 0.65 1 t+ w = phasor ar t ((w1 - w0) * sampleDur) w0 w1 0+ e = decay2 t 0.1 d+ f = midiCps (tRandId 'δ' 36 72 t)+ o = varSaw ar f 0 w * e * 0.1+ l = tRandId 'ε' (-1) 1 t+in pan2 o l 1++-- varSaw ; http://sc-users.bham.ac.narkive.com/sj4Tw3ub/sync-osc#post6+let freq = control kr "freq" 110+ factor = control kr "factor" 1+ x = mouseX kr 0 1.0 Linear 0.2+ y = mouseY kr (mce2 23 17) 0 Linear 0.2+ t = impulse kr 0.5 0+ ph = varSaw ar (freq * factor * tChooseId 'α' t (mce [0.125,0.5,1.3,1.5,23.0])) 0 x * y+in sinOsc ar (freq * mce2 1.001 1) ph * 0.1++-- varSaw ; slow indeterminate modulation of width, http://sccode.org/1-5as+let midinote = 60+ gate_ = 1+ amp = 0.25+ asr = envAsr 0.1 1 0.1 (EnvNum (-4))+ env = envGen kr gate_ 1 0 1 RemoveSynth asr+ freq = midiCps midinote+ width = range 0.2 0.8 (lfNoise2Id 'α' kr 1) * range 0.7 0.8 (sinOsc kr 5 (randId 'β' 0.0 1.0))+in varSaw ar freq 0 width * env * amp
+ Help/Ugen/varShapeOsc.help.hs view
@@ -0,0 +1,9 @@+-- varShapeOsc+let modulator = sinOsc kr (lfNoise2Id 'a' kr 4 * 10) 0+ freq = 100+ pw = sinOsc kr 0.01 0 `in_range` (0,1)+ waveshape = lag modulator 0.1 `in_range` (0,1)+ sync_ = 1+ syncfreq = 182+ sig = X.varShapeOsc ar freq pw waveshape sync_ syncfreq+in pan2 sig modulator 0.1
+ Help/Ugen/vbFourses.help.hs view
@@ -0,0 +1,24 @@+-- vbFourses ; a simple triangle wave ; supplying only one freq pair+let freqs = mce [150, 150]+ src = X.vbFourses ar 0.5 freqs+in leakDC (mceChannel 0 src) 0.995 * 0.4++-- vbFourses ; feeding it an array of frequencies ; mix to stereo+let freqs = mceFillInt 8 (\z -> randId z 1 500)+ src = X.vbFourses ar 0.1 freqs+in mixTo 2 (leakDC src 0.995 * 0.3)++-- vbFourses ; modulate inputs ; splay+let freqs = lfNoise0Id 'α' ar (mce [4, 3, 2, 1, 1, 2, 3, 4]) `in_range` (1,1200)+ src = X.vbFourses ar 0.7 freqs+in splay (leakDC src 0.995) 1 0.3 0 True++-- vbFourses ; smoothing is an i-Rate input+let w = lfPulse ar 1 0 0.5 * 100 + 100+ freqs = mce [w, 200]+ src = X.vbFourses ar 0.9 freqs -- mouseX kr 0.4 0.9 Linear 0.1+in leakDC (mceChannel 0 src) 0.995 * 0.4++---- ; drawings+import Sound.Sc3.Plot {- hsc3-plot -}+plot_ugen_nrt (48000,64) 1 (X.vbFourses ar 0.5 (mce [800, 30, 710, 3, 10, 1, 7, 11]))
+ Help/Ugen/vbJonVerb.help.hs view
@@ -0,0 +1,15 @@+-- vbJonVerb ; default param+X.vbJonVerb (dust ar 2) 0.7 0.3 0.8 0.5 0.5++-- vbJonVerb+let freq = mce (map (* 1000) [1,2.1,2.9])+ src = mix (resonz (mixFill 3 (\_ -> dust ar 0.25)) freq 0.01) * 10+in X.vbJonVerb src 0.8 0.3 0.8 0.1 0.5 + src++-- vbJonVerb ; default param ; id+X.vbJonVerb (dustId 'α' ar 2) 0.7 0.3 0.8 0.5 0.5++-- vbJonVerb ; id+let freq = mce (map (* 1000) [1,2.1,2.9])+ src = mix (resonz (mixFill 3 (\z -> dustId (z::Int) ar 0.25)) freq 0.01) * 10+in X.vbJonVerb src 0.8 0.3 0.8 0.1 0.5 + src
+ Help/Ugen/vbSlide.help.hs view
@@ -0,0 +1,10 @@+-- vbSlide+let src = lfNoise0Id 'α' ar 3 `in_range` (0,1)+ flt = X.vbSlide src 500 1500+ gen x = sinOsc ar (midiCps (x `in_range` (30,80))) 0 * 0.1+in mce2 (gen flt) (gen src)++---- ; drawings+import Sound.Sc3.Plot {- hsc3-plot -}+plot_ugen_nrt (48000,64) 0.07 (let src = lfPulse ar 10 0 0.2 in mce2 src (X.vbSlide src 100 500))+
+ Help/Ugen/vibrato.help.hs view
@@ -0,0 +1,24 @@+-- vibrato ; at 1 Hz, note the use of DC.ar+let v = vibratoId 'α' ar (dc ar 400) 1 0.02 0 0 0.04 0.1 0 0+in sinOsc ar v 0 * 0.1++-- vibrato ; compare, k-rate freq input can be a constant+let v = vibratoId 'α' kr 400 1 0.02 0 0 0.04 0.1 0 0+in sinOsc ar v 0 * 0.1++-- vibrato ; control rate and rateVariation+let x = mouseX kr 2 100 Linear 0.2+ y = mouseY kr 0 1 Linear 0.2+ v = vibratoId 'α' ar (dc ar 400) x 0.1 1 1 y 0.1 0 0+in sinOsc ar v 0 * 0.1++-- vibrato ; control depth and depthVariation+let n = lfNoise1Id 'α' kr 1 * 3 + 7+ x = mouseX kr 0 1 Linear 0.2+ y = mouseY kr 0 1 Linear 0.2+ v = vibratoId 'β' ar (dc ar 400) n x 1 1 y 0.1 0 0+in sinOsc ar v 0 * 0.1++-- vibrato ; mce+let v = vibratoId 'α' ar (dc ar (mce2 (mce2 411 440) (mce2 419 440.5))) 1 0.02 0 0 0.04 0.1 0 0+in mix (sinOsc ar v 0 * 0.1)
+ Help/Ugen/vosim.help.hs view
@@ -0,0 +1,33 @@+-- vosim+let trg = impulse ar 100 0+ frq = mouseX kr 440 880 Exponential 0.2+ n_cycles = 3+ dcy = 0.1+in X.vosim ar trg frq n_cycles dcy * 0.25++-- vosim+let p = tRandId 'α' 0 1 (impulse ar 6 0)+ f0 = linLin (lfNoise2Id 'β' kr 4) (-1) 1 3 9+ t = impulse ar (f0 * (1 + (p `greater_than` 0.95))) 0+ x = mouseX kr 0.25 2 Linear 0.2+ y = mouseY kr 0.25 0.75 Linear 0.2+ z = 9+ rng i = linLin i (-1) 1+ mk_nId e = rng (lfNoise2Id e kr z) 0.25 2+ tRId e ll rl = tRandId e (mce ll) (mce rl)+ f = tRId 'γ' [40,120,220] [440,990,880] t+ n = tRId 'δ' [4] [8,16,32] t+ d = tRId 'ε' [0.2,0.4,0.6] [0.6,0.8,1] t+ a = tRId 'ζ' [0] [0.05,0.15,0.25] t+ l = tRId 'η' [-1] [1] t+ xn = mk_nId 'θ'+ yn = mk_nId 'ι'+ v = X.vosim ar t (f * x * xn) n (d * y * yn) * a+in pan2 (mix v) l 1++-- vosim ; event control+let f (_,g,_,y,z,o,rx,_,p,_,_) =+ let trg = impulse ar (unitCps p) 0+ frq = linExp y 0 1 440 880+ in pan2 (X.vosim ar trg frq 1 rx) (o * 2 - 1) (g * z)+in mix (voicer 16 f) * control kr "gain" 1
+ Help/Ugen/vosimOsc.help.hs view
@@ -0,0 +1,15 @@+-- vosimOsc+let freq = sinOsc kr (sinOsc kr 0.01 0) 0 `in_exprange` (10,800)+ form1freq = sinOsc kr (mce2 0.5 0.1) 0 `in_exprange` (100,1000)+ form2freq = sinOsc kr 0.39 0 `in_exprange` (100,1000)+ shape = sinOsc kr 10 0+in X.vosimOsc ar freq form1freq form2freq shape * 0.1++-- vosimOsc ; event control+let f (_,g,x,y,z,o,rx,ry,_,_,_) =+ let freq = x * 40 + 10+ form1freq = y * 900 + 100+ form2freq = rx * 900 + 100+ shape = ry+ in pan2 (X.vosimOsc ar freq form1freq form2freq shape) (o * 2 - 1) (g * z)+in mix (voicer 16 f) * control kr "gain" 1
+ Help/Ugen/warp1.help.hs view
@@ -0,0 +1,33 @@+-- warp1 ; requires=buf ; interp=2=linear ; nc=2+let (b, nc) = (control kr "buf" 100, 2)+ p = linLin (lfSaw kr 0.05 0) (-1) 1 0 1+ x = mouseX kr 0.5 2 Linear 0.1+in warp1 nc b p x 0.1 (-1) 8 0.1 2 * 0.5++-- warp1 ; real-time (delayed) input, localBuf+let sz = 8192+ b = clearBuf (localBufId 'α' 1 sz)+ i = soundIn 0+ r = recordBuf ar b 0 1 0 1 Loop 1 DoNothing i+ ph = (sz / sampleRate) * 2 * pi+ p = lfSaw kr (1 / bufDur kr b) ph * 0.5 + 0.5+ x = mouseX kr 0.5 2 Linear 0.2+ y = mouseY kr 0.01 0.2 Linear 0.2+ w = warp1 1 b p x 0.1 (-1) 8 y 4+in mrg2 (i + w) r++-- warp1 ; requires=buf ; event control+let f (_,g,x,y,z,o,rx,ry,_,_,_) =+ let b = control kr "buf" 100+ p = linLin (lfSaw kr 0.05 0) (-1) 1 0 1+ dur = linLin y 0 1 0.01 0.2+ freqScale = linLin ry 0 1 0.75 1.25+ ol = linLin rx 0 1 2 16+ in pan2 (warp1 1 b x freqScale dur (-1) ol (ry * 0.75) 2) (o * 2 - 1) (z * g)+in mix (voicer 16 f) * control kr "gain" 2++---- ; setup+ld fn = withSc3 (async (b_allocRead 0 (sfResolve fn) 0 0))+ld "pf-c5.aif" -- stereo+ld "instr/celeste/long/13-C4-long.wav" -- mono+ld "instr/celeste/long/25-C5-long.wav" -- mono
+ Help/Ugen/weaklyNonlinear2.help.hs view
@@ -0,0 +1,21 @@+-- weaklyNonlinear2 ; mouseY controls input strength of forcing oscillator+let input = saw ar 261.626 * mouseY kr 0.0001 1 Exponential 0.1+ freq = mouseX kr 100 400 Linear 0.1+in pan2 (X.weaklyNonlinear2 ar input 0 1 1 freq 0 0 0 0 0 0) 0 0.1++-- weaklyNonlinear2 ; van der Pol equation+let input = sinOsc ar (mouseX kr 10 2000 Linear 0.1) 0 * 0.1+ reset = impulse kr (mouseY kr 0 100 Linear 0.1) 0+in pan2 (X.weaklyNonlinear2 ar input reset 1 1 440 0 0 (-0.01) 2 (-1) 1) 0 0.1++-- weaklyNonlinear2 ; duffing equation+let input = sinOsc ar (mouseX kr 1 1000 Exponential 0.1) 0 * 0.1+ freq = mouseY kr 1 1000 Exponential 0.1+in pan2 (X.weaklyNonlinear2 ar input 0 1 1 freq 0 0 (-0.001) 3 0 0) 0 0.1++-- weaklyNonlinear2 ; event control+let f (_,g,x,y,z,o,_,_,_,_,_) =+ let input = saw ar 261.626 * linExp y 0 1 0.0001 1+ freq = x * 300 + 100+ in pan2 (X.weaklyNonlinear2 ar input 0 1 1 freq 0 0 0 0 0 0) (o * 2 - 1) (z * g)+in mix (voicer 16 f) * control kr "gain" 0.5
+ Help/Ugen/whiteNoise.help.hs view
@@ -0,0 +1,70 @@+-- whiteNoise+let n = whiteNoiseId 'α' ar * 0.05 in mce2 n n++-- whiteNoise ; monad constructor+uid_st_eval (fmap (* 0.05) (whiteNoiseM ar))++-- whiteNoise ; random filtered noise bursts+let n = whiteNoiseId 'α' ar+ t = dustId 'β' ar (mce [3, 7])+ f = tExpRandId 'γ' 20 1800 t+ bw = tExpRandId 'δ' 0.001 1 t+ e = decay2 t 0.01 0.2+in resonz (n * e) f bw++-- whiteNoise ; monadic form+uid_st_eval (do+ n <- whiteNoiseM ar+ t <- dustM ar (mce [3, 7])+ f <- tExpRandM 20 1800 t+ bw <- tExpRandM 0.001 1 t+ let e = decay2 t 0.01 0.2+ return (resonz (n * e) f bw))++-- whiteNoise ; monadic form, without using do notation+uid_st_eval (+ whiteNoiseM ar >>= \n ->+ dustM ar (mce [3, 7]) >>= \t ->+ tExpRandM 20 1800 t >>= \f ->+ tExpRandM 0.001 1 t >>= \bw ->+ let e = decay2 t 0.01 0.2+ in return (resonz (n * e) f bw))++-- whiteNoise ; speaker balance+let n = whiteNoiseId 'α' ar * 0.1 in mce2 n n++-- whiteNoise ; speaker balance+let x = mouseX kr 0.1 2 Linear 0.2+ y = mouseY kr (-90) (-30) Linear 0.2+ l = sinOsc kr x 0+ n = whiteNoiseId 'α' ar+in pan2 n l (dbAmp y)++-- whiteNoise ; hpz1+hpz1 (whiteNoiseId 'α' ar * 0.01)++-- whiteNoise ; frequency control+sinOsc ar (whiteNoiseId 'α' kr * 300 + 500) 0 * 0.1++-- whiteNoise ; monad constructor ; clone+uid_st_eval (fmap ((* mce [0.02,0.04]) . mce) (replicateM 2 (whiteNoiseM ar)))++-- whiteNoiseM ; Control.Monad.ap+uid_st_eval+(do x <- return (-) `ap` whiteNoiseM ar `ap` whiteNoiseM ar+ return (x * 0.05))++-- white noise ; noise+(whiteNoise ar - whiteNoise ar) * 0.05++-- whiteNoise ; silence+let n = whiteNoise ar in (n - n) * 0.05++-- whitenoise ; violetnoise (one point difference)+hpz1 (whiteNoiseId 'α' ar) * 0.1++---- ; drawings+Sound.Sc3.Plot.plot_ugen1 0.01 (whiteNoiseId 'γ' ar)+Sound.Sc3.Plot.plot_ugen1 0.05 (lpf (whiteNoiseId 'γ' ar) 500)+Sound.Sc3.Plot.FFT.plot_ugen_fft1 0.1 (whiteNoiseId 'α' ar)+UI.ui_sc3_scope_freq (600,400) 0
+ Help/Ugen/wrap.help.hs view
@@ -0,0 +1,6 @@+-- wrap ; ln 2021-04-15 https://lukasnowok.github.io/spectrology/+let s = sinOsc ar (sinOsc ar (1 / 40) 0 * 100 + 20000) 0+in wrap s (xLine ar (-1.0) (-0.01) 20 DoNothing) 1 * 0.1++---- ; drawings+UI.ui_baudline 4096 50 "linear" 2
+ Help/Ugen/wrap2.help.hs view
@@ -0,0 +1,2 @@+-- c.f. sc3_wrap_ni+wrap2 (fSinOsc ar 1000 0) (line kr 0 1.01 8 DoNothing) * 0.1
+ Help/Ugen/wrapIndex.help.hs view
@@ -0,0 +1,5 @@+-- wrapIndex ; c.f. index+let b = asLocalBufId 'α' [200,300,400,500,600,800]+ x = mouseX kr 0 18 Linear 0.1+ f = wrapIndex b x+in sinOsc ar f 0 * 0.1
+ Help/Ugen/xFade2.help.hs view
@@ -0,0 +1,2 @@+-- xFade2 ; c.f. linXFade2+xFade2 (saw ar 440) (sinOsc ar 440 0) (lfTri kr 0.1 0) 0.1
+ Help/Ugen/xLine.help.hs view
@@ -0,0 +1,3 @@+-- xLine ; sc3 reorders mul and add inputs to precede the doneAction input+let f = xLine kr 200 17000 10 RemoveSynth+in sinOsc ar f 0 * 0.1
+ Help/Ugen/xOut.help.hs view
@@ -0,0 +1,8 @@+-- xOut ; send signal to a bus, crossfading with existing contents+let p a b = sinOsc ar (mce2 a b) 0 * 0.1+ x = mouseX kr 0 1 Linear 0.1+ y = mouseY kr 0 1 Linear 0.1+in mrg [out 0 (p 220 221)+ ,xOut 0 x (p 330 331)+ ,xOut 0 y (p 440 441)+ ,out 0 (p 120 121)]
+ Help/Ugen/zOsc.help.hs view
@@ -0,0 +1,8 @@+-- zOsc+let modulator = sinOsc kr 0.1 0+ freq = lfNoise2Id 'α' kr 10 `in_exprange` (10,1000)+ formantfreq = lfNoise2Id 'β' kr 1 `in_exprange` (700,1500)+ shape = modulator+ mode = sinOsc kr 0.91 0+ sig = X.zOsc ar freq formantfreq shape mode+in pan2 sig modulator 0.1
+ Help/Ugen/zeroCrossing.help.hs view
@@ -0,0 +1,7 @@+-- zeroCrossing+let a = sinOsc ar (sinOsc kr 1 0 * 600 + 700) 0 * 0.1+in mce [a, impulse ar (zeroCrossing a) 0 * 0.25]++-- zeroCrossing+let a = soundIn 0+in mce [a, sinOsc ar (zeroCrossing a) 0 * 0.1]
+ Help/Ugen/zitaRev.help.hs view
@@ -0,0 +1,37 @@+-- zitaRev ; http://kokkinizita.linuxaudio.org/linuxaudio/zita-rev1-doc/quickguide.html+let i = soundIn 0+ in_delay = 60+ eq1_freq = 315+ eq2_freq = 1500+ dry_wet_mix = 0.5+ level = 0+in X.zitaRev i i in_delay 200 3 2 6000 eq1_freq 0 eq2_freq 0 dry_wet_mix level++-- zitaRev ; longer+let i = soundIn 0+ in_delay = 80+ low_rt60 = 6+ mid_rt60 = 4+ eq1_freq = 190+ eq1_level = -6+ eq2_freq = 3500+ eq2_level = 6+ dry_wet_mix = 0+ level = 0+in X.zitaRev i i in_delay 200 low_rt60 mid_rt60 6000 eq1_freq eq1_level eq2_freq eq2_level dry_wet_mix level++-- zitaRev ; longer still+let i = soundIn 0+ k (nm,df,m) = control_m kr nm df m+ in_delay = k ("in_delay",100,(20,100,"lin"))+ low_rt60 = k ("low_rt60",6,(1,8,"exp"))+ mid_rt60 = k ("mid_rt60",2,(1,8,"exp"))+ eq1_freq = k ("eq1_freq",190,(40,2500,"exp"))+ eq1_level = k ("eq1_level",-6,(-15,15,"lin"))+ eq2_freq = k ("eq2_freq",3500,(160,10000,"exp"))+ eq2_level = k ("eq2_level",6,(-15,15,"lin"))+ dry_wet_mix = k ("dry_wet_mix",0.5,(0,1,"lin"))+ level = k ("level",-20,(-9,9,"lin"))+in X.zitaRev+ i i+ in_delay 200 low_rt60 mid_rt60 6000 eq1_freq eq1_level eq2_freq eq2_level dry_wet_mix level
− Help/hsc3.help.lhs
@@ -1,656 +0,0 @@-* Abstract--This document describes the hsc3 haskell-bindings to the supercollider synthesis-server.--The bindings allow haskell to be used-to write unit generator graphs, to control-the supercollider synthesiser interactively-while it is running, and to write scores for-offline rendering.--For detailed introductory materials on-haskell and supercollider, see-- http://haskell.org/- http://audiosynth.com/--* Questions, Dartmouth, 2002--| What should a computer music language do?-| ...-| Is a specialized computer music language-| even necessary? (McCartney, 2002)--These questions are asked in a paper that-documents a reimplementation of the supercollider-language for real time audio synthesis (McCartney,-1998).--The redesigned system consists of two parts, an-elegant, efficient, and musically neutral real-time audio synthesiser in the music-n family-(Mathews, 1961), and a language interpreter in the-smalltalk family (Goldberg, 1983).--The interpreter and synthesiser communicate using-the open sound control protocol (Wright & Freed,-1997).--Using this model of discrete communicating-processes, the computer music language is relieved-of many onerous tasks.--In part the question is rhetorical, given an-appropriately designed and implemented-synthesiser, the control language need not be-particularly specialised.--* What needs to be done--The requirements are rather minimal.--An open sound control protocol implementation and-a usable notation for server commands.--A unit generator graph protocol implementation and-a usable notation for writing graphs.--For interactive use a suitably responsive run time-system, where suitable is a function of the kind-of work being done.--* Questions, San Dimas, 1965--| (1) What are declarative languages?-| ...-| (4) How can we use them to program?-| (5) How can we implement them?-| (Strachey, in Landin, 1966)--(1) Haskell is a non-strict (Wadler, 1996) and- purely functional (Sabry, 1993) language, one- result of many years of research into these- questions (Hudak et al, 2007).--(4) Computation in haskell is structured using a- small number of simple type classes; monads- (Wadler, 1990), applicative functors (McBride- and Paterson, 2007) & arrows (Hughes, 2000).--(5) The glasgow haskell system includes both an- optimizing compiler generating efficient- machine programs and a bytecode generator and- intepreter for interative use.--In the authors experience the glasgow run-time-system is adequate for real-time control of the-supercollider synthesiser, capable of generating-high density & low latency control streams such as-those required for waveset synthesis etc.--* Types, Unit Generators, Parametric Polymorphism--In haskell polymorphism is provided by type-classes (Wadler & Blott, 1989).--Type class polymorphism is parametric, as distinct-from the ad hoc polymorphism of supercollider-language (Strachey, 1967).--Since unit generators are a sort of numerical-value, we wish to make their representation-amenable to the standard haskell numerical type-classes.--These give signatures such as:--> (+) :: (Num a) => a -> a -> a--meaning that a value can only be summed with a-value of the same type, and that the resulting-value must also be of the same type.--This implies that the type of a unit generator-must be inclusive, since we wish to combine-constants, control inputs, and actual unit-generators operating at varying rates and with-varying numbers of input and output ports.--This leads us to a representation that is simple-but somewhat uninformative, and delays evaluating-unit generator graph correctness to run-time.--We note that a more rigorous type representation-is possible, either in standard haskell or using-one of the many implemented type system-extensions, and could be layered either above or-below the current representation.--* Multiple channel expansion--The supercollider language implements a very-elegant rule for composing graphs from nodes with-different numbers of channels. The model is-referred to as multiple channel expansion, a-behaviour that, although it can become confusing-in deeply nested uses, is very intuitive for-simple cases.--The simple type representation of unit generators-allows us to implement the multiple channel-expansion model in much the same way as in the-supercollider language--Unit generators with multiple outputs, such-as pan2, are represented as a specific kind-of unit generator value, an ordered set of-proxies.--We can also write these sets directly using-the 'mce' function.--Multiple channel expansion flows downward-through unit generator graphs.--In the expression below, the frequency input-causes two sinOsc unit generators to be created.--> import Sound.SC3--> let { x = mouseX KR (-1) 1 Linear 0.1-> ; o1 = pulse AR 440 0.1-> ; o2 = sinOsc AR (mce [110, 2300]) 0 * 0.1 }-> in audition (out 0 (pan2 o1 x 0.1 + o2))--This is turn causes the (*) function to-expand and perform channel matching, that is-to duplicate the right hand side input as-required.--The (+) function is also expanded, since the-left and right hand sides are of equal degree-there is not replication of inputs.--The out function does not expand, since it is-defined to flatten one layer of mce values at-it's second input to support a variable number-of input channels; it would however expand on-mce at the first argument, or nested mce at the-second.--Equal inputs do also push the expansion-downwards, however in complex graphs this-seems occasionally unreliable.--> let f = mce2 440 440-> in audition (out 0 (sinOsc AR f 0 * 0.1))--* Multiply add inputs, Haskell Curry, and cloning--The supercollider language provides optional multiply-and add inputs for most unit generator constructors.--Optional arguments do not interact well with the-haskell behaviour of treating functions as monadic.--That is, one way to write the number thirteen is:--> let { sum_squares x y = x * x + y * y-> ; f = sum_squares 2 }-> in f 3--The absent multiply add inputs can in most cases be-simply re-written using (*) and (+).--The expression:--| { Out.ar(0, SinOsc.ar(440, 0, 0.1, 0.05)) }.play--is equivalent to:--> audition (out 0 (sinOsc AR 440 0 * 0.1 + 0.05))--However there is a subtle distinction in behaviour-relating to multiple channel expansion.--The supercollider language expression:--| { var a = WhiteNoise.ar([0.1, 0.05])-| ; var b = PinkNoise.ar * [0.1, 0.05]-| ; Out.ar(0, a + b) }.play--describes a graph with two WhiteNoise nodes-and a single PinkNoise node.--We note that this distinction is only relevant-for non-deterministic unit generators.--To write this simple graph in haskell we can use-the clone function:--> import Control.Monad-> import Sound.SC3.Monadic--> let f = liftM (* mce [0.1, 0.05])-> in do { a <- f (clone 2 (whiteNoise AR))-> ; b <- f (pinkNoise AR)-> ; audition (out 0 (a + b)) }--which is defined in relation to the standard-monad functions replicateM and liftM.--> clone :: (UId m) => Int -> m UGen -> m UGen-> clone n u = liftM mce (replicateM n u)--* Multiple Root Graphs--The mrg function, pronounced multiple root graph,-allows us to write unit generator graphs with-multiple sink nodes.--Consider the freeSelf unit generator:--> do { n <- dust KR 0.5-> ; let { a = freeSelf n-> ; b = out 0 (sinOsc AR 440 0 * 0.1) }-> in audition (mrg [a, b]) }--In order to allow multiple root graphs to be-freely composed we implement a leftmost rule,-whereby the leftmost root need not be a sink-node, in which case the mrg node may be used-as an input node.--Consider a simple ping pong delay filter:--> let ppd s = let { a = localIn 2 AR + mce [s, 0]-> ; b = delayN a 0.2 0.2-> ; c = mceEdit reverse b * 0.8 }-> in mrg [b, localOut c]-> in do { n <- whiteNoise AR-> ; let s = decay (impulse AR 0.3 0) 0.1 * n * 0.2-> in audition (out 0 (ppd s)) }--* Literals, Overloading, Coercion, Constants--This is a somewhat subtle distinction. Numeric-literals in haskell are overloaded, not coerced.-The numerical type classes provide two functions:--> fromInteger :: (Num a) => Integer -> a--and--> fromRational :: (Fractional a) => Rational -> a--which are implicitly applied to all integer and-rational literals respectively.--It is for this reason that we can write:--> sinOsc AR 440.0 0 * 0.1--but must explicitly construct constants from values-of a concrete numerical type using the constant-function.--> let { f = 440.0 :: Double-> ; p = 0 :: Int-> ; a = 0.1 :: Float }-> in sinOsc AR (constant f) (constant p) * (constant a)--The most common case requiring constant annotations-is buffer numbers, which must be provided to unit-generator graphs as values of type 'UGen' and to-the server command constructors as values of type-'Int'.--* Unit generators are comparable--In haskell the Eq and Ord type classes define-equality and ordering operators.--In unit generator graphs these operators have a-somewhat different meaning, and require a different-type signature.--For instance the greater-than operator defines a-unit generator that is zero for sample values-where the comparison fails, and one when it-succeeds.--Since the Ord type gives the signature:--> (>) :: (Ord a) => a -> a -> Bool--we define a variant with a star suffix, such-that:--> let { x = mouseX KR 3 45 Exponential 0.1-> ; t = sinOsc AR x 0 >* 0-> ; d = envTriangle 0.01 0.1-> ; e = envGen AR t 1 0 1 DoNothing d-> ; f = 220 + 880 * (toggleFF t)-> ; o = sinOsc AR f 0 }-> in audition (out 0 (o * e))--is a sequence of low and high tones.--For functions where the signature is-consistent with the meaning of the unit-generator operator we use the haskell name.--| max :: (Ord a) => a -> a -> a--> let { l = fSinOsc AR 500 0 * 0.25-> ; r = fSinOsc AR 0.5 0 * 0.23 }-> in audition (out 0 (l `max` r))--* Observable Sharing, Pure Noise--The haskell expression:--> let { a = sinOsc AR 440 0-> ; b = sinOsc AR 440 0-> ; c = a - b }-> in audition (out 0 c)--denotes a graph that has three nodes: sinOsc, (-)-and out.-- # UGens Int 3- # Synths Int 1--The graph constructor, when traversing the-structure denoted by (out 0 c), cannot distinguish-between a and b, they are the same value.--In other words, it is the same graph as if we had-written:--> let { x = sinOsc AR 440 0-> ; y = x - x }-> in audition (out 0 y)--Expressions with the same notation have the same-value.--This is acceptable for deterministic unit-generators, such as sinOsc, but of course fails-for non-deterministic unit generators such as-whiteNoise, and also for demand rate sources-such as dseq.--In supercollider language, the graph--| { var a = WhiteNoise.ar-| ; var b = WhiteNoise.ar-| ; var c = a - b-| ; Out.ar(0, c * 0.1) }.play--does not describe silence, it describes white-noise.--We read WhiteNoise.ar as a computation that-constructs a value, not as an expression that-denotes a value.--In procedural languages we are familiar with many-different types of equality. Scheme has eq?, eqv?-and equal?, supercollider language has == and ===.--| { var a = "x"-| ; var b = "x"-| ; [a == b, a === b] }.value--In a purely functional language expressions denote-values, and equal expressions denote the same-value. Therefore the graph given by the haskell-expression:--> let { z = 'α'-> ; n = Sound.SC3.UGen.Noise.ID.whiteNoise z-> ; a = n AR-> ; b = n AR-> ; c = a - b }-> in audition (out 0 (c * 0.1))--describes silence. To describe white noise we-would need to distinguish a and b, which can only-be done by providing non-equal identifiers in-place of z.--The whiteNoise function used above is written-using a fully qualified name because it is not the-whiteNoise function provided by Sound.SC3, that-function has the signature:--> whiteNoise :: (UId m) => Rate -> m UGen--where the type-class UId is defined as:--> class (Monad m) => UId m where-> generateUId :: m Int--The signature indicates that whiteNoise is a-function from a Rate value to an (m UGen)-value.--* Non-determinism, monadic structure, do notation--It is quite clear that a value of type (m UGen) is-not of type UGen.--Compare the whiteNoise signature with that of the-deterministic sin oscillator:--> sinOsc :: Rate -> UGen -> UGen -> UGen--We can write a white noise graph using this-function and the haskell 'do' notation as:--> do { a <- whiteNoise AR-> ; b <- whiteNoise AR-> ; let c = a - b-> in audition (out 0 (c * 0.1)) }--which brings us more or less to the supercollider-language notation, with the exception that there-are two distinct binding notations, one for-computations and one for expressions.--The type system does not allow us to confuse these-two bindings.--The do notation allows us to write expressions-that involve computations using a familiar and-readable right to left binding notation.--The above expression is equal to:--> whiteNoise AR >>= \a ->-> whiteNoise AR >>= \b ->-> let c = a - b-> in audition (out 0 (c * 0.1))--where (>>=) is the monadic bind function, and (\x--> y) is the notation for lambda expressions-(ie. for function definition, ie. {|x| y} in-supercollider language). The signature for bind is:--> (>>=) :: (Monad m) => m a -> (a -> m b) -> m b--which indicates that the value bound in the-function definition can only be accessed in a-function that produces a value in the same monad.--The audition function has an appropriate-signature:--> audition :: UGen -> IO ()--since IO is an instance of the UId class.--It is the type of audition that determines the-type of a, the type is inferred so there is no-need to write it.--> let { (|>) = flip (.)-> ; a >>=* b = a >>= b |> return-> ; u1 = sinOsc ar 440 0 * 0.1-> ; u2 = pinkNoise ar >>=* (* 0.1)-> ; u3 = Sound.SC3.UGen.Noise.ID.pinkNoise 'α' ar * 1-> ; u4 = resonz u3 (440 * 4) 0.1-> ; g = u2 >>=* (+ (u1 + u4)) }-> in g >>= out 0 |> audition--* Unsafe unit generator constructors--Haskell provides a mechanism to force values-from the IO monad, unsafePerformIO.--Using this we can write unit generator graphs-that have non-deterministic nodes using only-orindary let binding.--> import System.IO.Unsafe--> let { u = unsafePerformIO-> ; a = u (whiteNoise AR)-> ; b = u (whiteNoise AR)-> ; c = a - b }-> in audition (out 0 (c * 0.1))--This is hardly more convenient than do notation,-however we can also insert non-determinstic nodes-directly into function arguments. The package-hsc3-unsafe provides unsafe variant unnit generator-constructors.--> let { n = Sound.SC3.UGen.Unsafe.whiteNoise-> ; x = n AR - n AR }-> in audition (out 0 (x * 0.1))--The above uses the unsafe unit generator functions-provided at Sound.SC3.UGen.Unsafe, and avoids the-lifting operations which, for functions of many-arguments, can be cumbersome.--> import Control.Monad-> import Sound.SC3.Monadic--> let n = whiteNoise-> in do { x <- liftM2 (-) (n AR) (n AR)-> ; audition (out 0 (x * 0.1)) }--* Demand Rate, Sharing Again--Demand rate UGens are similarly not functions only-of their arguments.--In the supercollider language expression below the-left and right channels have different signals,-despite each receiving the same input unit-generator.--| { var a = Dseq([1, 3, 2, 7, 8], 3)-| ; var t = Impulse.kr(5,0)-| ; var f = Demand.kr(t, 0, [a, a]) * 30 + 340-| ; Out.ar(0, SinOsc.ar(f, 0) * 0.1) }.play--The distinction here concerns multiple-reads from a single demand rate source, ie.-it is not that the source is non-deterministic,-it is rather that each read request consumes-the value it reads.--Therefore in haskell demand rate unit generators have-similar constructor functions to non-deterministic-unit generators, in order that we can distinguish:--> do { a <- dseq 3 (mce [1, 3, 2, 7, 8])-> ; let { t = impulse KR 5 0-> ; f = demand t 0 (mce [a, a]) * 30 + 340 }-> in audition (out 0 (sinOsc AR f 0 * 0.1)) }--which is the same graph as given in supercollider-language above, from:--> do { a <- clone 2 (dseq 3 (mce [1, 3, 2, 7, 8]))-> ; let { t = impulse KR 5 0-> ; f = demand t 0 a * 30 + 340 }-> in audition (out 0 (sinOsc AR f 0 * 0.1)) }--which gives an equal sequence of tones in each-channel.--* References--+ A. Goldberg and D. Robson. Smalltalk-80: The- language and its implementation.- Addison-Wesley, Reading, MA, 1983.--+ P. Hudak, J. Hughes, S. P. Jones, and P. Wadler.- A History of Haskell: being lazy with class. In- The Third ACM SIGPLAN History of Programming- Languages Conference, San Diego, California,- June 2007. Association for Computing Machinery.--+ John Hughes. Generalising monads to arrows.- Sci. Comput. Program., 37(1-3):67-111, 2000.--+ P. Landin. The next 700 programming languages.- Communications of the ACM, 9(3):157-164, March- 1966. Presented at the ACM Programming and- Pragmatics Conference, August 1965.--+ M. V. Mathews. An Acoustical Compiler for Music- and Psychological Stimuli. AT&T Bell- Laboratories Technical Journal, 40:677-694,- 1961.--+ C. McBride and R. Paterson. Applicative- Programming with Effects. Journal of Functional- Programming, 17(4), 2007.--+ J. McCarthy. Recursive functions of symbolic- expressions and their computation by machine.- Communications of the ACM, 3(4):184-195, 1960.--+ J. McCartney. Continued evolution of the- SuperCollider real time synthesis environment.- In Proceedings of the International Computer- Music Conference, pages 133-136. International- Computer Music Association, 1998.--+ J. McCartney. Rethinking the Computer Music- Language: SuperCollider. Computer Music- Journal, 26(4):61-68, 2002.--+ Amr Sabry. What is a Purely Functional Language?- Journal of Functional Programming, 1(1), 1993.--+ C. Strachey. Fundamental Concepts in- Programming Languages. Higher-Order and- Symbolic Computation, 13:11-49, 2000.--+ Philip Wadler. Lazy versus strict. ACM- Comput. Surv., 28(2):318-320, 1996.--+ P. Wadler. Comprehending Monads. In Conference- on Lisp and Funcional Programming, Nice, France,- June 1990. ACM.--+ P. Wadler and S. Blott. How to make ad hoc- polymorphism less ad hoc. In Proceedings of- 16th ACM Symposium on Principles of Programming- Languages, pages 60-76, January 1989.--+ M. Wright and A. Freed. Open Sound Control: A- New Protocol for Communicating with Sound- Synthesizers. In Proceedings of the- International Computer Music Conference, pages- 101-104. International Computer Music- Association, 1997.
− Help/tutorial.lhs
@@ -1,313 +0,0 @@-* Haskell SuperCollider, a Tutorial.--* Prerequisites--Haskell SuperCollider requires that SuperCollider [1], GHC [2],-Emacs [4] and the standard Haskell Emacs mode [5] are all-installed and working properly.--* Setting up Haskell SuperCollider--Haskell SuperCollider is available through the haskell community-library system Hackage [6]. To install type:-- $ cabal install hsc3--Haskell SuperCollider is also available as a set of darcs [7]-repositories, the first implementing the Sound.OpenSoundControl-module, the second the Sound.SC3 module.-- $ darcs get http://slavepianos.org/rd/sw/hosc- $ darcs get http://slavepianos.org/rd/sw/hsc3--To build use the standard Cabal process in each repository in-sequence. To install to the user package database type:-- $ cabal install--* Setting up the Haskell SuperCollider Emacs mode--Add an appropriately modified variant of the following to-~/.emacs-- (push "~/sw/hsc3/emacs" load-path)- (setq hsc3-help-directory "~/sw/hsc3/Help/")- (require 'hsc3)--The hsc3 emacs mode associates itself with files having the-extension '.lhs'. When the hsc3 emacs mode is active there is a-'Haskell SuperCollider' menu available.--* Literate Haskell--The documentation for Haskell SuperCollider, including this-tutorial, is written in 'Bird' notation, a form of 'literate-Haskell' where lines starting with '>' are Haskell code and-everything else is commentary.--Unlike ordinary literate programs the Haskell SuperCollider help-files cannot be compiled to executables. Each help file contains-multiple independant examples that can be evaluated using editor-commands, either by selecting from the 'Haskell SuperCollider'-menu or using the associated keybinding.--* Interpreter Interaction & User Configuration--To start ghci and load the file at 'hsc3-run-control' file use-C-cC-s (Haskell SuperCollider -> Haskell -> Start haskell).--If there is no file at 'hsc3-run-control' one will be created and-the modules at 'hsc3-modules' will be imported. By default this-list contains the hosc and hsc3 modules as well as-Control.Concurrent, Control.Monad, Data.List, and System.Random.--Starting the interpreter splits the current window into two-windows. If the ghci output window becomes obscured during a-session you can see it again by typing C-cC-g (Haskell-SuperCollider -> Haskell -> See output).--To interrupt ghci type C-cC-i (Haskell SuperCollider -> Haskell--> Interrupt haskell).--To stop ghci type C-cC-x (Haskell SuperCollider -> Haskell ->-Quit haskell).--* Starting the SuperCollider server--The SuperCollider server can be started from the command line.-The help files assume that scsynth is listening for UDP-connections at the standard port on the local machine.-- $ scsynth -u 57110--* Basic SuperCollider Interaction--The SuperCollider server manages a graph of nodes with integer-identifiers. The root node has ID zero. By convention ordinary-graph nodes are placed in a group with identifier 1, however this-node is not created when scsynth starts.--To create this node we need to send an OSC message to the server,-the expression to do this is written below. To run single line-expressions move the cursor to the line and type C-cC-c (Haskell-SuperCollider -> Expression -> Run line).--> import Sound.SC3--> withSC3 (\fd -> send fd (g_new [(1, AddToTail, 0)]))--We can then audition a quiet sine oscillator at A440.--> audition (out 0 (sinOsc AR 440 0 * 0.1))--To stop the sound we can delete the group it is a part of, the-audition function places the synthesis node into the group node-with ID 1, the expression below deletes that group.--> withSC3 (\fd -> send fd (n_free [1]))--In order to audition another graph we need to re-create a group-with ID 1. Sound.SC3 includes a function 'reset' that sequences-these two actions, first deleting the group node, then-re-creating a new empty group.--> withSC3 reset--Using this command is so common there is a keybinding for it,-C-cC-k (Haskell SuperCollider -> SCSynth -> Reset scsynth).-After a reset we can audition a new graph.--> audition (out 0 (sinOsc AR 220 0 * 0.1))--To see the server status type C-cC-w (Haskell SuperCollider ->-SCSynth -> Display status). This prints a table indicating-server activity to the ghci output window.-- ***** SuperCollider Server Status *****- # UGens Int 3- # Synths Int 1- # Groups Int 2- # Instruments Int 1- % CPU (Average) Float 2.6957032680511475- % CPU (Peak) Float 2.7786526679992676- Sample Rate (Nominal) Double 44100.0- Sample Rate (Actual) Double 44099.958404246536--* Completion messages--To send a completion message add one to an existing-asynchronous message using withCM.--> let { g = out 0 (sinOsc AR 660 0 * 0.15)-> ; m = d_recv (synthdef "sin" g)-> ; cm = s_new "sin" 100 AddToTail 1 [] }-> in withSC3 (\fd -> send fd (withCM m cm))--Alternately use variant constructors for the-asynchronous commands.--> import Sound.SC3.Server.Command.Completion--> let { g = out 0 (sinOsc AR 660 0 * 0.15)-> ; cm = s_new "sin" 100 AddToTail 1 []-> ; m = d_recv' cm (synthdef "sin" g) }-> in withSC3 (\fd -> send fd m)--* Controls--In hsc3 control parameters must be indexed by name.--There are four types of control parameters,-initialisation-rate (ir), control-rate (kr),-triggered-control-rate (tr) and audio-rate.--The graph below illustrates the first three of these.-Note the specialised constructor for triggered-controls. --> let { b1 = control IR "b1" 0-> ; b2 = control IR "b2" 1-> ; f1 = control KR "f1" 450-> ; f2 = control KR "f2" 900-> ; a1 = tr_control "a1" 0-> ; a2 = tr_control "a2" 0-> ; m = impulse KR 1 0 * 0.1-> ; d x = decay2 (m + x) 0.01 0.2-> ; o1 = sinOsc AR f1 0 * d a1-> ; o2 = saw AR f2 * d a2-> ; g = mrg2 (out b1 o1) (out b2 o2)-> ; i fd = do { async fd (d_recv (synthdef "g" g))-> ; send fd (s_new "g" 100 AddToTail 1 []) } }-> in withSC3 i--The output buses cannot be set, since they are-initialisation rate only.--> withSC3 (\fd -> send fd (n_set1 100 "b1" 1))-> withSC3 (\fd -> send fd (n_set1 100 "b2" 0))--The frequency controls can be set since they are-control rate.--> withSC3 (\fd -> send fd (n_set1 100 "f1" 200))-> withSC3 (\fd -> send fd (n_set1 100 "f2" 300))--The audio controls can be set, however they are-immediately reset to zero at the next control cycle.--> withSC3 (\fd -> send fd (n_set1 100 "a1" 1))-> withSC3 (\fd -> send fd (n_set1 100 "a2" 1))--* Multiple line expressions--There are two variants for expressions that are written over-multiple lines.--To evaluate an expression that is written without using the-Haskell layout rules select the region and type C-cC-e (Haskell-SuperCollider -> Expression -> Run multiple lines). To select a-region use the mouse or place the cursor at one end, type-C-[Space] then move the cursor to the other end.--> let { f0 = xLine KR 1 1000 9 RemoveSynth-> ; f1 = sinOsc AR f0 0 * 200 + 800 }-> in audition (out 0 (sinOsc AR f1 0 * 0.1))--To evaluate a multiple line expression written using the layout-rules as applicable within a do block, select the region and type-C-cC-r (Haskell SuperCollider -> Expression -> Run region).--> let f0 = xLine KR 1 1000 9 RemoveSynth-> f1 = sinOsc AR f0 0 * 200 + 800-> audition (out 0 (sinOsc AR f1 0 * 0.1))--This writes the region in a do block in a procedure to a-temporary file, /tmp/hsc3.lhs, loads the file and then runs the-procedure. The preamble imports the modules listed at the emacs-variable hsc3-modules.--ghci understands import expressions, so to add a module to the-current scope it is enough to type C-cC-c at an appropriate-location. If hsc3-dot is installed, the following two-expressions will load the module and make a drawing.--> import Sound.SC3-> import Sound.SC3.UGen.Dot--> let { o = control KR "bus" 0-> ; f = mouseX KR 440 880 Exponential 0.1 }-> in draw (out o (sinOsc AR f 0))--* Help Files--To find help on a unit generator or on a SuperCollider server-command place the cursor over the identifier and type C-cC-h-(Haskell SuperCollider -> Help -> Haskell SuperCollider help).-This opens the help file, which ought to have working examples in-it, the above graph is in the sinOsc help file, the s_new help-file explains what arguments are required and what they mean.--The Haskell SuperCollider help files are derived from the help-files distributed with SuperCollider, the text is re-formatted to-read well as plain text and examples are translated into Haskell.--There is also partial haddock documentation for the Sound.SC3 and-Sound.OpenSoundControl modules, to build type:-- $ runhaskell Setup.lhs haddock--* Identifier lookup & hasktags--The emacs command M-. (find-tag) looks up an identifier in a-'tags' table. The hasktags utility can generate tags files from-haskell source files that are usable with emacs.--To generate a tags file for hsc3, visit the hsc3 directory and-type:-- $ find Sound -name '*.*hs' | xargs hasktags -e--To use the hsc3 tags table type `M-x visit-tags-table', or add an-entry to ~/.emacs:-- (setq tags-table-list '("~/sw/hsc3"))--* External Unit Generators--hsc3 includes bindings and help files for some unit generators-not in the standard supercollider distribution. In order to use-these unit generators they must be installed, see:-- http://sf.net/projects/sc3-plugins/--* Example Unit Generator Graphs--The Help/ directory contains example unit generator-graphs. To audition a graph from Emacs type C-cC-l-C-cC-m. Many of the graphs are self contained,-selecting the graph (excluding the 'main =' line) and-typing C-cC-e will audition it. In many cases both-supercollider language and haskell versions are given,-switch the emacs buffer to sclang-mode to run the-supercollider language versions.--* Monitoring incoming server messages--To monitor what OSC messages scsynth is receiving use the-'dumpOSC' server command to request that scsynth print text-traces of incoming messages to its standard output.--> withSC3 ((flip send) (dumpOSC TextPrinter))--To end printing send:--> withSC3 ((flip send) (dumpOSC NoPrinter))--* References--[1] http://audiosynth.com/-[2] http://haskell.org/ghc/-[4] http://gnu.org/software/emacs/-[5] http://haskell.org/haskell-mode/-[6] http://hackage.haskell.org/-[7] http://darcs.net/
− README
@@ -1,22 +0,0 @@-hsc3 - haskell supercollider--hsc3 provides Sound.SC3, a Haskell module that facilitates using-Haskell as a client to the SuperCollider synthesis server. --For installation and configuration information please consult the-tutorial file at Help/tutorial.lhs--The hsc3 interaction environment is written for GNU Emacs.-- http://slavepianos.org/rd/?t=hsc3- http://haskell.org/- http://audiosynth.com/- http://gnu.org/software/emacs/--(c) rohan drape and others, 2006-2010- gpl, http://gnu.org/copyleft/- with contributions by henning thielemann- & stefan kersten- & alex mclean- & brent yorgey- see darcs history for details
+ README.md view
@@ -0,0 +1,85 @@+hsc3 - haskell supercollider+----------------------------++[hsc3](http://rohandrape.net/?t=hsc3)+provides `Sound.SC3`, a module for using+[Haskell](http://haskell.org/)+as a client to the+[SuperCollider](http://audiosynth.com/)+synthesis server.+hsc3 requires+[hosc](http://rohandrape.net/?t=hosc).++There is an+[introduction](http://rohandrape.net/?t=hsc3-texts&e=1.1-introduction.md)+and a+[tutorial](http://rohandrape.net/?t=hsc3-texts&e=2.1-tutorial.md)+at+[hsc3-texts](http://rohandrape.net/?t=hsc3-texts).++There are a number of related projects:++- [hsc3-util](http://rohandrape.net/?t=hsc3-util): hsc3 & related utilities (2020)+- [stsc3](http://rohandrape.net/?t=stsc3): Smalltalk SuperCollider (2019)+- [hsc3-m](http://rohandrape.net/?t=hsc3-m): UGen variants (2018)+- [hsc3-forth](http://rohandrape.net/?t=hsc3-forth): Forth SuperCollider (2014)+- [hsc3-lisp](http://rohandrape.net/?t=hsc3-lisp): Lisp SuperCollider (2014)+- [hsc3-plot](http://rohandrape.net/?t=hsc3-plot): Plotting (2013)+- [hsc3-data](http://rohandrape.net/?t=hsc3-data): Data formats &etc. (2013)+- [hsc3-rw](http://rohandrape.net/?t=hsc3-rw): UGen Graph Re-writing (2013)+- [hsc3-cairo](http://rohandrape.net/?t=hsc3-cairo): Drawing (2012)+- [hsc3-sf-hsndfile](http://rohandrape.net/?t=hsc3-sf-hsndfile): Sound file Io (libsndfile) (2010)+- [hsc3-auditor](http://rohandrape.net/?t=hsc3-auditor): Simple sound event auditioner (2010)+- [hsc3-rec](http://rohandrape.net/?t=hsc3-rec): Record UGens (2008)+- [smlsc3](http://rohandrape.net/?t=smlsc3): Standard Ml SuperCollider (2008)+- [hsc3-lang](http://rohandrape.net/?t=hsc3-lang): SC3 language (2007)+- [hsc3-graphs](http://rohandrape.net/?t=hsc3-graphs): UGen graph collection (2006)+- [hsc3-db](http://rohandrape.net/?t=hsc3-db): UGen Database (2006)+- [hsc3-dot](http://rohandrape.net/?t=hsc3-dot): UGen graph drawing (2006)+- [hsc3-sf](http://rohandrape.net/?t=hsc3-sf): Sound file Io (2006)+- [hsc3-unsafe](http://rohandrape.net/?t=hsc3-unsafe): Unsafe UGen variants (2006)+- [rsc3](http://rohandrape.net/?t=rsc3): Scheme SuperCollider (2004)+- [sc3-rdu](http://rohandrape.net/?t=sc3-rdu): SuperCollider UGens (1998)++The hsc3 interaction environment ([hsc3.el](http://rohandrape.net/?t=hsc3&e=emacs/hsc3.el))+is written for+[Gnu](http://gnu.org/)+[Emacs](http://gnu.org/software/emacs/).++<!--+There is also, more obliquely related:+-->++## help++[UGen Index](http://rohandrape.net/?t=hsc3&e=Help/Ugen/ix.md)++©+[Rohan Drape](http://rohandrape.net/)+and others, 2005-2024,+[Gpl-3](http://gnu.org/copyleft/)++With contributions by:++- Henning Thielemann+- Stefan Kersten+- Alex McLean+- Brent Yorgey+- Shae Erisson++See the+[git](https://git-scm.com/)+[history](http://rohandrape.net/?t=hsc3&q=history)+for details++Initial announcement:+[[2005-11-29/haskell-cafe](http://rohandrape.net/?t=hsc3&e=md/announce.text),+ [haskell.org](http://www.haskell.org/pipermail/haskell-cafe/2005-November/012483.html)]++* * *++```+$ doctest Sound/Sc3+Examples: 370 Tried: 370 Errors: 0 Failures: 0+$+```
+ Setup.hs view
@@ -0,0 +1,3 @@+#!/usr/bin/env runhaskell+import Distribution.Simple+main = defaultMain
− Setup.lhs
@@ -1,3 +0,0 @@-#!/usr/bin/env runhaskell-> import Distribution.Simple-> main = defaultMain
− Sound/SC3.hs
@@ -1,22 +0,0 @@-module Sound.SC3 (-- $help- module Sound.SC3.Server- ,module Sound.SC3.UGen) where--import Sound.SC3.Server-import Sound.SC3.UGen---- $help--- Once the hsc3 library has been installed, you will find help files--- installed in @$PREFIX\/share\/hsc3-VERSION\/Help\/@.------ For installation and configuration information please consult the--- tutorial file at @Help\/tutorial.lhs@.------ For general information on supercollider and the overall design of--- the hsc3 bindings, see @Help\/hsc3.help.lhs@.------ For documentation and examples for unit generators, see--- @Help\/UGen\/@. Note that the Haddock documentation for many unit--- generators is incomplete; see the appropriate file in--- @Help\/UGen\/@ for complete documentation.-
− Sound/SC3/ID.hs
@@ -1,11 +0,0 @@-module Sound.SC3.ID (module Sound.SC3.UGen- ,module Sound.SC3.UGen.Demand.ID- ,module Sound.SC3.UGen.FFT.ID- ,module Sound.SC3.UGen.Noise.ID- ,module Sound.SC3.Server) where--import Sound.SC3.UGen-import Sound.SC3.UGen.Demand.ID-import Sound.SC3.UGen.FFT.ID-import Sound.SC3.UGen.Noise.ID-import Sound.SC3.Server
− Sound/SC3/Monadic.hs
@@ -1,14 +0,0 @@-module Sound.SC3.Monadic (module Sound.SC3.UGen- ,module Sound.SC3.UGen.Composite.Monadic- ,module Sound.SC3.UGen.Demand.Monadic- ,module Sound.SC3.UGen.FFT.Monadic- ,module Sound.SC3.UGen.Noise.Monadic- ,module Sound.SC3.Server) where--import Sound.SC3.UGen-import Sound.SC3.UGen.Composite.Monadic-import Sound.SC3.UGen.Demand.Monadic-import Sound.SC3.UGen.FFT.Monadic-import Sound.SC3.UGen.Noise.Monadic-import Sound.SC3.Server-
− Sound/SC3/Server.hs
@@ -1,13 +0,0 @@--- | Collection of modules for communicating with the SuperCollider--- synthesis server.-module Sound.SC3.Server ( module Sound.SC3.Server.Command- , module Sound.SC3.Server.Synthdef- , module Sound.SC3.Server.Play- , module Sound.SC3.Server.Status- , module Sound.SC3.Server.NRT ) where--import Sound.SC3.Server.Command-import Sound.SC3.Server.Synthdef-import Sound.SC3.Server.Play-import Sound.SC3.Server.Status-import Sound.SC3.Server.NRT
− Sound/SC3/Server/Command.hs
@@ -1,295 +0,0 @@--- | Constructors for the command set implemented by the SuperCollider--- synthesis server.-module Sound.SC3.Server.Command where--import qualified Data.ByteString.Lazy as B-import Data.Word-import Sound.OpenSoundControl-import Sound.SC3.Server.Utilities---- * Instrument definition commands---- | Install a bytecode instrument definition. (Asynchronous)-d_recv :: [Word8] -> OSC-d_recv b = Message "/d_recv" [Blob b]---- | Load an instrument definition from a named file. (Asynchronous)-d_load :: String -> OSC-d_load p = Message "/d_load" [String p]---- | Load a directory of instrument definitions files. (Asynchronous)-d_loadDir :: String -> OSC-d_loadDir p = Message "/d_loadDir" [String p]---- | Remove definition once all nodes using it have ended.-d_free :: [String] -> OSC-d_free = Message "/d_free" . map String---- * Node commands---- | Place a node after another.-n_after :: [(Int, Int)] -> OSC-n_after = Message "/n_after" . mk_duples Int Int---- | Place a node before another.-n_before :: [(Int, Int)] -> OSC-n_before = Message "/n_before" . mk_duples Int Int---- | Fill ranges of a node's control values.-n_fill :: Int -> [(String, Int, Double)] -> OSC-n_fill nid l = Message "/n_fill" (Int nid : mk_triples String Int Float l)---- | Delete a node.-n_free :: [Int] -> OSC-n_free = Message "/n_free" . map Int---- | Map a node's controls to read from a bus.-n_map :: Int -> [(String, Int)] -> OSC-n_map nid l = Message "/n_map" (Int nid : mk_duples String Int l)---- | Map a node's controls to read from buses.-n_mapn :: Int -> [(String, Int, Int)] -> OSC-n_mapn nid l = Message "/n_mapn" (Int nid : mk_triples String Int Int l)---- | Get info about a node.-n_query :: [Int] -> OSC-n_query = Message "/n_query" . map Int---- | Turn node on or off.-n_run :: [(Int, Bool)] -> OSC-n_run = Message "/n_run" . mk_duples Int (Int . fromEnum)---- | Set a node's control values.-n_set :: Int -> [(String, Double)] -> OSC-n_set nid c = Message "/n_set" (Int nid : mk_duples String Float c)---- | Set ranges of a node's control values.-n_setn :: Int -> [(String, [Double])] -> OSC-n_setn nid l = Message "/n_setn" (Int nid : concatMap f l)- where f (s,d) = String s : Int (length d) : map Float d---- | Trace a node.-n_trace :: [Int] -> OSC-n_trace = Message "/n_trace" . map Int---- * Synthesis node commands---- | Get control values.-s_get :: Int -> [String] -> OSC-s_get nid i = Message "/s_get" (Int nid : map String i)---- | Get ranges of control values.-s_getn :: Int -> [(String, Int)] -> OSC-s_getn nid l = Message "/s_getn" (Int nid : mk_duples String Int l)---- | Enumeration of possible locations to add new nodes (s_new and g_new).-data AddAction = AddToHead- | AddToTail- | AddBefore- | AddAfter- | AddReplace- deriving (Eq, Show, Enum)---- | Create a new synth.-s_new :: String -> Int -> AddAction -> Int -> [(String, Double)] -> OSC-s_new n i a t c = Message "/s_new" (String n : Int i : Int (fromEnum a) : Int t : mk_duples String Float c)---- | Create a new synth.-s_newargs :: String -> Int -> AddAction -> Int -> [(String, [Double])] -> OSC-s_newargs n i a t c = Message "/s_newargs" (String n : Int i : Int (fromEnum a) : Int t : mk_duples_l Int String Float c)---- | Auto-reassign synth's ID to a reserved value.-s_noid :: [Int] -> OSC-s_noid = Message "/s_noid" . map Int---- * Group node commands---- | Free all synths in this group and all its sub-groups.-g_deepFree :: [Int] -> OSC-g_deepFree = Message "/g_deepFree" . map Int---- | Delete all nodes in a group.-g_freeAll :: [Int] -> OSC-g_freeAll = Message "/g_freeAll" . map Int---- | Add node to head of group.-g_head :: [(Int, Int)] -> OSC-g_head = Message "/g_head" . mk_duples Int Int---- | Create a new group.-g_new :: [(Int, AddAction, Int)] -> OSC-g_new = Message "/g_new" . mk_triples Int (Int . fromEnum) Int---- | Add node to tail of group.-g_tail :: [(Int, Int)] -> OSC-g_tail = Message "/g_tail" . mk_duples Int Int---- * Unit Generator commands---- | Send a command to a unit generator.-u_cmd :: Int -> Int -> String -> [Datum] -> OSC-u_cmd nid uid cmd arg = Message "/u_cmd" ([Int nid, Int uid, String cmd] ++ arg)---- * Buffer commands---- | Allocates zero filled buffer to number of channels and samples. (Asynchronous)-b_alloc :: Int -> Int -> Int -> OSC-b_alloc nid frames channels = Message "/b_alloc" [Int nid, Int frames, Int channels]---- | Allocate buffer space and read a sound file. (Asynchronous)-b_allocRead :: Int -> String -> Int -> Int -> OSC-b_allocRead nid p f n = Message "/b_allocRead" [Int nid, String p, Int f, Int n]---- | Allocate buffer space and read a sound file, picking specific channels. (Asynchronous)-b_allocReadChannel :: Int -> String -> Int -> Int -> [Int] -> OSC-b_allocReadChannel nid p f n cs = Message "/b_allocReadChannel" ([Int nid, String p, Int f, Int n] ++ map Int cs)---- | Close attached soundfile and write header information. (Asynchronous)-b_close :: Int -> OSC-b_close nid = Message "/b_close" [Int nid]---- | Fill ranges of sample values.-b_fill :: Int -> [(Int, Int, Double)] -> OSC-b_fill nid l = Message "/b_fill" (Int nid : mk_triples Int Int Float l)---- | Free buffer data. (Asynchronous)-b_free :: Int -> OSC-b_free nid = Message "/b_free" [Int nid]---- | Call a command to fill a buffer. (Asynchronous)-b_gen :: Int -> String -> [Double] -> OSC-b_gen bid cmd arg = Message "/b_gen" (Int bid : String cmd : map Float arg)---- | Get sample values.-b_get :: Int -> [Int] -> OSC-b_get nid i = Message "/b_get" (Int nid : map Int i)---- | Get ranges of sample values.-b_getn :: Int -> [(Int, Int)] -> OSC-b_getn nid l = Message "/b_getn" (Int nid : mk_duples Int Int l)---- | Request \/b_info messages.-b_query :: [Int] -> OSC-b_query = Message "/b_query" . map Int---- | Read sound file data into an existing buffer. (Asynchronous)-b_read :: Int -> String -> Int -> Int -> Int -> Int -> OSC-b_read nid p f n f' z = Message "/b_read" [Int nid, String p, Int f, Int n, Int f', Int z]---- | Read sound file data into an existing buffer, picking specific channels. (Asynchronous)-b_readChannel :: Int -> String -> Int -> Int -> Int -> Int -> [Int] -> OSC-b_readChannel nid p f n f' z cs = Message "/b_readChannel" ([Int nid, String p, Int f, Int n, Int f', Int z] ++ map Int cs)---- | Set sample values.-b_set :: Int -> [(Int, Double)] -> OSC-b_set nid l = Message "/b_set" (Int nid : mk_duples Int Float l)---- | Set ranges of sample values.-b_setn :: Int -> [(Int, [Double])] -> OSC-b_setn nid l = Message "/b_setn" (Int nid : concatMap f l)- where f (i,d) = Int i : Int (length d) : map Float d---- | Write sound file data. (Asynchronous)-b_write :: Int -> String -> Int -> Int -> Int -> Int -> Int -> OSC-b_write nid p h t f s z = Message "/b_write" [Int nid, String p, Int h, Int t, Int f, Int s, Int z]---- | Zero sample data. (Asynchronous)-b_zero :: Int -> OSC-b_zero nid = Message "/b_zero" [Int nid]---- * Control bus commands---- | Fill ranges of bus values.-c_fill :: [(Int, Int, Double)] -> OSC-c_fill = Message "/c_fill" . mk_triples Int Int Float---- | Get bus values.-c_get :: [Int] -> OSC-c_get = Message "/c_get" . map Int---- | Get ranges of bus values.-c_getn :: [(Int, Int)] -> OSC-c_getn = Message "/c_getn" . mk_duples Int Int---- | Set bus values.-c_set :: [(Int, Double)] -> OSC-c_set = Message "/c_set" . mk_duples Int Float---- | Set ranges of bus values.-c_setn :: [(Int, [Double])] -> OSC-c_setn l = Message "/c_setn" (concatMap f l)- where f (i,d) = Int i : Int (length d) : map Float d---- * Server operation commands---- | Remove all bundles from the scheduling queue.-clearSched :: OSC-clearSched = Message "/clearSched" []---- | Enumeration of OSC printer types.-data PrintLevel = NoPrinter- | TextPrinter- | HexPrinter- | AllPrinter- deriving (Eq, Show, Enum)---- | Select printing of incoming Open Sound Control messages.-dumpOSC :: PrintLevel -> OSC-dumpOSC c = Message "/dumpOSC" [Int (fromEnum c)]---- | Select reception of notification messages. (Asynchronous)-notify :: Bool -> OSC-notify c = Message "/notify" [Int (fromEnum c)]---- | Stop synthesis server.-quit :: OSC-quit = Message "/quit" []---- | Request \/status.reply message.-status :: OSC-status = Message "/status" []---- | Request \/synced Message when all current asynchronous commands complete.-sync :: Int -> OSC-sync sid = Message "/sync" [Int sid]---- * Variants to simplify common cases---- | Set single sample value.-b_set1 :: Int -> Int -> Double -> OSC-b_set1 nid i x = b_set nid [(i,x)]---- | Set a range of sample values.-b_setn1 :: Int -> Int -> [Double] -> OSC-b_setn1 nid i xs = b_setn nid [(i,xs)]---- | Set single bus values.-c_set1 :: Int -> Double -> OSC-c_set1 i x = c_set [(i, x)]---- | Set a signle node control value.-n_set1 :: Int -> String -> Double -> OSC-n_set1 nid k n = n_set nid [(k, n)]---- * Modify existing message to include completion message---- List of asynchronous server commands.-async_cmds :: [String]-async_cmds = ["/d_recv", "/d_load", "/d_loadDir"- ,"/b_alloc", "/b_allocRead", "/b_allocReadChannel"- ,"/b_free", "/b_close"- ,"/b_read", "/b_readChannel"- ,"/b_write", "/b_zero"]---- | Add a completion message to an existing asynchronous command.-withCM :: OSC -> OSC -> OSC-withCM (Message c xs) cm =- if c `elem` async_cmds- then let xs' = xs ++ [Blob (B.unpack (encodeOSC cm))]- in Message c xs'- else error ("withCM: not async: " ++ c)-withCM _ _ = error "withCM: not message"---- Local Variables:--- truncate-lines:t--- End:
− Sound/SC3/Server/Command/Completion.hs
@@ -1,82 +0,0 @@--- | This module provides variations of the asynchronous server commands that--- expect a /completion packet/ as the first argument. The completion packet--- is executed by the server when the asynchronous command has finished. Note--- that this mechanism is for synchronizing server side processes only, for--- client side synchronization use @\/done@ message notification or the--- @\/sync@ barrier.-module Sound.SC3.Server.Command.Completion (- -- *Synthdef handling- d_recv'- , d_load'- , d_loadDir'- -- *Buffer allocation- , b_alloc'- , b_allocRead'- , b_allocReadChannel'- , b_free'- , b_close'- -- *Buffer reading- , b_read'- , b_readChannel'- -- *Buffer writing- , b_write'- -- *Buffer operations- , b_zero'-) where--import Data.Word (Word8)-import qualified Data.ByteString.Lazy as B-import Sound.OpenSoundControl---- Encode an OSC packet as an OSC blob.-encode_osc_blob :: OSC -> Datum-encode_osc_blob = Blob . B.unpack . encodeOSC---- | Install a bytecode instrument definition. (Asynchronous)-d_recv' :: OSC -> [Word8] -> OSC-d_recv' osc b = Message "/d_recv" [Blob b, encode_osc_blob osc]---- | Load an instrument definition from a named file. (Asynchronous)-d_load' :: OSC -> String -> OSC-d_load' osc p = Message "/d_load" [String p, encode_osc_blob osc]---- | Load a directory of instrument definitions files. (Asynchronous)-d_loadDir' :: OSC -> String -> OSC-d_loadDir' osc p = Message "/d_loadDir" [String p, encode_osc_blob osc]---- | Allocates zero filled buffer to number of channels and samples. (Asynchronous)-b_alloc' :: OSC -> Int -> Int -> Int -> OSC-b_alloc' osc nid frames channels = Message "/b_alloc" [Int nid, Int frames, Int channels, encode_osc_blob osc]---- | Allocate buffer space and read a sound file. (Asynchronous)-b_allocRead' :: OSC -> Int -> String -> Int -> Int -> OSC-b_allocRead' osc nid p f n = Message "/b_allocRead" [Int nid, String p, Int f, Int n, encode_osc_blob osc]---- | Allocate buffer space and read a sound file, picking specific channels. (Asynchronous)-b_allocReadChannel' :: OSC -> Int -> String -> Int -> Int -> [Int] -> OSC-b_allocReadChannel' osc nid p f n cs = Message "/b_allocReadChannel" ([Int nid, String p, Int f, Int n] ++ map Int cs ++ [encode_osc_blob osc])---- | Free buffer data. (Asynchronous)-b_free' :: OSC -> Int -> OSC-b_free' osc nid = Message "/b_free" [Int nid, encode_osc_blob osc]---- | Close attached soundfile and write header information. (Asynchronous)-b_close' :: OSC -> Int -> OSC-b_close' osc nid = Message "/b_close" [Int nid, encode_osc_blob osc]---- | Read sound file data into an existing buffer. (Asynchronous)-b_read' :: OSC -> Int -> String -> Int -> Int -> Int -> Int -> OSC-b_read' osc nid p f n f' z = Message "/b_read" [Int nid, String p, Int f, Int n, Int f', Int z, encode_osc_blob osc]---- | Read sound file data into an existing buffer. (Asynchronous)-b_readChannel' :: OSC -> Int -> String -> Int -> Int -> Int -> Int -> [Int] -> OSC-b_readChannel' osc nid p f n f' z cs = Message "/b_readChannel" ([Int nid, String p, Int f, Int n, Int f', Int z] ++ map Int cs ++ [encode_osc_blob osc])---- | Write sound file data. (Asynchronous)-b_write' :: OSC -> Int -> String -> Int -> Int -> Int -> Int -> Int -> OSC-b_write' osc nid p h t f s z = Message "/b_write" [Int nid, String p, Int h, Int t, Int f, Int s, Int z, encode_osc_blob osc]---- | Zero sample data. (Asynchronous)-b_zero' :: OSC -> Int -> OSC-b_zero' osc nid = Message "/b_zero" [Int nid, encode_osc_blob osc]-
− Sound/SC3/Server/NRT.hs
@@ -1,26 +0,0 @@--- | Non-realtime score generation.-module Sound.SC3.Server.NRT ( encodeNRT - , writeNRT- , putNRT ) where--import qualified Data.ByteString.Lazy as B-import Sound.OpenSoundControl-import System.IO---- | Encode and prefix with encoded length.-oscWithSize :: OSC -> B.ByteString-oscWithSize o = B.append l b- where b = encodeOSC o- l = encode_i32 (fromIntegral (B.length b))---- | Encode a list of OSC bundles as an NRT score.-encodeNRT :: [OSC] -> B.ByteString-encodeNRT = B.concat . map oscWithSize---- | Write a list of OSC bundles as an NRT score.-writeNRT :: FilePath -> [OSC] -> IO ()-writeNRT fn = B.writeFile fn . encodeNRT---- | Write a list of OSC bundles as an NRT score to a file handle.-putNRT :: Handle -> [OSC] -> IO ()-putNRT h = B.hPut h . encodeNRT
− Sound/SC3/Server/Play.hs
@@ -1,38 +0,0 @@--- | Basic user interaction with the scsynth server.-module Sound.SC3.Server.Play ( play, stop, reset, send, async- , withSC3, audition ) where--import Sound.OpenSoundControl-import Sound.SC3.Server.Command-import Sound.SC3.Server.Synthdef-import Sound.SC3.UGen.UGen---- | Construct an instrument definition, send /d_recv and /s_new--- | messages to scsynth.-play :: Transport t => t -> UGen -> IO OSC-play fd u = do let d = synthdef "Anonymous" u- send fd (d_recv d) - r <- wait fd "/done"- send fd (s_new "Anonymous" (-1) AddToTail 1 [])- return r---- | Free all nodes at the group with node id 1.-stop :: Transport t => t -> IO ()-stop fd = send fd (g_freeAll [1])---- | Send an osc message and wait for a reply.-async :: Transport t => t -> OSC -> IO OSC-async fd m = send fd m >> wait fd "/done"---- | Free all nodes and re-create group node with id 1.-reset :: Transport t => t -> IO ()-reset fd = do send fd (g_freeAll [0])- send fd (g_new [(1, AddToTail, 0)])---- | Bracket SC3 communication.-withSC3 :: (UDP -> IO a) -> IO a-withSC3 = withTransport (openUDP "127.0.0.1" 57110)---- | withSC3 . play-audition :: UGen -> IO ()-audition u = withSC3 (\fd -> play fd u) >> return ()
− Sound/SC3/Server/Status.hs
@@ -1,47 +0,0 @@--- | Request and display status information from the synthesis server.-module Sound.SC3.Server.Status ( serverStatus- , serverSampleRateNominal- , serverSampleRateActual ) where--import Control.Monad-import Sound.OpenSoundControl-import Sound.SC3.Server.Command---- | Collect server status information.-serverStatus :: Transport t => t -> IO [String]-serverStatus = liftM statusFormat . serverStatusData---- | Read nominal sample rate of server.-serverSampleRateNominal :: (Transport t) => t -> IO Double-serverSampleRateNominal = liftM (extractDouble . (!! 7)) . serverStatusData---- | Read actual sample rate of server.-serverSampleRateActual :: (Transport t) => t -> IO Double-serverSampleRateActual = liftM (extractDouble . (!! 8)) . serverStatusData--extractDouble :: Datum -> Double-extractDouble (Float f) = f-extractDouble (Double f) = f-extractDouble _ = error "extractDouble"--serverStatusData :: Transport t => t -> IO [Datum]-serverStatusData fd = do send fd status - (Message _ d) <- wait fd "status.reply"- return d--statusFields :: [String]-statusFields = ["Unused ",- "# UGens ", - "# Synths ", - "# Groups ",- "# Instruments ",- "% CPU (Average) ",- "% CPU (Peak) ",- "Sample Rate (Nominal) ",- "Sample Rate (Actual) "]--statusFormat :: [Datum] -> [String]-statusFormat d = s : zipWith (++) - (tail statusFields) - (map show (tail d))- where s = "***** SuperCollider Server Status *****"
− Sound/SC3/Server/Synthdef.hs
@@ -1,322 +0,0 @@--- | The unit-generator graph structure implemented by the--- SuperCollider synthesis server.-module Sound.SC3.Server.Synthdef ( Node(..), FromPort(..), Graph(..)- , synth, synthdef, synthstat ) where--import qualified Data.ByteString.Lazy as B-import qualified Data.Char as C-import qualified Data.IntMap as M-import Data.List-import Data.Word-import Sound.OpenSoundControl-import Sound.SC3.UGen.UGen-import Sound.SC3.UGen.Rate---- | Node identifier.-type NodeId = Int---- | Port index.-type PortIndex = Int---- | Type to represent unit generator graph.-data Graph = Graph { nextId :: NodeId- , constants :: [Node]- , controls :: [Node]- , ugens :: [Node] }- deriving (Eq, Show)---- | Type to represent nodes in unit generator graph.-data Node = NodeC { node_id :: NodeId- , node_c_value :: Double }- | NodeK { node_id :: NodeId- , node_k_rate :: Rate- , node_k_name :: String- , node_k_default :: Double- , node_k_type :: KType }- | NodeU { node_id :: NodeId- , node_u_rate :: Rate- , node_u_name :: String- , node_u_inputs :: [FromPort]- , node_u_outputs :: [Output]- , node_u_special :: Special- , node_u_ugenid :: Int }- | NodeP { node_id :: NodeId- , node_p_node :: Node- , node_p_index :: PortIndex }- deriving (Eq, Show)---- There are four classes of controls.-data KType = K_IR | K_KR | K_TR | K_AR- deriving (Eq, Show, Ord)--node_k_cmp :: Node -> Node -> Ordering-node_k_cmp p q = compare (node_k_type p) (node_k_type q)---- Determine class of control given rate and name.-ktype :: Rate -> Bool -> KType-ktype r tr =- if tr- then case r of- KR -> K_TR- _ -> error "ktype"- else case r of- IR -> K_IR- KR -> K_KR- AR -> K_AR- DR -> error "ktype"---- | Type to represent the left hand side of an edge in a unit--- generator graph.-data FromPort = C NodeId- | K NodeId KType- | U NodeId PortIndex- deriving (Eq, Show)---- | Transform a unit generator into a graph.-synth :: UGen -> Graph-synth u = let (_, g) = mk_node (prepare_root u) empty_graph- (Graph _ cs ks us) = g- ks' = sortBy node_k_cmp ks- us' = if null ks'- then reverse us- else implicit ks' ++ reverse us- in Graph (-1) cs ks' us'---- | Transform a unit generator into bytecode.-synthdef :: String -> UGen -> [Word8]-synthdef s = B.unpack . encode_graphdef s . synth---- | Simple statistical analysis of a unit generator graph.-synthstat :: UGen -> String-synthstat u =- let s = synth u- cs = constants s- ks = controls s- us = ugens s- f g = let h (x:xs) = (x, length (x:xs))- h [] = undefined- in show . map h . group . sort . map g- in unlines ["number of constants : " ++ show (length cs)- ,"number of controls : " ++ show (length ks)- ,"control rates : " ++ f node_k_rate ks- ,"number of unit generators : " ++ show (length us)- ,"unit generator rates : " ++ f node_u_rate us]--as_from_port :: Node -> FromPort-as_from_port (NodeC n _) = C n-as_from_port (NodeK n _ _ _ t) = K n t-as_from_port (NodeU n _ _ _ _ _ _) = U n 0-as_from_port (NodeP _ u p) = U (node_id u) p---- The empty graph.-empty_graph :: Graph-empty_graph = Graph 0 [] [] []---- Predicate to locate constant.-find_c_p :: Double -> Node -> Bool-find_c_p x (NodeC _ y) = x == y-find_c_p _ _ = error "find_c_p"---- Insert a constant node into the graph.-push_c :: Double -> Graph -> (Node, Graph)-push_c x g = let n = NodeC (nextId g) x- in (n, g { constants = n : constants g- , nextId = nextId g + 1 })---- Either find existing constant node, or insert a new node.-mk_node_c :: UGen -> Graph -> (Node, Graph)-mk_node_c (Constant x) g =- let y = find (find_c_p x) (constants g)- in maybe (push_c x g) (\y' -> (y', g)) y-mk_node_c _ _ = error "mk_node_c"---- Predicate to locate control, names must be unique.-find_k_p :: String -> Node -> Bool-find_k_p x (NodeK _ _ y _ _) = x == y-find_k_p _ _ = error "find_k_p"---- Insert a control node into the graph.-push_k :: (Rate, String, Double, Bool) -> Graph -> (Node, Graph)-push_k (r, nm, d, tr) g =- let n = NodeK (nextId g) r nm d (ktype r tr)- in (n, g { controls = n : controls g- , nextId = nextId g + 1 })---- Either find existing control node, or insert a new node.-mk_node_k :: UGen -> Graph -> (Node, Graph)-mk_node_k (Control r nm d tr) g =- let y = find (find_k_p nm) (controls g)- in maybe (push_k (r, nm, d, tr) g) (\y' -> (y', g)) y-mk_node_k _ _ = error "mk_node_k"--acc :: [UGen] -> [Node] -> Graph -> ([Node], Graph)-acc [] n g = (reverse n, g)-acc (x:xs) ys g = let (y, g') = mk_node x g- in acc xs (y:ys) g'--type UGenParts = (Rate, String, [FromPort], [Output], Special, Int)---- Predicate to locate primitive, names must be unique.-find_u_p :: UGenParts -> Node -> Bool-find_u_p (r, n, i, o, s, d) (NodeU _ r' n' i' o' s' d')- = r == r' && n == n' && i == i' && o == o' && s == s' && d == d'-find_u_p _ _ = error "find_u_p"---- Insert a primitive node into the graph.-push_u :: UGenParts -> Graph -> (Node, Graph)-push_u (r, nm, i, o, s, d) g =- let n = NodeU (nextId g) r nm i o s d- in (n, g { ugens = n : ugens g- , nextId = nextId g + 1 })---- Either find existing control node, or insert a new node.-mk_node_u :: UGen -> Graph -> (Node, Graph)-mk_node_u (Primitive r nm i o s d) g =- let (i', g') = acc i [] g- i'' = map as_from_port i'- u = (r, nm, i'', o, s, d)- y = find (find_u_p u) (ugens g')- in maybe (push_u u g') (\y' -> (y', g')) y-mk_node_u _ _ = error "mk_node_u"---- Proxies do not get stored in the graph.-mk_node_p :: Node -> PortIndex -> Graph -> (Node, Graph)-mk_node_p n p g = let z = nextId g- in (NodeP z n p, g { nextId = z + 1 })--mk_node :: UGen -> Graph -> (Node, Graph)-mk_node u g- | isConstant u = mk_node_c u g- | isControl u = mk_node_k u g- | isUGen u = mk_node_u u g- | isProxy u = let (n, g') = mk_node_u (proxySource u) g- in mk_node_p n (proxyIndex u) g'- | isMRG u = let (_, g') = mk_node (mrgRight u) g- in mk_node (mrgLeft u) g'- | isMCE u = error "mk_node: mce"- | otherwise = error "mk_node"--type Map = M.IntMap Int-type Maps = (Map, [Node], Map, Map)---- Generate maps from node identifiers to synthdef indexes.-mk_maps :: Graph -> Maps-mk_maps (Graph _ cs ks us) =- ( M.fromList (zip (map node_id cs) [0..])- , ks- , M.fromList (zip (map node_id ks) [0..])- , M.fromList (zip (map node_id us) [0..]) )---- Locate index in map given node identifer.-fetch :: NodeId -> Map -> Int-fetch = M.findWithDefault (error "fetch")--data Input = Input Int Int- deriving (Eq, Show)---- For controls we need to know not the overall index--- but in relation to controls of the same type.-fetch_k :: NodeId -> KType -> [Node] -> Int-fetch_k n t ks =- let f _ [] = error "fetch_k"- f i (x:xs) =- if n == node_id x- then i- else if t == node_k_type x- then f (i + 1) xs- else f i xs- in f 0 ks---- Construct input form required by byte-code generator.-make_input :: Maps -> FromPort -> Input-make_input (cs, _, _, _) (C n) = Input (-1) (fetch n cs)-make_input (_, ks, _, _) (K n t) =- let i = case t of- K_IR -> 0- K_KR -> 1- K_TR -> 2- K_AR -> 3- in Input i (fetch_k n t ks)-make_input (_, _, _, us) (U n p) = Input (fetch n us) p---- Byte-encode input value.-encode_input :: Input -> B.ByteString-encode_input (Input u p) = B.append (encode_i16 u) (encode_i16 p)---- Byte-encode control node.-encode_node_k :: Maps -> Node -> B.ByteString-encode_node_k (_, _, ks, _) (NodeK n _ nm _ _) =- B.concat [ B.pack (str_pstr nm)- , encode_i16 (fetch n ks) ]-encode_node_k _ _ = error "encode_node_k"---- Byte-encode primitive node.-encode_node_u :: Maps -> Node -> B.ByteString-encode_node_u m (NodeU _ r nm i o s _) =- let i' = map (encode_input . make_input m) i- o' = map (encode_i8 . rateId) o- (Special s') = s- in B.concat [ B.pack (str_pstr nm)- , encode_i8 (rateId r)- , encode_i16 (length i)- , encode_i16 (length o)- , encode_i16 s'- , B.concat i'- , B.concat o' ]-encode_node_u _ _ = error "encode_ugen: illegal input"---- Construct instrument definition bytecode.-encode_graphdef :: String -> Graph -> B.ByteString-encode_graphdef s g =- let (Graph _ cs ks us) = g- mm = mk_maps g- in B.concat [ encode_str "SCgf"- , encode_i32 0- , encode_i16 1- , B.pack (str_pstr s)- , encode_i16 (length cs)- , B.concat (map (encode_f32 . node_c_value) cs)- , encode_i16 (length ks)- , B.concat (map (encode_f32 . node_k_default) ks)- , encode_i16 (length ks)- , B.concat (map (encode_node_k mm) ks)- , encode_i16 (length us)- , B.concat (map (encode_node_u mm) us) ]--type KS_COUNT = (Int,Int,Int,Int)--ks_count :: [Node] -> KS_COUNT-ks_count ks =- let f r [] = r- f (i,k,t,a) (x:xs) =- let r' = case node_k_type x of- K_IR -> (i+1,k,t,a)- K_KR -> (i,k+1,t,a)- K_TR -> (i,k,t+1,a)- K_AR -> (i,k,t,a+1)- in f r' xs- in f (0,0,0,0) ks---- Construct implicit control unit generator nodes.-implicit :: [Node] -> [Node]-implicit ks =- let (ni,nk,nt,na) = ks_count ks- mk_n t n o =- let (nm, r) = case t of- K_IR -> ("Control", IR)- K_KR -> ("Control", KR)- K_TR -> ("TrigControl", KR)- K_AR -> ("AudioControl", AR)- i = replicate n r- in NodeU (-1) r nm [] i (Special o) defaultID- in [mk_n K_IR ni 0- ,mk_n K_KR nk ni- ,mk_n K_TR nt (ni + nk)- ,mk_n K_AR na (ni + nk + nt)]---- Transform mce nodes to mrg nodes-prepare_root :: UGen -> UGen-prepare_root u- | isMCE u = mrg (mceProxies u)- | isMRG u = MRG (prepare_root (mrgLeft u)) (prepare_root (mrgRight u))- | otherwise = u
− Sound/SC3/Server/Utilities.hs
@@ -1,11 +0,0 @@-module Sound.SC3.Server.Utilities where--mk_duples :: (a -> c) -> (b -> c) -> [(a, b)] -> [c]-mk_duples a b = concatMap (\(x,y) -> [a x, b y])--mk_duples_l :: (Int -> c) -> (a -> c) -> (b -> c) -> [(a, [b])] -> [c]-mk_duples_l i a b = concatMap (\(x,y) -> a x : i (length y) : map b y)--mk_triples :: (a -> d) -> (b -> d) -> (c -> d) -> [(a, b, c)] -> [d]-mk_triples a b c = concatMap (\(x,y,z) -> [a x, b y, c z])-
− Sound/SC3/UGen.hs
@@ -1,60 +0,0 @@--- | Collection of modules for writing unit-generator graphs.-module Sound.SC3.UGen (module Sound.SC3.UGen.Analysis,- module Sound.SC3.UGen.Buffer,- module Sound.SC3.UGen.Chaos,- module Sound.SC3.UGen.Composite,--- module Sound.SC3.UGen.Composite.Monadic,- module Sound.SC3.UGen.Demand,--- module Sound.SC3.UGen.Demand.Monadic,- module Sound.SC3.UGen.DiskIO,- module Sound.SC3.UGen.Envelope,- module Sound.SC3.UGen.Envelope.Construct,- module Sound.SC3.UGen.Enum,- module Sound.SC3.UGen.External,- module Sound.SC3.UGen.External.ATS,- module Sound.SC3.UGen.External.LPC,- module Sound.SC3.UGen.FFT,--- module Sound.SC3.UGen.FFT.Monadic,- module Sound.SC3.UGen.Filter,- module Sound.SC3.UGen.Granular,- module Sound.SC3.UGen.Information,- module Sound.SC3.UGen.IO,- module Sound.SC3.UGen.MachineListening,- module Sound.SC3.UGen.Math,--- module Sound.SC3.UGen.Noise.Monadic,- module Sound.SC3.UGen.Operator,- module Sound.SC3.UGen.Oscillator,- module Sound.SC3.UGen.Panner,- module Sound.SC3.UGen.Rate,- module Sound.SC3.UGen.UGen,- module Sound.SC3.UGen.UId) where--import Sound.SC3.UGen.Analysis-import Sound.SC3.UGen.Buffer-import Sound.SC3.UGen.Chaos-import Sound.SC3.UGen.Composite---import Sound.SC3.UGen.Composite.Monadic-import Sound.SC3.UGen.Demand---import Sound.SC3.UGen.Demand.Monadic-import Sound.SC3.UGen.DiskIO-import Sound.SC3.UGen.Envelope-import Sound.SC3.UGen.Envelope.Construct-import Sound.SC3.UGen.Enum-import Sound.SC3.UGen.External-import Sound.SC3.UGen.External.ATS-import Sound.SC3.UGen.External.LPC-import Sound.SC3.UGen.FFT---import Sound.SC3.UGen.FFT.Monadic-import Sound.SC3.UGen.Filter-import Sound.SC3.UGen.Granular-import Sound.SC3.UGen.Information-import Sound.SC3.UGen.IO-import Sound.SC3.UGen.Math-import Sound.SC3.UGen.MachineListening---import Sound.SC3.UGen.Noise.Monadic-import Sound.SC3.UGen.Operator-import Sound.SC3.UGen.Oscillator-import Sound.SC3.UGen.Panner-import Sound.SC3.UGen.Rate-import Sound.SC3.UGen.UGen-import Sound.SC3.UGen.UId
− Sound/SC3/UGen/Analysis.hs
@@ -1,29 +0,0 @@--- | Signal analysis unit generators.-module Sound.SC3.UGen.Analysis where--import Sound.SC3.UGen.Rate-import Sound.SC3.UGen.UGen---- | Amplitude follower.-amplitude :: Rate -> UGen -> UGen -> UGen -> UGen-amplitude r i at rt = mkOsc r "Amplitude" [i, at, rt] 1---- | Compressor, expander, limiter, gate, ducker.-compander :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-compander i c t sb sa ct rt = mkFilter "Compander" [i, c, t, sb, sa, ct, rt] 1---- | Autocorrelation pitch follower.-pitch :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-pitch i initFreq minFreq maxFreq execFreq maxBinsPerOctave median ampThreshold peakThreshold downSample = mkOsc KR "Pitch" [i, initFreq, minFreq, maxFreq, execFreq, maxBinsPerOctave, median, ampThreshold, peakThreshold, downSample] 2---- | Slope of signal.-slope :: UGen -> UGen-slope i = mkFilter "Slope" [i] 1---- | Zero crossing frequency follower.-zeroCrossing :: UGen -> UGen-zeroCrossing i = mkFilter "ZeroCrossing" [i] 1---- Local Variables:--- truncate-lines:t--- End:
− Sound/SC3/UGen/Buffer.hs
@@ -1,160 +0,0 @@--- | Unit generators to query, read and write audio buffers.-module Sound.SC3.UGen.Buffer where--import Sound.SC3.UGen.Enum-import Sound.SC3.UGen.Rate-import Sound.SC3.UGen.UGen-import Sound.SC3.UGen.Utilities---- * Buffer query unit generators---- | Buffer channel count.-bufChannels :: Rate -> UGen -> UGen-bufChannels r buf = mkOsc r "BufChannels" [buf] 1---- | Buffer duration, in seconds.-bufDur :: Rate -> UGen -> UGen-bufDur r buf = mkOsc r "BufDur" [buf] 1---- | Buffer frame count.-bufFrames :: Rate -> UGen -> UGen-bufFrames r buf = mkOsc r "BufFrames" [buf] 1---- | Buffer rate scalar with respect to server sample rate.-bufRateScale :: Rate -> UGen -> UGen-bufRateScale r buf = mkOsc r "BufRateScale" [buf] 1---- | Buffer sample rate.-bufSampleRate :: Rate -> UGen -> UGen-bufSampleRate r buf = mkOsc r "BufSampleRate" [buf] 1---- | Buffer sample count (ie. frame count by channel count).-bufSamples :: Rate -> UGen -> UGen-bufSamples r buf = mkOsc r "BufSamples" [buf] 1---- * Buffer filters and delays---- | Allpass filter (cubic interpolation).-bufAllpassC :: UGen -> UGen -> UGen -> UGen -> UGen-bufAllpassC buf i dly dcy = mkFilter "BufAllpassC" [buf, i, dly, dcy] 1---- | Allpass filter (linear interpolation).-bufAllpassL :: UGen -> UGen -> UGen -> UGen -> UGen-bufAllpassL buf i dly dcy = mkFilter "BufAllpassL" [buf, i, dly, dcy] 1---- | Allpass filter (no interpolation).-bufAllpassN :: UGen -> UGen -> UGen -> UGen -> UGen-bufAllpassN buf i dly dcy = mkFilter "BufAllpassN" [buf, i, dly, dcy] 1---- | Comb filter (cubic interpolation).-bufCombC :: UGen -> UGen -> UGen -> UGen -> UGen-bufCombC buf i dly dcy = mkFilter "BufCombC" [buf, i, dly, dcy] 1---- | Comb filter (linear interpolation).-bufCombL :: UGen -> UGen -> UGen -> UGen -> UGen-bufCombL buf i dly dcy = mkFilter "BufCombL" [buf, i, dly, dcy] 1---- | Comb filter (no interpolation).-bufCombN :: UGen -> UGen -> UGen -> UGen -> UGen-bufCombN buf i dly dcy = mkFilter "BufCombN" [buf, i, dly, dcy] 1---- | Delay line (cubic interpolation).-bufDelayC :: UGen -> UGen -> UGen -> UGen-bufDelayC buf i dly = mkFilter "BufDelayC" [buf, i, dly] 1---- | Delay line (linear interpolation).-bufDelayL :: UGen -> UGen -> UGen -> UGen-bufDelayL buf i dly = mkFilter "BufDelayL" [buf, i, dly] 1---- | Delay line (no interpolation).-bufDelayN :: UGen -> UGen -> UGen -> UGen-bufDelayN buf i dly = mkFilter "BufDelayN" [buf, i, dly] 1---- * Buffer I\/O---- | Buffer reader.-bufRd :: Int -> Rate -> UGen -> UGen -> Loop -> Interpolation -> UGen-bufRd n r buf phs lp intp = mkOsc r "BufRd" [buf, phs, from_loop lp, from_interpolation intp] n---- | Buffer reader (no interpolation).-bufRdN :: Int -> Rate -> UGen -> UGen -> Loop -> UGen-bufRdN n r b p l = bufRd n r b p l NoInterpolation---- | Buffer reader (linear interpolation).-bufRdL :: Int -> Rate -> UGen -> UGen -> Loop -> UGen-bufRdL n r b p l = bufRd n r b p l LinearInterpolation---- | Buffer reader (cubic interpolation).-bufRdC :: Int -> Rate -> UGen -> UGen -> Loop -> UGen-bufRdC n r b p l = bufRd n r b p l CubicInterpolation---- | Buffer writer.-bufWr :: UGen -> UGen -> Loop -> UGen -> UGen-bufWr buf phs lp i = mkFilterMCE "BufWr" [buf, phs, from_loop lp] i 0---- | Search a buffer for a value.-detectIndex :: UGen -> UGen -> UGen-detectIndex b i = mkFilter "DetectIndex" [b, i] 1---- | Index into table with signal.-index :: UGen -> UGen -> UGen-index b i = mkFilter "Index" [b, i] 1---- | Interpolating search in ordered table.-indexInBetween :: UGen -> UGen -> UGen-indexInBetween b i = mkFilter "IndexInBetween" [b, i] 1---- | Wavetable oscillator.-osc :: Rate -> UGen -> UGen -> UGen -> UGen-osc r bufnum freq phase = mkOsc r "Osc" [bufnum, freq, phase] 1---- | Wavetable oscillator.-oscN :: Rate -> UGen -> UGen -> UGen -> UGen-oscN r bufnum freq phase = mkOsc r "OscN" [bufnum, freq, phase] 1---- | Buffer playback.-playBuf :: Int -> UGen -> UGen -> UGen -> UGen -> Loop -> DoneAction -> UGen-playBuf n b r t s l a = mkOsc AR "PlayBuf" [b, r, t, s, from_loop l, from_done_action a] n---- | Buffer recording.-recordBuf :: UGen -> UGen -> UGen -> UGen -> UGen -> Loop -> UGen -> DoneAction -> UGen -> UGen-recordBuf b o rl pl r l t a i = mkOscMCE AR "RecordBuf" [b, o, rl, pl, r, from_loop l, t, from_done_action a] i 0---- | Triggered buffer shuffler (grain generator).-tGrains :: Int -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-tGrains n t b r c d p a i = mkFilter "TGrains" [t, b, r, c, d, p, a, i] n---- | Three variable wavetable oscillator.-vOsc3 :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen-vOsc3 r b f1 f2 f3 = mkOsc r "VOsc3" [b, f1, f2, f3] 1---- | Variable wavetable oscillator.-vOsc :: Rate -> UGen -> UGen -> UGen -> UGen-vOsc r b f phase = mkOsc r "VOsc" [b, f, phase] 1---- * Local buffers---- | Allocate a buffer local to the synth.-localBuf :: ID i => i -> UGen -> UGen -> UGen-localBuf z nf nc = mkOscId z IR "LocalBuf" [nc, nf] 1--- note that nf & nc are swapped at actual ugen---- | Set the maximum number of local buffers in a synth.-maxLocalBufs :: UGen -> UGen-maxLocalBufs n = mkOsc IR "MaxLocalBufs" [n] 0---- | Set local buffer values.-setBuf :: UGen -> [UGen] -> UGen -> UGen-setBuf b xs o = mkOsc IR "SetBuf" ([b, o, fromIntegral (length xs)] ++ xs) 1---- | Generate a localBuf and use setBuf to initialise it.-asLocalBuf :: ID i => i -> [UGen] -> UGen-asLocalBuf i xs =- let m = maxLocalBufs 8- b = mrg2 (localBuf i (fromIntegral (length xs)) 1) m- s = setBuf b xs 0- in mrg2 b s---- Local Variables:--- truncate-lines:t--- End:
− Sound/SC3/UGen/Chaos.hs
@@ -1,85 +0,0 @@--- | Chaotic functions.-module Sound.SC3.UGen.Chaos where--import Sound.SC3.UGen.Rate-import Sound.SC3.UGen.UGen---- | Chaotic noise.-crackle :: Rate -> UGen -> UGen-crackle r chaosParam = mkOsc r "Crackle" [chaosParam] 1---- | Cusp map chaotic generator (linear interpolation).-cuspL :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen-cuspL r freq a b xi = mkOsc r "CuspL" [freq, a, b, xi] 1---- | Cusp map chaotic generator (no interpolation).-cuspN :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen-cuspN r freq a b xi = mkOsc r "CuspN" [freq, a, b, xi] 1---- | Feedback sine with chaotic phase indexing (cubic interpolation).-fbSineC :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-fbSineC r freq im fb a c xi yi = mkOsc r "FBSineC" [freq, im, fb, a, c, xi, yi] 1---- | Feedback sine with chaotic phase indexing (linear interpolation).-fbSineL :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-fbSineL r freq im fb a c xi yi = mkOsc r "FBSineL" [freq, im, fb, a, c, xi, yi] 1---- | Feedback sine with chaotic phase indexing (no interpolation).-fbSineN :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-fbSineN r freq im fb a c xi yi = mkOsc r "FBSineN" [freq, im, fb, a, c, xi, yi] 1---- | Henon map chaotic generator (cubic interpolation).-henonC :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-henonC r freq a b x0 x1 = mkOsc r "HenonC" [freq, a, b, x0, x1] 1---- | Henon map chaotic generator (linear interpolation).-henonL :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-henonL r freq a b x0 x1 = mkOsc r "HenonL" [freq, a, b, x0, x1] 1---- | Henon map chaotic generator (no interpolation).-henonN :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-henonN r freq a b x0 x1 = mkOsc r "HenonN" [freq, a, b, x0, x1] 1---- | Latoocarfian chaotic function (cubic interpolation).-latoocarfianC :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-latoocarfianC r f a b c d xi yi = mkOsc r "LatoocarfianC" [f, a, b, c, d, xi, yi] 1---- | Latoocarfian chaotic function (linear interpolation).-latoocarfianL :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-latoocarfianL r f a b c d xi yi = mkOsc r "LatoocarfianL" [f, a, b, c, d, xi, yi] 1---- | Latoocarfian chaotic function (no interpolation).-latoocarfianN :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-latoocarfianN r f a b c d xi yi = mkOsc r "LatoocarfianN" [f, a, b, c, d, xi, yi] 1---- | Linear congruential chaotic generator (cubic interpolation).-linCongC :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-linCongC r f a c m xi = mkOsc r "LinCongC" [f, a, c, m, xi] 1---- | Linear congruential chaotic generator (linear interpolation).-linCongL :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-linCongL r f a c m xi = mkOsc r "LinCongL" [f, a, c, m, xi] 1---- | Linear congruential chaotic generator (no interpolation).-linCongN :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-linCongN r f a c m xi = mkOsc r "LinCongN" [f, a, c, m, xi] 1---- | Lorenz chaotic generator (linear interpolation).-lorenzL :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-lorenzL rate freq s r b h xi yi zi = mkOsc rate "LorenzL" [freq, s, r, b, h, xi, yi, zi] 1---- | General quadratic map chaotic generator (cubic interpolation).-quadC :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-quadC r freq a b c xi = mkOsc r "QuadC" [freq, a, b, c, xi] 1---- | General quadratic map chaotic generator (linear interpolation).-quadL :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-quadL r freq a b c xi = mkOsc r "QuadL" [freq, a, b, c, xi] 1---- | General quadratic map chaotic generator (no interpolation).-quadN :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-quadN r freq a b c xi = mkOsc r "QuadN" [freq, a, b, c, xi] 1---- Local Variables:--- truncate-lines:t--- End:
− Sound/SC3/UGen/Composite.hs
@@ -1,70 +0,0 @@--- | Common unit generator graphs.-module Sound.SC3.UGen.Composite where--import Control.Monad-import Data.List-import Data.List.Split-import Sound.SC3.UGen.Buffer-import Sound.SC3.UGen.Filter-import Sound.SC3.UGen.Information-import Sound.SC3.UGen.IO-import Sound.SC3.UGen.Math-import Sound.SC3.UGen.Oscillator-import Sound.SC3.UGen.Panner-import Sound.SC3.UGen.Rate-import Sound.SC3.UGen.UGen---- | Dynamic klank, set of non-fixed resonating filters.-dynKlank :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen-dynKlank i fs fo ds s = gen (mceChannels s)- where gen (f:a:d:xs) = ringz i (f * fs + fo) (d * ds) * a + gen xs- gen _ = 0---- | Frequency shifter, in terms of Hilbert UGen.-freqShift :: UGen -> UGen -> UGen -> UGen-freqShift i f p = mix (h * o)- where o = sinOsc AR f (mce [p + 0.5 * pi, p])- h = hilbert i---- | Linear interpolating variant on index.-indexL :: UGen -> UGen -> UGen-indexL b i =- let x = index b i- y = index b (i + 1)- in linLin (frac i) 0 1 x y---- | Collapse possible mce by summing.-mix :: UGen -> UGen-mix = foldl1 (+) . mceChannels---- | Mix variant, sum to n channels.-mixN :: Int -> UGen -> UGen-mixN n u =- let xs = transpose (splitEvery n (mceChannels u))- in mce (map (foldl1 (+)) xs)---- | Construct and sum a set of UGens.-mixFill :: Int -> (Int -> UGen) -> UGen-mixFill n f = mix (mce (map f [0..n-1]))---- | Monadic variant on mixFill.-mixFillM :: (Monad m) => Int -> (Int -> m UGen) -> m UGen-mixFillM n f = liftM sum (mapM f [0 .. n - 1])---- | PM oscillator.-pmOsc :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen-pmOsc r cf mf pm mp = sinOsc r cf (sinOsc r mf mp * pm)---- | Zero indexed audio input buses.-soundIn :: UGen -> UGen-soundIn (MCE ns) | all (==1) $ zipWith (-) (tail ns) ns =- in' (length ns) AR (numOutputBuses + head ns)-soundIn n =- in' 1 AR (numOutputBuses + n)---- | Pan a set of channels across the stereo field.-splay :: UGen -> UGen -> UGen -> UGen -> UGen-splay i s l c = mix (pan2 i (mce p * s + c) 1) * l * sqrt (1 / n)- where n = fromIntegral (mceDegree i)- m = n - 1- p = map ( (+ (-1.0)) . (* (2 / m)) ) [0 .. m]
− Sound/SC3/UGen/Composite/Monadic.hs
@@ -1,21 +0,0 @@-module Sound.SC3.UGen.Composite.Monadic where--import Sound.SC3.UGen.Demand.Monadic-import Sound.SC3.UGen.Filter-import Sound.SC3.UGen.Noise.Monadic-import Sound.SC3.UGen.UGen-import Sound.SC3.UGen.UId---- | Demand rate (:) function.-dcons :: (UId m) => UGen -> UGen -> m UGen-dcons x xs = do i <- dseq 1 (mce2 0 1)- a <- dseq 1 (mce2 x xs)- dswitch i a--tChoose :: (UId m) => UGen -> UGen -> m UGen-tChoose t a = do r <- tiRand 0 (constant (length (mceChannels a))) t- return (select r a)--twChoose :: (UId m) => UGen -> UGen -> UGen -> UGen -> m UGen-twChoose t a w n = do i <- twindex t n w- return (select i a)
− Sound/SC3/UGen/Demand.hs
@@ -1,32 +0,0 @@--- | Demand rate unit generators.-module Sound.SC3.UGen.Demand where--import Sound.SC3.UGen.Enum-import Sound.SC3.UGen.Rate-import Sound.SC3.UGen.UGen-import Sound.SC3.UGen.Utilities---- | Infinte repeat counter for demand rate unit generators.-dinf :: UGen-dinf = Constant 9E8---- | Demand results from demand rate ugens.-demand :: UGen -> UGen -> UGen -> UGen-demand t r d = mkFilterKeyed "Demand" 0 (t : r : d') (length d')- where d' = mceChannels d---- | Demand envlope generator.-demandEnvGen :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> DoneAction -> UGen-demandEnvGen r l d s c g rst ls lb ts a = mkOsc r "DemandEnvGen" [l, d, s, c, g, rst, ls, lb, ts, from_done_action a] 1---- | Demand results from demand rate ugens.-duty :: Rate -> UGen -> UGen -> DoneAction -> UGen -> UGen-duty rate d r act l = mkOsc rate "Duty" [d, r, from_done_action act, l] 1---- | Demand results as trigger from demand rate ugens.-tDuty :: Rate -> UGen -> UGen -> DoneAction -> UGen -> UGen -> UGen-tDuty r d rst act l gap = mkOsc r "TDuty" [d, rst, from_done_action act, l, gap] 1---- Local Variables:--- truncate-lines:t--- End:
− Sound/SC3/UGen/Demand/ID.hs
@@ -1,66 +0,0 @@-module Sound.SC3.UGen.Demand.ID where--import Sound.SC3.UGen.Enum-import Sound.SC3.UGen.Rate-import Sound.SC3.UGen.UGen-import Sound.SC3.UGen.Utilities---- | Buffer demand ugen.-dbufrd :: ID i => i -> UGen -> UGen -> Loop -> UGen-dbufrd z b p l = mkOscId z DR "Dbufrd" [b, p, from_loop l] 1---- | Buffer write on demand unit generator.-dbufwr :: ID i => i -> UGen -> UGen -> UGen -> Loop -> UGen-dbufwr z b p i l = mkOscId z DR "Dbufwr" [b, p, i, from_loop l] 1---- | Demand rate white noise.-dwhite :: ID i => i -> UGen -> UGen -> UGen -> UGen-dwhite z l lo hi = mkOscId z DR "Dwhite" [l, lo, hi] 1---- | Demand rate integer white noise.-diwhite :: ID i => i -> UGen -> UGen -> UGen -> UGen-diwhite z l lo hi = mkOscId z DR "Diwhite" [l, lo, hi] 1---- | Demand rate brown noise.-dbrown :: ID i => i -> UGen -> UGen -> UGen -> UGen -> UGen-dbrown z l lo hi step = mkOscId z DR "Dbrown" [l, lo, hi, step] 1---- | Demand rate integer brown noise.-dibrown :: ID i => i -> UGen -> UGen -> UGen -> UGen -> UGen-dibrown z l lo hi step = mkOscId z DR "Dibrown" [l, lo, hi, step] 1---- | Demand rate random selection.-drand :: ID i => i -> UGen -> UGen -> UGen-drand z l array = mkOscMCEId z DR "Drand" [l] array 1---- | Demand rate random selection with no immediate repetition.-dxrand :: ID i => i -> UGen -> UGen -> UGen-dxrand z l array = mkOscMCEId z DR "Dxrand" [l] array 1---- | Demand rate arithmetic series.-dseries :: ID i => i -> UGen -> UGen -> UGen -> UGen-dseries z l i n = mkOscId z DR "Dseries" [l, i, n] 1---- | Demand rate geometric series.-dgeom :: ID i => i -> UGen -> UGen -> UGen -> UGen-dgeom z l i n = mkOscId z DR "Dgeom" [l, i, n] 1---- | Demand rate sequence generator.-dseq :: ID i => i -> UGen -> UGen -> UGen-dseq z l array = mkOscMCEId z DR "Dseq" [l] array 1---- | Demand rate series generator.-dser :: ID i => i -> UGen -> UGen -> UGen-dser z l array = mkOscMCEId z DR "Dser" [l] array 1---- | Demand input replication-dstutter :: ID i => i -> UGen -> UGen -> UGen-dstutter z n i = mkOscId z DR "Dstutter" [n,i] 1---- | Demand rate input switching.-dswitch1 :: ID i => i -> UGen -> UGen -> UGen-dswitch1 z l array = mkOscMCEId z DR "Dswitch1" [l] array 1---- | Demand rate input switching.-dswitch :: ID i => i -> UGen -> UGen -> UGen-dswitch z l array = mkOscMCEId z DR "Dswitch" [l] array 1
− Sound/SC3/UGen/Demand/Monadic.hs
@@ -1,67 +0,0 @@-module Sound.SC3.UGen.Demand.Monadic where--import Sound.SC3.UGen.UGen-import Sound.SC3.UGen.UGen.Lift-import qualified Sound.SC3.UGen.Demand.ID as D-import Sound.SC3.UGen.UId-import Sound.SC3.UGen.Enum---- | Buffer demand ugen.-dbufrd :: (UId m) => UGen -> UGen -> Loop -> m UGen-dbufrd = liftU3 D.dbufrd---- | Buffer write on demand unit generator.-dbufwr :: (UId m) => UGen -> UGen -> UGen -> Loop -> m UGen-dbufwr = liftU4 D.dbufwr---- | Demand rate white noise.-dwhite :: (UId m) => UGen -> UGen -> UGen -> m UGen-dwhite = liftU3 D.dwhite---- | Demand rate integer white noise.-diwhite :: (UId m) => UGen -> UGen -> UGen -> m UGen-diwhite = liftU3 D.diwhite---- | Demand rate brown noise.-dbrown :: (UId m) => UGen -> UGen -> UGen -> UGen -> m UGen-dbrown = liftU4 D.dbrown---- | Demand rate integer brown noise.-dibrown :: (UId m) => UGen -> UGen -> UGen -> UGen -> m UGen-dibrown = liftU4 D.dibrown---- | Demand rate random selection.-drand :: (UId m) => UGen -> UGen -> m UGen-drand = liftU2 D.drand---- | Demand rate random selection with no immediate repetition.-dxrand :: (UId m) => UGen -> UGen -> m UGen-dxrand = liftU2 D.dxrand---- | Demand rate arithmetic series.-dseries :: (UId m) => UGen -> UGen -> UGen -> m UGen-dseries = liftU3 D.dseries---- | Demand rate geometric series.-dgeom :: (UId m) => UGen -> UGen -> UGen -> m UGen-dgeom = liftU3 D.dgeom---- | Demand rate sequence generator.-dseq :: (UId m) => UGen -> UGen -> m UGen-dseq = liftU2 D.dseq---- | Demand rate series generator.-dser :: (UId m) => UGen -> UGen -> m UGen-dser = liftU2 D.dser---- | Demand input replication-dstutter :: (UId m) => UGen -> UGen -> m UGen-dstutter = liftU2 D.dstutter---- | Demand rate input switching.-dswitch1 :: (UId m) => UGen -> UGen -> m UGen-dswitch1 = liftU2 D.dswitch1---- | Demand rate input switching.-dswitch :: (UId m) => UGen -> UGen -> m UGen-dswitch = liftU2 D.dswitch
− Sound/SC3/UGen/DiskIO.hs
@@ -1,32 +0,0 @@-module Sound.SC3.UGen.DiskIO where--import Sound.SC3.UGen.Enum-import Sound.SC3.UGen.Rate-import Sound.SC3.UGen.UGen-import Sound.SC3.UGen.Utilities---- | Stream soundfile from disk.------ [@nc@] Number of channels in buffer/soundfile.------ [@bufnum@] Buffer used for streaming (the file descriptor has to be left--- open, see the @/b_read@ server command).------ [@loop@] Whether to loop playback (0, 1)----diskIn :: Int -> UGen -> Loop -> UGen-diskIn nc bufnum loop = mkOsc AR "DiskIn" [bufnum, from_loop loop] nc---- | Stream soundfile from disk with variable playback rate.------ [@nc@] Number of channels in buffer/soundfile.------ [@bufnum@] Buffer used for streaming (the file descriptor has to be left--- open, see the @/b_read@ server command).------ [@rate@] Playback rate------ [@loop@] Whether to loop playback (0,1)----vDiskIn :: Int -> UGen -> UGen -> Loop -> UGen-vDiskIn nc bufnum rate loop = mkOsc AR "VDiskIn" [bufnum, rate, from_loop loop] nc
− Sound/SC3/UGen/Enum.hs
@@ -1,41 +0,0 @@--- | Data types for enumerated and non signal unit generator inputs.-module Sound.SC3.UGen.Enum where--import Sound.SC3.UGen.UGen---- | Loop indicator input.-data Loop = Loop- | NoLoop- | WithLoop UGen- deriving (Eq, Show)---- | Interpolation indicator input.-data Interpolation = NoInterpolation- | LinearInterpolation- | CubicInterpolation- | Interpolation UGen- deriving (Eq, Show)---- | Completion mode indicator input.-data DoneAction = DoNothing- | PauseSynth- | RemoveSynth- | DoneAction UGen- deriving (Eq, Show)---- | Warp interpolation indicator input.-data Warp = Linear- | Exponential- | Warp UGen- deriving (Eq, Show)---- | Envelope curve indicator input.-data EnvCurve = EnvStep- | EnvLin- | EnvExp- | EnvSin- | EnvCos- | EnvNum UGen- | EnvSqr- | EnvCub- deriving (Eq, Show)
− Sound/SC3/UGen/Envelope.hs
@@ -1,56 +0,0 @@--- | Envelope generators.-module Sound.SC3.UGen.Envelope where--import Sound.SC3.UGen.Enum-import Sound.SC3.UGen.Rate-import Sound.SC3.UGen.UGen-import Sound.SC3.UGen.Utilities---- | Segment based envelope generator.-envGen :: Rate -> UGen -> UGen -> UGen -> UGen -> DoneAction -> [UGen] -> UGen-envGen r gate lvl bias scale act pts = mkOsc r "EnvGen" i 1- where i = [gate, lvl, bias, scale, from_done_action act] ++ pts---- | Line generator.-line :: Rate -> UGen -> UGen -> UGen -> DoneAction -> UGen-line r start end dur act = mkOsc r "Line" [start, end, dur, from_done_action act] 1---- | Exponential line generator.-xLine :: Rate -> UGen -> UGen -> UGen -> DoneAction -> UGen-xLine r start end dur act = mkOsc r "XLine" [start, end, dur, from_done_action act] 1---- | Free node on trigger.-freeSelf :: UGen -> UGen-freeSelf i = mkFilter "FreeSelf" [i] 0---- | Free node on done action at source.-freeSelfWhenDone :: UGen -> UGen-freeSelfWhenDone i = mkFilter "FreeSelfWhenDone" [i] 1---- | Pause specified node on trigger.-pause :: UGen -> UGen -> UGen-pause t n = mkFilter "Pause" [t, n] 1---- | Pause node on trigger.-pauseSelf :: UGen -> UGen-pauseSelf i = mkFilter "PauseSelf" [i] 0---- | Pause node on done action at source.-pauseSelfWhenDone :: UGen -> UGen-pauseSelfWhenDone i = mkFilter "PauseSelfWhenDone" [i] 0---- | One while the source is marked done, else zero.-done :: UGen -> UGen-done i = mkFilter "Done" [i] 1---- | Raise specified done action when input goes silent.-detectSilence :: UGen -> UGen -> UGen -> DoneAction -> UGen-detectSilence i a t act = mkFilter "DetectSilence" [i, a, t, from_done_action act] 0---- | When triggered free specified node.-free :: UGen -> UGen -> UGen-free i n = mkFilter "Free" [i, n] 1---- | Linear envelope generator.-linen :: UGen -> UGen -> UGen -> UGen -> DoneAction -> UGen-linen g at sl rt da = mkFilter "Linen" [g, at, sl, rt, from_done_action da] 1
− Sound/SC3/UGen/Envelope/Construct.hs
@@ -1,102 +0,0 @@--- | Functions to generate break point data for standard envelope--- types.-module Sound.SC3.UGen.Envelope.Construct (env- ,envCoord- ,envTrapezoid- ,envPerc', envPerc- ,envTriangle- ,envSine- ,envLinen', envLinen) where--import Sound.SC3.UGen.UGen-import Sound.SC3.UGen.Math-import Sound.SC3.UGen.Enum---- | Basic envelope data constructor. The curve argument are cycled--- if required.-env :: [UGen] -> [UGen] -> [EnvCurve] -> UGen -> UGen -> [UGen]-env [] _ _ _ _ = error "env: illegal specification"-env (l:ls) tms crv rls lp =- let f l' t c = [l', t, env_curve c, env_value c]- n = length tms- n' = fromIntegral n- crv' = take n (cycle crv)- in [l, n', rls, lp] ++ concat (zipWith3 f ls tms crv')---- | Co-ordinate based static envelope generator.-envCoord :: [(UGen, UGen)] -> UGen -> UGen -> EnvCurve -> [UGen]-envCoord bp dur amp c = - let l = map ((* amp) . snd) bp- t = map (* dur) (d_dx (map fst bp))- in env l t (repeat c) (-1) (-1)--{- | Trapezoidal envelope generator. The arguments are: 1. @shape@-determines the sustain time as a proportion of @dur@, zero is a-triangular envelope, one a rectangular envelope; 2. @skew@ determines-the attack\/decay ratio, zero is an immediate attack and a slow decay,-one a slow attack and an immediate decay; 3. @duration@ in seconds;-4. @amplitude@ as linear gain. -}-envTrapezoid :: UGen -> UGen -> UGen -> UGen -> [UGen]-envTrapezoid shape skew dur amp =- let x1 = skew * (1 - shape)- bp = [ (0, skew <=* 0)- , (x1, 1)- , (shape + x1, 1)- , (1, skew >=* 1) ]- in envCoord bp dur amp EnvLin--envPerc' :: UGen -> UGen -> UGen -> (EnvCurve, EnvCurve) -> [UGen]-envPerc' atk rls lvl (c0, c1) =- let c = [c0, c1]- in env [0.0, lvl, 0.0] [atk, rls] c (-1.0) (-1.0)---- | Percussive envelope, with attack, release, level and curve--- inputs.-envPerc :: UGen -> UGen -> [UGen]-envPerc atk rls =- let cn = EnvNum (-4.0)- in envPerc' atk rls 1.0 (cn, cn)---- | Triangular envelope, with duration and level inputs.-envTriangle :: UGen -> UGen -> [UGen]-envTriangle dur lvl =- let c = replicate 2 EnvLin- d = replicate 2 (dur / 2.0)- in env [0.0, lvl, 0.0] d c (-1.0) (-1.0)---- | Sine envelope, with duration and level inputs.-envSine :: UGen -> UGen -> [UGen]-envSine dur lvl =- let c = replicate 2 EnvSin- d = replicate 2 (dur / 2.0)- in env [0.0, lvl, 0.0] d c (-1.0) (-1.0)--envLinen' :: UGen -> UGen -> UGen -> UGen -> (EnvCurve, EnvCurve, EnvCurve) -> [UGen]-envLinen' aT sT rT l (c0, c1, c2) =- env [0, l, l, 0] [aT, sT, rT] [c0, c1, c2] (-1) (-1)---- | Linear envelope parameter constructor.-envLinen :: UGen -> UGen -> UGen -> UGen -> [UGen]-envLinen aT sT rT l =- let c = (EnvLin, EnvLin, EnvLin)- in envLinen' aT sT rT l c--d_dx :: (Num a) => [a] -> [a]-d_dx [] = []-d_dx [_] = []-d_dx [x,y] = [y - x]-d_dx (x:y:r) = y - x : d_dx (y:r)--env_curve :: EnvCurve -> UGen-env_curve EnvStep = Constant 0.0-env_curve EnvLin = Constant 1.0-env_curve EnvExp = Constant 2.0 -env_curve EnvSin = Constant 3.0-env_curve EnvCos = Constant 4.0-env_curve (EnvNum _) = Constant 5.0-env_curve EnvSqr = Constant 6.0-env_curve EnvCub = Constant 7.0--env_value :: EnvCurve -> UGen-env_value (EnvNum u) = u-env_value _ = Constant 0.0
− Sound/SC3/UGen/External.hs
@@ -1,74 +0,0 @@--- | Bindings to unit generators not distributed with SuperCollider--- proper.-module Sound.SC3.UGen.External where--import Sound.SC3.UGen.Rate-import Sound.SC3.UGen.UGen---- | Resynthesize sinusoidal ATS analysis data.-atsSynth :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-atsSynth b np ps pk fp m a = mkOsc AR "AtsSynth" [b, np, ps, pk, fp, m, a] 1---- | Resynthesize sinusoidal and critical noise ATS analysis data.-atsNoiSynth :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-atsNoiSynth b np ps pk fp sr nr m a nb bs bk = mkOsc AR "AtsNoiSynth" [b, np, ps, pk, fp, sr, nr, m, a, nb, bs, bk] 1---- | Emulation of AY (aka YM) soundchip, used in Spectrum\/Atari.-ay :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-ay ta tb tc n c va vb vc ef es ct = mkOsc AR "AY" [ta, tb, tc, n, c, va, vb, vc, ef, es, ct] 1---- | Convert frequency value to value appropriate for AY tone inputs.-ayFreqToTone :: Fractional a => a -> a-ayFreqToTone f = 110300 / (f - 0.5)---- | Phase modulation oscillator matrix.-fm7 :: [[UGen]] -> [[UGen]] -> UGen-fm7 ctl m0d = mkOsc AR "FM7" (concat ctl ++ concat m0d) 6---- | Triangular waveguide mesh of a drum-like membrane.-membraneCircle :: UGen -> UGen -> UGen -> UGen-membraneCircle i t l = mkOsc AR "MembraneCircle" [i, t, l] 1---- | Triangular waveguide mesh of a drum-like membrane.-membraneHexagon :: UGen -> UGen -> UGen -> UGen-membraneHexagon i t l = mkOsc AR "MembraneHexagon" [i, t, l] 1---- | Extract cps, rmso and err signals from LPC data.-lpcVals :: Rate -> UGen -> UGen -> UGen-lpcVals r b ptr = mkOsc r "LPCVals" [b, ptr] 3---- | Resynthesize LPC analysis data.-lpcSynth :: UGen -> UGen -> UGen -> UGen-lpcSynth b s ptr = mkOsc AR "LPCSynth" [b, s, ptr] 1---- | Invert FFT amplitude data.-pv_Invert :: UGen -> UGen-pv_Invert b = mkOsc KR "PV_Invert" [b] 1---- | STK flute model.-stkFlute :: Rate-> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-stkFlute rt f jd ng vf vg bp tr = mkOsc rt "StkFlute" [f, jd, ng, vf, vg, bp, tr] 1---- | STK modal bar models.-stkModalBar :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-stkModalBar rt f i sh sp vg vf mx v tr = mkOsc rt "StkModalBar" [f, i, sh, sp, vg, vf, mx, v, tr] 1---- | STK bowed string model.-stkBowed :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-stkBowed rt f pr po vf vg l g = mkOsc rt "StkBowed" [f, pr, po, vf, vg, l, g] 1---- | STK mandolin model.-stkMandolin :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-stkMandolin rt f bs pp dm dt at tr = mkOsc rt "StkMandolin" [f, bs, pp, dm, dt, at, tr] 1 ---- | STK shaker models.-stkShakers :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-stkShakers rt i e d o rf tr = mkOsc rt "StkShakers" [i, e, d, o, rf, tr] 1---- | Vocal simulation due to W. Kaegi.-vosim :: UGen -> UGen -> UGen -> UGen -> UGen-vosim t f nc d = mkOsc AR "VOSIM" [t, f, nc, d] 1---- Local Variables:--- truncate-lines:t--- End:
− Sound/SC3/UGen/External/ATS.hs
@@ -1,98 +0,0 @@--- | Reader for ATS analyis data files.-module Sound.SC3.UGen.External.ATS ( ATS(..)- , ATSHeader(..)- , ATSFrame- , atsRead- , atsSC3 ) where--import Control.Monad-import qualified Data.ByteString.Lazy as B-import Data.List-import Sound.OpenSoundControl-import System.IO---- | ATS analysis data.-data ATS = ATS { atsHeader :: ATSHeader- , atsFrames :: [ATSFrame] }- deriving (Eq, Show)---- | ATS analysis meta-data.-data ATSHeader = ATSHeader { atsSampleRate :: Double- , atsFrameSize :: Int- , atsWindowSize :: Int- , atsNPartials :: Int- , atsNFrames :: Int- , atsMaxAmplitude :: Double- , atsMaxFrequency :: Double- , atsAnalysisDuration :: Double- , atsFileType :: Int- } deriving (Eq, Show)---- | ATS analysis frame data. -type ATSFrame = [Double]---- | Read an ATS data file.-atsRead :: FilePath -> IO ATS-atsRead fn = do- h <- openFile fn ReadMode- v <- B.hGet h 8- let reader = get_reader v- hdr_r <- replicateM 9 (reader h)- let f j = hdr_r !! (j - 1)- g = floor . f- ft = g 9- (n, x) = ftype_n ft- np = g 4- nf = g 5- fl = np * n + x- hdr = ATSHeader (f 1) (g 2) (g 3) np nf (f 6) (f 7) (f 8) ft- get_f = replicateM fl (reader h)- d <- replicateM nf get_f- hClose h- return (ATS hdr d)---- | Analysis data in format required by the sc3 ATS UGens.-atsSC3 :: ATS -> [Double]-atsSC3 (ATS h d) = - let f = fromIntegral- td = transpose d- in f (atsFileType h) :- f (atsNPartials h) :- f (atsNFrames h) :- f (atsWindowSize h) :- concatMap (td !!) (atsSC3Indices h)---- be-read_f64 :: Handle -> IO Double-read_f64 h = liftM decode_f64 (B.hGet h 8)---- le-read_f64LE :: Handle -> IO Double-read_f64LE h = liftM (decode_f64 . B.reverse) (B.hGet h 8)---- Determine endianess and hence reader.-get_reader :: B.ByteString -> (Handle -> IO Double)-get_reader v = if decode_f64 v == 123.0- then read_f64- else read_f64LE---- Calculate partial depth and frame constant.-ftype_n :: Int -> (Int, Int)-ftype_n 1 = (2, 1)-ftype_n 2 = (3, 1)-ftype_n 3 = (2, 26)-ftype_n 4 = (3, 26)-ftype_n _ = undefined---- Indices for track data in the order required by sc3.-atsSC3Indices :: ATSHeader -> [Int]-atsSC3Indices h = - let np = atsNPartials h- o = 3 * (np - 1)- a = [1,4 .. (1 + o)]- f = map (+ 1) a- p = map (+ 1) f- n = map (+ (4+o)) [0..24]- in if atsFileType h == 4- then a ++ f ++ p ++ n- else error "atsSC3Indices: illegal ATS file type (/= 4)"
− Sound/SC3/UGen/External/LPC.hs
@@ -1,62 +0,0 @@--- | Reader for LPC analysis data files.-module Sound.SC3.UGen.External.LPC ( LPC(..)- , LPCHeader(..)- , LPCFrame- , lpcRead- , lpcSC3 ) where--import Control.Monad-import qualified Data.ByteString.Lazy as B-import Data.List-import Sound.OpenSoundControl-import System.IO---- | LPC analysis data.-data LPC = LPC { lpcHeader :: LPCHeader- , lpcFrames :: [LPCFrame] }- deriving (Eq, Show)---- | LPC analysis meta-data.-data LPCHeader = LPCHeader { lpcHeaderSize :: Int- , lpcMagic :: Int- , lpcNPoles :: Int- , lpcFrameSize :: Int- , lpcFrameRate :: Double- , lpcSampleRate :: Double- , lpcAnalysisDuration :: Double- , lpcNFrames :: Int- } deriving (Eq, Show)---- | LPC analysis frame data.-type LPCFrame = [Double]---- | Read an lpanal format LPC data file.-lpcRead :: FilePath -> IO LPC-lpcRead fn = do- h <- openFile fn ReadMode- l <- hFileSize h- [hs, lm, np, fs] <- replicateM 4 (read_i32 h)- [fr, sr, fd] <- replicateM 3 (read_f32 h)- let nf = ((fromIntegral l - hs) `div` 4) `div` fs- hdr = LPCHeader hs lm np fs fr sr fd nf- hc = hs - (7 * 4)- get_f = replicateM fs (read_f32 h)- B.hGet h hc- d <- replicateM nf get_f- hClose h- return (LPC hdr d)---- | Analysis data in format required by the sc3 LPC UGens.-lpcSC3 :: LPC -> [Double]-lpcSC3 (LPC h d) = let f = fromIntegral- np = f (lpcNPoles h)- nf = f (lpcNFrames h)- fs = f (lpcFrameSize h)- in np : nf : fs : concat (transpose d)--read_i32 :: Handle -> IO Int-read_i32 h = liftM decode_i32 (B.hGet h 4)--read_f32 :: Handle -> IO Double-read_f32 h = liftM decode_f32 (B.hGet h 4)-
− Sound/SC3/UGen/FFT.hs
@@ -1,162 +0,0 @@--- | Frequency domain unit generators.-module Sound.SC3.UGen.FFT where--import Sound.OpenSoundControl (OSC)-import Sound.SC3.Server.Command (b_gen)-import Sound.SC3.UGen.Rate-import Sound.SC3.UGen.UGen---- | Fast fourier transform.-fft :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen-fft buf i h wt a = mkOsc KR "FFT" [buf,i,h,wt,a] 1---- | Variant FFT constructor with default values for hop size, window--- | type, and active status.-fft' :: UGen -> UGen -> UGen-fft' buf i = fft buf i 0.5 0 1---- | Inverse Fast Fourier Transform.-ifft :: UGen -> UGen -> UGen-ifft buf wt = mkOsc AR "IFFT" [buf,wt] 1---- | Variant ifft with default value for window type.-ifft' :: UGen -> UGen-ifft' buf = ifft buf 0---- | Strict convolution of two continuously changing inputs.-convolution :: UGen -> UGen -> UGen -> UGen-convolution i kernel frameSize = mkOsc AR "Convolution" [i, kernel, frameSize] 1---- | Pack demand-rate FFT bin streams into an FFT chain.-packFFT :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-packFFT b sz from to z mp = mkOscMCE KR "PackFFT" [b, sz, from, to, z, n] mp 1- where n = constant (mceDegree mp)---- | Format magnitude and phase data data as required for packFFT.-packFFTSpec :: [UGen] -> [UGen] -> UGen-packFFTSpec m p = mce (interleave m p)- where interleave x = concat . zipWith (\a b -> [a,b]) x--pvcollect :: UGen -> UGen -> (UGen -> UGen -> UGen -> (UGen, UGen)) -> UGen -> UGen -> UGen -> UGen-pvcollect c nf f from to z = packFFT c nf from to z mp- where m = unpackFFT c nf from to 0- p = unpackFFT c nf from to 1- i = [from .. to]- e = zipWith3 f m p i- mp = uncurry packFFTSpec (unzip e)--pv_Add :: UGen -> UGen -> UGen-pv_Add ba bb = mkOsc KR "PV_Add" [ba,bb] 1---- | Shift and scale the bin positions.-pv_BinShift :: UGen -> UGen -> UGen -> UGen-pv_BinShift buf str shift = mkOsc KR "PV_BinShift" [buf,str,shift] 1---- | Combine low and high bins from two inputs.-pv_BinWipe :: UGen -> UGen -> UGen -> UGen-pv_BinWipe ba bb wp = mkOsc KR "PV_BinWipe" [ba,bb,wp] 1---- | Clear bins above or below a cutoff point.-pv_BrickWall :: UGen -> UGen -> UGen-pv_BrickWall buf wp = mkOsc KR "PV_BrickWall" [buf,wp] 1--pv_ConformalMap :: UGen -> UGen -> UGen -> UGen-pv_ConformalMap buf real imag = mkOsc KR "PV_ConformalMap" [buf,real,imag] 1---- | Copies spectral frame.-pv_Copy :: UGen -> UGen -> UGen-pv_Copy ba bb = mkOsc KR "PV_Copy" [ba,bb] 1--pv_CopyPhase :: UGen -> UGen -> UGen-pv_CopyPhase ba bb = mkOsc KR "PV_CopyPhase" [ba,bb] 1--pv_Diffuser :: UGen -> UGen -> UGen-pv_Diffuser buf trg = mkOsc KR "PV_Diffuser" [buf,trg] 1--pv_HainsworthFoote :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen-pv_HainsworthFoote buf h f thr wait = mkOsc AR "PV_HainsworthFoote" [buf,h,f,thr,wait] 1--pv_JensenAndersen :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-pv_JensenAndersen buf sc hfe hfc sf thr wait = mkOsc AR "PV_JensenAndersen" [buf,sc,hfe,hfc,sf,thr,wait] 1--pv_LocalMax :: UGen -> UGen -> UGen-pv_LocalMax buf thr = mkOsc KR "PV_LocalMax" [buf,thr] 1--pv_MagAbove :: UGen -> UGen -> UGen-pv_MagAbove buf thr = mkOsc KR "PV_MagAbove" [buf,thr] 1--pv_MagBelow :: UGen -> UGen -> UGen-pv_MagBelow buf thr = mkOsc KR "PV_MagBelow" [buf,thr] 1--pv_MagClip :: UGen -> UGen -> UGen-pv_MagClip buf thr = mkOsc KR "PV_MagClip" [buf,thr] 1--pv_MagFreeze :: UGen -> UGen -> UGen-pv_MagFreeze buf frz = mkOsc KR "PV_MagFreeze" [buf,frz] 1--pv_MagMul :: UGen -> UGen -> UGen-pv_MagMul ba bb = mkOsc KR "PV_MagMul" [ba,bb] 1--pv_MagNoise :: UGen -> UGen-pv_MagNoise buf = mkOsc KR "PV_MagNoise" [buf] 1--pv_MagShift :: UGen -> UGen -> UGen -> UGen-pv_MagShift buf str shift = mkOsc KR "PV_MagShift" [buf,str,shift] 1--pv_MagSmear :: UGen -> UGen -> UGen-pv_MagSmear buf bins = mkOsc KR "PV_MagSmear" [buf,bins] 1--pv_MagSquared :: UGen -> UGen-pv_MagSquared buf = mkOsc KR "PV_MagSquared" [buf] 1--pv_Max :: UGen -> UGen -> UGen-pv_Max ba bb = mkOsc KR "PV_Max" [ba,bb] 1--pv_Min :: UGen -> UGen -> UGen-pv_Min ba bb = mkOsc KR "PV_Min" [ba,bb] 1--pv_Mul :: UGen -> UGen -> UGen-pv_Mul ba bb = mkOsc KR "PV_Mul" [ba,bb] 1--pv_PhaseShift270 :: UGen -> UGen-pv_PhaseShift270 buf = mkOsc KR "PV_PhaseShift270" [buf] 1--pv_PhaseShift90 :: UGen -> UGen-pv_PhaseShift90 buf = mkOsc KR "PV_PhaseShift90" [buf] 1--pv_PhaseShift :: UGen -> UGen -> UGen-pv_PhaseShift buf shift = mkOsc KR "PV_PhaseShift" [buf,shift] 1--pv_RectComb2 :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen-pv_RectComb2 ba bb teeth phase width = mkOsc KR "PV_RectComb2" [ba,bb,teeth,phase,width] 1--pv_RectComb :: UGen -> UGen -> UGen -> UGen -> UGen-pv_RectComb buf teeth phase width = mkOsc KR "PV_RectComb" [buf,teeth,phase,width] 1--unpack1FFT :: UGen -> UGen -> UGen -> UGen -> UGen-unpack1FFT buf size index which = mkOsc DR "Unpack1FFT" [buf, size, index, which] 1--unpackFFT :: UGen -> UGen -> UGen -> UGen -> UGen -> [UGen]-unpackFFT c nf from to w = map (\i -> unpack1FFT c nf i w) [from .. to]---- * Partitioned convolution---- | Calculate size of accumulation buffer given FFT and IR sizes.-pc_calcAccumSize :: Int -> Int -> Int-pc_calcAccumSize fft_size ir_length =- let partition_size = fft_size `div` 2- num_partitions = (ir_length `div` partition_size) + 1- in fft_size * num_partitions---- | Generate accumulation buffer given time-domain IR buffer and FFT size.-pc_preparePartConv :: Int -> Int -> Int -> OSC-pc_preparePartConv b irb fft_size =- b_gen b "PreparePartConv" (map fromIntegral [irb, fft_size])---- | Partitioned convolution.-partConv :: UGen -> UGen -> UGen -> UGen-partConv i sz ib = mkOsc AR "PartConv" [i, sz, ib] 1---- Local Variables:--- truncate-lines:t--- End:
− Sound/SC3/UGen/FFT/ID.hs
@@ -1,20 +0,0 @@-module Sound.SC3.UGen.FFT.ID where--import Sound.SC3.UGen.Rate-import Sound.SC3.UGen.UGen---- | Randomize order of bins.-pv_BinScramble :: ID i => i -> UGen -> UGen -> UGen -> UGen -> UGen-pv_BinScramble z buf wp width trg = mkOscId z KR "PV_BinScramble" [buf,wp,width,trg] 1---- | Randomly clear bins.-pv_RandComb :: ID i => i -> UGen -> UGen -> UGen -> UGen-pv_RandComb z buf wp trg = mkOscId z KR "PV_RandComb" [buf,wp,trg] 1---- | Cross fade, copying bins in random order.-pv_RandWipe :: ID i => i -> UGen -> UGen -> UGen -> UGen -> UGen-pv_RandWipe z ba bb wp trg = mkOscId z KR "PV_RandWipe" [ba,bb,wp,trg] 1---- Local Variables:--- truncate-lines:t--- End:
− Sound/SC3/UGen/FFT/Monadic.hs
@@ -1,18 +0,0 @@-module Sound.SC3.UGen.FFT.Monadic where--import Sound.SC3.UGen.UGen-import Sound.SC3.UGen.UGen.Lift-import qualified Sound.SC3.UGen.FFT.ID as F-import Sound.SC3.UGen.UId---- | Randomize order of bins.-pv_BinScramble :: (UId m) => UGen -> UGen -> UGen -> UGen -> m UGen-pv_BinScramble = liftU4 F.pv_BinScramble---- | Randomly clear bins.-pv_RandComb :: (UId m) => UGen -> UGen -> UGen -> m UGen-pv_RandComb = liftU3 F.pv_RandComb---- | Cross fade, copying bins in random order.-pv_RandWipe :: (UId m) => UGen -> UGen -> UGen -> UGen -> m UGen-pv_RandWipe = liftU4 F.pv_RandWipe
− Sound/SC3/UGen/Filter.hs
@@ -1,373 +0,0 @@--- | Time-domain filter unit generators.-module Sound.SC3.UGen.Filter where--import Data.List-import Sound.SC3.UGen.Rate-import Sound.SC3.UGen.UGen---- | Allpass filter (no interpolation)-allpassN :: UGen -> UGen -> UGen -> UGen -> UGen-allpassN i mt dly dcy = mkFilter "AllpassN" [i, mt, dly, dcy] 1---- | Allpass filter (linear interpolation)-allpassL :: UGen -> UGen -> UGen -> UGen -> UGen-allpassL i mt dly dcy = mkFilter "AllpassL" [i, mt, dly, dcy] 1---- | Allpass filter (cubic interpolation)-allpassC :: UGen -> UGen -> UGen -> UGen -> UGen-allpassC i mt dly dcy = mkFilter "AllpassC" [i, mt, dly, dcy] 1---- | Basic psychoacoustic amplitude compensation.-ampComp :: UGen -> UGen -> UGen -> UGen-ampComp f r e = mkFilter "AmpComp" [f, r, e] 1---- | ANSI A-weighting curve psychoacoustic amplitude compensation.-ampCompA :: UGen -> UGen -> UGen -> UGen -> UGen-ampCompA f r ma ra = mkFilter "AmpCompA" [f, r, ma, ra] 1---- | Bandpass filter-bpf :: UGen -> UGen -> UGen -> UGen-bpf i freq rq = mkFilter "BPF" [i, freq, rq] 1---- | Two zero fixed midpass filter.-bpz2 :: UGen -> UGen-bpz2 i = mkFilter "BPZ2" [i] 1---- | Band reject filter-brf :: UGen -> UGen -> UGen -> UGen-brf i freq rq = mkFilter "BRF" [i, freq, rq] 1---- | Two zero fixed midcut filter.-brz2 :: UGen -> UGen-brz2 i = mkFilter "BRZ2" [i] 1---- | Clip input between lower and upper bounds.-clip :: UGen -> UGen -> UGen -> UGen-clip i l h = mkFilter "Clip" [i, l, h] 1---- | Comb filter (no interpolation)-combN :: UGen -> UGen -> UGen -> UGen -> UGen-combN i mt dly dcy = mkFilter "CombN" [i, mt, dly, dcy] 1---- | Comb filter (linear interpolation)-combL :: UGen -> UGen -> UGen -> UGen -> UGen-combL i mt dly dcy = mkFilter "CombL" [i, mt, dly, dcy] 1---- | Comb filter (cubic interpolation)-combC :: UGen -> UGen -> UGen -> UGen -> UGen-combC i mt dly dcy = mkFilter "CombC" [i, mt, dly, dcy] 1---- | Convert signal to modal pitch.-degreeToKey :: UGen -> UGen -> UGen -> UGen-degreeToKey b i o = mkFilter "DegreeToKey" [b, i, o] 1---- | Exponential decay.-decay :: UGen -> UGen -> UGen-decay i dcy = mkFilter "Decay" [i, dcy] 1---- | Exponential decay (equvalent to $decay dcy - decay atk$).-decay2 :: UGen -> UGen -> UGen -> UGen-decay2 i atk dcy = mkFilter "Decay2" [i, atk, dcy] 1---- | Single sample delay.-delay1 :: UGen -> UGen-delay1 i = mkFilter "Delay1" [i] 1---- | Two sample delay.-delay2 :: UGen -> UGen-delay2 i = mkFilter "Delay2" [i] 1---- | Simple delay line (cubic interpolation).-delayC :: UGen -> UGen -> UGen -> UGen-delayC i mt dly = mkFilter "DelayC" [i, mt, dly] 1---- | Simple delay line (linear interpolation).-delayL :: UGen -> UGen -> UGen -> UGen-delayL i mt dly = mkFilter "DelayL" [i, mt, dly] 1---- | Simple delay line (no interpolation).-delayN :: UGen -> UGen -> UGen -> UGen-delayN i mt dly = mkFilter "DelayN" [i, mt, dly] 1---- | FOF like filter.-formlet :: UGen -> UGen -> UGen -> UGen -> UGen-formlet i f a d = mkFilter "Formlet" [i, f, a, d] 1---- | First order filter section.-fos :: UGen -> UGen -> UGen -> UGen -> UGen-fos i a0 a1 b1 = mkFilter "FOS" [i, a0, a1, b1] 1---- | A simple reverb.-freeVerb :: UGen -> UGen -> UGen -> UGen -> UGen-freeVerb i mx room damp = mkFilter "FreeVerb" [i, mx, room, damp] 1---- | A simple reverb (two channel).-freeVerb2 :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen-freeVerb2 i1 i2 mx room damp = mkFilter "FreeVerb2" [i1, i2, mx, room, damp] 2---- | Gate.-gate :: UGen -> UGen -> UGen-gate i t = mkFilter "Gate" [i, t] 1---- | Hash input values.-hasher :: UGen -> UGen-hasher i = mkFilter "Hasher" [i] 1---- | Hilbert transform.-hilbert :: UGen -> UGen-hilbert i = mkFilter "Hilbert" [i] 2---- | Highpass filter.-hpf :: UGen -> UGen -> UGen-hpf i f = mkFilter "HPF" [i, f] 1---- | Two point difference filter.-hpz1 :: UGen -> UGen-hpz1 i = mkFilter "HPZ1" [i] 1---- | Two zero fixed highpass filter.-hpz2 :: UGen -> UGen-hpz2 i = mkFilter "HPZ2" [i] 1---- | Is signal within specified range.-inRange :: UGen -> UGen -> UGen -> UGen-inRange i lo hi = mkFilter "InRange" [i, lo, hi] 1---- | Fixed resonator filter bank.-klank :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen-klank i fs fp d s = mkFilterMCER [AR] "Klank" [i, fs, fp, d] s 1---- | Format frequency, amplitude and decay time data as required for klank.-klankSpec :: [UGen] -> [UGen] -> [UGen] -> UGen-klankSpec f a p = mce ((concat . transpose) [f, a, p])---- | Simple averaging filter.-lag :: UGen -> UGen -> UGen-lag i t = mkFilter "Lag" [i, t] 1---- | Nested lag filter.-lag2 :: UGen -> UGen -> UGen-lag2 i t = mkFilter "Lag2" [i, t] 1---- | Twice nested lag filter.-lag3 :: UGen -> UGen -> UGen-lag3 i t = mkFilter "Lag3" [i, t] 1---- | Last value before chang above threshhold.-lastValue :: UGen -> UGen -> UGen-lastValue i t = mkFilter "LastValue" [i, t] 1---- | Sample and hold.-latch :: UGen -> UGen -> UGen-latch i t = mkFilter "Latch" [i, t] 1---- | Remove DC offset.-leakDC :: UGen -> UGen -> UGen-leakDC i coef = mkFilter "LeakDC" [i, coef] 1---- | Map from one linear range to another linear range.-linLin :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen-linLin i sl sh dl dh = mkFilter "LinLin" [i, sl, sh, dl, dh] 1---- | Map from a linear range to an exponential range.-linExp :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen-linExp i sl sh dl dh = mkFilter "LinExp" [i, sl, sh, dl, dh] 1---- | Lowpass filter.-lpf :: UGen -> UGen -> UGen-lpf i f = mkFilter "LPF" [i, f] 1---- | Two point average filter.-lpz1 :: UGen -> UGen-lpz1 i = mkFilter "LPZ1" [i] 1---- | Two zero fixed lowpass filter.-lpz2 :: UGen -> UGen-lpz2 i = mkFilter "LPZ2" [i] 1---- | Masks off bits in the mantissa of signal.-mantissaMask :: UGen -> UGen -> UGen-mantissaMask i bits = mkFilter "MantissaMask" [i, bits] 1---- | Median filter.-median :: UGen -> UGen -> UGen-median size i = mkFilter "Median" [size, i] 1---- | Moog VCF implementation.-moogFF :: UGen -> UGen -> UGen -> UGen -> UGen-moogFF i f g r = mkFilter "MoogFF" [i, f, g, r] 1---- | Most changed input.-mostChange :: UGen -> UGen -> UGen-mostChange a b = mkFilter "MostChange" [a, b] 1---- | Multiply add ternary operator.-mulAdd :: UGen -> UGen -> UGen -> UGen-mulAdd s m a = mkFilter "MulAdd" [s, m, a] 1---- | Flattens dynamics.-normalizer :: UGen -> UGen -> UGen -> UGen-normalizer i level dur = mkFilter "Normalizer" [i, level, dur] 1---- | One pole filter.-onePole :: UGen -> UGen -> UGen-onePole i coef = mkFilter "OnePole" [i, coef] 1---- | One zero filter.-oneZero :: UGen -> UGen -> UGen-oneZero i coef = mkFilter "OneZero" [i, coef] 1---- | Maximum value.-peak :: UGen -> UGen -> UGen-peak t r = mkFilter "Peak" [t, r] 1---- | Simple time domain pitch shifter.-pitchShift :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen-pitchShift i w p d t = mkFilter "PitchShift" [i, w, p, d, t] 1---- | Karplus-Strong synthesis.-pluck :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-pluck i tr mdl dl dc coef = mkFilter "Pluck" [i, tr, mdl, dl, dc, coef] 1---- | Trigger counter.-pulseCount :: UGen -> UGen -> UGen-pulseCount t r = mkFilter "PulseCount" [t, r] 1---- | Pass every nth trigger.-pulseDivider :: UGen -> UGen -> UGen -> UGen-pulseDivider t factor start = mkFilter "PulseDivider" [t, factor, start] 1---- | Linear lag.-ramp :: UGen -> UGen -> UGen-ramp i t = mkFilter "Ramp" [i, t] 1---- | Resonant highpass filter.-rhpf :: UGen -> UGen -> UGen -> UGen-rhpf i freq rq = mkFilter "RHPF" [i, freq, rq] 1---- | Resonant lowpass filter.-rlpf :: UGen -> UGen -> UGen -> UGen-rlpf i freq rq = mkFilter "RLPF" [i, freq, rq] 1---- | Resonant filter.-resonz :: UGen -> UGen -> UGen -> UGen-resonz i freq bwr = mkFilter "Resonz" [i, freq, bwr] 1---- | Ringing filter (equivalent to Resonz).-ringz :: UGen -> UGen -> UGen -> UGen-ringz i freq dcy = mkFilter "Ringz" [i, freq, dcy] 1---- | Track maximum level.-runningMax :: UGen -> UGen -> UGen-runningMax i t = mkFilter "RunningMax" [i, t] 1---- | Track minimum level.-runningMin :: UGen -> UGen -> UGen-runningMin i t = mkFilter "RunningMin" [i, t] 1---- | Running sum.-runningSum :: UGen -> UGen -> UGen-runningSum i n = mkFilter "RunningSum" [i, n] 1---- | Select output from array of inputs.-select :: UGen -> UGen -> UGen-select i a = mkFilterMCE "Select" [i] a 1---- | Send a trigger message from the server back to the all registered clients.-sendTrig :: UGen -> UGen -> UGen -> UGen-sendTrig i k v = mkFilter "SendTrig" [i, k, v] 0---- | Set-reset flip flop.-setResetFF :: UGen -> UGen -> UGen-setResetFF t r = mkFilter "SetResetFF" [t, r] 1---- | Wave shaper.-shaper :: UGen -> UGen -> UGen-shaper b s = mkFilter "Shaper" [b, s] 1---- | Remove transients and higher frequencies.-slew :: UGen -> UGen -> UGen -> UGen-slew i up dn = mkFilter "Slew" [i, up, dn] 1---- | Second order filter section (biquad). -sos :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-sos i a0 a1 a2 b1 b2 = mkFilter "SOS" [i, a0, a1, a2, b1, b2] 1---- | Stepper pulse counter.-stepper :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-stepper t r mn mx s v = mkFilter "Stepper" [t, r, mn, mx, s, v] 1---- | Triggered linear ramp.-sweep :: UGen -> UGen -> UGen-sweep t r = mkFilter "Sweep" [t, r] 1---- | Delay trigger by specified interval. -tDelay :: UGen -> UGen -> UGen-tDelay i d = mkFilter "TDelay" [i, d] 1---- | Time since last triggered.-timer :: UGen -> UGen-timer t = mkFilter "Timer" [t] 1- --- | Toggle flip flop.-toggleFF :: UGen -> UGen-toggleFF t = mkFilter "ToggleFF" [t] 1---- | When triggered output trigger for specified duration.-trig :: UGen -> UGen -> UGen-trig i d = mkFilter "Trig" [i, d] 1---- | When triggered output unit signal for specified duration.-trig1 :: UGen -> UGen -> UGen-trig1 i d = mkFilter "Trig1" [i, d] 1---- | Two pole filter.-twoPole :: UGen -> UGen -> UGen -> UGen-twoPole i freq radius = mkFilter "TwoPole" [i, freq, radius] 1---- | Two zero filter.-twoZero :: UGen -> UGen -> UGen -> UGen-twoZero i freq radius = mkFilter "TwoZero" [i, freq, radius] 1---- | Index into a table with a signal.-wrapIndex :: UGen -> UGen -> UGen-wrapIndex b i = mkFilter "WrapIndex" [b, i] 1---- * BEQ filters--bLowPass :: UGen -> UGen -> UGen -> UGen-bLowPass i f rq = mkFilter "BLowPass" [i, f, rq] 1--bHiPass :: UGen -> UGen -> UGen -> UGen-bHiPass i f rq = mkFilter "BHiPass" [i, f, rq] 1--bAllPass :: UGen -> UGen -> UGen -> UGen-bAllPass i f rq = mkFilter "BAllPass" [i, f, rq] 1--bBandPass :: UGen -> UGen -> UGen -> UGen-bBandPass i f bw = mkFilter "BBandPass" [i, f, bw] 1--bBandStop :: UGen -> UGen -> UGen -> UGen-bBandStop i f bw = mkFilter "BBandStop" [i, f, bw] 1--bPeakEQ :: UGen -> UGen -> UGen -> UGen -> UGen-bPeakEQ i f rq db = mkFilter "BPeakEQ" [i, f, rq, db] 1--bLowShelf :: UGen -> UGen -> UGen -> UGen -> UGen-bLowShelf i f rs db = mkFilter "BLowShelf" [i, f, rs, db] 1--bHiShelf :: UGen -> UGen -> UGen -> UGen -> UGen-bHiShelf i f rs db = mkFilter "BHiShelf" [i, f, rs, db] 1--bLowPassCoef :: Floating a => a -> a -> a -> (a, a, a, a, a)-bLowPassCoef sr freq rq =- let w0 = pi * 2 * freq * (1 / sr)- cos_w0 = cos w0- i = 1 - cos_w0- alpha = sin w0 * 0.5 * rq- b0rz = recip (1 + alpha)- a0 = i * 0.5 * b0rz- a1 = i * b0rz- b1 = cos_w0 * 2 * b0rz- b2 = (1 - alpha) * negate b0rz- in (a0, a1, a0, b1, b2)
− Sound/SC3/UGen/Granular.hs
@@ -1,29 +0,0 @@--- | Granular synthesis unit generators.-module Sound.SC3.UGen.Granular where--import Sound.SC3.UGen.Rate-import Sound.SC3.UGen.UGen---- | Granular synthesis with sound stored in a buffer.-grainBuf :: Int -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-grainBuf nc t d s r p i l e = mkOsc AR "GrainBuf" [t, d, s, r, p, i, l, e] nc---- | Granular synthesis with frequency modulated sine tones.-grainFM :: Int -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-grainFM nc t d c m i l e = mkOsc AR "GrainFM" [t, d, c, m, i, l, e] nc---- | Granulate an input signal.-grainIn :: Int -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-grainIn nc t d i l e = mkOsc AR "GrainIn" [t, d, i, l, e] nc---- | Granular synthesis with sine tones.-grainSin :: Int -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-grainSin nc t d f l e = mkOsc AR "GrainSin" [t, d, f, l, e] nc---- | Warp a buffer with a time pointer.-warp1 :: Int -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-warp1 nc b p f w e o r i = mkOsc AR "Warp1" [b, p, f, w, e, o, r, i] nc---- Local Variables:--- truncate-lines:t--- End:
− Sound/SC3/UGen/IO.hs
@@ -1,77 +0,0 @@--- | Audio bus, control bus and input device unit generators.-module Sound.SC3.UGen.IO where--import Sound.SC3.UGen.Enum-import Sound.SC3.UGen.Rate-import Sound.SC3.UGen.UGen-import Sound.SC3.UGen.Utilities---- | Read signal from an audio or control bus.-in' :: Int -> Rate -> UGen -> UGen-in' nc r bus = mkOsc r "In" [bus] nc---- | Define and read from buses local to a synthesis node.-localIn :: Int -> Rate -> UGen-localIn nc r = mkOsc r "LocalIn" [] nc---- | Control rate bus input with lag.-lagIn :: Int -> UGen -> UGen -> UGen-lagIn nc bus lag = mkOsc KR "LagIn" [bus, lag] nc---- | Read signal from a bus without erasing it.-inFeedback :: Int -> UGen -> UGen-inFeedback nc bus = mkOsc AR "InFeedback" [bus] nc---- | Generate a trigger anytime a bus is set.-inTrig :: Int -> UGen -> UGen-inTrig nc bus = mkOsc KR "InTrig" [bus] nc---- | Mix signal to an audio or control bus.-out :: UGen -> UGen -> UGen-out bus i = mkFilterMCE "Out" [bus] i 0---- | Over-write signal to an audio or control bus.-replaceOut :: UGen -> UGen -> UGen-replaceOut bus i = mkFilterMCE "ReplaceOut" [bus] i 0---- | Mix signal to an audio bus at precise sample offset.-offsetOut :: UGen -> UGen -> UGen-offsetOut bus i = mkOscMCE AR "OffsetOut" [bus] i 0---- | Write signal to bus local to a synthesis node, see localIn.-localOut :: UGen -> UGen-localOut i = mkFilterMCE "LocalOut" [] i 0---- | Crossfade signal to an audio or control bus.-xOut :: UGen -> UGen -> UGen -> UGen-xOut bus xfade i = mkFilterMCE "XOut" [bus, xfade] i 0--sharedOut :: UGen -> UGen -> UGen-sharedOut bus i = mkOscMCE KR "SharedOut" [bus] i 0--sharedIn :: Int -> UGen -> UGen-sharedIn nc bus = mkOsc KR "SharedIn" [bus] nc---- | Report the status of a particular key.-keyState :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen-keyState r key minVal maxVal lag = mkOscR [KR] r "KeyState" [key, minVal, maxVal, lag] 1---- | Report the status of the first pointer button.-mouseButton :: Rate -> UGen -> UGen -> UGen -> UGen-mouseButton r ll rl lag = mkOscR [KR] r "MouseButton" [ll, rl, lag] 1---- | Cursor UGen, X axis.-mouseX :: Rate -> UGen -> UGen -> Warp -> UGen -> UGen-mouseX r ll rl w lag = mkOscR [KR] r "MouseX" [ll, rl, from_warp w, lag] 1---- | Cursor UGen, Y axis.-mouseY :: Rate -> UGen -> UGen -> Warp -> UGen -> UGen-mouseY r ll rl w lag = mkOscR [KR] r "MouseY" [ll, rl, from_warp w, lag] 1---- | Control variant.-trigControl :: Int -> Rate -> UGen-trigControl nc r = mkOsc r "TrigControl" [] nc---- Local Variables:--- truncate-lines:t--- End:
− Sound/SC3/UGen/Information.hs
@@ -1,49 +0,0 @@--- | Unit generators to access information related to the synthesis--- environment.-module Sound.SC3.UGen.Information where--import Sound.SC3.UGen.UGen---- | Sample rate of synthesis server, frames per second.-sampleRate :: UGen-sampleRate = mkInfo "SampleRate"---- | Duration of one sample, seconds.-sampleDur :: UGen-sampleDur = mkInfo "SampleDur"---- | Duration of one sample, radians.-radiansPerSample :: UGen-radiansPerSample = mkInfo "RadiansPerSample"---- | Control rate of synthesis server, periods per second.-controlRate :: UGen-controlRate = mkInfo "ControlRate"---- | Sub-sample accurate scheduling offset.-subsampleOffset :: UGen-subsampleOffset = mkInfo "SubsampleOffset"---- | Number of allocated output audio rate buses.-numOutputBuses :: UGen-numOutputBuses = mkInfo "NumOutputBuses"---- | Number of allocated input audio rate buses.-numInputBuses :: UGen-numInputBuses = mkInfo "NumInputBuses"---- | Number of allocated audio rate buses.-numAudioBuses :: UGen-numAudioBuses = mkInfo "NumAudioBuses"---- | Number of allocated control rate buses.-numControlBuses :: UGen-numControlBuses = mkInfo "NumControlBuses"---- | Number of allocated buffers.-numBuffers :: UGen-numBuffers = mkInfo "NumBuffers"---- | Number of runnings synthesis nodes.-numRunningSynths :: UGen-numRunningSynths = mkInfo "NumRunningSynths"
− Sound/SC3/UGen/MachineListening.hs
@@ -1,53 +0,0 @@--- | Machine listening & feature extraction analysis unit generators.-module Sound.SC3.UGen.MachineListening where--import Data.List-import Data.Maybe-import Sound.SC3.UGen.Rate-import Sound.SC3.UGen.UGen---- | Autocorrelation beat tracker.-beatTrack :: UGen -> UGen -> UGen-beatTrack fft lock = mkOsc KR "BeatTrack" [fft, lock] 4---- | Template matching beat tracker.-beatTrack2 :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-beatTrack2 b mf ws pa lk w = mkOsc KR "BeatTrack2" [b, mf, ws, pa, lk, w] 6---- | Extraction of instantaneous loudness in sones.-loudness :: UGen -> UGen -> UGen -> UGen-loudness fft smask tmask = mkOsc KR "Loudness" [fft, smask, tmask] 1---- | Translate onset type string to constant UGen value.-onsetType :: Num a => String -> a-onsetType s = fromIntegral (fromMaybe 3 (findIndex (== s) t))- where t = ["power", "magsum", "complex", "rcomplex", "phase", "wphase", "mkl"]---- | Onset detector.-onsets :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-onsets c t o r f mg ms wt rw = mkOsc KR "Onsets" [c, t, o, r, f, mg, ms, wt, rw] 1---- | Onset detector with default values for minor parameters.-onsets' :: UGen -> UGen -> UGen -> UGen-onsets' c t o = onsets c t o 1 0.1 10 11 1 0---- | Key tracker.-keyTrack :: UGen -> UGen -> UGen -> UGen -> UGen-keyTrack fft kd cl _ = mkOsc KR "KeyTrack" [fft, kd, cl] 1---- | Mel frequency cepstral coefficients.-mfcc :: Int -> UGen -> UGen-mfcc nc b = mkOsc KR "MFCC" [b, constant nc] nc--specFlatness :: UGen -> UGen-specFlatness b = mkOsc KR "SpecFlatness" [b] 1--specPcile :: UGen -> UGen -> UGen -> UGen-specPcile b f i = mkOsc KR "SpecPcile" [b, f, i] 1--specCentroid :: UGen -> UGen-specCentroid b = mkOsc KR "SpecCentroid" [b] 1---- Local Variables:--- truncate-lines:t--- End:
− Sound/SC3/UGen/Math.hs
@@ -1,249 +0,0 @@--- | Non-standard mathematical classes and class instances.-module Sound.SC3.UGen.Math where--import Sound.SC3.UGen.Operator-import Sound.SC3.UGen.UGen---- The Eq and Ord classes in the Prelude require Bool, hence the name--- mangling. True is 1.0, False is 0.0---- | Variant on Eq class, result is of the same type as the values compared.-class EqE a where- (==*) :: a -> a -> a- (/=*) :: a -> a -> a--instance EqE Double where- a ==* b = if a == b then 1.0 else 0.0- a /=* b = if a /= b then 1.0 else 0.0--instance EqE UGen where- (==*) = mkBinaryOperator EQ_ (==*)- (/=*) = mkBinaryOperator NE (/=*)---- | Variant on Ord class, result is of the same type as the values compared.-class OrdE a where- (<*) :: a -> a -> a- (<=*) :: a -> a -> a- (>*) :: a -> a -> a- (>=*) :: a -> a -> a--instance OrdE Double where- a <* b = if a < b then 1.0 else 0.0- a <=* b = if a <= b then 1.0 else 0.0- a >* b = if a > b then 1.0 else 0.0- a >=* b = if a >= b then 1.0 else 0.0--instance OrdE UGen where- (<*) = mkBinaryOperator LT_ (<*)- (<=*) = mkBinaryOperator LE (<=*)- (>*) = mkBinaryOperator GT_ (>*)- (>=*) = mkBinaryOperator GE (>=*)---- | Unary operator class.-class (Floating a, Ord a) => UnaryOp a where- ampDb :: a -> a- ampDb a = log10 a * 20- asFloat :: a -> a- asFloat = undefined- asInt :: a -> a- asInt = undefined- bitNot :: a -> a- bitNot = undefined- ceil :: a -> a- cpsMIDI :: a -> a- cpsMIDI a = (log2 (a * (1.0 / 440.0)) * 12.0) + 69.0- cpsOct :: a -> a- cpsOct a = log2 (a * (1.0 / 440.0)) + 4.75- cubed :: a -> a- cubed a = a * a * a- dbAmp :: a -> a- dbAmp a = 10 ** (a * 0.05)- distort :: a -> a- distort = undefined- floorE :: a -> a- frac :: a -> a- frac = undefined- isNil :: a -> a- isNil a = if a == 0.0 then 0.0 else 1.0- log10 :: a -> a- log10 = logBase 10- log2 :: a -> a- log2 = logBase 2- midiCPS :: a -> a- midiCPS a = 440.0 * (2.0 ** ((a - 69.0) * (1.0 / 12.0)))- midiRatio :: a -> a- midiRatio a = 2.0 ** (a * (1.0 / 12.0))- notE :: a -> a- notE a = if a > 0.0 then 0.0 else 1.0- notNil :: a -> a- notNil a = if a /= 0.0 then 0.0 else 1.0- octCPS :: a -> a- octCPS a = 440.0 * (2.0 ** (a - 4.75))- ramp_ :: a -> a- ramp_ _ = undefined- ratioMIDI :: a -> a- ratioMIDI a = 12.0 * log2 a- softClip :: a -> a- softClip = undefined- squared :: a -> a- squared a = a * a--instance UnaryOp Double where- ceil a = fromIntegral (ceiling a :: Integer)- floorE a = fromIntegral (floor a :: Integer)--instance UnaryOp UGen where- ampDb = mkUnaryOperator AmpDb ampDb- asFloat = mkUnaryOperator AsFloat asFloat- asInt = mkUnaryOperator AsInt asInt- bitNot = mkUnaryOperator BitNot bitNot- ceil = mkUnaryOperator Ceil ceil- cpsMIDI = mkUnaryOperator CPSMIDI cpsMIDI- cpsOct = mkUnaryOperator CPSOct cpsOct- cubed = mkUnaryOperator Cubed cubed- dbAmp = mkUnaryOperator DbAmp dbAmp- distort = mkUnaryOperator Distort distort- floorE = mkUnaryOperator Floor floorE- frac = mkUnaryOperator Frac frac- isNil = mkUnaryOperator IsNil isNil- log10 = mkUnaryOperator Log10 log10- log2 = mkUnaryOperator Log2 log2- midiCPS = mkUnaryOperator MIDICPS midiCPS- midiRatio = mkUnaryOperator MIDIRatio midiRatio- notE = mkUnaryOperator Not notE- notNil = mkUnaryOperator NotNil notNil- octCPS = mkUnaryOperator OctCPS octCPS- ramp_ = mkUnaryOperator Ramp ramp_- ratioMIDI = mkUnaryOperator RatioMIDI ratioMIDI- softClip = mkUnaryOperator SoftClip softClip- squared = mkUnaryOperator Squared squared---- | Binary operator class.-class (Floating a, Ord a) => BinaryOp a where- absDif :: a -> a -> a- absDif a b = abs (a - b)- amClip :: a -> a -> a- amClip a b = if b <= 0 then 0 else a * b- atan2E :: a -> a -> a- atan2E a b = atan (b/a)- bitAnd :: a -> a -> a- bitAnd = undefined- bitOr :: a -> a -> a- bitOr = undefined- bitXOr :: a -> a -> a- bitXOr = undefined- clip2 :: a -> a -> a- clip2 a b = clip_ a (-b) b- difSqr :: a -> a -> a- difSqr a b = (a*a) - (b*b)- excess :: a -> a -> a- excess a b = a - clip_ a (-b) b- exprandRange :: a -> a -> a- exprandRange = undefined- fill :: a -> a -> a- fill = undefined- firstArg :: a -> a -> a- firstArg a _ = a- fold2 :: a -> a -> a- gcdE :: a -> a -> a- gcdE = undefined- hypot :: a -> a -> a- hypot = undefined- hypotx :: a -> a -> a- hypotx = undefined- iDiv :: a -> a -> a- iDiv = undefined- lcmE :: a -> a -> a- lcmE = undefined- modE :: a -> a -> a- randRange :: a -> a -> a- randRange = undefined- ring1 :: a -> a -> a- ring1 a b = a * b + a- ring2 :: a -> a -> a- ring2 a b = a * b + a + b- ring3 :: a -> a -> a- ring3 a b = a * a * b- ring4 :: a -> a -> a- ring4 a b = a * a * b - a * b * b- roundE :: a -> a -> a- roundUp :: a -> a -> a- scaleNeg :: a -> a -> a- scaleNeg a b = (abs a - a) * b' + a where b' = 0.5 * b + 0.5- shiftLeft :: a -> a -> a- shiftLeft = undefined- shiftRight :: a -> a -> a- shiftRight = undefined- sqrDif :: a -> a -> a- sqrDif a b = (a-b) * (a-b)- sqrSum :: a -> a -> a- sqrSum a b = (a+b) * (a+b)- sumSqr :: a -> a -> a- sumSqr a b = (a*a) + (b*b)- thresh :: a -> a -> a- thresh a b = if a < b then 0 else a- trunc :: a -> a -> a- trunc = undefined- unsignedShift :: a -> a -> a- unsignedShift = undefined- wrap2 :: a -> a -> a--instance BinaryOp Double where- fold2 a b = fold a (-b) b- modE a b = n - floorE n where n = a / b- roundE a b = if b == 0 then a else floorE (a/b + 0.5) * b- roundUp a b = if b == 0 then a else ceil (a/b + 0.5) * b- wrap2 a b = wrap a (-b) b--instance BinaryOp UGen where- iDiv = mkBinaryOperator IDiv undefined- modE = mkBinaryOperator Mod modE- bitAnd = mkBinaryOperator BitAnd undefined- bitOr = mkBinaryOperator BitOr undefined- bitXOr = mkBinaryOperator BitXor undefined- lcmE = mkBinaryOperator LCM undefined- gcdE = mkBinaryOperator GCD undefined- roundE = mkBinaryOperator Round undefined- roundUp = mkBinaryOperator RoundUp undefined- trunc = mkBinaryOperator Trunc undefined- atan2E = mkBinaryOperator Atan2 undefined- hypot = mkBinaryOperator Hypot undefined- hypotx = mkBinaryOperator Hypotx undefined- shiftLeft = mkBinaryOperator ShiftLeft undefined- shiftRight = mkBinaryOperator ShiftRight undefined- unsignedShift = mkBinaryOperator UnsignedShift undefined- fill = mkBinaryOperator Fill undefined- ring1 = mkBinaryOperator Ring1 undefined- ring2 = mkBinaryOperator Ring2 undefined- ring3 = mkBinaryOperator Ring3 undefined- ring4 = mkBinaryOperator Ring4 undefined- difSqr = mkBinaryOperator DifSqr undefined- sumSqr = mkBinaryOperator SumSqr undefined- sqrSum = mkBinaryOperator SqrSum undefined- sqrDif = mkBinaryOperator SqrDif undefined- absDif = mkBinaryOperator AbsDif undefined- thresh = mkBinaryOperator Thresh undefined- amClip = mkBinaryOperator AMClip undefined- scaleNeg = mkBinaryOperator ScaleNeg undefined- clip2 = mkBinaryOperator Clip2 undefined- excess = mkBinaryOperator Excess undefined- fold2 = mkBinaryOperator Fold2 undefined- wrap2 = mkBinaryOperator Wrap2 undefined- firstArg = mkBinaryOperator FirstArg undefined- randRange = mkBinaryOperator RandRange undefined- exprandRange = mkBinaryOperator ExpRandRange undefined--wrap :: (UnaryOp a, Ord a) => a -> a -> a -> a-wrap a b c = if a >= b && a <= c then a else a - r * floorE (a-b)/r - where r = c - b--fold :: (UnaryOp a, Ord a) => a -> a -> a -> a-fold a b c = if a >= b && a <= c then a else y' + b- where r = c - b- r' = r + r- x = a - b- y = x - r' * floorE x/r'- y' = if y >= r then r' - y else y--clip_ :: (Ord a) => a -> a -> a -> a-clip_ a b c = if a < b then b else if a > c then c else a
− Sound/SC3/UGen/Noise/ID.hs
@@ -1,108 +0,0 @@-module Sound.SC3.UGen.Noise.ID where--import Sound.SC3.UGen.Rate-import Sound.SC3.UGen.UGen---- | Brown noise.-brownNoise :: ID a => a -> Rate -> UGen-brownNoise z r = mkOscId z r "BrownNoise" [] 1---- | Clip noise.-clipNoise :: ID a => a -> Rate -> UGen-clipNoise z r = mkOscId z r "ClipNoise" [] 1---- | Randomly pass or block triggers.-coinGate :: ID a => a -> UGen -> UGen -> UGen-coinGate z prob i = mkFilterId z "CoinGate" [prob, i] 1---- | Random impulses in (-1, 1).-dust2 :: ID a => a -> Rate -> UGen -> UGen-dust2 z r density = mkOscId z r "Dust2" [density] 1---- | Random impulse in (0,1).-dust :: ID a => a -> Rate -> UGen -> UGen-dust z r density = mkOscId z r "Dust" [density] 1---- | Random value in exponential distribution.-expRand :: ID a => a -> UGen -> UGen -> UGen-expRand z lo hi = mkOscId z IR "ExpRand" [lo, hi] 1---- | Gray noise.-grayNoise :: ID a => a -> Rate -> UGen-grayNoise z r = mkOscId z r "GrayNoise" [] 1---- | Random integer in uniform distribution.-iRand :: ID a => a -> UGen -> UGen -> UGen-iRand z lo hi = mkOscId z IR "IRand" [lo, hi] 1---- | Clip noise.-lfClipNoise :: ID a => a -> Rate -> UGen -> UGen-lfClipNoise z r freq = mkOscId z r "LFClipNoise" [freq] 1---- | Dynamic clip noise.-lfdClipNoise :: ID a => a -> Rate -> UGen -> UGen-lfdClipNoise z r freq = mkOscId z r "LFDClipNoise" [freq] 1---- | Dynamic step noise.-lfdNoise0 :: ID a => a -> Rate -> UGen -> UGen-lfdNoise0 z r freq = mkOscId z r "LFDNoise0" [freq] 1---- | Dynamic ramp noise.-lfdNoise1 :: ID a => a -> Rate -> UGen -> UGen-lfdNoise1 z r freq = mkOscId z r "LFDNoise1" [freq] 1---- | Dynamic quadratic noise-lfdNoise2 :: ID a => a -> Rate -> UGen -> UGen-lfdNoise2 z r freq = mkOscId z r "LFDNoise2" [freq] 1---- | Dynamic cubic noise-lfdNoise3 :: ID a => a -> Rate -> UGen -> UGen-lfdNoise3 z r freq = mkOscId z r "LFDNoise3" [freq] 1---- | Step noise.-lfNoise0 :: ID a => a -> Rate -> UGen -> UGen-lfNoise0 z r freq = mkOscId z r "LFNoise0" [freq] 1---- | Ramp noise.-lfNoise1 :: ID a => a -> Rate -> UGen -> UGen-lfNoise1 z r freq = mkOscId z r "LFNoise1" [freq] 1---- | Quadratic noise.-lfNoise2 :: ID a => a -> Rate -> UGen -> UGen-lfNoise2 z r freq = mkOscId z r "LFNoise2" [freq] 1---- | Random value in skewed linear distribution.-linRand :: ID a => a -> UGen -> UGen -> UGen -> UGen-linRand z lo hi m = mkOscId z IR "LinRand" [lo, hi, m] 1---- | Random value in sum of n linear distribution.-nRand :: ID a => a -> UGen -> UGen -> UGen -> UGen-nRand z lo hi n = mkOscId z IR "NRand" [lo, hi, n] 1---- | Pink noise.-pinkNoise :: ID a => a -> Rate -> UGen-pinkNoise z r = mkOscId z r "PinkNoise" [] 1---- | Random value in uniform distribution.-rand :: ID a => a -> UGen -> UGen -> UGen-rand z lo hi = mkOscId z IR "Rand" [lo, hi] 1---- | Random value in exponential distribution on trigger.-tExpRand :: ID a => a -> UGen -> UGen -> UGen -> UGen-tExpRand z lo hi trig = mkFilterId z "TExpRand" [lo, hi, trig] 1---- | Random integer in uniform distribution on trigger.-tiRand :: ID a => a -> UGen -> UGen -> UGen -> UGen-tiRand z lo hi trig = mkFilterId z "TIRand" [lo, hi, trig] 1---- | Random value in uniform distribution on trigger.-tRand :: ID a => a -> UGen -> UGen -> UGen -> UGen-tRand z lo hi trig = mkFilterId z "TRand" [lo, hi, trig] 1---- | Triggered windex.-twindex :: ID a => a -> UGen -> UGen -> UGen -> UGen-twindex z i n a = mkFilterMCEId z "TWindex" [i, n] a 1---- | White noise.-whiteNoise :: ID a => a -> Rate -> UGen-whiteNoise z r = mkOscId z r "WhiteNoise" [] 1
− Sound/SC3/UGen/Noise/Monadic.hs
@@ -1,111 +0,0 @@-module Sound.SC3.UGen.Noise.Monadic where--import Sound.SC3.UGen.Rate-import Sound.SC3.UGen.UGen-import Sound.SC3.UGen.UGen.Lift-import qualified Sound.SC3.UGen.Noise.ID as N-import Sound.SC3.UGen.UId---- | Brown noise.-brownNoise :: (UId m) => Rate -> m UGen-brownNoise = liftU N.brownNoise---- | Clip noise.-clipNoise :: (UId m) => Rate -> m UGen-clipNoise = liftU N.clipNoise---- | Randomly pass or block triggers.-coinGate :: (UId m) => UGen -> UGen -> m UGen-coinGate = liftU2 N.coinGate---- | Random impulses in (-1, 1).-dust2 :: (UId m) => Rate -> UGen -> m UGen-dust2 = liftU2 N.dust2---- | Random impulse in (0,1).-dust :: (UId m) => Rate -> UGen -> m UGen-dust = liftU2 N.dust---- | Random value in exponential distribution.-expRand :: (UId m) => UGen -> UGen -> m UGen-expRand = liftU2 N.expRand---- | Gray noise.-grayNoise :: (UId m) => Rate -> m UGen-grayNoise = liftU N.grayNoise---- | Random integer in uniform distribution.-iRand :: (UId m) => UGen -> UGen -> m UGen-iRand = liftU2 N.iRand---- | Clip noise.-lfClipNoise :: (UId m) => Rate -> UGen -> m UGen-lfClipNoise = liftU2 N.lfClipNoise---- | Dynamic clip noise.-lfdClipNoise :: (UId m) => Rate -> UGen -> m UGen-lfdClipNoise = liftU2 N.lfdClipNoise---- | Dynamic step noise.-lfdNoise0 :: (UId m) => Rate -> UGen -> m UGen-lfdNoise0 = liftU2 N.lfdNoise0---- | Dynamic ramp noise.-lfdNoise1 :: (UId m) => Rate -> UGen -> m UGen-lfdNoise1 = liftU2 N.lfdNoise1---- | Dynamic quadratic noise-lfdNoise2 :: (UId m) => Rate -> UGen -> m UGen-lfdNoise2 = liftU2 N.lfdNoise2---- | Dynamic cubic noise-lfdNoise3 :: (UId m) => Rate -> UGen -> m UGen-lfdNoise3 = liftU2 N.lfdNoise3---- | Step noise.-lfNoise0 :: (UId m) => Rate -> UGen -> m UGen-lfNoise0 = liftU2 N.lfNoise0---- | Ramp noise.-lfNoise1 :: (UId m) => Rate -> UGen -> m UGen-lfNoise1 = liftU2 N.lfNoise1---- | Quadratic noise.-lfNoise2 :: (UId m) => Rate -> UGen -> m UGen-lfNoise2 = liftU2 N.lfNoise2---- | Random value in skewed linear distribution.-linRand :: (UId m) => UGen -> UGen -> UGen -> m UGen-linRand = liftU3 N.linRand---- | Random value in sum of n linear distribution.-nRand :: (UId m) => UGen -> UGen -> UGen -> m UGen-nRand = liftU3 N.nRand---- | Pink noise.-pinkNoise :: (UId m) => Rate -> m UGen-pinkNoise = liftU N.pinkNoise---- | Random value in uniform distribution.-rand :: (UId m) => UGen -> UGen -> m UGen-rand = liftU2 N.rand---- | Random value in exponential distribution on trigger.-tExpRand :: (UId m) => UGen -> UGen -> UGen -> m UGen-tExpRand = liftU3 N.tExpRand---- | Random integer in uniform distribution on trigger.-tiRand :: (UId m) => UGen -> UGen -> UGen -> m UGen-tiRand = liftU3 N.tiRand---- | Random value in uniform distribution on trigger.-tRand :: (UId m) => UGen -> UGen -> UGen -> m UGen-tRand = liftU3 N.tRand---- | Triggered windex.-twindex :: (UId m) => UGen -> UGen -> UGen -> m UGen-twindex = liftU3 N.twindex---- | White noise.-whiteNoise :: (UId m) => Rate -> m UGen-whiteNoise = liftU N.whiteNoise
− Sound/SC3/UGen/Operator.hs
@@ -1,131 +0,0 @@--- | Enumerations of the unary and binary math unit generators.-module Sound.SC3.UGen.Operator (Unary(..), unaryName,- Binary(..), binaryName) where--data Unary = Neg- | Not- | IsNil- | NotNil- | BitNot- | Abs- | AsFloat- | AsInt- | Ceil- | Floor- | Frac- | Sign- | Squared- | Cubed- | Sqrt- | Exp- | Recip- | MIDICPS- | CPSMIDI- | MIDIRatio- | RatioMIDI- | DbAmp- | AmpDb- | OctCPS- | CPSOct- | Log- | Log2- | Log10- | Sin- | Cos- | Tan- | ArcSin- | ArcCos- | ArcTan- | SinH- | CosH- | TanH- | Rand- | Rand2- | LinRand- | BiLinRand- | Sum3Rand- | Distort- | SoftClip- | Coin- | DigitValue- | Silence- | Thru- | RectWindow- | HanWindow- | WelchWindow- | TriWindow- | Ramp- | SCurve- deriving (Eq, Show, Enum)--data Binary = Add- | Sub- | Mul- | IDiv- | FDiv- | Mod- | EQ_- | NE- | LT_- | GT_- | LE- | GE- | Min- | Max- | BitAnd- | BitOr- | BitXor- | LCM- | GCD- | Round- | RoundUp- | Trunc- | Atan2- | Hypot- | Hypotx- | Pow- | ShiftLeft- | ShiftRight- | UnsignedShift- | Fill- | Ring1- | Ring2- | Ring3- | Ring4- | DifSqr- | SumSqr- | SqrSum- | SqrDif- | AbsDif- | Thresh- | AMClip- | ScaleNeg- | Clip2- | Excess- | Fold2- | Wrap2- | FirstArg- | RandRange- | ExpRandRange- deriving (Eq, Show, Enum)---- | Provide symbolic names for standard unary operators.-unaryName :: Int -> String-unaryName 0 = "-"-unaryName n = show (toEnum n :: Unary)---- | Provide symbolic names for standard binary operators.-binaryName :: Int -> String-binaryName 0 = "+"-binaryName 1 = "-"-binaryName 2 = "*"-binaryName 4 = "/"-binaryName 5 = "%"-binaryName 6 = "=="-binaryName 7 = "/="-binaryName 8 = "<"-binaryName 9 = ">"-binaryName 10 = "<="-binaryName 11 = ">="-binaryName 25 = "**"-binaryName n = show (toEnum n :: Binary)
− Sound/SC3/UGen/Oscillator.hs
@@ -1,92 +0,0 @@--- | Oscillators.-module Sound.SC3.UGen.Oscillator where--import Data.List-import Sound.SC3.UGen.Rate-import Sound.SC3.UGen.UGen---- | Band Limited ImPulse generator.-blip :: Rate -> UGen -> UGen -> UGen-blip r freq nharm = mkOscR [AR] r "Blip" [freq, nharm] 1---- | Formant oscillator.-formant :: Rate -> UGen -> UGen -> UGen -> UGen-formant r f0 f bw = mkOscR [AR] r "Formant" [f0, f, bw] 1---- | Fast sine wave oscillator implemented using a ringing filter.-fSinOsc :: Rate -> UGen -> UGen -> UGen-fSinOsc r freq phase = mkOsc r "FSinOsc" [freq, phase] 1---- | Dynamic stochastic synthesis generator conceived by Iannis Xenakis.-gendy1 :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-gendy1 r ampDist durDist adParam ddParam minFreq maxFreq ampScale durScale initCPs kNum = mkOsc r "Gendy1" [ampDist, durDist, adParam, ddParam, minFreq, maxFreq, ampScale, durScale, initCPs, kNum] 1---- | Impulse oscillator (non band limited).-impulse :: Rate -> UGen -> UGen -> UGen-impulse r freq phase = mkOsc r "Impulse" [freq, phase] 1---- | Bank of fixed oscillators.-klang :: Rate -> UGen -> UGen -> UGen -> UGen-klang r fs fo a- | r == AR = mkOscMCE r "Klang" [fs, fo] a 1- | otherwise = undefined---- | Format frequency, amplitude and phase data as required for klang.-klangSpec :: [UGen] -> [UGen] -> [UGen] -> UGen-klangSpec f a p = mce ((concat . transpose) [f, a, p])---- | Upsample control rate signal to audio rate.-k2A :: UGen -> UGen-k2A i = mkOsc AR "K2A" [i] 1---- | A sine like shape made of two cubic pieces.-lfCub :: Rate -> UGen -> UGen -> UGen-lfCub r freq phase = mkOsc r "LFCub" [freq, phase] 1---- | A sine like shape made of two cubic pieces.-lfPar :: Rate -> UGen -> UGen -> UGen-lfPar r freq phase = mkOsc r "LFPar" [freq, phase] 1---- | Pulse oscillator (non band limited).-lfPulse :: Rate -> UGen -> UGen -> UGen -> UGen-lfPulse r freq iphase width = mkOsc r "LFPulse" [freq, iphase, width] 1---- | Sawtooth oscillator (non band limited).-lfSaw :: Rate -> UGen -> UGen -> UGen-lfSaw r freq phase = mkOsc r "LFSaw" [freq, phase] 1---- | Sawtooth oscillator (non band limited).-lfTri :: Rate -> UGen -> UGen -> UGen-lfTri r freq phase = mkOsc r "LFTri" [freq, phase] 1---- | Triggered linear ramp between two levels.-phasor :: Rate -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-phasor r t f s e p = mkOsc r "Phasor" [t, f, s, e, p] 1---- | Pulse wave generator (band limited).-pulse :: Rate -> UGen -> UGen -> UGen-pulse r freq width = mkOscR [AR] r "Pulse" [freq, width] 1---- | Sawtooth oscillator (band limited).-saw :: Rate -> UGen -> UGen-saw r freq = mkOscR [AR] r "Saw" [freq] 1---- | Silence.-silent :: Int -> UGen-silent = mkOsc AR "Silent" []---- | Sine oscillator.-sinOsc :: Rate -> UGen -> UGen -> UGen-sinOsc r freq phase = mkOsc r "SinOsc" [freq, phase] 1---- | Sawtooth oscillator hard synched to a fundamental.-syncSaw :: Rate -> UGen -> UGen -> UGen-syncSaw r syncFreq sawFreq = mkOsc r "SyncSaw" [syncFreq, sawFreq] 1---- | Variable duty sawtooth oscillator.-varSaw :: Rate -> UGen -> UGen -> UGen -> UGen-varSaw r freq iphase width = mkOsc r "VarSaw" [freq, iphase, width] 1---- Local Variables:--- truncate-lines:t--- End:
− Sound/SC3/UGen/Panner.hs
@@ -1,45 +0,0 @@--- | Sound field location and analysis unit generators.-module Sound.SC3.UGen.Panner where--import Sound.SC3.UGen.UGen---- | Two channel equal power panner.-pan2 :: UGen -> UGen -> UGen -> UGen-pan2 i x level = mkFilter "Pan2" [i, x, level] 2---- | Two channel linear pan.-linPan2 :: UGen -> UGen -> UGen -> UGen-linPan2 i x level = mkFilter "LinPan2" [i, x, level] 2--pan4 :: UGen -> UGen -> UGen -> UGen -> UGen-pan4 i x y level = mkFilter "Pan4" [i, x, y, level] 4--balance2 :: UGen -> UGen -> UGen -> UGen -> UGen-balance2 l r p level = mkFilter "Balance2" [l, r, p, level] 2---- | Rotate a sound field.-rotate2 :: UGen -> UGen -> UGen -> UGen-rotate2 x y pos = mkFilter "Rotate2" [x, y, pos] 2--panB :: UGen -> UGen -> UGen -> UGen -> UGen-panB i az el level = mkFilter "PanB" [i, az, el, level] 4---- | 2D Ambisonic B-format panner.-panB2 :: UGen -> UGen -> UGen -> UGen-panB2 i az level = mkFilter "PanB2" [i, az, level] 3--biPanB2 :: UGen -> UGen -> UGen -> UGen -> UGen-biPanB2 inA inB azimuth gain = mkFilter "BiPanB2" [inA, inB, azimuth, gain] 3---- | 2D Ambisonic B-format decoder.-decodeB2 :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen-decodeB2 nc w x y o = mkFilterMCE "DecodeB2" [w, x, y, o] nc 0--panAz :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen -> UGen-panAz nc i p l w o = mkFilterMCE "PanAz" [i, p, l, w, o] nc 0--xFade2 :: UGen -> UGen -> UGen -> UGen -> UGen-xFade2 inA inB pan level = mkFilter "XFade2" [inA, inB, pan, level] 2--linXFade2 :: UGen -> UGen -> UGen -> UGen-linXFade2 inA inB pan = mkFilter "LinXFade2" [inA, inB, pan] 2
− Sound/SC3/UGen/Rate.hs
@@ -1,32 +0,0 @@--- | Operating rate definitions and utilities.-module Sound.SC3.UGen.Rate ( Rate(..)- , rateId- , ar, kr, ir, dr ) where--import Data.Function---- | Operating rate of unit generator.-data Rate = IR | KR | AR | DR - deriving (Eq, Show, Enum, Bounded)--instance Ord Rate where- compare = compare `on` rate_ord---- | Rate constructors (lower case aliases of upper case data--- constructors).-ar, kr, ir, dr :: Rate-ar = AR-kr = KR-ir = IR-dr = DR---- | Integer rate identifier, as required for scsynth bytecode.-rateId :: Rate -> Int-rateId = fromEnum---- Rates as ordered for filter rate selection.-rate_ord :: Rate -> Int-rate_ord IR = 0-rate_ord KR = 1-rate_ord AR = 2-rate_ord DR = 3
− Sound/SC3/UGen/UGen.hs
@@ -1,446 +0,0 @@-module Sound.SC3.UGen.UGen where--import Control.Monad-import qualified Data.Char as C-import qualified Data.HashTable as H-import Data.List-import Sound.SC3.UGen.Operator-import Sound.SC3.UGen.Rate-import Sound.SC3.UGen.UId-import System.Random---- | Typeclass to constrain UGen identifiers.-class ID a where- resolveID :: a -> Int--instance ID Int where- resolveID = id--instance ID Char where- resolveID = C.ord--instance ID UGen where- resolveID = hashUGen---- | Unit generator.-data UGen = Constant { constantValue :: Double }- | Control { controlOperatingRate :: Rate- , controlName :: String- , controlDefault :: Double- , controlTriggered :: Bool }- | Primitive { ugenRate :: Rate- , ugenName :: String- , ugenInputs :: [UGen]- , ugenOutputs :: [Output]- , ugenSpecial :: Special- , ugenId :: Int }- | Proxy { proxySource :: UGen- , proxyIndex :: Int }- | MCE { mceProxies :: [UGen] }- | MRG { mrgLeft :: UGen- , mrgRight :: UGen }- deriving (Eq, Show)---- | Unit generator output descriptor.-type Output = Rate---- | Operating mode of unary and binary operators.-newtype Special = Special Int- deriving (Eq, Show)---- * Unit generator node constructors--defaultID :: Int-defaultID = (-1)---- | Hash function for unit generators.-hashUGen :: UGen -> Int-hashUGen = fromIntegral . H.hashString . show---- | Constant value node constructor.-constant :: (Real a) => a -> UGen-constant = Constant . realToFrac---- | Control input node constructor.------ Note that if the name begins with a t_ prefix the control is--- not converted to a triggered control. Please see tr_control.-control :: Rate -> String -> Double -> UGen-control r n d = Control r n d False---- | Triggered (kr) control input node constructor.-tr_control :: String -> Double -> UGen-tr_control n d = Control KR n d True---- | Multiple channel expansion node constructor.-mce :: [UGen] -> UGen-mce [] = error "mce: empty list"-mce xs = MCE xs---- | Multiple root graph node constructor.-mrg2 :: UGen -> UGen -> UGen-mrg2 = MRG---- | Unit generator proxy node constructor.-proxy :: UGen -> Int -> UGen-proxy = Proxy---- * Unit generator node predicates---- | Constant node predicate.-isConstant :: UGen -> Bool-isConstant (Constant _) = True-isConstant _ = False---- | Control node predicate.-isControl :: UGen -> Bool-isControl (Control _ _ _ _) = True-isControl _ = False---- | Unit generator primitive node predicate.-isUGen :: UGen -> Bool-isUGen (Primitive _ _ _ _ _ _) = True-isUGen _ = False---- | Proxy node predicate.-isProxy :: UGen -> Bool-isProxy (Proxy _ _) = True-isProxy _ = False---- | Multiple channel expansion node predicate.-isMCE :: UGen -> Bool-isMCE (MCE _) = True-isMCE _ = False---- | MRG predicate.-isMRG :: UGen -> Bool-isMRG (MRG _ _) = True-isMRG _ = False---- * Multiple channel expansion---- | Multiple channel expansion for two inputs.-mce2 :: UGen -> UGen -> UGen-mce2 x y = mce [x, y]---- | Clone a unit generator (mce . replicateM).-clone :: (UId m) => Int -> m UGen -> m UGen-clone n = liftM mce . replicateM n---- | Number of channels to expand to.-mceDegree :: UGen -> Int-mceDegree (MCE l) = length l-mceDegree (MRG u _) = mceDegree u-mceDegree _ = error "mceDegree: illegal ugen"---- | Extend UGen to specified degree.-mceExtend :: Int -> UGen -> [UGen]-mceExtend n (MCE l) = take n (cycle l)-mceExtend n (MRG x y) =- let (r:rs) = mceExtend n x- in MRG r y : rs-mceExtend n u = replicate n u---- | Apply MCE transformation.-mceTransform :: UGen -> UGen-mceTransform (Primitive r n i o s d) =- let f j = Primitive r n j o s d- upr = maximum (map mceDegree (filter isMCE i))- i' = transpose (map (mceExtend upr) i)- in MCE (map f i')-mceTransform _ = error "mceTransform: illegal ugen"---- | Apply MCE transformation if required.-mceExpand :: UGen -> UGen-mceExpand (MCE l) = MCE (map mceExpand l)-mceExpand (MRG x y) = MRG (mceExpand x) y-mceExpand u =- let required (Primitive _ _ i _ _ _) = not (null (filter isMCE i))- required _ = False- in if required u- then mceExpand (mceTransform u)- else u---- | Apply a function to each channel at a unit generator.-mceMap :: (UGen -> UGen) -> UGen -> UGen-mceMap f u = mce (map f (mceChannels u))---- | Apply UGen list operation on MCE contents.-mceEdit :: ([UGen] -> [UGen]) -> UGen -> UGen-mceEdit f (MCE l) = MCE (f l)-mceEdit _ _ = error "mceEdit: non MCE value"---- | Reverse order of channels at MCE.-mceReverse :: UGen -> UGen-mceReverse = mceEdit reverse---- | Obtain indexed channel at MCE.-mceChannel :: Int -> UGen -> UGen-mceChannel n (MCE l) = l !! n-mceChannel _ _ = error "mceChannel: non MCE value"---- | Output channels of UGen as a list.-mceChannels :: UGen -> [UGen]-mceChannels (MCE l) = l-mceChannels (MRG x y) = let (r:rs) = mceChannels x in MRG r y : rs-mceChannels u = [u]---- | Transpose rows and columns, ie. {{a,b},{c,d}} to {{a,c},{b,d}}.-mceTranspose :: UGen -> UGen-mceTranspose =- mce . map mce . transpose . map mceChannels . mceChannels---- | Collapse mce by summing (see also mix and mixN).-mceSum :: UGen -> UGen-mceSum = sum . mceChannels---- * Multiple root graphs---- | Multiple root graph constructor.-mrg :: [UGen] -> UGen-mrg [] = undefined-mrg [x] = x-mrg (x:xs) = MRG x (mrg xs)---- * Unit generator function builders---- | Apply proxy transformation if required.-proxify :: UGen -> UGen-proxify u- | isMCE u = mce (map proxify (mceProxies u))- | isMRG u = mrg [proxify (mrgLeft u), mrgRight u]- | isUGen u =- let o = ugenOutputs u- in case o of- (_:_:_) -> mce (map (proxy u) [0..(length o - 1)])- _ -> u- | otherwise = error "proxify: illegal ugen"---- | Determine the rate of a UGen.-rateOf :: UGen -> Rate-rateOf u- | isConstant u = IR- | isControl u = controlOperatingRate u- | isUGen u = ugenRate u- | isProxy u = rateOf (proxySource u)- | isMCE u = maximum (map rateOf (mceProxies u))- | isMRG u = rateOf (mrgLeft u)- | otherwise = undefined---- True is input is a sink UGen, ie. has no outputs.-is_sink :: UGen -> Bool-is_sink u- | isUGen u = null (ugenOutputs u)- | isMCE u = all is_sink (mceProxies u)- | isMRG u = is_sink (mrgLeft u)- | otherwise = False---- Ensure input UGen is valid, ie. not a sink.-check_input :: UGen -> UGen-check_input u = if is_sink u- then error ("illegal input: " ++ show u)- else u---- | Construct proxied and multiple channel expanded UGen.-mkUGen :: (ID a) =>- Rate -> String -> [UGen] -> [Output] -> Special -> a -> UGen-mkUGen r n i o s z =- let u = Primitive r n (map check_input i) o s (resolveID z)- in proxify (mceExpand u)---- | Operator UGen constructor.-mkOperator :: String -> [UGen] -> Int -> UGen-mkOperator c i s =- let r = maximum (map rateOf i)- in mkUGen r c i [r] (Special s) defaultID---- | Unary math constructor with constant optimization.-mkUnaryOperator :: Unary -> (Double -> Double) -> UGen -> UGen-mkUnaryOperator i f a- | isConstant a = constant (f (constantValue a))- | otherwise = mkOperator "UnaryOpUGen" [a] (fromEnum i)---- | Binary math constructor with constant optimization.-mkBinaryOperator :: Binary -> (Double -> Double -> Double) ->- UGen -> UGen -> UGen-mkBinaryOperator i f a b =- if isConstant a && isConstant b- then let a' = constantValue a- b' = constantValue b- in constant (f a' b')- else mkOperator "BinaryOpUGen" [a, b] (fromEnum i)--mk_osc :: (ID a) =>- [Rate] -> a ->- Rate -> String -> [UGen] -> Int -> UGen-mk_osc rs z r c i o =- if r `elem` rs- then mkUGen r c i (replicate o r) (Special 0) z- else error ("mk_osc: rate restricted: " ++ show (r, rs, c))---- | Oscillator constructor.-mkOsc :: Rate -> String -> [UGen] -> Int -> UGen-mkOsc = mk_osc [minBound .. maxBound] defaultID---- | Oscillator constructor, rate restricted variant.-mkOscR :: [Rate] -> Rate -> String -> [UGen] -> Int -> UGen-mkOscR rs = mk_osc rs defaultID---- | Oscillator constructor, setting identifier.-mkOscId :: (ID a) =>- a -> Rate -> String -> [UGen] -> Int -> UGen-mkOscId = mk_osc [minBound .. maxBound]--mk_osc_mce :: (ID a) =>- a -> Rate -> String -> [UGen] -> UGen -> Int -> UGen-mk_osc_mce z r c i j =- let i' = i ++ mceChannels j- in mk_osc [minBound .. maxBound] z r c i'---- | Variant oscillator constructor with MCE collapsing input.-mkOscMCE :: Rate -> String -> [UGen] -> UGen -> Int -> UGen-mkOscMCE = mk_osc_mce defaultID---- | Variant oscillator constructor with MCE collapsing input.-mkOscMCEId :: (ID a) =>- a -> Rate -> String -> [UGen] -> UGen -> Int -> UGen-mkOscMCEId = mk_osc_mce--mk_filter :: (ID a) =>- [Rate] -> a -> String -> [UGen] -> Int -> UGen-mk_filter rs z c i o =- let r = maximum (map rateOf i)- o'= replicate o r- in if r `elem` rs- then mkUGen r c i o' (Special 0) z- else error ("mk_filter: rate restriceted: " ++ show (r, rs, c))--all_rates :: [Rate]-all_rates = [minBound .. maxBound]---- | Filter UGen constructor.-mkFilter :: String -> [UGen] -> Int -> UGen-mkFilter = mk_filter all_rates defaultID---- | Filter UGen constructor.-mkFilterR :: [Rate] -> String -> [UGen] -> Int -> UGen-mkFilterR rs = mk_filter rs defaultID---- | Filter UGen constructor.-mkFilterId :: (ID a) => a -> String -> [UGen] -> Int -> UGen-mkFilterId = mk_filter all_rates---- | Variant filter with rate derived from keyed input.-mkFilterKeyed :: String -> Int -> [UGen] -> Int -> UGen-mkFilterKeyed c k i o =- let r = rateOf (i !! k)- o' = replicate o r- in mkUGen r c i o' (Special 0) defaultID--mk_filter_mce :: (ID a) => [Rate] -> a ->- String -> [UGen] -> UGen -> Int -> UGen-mk_filter_mce rs z c i j = mk_filter rs z c (i ++ mceChannels j)---- | Variant filter constructor with MCE collapsing input.-mkFilterMCER :: [Rate] -> String -> [UGen] -> UGen -> Int -> UGen-mkFilterMCER rs = mk_filter_mce rs defaultID---- | Variant filter constructor with MCE collapsing input.-mkFilterMCE :: String -> [UGen] -> UGen -> Int -> UGen-mkFilterMCE = mk_filter_mce all_rates defaultID---- | Variant filter constructor with MCE collapsing input.-mkFilterMCEId :: (ID a) =>- a -> String -> [UGen] -> UGen -> Int -> UGen-mkFilterMCEId = mk_filter_mce all_rates---- | Information unit generators are very specialized.-mkInfo :: String -> UGen-mkInfo name = mkOsc IR name [] 1---- Unit generators are numbers.-instance Num UGen where- negate = mkUnaryOperator Neg negate- (+) = mkBinaryOperator Add (+)- (-) = mkBinaryOperator Sub (-)- (*) = mkBinaryOperator Mul (*)- abs = mkUnaryOperator Abs abs- signum = mkUnaryOperator Sign signum- fromInteger = Constant . fromInteger---- Unit generators are fractional.-instance Fractional UGen where- recip = mkUnaryOperator Recip recip- (/) = mkBinaryOperator FDiv (/)- fromRational = Constant . fromRational---- Unit generators are floating point.-instance Floating UGen where- pi = Constant pi- exp = mkUnaryOperator Exp exp- log = mkUnaryOperator Log log- sqrt = mkUnaryOperator Sqrt sqrt- (**) = mkBinaryOperator Pow (**)- logBase a b = log b / log a- sin = mkUnaryOperator Sin sin- cos = mkUnaryOperator Cos cos- tan = mkUnaryOperator Tan tan- asin = mkUnaryOperator ArcSin asin- acos = mkUnaryOperator ArcCos acos- atan = mkUnaryOperator ArcTan atan- sinh = mkUnaryOperator SinH sinh- cosh = mkUnaryOperator CosH cosh- tanh = mkUnaryOperator TanH tanh- asinh x = log (sqrt (x*x+1) + x)- acosh x = log (sqrt (x*x-1) + x)- atanh x = (log (1+x) - log (1-x)) / 2---- Unit generators are real.-instance Real UGen where- toRational (Constant n) = toRational n- toRational _ = error "toRational at non-constant UGen"---- Unit generators are integral.-instance Integral UGen where- quot = mkBinaryOperator IDiv undefined- rem = mkBinaryOperator Mod undefined- quotRem a b = (quot a b, rem a b)- div = mkBinaryOperator IDiv undefined- mod = mkBinaryOperator Mod undefined- toInteger (Constant n) = floor n- toInteger _ = error "toInteger at non-constant UGen"---- Unit generators are orderable.-instance Ord UGen where- (Constant a) < (Constant b) = a < b- _ < _ = error "< at UGen is partial, see <*"- (Constant a) <= (Constant b) = a <= b- _ <= _ = error "<= at UGen is partial, see <=*"- (Constant a) > (Constant b) = a < b- _ > _ = error "> at UGen is partial, see >*"- (Constant a) >= (Constant b) = a >= b- _ >= _ = error ">= at UGen is partial, see >=*"- min = mkBinaryOperator Min min- max = mkBinaryOperator Max max---- Unit generators are enumerable.-instance Enum UGen where- succ u = u + 1- pred u = u - 1- toEnum = constant- fromEnum (Constant n) = truncate n- fromEnum _ = error "cannot enumerate non-constant UGens"- enumFrom = iterate (+1)- enumFromThen n m = iterate (+(m-n)) n- enumFromTo n m = takeWhile (<= m+1/2) (enumFrom n)- enumFromThenTo n n' m =- let p = if n' >= n then (>=) else (<=)- in takeWhile (p (m + (n'-n)/2)) (enumFromThen n n')---- Unit generators are stochastic.-instance Random UGen where- randomR (Constant l, Constant r) g =- let (n, g') = randomR (l,r) g- in (Constant n, g')- randomR _ _ = error "randomR: non constant (l,r)"- random = randomR (-1.0, 1.0)
− Sound/SC3/UGen/UGen/Lift.hs
@@ -1,36 +0,0 @@-module Sound.SC3.UGen.UGen.Lift where--import Sound.SC3.UGen.UGen-import Sound.SC3.UGen.UId---- | Lift base UGen to monadic form.-liftU :: (UId m) =>- (Int -> a -> UGen) ->- (a -> m UGen)-liftU f a = do- n <- generateUId- return (f n a)---- | Lift base UGen to monadic form.-liftU2 :: (UId m) =>- (Int -> a -> b -> UGen) ->- (a -> b -> m UGen)-liftU2 f a b = do- n <- generateUId- return (f n a b)---- | Lift base UGen to monadic form.-liftU3 :: (UId m) =>- (Int -> a -> b -> c -> UGen) ->- (a -> b -> c -> m UGen)-liftU3 f a b c = do- n <- generateUId- return (f n a b c)---- | Lift base UGen to monadic form.-liftU4 :: (UId m) =>- (Int -> a -> b -> c -> d -> UGen) ->- (a -> b -> c -> d -> m UGen)-liftU4 f a b c d = do- n <- generateUId- return (f n a b c d)
− Sound/SC3/UGen/UId.hs
@@ -1,12 +0,0 @@-module Sound.SC3.UGen.UId where--import Control.Monad-import Data.Unique---- | A class indicating a monad that will generate a sequence of--- unique integer identifiers.-class (Monad m) => UId m where- generateUId :: m Int--instance UId IO where- generateUId = liftM hashUnique newUnique
− Sound/SC3/UGen/Utilities.hs
@@ -1,26 +0,0 @@-module Sound.SC3.UGen.Utilities where--import Sound.SC3.UGen.Enum-import Sound.SC3.UGen.UGen--from_loop :: Loop -> UGen-from_loop NoLoop = Constant 0-from_loop Loop = Constant 1-from_loop (WithLoop u) = u--from_interpolation :: Interpolation -> UGen-from_interpolation NoInterpolation = Constant 1-from_interpolation LinearInterpolation = Constant 2-from_interpolation CubicInterpolation = Constant 4-from_interpolation (Interpolation u) = u--from_done_action :: DoneAction -> UGen-from_done_action DoNothing = Constant 0-from_done_action PauseSynth = Constant 1-from_done_action RemoveSynth = Constant 2-from_done_action (DoneAction u) = u--from_warp :: Warp -> UGen-from_warp Linear = Constant 0-from_warp Exponential = Constant 1-from_warp (Warp u) = u
+ Sound/Sc3.hs view
@@ -0,0 +1,9 @@+{- | Composite of "Sound.Sc3.Common", "Sound.Sc3.Server.Monad",+"Sound.Sc3.Ugen" and "Sound.Sc3.Ugen.Bindings".+-}+module Sound.Sc3 (module M) where++import Sound.Sc3.Common as M+import Sound.Sc3.Server.Monad as M+import Sound.Sc3.Ugen as M+import Sound.Sc3.Ugen.Bindings as M
+ Sound/Sc3/Common.hs view
@@ -0,0 +1,15 @@+-- | Composite of SC3.Common sub-modules.+module Sound.Sc3.Common (module M) where++import Sound.Sc3.Common.Buffer as M+import Sound.Sc3.Common.Enum as M+import Sound.Sc3.Common.Envelope as M+import Sound.Sc3.Common.Help as M+import Sound.Sc3.Common.Math as M+import Sound.Sc3.Common.Math.Operator as M+import Sound.Sc3.Common.Math.Warp as M+import Sound.Sc3.Common.Mce as M+import Sound.Sc3.Common.Monad as M+import Sound.Sc3.Common.Rate as M+import Sound.Sc3.Common.SoundFile as M+import Sound.Sc3.Common.Uid as M
+ Sound/Sc3/Common/Base.hs view
@@ -0,0 +1,369 @@+-- | Common core functions.+module Sound.Sc3.Common.Base where++import Data.Char {- base -}+import Data.List {- base -}+import Data.Maybe {- base -}+import Data.Ord {- base -}++import qualified Safe {- safe -}++-- * Function++-- | Unary function.+type Fn1 a b = a -> b++-- | Binary function.+type Fn2 a b c = a -> b -> c++-- | Ternary function.+type Fn3 a b c d = a -> b -> c -> d++-- | Quaternary function.+type Fn4 a b c d e = a -> b -> c -> d -> e++-- | 5-parameter function.+type Fn5 a b c d e f = a -> b -> c -> d -> e -> f++-- | 6-parameter function.+type Fn6 a b c d e f g = a -> b -> c -> d -> e -> f -> g++-- | 10-parameter function.+type Fn10 a b c d e f g h i j k = a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k++-- | 11-parameter function.+type Fn11 a b c d e f g h i j k l = a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l++{- | Apply /f/ n times, ie. iterate f x !! n++>>> iter 3 (* 2) 1+8++>>> iterate (* 2) 1 !! 3+8+-}+iter :: Int -> (a -> a) -> a -> a+iter n f x = if n == 0 then x else f (iter (n - 1) f x)++-- * Functor++-- | This is the same function as Control.Monad.void, which however hugs does not know of.+fvoid :: Functor f => f a -> f ()+fvoid = fmap (const ())++-- * Read++-- | Variant of 'reads' requiring exact match.+reads_exact :: Read a => String -> Maybe a+reads_exact s =+ case reads s of+ [(r, "")] -> Just r+ _ -> Nothing++-- * String++{- | Similar to Data.List.Split.splitOn, which however hugs doesn't know of.++>>> string_split_at_char ':' "/usr/local/bin:/usr/bin:/bin"+["/usr/local/bin","/usr/bin","/bin"]++>>> string_split_at_char ':' "/usr/local/bin"+["/usr/local/bin"]+-}+string_split_at_char :: Char -> String -> [String]+string_split_at_char c s =+ case break (== c) s of+ (lhs, []) -> [lhs]+ (lhs, _ : rhs) -> lhs : string_split_at_char c rhs++-- * String / Case++-- | Ci = Case insensitive, Cs = case sensitive, Sci = separator & case insensitive+data Case_Rule = Ci | Cs | Sci deriving (Eq)++string_op :: (String -> String -> t) -> Case_Rule -> String -> String -> t+string_op f cr x y =+ let ci_form = map toLower+ sci_form = filter (`notElem` "-_") . ci_form+ in case cr of+ Ci -> f (ci_form x) (ci_form y)+ Cs -> f x y+ Sci -> f (sci_form x) (sci_form y)++{- | String equality with 'Case_Rule'.++>>> string_eq Ci "sinOsc" "SinOsc"+True++>>> string_eq Sci "sin-osc" "SinOsc"+True+-}+string_eq :: Case_Rule -> String -> String -> Bool+string_eq = string_op (==)++string_cmp :: Case_Rule -> String -> String -> Ordering+string_cmp = string_op compare++-- | 'rlookup_by' of 'string_eq'.+rlookup_str :: Case_Rule -> String -> [(a, String)] -> Maybe a+rlookup_str = rlookup_by . string_eq++{- | 'Enum' parser with 'Case_Rule'.++>>> parse_enum Ci "false" :: Maybe Bool+Just False+-}+parse_enum :: (Show t, Enum t, Bounded t) => Case_Rule -> String -> Maybe t+parse_enum cr nm =+ let u = [minBound .. maxBound]+ t = zip (map show u) u+ in lookup_by (string_eq cr) nm t++-- * List++{- | Left to right composition of a list of functions.++>>> compose_l [(* 2),(+ 1)] 3+7+-}+compose_l :: [t -> t] -> t -> t+compose_l = flip (foldl (\x f -> f x))++{- | Right to left composition of a list of functions.++>>> compose_r [(* 2),(+ 1)] 3+8+-}+compose_r :: [t -> t] -> t -> t+compose_r = flip (foldr ($))++{- | SequenceableCollection.differentiate++> [3,4,1,1].differentiate == [3,1,-3,0]++>>> d_dx [3,4,1,1]+[3,1,-3,0]++>>> d_dx [0,1,3,6]+[0,1,2,3]+-}+d_dx :: (Num a) => [a] -> [a]+d_dx l = zipWith (-) l (0 : l)++{- | Variant that does not prepend zero to input, ie. 'tail' of 'd_dx'.++>> d_dx' [3,4,1,1]+[1,-3,0]++>>> d_dx' [0,1,3,6]+[1,2,3]+-}+d_dx' :: Num n => [n] -> [n]+d_dx' l = zipWith (-) (Safe.tailNote "d_dx'" l) l++{- | SequenceableCollection.integrate++> [3,4,1,1].integrate == [3,7,8,9]++>>> dx_d [3,4,1,1]+[3,7,8,9]++>>> dx_d (d_dx [0,1,3,6])+[0,1,3,6]++>>> dx_d [0.5,0.5]+[0.5,1.0]+-}+dx_d :: Num n => [n] -> [n]+dx_d = scanl1 (+)++{- | Variant pre-prending zero to output.++>>> dx_d' [3,4,1,1]+[0,3,7,8,9]++>>> dx_d' (d_dx' [0,1,3,6])+[0,1,3,6]++>>> dx_d' [0.5,0.5]+[0.0,0.5,1.0]+-}+dx_d' :: Num n => [n] -> [n]+dx_d' = (0 :) . dx_d++-- | 'lookup' with equality function.+lookup_by :: (a -> t -> Bool) -> a -> [(t, b)] -> Maybe b+lookup_by f x = fmap snd . find (f x . fst)++-- | Erroring variant, with message.+lookup_by_note :: String -> (a -> t -> Bool) -> a -> [(t, b)] -> b+lookup_by_note msg f x = fromMaybe (error ("lookup_by: " ++ msg)) . lookup_by f x++-- | Erroring variant.+lookup_by_err :: (a -> t -> Bool) -> a -> [(t, b)] -> b+lookup_by_err = lookup_by_note "error"++-- | Reverse 'lookup' with equality function.+rlookup_by :: (b -> b -> Bool) -> b -> [(a, b)] -> Maybe a+rlookup_by f x = fmap fst . find (f x . snd)++{- | (prev,cur,next) triples.++>>> pcn_triples [1..3]+[(Nothing,1,Just 2),(Just 1,2,Just 3),(Just 2,3,Nothing)]+-}+pcn_triples :: [a] -> [(Maybe a, a, Maybe a)]+pcn_triples =+ let f e l = case l of+ e1 : e2 : l' -> (e, e1, Just e2) : f (Just e1) (e2 : l')+ [e'] -> [(e, e', Nothing)]+ [] -> undefined+ in f Nothing++{- | Separate first list element.++>>> sep_first "astring"+Just ('a',"string")+-}+sep_first :: [t] -> Maybe (t, [t])+sep_first l =+ case l of+ e : l' -> Just (e, l')+ _ -> Nothing++{- | Separate last list element.++>>> sep_last "stringb"+Just ("string",'b')+-}+sep_last :: [t] -> Maybe ([t], t)+sep_last =+ let f (e, l) = (reverse l, e)+ in fmap f . sep_first . reverse++{- | Are lists of equal length?++>>> equal_length_p ["t1","t2"]+True++>>> equal_length_p ["t","t1","t2"]+False+-}+equal_length_p :: [[a]] -> Bool+equal_length_p = (== 1) . length . nub . map length++-- | Histogram+histogram :: Ord a => [a] -> [(a, Int)]+histogram x =+ let g = group (sort x)+ in zip (map (Safe.headNote "histogram") g) (map length g)++-- | !! with localised error message+at_with_error_message :: String -> [t] -> Int -> t+at_with_error_message msg list index =+ if index >= length list+ then error ("!!: index out of range: " ++ msg)+ else list !! index++-- | concat of intersperse. This is the same function as intercalate, which hugs doesn't know of.+concat_intersperse :: [a] -> [[a]] -> [a]+concat_intersperse x = concat . intersperse x++{- | Similar to Data.List.Split.splitOn, which however hugs doesn't know of.++>>> list_split_at_elem ' ' "a sequence of words"+["a","sequence","of","words"]+-}+list_split_at_elem :: Eq t => t -> [t] -> [[t]]+list_split_at_elem c s =+ case break (== c) s of+ (lhs, []) -> [lhs]+ (lhs, _ : rhs) -> lhs : list_split_at_elem c rhs++{- | Data.List.sortOn, which however hugs does not know of.++>>> sort_on snd [('a',1),('b',0)]+[('b',0),('a',1)]+-}+sort_on :: (Ord b) => (a -> b) -> [a] -> [a]+sort_on = sortBy . comparing++{- | Inserts at the first position where it compares less but not equal to the next element.++>>> import Data.Function+>>> insertBy (compare `on` fst) (3,'x') (zip [1..5] ['a'..])+[(1,'a'),(2,'b'),(3,'x'),(3,'c'),(4,'d'),(5,'e')]++>>> insertBy_post (compare `on` fst) (3,'x') (zip [1..5] ['a'..])+[(1,'a'),(2,'b'),(3,'c'),(3,'x'),(4,'d'),(5,'e')]+-}+insertBy_post :: (a -> a -> Ordering) -> a -> [a] -> [a]+insertBy_post cmp e l =+ case l of+ [] -> [e]+ h : l' -> case cmp e h of+ LT -> e : l+ _ -> h : insertBy_post cmp e l'++-- | 'insertBy_post' using 'compare'.+insert_post :: Ord t => t -> [t] -> [t]+insert_post = insertBy_post compare++{- | Apply /f/ at all but last element, and /g/ at last element.++>>> at_last (* 2) negate [1..4]+[2,4,6,-4]+-}+at_last :: (a -> b) -> (a -> b) -> [a] -> [b]+at_last f g x =+ case x of+ [] -> []+ [i] -> [g i]+ i : x' -> f i : at_last f g x'++-- * Tuples++-- | Zip two 4-tuples.+p4_zip :: (a, b, c, d) -> (e, f, g, h) -> ((a, e), (b, f), (c, g), (d, h))+p4_zip (a, b, c, d) (e, f, g, h) = ((a, e), (b, f), (c, g), (d, h))++-- | Two-tuple.+type T2 a = (a, a)++-- | Three-tuple.+type T3 a = (a, a, a)++-- | Four-tuple.+type T4 a = (a, a, a, a)++-- | t -> (t,t)+dup2 :: t -> T2 t+dup2 t = (t, t)++-- | t -> (t,t,t)+dup3 :: t -> T3 t+dup3 t = (t, t, t)++-- | t -> (t,t,t,t)+dup4 :: t -> T4 t+dup4 t = (t, t, t, t)++-- | 'concatMap' of /f/ at /x/ and /g/ at /y/.+mk_duples :: (a -> c) -> (b -> c) -> [(a, b)] -> [c]+mk_duples a b = concatMap (\(x, y) -> [a x, b y])++-- | Length prefixed list variant of 'mk_duples'.+mk_duples_l :: (Int -> c) -> (a -> c) -> (b -> c) -> [(a, [b])] -> [c]+mk_duples_l i a b = concatMap (\(x, y) -> a x : i (length y) : map b y)++-- | 'concatMap' of /f/ at /x/ and /g/ at /y/ and /h/ at /z/.+mk_triples :: (a -> d) -> (b -> d) -> (c -> d) -> [(a, b, c)] -> [d]+mk_triples a b c = concatMap (\(x, y, z) -> [a x, b y, c z])++-- | [x,y] -> (x,y)+t2_from_list :: [t] -> T2 t+t2_from_list l = case l of [p, q] -> (p, q); _ -> error "t2_from_list"++-- | [x,y,z] -> (x,y,z)+t3_from_list :: [t] -> (t, t, t)+t3_from_list l = case l of [p, q, r] -> (p, q, r); _ -> error "t3_from_list"
+ Sound/Sc3/Common/Base/System.hs view
@@ -0,0 +1,30 @@+module Sound.Sc3.Common.Base.System where++import Control.Exception {- base -}+import Data.Maybe {- base -}+import System.Environment {- base -}++{- | 'getEnv' with error handler to return default value. This almost works in hugs (IOException should be Exception, the signature can be elided)++>>> get_env_with_default "undefined_environment_variable" "default"+"default"+-}+get_env_with_default :: String -> String -> IO String+get_env_with_default variableName defaultValue =+ Control.Exception.catch (getEnv variableName) ((\_ -> return defaultValue) :: IOException -> IO String)++{- | 'getEnvironment' with lookup and default value.++> get_env_default "PATH" "/usr/bin"+-}+get_env_default :: String -> String -> IO String+get_env_default variableName defaultValue = do+ env <- getEnvironment+ return (fromMaybe defaultValue (lookup variableName env))++{- | 'lookupEnv' with default value.++> lookup_env_default "PATH" "/usr/bin"+-}+lookup_env_default :: String -> String -> IO String+lookup_env_default e k = fmap (fromMaybe k) (lookupEnv e)
+ Sound/Sc3/Common/Buffer.hs view
@@ -0,0 +1,218 @@+-- | Signals & wavetables+module Sound.Sc3.Common.Buffer where++import Data.List {- base -}++import qualified Sound.Sc3.Common.Math as S {- hsc3 -}++{- | /z/ ranges from 0 (for /i/) to 1 (for /j/).++> 1.5.blend(2.0,0.50)+1.75+> 1.5.blend(2.0,0.75)+1.875++>>> blend 0.50 1.5 2+1.75++>>> blend 0.75 1.5 2+1.875+-}+blend :: Num a => a -> a -> a -> a+blend z i j = i + (z * (j - i))++{- | Variant of '(!!)' but values for index greater than the size of the collection will be clipped to the last index.++>>> map (\x -> clipAt x "abc") [-1,0,1,2,3]+"aabcc"+-}+clipAt :: Int -> [a] -> a+clipAt ix c = if ix > length c - 1 then last c else if ix < 0 then c !! 0 else c !! ix++-- | 'blendAt' with @clip@ function as argument.+blendAtBy :: (Integral i, RealFrac n) => (i -> t -> n) -> n -> t -> n+blendAtBy f ix c =+ let m = floor ix+ m' = fromIntegral m+ in blend (S.absdif ix m') (f m c) (f (m + 1) c)++{- | @SequenceableCollection.blendAt@ returns a linearly interpolated value between the two closest indices.+Inverse operation is 'indexInBetween'.++> [2,5,6].blendAt(0.4)+3.2++>>> blendAt 0 [2,5,6]+2.0+>>> blendAt 0.4 [2,5,6]+3.2+-}+blendAt :: RealFrac a => a -> [a] -> a+blendAt = blendAtBy clipAt++-- | Resampling function, /n/ is destination length, /r/ is source length, /f/ is the indexing function, /c/ is the collection.+resamp1_gen :: (Integral i, RealFrac n) => i -> i -> (i -> t -> n) -> t -> i -> n+resamp1_gen n r f c =+ let n' = fromIntegral n+ fwd = (fromIntegral r - 1) / (n' - 1)+ gen i = blendAtBy f (fromIntegral i * fwd) c+ in gen++{- | @SequenceableCollection.resamp1@ returns a new collection of the desired length, with values resampled evenly-spaced from the receiver with linear interpolation.++> [1].resamp1(3) == [1,1,1]+> [1,2,3,4].resamp1(12)+> [1,2,3,4].resamp1(3) == [1,2.5,4]++>>> resamp1 3 [1]+[1.0,1.0,1.0]++>>> resamp1 7 [1,2,3,4]+[1.0,1.5,2.0,2.5,3.0,3.5,4.0]++>>> resamp1 3 [1,2,3,4]+[1.0,2.5,4.0]+-}+resamp1 :: RealFrac n => Int -> [n] -> [n]+resamp1 n c =+ let gen = resamp1_gen n (length c) clipAt c+ in map gen [0 .. n - 1]++{- | @ArrayedCollection.normalizeSum@ ensures sum of elements is one.++> [1,2,3].normalizeSum == [1/6,1/3,0.5]++>>> normalizeSum [1,2,3] == [1/6,2/6,3/6]+True+-}+normalizeSum :: (Fractional a) => [a] -> [a]+normalizeSum l = let n = sum l in map (/ n) l++-- | Variant that specifies range of input sequence separately.+normalise_rng :: Fractional n => (n, n) -> (n, n) -> [n] -> [n]+normalise_rng (il, ir) (l, r) = map (\e -> S.sc3_linlin e il ir l r)++{- | @ArrayedCollection.normalize@ returns a new Array with the receiver items normalized between min and max.++> [1,2,3].normalize == [0,0.5,1]+> [1,2,3].normalize(-20,10) == [-20,-5,10]++>>> normalize 0 1 [1,2,3]+[0.0,0.5,1.0]++>>> normalize (-20) 10 [1,2,3]+[-20.0,-5.0,10.0]+-}+normalize :: (Fractional n, Ord n) => n -> n -> [n] -> [n]+normalize l r c = normalise_rng (minimum c, maximum c) (l, r) c++{- | List of 2-tuples of elements at distance (stride) /n/.++>>> t2_window 3 [1..9]+[(1,2),(4,5),(7,8)]+-}+t2_window :: Integral i => i -> [t] -> [(t, t)]+t2_window n x =+ case x of+ i : j : _ -> (i, j) : t2_window n (genericDrop n x)+ _ -> []++{- | List of 2-tuples of adjacent elements.++>>> t2_adjacent [1..6]+[(1,2),(3,4),(5,6)]++>>> t2_adjacent [1..5]+[(1,2),(3,4)]+-}+t2_adjacent :: [t] -> [(t, t)]+t2_adjacent = t2_window (2 :: Int)++{- | List of 2-tuples of overlapping elements.++>>> t2_overlap [1..4]+[(1,2),(2,3),(3,4)]+-}+t2_overlap :: [b] -> [(b, b)]+t2_overlap x =+ case uncons x of+ Nothing -> error "t2_overlap"+ Just (_, t) -> zip x t++{- | Concat of 2-tuples.++>>> t2_concat (t2_adjacent [1..6])+[1,2,3,4,5,6]++>>> t2_concat (t2_overlap [1..4])+[1,2,2,3,3,4]+-}+t2_concat :: [(a, a)] -> [a]+t2_concat x =+ case x of+ [] -> []+ (i, j) : x' -> i : j : t2_concat x'++{- | A Signal is half the size of a Wavetable, each element is the sum+of two adjacent elements of the Wavetable.++>>> from_wavetable [-0.5,0.5,0,0.5,1.5,-0.5,1,-0.5]+[0.0,0.5,1.0,0.5]++>>> let s = [0,0.5,1,0.5]+>>> from_wavetable (to_wavetable s) == s+True+-}+from_wavetable :: Num n => [n] -> [n]+from_wavetable = map (uncurry (+)) . t2_adjacent++{- | A Wavetable has n * 2 elements, where n is the number of elements of the Signal.+ Each signal element e0 expands to the two elements (2 * e0 - e1, e1 - e0)+ where e1 is the next element, or zero at the final element.+ Properly wavetables are only of power of two element signals.++> Signal[0,0.5,1,0.5].asWavetable == Wavetable[-0.5,0.5,0,0.5,1.5,-0.5,1,-0.5]++>>> to_wavetable [0,0.5,1,0.5]+[-0.5,0.5,0.0,0.5,1.5,-0.5,1.0,-0.5]+-}+to_wavetable :: Num a => [a] -> [a]+to_wavetable = to_wavetable_nowrap . (++ [0])++{- | Shaper requires wavetables without wrap.++>>> to_wavetable_nowrap [0,0.5,1,0.5]+[-0.5,0.5,0.0,0.5,1.5,-0.5]+-}+to_wavetable_nowrap :: Num a => [a] -> [a]+to_wavetable_nowrap =+ let f (e0, e1) = (2 * e0 - e1, e1 - e0)+ in t2_concat . map f . t2_overlap++{- | Variant of 'sineFill' that gives each component table.++>>> let t = sineGen 1024 (map recip [1, 2, 3, 5, 8, 13, 21, 34, 55]) (replicate 9 0)+>>> map length t == replicate 9 1024+True++> Sound.Sc3.Plot.plot_p1_ln t+-}+sineGen :: (Floating n, Enum n) => Int -> [n] -> [n] -> [[n]]+sineGen n =+ let incr = (2 * pi) / fromIntegral n+ ph partial = take n [0, incr * partial ..]+ f h amp iph = map (\z -> sin (z + iph) * amp) (ph h)+ in zipWith3 f [1 ..]++{- | @Signal.*sineFill@ is a table generator.+ Frequencies are partials, amplitudes and initial phases are as given.+ Result is normalised.++> let a = [[21,5,34,3,2,13,1,8,55],[13,8,55,34,5,21,3,1,2],[55,34,1,3,2,13,5,8,21]]+> let t = map (\amp -> sineFill 1024 (map recip amp) (replicate 9 0)) a+> Sound.Sc3.Plot.plot_p1_ln t+-}+sineFill :: (Ord n, Floating n, Enum n) => Int -> [n] -> [n] -> [n]+sineFill n amp iph =+ let t = sineGen n amp iph+ in normalize (-1) 1 (map sum (transpose t))
+ Sound/Sc3/Common/Buffer/Array.hs view
@@ -0,0 +1,35 @@+{- | Array variants of "Sound.Sc3.Common.Buffer".+These functions have the same names as the plain forms and are not re-exported by "Sound.Sc3.Common".+-}+module Sound.Sc3.Common.Buffer.Array where++import qualified Data.Array as A {- array -}++import qualified Sound.Sc3.Common.Buffer as Common.Buffer {- hsc3 -}++-- | 'Common.Buffer.clipAt'.+clipAt :: Int -> A.Array Int a -> a+clipAt ix c =+ let (l, r) = A.bounds c+ f = (A.!) c+ in if ix < l then f l else if ix > r then f r else f ix++{- | 'C.blendAtBy' of 'clipAt'.++> Sound.Sc3.Common.Buffer.Array.blendAt 0 (A.listArray (0,2) [2,5,6]) == 2+> Sound.Sc3.Common.Buffer.Array.blendAt 0.4 (A.listArray (0,2) [2,5,6]) == 3.2+-}+blendAt :: RealFrac a => a -> A.Array Int a -> a+blendAt = Common.Buffer.blendAtBy clipAt++{- | 'C.resamp1'.++> Sound.Sc3.Common.Buffer.Array.resamp1 12 (A.listArray (0,3) [1,2,3,4])+> Sound.Sc3.Common.Buffer.Array.resamp1 3 (A.listArray (0,3) [1,2,3,4]) == A.listArray (0,2) [1,2.5,4]+-}+resamp1 :: RealFrac n => Int -> A.Array Int n -> A.Array Int n+resamp1 n c =+ let (_, r) = A.bounds c+ gen = Common.Buffer.resamp1_gen n (r + 1) clipAt c+ rs = map gen [0 .. n - 1]+ in A.listArray (0, n - 1) rs
+ Sound/Sc3/Common/Buffer/Gen.hs view
@@ -0,0 +1,128 @@+{- | Implementation of server b_gen routines.++The naming scheme is: _p generates one partial, _l generates a list+of partials, _nrm is the unit normalised form.+-}+module Sound.Sc3.Common.Buffer.Gen where++import Data.List {- base -}++import qualified Sound.Sc3.Common.Buffer as Buffer {- hsc3 -}+import qualified Sound.Sc3.Common.Math as Math {- hsc3 -}++-- | Sum (mix) multiple tables into one.+sum_l :: Num n => [[n]] -> [n]+sum_l = map sum . transpose++-- | Unit normalisation.+nrm_u :: (Fractional n, Ord n) => [n] -> [n]+nrm_u = Buffer.normalize (-1) 1++-- * sine1++{- | 'sine3_p' with zero phase.++> import Sound.Sc3.Plot+> plot_p1_ln [sine1_p 512 (1, 1)]+-}+sine1_p :: (Enum n, Floating n) => Int -> (n, n) -> [n]+sine1_p n (pfreq, ampl) = sine3_p n (pfreq, ampl, 0)++-- | Series of sine wave harmonics using specified amplitudes.+sine1_l :: (Enum n, Floating n) => Int -> [n] -> [[n]]+sine1_l n = zipWith (curry (sine1_p n)) [1 ..]++{- | 'sum_l' of 'sine1_l'.++> plot_p1_ln [sine1 256 [1, 0.95 .. 0.5]]+-}+sine1 :: (Enum n, Floating n) => Int -> [n] -> [n]+sine1 n = sum_l . sine1_l n++{- | 'nrm_u' of 'sine1_l'.++> Sound.Sc3.Plot.plot_p1_ln [sine1_nrm 256 [1, 0.95 .. 0.5]]+> Sound.Sc3.Plot.plot_p1_ln [sine1_nrm 256 [1, 1/2, 1/3, 1/4, 1/5]]+-}+sine1_nrm :: (Enum n, Floating n, Ord n) => Int -> [n] -> [n]+sine1_nrm n = nrm_u . sine1 n++-- | Variant that generates a wavetable (without guard point) suitable for the Shaper Ugen.+sine1Tbl :: (Enum n, Floating n, Ord n) => Int -> [n] -> [n]+sine1Tbl n = Buffer.to_wavetable . sine1_nrm n++-- * sine2++-- | Series of /n/ sine wave partials using specified frequencies and amplitudes.+sine2_l :: (Enum n, Floating n) => Int -> [(n, n)] -> [[n]]+sine2_l n = map (sine1_p n)++{- | 'sum_l' of 'sine2_l'.++> Sound.Sc3.Plot.plot_p1_ln [sine2 256 (zip [1, 2..] [1, 0.95 .. 0.5])]+> Sound.Sc3.Plot.plot_p1_ln [sine2 256 (zip [1, 1.5 ..] [1, 0.95 .. 0.5])]+-}+sine2 :: (Enum n, Floating n) => Int -> [(n, n)] -> [n]+sine2 n = sum_l . sine2_l n++-- | 'nrm_u' of 'sine2_l'.+sine2_nrm :: (Enum n, Floating n, Ord n) => Int -> [n] -> [n]+sine2_nrm n = nrm_u . sine1 n++-- * sine3++{- | Sine wave table at specified frequency, amplitude and phase.+The table does not arrive back at the starting point.++>>> map (round . (* 100)) (sine3_p 8 (1, 1, 0))+[0,71,100,71,0,-71,-100,-71]+-}+sine3_p :: (Enum n, Floating n) => Int -> (n, n, n) -> [n]+sine3_p n (pfreq, ampl, phase) =+ let incr = (Math.two_pi / (fromIntegral n - 0)) * pfreq+ in map ((*) ampl . sin) (take n [phase, phase + incr ..])++-- | 'map' of 'sine3_p'.+sine3_l :: (Enum n, Floating n) => Int -> [(n, n, n)] -> [[n]]+sine3_l n = map (sine3_p n)++{- | 'sum_l' of 'sine3_l'.++> plot_p1_ln [sine3 256 (zip3 [1,1.5 ..] [1,0.95 .. 0.5] [0,pi/7..])]+-}+sine3 :: (Enum n, Floating n) => Int -> [(n, n, n)] -> [n]+sine3 n = sum_l . sine3_l n++-- * cheby++{- | Generate Chebyshev waveshaping table, see b_gen_cheby.+Cf. <https://www.csounds.com/manual/html/GEN13.html>++> import Sound.Sc3.Plot+> let p x = plot_p1_ln [gen_cheby 512 x]++> p [1, 0, 1, 1, 0, 1]+> p [100, -50, -33, 25, 20, -16.7, -14.2, 12.5, 11.1, -10, -9.09, 8.333, 7.69, -7.14, -6.67, 6.25, 5.88, -5.55, -5.26, 5]+> p [100, 0, -33, 0, 20, 0, -14.2, 0, 11.1, 0, -9.09, 0, 7.69, 0, -6.67, 0, 5.88, 0, -5.26]+> p [100, 0, -11.11, 0, 4, 0, -2.04, 0, 1.23, 0, -0.826, 0, 0.59, 0, -0.444, 0, 0.346, 0, -0.277]+> p [1, -0.8, 0, 0.6, 0, 0, 0, 0.4, 0, 0, 0, 0, 0.1, -0.2, -0.3, 0.5]+> p [0, 0, -0.1, 0, 0.3, 0, -0.5, 0, 0.7, 0, -0.9, 0, 1, 0, -1, 0]+> p [0, 0, 0, 0, 0, 0, -1, 0, 1, 0, 0, -0.1, 0, 0.1, 0, -0.2, 0.3, 0, -0.7, 0, 0.2, 0, -0.1]+> p [5, 0, 3, 0, 1]+-}+gen_cheby :: (Enum n, Floating n, Ord n, Integral i) => i -> [n] -> [n]+gen_cheby n =+ let acos' x = if x > 1 then 0 else if x < -1 then pi else acos x+ c k x = cos (k * acos' x)+ ix = [-1, -1 + (2 / (fromIntegral n - 1)) .. 1] -- increment?+ mix = map sum . transpose+ c_normalize x = let m = maximum (map abs x) in map (* recip m) x+ in c_normalize . mix . zipWith (\k a -> map ((* a) . c k) ix) [1 ..]++-- | Type specialised 'gen_cheby'.+cheby :: (Enum n, Floating n, Ord n) => Int -> [n] -> [n]+cheby = gen_cheby++-- | Variant that generates a wavetable (without guard point) suitable for the Shaper Ugen.+chebyShaperTbl :: (Enum n, Floating n, Ord n) => Int -> [n] -> [n]+chebyShaperTbl n = Buffer.to_wavetable_nowrap . cheby n
+ Sound/Sc3/Common/Buffer/Vector.hs view
@@ -0,0 +1,44 @@+{- | Vector variants of "Sound.Sc3.Common.Buffer".+These functions have the same names as the plain forms and are not re-exported by "Sound.Sc3.Common".+-}+module Sound.Sc3.Common.Buffer.Vector where++import qualified Data.Vector.Storable as V {- vector -}++import qualified Sound.Sc3.Common.Buffer as C {- hsc3 -}++-- | 'C.clipAt'.+clipAt :: V.Storable t => Int -> V.Vector t -> t+clipAt ix c =+ let r = V.length c+ f = (V.!) c+ in if ix > r - 1 then f (r - 1) else f ix++{- | 'C.blendAtBy' of 'clipAt'.++> Sound.Sc3.Common.Buffer.Vector.blendAt 0 (V.fromList [2,5,6]) == 2+> Sound.Sc3.Common.Buffer.Vector.blendAt 0.4 (V.fromList [2,5,6]) == 3.2+> Sound.Sc3.Common.Buffer.Vector.blendAt 2.1 (V.fromList [2,5,6]) == 6+-}+blendAt :: (V.Storable t, RealFrac t) => t -> V.Vector t -> t+blendAt = C.blendAtBy clipAt++{- | 'C.from_wavetable'++> Sound.Sc3.Common.Buffer.Vector.from_wavetable (V.fromList [-0.5,0.5,0,0.5,1.5,-0.5,1,-0.5])+-}+from_wavetable :: (V.Storable t, Num t) => V.Vector t -> V.Vector t+from_wavetable wt =+ let n = V.length wt+ f k = let k2 = k * 2 in (wt V.! k2) + (wt V.! (k2 + 1))+ in V.generate (n `div` 2) f++{- | 'C.resamp1'.++> Sound.Sc3.Common.Buffer.Vector.resamp1 12 (V.fromList [1,2,3,4])+> Sound.Sc3.Common.Buffer.Vector.resamp1 3 (V.fromList [1,2,3,4]) == V.fromList [1,2.5,4]+-}+resamp1 :: (V.Storable t, RealFrac t) => Int -> V.Vector t -> V.Vector t+resamp1 n c =+ let gen = C.resamp1_gen n (V.length c) clipAt c+ in V.generate n gen
+ Sound/Sc3/Common/Context.hs view
@@ -0,0 +1,62 @@+-- | Interpreter (module) contexts for hsc3.+module Sound.Sc3.Common.Context where++import Text.Printf {- base -}++-- | (moduleName, qualifierName, packageName)+type Context = [(String, Maybe String, String)]++-- | Format a Context as a sequence of import commands.+context_format :: Context -> [String]+context_format =+ let f (moduleName, qualifier, packageName) =+ case qualifier of+ Nothing -> printf "import %s {- %s -}" moduleName packageName+ Just qualifierName -> printf "import qualified %s as %s {- %s -}" moduleName qualifierName packageName+ in map f++-- | writeFile of context_format+context_write :: FilePath -> Context -> IO ()+context_write fn = writeFile fn . unlines . context_format++-- | Minimal hsc3 context+min_context :: Context+min_context =+ [ ("Prelude", Nothing, "base")+ , ("Control.Monad", Nothing, "base")+ , ("Data.Bits", Nothing, "base")+ , ("Data.Function", Nothing, "base")+ , ("Data.List", Nothing, "base")+ , ("Sound.Sc3", Nothing, "hsc3")+ ]++-- | Standard hsc3 context+std_context :: Context+std_context =+ [ ("Prelude", Nothing, "base")+ , ("Control.Monad", Nothing, "base")+ , ("Data.Bits", Nothing, "base")+ , ("Data.Function", Nothing, "base")+ , ("Data.List", Nothing, "base")+ , ("System.Random", Nothing, "random")+ , ("Sound.Osc", Nothing, "hosc")+ , ("Sound.Sc3", Nothing, "hsc3")+ , ("Sound.Sc3.Common.Base", Just "Sound.Sc3.Common.Base", "hsc3")+ , ("Sound.Sc3.Common.Buffer.Gen", Just "Gen", "hsc3")+ , ("Sound.Sc3.Common.Math.Filter.Beq", Just "Sound.Sc3.Common.Math.Filter.Beq", "hsc3")+ , ("Sound.Sc3.Ugen.Bindings.Db.External", Just "X", "hsc3")+ , ("Sound.Sc3.Ugen.Bindings.Composite.External", Just "X", "hsc3")+ , ("Sound.Sc3.Ugen.Bindings.Hw.External.F0", Just "X", "hsc3")+ , ("Sound.Sc3.Ugen.Bindings.Hw.External.SC3_Plugins", Just "X", "hsc3")+ , ("Sound.Sc3.Ugen.Bindings.Hw.External.Zita", Just "X", "hsc3")+ , ("Sound.Sc3.Ugen.Bindings.Db.Rdu", Just "X", "sc3-rdu")+ , ("Sound.Sc3.Ugen.Dot", Just "Sound.Sc3.Ugen.Dot", "hsc3-dot")+ , ("Sound.Sc3.Ugen.Unsafe", Nothing, "hsc3-unsafe")+ , ("Sound.Sc3.Ugen.Unsafe", Nothing, "hsc3-unsafe")+ , ("Sound.Sc3.Ugen.Protect", Just "Protect", "hsc3-rw")+ , ("Sound.Sc3.Ui.Html", Just "Ui", "hsc3-ui")+ , ("Sound.Sc3.Ui.Plot", Just "Ui", "hsc3-ui")+ , ("Sound.Sc3.Ui.Qarma", Just "Ui", "hsc3-ui")+ , ("Sound.Sc3.Ui.ScLang", Just "Ui", "hsc3-ui")+ , ("Sound.Sc3.Ui.ScLang.Control", Just "Ui", "hsc3-ui")+ ]
+ Sound/Sc3/Common/Enum.hs view
@@ -0,0 +1,128 @@+-- | Data types for enumerated and non signal unit generator inputs.+module Sound.Sc3.Common.Enum where++-- * Loop++-- | Loop indicator input.+data Loop t+ = -- | 0+ NoLoop+ | -- | 1+ Loop+ | WithLoop t+ deriving (Eq, Show)++-- | Apply /f/ at 'WithLoop'.+loop_map :: (t -> u) -> Loop t -> Loop u+loop_map f lp =+ case lp of+ NoLoop -> NoLoop+ Loop -> Loop+ WithLoop t -> WithLoop (f t)++-- | fmap is 'loop_map'+instance Functor Loop where+ fmap = loop_map++-- | Resolve 'Loop'.+from_loop :: Num t => Loop t -> t+from_loop e =+ case e of+ NoLoop -> 0+ Loop -> 1+ WithLoop u -> u++-- * Interpolation++-- | Interpolation indicator input.+data Interpolation t+ = NoInterpolation+ | LinearInterpolation+ | CubicInterpolation+ | WithInterpolation t+ deriving (Eq, Show)++-- | Resolve 'Interpolation'.+from_interpolation :: Num t => Interpolation t -> t+from_interpolation e =+ case e of+ NoInterpolation -> 1+ LinearInterpolation -> 2+ CubicInterpolation -> 4+ WithInterpolation u -> u++-- * DoneAction++-- | Completion mode indicator input.+data DoneAction t+ = DoNothing+ | PauseSynth+ | RemoveSynth+ | RemoveGroup+ | WithDoneAction t+ deriving (Eq, Show)++-- | Apply /f/ at 'WithDoneAction'.+done_action_map :: (t -> u) -> DoneAction t -> DoneAction u+done_action_map f e =+ case e of+ DoNothing -> DoNothing+ PauseSynth -> PauseSynth+ RemoveSynth -> RemoveSynth+ RemoveGroup -> RemoveGroup+ WithDoneAction x -> WithDoneAction (f x)++-- | fmap is 'done_action_map'+instance Functor DoneAction where+ fmap = done_action_map++-- | Resolve 'DoneAction'.+from_done_action :: Num t => DoneAction t -> t+from_done_action e =+ case e of+ DoNothing -> 0+ PauseSynth -> 1+ RemoveSynth -> 2+ RemoveGroup -> 14+ WithDoneAction x -> x++-- * Warp++-- | Warp interpolation indicator input.+data Warp t+ = Linear+ | Exponential+ | WithWarp t+ deriving (Eq, Show)++{- | Resolve 'Warp'.++>>> map from_warp [Linear,Exponential]+[0,1]+-}+from_warp :: Num t => Warp t -> t+from_warp e =+ case e of+ Linear -> 0+ Exponential -> 1+ WithWarp u -> u++-- | Apply /f/ at 'WithWarp'+warp_map :: (t -> u) -> Warp t -> Warp u+warp_map f e =+ case e of+ Linear -> Linear+ Exponential -> Exponential+ WithWarp u -> WithWarp (f u)++-- | fmap = 'warp_map'+instance Functor Warp where+ fmap = warp_map++-- * Buffer++-- | Unification of integer and 'Ugen' buffer identifiers.+data Buffer t+ = Buffer_Id Int+ | Buffer t+ deriving (Eq, Show)
+ Sound/Sc3/Common/Envelope.hs view
@@ -0,0 +1,552 @@+-- | Envelope generators.+module Sound.Sc3.Common.Envelope where++import Data.List {- base -}+import Data.Maybe {- base -}++import qualified Safe {- safe -}++import qualified Sound.Sc3.Common.Base as Base {- hsc3 -}+import qualified Sound.Sc3.Common.Math.Interpolate as Interpolate {- hsc3 -}++-- * Curve++-- | Envelope curve indicator input.+data Envelope_Curve a+ = EnvStep+ | EnvLin+ | EnvExp+ | EnvSin+ | -- | Note: not implemented at Sc3+ EnvWelch+ | EnvNum a+ | EnvSqr+ | EnvCub+ | EnvHold+ deriving (Eq, Show)++-- | Envelope curve pair.+type Envelope_Curve_2 a = Base.T2 (Envelope_Curve a)++-- | Envelope curve triple.+type Envelope_Curve_3 a = Base.T3 (Envelope_Curve a)++-- | Envelope curve quadruple.+type Envelope_Curve_4 a = Base.T4 (Envelope_Curve a)++{- | Convert 'Envelope_Curve' to shape value.++>>> map env_curve_shape [EnvSin,EnvSqr]+[3,6]+-}+env_curve_shape :: Num a => Envelope_Curve a -> a+env_curve_shape e =+ case e of+ EnvStep -> 0+ EnvLin -> 1+ EnvExp -> 2+ EnvSin -> 3+ EnvWelch -> 4+ EnvNum _ -> 5+ EnvSqr -> 6+ EnvCub -> 7+ EnvHold -> 8++{- | The /value/ of 'EnvCurve' is non-zero for 'EnvNum'.++>>> map env_curve_value [EnvWelch,EnvNum 2]+[0,2]+-}+env_curve_value :: Num a => Envelope_Curve a -> a+env_curve_value e =+ case e of+ EnvNum u -> u+ _ -> 0++-- | 'Interpolation_f' of 'Envelope_Curve'.+env_curve_interpolation_f :: (Ord t, Floating t) => Envelope_Curve t -> Interpolate.Interpolation_f t+env_curve_interpolation_f c =+ case c of+ EnvStep -> Interpolate.step+ EnvLin -> Interpolate.linear+ EnvExp -> Interpolate.exponential+ EnvSin -> Interpolate.sine+ EnvWelch -> Interpolate.welch+ EnvNum n -> Interpolate.curve n+ EnvSqr -> Interpolate.squared+ EnvCub -> Interpolate.cubed+ EnvHold -> undefined++-- | Apply /f/ to 'EnvNum' value.+env_curve_map :: (a -> b) -> Envelope_Curve a -> Envelope_Curve b+env_curve_map f e =+ case e of+ EnvStep -> EnvStep+ EnvLin -> EnvLin+ EnvExp -> EnvExp+ EnvSin -> EnvSin+ EnvWelch -> EnvWelch+ EnvNum x -> EnvNum (f x)+ EnvSqr -> EnvSqr+ EnvCub -> EnvCub+ EnvHold -> EnvHold++-- * Envelope++-- | Sc3 envelope segment model+data Envelope a = Envelope+ { env_levels :: [a]+ -- ^ Set of /n/ levels, n is >= 1+ , env_times :: [a]+ -- ^ Set of /n-1/ time intervals+ , env_curves :: [Envelope_Curve a]+ -- ^ Possibly empty curve set+ , env_release_node :: Maybe Int+ -- ^ Maybe index to release node+ , env_loop_node :: Maybe Int+ -- ^ Maybe index to loop node+ , env_offset :: a+ -- ^ An offset for all time values (IEnvGen only)+ }+ deriving (Eq, Show)++-- | Apply /f/ to all /a/ at 'Envelope'.+envelope_map :: (a -> b) -> Envelope a -> Envelope b+envelope_map f e =+ let Envelope l t c rn ln os = e+ in Envelope (map f l) (map f t) (map (env_curve_map f) c) rn ln (f os)++-- | fmap = 'envelope_map'+instance Functor Envelope where+ fmap = envelope_map++{- | Variant without release and loop node inputs (defaulting to nil).++> Sound.Sc3.Plot.plotEnvelope [envelope [0,1,0] [3,2] [EnvSin,EnvSin]]+-}+envelope :: Num a => [a] -> [a] -> [Envelope_Curve a] -> Envelope a+envelope l t c = Envelope l t c Nothing Nothing 0++-- | Duration of 'Envelope', ie. 'sum' '.' 'env_times'.+envelope_duration :: Num n => Envelope n -> n+envelope_duration = sum . env_times++-- | Number of segments at 'Envelope', ie. 'length' '.' 'env_times'.+envelope_n_segments :: Integral i => Envelope n -> i+envelope_n_segments = genericLength . env_times++-- | Determine which envelope segment a given time /t/ falls in.+envelope_segment_ix :: (Ord a, Num a) => Envelope a -> a -> Maybe Int+envelope_segment_ix e t =+ let d = Base.dx_d (env_times e)+ in findIndex (>= t) d++-- | A set of start time, start level, end time, end level and curve.+type Envelope_Segment t = (t, t, t, t, Envelope_Curve t)++-- | Extract envelope segment given at index /i/.+envelope_segment :: Num t => Envelope t -> Int -> Envelope_Segment t+envelope_segment e i =+ let l = env_levels e+ t = env_times e+ x0 = l !! i+ x1 = l !! (i + 1)+ t0 = (0 : Base.dx_d t) !! i+ t1 = t0 + t !! i+ c = envelope_curves e !! i+ in (t0, x0, t1, x1, c)++-- | Extract all segments.+envelope_segments :: Num t => Envelope t -> [Envelope_Segment t]+envelope_segments e =+ let n = envelope_n_segments e+ in map (envelope_segment e) [0 .. n - 1]++-- | Transform list of 'Envelope_Segment's into lists ('env_levels','env_times','env_curves').+pack_envelope_segments :: Num t => [Envelope_Segment t] -> ([t], [t], [Envelope_Curve t])+pack_envelope_segments s =+ case s of+ [] -> error ""+ [(t0, l0, t1, l1, c)] -> ([l0, l1], [t1 - t0], [c])+ (_, l0, _, _, _) : _ ->+ let t (t0, _, t1, _, _) = t1 - t0+ c (_, _, _, _, x) = x+ l (_, _, _, x, _) = x+ in (l0 : map l s, map t s, map c s)++-- | An envelope is /normal/ if it has no segments with zero duration.+envelope_is_normal :: (Eq n, Num n) => Envelope n -> Bool+envelope_is_normal = notElem 0 . env_times++-- | Normalise envelope by deleting segments of zero duration.+envelope_normalise :: (Num a, Ord a) => Envelope a -> Envelope a+envelope_normalise e =+ let s = envelope_segments e+ f (t0, _, t1, _, _) = t1 <= t0+ s' = filter (not . f) s+ (l, t, c) = pack_envelope_segments s'+ in case e of+ Envelope _ _ _ Nothing Nothing os -> Envelope l t c Nothing Nothing os+ _ -> error "envelope_normalise: has release or loop node..."++{- | Get value for 'Envelope' at time /t/, or zero if /t/ is out of+range. By convention if the envelope has a segment of zero+duration we give the rightmost value.+-}+envelope_at :: (Ord t, Floating t) => Envelope t -> t -> t+envelope_at e t =+ case envelope_segment_ix e t of+ Just n ->+ let (t0, x0, t1, x1, c) = envelope_segment e n+ d = t1 - t0+ t' = (t - t0) / d+ f = env_curve_interpolation_f c+ in if d <= 0+ then x1+ else f x0 x1 t'+ Nothing -> 0++-- | Render 'Envelope' to breakpoint set of /n/ equi-distant places.+envelope_render :: (Ord t, Floating t, Enum t) => Int -> Envelope t -> [(t, t)]+envelope_render n e =+ let d = envelope_duration e+ k = d / (fromIntegral n - 1)+ t = [0, k .. d]+ in zip t (map (envelope_at e) t)++-- | Contruct a lookup table of /n/ places from 'Envelope'.+envelope_table :: (Ord t, Floating t, Enum t) => Int -> Envelope t -> [t]+envelope_table n = map snd . envelope_render n++{- | Variant on 'env_curves' that expands the, possibly empty, user+list by cycling (if not empty) or by filling with 'EnvLin'.+-}+envelope_curves :: Envelope a -> [Envelope_Curve a]+envelope_curves e =+ let c = env_curves e+ n = envelope_n_segments e+ in if null c+ then replicate n EnvLin+ else take n (cycle c)++{- | Linear Sc3 form of 'Envelope' data.++Form is: l0 #t reset loop l1 t0 c0 c0' ...++>>> envelope_sc3_array (envelope [0,1] [0.1] [EnvLin])+Just [0.0,1.0,-99.0,-99.0,1.0,0.1,1.0,0.0]++>>> let l = [0,0.6,0.3,1.0,0]+>>> let t = [0.1,0.02,0.4,1.1]+>>> let c = [EnvLin,EnvExp,EnvNum (-6),EnvSin]+>>> envelope_sc3_array (Envelope l t c Nothing Nothing 0)+Just [0.0,4.0,-99.0,-99.0,0.6,0.1,1.0,0.0,0.3,2.0e-2,2.0,0.0,1.0,0.4,5.0,-6.0,0.0,1.1,3.0,0.0]+-}+envelope_sc3_array :: Num a => Envelope a -> Maybe [a]+envelope_sc3_array e =+ let Envelope l t _ rn ln _ = e+ n = length t+ n' = fromIntegral n+ rn' = fromIntegral (fromMaybe (-99) rn)+ ln' = fromIntegral (fromMaybe (-99) ln)+ c = envelope_curves e+ f i j k = [i, j, env_curve_shape k, env_curve_value k]+ in case l of+ l0 : l' -> Just (l0 : n' : rn' : ln' : concat (zipWith3 f l' t c))+ _ -> Nothing++{- | @IEnvGen@ Sc3 form of 'Envelope' data.++>>> let l = [0,0.6,0.3,1.0,0]+>>> let t = [0.1,0.02,0.4,1.1]+>>> let c = [EnvLin,EnvExp,EnvNum (-6),EnvSin]+>>> let e = Envelope l t c Nothing Nothing 0+>>> envelope_sc3_ienvgen_array e+Just [0.0,0.0,4.0,1.62,0.1,1.0,0.0,0.6,2.0e-2,2.0,0.0,0.3,0.4,5.0,-6.0,1.0,1.1,3.0,0.0,0.0]+-}+envelope_sc3_ienvgen_array :: Num a => Envelope a -> Maybe [a]+envelope_sc3_ienvgen_array e =+ let Envelope l t _ _ _ os = e+ n = length t+ n' = fromIntegral n+ c = envelope_curves e+ f i j k = [j, env_curve_shape k, env_curve_value k, i]+ in case l of+ l0 : l' -> Just (os : l0 : n' : sum t : concat (zipWith3 f l' t c))+ _ -> Nothing++-- | 'True' if 'env_release_node' is not 'Nothing'.+env_is_sustained :: Envelope a -> Bool+env_is_sustained = isJust . env_release_node++-- | Delay the onset of the envelope (add initial segment).+env_delay :: Envelope a -> a -> Envelope a+env_delay (Envelope l t c rn ln os) d =+ let l0 = Safe.headNote "env_delay" l+ l' = l0 : l+ t' = d : t+ c' = EnvLin : c+ rn' = fmap (+ 1) rn+ ln' = fmap (+ 1) ln+ in Envelope l' t' c' rn' ln' os++{- | Connect releaseNode (or end) to first node of envelope.+z is a value that is first zero and thereafter one.+tc & cc are time and curve from first to last.+-}+env_circle_z :: Fractional a => a -> a -> Envelope_Curve a -> Envelope a -> Envelope a+env_circle_z z tc cc (Envelope l t c rn _ os) =+ let n = length t+ in case rn of+ Nothing ->+ let l' = 0 : l ++ [0]+ t' = z * tc : t ++ [1] -- inf (but drawings are poor)+ c' = cc : take n (cycle c) ++ [EnvLin]+ rn' = Just (n + 1)+ in Envelope l' t' c' rn' (Just 0) os+ Just i ->+ let l' = 0 : l+ t' = z * tc : t+ c' = cc : take n (cycle c)+ rn' = Just (i + 1)+ in Envelope l' t' c' rn' (Just 0) os++-- | env_circle_z with cycle time of zero.+env_circle_0 :: Fractional a => Envelope a -> Envelope a+env_circle_0 = env_circle_z 1 0 EnvLin++-- * Construct++{- | Trapezoidal envelope generator.++Requires (<=) and (>=) functions returning @1@ for true and @0@ for false.++The arguments are: 1. @shape@ determines the sustain time as a+proportion of @dur@, zero is a triangular envelope, one a rectangular+envelope; 2. @skew@ determines the attack\/decay ratio, zero is an+immediate attack and a slow decay, one a slow attack and an immediate+decay; 3. @duration@ in seconds; 4. @amplitude@ as linear gain.+-}+envTrapezoid_f :: Num t => (t -> t -> t, t -> t -> t) -> t -> t -> t -> t -> Envelope t+envTrapezoid_f (lte_f, gte_f) shape skew dur amp =+ let x1 = skew * (1 - shape)+ bp =+ [ (0, lte_f skew 0)+ , (x1, 1)+ , (shape + x1, 1)+ , (1, gte_f skew 1)+ ]+ in envCoord bp dur amp EnvLin++{- | Coordinate based static envelope generator. Points are (time,value) pairs.++>>> let e = envCoord [(0,0),(1/4,1),(1,0)] 1 1 EnvLin+>>> envelope_sc3_array e+Just [0.0,2.0,-99.0,-99.0,1.0,0.25,1.0,0.0,0.0,0.75,1.0,0.0]++> import Sound.Sc3.Plot {\- hsc3-plot -\}+> plotEnvelope [envCoord [(0,0),(1/4,1),(1,0)] 1 1 EnvLin]+-}+envCoord :: Num n => [(n, n)] -> n -> n -> Envelope_Curve n -> Envelope n+envCoord xy dur amp c = envXyc (map (\(x, y) -> (x * dur, y * amp, c)) xy)++{- | Segments given as pairs of (time,level).+The input is sorted by time before processing.++>>> env_levels (envPairs [(0, 1), (3, 1.4), (2.1, 0.5)] EnvSin)+[1.0,0.5,1.4]+-}+envPairs :: (Num n, Ord n) => [(n, n)] -> Envelope_Curve n -> Envelope n+envPairs xy = envCoord (Base.sort_on fst xy) 1 1++-- | Percussive envelope, with attack, release, level and curve inputs.+envPerc_c :: Num a => a -> a -> a -> Envelope_Curve_2 a -> Envelope a+envPerc_c atk rls lvl (c0, c1) =+ let c = [c0, c1]+ in Envelope [0, lvl, 0] [atk, rls] c Nothing Nothing 0++-- | Percussive envelope, with attack and release inputs.+envPerc :: Num a => a -> a -> Envelope a+envPerc atk rls =+ let cn = EnvNum (-4)+ in envPerc_c atk rls 1 (cn, cn)++{- | Triangular envelope, with duration and level inputs.++>>> let e = envTriangle 1 0.1+>>> envelope_sc3_array e+Just [0.0,2.0,-99.0,-99.0,0.1,0.5,1.0,0.0,0.0,0.5,1.0,0.0]+-}+envTriangle :: Fractional a => a -> a -> Envelope a+envTriangle dur lvl =+ let c = replicate 2 EnvLin+ d = replicate 2 (dur / 2)+ in Envelope [0, lvl, 0] d c Nothing Nothing 0++{- | Sine envelope, with duration and level inputs.++>>> envelope_sc3_array (envSine 0 0.1)+Just [0.0,2.0,-99.0,-99.0,0.1,0.0,3.0,0.0,0.0,0.0,3.0,0.0]+-}+envSine :: Fractional a => a -> a -> Envelope a+envSine dur lvl =+ let c = replicate 2 EnvSin+ d = replicate 2 (dur / 2)+ in Envelope [0, lvl, 0] d c Nothing Nothing 0++-- | Parameters for Linen envelopes.+data Linen a = Linen+ { linen_attackTime :: a+ , linen_sustainTime :: a+ , linen_releaseTime :: a+ , linen_level :: a+ , linen_curve :: Envelope_Curve_3 a+ }++-- | Sc3 defaults for Linen.+linen_def :: Fractional t => Linen t+linen_def = let c = EnvLin in Linen 0.01 1 1 1 (c, c, c)++-- | Record ('Linen') variant of 'envLinen'.+envLinen_r :: Num a => Linen a -> Envelope a+envLinen_r (Linen aT sT rT lv (c0, c1, c2)) =+ let l = [0, lv, lv, 0]+ t = [aT, sT, rT]+ c = [c0, c1, c2]+ in Envelope l t c Nothing Nothing 0++-- | Variant of 'envLinen' with user specified 'Envelope_Curve a'.+envLinen_c :: Num a => a -> a -> a -> a -> Envelope_Curve_3 a -> Envelope a+envLinen_c aT sT rT lv c = envLinen_r (Linen aT sT rT lv c)++{- | Linear envelope parameter constructor.++>>> let e = envLinen 0 1 0 1+>>> let s = envelope_segments e+>>> let p = pack_envelope_segments s+>>> p == (env_levels e,env_times e,env_curves e)+True+-}+envLinen :: Num a => a -> a -> a -> a -> Envelope a+envLinen aT sT rT lv =+ let c = (EnvLin, EnvLin, EnvLin)+ in envLinen_c aT sT rT lv c++{- | Parameters for Adsr envelopes.+ The sustain level is given as a proportion of the peak level.+-}+data Adsr a = Adsr+ { adsr_attackTime :: a+ , adsr_decayTime :: a+ , adsr_sustainLevel :: a+ , adsr_releaseTime :: a+ , adsr_peakLevel :: a+ , adsr_curve :: Envelope_Curve_3 a+ , adsr_bias :: a+ }++-- | Sc3 defaults for Adsr.+adsr_def :: Fractional n => Adsr n+adsr_def = let c = EnvNum (-4) in Adsr 0.01 0.3 0.5 1 1 (c, c, c) 0++-- | Attack, decay, sustain, release envelope parameter constructor.+envAdsr :: Num a => a -> a -> a -> a -> a -> Envelope_Curve a -> a -> Envelope a+envAdsr aT dT sL rT pL c b = envAdsr_r (Adsr aT dT sL rT pL (c, c, c) b)++-- | Variant with defaults for pL, c and b.+envAdsr_def :: Num a => a -> a -> a -> a -> Envelope a+envAdsr_def aT dT sL rT = envAdsr aT dT sL rT 1 (EnvNum (-4)) 0++-- | Record ('Adsr') variant of 'envAdsr'.+envAdsr_r :: Num a => Adsr a -> Envelope a+envAdsr_r (Adsr aT dT sL rT pL (c0, c1, c2) b) =+ let l = map (+ b) [0, pL, pL * sL, 0]+ t = [aT, dT, rT]+ c = [c0, c1, c2]+ in Envelope l t c (Just 2) Nothing 0++-- | Parameters for Roland type Adssr envelopes.+data Adssr a = Adssr+ { adssr_attackTime :: a+ , adssr_attackLevel :: a+ , adssr_decayTime :: a+ , adssr_decayLevel :: a+ , adssr_slopeTime :: a+ , adssr_sustainLevel :: a+ , adssr_releaseTime :: a+ , adssr_curve :: Envelope_Curve_4 a+ , adssr_bias :: a+ }++-- | Attack, decay, slope, sustain, release envelope parameter constructor.+envAdssr :: Num a => a -> a -> a -> a -> a -> a -> a -> Envelope_Curve a -> a -> Envelope a+envAdssr t1 l1 t2 l2 t3 l3 t4 c b = envAdssr_r (Adssr t1 l1 t2 l2 t3 l3 t4 (c, c, c, c) b)++-- | Record ('Adssr') variant of 'envAdssr'.+envAdssr_r :: Num a => Adssr a -> Envelope a+envAdssr_r (Adssr t1 l1 t2 l2 t3 l3 t4 (c1, c2, c3, c4) b) =+ let l = map (+ b) [0, l1, l2, l3, 0]+ t = [t1, t2, t3, t4]+ c = [c1, c2, c3, c4]+ in Envelope l t c (Just 3) Nothing 0++-- | Parameters for Asr envelopes.+data Asr a = Asr+ { asr_attackTime :: a+ , asr_sustainLevel :: a+ , asr_releaseTime :: a+ , asr_curve :: Envelope_Curve_2 a+ }++-- | Sc3 default values for Asr.+asr_def :: Fractional t => Asr t+asr_def = let c = EnvNum (-4) in Asr 0.01 1 1 (c, c)++-- | Sc3 .asr has singular curve argument, hence _c suffix.+envAsr_c :: Num a => a -> a -> a -> Envelope_Curve_2 a -> Envelope a+envAsr_c aT sL rT c = envAsr_r (Asr aT sL rT c)++{- | Attack, sustain, release envelope parameter constructor.++>>> envelope_sc3_array (envAsr 3 0.1 2 EnvSin)+Just [0.0,2.0,1.0,-99.0,0.1,3.0,3.0,0.0,0.0,2.0,3.0,0.0]+-}+envAsr :: Num a => a -> a -> a -> Envelope_Curve a -> Envelope a+envAsr aT sL rT c = envAsr_c aT sL rT (c, c)++-- | Record ('Asr') variant of 'envAsr'.+envAsr_r :: Num a => Asr a -> Envelope a+envAsr_r (Asr aT sL rT (c0, c1)) =+ let l = [0, sL, 0]+ t = [aT, rT]+ c' = [c0, c1]+ in Envelope l t c' (Just 1) Nothing 0++-- | All segments are horizontal lines.+envStep :: Num a => [a] -> [a] -> Maybe Int -> Maybe Int -> Envelope a+envStep levels times releaseNode loopNode =+ if length levels /= length times+ then error "envStep: levels and times must have same size"+ else+ let levels' = Safe.headNote "envStep" levels : levels+ in Envelope levels' times [EnvStep] releaseNode loopNode 0++{- | Segments given as triples of (time,level,curve). The final curve is ignored.++>>> env_levels (envXyc [(0, 1, EnvSin), (2.1, 0.5, EnvLin), (3, 1.4, EnvLin)])+[1.0,0.5,1.4]+-}+envXyc :: Num n => [(n, n, Envelope_Curve n)] -> Envelope n+envXyc xyc =+ let n = length xyc+ (times, levels, curves) = unzip3 xyc+ offset = times !! 0+ in Envelope levels (Base.d_dx' times) (take (n - 1) curves) Nothing Nothing offset++{- | Variant where the input is sorted by time before processing.++>>> env_levels (envXyc_sort [(0, 1, EnvSin), (3, 1.4, EnvLin), (2.1, 0.5, EnvLin)])+[1.0,0.5,1.4]+-}+envXyc_sort :: (Num n, Ord n) => [(n, n, Envelope_Curve n)] -> Envelope n+envXyc_sort = envXyc . Base.sort_on (\(x, _, _) -> x)
+ Sound/Sc3/Common/Help.hs view
@@ -0,0 +1,296 @@+-- | Functions to access to the Sc3 Rtf & Html based help systems.+module Sound.Sc3.Common.Help where++import Control.Monad {- base -}+import Data.Char {- base -}+import Data.List {- base -}+import Data.Maybe {- base -}+import System.Environment {- base -}++import System.FilePath {- filepath -}+import System.Process {- process -}++import qualified Data.List.Split as Split {- split -}++import qualified Sound.Sc3.Common.Base.System as Base.System {- hsc3 -}++-- * Rtf++-- | Directory containing Sc3 Rtf help files.+sc3_rtf_help_dir :: IO FilePath+sc3_rtf_help_dir = getEnv "Sc3_Rtf_Help_Dir"++{- | Find (case-insensitively) indicated file at 'sc3_rtf_help_dir'.+Runs the command "find -name" (so Unix only).++> sc3_rtf_find_file "SinOsc.help.rtf"+> sc3_rtf_find_file "lfsaw.help.rtf"+> sc3_rtf_find_file "softClip.rtf"+-}+sc3_rtf_find_file :: FilePath -> IO (Maybe FilePath)+sc3_rtf_find_file fn = do+ d <- sc3_rtf_help_dir+ r <- System.Process.readProcess "find" [d, "-iname", fn] ""+ case lines r of+ [] -> return Nothing+ [r0] -> return (Just r0)+ _ -> error "sc3_rtf_find_file: multiple files?"++-- | 'error' variant.+sc3_rtf_find_file_err :: FilePath -> IO FilePath+sc3_rtf_find_file_err = fmap (fromMaybe (error "sc3_rtf_find_file")) . sc3_rtf_find_file++-- | Run the command unrtf (so UNIX only) to convert an RTF file to a TEXT (.scd) file.+sc3_rtf_to_scd :: FilePath -> FilePath -> IO ()+sc3_rtf_to_scd rtf_fn scd_fn = do+ txt <- System.Process.readProcess "unrtf" ["--text", rtf_fn] ""+ let delete_trailing_whitespace = reverse . dropWhile isSpace . reverse+ tidy = unlines . map delete_trailing_whitespace . drop 4 . lines+ writeFile scd_fn (tidy txt)++-- | 'sc3_rtf_to_scd' of 'sc3_rtf_find_file_err', writing output to TMPDIR+sc3_rtf_help_translate :: String -> IO FilePath+sc3_rtf_help_translate nm = do+ tmp <- Base.System.get_env_default "TMPDIR" "/tmp"+ rtf_fn <- sc3_rtf_find_file_err (nm <.> "*rtf")+ let scd_fn = tmp </> takeFileName rtf_fn -<.> "scd"+ sc3_rtf_to_scd rtf_fn scd_fn+ return scd_fn++-- | 'sc3_rtf_help_translate' and run editor.+sc3_rtf_help_scd_open :: (String, [String]) -> String -> IO ()+sc3_rtf_help_scd_open (cmd, arg) nm = do+ scd_fn <- sc3_rtf_help_translate nm+ System.Process.callProcess cmd (arg ++ [scd_fn])++{- | 'sc3_rtf_help_scd_open' with emacsclient --no-wait.++> sc3_rtf_help_scd_open_emacs "lfsaw"+-}+sc3_rtf_help_scd_open_emacs :: String -> IO ()+sc3_rtf_help_scd_open_emacs = sc3_rtf_help_scd_open ("emacsclient", ["--no-wait"])++-- * Sc-Doc (Html)++-- | Url for online Sc-Doc SuperCollider documentation.+sc3_scdoc_help_url :: String+sc3_scdoc_help_url = "http://doc.sccode.org/"++{- | Read the environment variable @Sc3_ScDoc_Html_Help_Dir@.+ The default value is @~\/.local\/share\/SuperCollider/Help@.+-}+sc3_scdoc_help_dir :: IO String+sc3_scdoc_help_dir = do+ h <- getEnv "HOME"+ let d = h </> ".local/share/SuperCollider/Help"+ Base.System.get_env_default "Sc3_ScDoc_Html_Help_Dir" d++{- | Path to indicated Sc3 class help file.++>>> sc3_scdoc_help_class "SinOsc"+"Classes/SinOsc.html"+-}+sc3_scdoc_help_class :: String -> String+sc3_scdoc_help_class c = "Classes" </> c <.> "html"++{- | Generate path to indicated Sc3 operator help file.++>>> sc3_scdoc_help_operator "+"+"Overviews/Operators.html#+"+-}+sc3_scdoc_help_operator :: String -> FilePath+sc3_scdoc_help_operator = (++) "Overviews/Operators.html#"++{- | Generate path to indicated Sc3 method help.++>>> sc3_scdoc_help_method '*' ("C","m")+"Classes/C.html#*m"+-}+sc3_scdoc_help_method :: Char -> (String, String) -> FilePath+sc3_scdoc_help_method z (c, m) = "Classes" </> c <.> "html#" ++ [z] ++ m++{- | Generate path to indicated Sc3 class method help.++>>> sc3_scdoc_help_class_method ("C","m")+"Classes/C.html#*m"+-}+sc3_scdoc_help_class_method :: (String, String) -> FilePath+sc3_scdoc_help_class_method = sc3_scdoc_help_method '*'++{- | Generate path to indicated Sc3 instance method help.++>>> sc3_scdoc_help_instance_method ("C","m")+"Classes/C.html#-m"+-}+sc3_scdoc_help_instance_method :: (String, String) -> FilePath+sc3_scdoc_help_instance_method = sc3_scdoc_help_method '-'++{- | Sc3 help path documenting x.++>>> sc3_scdoc_help_path "Operator.distort"+"Overviews/Operators.html#distort"++>>> sc3_scdoc_help_path "Collection.*fill"+"Classes/Collection.html#*fill"++>>> sc3_scdoc_help_path "Collection.inject"+"Classes/Collection.html#-inject"++>>> sc3_scdoc_help_path "SinOsc"+"Classes/SinOsc.html"+-}+sc3_scdoc_help_path :: String -> String+sc3_scdoc_help_path s = do+ case Split.splitOn "." s of+ ["Operator", m] -> sc3_scdoc_help_operator m+ [c, '*' : m] -> sc3_scdoc_help_class_method (c, m)+ [c, m] -> sc3_scdoc_help_instance_method (c, m)+ _ -> sc3_scdoc_help_class s++{- | Open Sc3 help path, either the local file or the online version.+ Use @BROWSER@ or @x-www-browser@.++> Base.System.get_env_default "BROWSER" "x-www-browser"++> sc3_scdoc_help_open True (sc3_scdoc_help_path "SinOsc")+> sc3_scdoc_help_open True (sc3_scdoc_help_path "Collection.*fill")+> sc3_scdoc_help_open False (sc3_scdoc_help_path "Collection.inject")+-}+sc3_scdoc_help_open :: Bool -> String -> IO ()+sc3_scdoc_help_open use_loc p = do+ d <- sc3_scdoc_help_dir+ b <- Base.System.get_env_default "BROWSER" "x-www-browser"+ let u = if use_loc then "file://" ++ (d </> p) else sc3_scdoc_help_url ++ p+ void (System.Process.rawSystem b [u])++{- | Generate path to indicated Sc3 instance method help.+Adds initial forward slash if not present.++> let r = "Reference/Server-Command-Reference.html#/b_alloc"+> sc3_scdoc_help_server_command_path "b_alloc" == r+-}+sc3_scdoc_help_server_command_path :: String -> FilePath+sc3_scdoc_help_server_command_path c =+ let c' = case c of+ '/' : _ -> c+ _ -> '/' : c+ in "Reference/Server-Command-Reference.html" ++ ('#' : c')++{- | 'sc3_scdoc_help_open' of 'sc3_server_command_path'++> sc3_scdoc_help_server_command_open True "s_new"+> sc3_scdoc_help_server_command_open False "/b_allocRead"+-}+sc3_scdoc_help_server_command_open :: Bool -> String -> IO ()+sc3_scdoc_help_server_command_open use_loc =+ sc3_scdoc_help_open use_loc+ . sc3_scdoc_help_server_command_path++-- * Fragments++-- | Apply function at lines of string.+on_lines_of :: ([String] -> [[String]]) -> String -> [String]+on_lines_of f = map unlines . f . lines++{- | Split text into fragments at empty lines.+Hsc3 (and related projects) write help files as sets of distinct fragments.+Fragments are separated by empty lines.+A line containing the special character sequence ---- indicates the end of the fragments.++>>> on_lines_of split_multiple_fragments ";a\nb\n\n\n;c\nd"+[";a\nb\n",";c\nd\n"]+-}+split_multiple_fragments :: [String] -> [[String]]+split_multiple_fragments = filter (not . null) . Split.splitOn [[]]++{- | The text '----' appearing anywhere in a line indicates the end of the graph fragments.+The text '# ' appearing at the start of a line also indicates the end of the graph fragments.++>>> drop_post_graph_section ["a","b","c","","----d","e","f"]+["a","b","c",""]++>>> drop_post_graph_section ["a","b","c","","----d","# e","","f"]+["a","b","c",""]+-}+drop_post_graph_section :: [String] -> [String]+drop_post_graph_section =+ let isEnd x = "----" `isInfixOf` x || "# " `isPrefixOf` x+ in takeWhile (not . isEnd)++{- | Some help files are in Markdown format.+These are recognised by examing the first two characters, which must be a '#' and ' '.+-}+is_md_help :: String -> Bool+is_md_help x =+ case x of+ '#' : ' ' : _ -> True+ _ -> False++{- | There are two code block formats in markdown help files.+The first indents the block using a single tab or four spaces.+The second marks the start and end of the block by lines starting with three back ticks (`).++See:+<https://spec.commonmark.org/0.30/#indented-code-blocks>+and+<https://spec.commonmark.org/0.30/#fenced-code-blocks>+-}+data CodeBlockType = IndentedCodeBlock | FencedCodeBlock+ deriving (Bounded, Enum, Eq, Read, Show)++-- | Get code blocks from Markdown help file.+md_help_get_code_blocks :: [String] -> [(CodeBlockType, [String])]+md_help_get_code_blocks x =+ case x of+ [] -> []+ "```" : x' ->+ let (q, x'') = break (== "```") x'+ in (FencedCodeBlock, q) : md_help_get_code_blocks (drop 1 x'')+ ('\t' : _) : _ ->+ let (q, x') = span ((==) ['\t'] . take 1) x+ in (IndentedCodeBlock, (map (drop 1) q)) : md_help_get_code_blocks x'+ _ : x' ->+ md_help_get_code_blocks x'++is_doctest_block :: [String] -> Bool+is_doctest_block =+ let f x p = p `isPrefixOf` x+ in any (\x -> f x ">>> " || f x ">> ")++md_help_get_tab_indented_code_blocks :: [String] -> [[String]]+md_help_get_tab_indented_code_blocks =+ filter (not . is_doctest_block)+ . map snd+ . filter ((== IndentedCodeBlock) . fst)+ . md_help_get_code_blocks++{- | Get indented code blocks from Markdown help file.++>>> s <- readFile "/home/rohan/sw/spl/Help/Reference/AllpassC.help.sl"+>>> is_md_help s+True++>>> let b = md_help_get_fenced_code_blocks (lines s)+>>> length b+3+-}+md_help_get_fenced_code_blocks :: [String] -> [[String]]+md_help_get_fenced_code_blocks =+ filter (not . is_doctest_block)+ . map snd+ . filter ((== FencedCodeBlock) . fst)+ . md_help_get_code_blocks++get_help_file_fragments :: String -> [String]+get_help_file_fragments s =+ if is_md_help s+ then on_lines_of md_help_get_fenced_code_blocks s+ else on_lines_of (split_multiple_fragments . drop_post_graph_section) s++-- | Read text fragments from file.+read_file_fragments :: FilePath -> IO [String]+read_file_fragments = fmap get_help_file_fragments . readFile++-- | Read text fragments from set of files.+read_file_set_fragments :: [FilePath] -> IO [String]+read_file_set_fragments = fmap concat . mapM read_file_fragments
+ Sound/Sc3/Common/Help/Sc2.hs view
@@ -0,0 +1,238 @@+-- | Functions related to the Sc2 help files.+module Sound.Sc3.Common.Help.Sc2 where++{- | Approximate Ugen categorisation from Sc2.+The help files were organised in sub-directories.++> map fst sc2_ugen_categories+-}+sc2_ugen_categories :: [(String, [String])]+sc2_ugen_categories =+ [+ ( "Analysis"+ ,+ [ "Pitch"+ , "RunningSum"+ , "Slope"+ , "ZeroCrossing"+ ]+ )+ ,+ ( "BinaryOps"+ , []+ )+ ,+ ( "Buffers"+ , ["TGrains"]+ )+ ,+ ( "Controls"+ ,+ [ "DegreeToKey"+ , "GetTempo"+ , "Impulse"+ , "Index"+ , "Integrator"+ , "K2A"+ , "Lag"+ , "Latch"+ , "LFPulse"+ , "LFSaw"+ , "LFTri"+ , "LinExp"+ , "MouseX"+ , "MouseY"+ , "Osc1"+ , "Slew"+ , "WrapIndex"+ ]+ )+ ,+ ( "Delays"+ ,+ [ "AllpassC"+ , "CombC"+ , "Delay1"+ , "Delay2"+ , "DelayC"+ , "DelayWrite"+ , "MultiTapDelay"+ , "PingPongDelay"+ , "PitchShift"+ ]+ )+ ,+ ( "Envelopes"+ ,+ [ "Cutoff"+ , "Decay2"+ , "Decay"+ , "Ln"+ , "XLn"+ ]+ )+ ,+ ( "Events"+ , ["OverlapTexture"]+ )+ ,+ ( "Filters"+ ,+ [ "BPF"+ , "BPZ2"+ , "BRF"+ , "BRZ2"+ , "Formlet"+ , "FOS"+ , "HPF"+ , "HPZ1"+ , "HPZ2"+ , "LeakDC"+ , "Limiter"+ , "LPF"+ , "LPZ1"+ , "LPZ2"+ , "Median"+ , "Normalizer"+ , "OnePole"+ , "OneZero"+ , "Resonz"+ , "RHPF"+ , "RingzBank"+ , "Ringz"+ , "RLPF"+ , "SOS"+ , "TwoPole"+ , "TwoZero"+ ]+ )+ ,+ ( "Misc"+ , ["Mix"]+ )+ ,+ ( "Noise"+ ,+ [ "BrownNoise"+ , "ClipNoise"+ , "Crackle"+ , "Dust2"+ , "Dust"+ , "GrayNoise"+ , "LatoocarfianC"+ , "LFClipNoise"+ , "LFNoise0"+ , "LFNoise1"+ , "LFNoise2"+ , "LinCongC"+ , "PinkNoise"+ , "WhiteNoise"+ ]+ )+ ,+ ( "Oscillators"+ ,+ [ "Blip"+ , "Formant"+ , "FSinOsc"+ , "Impulse"+ , "LFPulse"+ , "LFSaw"+ , "LFTri"+ , "PMOsc"+ , "Pulse"+ , "Saw"+ , "SinOsc"+ , "SyncSaw"+ , "VarSaw"+ ]+ )+ ,+ ( "Panners"+ ,+ [ "LinPan2"+ , "LinXFade2"+ , "Pan2"+ , "PanAz"+ , "PanB"+ ]+ )+ ,+ ( "Random"+ ,+ [ "CoinGate"+ , "ExpRand"+ , "IRand"+ , "LinRand"+ , "NRand"+ , "Rand"+ , "TExpRand"+ , "TIRand"+ , "TRand"+ ]+ )+ ,+ ( "Samples"+ ,+ [ "AudioIn"+ , "BufRd"+ , "PlayBuf"+ ]+ )+ ,+ ( "Triggers"+ ,+ [ "Gate"+ , "InRange"+ , "PeakFollower"+ , "Phasor"+ , "PulseCount"+ , "PulseDivider"+ , "Schmidt"+ , "Stepper"+ , "Sweep"+ , "TDelay"+ , "Timer"+ , "ToggleFF"+ ]+ )+ ,+ ( "UnaryOperators"+ ,+ [ "abs"+ , "acos"+ , "ampdb"+ , "asin"+ , "atan"+ , "ceil"+ , "cos"+ , "cosh"+ , "cpsmidi"+ , "cpsoct"+ , "cubed"+ , "dbamp"+ , "distort"+ , "exp"+ , "floor"+ , "frac"+ , "isNegative"+ , "isPositive"+ , "isStrictlyPositive"+ , "log10"+ , "log2"+ , "log"+ , "midicps"+ , "neg"+ , "octcps"+ , "reciprocal"+ , "sign"+ , "sin"+ , "sinh"+ , "softclip"+ , "sqrt"+ , "squared"+ , "tan"+ , "tanh"+ ]+ )+ ]
+ Sound/Sc3/Common/Math.hs view
@@ -0,0 +1,988 @@+-- | Common math functions.+module Sound.Sc3.Common.Math where++import qualified Data.Fixed {- base -}+import Data.Maybe {- base -}+import Data.Ratio {- base -}+import qualified Numeric {- base -}++import qualified Sound.Sc3.Common.Base as Common.Base {- hsc3 -}++{- | Half pi.++>>> half_pi+1.5707963267948966+-}+half_pi :: Floating a => a+half_pi = pi / 2++{- | Two pi.++>>> two_pi+6.283185307179586+-}+two_pi :: Floating n => n+two_pi = 2 * pi++-- | 'abs' of '(-)'.+absdif :: Num a => a -> a -> a+absdif i j = abs (j - i)++-- | Sc3 MulAdd type signature, arguments in Sc3 order of input, multiply, add.+type Sc3_MulAdd t = t -> t -> t -> t++{- | Ordinary (un-optimised) multiply-add, see also mulAdd Ugen.++>>> sc3_mul_add 2 3 4 == 2 * 3 + 4+True++>>> map (\x -> sc3_mul_add x 2 3) [1,5]+[5,13]++>>> map (\x -> sc3_mul_add x 3 2) [1,5]+[5,17]+-}+sc3_mul_add :: Num t => Sc3_MulAdd t+sc3_mul_add i m a = i * m + a++{- | Ordinary Haskell order (un-optimised) multiply-add.++>>> mul_add 3 4 2 == 2 * 3 + 4+True++>>> map (mul_add 2 3) [1,5]+[5,13]++>> map (mul_add 3 4) [1,5]+[7,19]+-}+mul_add :: Num t => t -> t -> t -> t+mul_add m a = (+ a) . (* m)++{- | 'uncurry' 'mul_add'++>>> mul_add_hs (3,4) 2 == 2 * 3 + 4+True+-}+mul_add_hs :: Num t => (t, t) -> t -> t+mul_add_hs = uncurry mul_add++-- | 'fromInteger' of 'truncate'.+sc3_truncate :: RealFrac a => a -> a+sc3_truncate = fromInteger . truncate++-- | 'fromInteger' of 'round'.+sc3_round :: RealFrac a => a -> a+sc3_round = fromInteger . round++-- | 'fromInteger' of 'ceiling'.+sc3_ceiling :: RealFrac a => a -> a+sc3_ceiling = fromInteger . ceiling++-- | 'fromInteger' of 'floor'.+sc3_floor :: RealFrac a => a -> a+sc3_floor = fromInteger . floor++{- | Variant of @Sc3@ @roundTo@ function.++>>> sc3_round_to (2/3) 0.25+0.75++>>> map (`sc3_round_to` 0.25) [0,0.1 .. 1]+[0.0,0.0,0.25,0.25,0.5,0.5,0.5,0.75,0.75,1.0,1.0]++>>> map (`sc3_round_to` 5.0) [100.0 .. 110.0]+[100.0,100.0,100.0,105.0,105.0,105.0,105.0,105.0,110.0,110.0,110.0]+-}+sc3_round_to :: RealFrac n => n -> n -> n+sc3_round_to a b = if b == 0 then a else sc3_floor ((a / b) + 0.5) * b++-- | 'fromInteger' of 'div' of 'floor'.+sc3_idiv :: RealFrac n => n -> n -> n+sc3_idiv a b = fromInteger (floor a `div` floor b)++{- | 'sc3_lcm'++Least common multiple. This definition extends the usual definition+and returns a negative number if any of the operands is negative. This+makes it consistent with the lattice-theoretical interpretation and+its idempotency, commutative, associative, absorption laws.++>>> lcm 4 6+12++>>> lcm 1 1+1++>>> lcm 1624 26+21112++>>> lcm 1624 (-26) /= (-21112)+True++>>> lcm (-1624) (-26) /= (-21112)+True++>>> lcm 513 (gcd 513 44)+513+-}+sc3_lcm :: t -> t -> t+sc3_lcm = error "sc3_lcm: undefined"++{- | 'sc3_gcd'++Greatest common divisor. This definition extends the usual+definition and returns a negative number if both operands are+negative. This makes it consistent with the lattice-theoretical+interpretation and its idempotency, commutative, associative,+absorption laws. <https://www.jsoftware.com/papers/eem/gcd.htm>++>>> gcd 4 6+2++>>> gcd 0 1+1++>>> gcd 1024 256+256++>>> gcd 1024 (-256)+256++>>> gcd (-1024) (-256) /= (-256)+True++>>> gcd (-1024) (lcm (-1024) 256) /= (-1024)+True++>>> gcd 66 54 * lcm 66 54 == 66 * 54+True+-}+sc3_gcd :: t -> t -> t+sc3_gcd = error "sc3_gcd: undefined"++{- | The Sc3 @%@ Ugen operator is the 'Data.Fixed.mod'' function.++> 1.5 % 1.2 // ~= 0.3+> -1.5 % 1.2 // ~= 0.9+> 1.5 % -1.2 // ~= -0.9+> -1.5 % -1.2 // ~= -0.3++>>> let (~=) p q = abs (p - q) < 0.000001+>>> let (%) = sc3_mod+>>> (1.5 % 1.2) ~= 0.3+True++>>> ((-1.5) % 1.2) ~= 0.9+True++>>> (1.5 % (-1.2)) ~= (-0.9)+True++>>> ((-1.5) % (-1.2)) ~= (-0.3)+True++> 1.2 % 1.5 // ~= 1.2+> -1.2 % 1.5 // ~= 0.3+> 1.2 % -1.5 // ~= -0.3+> -1.2 % -1.5 // ~= -1.2++>>> (1.2 % 1.5) ~= 1.2+True++>>> ((-1.2) % 1.5) ~= 0.3+True++>>> (1.2 % (-1.5)) ~= (-0.3)+True++>>> ((-1.2) % (-1.5)) ~= (-1.2)+True++>>> map (\n -> sc3_mod n 12.0) [-1.0,12.25,15.0]+[11.0,0.25,3.0]+-}+sc3_mod :: RealFrac n => n -> n -> n+sc3_mod = Data.Fixed.mod'++-- | Type specialised 'sc3_mod'.+fmod_f32 :: Float -> Float -> Float+fmod_f32 = sc3_mod++-- | Type specialised 'sc3_mod'.+fmod_f64 :: Double -> Double -> Double+fmod_f64 = sc3_mod++{- | @Sc3@ clip function. Clip /n/ to within range /(i,j)/. 'clip' is a 'Ugen'.++>>> map (\n -> sc3_clip n 5 10) [3..12]+[5,5,5,6,7,8,9,10,10,10]+-}+sc3_clip :: Ord a => a -> a -> a -> a+sc3_clip n i j = if n < i then i else if n > j then j else n++{- | Variant of 'sc3_clip' with haskell argument structure.++>>> map (clip_hs (5,10)) [3..12]+[5,5,5,6,7,8,9,10,10,10]+-}+clip_hs :: (Ord a) => (a, a) -> a -> a+clip_hs (i, j) n = sc3_clip n i j++{- | Fractional modulo, alternate implementation.++>>> map (\n -> sc3_mod_alt n 12.0) [-1.0,12.25,15.0]+[11.0,0.25,3.0]+-}+sc3_mod_alt :: RealFrac a => a -> a -> a+sc3_mod_alt n hi =+ let lo = 0.0+ in if n >= lo && n < hi+ then n+ else+ if hi == lo+ then lo+ else n - hi * sc3_floor (n / hi)++{- | Wrap function that is /non-inclusive/ at right edge, ie. the Wrap Ugen rule.++>>> map (round . sc3_wrap_ni 0 5) [4,5,6]+[4,0,1]++>>> map (round . sc3_wrap_ni 5 10) [3..12]+[8,9,5,6,7,8,9,5,6,7]++> Sound.Sc3.Plot.plot_fn_r1_ln (sc3_wrap_ni (-1) 1) (-2,2)+-}+sc3_wrap_ni :: RealFrac a => a -> a -> a -> a+sc3_wrap_ni lo hi n = sc3_mod (n - lo) (hi - lo) + lo++{- | sc_wrap::int++> [5,6].wrap(0,5) == [5,0]++>>> map (wrap_hs_int (0,5)) [5,6]+[5,0]++> [9,10,5,6,7,8,9,10,5,6].wrap(5,10) == [9,10,5,6,7,8,9,10,5,6]++>>> map (wrap_hs_int (5,10)) [3..12]+[9,10,5,6,7,8,9,10,5,6]+-}+wrap_hs_int :: Integral a => (a, a) -> a -> a+wrap_hs_int (i, j) n = ((n - i) `mod` (j - i + 1)) + i++{- | Wrap /n/ to within range /(i,j)/, ie. @AbstractFunction.wrap@,+ie. /inclusive/ at right edge. 'wrap' is a 'Ugen', hence prime.++> [5.0,6.0].wrap(0.0,5.0) == [0.0,1.0]++>>> map (round . wrap_hs (0,4)) [-1,0 .. 5]+[3,0,1,2,3,0,1]++>>> map (round . wrap_hs (0,5)) [5,6]+[0,1]++>>> map (round . wrap_hs (5,10)) [3..12]+[8,9,5,6,7,8,9,5,6,7]++> Sound.Sc3.Plot.plot_fn_r1_ln (wrap_hs (-1,1)) (-2,2)+-}+wrap_hs :: RealFrac n => (n, n) -> n -> n+wrap_hs (i, j) n =+ let r = j - i -- + 1+ n' = if n >= j then n - r else if n < i then n + r else n+ in if n' >= i && n' < j+ then n'+ else n' - r * sc3_floor ((n' - i) / r)++{- | Variant of 'wrap_hs' with @Sc3@ argument ordering.++>>> map (\n -> sc3_wrap n 5 10) [3..12] == map (wrap_hs (5,10)) [3..12]+True++>>> map (\n -> sc3_wrap n 0 4) [-1, 0 .. 5]+[3.0,0.0,1.0,2.0,3.0,0.0,1.0]+-}+sc3_wrap :: RealFrac n => n -> n -> n -> n+sc3_wrap index start end = wrap_hs (start, end) index++{- | Generic variant of 'wrap''.++> [5,6].wrap(0,5) == [5,0]++>>> map (generic_wrap (0,5)) [5,6]+[5,0]++> [9,10,5,6,7,8,9,10,5,6].wrap(5,10) == [9,10,5,6,7,8,9,10,5,6]++>>> map (generic_wrap (5::Integer,10)) [3..12]+[9,10,5,6,7,8,9,10,5,6]+-}+generic_wrap :: (Ord a, Num a) => (a, a) -> a -> a+generic_wrap (l, r) n =+ let d = r - l + 1+ f = generic_wrap (l, r)+ in if n < l+ then f (n + d)+ else if n > r then f (n - d) else n++{- | Given sample-rate /sr/ and bin-count /n/ calculate frequency of /i/th bin.++>>> bin_to_freq 44100 2048 32+689.0625+-}+bin_to_freq :: (Fractional n, Integral i) => n -> i -> i -> n+bin_to_freq sr n i = fromIntegral i * sr / fromIntegral n++{- | Fractional midi note number to cycles per second.++>>> map (floor . midi_to_cps) [0,24,69,120,127]+[8,32,440,8372,12543]++>>> map (floor . midi_to_cps) [-36,138]+[1,23679]++>>> map (floor . midi_to_cps) [69.0,69.25 .. 70.0]+[440,446,452,459,466]+-}+midi_to_cps :: Floating a => a -> a+midi_to_cps i = 440.0 * (2.0 ** ((i - 69.0) * (1.0 / 12.0)))++{- | Cycles per second to fractional midi note number.++>>> map (round . cps_to_midi) [8,32,440,8372,12543]+[0,24,69,120,127]++>>> map (round . cps_to_midi) [1,24000]+[-36,138]+-}+cps_to_midi :: Floating a => a -> a+cps_to_midi a = (logBase 2 (a * (1.0 / 440.0)) * 12.0) + 69.0++{- | Cycles per second to linear octave (4.75 = A4 = 440).++>>> map (cps_to_oct . midi_to_cps) [60,63,69]+[4.0,4.25,4.75]+-}+cps_to_oct :: Floating a => a -> a+cps_to_oct a = logBase 2 (a * (1.0 / 440.0)) + 4.75++{- | Linear octave to cycles per second.++> [4.0,4.25,4.75].octcps.cpsmidi == [60,63,69]++>>> map (cps_to_midi . oct_to_cps) [4.0,4.25,4.75]+[60.0,63.0,69.0]+-}+oct_to_cps :: Floating a => a -> a+oct_to_cps a = 440.0 * (2.0 ** (a - 4.75))++-- | Degree, scale and steps per octave to key.+degree_to_key :: RealFrac a => [a] -> a -> a -> a+degree_to_key s n d =+ let l = length s+ d' = round d+ a = (d - fromIntegral d') * 10.0 * (n / 12.0)+ in (n * fromIntegral (d' `div` l)) + Common.Base.at_with_error_message "degree_to_key" s (d' `mod` l) + a++{- | One-indexed piano key number (for standard 88 key piano) to midi note number.++>>> map pianokey_to_midi [1,49,88]+[21,69,108]+-}+pianokey_to_midi :: Num n => n -> n+pianokey_to_midi = (+) 20++{- | Piano key to hertz (ba.pianokey2hz in Faust).+ This is useful as a more musical gamut than midi note numbers.+ Ie. if x is in (0,1) then pianokey_to_cps of (x * 88) is in (26,4168)++>>> map (round . pianokey_to_cps) [0,1,40,49,88]+[26,28,262,440,4186]++>>> map (round . midi_to_cps) [0,60,69,127]+[8,262,440,12544]+-}+pianokey_to_cps :: Floating n => n -> n+pianokey_to_cps = midi_to_cps . pianokey_to_midi++{- | Linear amplitude to decibels.++>>> map (round . amp_to_db) [0.01,0.05,0.0625,0.125,0.25,0.5]+[-40,-26,-24,-18,-12,-6]+-}+amp_to_db :: Floating a => a -> a+amp_to_db = (* 20) . logBase 10++{- | Decibels to linear amplitude.++>>> map (floor . (* 100). db_to_amp) [-40,-26,-24,-18,-12,-6]+[1,5,6,12,25,50]++>>> let amp = map (2 **) [0 .. 15]+>>> let db = [0,-6 .. -90]+>>> map (round . amp_to_db . (/) 1) amp == db+True++>>> db_to_amp (-3)+0.7079457843841379++>>> amp_to_db 0.7079457843841379+-3.0+-}+db_to_amp :: Floating a => a -> a+db_to_amp = (10 **) . (* 0.05)++{- | Fractional midi note interval to frequency multiplier.++>>> map midi_to_ratio [-12,0,7,12]+[0.5,1.0,1.4983070768766815,2.0]+-}+midi_to_ratio :: Floating a => a -> a+midi_to_ratio a = 2.0 ** (a * (1.0 / 12.0))++{- | Inverse of 'midi_to_ratio'.++>>> map ratio_to_midi [3/2,2]+[7.019550008653875,12.0]+-}+ratio_to_midi :: Floating a => a -> a+ratio_to_midi a = 12.0 * logBase 2 a++{- | /sr/ = sample rate, /r/ = cycle (two-pi), /cps/ = frequency++>>> cps_to_incr 48000 128 375+1.0++>>> cps_to_incr 48000 two_pi 458.3662361046586+6.0e-2+-}+cps_to_incr :: Fractional a => a -> a -> a -> a+cps_to_incr sr r cps = (r / sr) * cps++{- | Inverse of 'cps_to_incr'.++>>> incr_to_cps 48000 128 1+375.0+-}+incr_to_cps :: Fractional a => a -> a -> a -> a+incr_to_cps sr r ic = ic / (r / sr)++-- | Pan2 function, identity is linear, sqrt is equal power.+pan2_f :: Fractional t => (t -> t) -> t -> t -> (t, t)+pan2_f f p q =+ let q' = (q / 2) + 0.5+ in (p * f (1 - q'), p * f q')++{- | Linear pan.++>>> map (lin_pan2 1) [-1,-0.5,0,0.5,1]+[(1.0,0.0),(0.75,0.25),(0.5,0.5),(0.25,0.75),(0.0,1.0)]+-}+lin_pan2 :: Fractional t => t -> t -> (t, t)+lin_pan2 = pan2_f id++{- | Equal power pan.++>>> map (eq_pan2 1) [-1,-0.5,0,0.5,1]+[(1.0,0.0),(0.8660254037844386,0.5),(0.7071067811865476,0.7071067811865476),(0.5,0.8660254037844386),(0.0,1.0)]+-}+eq_pan2 :: Floating t => t -> t -> (t, t)+eq_pan2 = pan2_f sqrt++-- | 'fromInteger' of 'properFraction'.+sc3_properFraction :: RealFrac t => t -> (t, t)+sc3_properFraction a =+ let (p, q) = properFraction a+ in (fromInteger p, q)++-- | a^2 - b^2.+sc3_dif_sqr :: Num a => a -> a -> a+sc3_dif_sqr a b = (a * a) - (b * b)++-- | Euclidean distance function ('sqrt' of sum of squares).+sc3_hypot :: Floating a => a -> a -> a+sc3_hypot x y = sqrt (x * x + y * y)++-- | Sc3 hypotenuse approximation function.+sc3_hypotx :: (Ord a, Floating a) => a -> a -> a+sc3_hypotx x y = abs x + abs y - ((sqrt 2 - 1) * min (abs x) (abs y))++{- | Fold /k/ to within range /(i,j)/, ie. @AbstractFunction.fold@++>>> map (foldToRange 5 10) [3..12]+[7,6,5,6,7,8,9,10,9,8]+-}+foldToRange :: (Ord a, Num a) => a -> a -> a -> a+foldToRange i j =+ let f n =+ if n > j+ then f (j - (n - j))+ else+ if n < i+ then f (i - (n - i))+ else n+ in f++-- | Variant of 'foldToRange' with @Sc3@ argument ordering.+sc3_fold :: (Ord a, Num a) => a -> a -> a -> a+sc3_fold n i j = foldToRange i j n++-- | Sc3 distort operator.+sc3_distort :: Fractional n => n -> n+sc3_distort x = x / (1 + abs x)++-- | Sc3 softclip operator.+sc3_softclip :: (Ord n, Fractional n) => n -> n+sc3_softclip x = let x' = abs x in if x' <= 0.5 then x else (x' - 0.25) / x++-- * Bool++-- | True is conventionally 1. The test to determine true is @> 0@.+sc3_true :: Num n => n+sc3_true = 1++-- | False is conventionally 0. The test to determine true is @<= 0@.+sc3_false :: Num n => n+sc3_false = 0++{- | Lifted 'not'.++>>> sc3_not sc3_true == sc3_false+True++>>> sc3_not sc3_false == sc3_true+True+-}+sc3_not :: (Ord n, Num n) => n -> n+sc3_not = sc3_bool . (<= 0)++-- | Translate 'Bool' to 'sc3_true' and 'sc3_false'.+sc3_bool :: Num n => Bool -> n+sc3_bool b = if b then sc3_true else sc3_false++-- | Lift comparison function.+sc3_comparison :: Num n => (n -> n -> Bool) -> n -> n -> n+sc3_comparison f p q = sc3_bool (f p q)++-- * Eq++-- | Lifted '=='.+sc3_eq :: (Num n, Eq n) => n -> n -> n+sc3_eq = sc3_comparison (==)++-- | Lifted '/='.+sc3_neq :: (Num n, Eq n) => n -> n -> n+sc3_neq = sc3_comparison (/=)++-- * Ord++-- | Lifted '<'.+sc3_lt :: (Num n, Ord n) => n -> n -> n+sc3_lt = sc3_comparison (<)++-- | Lifted '<='.+sc3_lte :: (Num n, Ord n) => n -> n -> n+sc3_lte = sc3_comparison (<=)++-- | Lifted '>'.+sc3_gt :: (Num n, Ord n) => n -> n -> n+sc3_gt = sc3_comparison (>)++-- | Lifted '>='.+sc3_gte :: (Num n, Ord n) => n -> n -> n+sc3_gte = sc3_comparison (>=)++-- * Clip Rule++-- | Enumeration of clipping rules.+data Clip_Rule = Clip_None | Clip_Left | Clip_Right | Clip_Both+ deriving (Enum, Bounded)++{- | Clip a value that is expected to be within an input range to an output range, according to a rule.++>>> let f r = map (\x -> apply_clip_rule r 0 1 (-1) 1 x) [-1,0,0.5,1,2]+>>> map f [minBound .. maxBound]+[[Nothing,Nothing,Nothing,Nothing,Nothing],[Just (-1.0),Just (-1.0),Nothing,Nothing,Nothing],[Nothing,Nothing,Nothing,Just 1.0,Just 1.0],[Just (-1.0),Just (-1.0),Nothing,Just 1.0,Just 1.0]]+-}+apply_clip_rule :: Ord n => Clip_Rule -> n -> n -> n -> n -> n -> Maybe n+apply_clip_rule clip_rule sl sr dl dr x =+ case clip_rule of+ Clip_None -> Nothing+ Clip_Left -> if x <= sl then Just dl else Nothing+ Clip_Right -> if x >= sr then Just dr else Nothing+ Clip_Both -> if x <= sl then Just dl else if x >= sr then Just dr else Nothing++-- * LinLin++-- | Scale uni-polar (0,1) input to linear (l,r) range.+urange_ma :: Fractional a => Sc3_MulAdd a -> a -> a -> a -> a+urange_ma mul_add_f l r i = mul_add_f i (r - l) l++{- | Scale (0,1) input to linear (l,r) range. u = uni-polar.++>>> map (urange 3 4) [0,0.5,1]+[3.0,3.5,4.0]+-}+urange :: Fractional a => a -> a -> a -> a+urange = urange_ma sc3_mul_add++{- | Calculate multiplier and add values for (-1,1) 'range' transform.++>>> range_muladd 3 4+(0.5,3.5)+-}+range_muladd :: Fractional t => t -> t -> (t, t)+range_muladd = linlin_muladd (-1) 1++{- | Scale bi-polar (-1,1) input to linear (l,r) range.+Note that the argument order is not the same as 'linLin'.+-}+range_ma :: Fractional a => Sc3_MulAdd a -> a -> a -> a -> a+range_ma mul_add_f l r i =+ let (m, a) = range_muladd l r+ in mul_add_f i m a++{- | Scale (-1,1) input to linear (l,r) range.+Note that the argument order is not the same as 'linlin'.+Note also that the various range Ugen methods at sclang select mul-add values given the output range of the Ugen, ie LFPulse.range selects a (0,1) input range.++>>> map (range 3 4) [-1,0,1]+[3.0,3.5,4.0]++>>> map (\x -> let (m,a) = linlin_muladd (-1) 1 3 4 in x * m + a) [-1,0,1]+[3.0,3.5,4.0]+-}+range :: Fractional a => a -> a -> a -> a+range = range_ma sc3_mul_add++-- | 'uncurry' 'range'+range_hs :: Fractional a => (a, a) -> a -> a+range_hs = uncurry range++-- | 'flip' 'range_hs'. This allows cases such as osc `in_range` (0,1)+in_range :: Fractional a => a -> (a, a) -> a+in_range = flip range_hs++{- | Calculate multiplier and add values for 'linlin' transform.+Inputs are: input-min input-max output-min output-max++>>> range_muladd 3 4+(0.5,3.5)++>>> linlin_muladd (-1) 1 3 4+(0.5,3.5)++>>> linlin_muladd 0 1 3 4+(1.0,3.0)++>>> linlin_muladd (-1) 1 0 1+(0.5,0.5)++>>> linlin_muladd (-0.3) 1 (-1) 1+(1.5384615384615383,-0.5384615384615385)+-}+linlin_muladd :: Fractional t => t -> t -> t -> t -> (t, t)+linlin_muladd sl sr dl dr =+ let m = (dr - dl) / (sr - sl)+ a = dl - (m * sl)+ in (m, a)++{- | Map from one linear range to another linear range.++>>> linlin_ma sc3_mul_add 5 0 10 (-1) 1+0.0+-}+linlin_ma :: Fractional a => Sc3_MulAdd a -> a -> a -> a -> a -> a -> a+linlin_ma mul_add_f i sl sr dl dr =+ let (m, a) = linlin_muladd sl sr dl dr+ in mul_add_f i m a++{- | 'linLin' with a more typical haskell argument structure, ranges as pairs and input last.++>>> map (linlin_hs (0,127) (-0.5,0.5)) [0,63.5,127]+[-0.5,0.0,0.5]+-}+linlin_hs :: Fractional a => (a, a) -> (a, a) -> a -> a+linlin_hs (sl, sr) (dl, dr) = let (m, a) = linlin_muladd sl sr dl dr in (+ a) . (* m)++{- | Map from one linear range to another linear range.++>>> map (\i -> sc3_linlin i (-1) 1 0 1) [-1,-0.75 .. 1]+[0.0,0.125,0.25,0.375,0.5,0.625,0.75,0.875,1.0]+-}+sc3_linlin :: Fractional a => a -> a -> a -> a -> a -> a+sc3_linlin i sl sr dl dr = linlin_hs (sl, sr) (dl, dr) i++{- | Given enumeration from /dst/ that is in the same relation as /n/ is from /src/.++>>> linlin_enum_plain 'a' 'A' 'e'+'E'++>>> linlin_enum_plain 0 (-50) 16+-34++>>> linlin_enum_plain 0 (-50) (-1)+-51+-}+linlin_enum_plain :: (Enum t, Enum u) => t -> u -> t -> u+linlin_enum_plain src dst n = toEnum (fromEnum dst + (fromEnum n - fromEnum src))++{- | Variant of 'linlin_enum_plain' that requires /src/ and /dst/ ranges to be of equal size,+-- and for /n/ to lie in /src/.++>>> linlin_enum (0,100) (-50,50) 0x10 -- 16+Just (-34)++>>> linlin_enum (-50,50) (0,100) (-34)+Just 16++>>> linlin_enum (0,100) (-50,50) (-1)+Nothing+-}+linlin_enum :: (Enum t, Enum u) => (t, t) -> (u, u) -> t -> Maybe u+linlin_enum (l, r) (l', r') n =+ if fromEnum n >= fromEnum l && fromEnum r - fromEnum l == fromEnum r' - fromEnum l'+ then Just (linlin_enum_plain l l' n)+ else Nothing++-- | Erroring variant.+linlin_enum_err :: (Enum t, Enum u) => (t, t) -> (u, u) -> t -> u+linlin_enum_err src dst = fromMaybe (error "linlin_enum") . linlin_enum src dst++{- | Variant of 'linlin' that requires /src/ and /dst/ ranges to be of+-- equal size, thus with constraint of 'Num' and 'Eq' instead of+-- 'Fractional'.++>>> linlin_eq (0,100) (-50,50) 0x10 -- 16+Just (-34)++>>> linlin_eq (-50,50) (0,100) (-34)+Just 16+-}+linlin_eq :: (Eq a, Num a) => (a, a) -> (a, a) -> a -> Maybe a+linlin_eq (l, r) (l', r') n =+ let d = r - l+ d' = r' - l'+ in if d == d' then Just (l' + (n - l)) else Nothing++-- | Erroring variant.+linlin_eq_err :: (Eq a, Num a) => (a, a) -> (a, a) -> a -> a+linlin_eq_err src dst = fromMaybe (error "linlin_eq") . linlin_eq src dst++-- * LinExp++{- | Linear to exponential range conversion.+ Rule is as at linExp Ugen, haskell manner argument ordering.+ Destination values must be nonzero and have the same sign.++>>> map (floor . linexp_hs (1,2) (10,100)) [0,1,1.5,2,3]+[1,10,31,100,1000]++>>> map (floor . linexp_hs (-2,2) (1,100)) [-3,-2,-1,0,1,2,3]+[0,1,3,10,31,100,316]+-}+linexp_hs :: Floating a => (a, a) -> (a, a) -> a -> a+linexp_hs (in_l, in_r) (out_l, out_r) x =+ let rt = out_r / out_l+ rn = 1.0 / (in_r - in_l)+ rr = rn * negate in_l+ in out_l * (rt ** (x * rn + rr))++{- | Variant of 'linexp_hs' with argument ordering as at 'linExp' Ugen.++>>> map (\i -> lin_exp i 1 2 1 3) [1,1.1,1.9,2]+[1.0,1.1161231740339046,2.6878753795222865,3.0]++>>> map (\i -> floor (lin_exp i 1 2 10 100)) [0,1,1.5,2,3]+[1,10,31,100,1000]+-}+lin_exp :: Floating a => a -> a -> a -> a -> a -> a+lin_exp x in_l in_r out_l out_r = linexp_hs (in_l, in_r) (out_l, out_r) x++{- | @SimpleNumber.linexp@ shifts from linear to exponential ranges.++>>> map (sc3_linexp 1 2 1 3) [1,1.1,1.9,2]+[1.0,1.1161231740339046,2.6878753795222865,3.0]++> [1,1.5,2].collect({|i| i.linexp(1,2,10,100).floor}) == [10,31,100]++>>> map (floor . sc3_linexp 1 2 10 100) [0,1,1.5,2,3]+[10,10,31,100,100]+-}+sc3_linexp :: (Ord a, Floating a) => a -> a -> a -> a -> a -> a+sc3_linexp src_l src_r dst_l dst_r x =+ case apply_clip_rule Clip_Both src_l src_r dst_l dst_r x of+ Just r -> r+ Nothing -> ((dst_r / dst_l) ** ((x - src_l) / (src_r - src_l))) * dst_l++{- | @SimpleNumber.explin@ is the inverse of linexp.++>>> map (sc3_explin 10 100 1 2) [10,10,31,100,100]+[1.0,1.0,1.4913616938342726,2.0,2.0]+-}+sc3_explin :: (Ord a, Floating a) => a -> a -> a -> a -> a -> a+sc3_explin src_l src_r dst_l dst_r x =+ fromMaybe+ (logBase (src_r / src_l) (x / src_l) * (dst_r - dst_l) + dst_l)+ (apply_clip_rule Clip_Both src_l src_r dst_l dst_r x)++-- * ExpExp++{- | Translate from one exponential range to another.++>>> map (round . sc3_expexp 0.1 10 4.3 100) [1 .. 10]+[21,33,44,53,62,71,78,86,93,100]+-}+sc3_expexp :: (Ord a, Floating a) => a -> a -> a -> a -> a -> a+sc3_expexp src_l src_r dst_l dst_r x =+ fromMaybe+ ((dst_r / dst_l) ** logBase (src_r / src_l) (x / src_l) * dst_l)+ (apply_clip_rule Clip_Both src_l src_r dst_l dst_r x)++-- * LinCurve++{- | Map /x/ from an assumed linear input range (src_l,src_r) to an+exponential curve output range (dst_l,dst_r). 'curve' is like the+parameter in Env. Unlike with linexp, the output range may include+zero.++> (0..10).lincurve(0,10,-4.3,100,-3).round == [-4,24,45,61,72,81,87,92,96,98,100]++>>> let f = round . sc3_lincurve (-3) 0 10 (-4.3) 100+>>> map f [0 .. 10]+[-4,24,45,61,72,81,87,92,96,98,100]++> import Sound.Sc3.Plot {\- hsc3-plot -\}+> plotTable (map (\c-> map (sc3_lincurve c 0 1 (-1) 1) [0,0.01 .. 1]) [-6,-4 .. 6])+-}+sc3_lincurve :: (Ord a, Floating a) => a -> a -> a -> a -> a -> a -> a+sc3_lincurve curve src_l src_r dst_l dst_r x =+ case apply_clip_rule Clip_Both src_l src_r dst_l dst_r x of+ Just r -> r+ Nothing ->+ if abs curve < 0.001+ then linlin_hs (src_l, src_r) (dst_l, dst_r) x+ else+ let grow = exp curve+ a = (dst_r - dst_l) / (1.0 - grow)+ b = dst_l + a+ scaled = (x - src_l) / (src_r - src_l)+ in b - (a * (grow ** scaled))++{- | Inverse of 'sc3_lincurve'.++>>> let f = round . sc3_curvelin (-3) (-4.3) 100 0 10+>>> map f [-4,24,45,61,72,81,87,92,96,98,100] == [0..10]+True+-}+sc3_curvelin :: (Ord a, Floating a) => a -> a -> a -> a -> a -> a -> a+sc3_curvelin curve src_l src_r dst_l dst_r x =+ case apply_clip_rule Clip_Both src_l src_r dst_l dst_r x of+ Just r -> r+ Nothing ->+ if abs curve < 0.001+ then linlin_hs (src_l, src_r) (dst_l, dst_r) x+ else+ let grow = exp curve+ a = (src_r - src_l) / (1.0 - grow)+ b = src_l + a+ in log ((b - x) / a) * (dst_r - dst_l) / curve + dst_l++-- * Pp (pretty print)++-- | Removes all but the last trailing zero from floating point string.+double_pp_rm0 :: String -> String+double_pp_rm0 =+ let rev_f f = reverse . f . reverse+ remv l = case l of+ '0' : '.' : _ -> l+ '0' : l' -> remv l'+ _ -> l+ in rev_f remv++{- | The default show is odd, 0.05 shows as 5.0e-2.++>>> unwords (map (double_pp 4) [0.0001,0.001,0.01,0.1,1.0])+"0.0001 0.001 0.01 0.1 1.0"+-}+double_pp :: Int -> Double -> String+double_pp k n = double_pp_rm0 (Numeric.showFFloat (Just k) n "")++{- | Print as integer if integral, else as real.++>>> unwords (map (real_pp 5) [0.0001,0.001,0.01,0.1,1.0])+"0.0001 0.001 0.01 0.1 1"+-}+real_pp :: Int -> Double -> String+real_pp k n =+ let r = toRational n+ in if denominator r == 1 then show (numerator r) else double_pp k n++-- * Parser++-- | Type-specialised 'Text.Read.readMaybe'.+parse_double :: String -> Maybe Double+parse_double = Common.Base.reads_exact++-- * Optimiser++-- | Non-specialised optimised sum function (3 & 4 element adders).+sum_opt_f :: Num t => (t -> t -> t -> t) -> (t -> t -> t -> t -> t) -> [t] -> t+sum_opt_f f3 f4 =+ let recur l =+ case l of+ p : q : r : s : l' -> recur (f4 p q r s : l')+ p : q : r : l' -> recur (f3 p q r : l')+ _ -> sum l+ in recur++-- * Sin++{- | Taylor approximation of sin, (-pi, pi).++> import Sound.Sc3.Plot+> let xs = [-pi, -pi + 0.05 .. pi] in plot_p1_ln [map sin_taylor_approximation xs, map sin xs]+> let xs = [-pi, -pi + 0.05 .. pi] in plot_p1_ln [map (\x -> sin_taylor_approximation x - sin x) xs]+-}+sin_taylor_approximation :: Floating a => a -> a+sin_taylor_approximation x = x - (x ** 3) / (3 * 2) + (x ** 5) / (5 * 4 * 3 * 2) - (x ** 7) / (7 * 6 * 5 * 4 * 3 * 2) + (x ** 9) / (9 * 8 * 7 * 6 * 5 * 4 * 3 * 2)++{- | Bhaskara approximation of sin, (0, pi).++> import Sound.Sc3.Plot+> let xs = [0, 0.05 .. pi] in plot_p1_ln [map sin_bhaskara_approximation xs, map sin xs]+> let xs = [0, 0.05 .. pi] in plot_p1_ln [map (\x -> sin_bhaskara_approximation x - sin x) xs]+-}+sin_bhaskara_approximation :: Floating a => a -> a+sin_bhaskara_approximation x = (16 * x * (pi - x)) / ((5 * pi * pi) - (4 * x * (pi - x)))++{- | Robin Green, robin_green@playstation.sony.com, (-pi, pi)++> import Sound.Sc3.Plot+> let xs = [-pi, -pi + 0.05 .. pi] in plot_p1_ln [map sin_green_approximation xs, map sin xs]+> let xs = [-pi, -pi + 0.05 .. pi] in plot_p1_ln [map (\x -> sin_green_approximation x - sin x) xs]+-}+sin_green_approximation :: Floating a => a -> a+sin_green_approximation x = x - (0.166666546 * (x ** 3)) + (0.00833216076 * (x ** 5)) - (0.000195152832 * (x ** 7))++{- | Paul Adenot, (-pi, pi)++> import Sound.Sc3.Plot+> let xs = [-pi, -pi + 0.05 .. pi] in plot_p1_ln [map sin_adenot_approximation xs, map sin xs]+> let xs = [-pi, -pi + 0.05 .. pi] in plot_p1_ln [map (\x -> sin_adenot_approximation x - sin x) xs]+-}+sin_adenot_approximation :: Floating a => a -> a+sin_adenot_approximation x = 0.391969947653056 * x * (pi - abs x)++{- Anthony C. Robin, (0, 45).+Simple Trigonometric Approximations, The Mathematical Gazette, Vol. 79, No. 485 (Jul., 1995), pp. 385-387.++> import Sound.Sc3.Plot+> degrees_to_radians = (* pi) . (/ 180)+> let xs = [0, 0.05 .. 45] in plot_p1_ln [map sin_robin_approximation xs, map (sin . degrees_to_radians) xs]+> let xs = [0, 0.05 .. 45] in plot_p1_ln [map (\x -> sin_robin_approximation x - sin (degrees_to_radians x)) xs]+-}+sin_robin_approximation :: Floating a => a -> a+sin_robin_approximation x = let c = x * 0.01 in c * (2 - c)
+ Sound/Sc3/Common/Math/Filter.hs view
@@ -0,0 +1,89 @@+-- | Filter coefficient calculations.+module Sound.Sc3.Common.Math.Filter where++-- | Sos filter coefficients, (a0, a1, a2, b1, b2)+type SosCoef t = (t, t, t, t, t)++-- | Butterworth low pass or high pass Sos filter coefficients.+bw_lpf_or_hpf_coef :: Floating n => Bool -> n -> n -> SosCoef n+bw_lpf_or_hpf_coef is_hpf sample_rate f =+ let f' = f * pi / sample_rate+ c = if is_hpf then tan f' else 1 / tan f'+ c2 = c * c+ s2c = sqrt 2 * c+ a0 = 1 / (1 + s2c + c2)+ a1 = if is_hpf then -2 * a0 else 2 * a0+ a2 = a0+ b1 = if is_hpf then 2 * (c2 - 1.0) * a0 else 2 * (1 - c2) * a0+ b2 = (1 - s2c + c2) * a0+ in (a0, a1, a2, b1, b2)++-- | Two place infinite impulse response filter coefficients, (a0, b1, b2)+type Iir2Coef t = (t, t, t)++-- | rlpf coefficients, (a0,b1,b2).+rlpf_coef :: Floating n => (n -> n -> n) -> (n, n, n) -> Iir2Coef n+rlpf_coef max_f (radians_per_sample, f, rq) =+ let qr = max_f 0.001 rq+ pf = f * radians_per_sample+ d = tan (pf * qr * 0.5)+ c = (1 - d) / (1 + d)+ b1 = (1 + c) * cos pf+ b2 = negate c+ a0 = (1 + c - b1) * 0.25+ in (a0, b1, b2)++-- | resonz coefficients, (a0,b1,b2).+resonz_coef :: Floating n => (n, n, n) -> Iir2Coef n+resonz_coef (radians_per_sample, f, rq) =+ let ff = f * radians_per_sample+ b = ff * rq+ r = 1 - b * 0.5+ two_r = 2 * r+ r2 = r * r+ ct = (two_r * cos ff) / (1 + r2)+ b1 = two_r * ct+ b2 = negate r2+ a0 = (1 - r2) * 0.5+ in (a0, b1, b2)++-- * Pinking++type Pinking_Param t = (t, t, t, t, t, t, t)++{- | Sample rate variable pinking filter.++https://www.musicdsp.org/en/latest/Filters/76-pink-noise-filter.html+-}+pinking_filter_freq_48000 :: Fractional t => Pinking_Param t+pinking_filter_freq_48000 = (4752.456, 4030.961, 2784.711, 1538.461, 357.681, 70, 30)++pinking_filter_freq_96000 :: Fractional t => Pinking_Param t+pinking_filter_freq_96000 = (8227.219, 8227.219, 6388.570, 3302.754, 479.412, 151.070, 54.264)++pinking_filter_freq_192000 :: Fractional t => Pinking_Param t+pinking_filter_freq_192000 = (9211.912, 8621.096, 8555.228, 8292.754, 518.334, 163.712, 240.241)++{- | Pinking filter coefficients++>>> pinking_filter_coef 48000 pinking_filter_freq_48000+(0.5368186045507747,0.5899888969306109,0.6945314610687594,0.8175983529924599,0.9542588306160661,0.9908788735874952,0.9960807097281633)+-}+pinking_filter_coef :: Floating t => t -> Pinking_Param t -> Pinking_Param t+pinking_filter_coef sr (f0, f1, f2, f3, f4, f5, f6) =+ let f n = exp ((-2) * pi * n / sr)+ in (f f0, f f1, f f2, f f3, f f4, f f5, f f6)++pinking_filter_next :: Floating t => Pinking_Param t -> Pinking_Param t -> t -> (t, Pinking_Param t)+pinking_filter_next (k0, k1, k2, k3, k4, k5, k6) (m0, m1, m2, m3, m4, m5, m6) white =+ let (b0, b1, b2, b3, b4, b5, b6) =+ ( (k0 * white) + (k0 * m0)+ , (k1 * white) + (k1 * m1)+ , (k2 * white) + (k2 * m2)+ , (k3 * white) + (k3 * m3)+ , (k4 * white) + (k4 * m4)+ , (k5 * white) + (k5 * m5)+ , (k6 * white) + (k6 * m6)+ )+ pink = b0 + b1 + b2 + b3 + b4 + b5 + white - b6+ in (pink, (b0, b1, b2, b3, b4, b5, b6))
+ Sound/Sc3/Common/Math/Filter/Beq.hs view
@@ -0,0 +1,117 @@+-- | Beq filter coefficient calculations.+module Sound.Sc3.Common.Math.Filter.Beq where++-- | Beq coefficients, (a0, a1, a2, b1, b2).+type Beq t = (t, t, t, t, t)++-- | Calculate coefficients for bi-quad low pass filter.+bLowPassCoef :: Floating t => t -> t -> t -> Beq t+bLowPassCoef sr freq rq =+ let w0 = pi * 2 * freq * (1 / sr)+ cos_w0 = cos w0+ i = 1 - cos_w0+ alpha = sin w0 * 0.5 * rq+ b0rz = recip (1 + alpha)+ a0 = i * 0.5 * b0rz+ a1 = i * b0rz+ b1 = cos_w0 * 2 * b0rz+ b2 = (1 - alpha) * negate b0rz+ in (a0, a1, a0, b1, b2)++-- | Calculate coefficients for bi-quad high pass filter.+bHiPassCoef :: Floating t => t -> t -> t -> Beq t+bHiPassCoef sr freq rq =+ let w0 = pi * 2 * freq * (1 / sr)+ cos_w0 = cos w0+ i = 1 + cos_w0+ alpha = sin w0 * 0.5 * rq+ b0rz = recip (1 + alpha)+ a0 = i * 0.5 * b0rz+ a1 = negate i * b0rz+ b1 = cos_w0 * 2 * b0rz+ b2 = (1 - alpha) * negate b0rz+ in (a0, a1, a0, b1, b2)++-- | Calculate coefficients for bi-quad all pass filter.+bAllPassCoef :: Floating t => t -> t -> t -> Beq t+bAllPassCoef sr freq rq =+ let w0 = pi * 2 * freq * (1 / sr)+ alpha = sin w0 * 0.5 * rq+ b0rz = recip (1 + alpha)+ a0 = (1 - alpha) * b0rz+ b1 = 2.0 * cos w0 * b0rz+ in (a0, negate b1, 1.0, b1, negate a0)++-- | Calculate coefficients for bi-quad band pass filter.+bBandPassCoef :: Floating t => t -> t -> t -> Beq t+bBandPassCoef sr freq bw =+ let w0 = pi * 2 * freq * (1 / sr)+ sin_w0 = sin w0+ alpha = sin_w0 * sinh (0.34657359027997 * bw * w0 / sin_w0)+ b0rz = recip (1 + alpha)+ a0 = alpha * b0rz+ b1 = cos w0 * 2 * b0rz+ b2 = (1 - alpha) * negate b0rz+ in (a0, 0.0, negate a0, b1, b2)++-- | Calculate coefficients for bi-quad stop band filter.+bBandStopCoef :: Floating t => t -> t -> t -> Beq t+bBandStopCoef sr freq bw =+ let w0 = pi * 2 * freq * (1 / sr)+ sin_w0 = sin w0+ alpha = sin_w0 * sinh (0.34657359027997 * bw * w0 / sin_w0)+ b0rz = recip (1 + alpha)+ b1 = 2.0 * cos w0 * b0rz+ b2 = (1 - alpha) * negate b0rz+ in (b0rz, negate b1, b0rz, b1, b2)++-- | Calculate coefficients for bi-quad peaking Eq filter.+bPeakEqCoef :: Floating t => t -> t -> t -> t -> Beq t+bPeakEqCoef sr freq rq db =+ let a = 10 ** (db / 40)+ w0 = pi * 2 * freq * (1 / sr)+ alpha = sin w0 * 0.5 * rq+ b0rz = recip (1 + (alpha / a))+ a0 = (1 + (alpha * a)) * b0rz+ a2 = (1 - (alpha * a)) * b0rz+ b1 = 2.0 * cos w0 * b0rz+ b2 = (1 - (alpha / a)) * negate b0rz+ in (a0, negate b1, a2, b1, b2)++-- | Calculate coefficients for bi-quad low shelf filter.+bLowShelfCoef :: Floating t => t -> t -> t -> t -> Beq t+bLowShelfCoef sr freq rs db =+ let a = 10 ** (db / 40)+ w0 = pi * 2 * freq * (1 / sr)+ cos_w0 = cos w0+ sin_w0 = sin w0+ alpha = sin_w0 * 0.5 * sqrt ((a + recip a) * (rs - 1) + 2.0)+ i = (a + 1) * cos_w0+ j = (a - 1) * cos_w0+ k = 2 * sqrt a * alpha+ b0rz = recip ((a + 1) + j + k)+ a0 = a * ((a + 1) - j + k) * b0rz+ a1 = 2 * a * ((a - 1) - i) * b0rz+ a2 = a * ((a + 1) - j - k) * b0rz+ b1 = 2.0 * ((a - 1) + i) * b0rz+ b2 = ((a + 1) + j - k) * negate b0rz+ in (a0, a1, a2, b1, b2)++-- | Calculate coefficients for bi-quad high shelf filter.+bHiShelfCoef :: Floating t => t -> t -> t -> t -> Beq t+bHiShelfCoef sr freq rs db =+ let a = 10 ** (db / 40)+ w0 = pi * 2 * freq * (1 / sr)+ cos_w0 = cos w0+ sin_w0 = sin w0+ alpha = sin_w0 * 0.5 * sqrt ((a + recip a) * (rs - 1) + 2.0)+ i = (a + 1) * cos_w0+ j = (a - 1) * cos_w0+ k = 2 * sqrt a * alpha+ b0rz = recip ((a + 1) - j + k)+ a0 = a * ((a + 1) + j + k) * b0rz+ a1 = -2.0 * a * ((a - 1) + i) * b0rz+ a2 = a * ((a + 1) + j - k) * b0rz+ b1 = -2.0 * ((a - 1) - i) * b0rz+ b2 = ((a + 1) - j - k) * negate b0rz+ in (a0, a1, a2, b1, b2)
+ Sound/Sc3/Common/Math/Interpolate.hs view
@@ -0,0 +1,143 @@+{- | Interpolation functions, ie. for envelope segments.+Present naming is for qualified import.+-}+module Sound.Sc3.Common.Math.Interpolate where++import qualified Sound.Sc3.Common.Math as Math {- hsc3 -}++{- | An interpolation function takes three arguments.+ x0 is the left or begin value, x1 is the right or end value, t is a (0,1) index.+-}+type Interpolation_f t = t -> t -> t -> t++{- | Clip x to (0,1) and run f.++>>> interpolate linear (-1,1) 0.5+0.0+-}+interpolate :: (Num t, Ord t) => Interpolation_f t -> (t, t) -> t -> t+interpolate f (l, r) x = if x < 0 then l else if x > 1 then r else f l r x++-- | Step function, ignores t and returns x1.+step :: Interpolation_f t+step _ x1 _ = x1++{- | Linear interpolation funtion.++>>> map (linear 1 10) [0,0.25 .. 1]+[1.0,3.25,5.5,7.75,10.0]++> import Sound.Sc3.Plot {\- hsc3-plot -\}+> plot_fn_r1_ln (linear (-1) 1) (0,1)+-}+linear :: Num t => Interpolation_f t+linear x0 x1 t = t * (x1 - x0) + x0++{- | Exponential interpolation.+ x0 must not be zero and (x0,x1) must not span zero.++> plot_fn_r1_ln [exponential 0.001 1] (0,1)+> plot_fn_r1_ln [exponential 1 2] (0,1)+> plot_fn_r1_ln [exponential 20 20000] (0,1)+-}+exponential :: Floating t => Interpolation_f t+exponential x0 x1 t = x0 * ((x1 / x0) ** t)++{- | Variant that allows x0 to be zero, though (x0,x1) must not span zero.++> plot_fn_r1_ln [exponential_0 0 1] (0,1)+> plot_fn_r1_ln [exponential_0 0 (-1)] (0,1)+-}+exponential_0 :: (Eq t, Floating t) => Interpolation_f t+exponential_0 x0 x1 =+ let epsilon = 1e-6+ x0' = if x0 == 0 then epsilon * signum x1 else x0+ in exponential x0' x1++{- | 'linear' of 'exponential_0' of (0,1), ie. allows (x0,x1) to span zero.++> plot_fn_r1_ln [exponential_lin (-1) 1] (0,1)+-}+exponential_lin :: (Eq t, Floating t) => Interpolation_f t+exponential_lin x0 x1 t = linear x0 x1 (exponential_0 0 1 t)++{- | 'linear' with t transformed by sine function over (-pi/2,pi/2).++> plot_fn_r1_ln [sine (-1) 1] (0,1)+> plot_fn_r1_ln [sine 1 (-1)] (0,1)+-}+sine :: Floating t => Interpolation_f t+sine x0 x1 t =+ let t' = -cos (pi * t) * 0.5 + 0.5+ in linear x0 x1 t'++{- | If x0 '<' x1 rising sine segment (0,pi/2), else falling segment (pi/2,pi).++> plot_fn_r1_ln [welch (-1) 1] (0,1)+> plot_fn_r1_ln [welch 1 (-1)] (0,1)+-}+welch :: (Ord t, Floating t) => Interpolation_f t+welch x0 x1 t =+ if x0 < x1+ then x0 + (x1 - x0) * sin (Math.half_pi * t)+ else x1 - (x1 - x0) * sin (Math.half_pi - (Math.half_pi * t))++{- | Curvature controlled by single parameter c.+ Zero is 'linear', increasing c approaches 'exponential' and continues past it.+ The value for c at which the curve is close to exponential depends on the range.++> plot_p1_ln (map (\c-> map (curve c (-1) 1) [0,0.01 .. 1]) [-6,-4 .. 6])+> plot_p1_ln (map (\f -> map f [0,0.01 .. 1]) [curve 4.4 1 100,exponential 1 100,curve 4.5 1 100])+> plot_p1_ln (map (\f -> map f [0,0.01 .. 1]) [exponential 20 20000,curve 7 20 20000])+> plot_p1_ln (map (\f -> map f [0,0.01 .. 1]) [fader 0 2,curve 2 0 2])+-}+curve :: (Ord t, Floating t) => t -> Interpolation_f t+curve c x0 x1 t =+ if abs c < 0.0001+ then linear x0 x1 t+ else+ let d = 1 - exp c+ n = 1 - exp (t * c)+ in x0 + (x1 - x0) * (n / d)++{- | Square of 'linear' of 'sqrt' of x0 and x1, therefore neither may be negative.++> plot_fn_r1_ln [squared 0 1] (0,1)+> plot_p1_ln (map (\f -> map f [0,0.01 .. 1]) [curve 2.05 0 1,squared 0 1])+-}+squared :: Floating t => Interpolation_f t+squared x0 x1 t =+ let x0' = sqrt x0+ x1' = sqrt x1+ l = linear x0' x1' t+ in l * l++{- | Cubic variant of 'squared'.++> plot_fn_r1_ln [cubed 0 1] (0,1)+> plot_p1_ln (map (\f -> map f [0,0.01 .. 1]) [curve 3.25 0 1,cubed 0 1])+-}+cubed :: Floating t => Interpolation_f t+cubed x0 x1 t =+ let x0' = x0 ** (1 / 3)+ x1' = x1 ** (1 / 3)+ l = linear x0' x1' t+ in l * l * l++{- | x0 until end, then immediately x1.++> plot_fn_r1_ln [hold 0 1] (0,2)+-}+hold :: (Num t, Ord t) => Interpolation_f t+hold x0 x1 t = if t >= 1 then x1 else x0++{- | Fader curve, equal to 'squared' when x1 > x0.++> plot_p1_ln (map (\f -> map f [0,0.01 .. 1]) [squared 0 1,fader 0 1])+> plot_p1_ln (map (\f -> map f [0,0.01 .. 1]) [curve 2 1 0,fader 1 0])+-}+fader :: (Num t, Ord t) => Interpolation_f t+fader x0 x1 t =+ let rng = x1 - x0+ sqr i = i * i+ in sqr (if rng > 0 then t else 1 - (1 - t)) * rng + x0
+ Sound/Sc3/Common/Math/Noise.hs view
@@ -0,0 +1,51 @@+-- | Noise generating functions.+module Sound.Sc3.Common.Math.Noise where++import Sound.Sc3.Common.Math {- hsc3 -}++-- | x(n+1) = a - b * sqrt(|x(n)|)+cusp_f :: Floating t => t -> t -> t -> t+cusp_f a b x = a - (b * sqrt (abs x))++{- | x(n+1) = sin(im * y(n) + fb * x(n))+ y(n+1) = (a * y(n) + c) % 2pi+-}+fbSine_f :: (Floating t, RealFrac t) => t -> t -> t -> t -> (t, t) -> (t, t)+fbSine_f im fb a c (x, y) = (sin ((im * y) + (fb * x)), ((a * y) + c) `sc3_mod` (2 * pi))++-- | x(n+2) = 1 - a * x(n+1)^2 + b * x(n)+henon_f :: Floating t => t -> t -> (t, t) -> (t, t)+henon_f a b (x1, x0) = (1 - (a * (x1 ** 2)) + (b * x0), x1)++{- | x(n+1) = sin(b * y(n)) + c * sin(b * x(n))+ y(n+1) = sin(a * x(n)) + d * sin(a * y(n))+-}+latoocarfian_f :: Floating t => t -> t -> t -> t -> (t, t) -> (t, t)+latoocarfian_f a b c d (x, y) = (sin (b * y) + (c * sin (b * x)), sin (a * x) + (d * sin (a * y)))++-- | x(n+1) = (a * x(n) + c) % m+linCong_f :: RealFrac t => t -> t -> t -> t -> t+linCong_f a c m x = (a * x + c) `sc3_mod` m++-- | x(n+1) = a * x * (1.0 - x)+logistic_f :: Num t => t -> t -> t+logistic_f a x = a * x * (1 - x)++{- | x' = s * (y - x)+ y' = x * (r - z) - y+ z' = x * y - b * z+-}+lorenz_f :: Num t => t -> t -> t -> (t, t, t) -> (t, t, t)+lorenz_f s r b (x, y, z) = (s * (y - x), x * (r - z) - y, x * y - b * z)++-- | x(n+1) = a * x(n)^2 + b * x(n) + c+quad_f :: Floating t => t -> t -> t -> t -> t+quad_f a b c x = (a * (x ** 2)) + (b * x) + c++{- | x(n+1) = (x(n) + y(n+1)) % 2pi+ y(n+1) = (y(n) + k * sin(x(n))) % 2pi+-}+standard_f :: (RealFrac t, Floating t) => t -> (t, t) -> (t, t)+standard_f k (x, y) =+ let y' = (y + (k * sin x)) `sc3_mod` two_pi+ in ((x + y') `sc3_mod` two_pi, y')
+ Sound/Sc3/Common/Math/Operator.hs view
@@ -0,0 +1,557 @@+{- | Non-standard mathematical enumerations, classes and base instances.++Enumerations of the unary and binary math unit generators.+Names that conflict with existing names have a @_@ suffix.++The Eq and Ord classes in the Prelude require Bool, hence EqE and OrdE.+True is 1.0, False is 0.0++The RealFrac class requires Integral results, hence RealFracE.+-}+module Sound.Sc3.Common.Math.Operator where++import Control.Monad {- base -}+import qualified Data.Fixed as F {- base -}+import Data.Int {- base -}+import Data.Maybe {- base -}++import qualified Sound.Sc3.Common.Base as Base {- hsc3 -}+import qualified Sound.Sc3.Common.Math as Math {- hsc3 -}++-- * Unary++{- | Enumeration of @Sc3@ unary operator Ugens.+ The names here are from the enumeration at "server/plugins/UnaryOpUgens.cpp".+ The capitalisation is edited since these names become function names in rsc3.+ Names have a _ suffix if they conflict with Ugen names.++> zip (map show [minBound :: Sc3_Unary_Op .. maxBound]) [0..]+-}+data Sc3_Unary_Op+ = OpNeg -- -+ | OpNot -- !+ | OpIsNil+ | OpNotNil+ | OpBitNot+ | OpAbs -- 5+ | OpAsFloat+ | OpAsInt+ | OpCeil -- 8+ | OpFloor -- 9+ | OpFrac -- 10+ | OpSign -- 11+ | OpSquared -- 12+ | OpCubed -- 13+ | OpSqrt -- 14+ | OpExp -- 15+ | OpRecip -- 16+ | OpMidiCps -- 17+ | OpCpsMidi -- 18+ | OpMidiRatio -- 19+ | OpRatioMidi -- 20+ | OpDbAmp -- 21+ | OpAmpDb -- 22+ | OpOctCps+ | OpCpsOct+ | OpLog -- 25 (natural, base e)+ | OpLog2 -- 26 (base 2)+ | OpLog10 -- 27 (base 10)+ | OpSin -- 28+ | OpCos -- 29+ | OpTan -- 30+ | OpArcSin+ | OpArcCos+ | OpArcTan+ | OpSinh+ | OpCosh -- 35+ | OpTanh -- 36+ | OpRand_ -- 37 ; Ugen+ | OpRand2+ | OpLinRand_ -- 39 ; Ugen+ | OpBiLinRand -- 40+ | OpSum3Rand+ | OpDistort -- 42+ | OpSoftClip -- 43+ | OpCoin+ | OpDigitValue -- 45+ | OpSilence -- 46+ | OpThru -- 47+ | OpRectWindow -- 48+ | OpHanWindow -- 49+ | OpWelchWindow -- 50+ | OpTriWindow+ | OpRamp_ -- 52 ; Ugen+ | OpScurve+ deriving (Eq, Show, Enum, Bounded, Read)++-- | Enum name without Op prefix.+sc3_unary_op_name :: Sc3_Unary_Op -> String+sc3_unary_op_name = drop 2 . show++{- | 'Base.parse_enum' with Op prefix.++>>> Data.Maybe.mapMaybe (parse_unary Base.Cs) (words "Abs Rand")+[OpAbs]+-}+parse_unary :: Base.Case_Rule -> String -> Maybe Sc3_Unary_Op+parse_unary cr = Base.parse_enum cr . (++) "Op"++{- | Table of operator names (non-symbolic) and indices.++> map fst sc3_unary_op_tbl+-}+sc3_unary_op_tbl :: [(String, Int)]+sc3_unary_op_tbl = zip (map sc3_unary_op_name [minBound .. maxBound]) [0 ..]++-- | Table of symbolic names for standard unary operators.+unary_sym_tbl :: [(Sc3_Unary_Op, String)]+unary_sym_tbl = [] -- (Neg,"-"),(Not,"!")++-- | Lookup possibly symbolic name for standard unary operators.+unaryName :: Int -> String+unaryName n =+ let e = toEnum n+ in fromMaybe (sc3_unary_op_name e) (lookup e unary_sym_tbl)++{- | Given name of unary operator derive index.++>>> Data.Maybe.mapMaybe (unaryIndex Base.Ci) (words "abs Cubed midiCps Neg")+[5,13,17,0]++>>> unaryIndex Base.Cs "SinOsc"+Nothing+-}+unaryIndex :: Base.Case_Rule -> String -> Maybe Int+unaryIndex cr nm =+ let ix = Base.rlookup_str cr nm unary_sym_tbl+ ix' = parse_unary cr nm+ in fmap fromEnum (mplus ix' ix)++{- | 'isJust' of 'unaryIndex'.++>>> map (is_unary Base.Ci) (words "Abs MidiCps Neg")+[True,True,True]++>>> map (is_unary Base.Ci) (words "- rand")+[False,False]++>>> map (is_unary Base.Ci) (words "arctan atan")+[True,False]+-}+is_unary :: Base.Case_Rule -> String -> Bool+is_unary cr = isJust . unaryIndex cr++-- * Binary++{- | Enumeration of @Sc3@ unary operator Ugens.+The names here are from the enumeration at "server/plugins/BinaryOpUgens.cpp".++> zip (map show [minBound :: Sc3_Binary_Op .. maxBound]) [0..]+-}+data Sc3_Binary_Op+ = OpAdd -- 0+ | OpSub -- 1+ | OpMul -- 2+ | OpIdiv -- 3+ | OpFdiv -- 4+ | OpMod -- 5+ | OpEq -- 6+ | OpNe -- 7+ | OpLt -- 8+ | OpGt -- 9+ | OpLe -- 10+ | OpGe -- 11+ | OpMin -- 12+ | OpMax -- 13+ | OpBitAnd -- 14+ | OpBitOr -- 15+ | OpBitXor+ | OpLcm -- 17+ | OpGcd -- 18+ | OpRoundTo -- 19 -- i.e. roundTo: (renamed)+ | OpRoundUp -- 20+ | OpTrunc -- 21+ | OpAtan2 -- 22+ | OpHypot -- 23+ | OpHypotx+ | OpPow -- 25+ | OpShiftLeft -- 26+ | OpShiftRight -- 27+ | OpUnsignedShift+ | OpFill+ | OpRing1 -- 30+ | OpRing2+ | OpRing3+ | OpRing4+ | OpDifSqr+ | OpSumSqr -- 35+ | OpSqrSum+ | OpSqrDif+ | OpAbsDif -- 38+ | OpThresh+ | OpAmClip -- 40+ | OpScaleNeg -- 41+ | OpClip2 -- 42+ | OpExcess+ | OpFold2 -- 44+ | OpWrap2 -- 45+ | OpFirstArg -- 46+ | OpRandRange -- 47+ | OpExpRandRange -- 48+ deriving (Eq, Show, Enum, Bounded, Read)++-- | Enum name without Op prefix.+sc3_binary_op_name :: Sc3_Binary_Op -> String+sc3_binary_op_name = drop 2 . show++-- | Table of operator names (non-symbolic) and indices.+sc3_binary_op_tbl :: [(String, Int)]+sc3_binary_op_tbl = zip (map sc3_binary_op_name [minBound .. maxBound]) [0 ..]++{- | 'parse_enum' with Op prefix.++>>> parse_binary Base.Ci "mul"+Just OpMul+-}+parse_binary :: Base.Case_Rule -> String -> Maybe Sc3_Binary_Op+parse_binary cr = Base.parse_enum cr . (++) "Op"++-- | Table of symbolic names for standard binary operators.+binary_sym_tbl :: [(Sc3_Binary_Op, String)]+binary_sym_tbl =+ [ (OpAdd, "+")+ , (OpSub, "-")+ , (OpMul, "*")+ , (OpFdiv, "/")+ , (OpMod, "%")+ , (OpEq, "==")+ , (OpNe, "/=") -- or !=+ , (OpLt, "<")+ , (OpGt, ">")+ , (OpLe, "<=")+ , (OpGe, ">=")+ , (OpBitAnd, ".&.") -- or &+ , (OpBitOr, ".|.") -- or |+ , (OpPow, "**")+ ]++{- | Table of operator names (non-symbolic) and indices.++> map fst sc3_binary_op_sym_tbl+-}+sc3_binary_op_sym_tbl :: [(String, Int)]+sc3_binary_op_sym_tbl =+ let f x = fromMaybe (sc3_binary_op_name x) (lookup x binary_sym_tbl)+ in zip (map f [minBound .. maxBound]) [0 ..]++{- | Lookup possibly symbolic name for standard binary operators.++>>> map binaryName [1,2,8,12]+["-","*","<","Min"]+-}+binaryName :: Int -> String+binaryName n =+ let e = toEnum n+ in fromMaybe (sc3_binary_op_name e) (lookup e binary_sym_tbl)++{- | Given name of binary operator derive index.++>>> Data.Maybe.mapMaybe (binaryIndex Base.Ci) (words "* mul ring1 +")+[2,2,30,0]++>>> binaryIndex Base.Ci "sinosc"+Nothing++>>> map (\x -> (x,binaryIndex Base.Ci x)) (map snd binary_sym_tbl)+[("+",Just 0),("-",Just 1),("*",Just 2),("/",Just 4),("%",Just 5),("==",Just 6),("/=",Just 7),("<",Just 8),(">",Just 9),("<=",Just 10),(">=",Just 11),(".&.",Just 14),(".|.",Just 15),("**",Just 25)]+-}+binaryIndex :: Base.Case_Rule -> String -> Maybe Int+binaryIndex cr nm =+ let ix = Base.rlookup_str cr nm binary_sym_tbl+ ix' = parse_binary cr nm+ in fmap fromEnum (mplus ix' ix)++{- | 'isJust' of 'binaryIndex'.++>>> map (is_binary Base.Ci) (words "== > % Trunc max")+[True,True,True,True,True]+-}+is_binary :: Base.Case_Rule -> String -> Bool+is_binary cr = isJust . binaryIndex cr++-- * Operator++-- | Lookup operator name for operator Ugens, else Ugen name.+ugen_operator_name :: String -> Int -> Maybe String+ugen_operator_name nm n =+ case nm of+ "UnaryOpUGen" -> Just (unaryName n)+ "BinaryOpUGen" -> Just (binaryName n)+ _ -> Nothing++{- | Order of lookup: binary then unary.++>>> map (resolve_operator Base.Ci) (words "+ - sub abs max")+[("BinaryOpUGen",Just 0),("BinaryOpUGen",Just 1),("BinaryOpUGen",Just 1),("UnaryOpUGen",Just 5),("BinaryOpUGen",Just 13)]++>>> map (resolve_operator Base.Cs) (words "Abs Add Neg")+[("UnaryOpUGen",Just 5),("BinaryOpUGen",Just 0),("UnaryOpUGen",Just 0)]+-}+resolve_operator :: Base.Case_Rule -> String -> (String, Maybe Int)+resolve_operator cr nm =+ case binaryIndex cr nm of+ Just sp -> ("BinaryOpUGen", Just sp)+ Nothing -> case unaryIndex cr nm of+ Just sp -> ("UnaryOpUGen", Just sp)+ _ -> (nm, Nothing)++-- | Case-insensitive resolve_operator.+resolve_operator_ci :: String -> (String, Maybe Int)+resolve_operator_ci = resolve_operator Base.Ci++-- * Classes++-- | Variant on 'Eq' class, result is of the same type as the values compared.+class (Eq a, Num a) => EqE a where+ equal_to :: a -> a -> a+ equal_to = Math.sc3_eq+ not_equal_to :: a -> a -> a+ not_equal_to = Math.sc3_neq++instance EqE Int+instance EqE Integer+instance EqE Int32+instance EqE Int64+instance EqE Float+instance EqE Double++-- | Variant on Ord class, result is of the same type as the values compared.+class (Ord a, Num a) => OrdE a where+ less_than :: a -> a -> a+ less_than = Math.sc3_lt+ less_than_or_equal_to :: a -> a -> a+ less_than_or_equal_to = Math.sc3_lte+ greater_than :: a -> a -> a+ greater_than = Math.sc3_gt+ greater_than_or_equal_to :: a -> a -> a+ greater_than_or_equal_to = Math.sc3_gte++instance OrdE Int+instance OrdE Integer+instance OrdE Int32+instance OrdE Int64+instance OrdE Float+instance OrdE Double++-- | Variant of 'RealFrac' with non 'Integral' results.+class RealFrac a => RealFracE a where+ properFractionE :: a -> (a, a)+ properFractionE = Math.sc3_properFraction+ truncateE :: a -> a+ truncateE = Math.sc3_truncate+ roundE :: a -> a+ roundE = Math.sc3_round+ ceilingE :: a -> a+ ceilingE = Math.sc3_ceiling+ floorE :: a -> a+ floorE = Math.sc3_floor++instance RealFracE Float+instance RealFracE Double++{- | Unary operator class.++>>> map (floor . (* 1e4) . dbAmp) [-90,-60,-30,0]+[0,10,316,10000]+-}+class (Floating a, Ord a) => UnaryOp a where+ ampDb :: a -> a+ ampDb = Math.amp_to_db+ asFloat :: a -> a+ asFloat = error "asFloat"+ asInt :: a -> a+ asInt = error "asInt"+ cpsMidi :: a -> a+ cpsMidi = Math.cps_to_midi+ cpsOct :: a -> a+ cpsOct = Math.cps_to_oct+ cubed :: a -> a+ cubed n = n * n * n+ dbAmp :: a -> a+ dbAmp = Math.db_to_amp+ distort :: a -> a+ distort = Math.sc3_distort+ frac :: a -> a+ frac = error "frac"+ isNil :: a -> a+ isNil a = if a == 0.0 then 0.0 else 1.0+ log10 :: a -> a+ log10 = logBase 10+ log2 :: a -> a+ log2 = logBase 2+ midiCps :: a -> a+ midiCps = Math.midi_to_cps+ midiRatio :: a -> a+ midiRatio = Math.midi_to_ratio+ notE :: a -> a+ notE a = if a > 0.0 then 0.0 else 1.0+ notNil :: a -> a+ notNil a = if a /= 0.0 then 0.0 else 1.0+ octCps :: a -> a+ octCps = Math.oct_to_cps+ ramp_ :: a -> a+ ramp_ _ = error "ramp_"+ ratioMidi :: a -> a+ ratioMidi = Math.ratio_to_midi+ softClip :: a -> a+ softClip = Math.sc3_softclip+ squared :: a -> a+ squared = \z -> z * z++instance UnaryOp Float+instance UnaryOp Double++-- | Sc3_Binary_Op operator class.+class (Floating a, RealFrac a, Ord a) => BinaryOp a where+ absDif :: a -> a -> a+ absDif a b = abs (a - b)+ amClip :: a -> a -> a+ amClip a b = if b <= 0 then 0 else a * b+ atan2E :: a -> a -> a+ atan2E a b = atan (b / a)+ clip2 :: a -> a -> a+ clip2 a b = Math.sc3_clip a (-b) b+ difSqr :: a -> a -> a+ difSqr = Math.sc3_dif_sqr+ excess :: a -> a -> a+ excess a b = a - Math.sc3_clip a (-b) b+ exprandRange :: a -> a -> a+ exprandRange = error "exprandRange"+ fill :: a -> a -> a+ fill = error "fill"+ firstArg :: a -> a -> a+ firstArg a _ = a+ fold2 :: a -> a -> a+ fold2 a b = Math.sc3_fold a (-b) b+ gcdE :: a -> a -> a+ gcdE = Math.sc3_gcd+ hypot :: a -> a -> a+ hypot = Math.sc3_hypot+ hypotx :: a -> a -> a+ hypotx = Math.sc3_hypotx+ iDiv :: a -> a -> a+ iDiv = Math.sc3_idiv+ lcmE :: a -> a -> a+ lcmE = Math.sc3_lcm+ modE :: a -> a -> a+ modE = Math.sc3_mod+ randRange :: a -> a -> a+ randRange = error "randRange"+ ring1 :: a -> a -> a+ ring1 a b = a * b + a+ ring2 :: a -> a -> a+ ring2 a b = a * b + a + b+ ring3 :: a -> a -> a+ ring3 a b = a * a * b+ ring4 :: a -> a -> a+ ring4 a b = a * a * b - a * b * b+ roundUp :: a -> a -> a+ roundUp = error "roundUp"+ scaleNeg :: a -> a -> a+ scaleNeg a b = (abs a - a) * b' + a where b' = 0.5 * b + 0.5+ sqrDif :: a -> a -> a+ sqrDif a b = (a - b) * (a - b)+ sqrSum :: a -> a -> a+ sqrSum a b = (a + b) * (a + b)+ sumSqr :: a -> a -> a+ sumSqr a b = (a * a) + (b * b)+ thresh :: a -> a -> a+ thresh a b = if a < b then 0 else a+ trunc :: a -> a -> a+ trunc = error "trunc"+ wrap2 :: a -> a -> a+ wrap2 = error "wrap2"++instance BinaryOp Float where+ fold2 a b = Math.sc3_fold a (-b) b+ modE = F.mod'+ roundUp a b = if b == 0 then a else ceilingE (a / b + 0.5) * b+ wrap2 a b = Math.sc3_wrap_ni (-b) b a++instance BinaryOp Double where+ fold2 a b = Math.sc3_fold a (-b) b+ modE = F.mod'+ roundUp a b = if b == 0 then a else ceilingE (a / b + 0.5) * b+ wrap2 a b = Math.sc3_wrap_ni (-b) b a++-- * Infix++(==**) :: EqE a => a -> a -> a+(==**) = equal_to++(/=**) :: EqE a => a -> a -> a+(/=**) = not_equal_to++(<**) :: OrdE a => a -> a -> a+(<**) = less_than++(<=**) :: OrdE a => a -> a -> a+(<=**) = less_than_or_equal_to++(>**) :: OrdE a => a -> a -> a+(>**) = greater_than++(>=**) :: OrdE a => a -> a -> a+(>=**) = greater_than_or_equal_to++-- * Tables++-- | Association table for 'Sc3_Binary_Op' to haskell function implementing operator.+binop_hs_tbl :: (Real n, Floating n, RealFrac n) => [(Sc3_Binary_Op, n -> n -> n)]+binop_hs_tbl =+ [ (OpAdd, (+))+ , (OpSub, (-))+ , (OpFdiv, (/))+ , (OpIdiv, Math.sc3_idiv)+ , (OpMod, Math.sc3_mod)+ , (OpEq, Math.sc3_eq)+ , (OpNe, Math.sc3_neq)+ , (OpLt, Math.sc3_lt)+ , (OpLe, Math.sc3_lte)+ , (OpGt, Math.sc3_gt)+ , (OpGe, Math.sc3_gte)+ , (OpMin, min)+ , (OpMax, max)+ , (OpMul, (*))+ , (OpPow, (**))+ , (OpMin, min)+ , (OpMax, max)+ , (OpRoundTo, Math.sc3_round_to)+ ]++-- | 'lookup' 'binop_hs_tbl' via 'toEnum'.+binop_special_hs :: (RealFrac n, Floating n) => Int -> Maybe (n -> n -> n)+binop_special_hs z = lookup (toEnum z) binop_hs_tbl++-- | Association table for 'Unary' to haskell function implementing operator.+uop_hs_tbl :: (RealFrac n, Floating n) => [(Sc3_Unary_Op, n -> n)]+uop_hs_tbl =+ [ (OpNeg, negate)+ , (OpNot, \z -> if z > 0 then 0 else 1)+ , (OpAbs, abs)+ , (OpCeil, Math.sc3_ceiling)+ , (OpFloor, Math.sc3_floor)+ , (OpSquared, \z -> z * z)+ , (OpCubed, \z -> z * z * z)+ , (OpSqrt, sqrt)+ , (OpRecip, recip)+ , (OpMidiCps, Math.midi_to_cps)+ , (OpCpsMidi, Math.cps_to_midi)+ , (OpSin, sin)+ , (OpCos, cos)+ , (OpTan, tan)+ ]++-- | 'lookup' 'uop_hs_tbl' via 'toEnum'.+uop_special_hs :: (RealFrac n, Floating n) => Int -> Maybe (n -> n)+uop_special_hs z = lookup (toEnum z) uop_hs_tbl
+ Sound/Sc3/Common/Math/Warp.hs view
@@ -0,0 +1,145 @@+-- | A warp is a mapping from the space @[0,1]@ to a user defined space @[l,r]@.+module Sound.Sc3.Common.Math.Warp where++import Numeric {- base -}++import qualified Sound.Sc3.Common.Math as Math {- hsc3 -}++-- | A warp function is lhs -> rhs -> x -> y+type Warp_f t = t -> t -> t -> t++{- | Linear real value map.++>>> map (warp_lin 1 2) [0,1/2,1] == [1,3/2,2]+True++>>> map (warp_lin (-1) 1) [0,1/2,1] == [-1,0,1]+True+-}+warp_lin :: Fractional t => Warp_f t+warp_lin l r n = let z = r - l in n * z + l++{- | Inverse of 'warp_lin'++>>> map (warp_lin_inv 1 2) [1,3/2,2] == [0,1/2,1]+True++>>> map (warp_lin_inv (-1) 1) [-1,0,1] == [0,1/2,1]+True+-}+warp_lin_inv :: Fractional t => Warp_f t+warp_lin_inv l r n = let z = r - l in (n - l) / z++{- | The left and right must both be non zero and have the same sign.++>>> map (warp_exp 1 2) [0,0.5,1] == [1,2 ** 0.5,2]+True++> import Sound.Sc3.Plot {\- hsc3-plot -\}+> plot_p1_ln [map (warp_exp 1 2) [0,0.01 .. 1]]+-}+warp_exp :: Floating a => Warp_f a+warp_exp l r n = let z = r / l in (z ** n) * l++warp_exp_inv :: Floating a => Warp_f a+warp_exp_inv l r n = let z = r / l in logBase z (n / l)++{- | Cosine warp++> map (warp_cos 1 2) [0,0.25,0.5,0.75,1]+> plot_p1_ln [map (warp_cos 1 2) [0,0.01 .. 1]]+-}+warp_cos :: Floating t => Warp_f t+warp_cos l r n = warp_lin 0 (r - l) (0.5 - (cos (pi * n) / 2))++warp_cos_inv :: Floating a => Warp_f a+warp_cos_inv l r n = acos (1.0 - (warp_lin_inv 0 (r - l) n * 2)) / pi++{- | Sine warp++> map (warp_sin 1 2) [0,0.25,0.5,0.75,1]+> plot_p1_ln [map (warp_sin 1 2) [0,0.01 .. 1]]+-}+warp_sin :: Floating t => Warp_f t+warp_sin l r n = warp_lin 0 (r - l) (sin (pi * 0.5 * n))++warp_sin_inv :: Floating t => Warp_f t+warp_sin_inv l r n = asin (warp_lin_inv 0 (r - l) n) / (pi / 2)++{- | Fader warp. Left and right values are ordinarily zero and one.++> map (warp_amp 0 1) [0,0.5,1] == [0,0.25,1]++> plot_p1_ln [map (warp_amp 0 2) [0,0.01 .. 1]]+> plot_p1_ln [map (warp_amp_inv 0 1 . warp_amp 0 1) [0,0.01 .. 1]]+-}+warp_amp :: Num a => Warp_f a+warp_amp l r n = (n * n) * (r - l) + l++warp_amp_inv :: Floating a => Warp_f a+warp_amp_inv l r n = sqrt ((n - l) / (r - l))++{- | DB fader warp. Left and right values are ordinarily negative+infinity and zero. An input of @0@ gives @-180@.++> map (round . warp_db (-180) 0) [0,0.5,1] == [-180,-12,0]++> plot_p1_ln [map (warp_db (-60) 0) [0,0.01 .. 1]]+> plot_p1_ln [map (warp_db_inv 0 60) [0 .. 60]]+-}+warp_db :: (Eq a, Floating a) => Warp_f a+warp_db l r n =+ let n' = if n == 0 then -180 else Math.amp_to_db (n * n)+ in Math.sc3_linlin n' (-180) 0 l r++warp_db_inv :: Floating a => Warp_f a+warp_db_inv l r n = sqrt (Math.db_to_amp (Math.sc3_linlin n l r (-180) 0))++{- | A curve warp given by a real /n/.++> warp_curve (-3) 1 2 0.25 == 1.5552791692202022+> warp_curve (-3) 1 2 0.50 == 1.8175744761936437++> plot_p1_ln [map (warp_curve (-3) 1 2) [0,0.01 .. 1]]+> plot_p1_ln (map (\c -> map (warp_curve c 1 2) [0,0.01 .. 1]) [0,3,6,9])+> plot_p1_ln [map (warp_curve_inv 7 20 20000 . warp_curve 7 20 20000) [0,0.01 .. 1]]+-}+warp_curve :: (Ord a, Floating a) => a -> Warp_f a+warp_curve k l r n =+ if abs k < 0.001+ then warp_lin l r n+ else+ let e = exp k+ a = (r - l) / (1 - e)+ b = l + a+ in b - ((e ** n) * a)++warp_curve_inv :: (Ord a, Floating a) => a -> Warp_f a+warp_curve_inv k l r n =+ if abs k < 0.001+ then warp_lin l r n+ else+ let e = exp k+ a = (r - l) / (1 - e)+ b = l + a+ in log ((b - n) / a) / k++{- | Select warp functions by name. Numerical names are interpreted as /curve/ values for 'warpCurve'.++> let Just w = warp_named "lin"+> let Just w = warp_named "-3"+> let Just w = warp_named "6"+> plot_p1_ln [map ((fst w) 1 2) [0,0.01 .. 1]]+-}+warp_named :: (Floating t, RealFrac t) => String -> Maybe (Warp_f t, Warp_f t)+warp_named nm =+ case nm of+ "lin" -> Just (warp_lin, warp_lin_inv)+ "exp" -> Just (warp_exp, warp_exp_inv)+ "sin" -> Just (warp_sin, warp_sin_inv)+ "cos" -> Just (warp_cos, warp_cos_inv)+ "amp" -> Just (warp_amp, warp_amp_inv)+ "db" -> Just (warp_db, warp_db_inv)+ _ -> case readSigned readFloat nm of+ [(c, "")] -> Just (warp_curve c, warp_curve_inv c)+ _ -> Nothing
+ Sound/Sc3/Common/Math/Window.hs view
@@ -0,0 +1,105 @@+-- | Windowing functions.+module Sound.Sc3.Common.Math.Window where++-- * Type and conversion++-- | A function from a (0, 1) normalised input to an output.+type Window x = x -> x++-- | A discrete rendering of a 'Window'.+type Table x = [x]++{- | Format for table.+ Closed indicates the end point should be equal to the start point.+ Open indicates it should be one place short.+ Guarded indicates that an extra place should be added that closes the table, ie. the table has one place more than requested.+ When using a table with an oscillator we want an Open or Guarded table, since the point following the end point is the start point.+-}+data TableFormat = TableClosed | TableOpen | TableGuarded deriving (Eq, Show)++{- | Generate an /n/ element table from a (0, 1) normalised window function /f/.+ The cycle argument decides if the end point should be equal to the start point, or one place short.+ When using a table with an oscillator we want the latter, since the point following the end point is the start point.+-}+window_table :: (Integral n, Fractional a, Enum a) => TableFormat -> n -> Window a -> Table a+window_table fmt n f =+ let k = 1 / (fromIntegral n - (if fmt == TableClosed then 1 else 0))+ in take (fromIntegral (if fmt == TableGuarded then n + 1 else n)) (map f [0, k ..])++-- | window_table of TableClosed.+window_table_closed :: (Integral n, Fractional a, Enum a) => n -> Window a -> Table a+window_table_closed = window_table TableClosed++-- * Math++-- | /n/ ^ 2.+square :: Num a => a -> a+square x = x * x++-- * Window functions++-- | Gaussian window, θ <= 0.5.+gaussian :: Floating a => a -> Window a+gaussian theta i = exp (-(0.5 * square ((i - 0.5) / (theta * 0.5))))++-- | Hann raised cosine window.+hann :: Floating a => Window a+hann i = 0.5 * (1 - cos (2 * pi * i))++-- | Hamming raised cosine window.+hamming :: Floating a => Window a+hamming i = 0.54 - 0.46 * cos (2 * pi * i)++-- | Unit ('id') window, also known as a Dirichlet window.+rectangular :: Window a+rectangular = id++-- | 'sin' window.+sine :: Floating a => Window a+sine i = sin (i * pi)++{- | Triangular window, ie. Bartlett window with zero end-points.++> let n = 2 ^ 7+> Sound.Sc3.Plot.plot_p1_ln (map (\fmt -> window_table fmt n triangular) [TableClosed, TableOpen])+> Sound.Sc3.Plot.plot_p1_ln (map (\fmt -> window_table fmt n triangular) [TableClosed, TableGuarded])+-}+triangular :: Fractional a => Window a+triangular i = 2 * (0.5 - abs (i - 0.5))++-- * Tables++{- | 'window_table_closed' . 'gaussian'.++> Sound.Sc3.Plot.plot_p1_ln [gaussian_table 1024 0.25, gaussian_table 1024 0.5]+-}+gaussian_table :: (Integral n, Floating b, Enum b) => n -> b -> [b]+gaussian_table n = window_table_closed n . gaussian++{- | 'window_table_closed' . 'hamming'.++> Sound.Sc3.Plot.plot_p1_ln [hann_table 128, hamming_table 128]+-}+hamming_table :: Int -> [Double]+hamming_table n = window_table_closed n hamming++{- | 'window_table_closed' . 'hann'.++> Sound.Sc3.Plot.plot_p1_ln [hann_table (2 ^ 7)]+-}+hann_table :: Int -> [Double]+hann_table n = window_table_closed n hann++{- | 'window_table_closed' . 'sine'.++> Sound.Sc3.Plot.plot_p1_ln [sine_table (2 ^ 7)]+-}+sine_table :: (Integral n, Floating b, Enum b) => n -> [b]+sine_table n = window_table_closed n sine++{- | 'window_table_closed' . 'triangular'.++> Sound.Sc3.Plot.plot_p1_ln [triangular_table (2 ^ 8)]+-}+triangular_table :: (Integral n, Fractional b, Enum b) => n -> [b]+triangular_table n = window_table_closed n triangular
+ Sound/Sc3/Common/Mce.hs view
@@ -0,0 +1,174 @@+-- | The Sc3 multiple channel expansion (Mce) rules over an abstract type.+module Sound.Sc3.Common.Mce where++import qualified Sound.Sc3.Common.Base {- hsc3 -}++{- | Multiple channel expansion.+The Mce type is a tree, however in hsc3 Mce_Vector will always hold Mce_Scalar elements.+-}+data Mce t = Mce_Scalar t | Mce_Vector [Mce t]+ deriving (Ord, Eq, Read, Show)++{- | There are two invariants:+1. Mce should not be empty, ie. Mce_Vector should not have a null list.+2. Scalar Mce values should not be written as one-place vectors.++>>> mce_is_well_formed (Mce_Vector [])+False++>>> mce_is_well_formed (Mce_Vector [Mce_Scalar 1])+False+-}+mce_is_well_formed :: Mce t -> Bool+mce_is_well_formed m =+ case m of+ Mce_Scalar _ -> True+ Mce_Vector v -> length v > 1 && all mce_is_well_formed v++-- | Is Mce scalar.+mce_is_scalar :: Mce t -> Bool+mce_is_scalar m =+ case m of+ Mce_Scalar _ -> True+ _ -> False++-- | fromList for Mce, generates well-formed Mce.+mce_from_list :: [t] -> Mce t+mce_from_list l =+ case l of+ [] -> error "mce_from_list: null?"+ [e] -> Mce_Scalar e+ _ -> Mce_Vector (map Mce_Scalar l)++{- | toList for Mce.++>>> let v = Mce_Vector+>>> mce_to_list (v[v[1, 2], 3, v[4, 5]])+[1,2,3,4,5]+-}+mce_to_list :: Mce t -> [t]+mce_to_list m =+ case m of+ Mce_Scalar e -> [e]+ Mce_Vector e -> concatMap mce_to_list e++{- | Pretty printer for Mce.++>>> let v = Mce_Vector+>>> mce_show (v[1, 2, v[3, 4]] * 5 + v[6, 7, 8])+"[11, 17, [23, 28]]"+-}+mce_show :: Show t => Mce t -> String+mce_show m =+ let bracketed (l, r) x = l : x ++ [r]+ in case m of+ Mce_Scalar e -> show e+ Mce_Vector e -> bracketed ('[', ']') (Sound.Sc3.Common.Base.concat_intersperse ", " (map mce_show e))++-- | Read value from Mce_Scalar, error if Mce is Mce_Vector+mce_scalar_value :: Mce t -> t+mce_scalar_value m =+ case m of+ Mce_Scalar x -> x+ Mce_Vector _ -> error "mce_scalar_value: not Mce_Scalar"++{- | Length, or perhaps rather width, of Mce.+Considers only the outermost level, i.e. mce_length is not necessarily the length of mce_to_list.+-}+mce_length :: Mce a -> Int+mce_length m =+ case m of+ Mce_Scalar _ -> 1+ Mce_Vector e -> length e++{- | The depth of an Mce is the longest sequence of nested Mce_Vector nodes.++>>> mce_depth 1+1++>>> mce_depth (Mce_Vector [1, 2])+1++>>> let v = Mce_Vector+>>> mce_depth (v[v[1, 2], 3, v[4, 5]])+2++>>> mce_depth (v[v[1, 2, 3, v[4, 5], 6], 7])+3+-}+mce_depth :: Mce a -> Int+mce_depth m =+ case m of+ Mce_Scalar _ -> 1+ Mce_Vector v -> if all mce_is_scalar v then 1 else 1 + maximum (map mce_depth v)++{- | Extend Mce to specified degree.+Considers only the outermost level.+-}+mce_extend :: Int -> Mce t -> Mce t+mce_extend n m =+ case m of+ Mce_Scalar _ -> Mce_Vector (replicate n m)+ Mce_Vector e -> if length e > n then error "mce_extend?" else Mce_Vector (take n (cycle e))++-- | fmap for Mce, apply /f/ at elements of /m/.+mce_map :: (a -> b) -> Mce a -> Mce b+mce_map f m =+ case m of+ Mce_Scalar e -> Mce_Scalar (f e)+ Mce_Vector e -> Mce_Vector (map (mce_map f) e)++instance Functor Mce where fmap = mce_map++{- | Apply /f/ pairwise at elements of /m1/ and /m2/.+ At each level this extends the shorter of the two operands.+-}+mce_binop :: (a -> b -> c) -> Mce a -> Mce b -> Mce c+mce_binop f m1 m2 =+ case (m1, m2) of+ (Mce_Scalar e1, Mce_Scalar e2) -> Mce_Scalar (f e1 e2)+ (Mce_Scalar _, Mce_Vector e2) -> Mce_Vector (map (mce_binop f m1) e2)+ (Mce_Vector e1, Mce_Scalar _) -> Mce_Vector (map (flip (mce_binop f) m2) e1)+ (Mce_Vector e1, Mce_Vector e2) ->+ let n = max (length e1) (length e2)+ ext = take n . cycle+ in Mce_Vector (zipWith (mce_binop f) (ext e1) (ext e2))++instance Num n => Num (Mce n) where+ (+) = mce_binop (+)+ (-) = mce_binop (-)+ (*) = mce_binop (*)+ abs = mce_map abs+ negate = mce_map negate+ signum = mce_map signum+ fromInteger = Mce_Scalar . fromInteger++instance Fractional n => Fractional (Mce n) where+ (/) = mce_binop (/)+ fromRational = Mce_Scalar . fromRational++instance Floating n => Floating (Mce n) where+ pi = Mce_Scalar pi+ exp = fmap exp+ log = fmap log+ sqrt = fmap sqrt+ (**) = mce_binop (**)+ logBase = mce_binop logBase+ sin = fmap sin+ cos = fmap cos+ asin = fmap asin+ acos = fmap acos+ atan = fmap atan+ sinh = fmap sinh+ cosh = fmap cosh+ asinh = fmap asinh+ acosh = fmap acosh+ atanh = fmap atanh++{-++If Ugen is any of Functor, Foldable, Traversable, then Mce must be as well.++{-# Language DeriveFunctor, DeriveFoldable, DeriveTraversable #-}++-}
+ Sound/Sc3/Common/Monad.hs view
@@ -0,0 +1,32 @@+-- | Common 'Control.Monad' variations.+module Sound.Sc3.Common.Monad where++-- | 'sequence' of 'repeat'+repeatM :: Monad m => m t -> m [t]+repeatM = sequence . repeat++-- | This is the same function as Control.Monad.void, which however hugs does not know of.+mvoid :: Monad m => m a -> m ()+mvoid f = f >> return ()++-- | 'void' of 'repeatM'.+repeatM_ :: Monad m => m t -> m ()+repeatM_ = mvoid . repeatM++{- | Right to left compositon of 'Monad' functions.++>>> composeM [return . (+ 1),return . (* 2)] 3+7++>>> composeM [return . (* 2),return . (+ 1)] 3+8+-}+composeM :: Monad m => [a -> m a] -> a -> m a+composeM = foldr (\f g -> \x -> g x >>= f) return -- foldr (<=<) return except hugs doesn't know of <=<++{- | Feed forward composition of /n/ applications of /f/.++> fmap (== 3) (chainM 3 (return . (+ 1)) 0)+-}+chainM :: Monad m => Int -> (b -> m b) -> b -> m b+chainM n f = composeM (replicate n f)
+ Sound/Sc3/Common/Monad/Operators.hs view
@@ -0,0 +1,133 @@+-- | Functions to make writing 'Applicative' and 'Monad' Ugen graphs less clumsy.+module Sound.Sc3.Common.Monad.Operators where++infixl 7 .*, *., .*.+infixl 6 .+, +., .+.++infixl 7 ./, /., ./.+infixl 6 .-, -., .-.++{- | '+' variant with 'Functor' at left.++>>> fmap (== 5) (return 3 .+ 2)+True++>>> [3,4] .+ 2+[5,6]+-}+(.+) :: (Functor f, Num a) => f a -> a -> f a+m .+ n = fmap (+ n) m++{- | '+' variant with 'Functor' at right.++>>> fmap (== 5) (3 +. return 2)+True++>>> 3 +. [2,3]+[5,6]+-}+(+.) :: (Functor f, Num a) => a -> f a -> f a+m +. n = fmap (+ m) n++{- | '+' variant with 'Applicative' at left and right.++>>> fmap (== 5) (return 3 .+. return 2)+True++>>> [3,4] .+. [2,3]+[5,6,6,7]++>>> import Control.Applicative+>>> getZipList (ZipList [3,4] .+. ZipList [2,3])+[5,7]+-}+(.+.) :: (Applicative m, Num a) => m a -> m a -> m a+(.+.) = liftA2 (+)++{- | '*' variant with 'Functor' at left.++>>> fmap (== 6) (return 3 .* 2)+True+-}+(.*) :: (Functor f, Num a) => f a -> a -> f a+m .* n = fmap (* n) m++{- | '*' variant with 'Functor' at right.++>>> fmap (== 6) (3 *. return 2)+True+-}+(*.) :: (Functor f, Num a) => a -> f a -> f a+m *. n = fmap (* m) n++{- | '*' variant with 'Applicative' at left and right.++>>> fmap (== 6) (return 3 .*. return 2)+True+-}+(.*.) :: (Applicative m, Num a) => m a -> m a -> m a+(.*.) = liftA2 (*)++{- | '-' variant with 'Functor' at left.++>>> fmap (== 1) (return 3 .- 2)+True++>>> [3,4] .- 2+[1,2]+-}+(.-) :: (Functor f, Num a) => f a -> a -> f a+m .- n = fmap (subtract n) m++{- | '-' variant with 'Functor' at right.++>>> fmap (== 1) (3 -. return 2)+True++>>> 3 -. [2,3]+[1,0]+-}+(-.) :: (Functor f, Num a) => a -> f a -> f a+m -. n = fmap (m -) n++{- | '-' variant with 'Applicative' at left and right.++>>> fmap (== 1) (return 3 .-. return 2)+True++>>> [3,4] .-. [2,3]+[1,0,2,1]++>>> import Control.Applicative+>>> getZipList (ZipList [3,4] .-. ZipList [2,3])+[1,1]+-}+(.-.) :: (Applicative m, Num a) => m a -> m a -> m a+(.-.) = liftA2 (-)++{- | '/' variant with 'Functor' at left.++>>> fmap (== 3) (return 6 ./ 2)+True+-}+(./) :: (Functor f, Fractional a) => f a -> a -> f a+m ./ n = fmap (/ n) m++{- | '/' variant with 'Functor' at right.++>>> fmap (== 3) (6 /. return 2)+True+-}+(/.) :: (Functor f, Fractional a) => a -> f a -> f a+m /. n = fmap (m /) n++{- | '/' variant with 'Applicative' at left and right.++>>> fmap (== 3) (return 6 ./. return 2)+True++>>> [5,6] ./. [2,3] == [5/2,5/3,3,2]+True+-}+(./.) :: (Applicative m, Fractional a) => m a -> m a -> m a+(./.) = liftA2 (/)
+ Sound/Sc3/Common/Random.hs view
@@ -0,0 +1,56 @@+-- | Linear congruential generator and related utilities. Ordinarily use System.Random.+module Sound.Sc3.Common.Random where++import Data.Bits {- base -}+import Data.Int {- base -}+import Data.Word {- base -}+import System.CPUTime {- base -}++{- | Linear congruential generator given modulo function for type.++See <http://en.wikipedia.org/wiki/Linear_congruential_generator> for possible parameters.+-}+lcg :: Num t => (t -> t) -> t -> t -> t -> t+lcg modFunc a c x0 = modFunc (a * x0 + c)++{- | 'lcg' 6364136223846793005 1442695040888963407, so in (0, 18446744073709551615)++> take 5 (iterate lcgWord64Knuth 147092873413)+> (maxBound :: Word64) == (2 ^ 64 - 1)+-}+lcgWord64Knuth :: Word64 -> Word64+lcgWord64Knuth = lcg id 6364136223846793005 1442695040888963407++{- | 'lcg' 1103515245 12345, so in (-2147483648, 2147483647)++> take 5 (iterate lcgInt32Glibc 873413)+> (minBound :: Int32,maxBound :: Int32) == (-2147483648, 2147483647)+-}+lcgInt32Glibc :: Int32 -> Int32+lcgInt32Glibc = lcg id 1103515245 12345++-- | Run getCPUTime and convert to Word64+cpuTimeSeedWord64 :: IO Word64+cpuTimeSeedWord64 = fmap (fromIntegral . flip div cpuTimePrecision) getCPUTime++-- | Run getCPUTime and convert to Int32+cpuTimeSeedInt32 :: IO Int32+cpuTimeSeedInt32 = fmap (fromIntegral . flip div cpuTimePrecision) getCPUTime++-- | Iterate lcgWord64Knuth using cpuTimeSeedWord64.+lcgWord64KnuthCpuTime :: IO [Word64]+lcgWord64KnuthCpuTime = fmap (iterate lcgWord64Knuth) cpuTimeSeedWord64++{- | Convert Word64 to Double in range (0, 1).+ Shifts input right 11 places (ie. discards 11 least significant bits) then divide by 2^53.+-}+word64ToUnitDouble :: Word64 -> Double+word64ToUnitDouble n = realToFrac (shiftR n 11) / realToFrac (shiftL (1 :: Word64) 53)++{- | word64ToUnitDouble of lcgWord64KnuthCpuTime++> x <- fmap (take 256) lcgDoubleKnuthCpuTime+> Sound.Sc3.Plot.plot_p1_ln [x]+-}+lcgDoubleKnuthCpuTime :: IO [Double]+lcgDoubleKnuthCpuTime = fmap (map word64ToUnitDouble) lcgWord64KnuthCpuTime
+ Sound/Sc3/Common/Rate.hs view
@@ -0,0 +1,92 @@+-- | Operating rate definitions and utilities.+module Sound.Sc3.Common.Rate where++import Data.Char {- base -}+import Data.Maybe {- base -}++-- | Enumeration of operating rates of unit generators.+data Rate = InitialisationRate | ControlRate | AudioRate | DemandRate+ deriving (Eq, Ord, Enum, Bounded, Show, Read)++{- | Standard abbreviations of Rate values.+ir = initialisation, kr = control, ar = audio, dr = demand.+dr sorts to the right of the fixed clock rates.++> Data.List.sort [dr,ar,kr,ir] == [ir,kr,ar,dr]+-}+ir, kr, ar, dr :: Rate+ir = InitialisationRate+kr = ControlRate+ar = AudioRate+dr = DemandRate++{- | Standard SuperCollider rate abbreviations.++> map rateAbbrev [minBound .. maxBound] == ["ir","kr","ar","dr"]+-}+rateAbbrev :: Rate -> String+rateAbbrev rt =+ fromMaybe+ (error "rateAbbrev?")+ (lookup (fromEnum rt) (zip [0 ..] (words "ir kr ar dr")))++{- | Standard SuperCollider rate abbreviations.++> map rateName [minBound .. maxBound] == ["scalar","control","audio","demand"]+-}+rateName :: Rate -> String+rateName rt =+ fromMaybe+ (error "rateName?")+ (lookup (fromEnum rt) (zip [0 ..] (words "scalar control audio demand")))++-- | Integer rate identifier, as required for scsynth bytecode.+rateId :: Rate -> Int+rateId = fromEnum++-- | Color identifiers for each 'Rate'.+rate_color :: Rate -> String+rate_color r =+ case r of+ AudioRate -> "black"+ ControlRate -> "blue"+ InitialisationRate -> "yellow"+ DemandRate -> "red"++-- | Set of all 'Rate' values.+all_rates :: [Rate]+all_rates = [minBound .. maxBound]++{- | Case insensitive parser for rate.++> Data.Maybe.mapMaybe rate_parse (words "ar kR IR Dr") == [AudioRate,ControlRate,InitialisationRate,DemandRate]+-}+rate_parse :: String -> Maybe Rate+rate_parse r =+ case map toUpper r of+ "AR" -> Just AudioRate+ "KR" -> Just ControlRate+ "IR" -> Just InitialisationRate+ "DR" -> Just DemandRate+ _ -> Nothing++-- * Control rates++{- | Enumeration of the four operating rates for controls.+I = initialisation, K = control, T = trigger, A = audio.+-}+data K_Type = K_InitialisationRate | K_ControlRate | K_TriggerRate | K_AudioRate+ deriving (Eq, Show, Ord)++-- | Determine class of control given 'Rate' and /trigger/ status.+ktype :: Rate -> Bool -> K_Type+ktype r tr =+ if tr+ then case r of+ ControlRate -> K_TriggerRate+ _ -> error "ktype: non ControlRate trigger control"+ else case r of+ InitialisationRate -> K_InitialisationRate+ ControlRate -> K_ControlRate+ AudioRate -> K_AudioRate+ DemandRate -> error "ktype: DemandRate control"
+ Sound/Sc3/Common/SoundFile.hs view
@@ -0,0 +1,133 @@+-- | Sound file functions.+module Sound.Sc3.Common.SoundFile where++import System.Environment {- base -}+import System.IO.Unsafe {- base -}+import System.Process {- process -}++import System.Directory {- directory -}+import System.FilePath {- filepath -}++import qualified Sound.Sc3.Common.Base {- hsc3 -}++{- | Find the file fn (case-sensitively) starting from dir.+Runs the system command "find" (so UNIX only).+Note that fn must be a file name not a relative path name.++> findFileFromDirectory "/home/rohan/data/audio" "metal.wav"+-}+findFileFromDirectory :: String -> String -> IO (Maybe String)+findFileFromDirectory dir fn = do+ r <- System.Process.readProcess "find" [dir, "-name", fn] ""+ case lines r of+ [] -> return Nothing+ [r0] -> return (Just r0)+ _ -> error "findFileFromDirectory: multiple files?"++{- | Find the file fn starting from dir.+If dir/fn names a file return that file, else call findFileFromDirectory.+Note this will not find dir/p/q/r given q/r, the query must be either p/q/r or r.++> findFileAtOrFromDirectory "/home/rohan/data/audio" "instr/bosendorfer/072/C5.aif"+-}+findFileAtOrFromDirectory :: String -> String -> IO (Maybe String)+findFileAtOrFromDirectory dir fn = do+ isAtDir <- doesFileExist (dir </> fn)+ if isAtDir then return (Just (dir </> fn)) else findFileFromDirectory dir fn++{- | Run findFileAtOrFromDirectory for each entry in path until the file is found, or not.++> findFileAtOrFromPath ["/home/rohan/rd/data/"] "20.2-LW+RD.flac"+-}+findFileAtOrFromPath :: [FilePath] -> FilePath -> IO (Maybe FilePath)+findFileAtOrFromPath path fn =+ case path of+ [] -> return Nothing+ dir : path' -> do+ m <- findFileAtOrFromDirectory dir fn+ case m of+ Just r -> return (Just r)+ Nothing -> findFileAtOrFromPath path' fn++-- | SFDIR environment variable.+sfDir :: IO FilePath+sfDir = getEnv "SFDIR"++-- | SFPATH environment variable.+sfPath :: IO FilePath+sfPath = getEnv "SFPATH"++{- | Find file fn at 'sfDir' directly or along 'sfPath'.+If fn is either absolute or names a relative file and if that file exists it is returned.+If sdDir/fn exists it is returned.+Else each directory at sfPath is searched (recursively) in turn.+Despite the name this will find any file type along the SFDIR and SFPATH, i.e. .sfz files &etc.++> mapM sfFindFile ["/home/rohan/data/audio/metal.wav", "pf-c5.aif", "20.2-LW+RD.flac"]+-}+sfFindFile :: FilePath -> IO (Maybe FilePath)+sfFindFile fn = do+ dir <- sfDir+ path <- fmap (Sound.Sc3.Common.Base.string_split_at_char ':') sfPath+ isFn <- doesFileExist fn+ isDir <- doesFileExist (dir </> fn)+ if isFn then return (Just fn) else if isDir then return (Just (dir </> fn)) else findFileAtOrFromPath path fn++-- | sfFindFile or error.+sfResolveFile :: FilePath -> IO FilePath+sfResolveFile fn = do+ m <- sfFindFile fn+ case m of+ Nothing -> error ("sfResolveFile: " ++ fn)+ Just r -> return r++{- | Unsafe sfResolveFile.+For resolving sound file names at read only sound file archives this is quite safe.+-}+sfResolve :: FilePath -> FilePath+sfResolve = unsafePerformIO . sfResolveFile++{- | Return the number of channels at fn.+Runs the system command "soxi" (so UNIX only).++> sfResolveFile "metal.wav" >>= sfNumChannels >>= print+-}+sfNumChannels :: FilePath -> IO Int+sfNumChannels fn = fmap read (System.Process.readProcess "soxi" ["-c", fn] "")++{- | Return the sample rate of fn.+Runs the system command "soxi" (so UNIX only).++> sfResolveFile "metal.wav" >>= sfSampleRate >>= print+-}+sfSampleRate :: FilePath -> IO Int+sfSampleRate fn = fmap read (System.Process.readProcess "soxi" ["-r", fn] "")++{- | Return the number of frames at fn.+Runs the system command "soxi" (so UNIX only).++> sfResolveFile "metal.wav" >>= sfFrameCount >>= print+-}+sfFrameCount :: FilePath -> IO Int+sfFrameCount fn = fmap read (System.Process.readProcess "soxi" ["-s", fn] "")++{- | Return the number of channels, sample-rate and number of frames at fn.+Runs the system command "soxi" (so UNIX only).++> sfResolveFile "metal.wav" >>= sfMetadata >>= print+-}+sfMetadata :: FilePath -> IO (Int, Int, Int)+sfMetadata fn = do+ nc <- sfNumChannels fn+ sr <- sfSampleRate fn+ nf <- sfFrameCount fn+ return (nc, sr, nf)++{- | Unsafe sfMetadata.+For fetching sound file information from read only sound file archives this is quite safe.++> sfInfo (sfResolve "metal.wav") == (1,44100,1029664)+> sfInfo (sfResolve "pf-c5.aif") == (2,44100,576377)+-}+sfInfo :: FilePath -> (Int, Int, Int)+sfInfo = unsafePerformIO . sfMetadata
+ Sound/Sc3/Common/Uid.hs view
@@ -0,0 +1,143 @@+{-# LANGUAGE FlexibleInstances #-}++{- | Unique identifier types and classes.+Used by non-deterministic (noise) and non-sharable (demand) unit generators.+-}+module Sound.Sc3.Common.Uid where++import Data.Functor.Identity {- base -}+import Data.List {- base -}+import qualified Data.Unique as Unique {- base -}++import qualified Control.Monad.Trans.Reader as Reader {- transformers -}+import qualified Control.Monad.Trans.State as State {- transformers -}++import qualified Data.Digest.Murmur32 as Murmur32 {- murmur-hash -}++import qualified Sound.Sc3.Common.Base as Base {- hsc3 -}++-- * Id & Uid++-- | Identifiers are integers.+type Id = Int++-- | A class indicating a monad (and functor and applicative) that will generate a sequence of unique integer identifiers.+class (Functor m, Applicative m, Monad m) => Uid m where+ generateUid :: m Int++-- | Requires FlexibleInstances.+instance Uid (State.StateT Int Identity) where+ generateUid = State.get >>= \n -> State.put (n + 1) >> return n++instance Uid IO where+ generateUid = fmap Unique.hashUnique Unique.newUnique++instance Uid m => Uid (Reader.ReaderT t m) where+ generateUid = Reader.ReaderT (const generateUid)++-- * Uid_St++-- | 'State.State' Uid.+type Uid_St = State.State Int++-- | Alias for 'runIdentity'.+uid_id_eval :: Identity t -> t+uid_id_eval = runIdentity++{- | 'State.evalState' with initial state of zero.++> uid_st_eval (replicateM 3 generateUid) == [0, 1, 2]+-}+uid_st_eval :: Uid_St t -> t+uid_st_eval x = State.evalState x 0++-- | Thread state through sequence of 'State.runState'.+uid_st_seq :: [Uid_St t] -> ([t], Int)+uid_st_seq =+ let swap (p, q) = (q, p)+ step_f n x = swap (State.runState x n)+ in swap . mapAccumL step_f 0++{- | 'fst' of 'uid_st_seq'.++> uid_st_seq_ (replicate 3 generateUid) == [0, 1, 2]+-}+uid_st_seq_ :: [Uid_St t] -> [t]+uid_st_seq_ = fst . uid_st_seq++-- * Lift++-- | Unary Uid lift.+liftUid1 :: Uid m => (Int -> Base.Fn1 a b) -> Base.Fn1 a (m b)+liftUid1 fn a = do+ z <- generateUid+ return (fn z a)++-- | Binary Uid lift.+liftUid2 :: Uid m => (Int -> Base.Fn2 a b c) -> Base.Fn2 a b (m c)+liftUid2 fn a b = do+ z <- generateUid+ return (fn z a b)++-- | Ternary Uid lift.+liftUid3 :: Uid m => (Int -> Base.Fn3 a b c d) -> Base.Fn3 a b c (m d)+liftUid3 fn a b c = do+ z <- generateUid+ return (fn z a b c)++-- | Quaternary Uid lift.+liftUid4 :: Uid m => (Int -> Base.Fn4 a b c d e) -> Base.Fn4 a b c d (m e)+liftUid4 fn a b c d = do+ z <- generateUid+ return (fn z a b c d)++-- | 5-parameter Uid lift.+liftUid5 :: Uid m => (Int -> Base.Fn5 a b c d e f) -> Base.Fn5 a b c d e (m f)+liftUid5 fn a b c d e = do+ z <- generateUid+ return (fn z a b c d e)++-- | 6-parameter Uid lift.+liftUid6 :: Uid m => (Int -> Base.Fn6 a b c d e f g) -> Base.Fn6 a b c d e f (m g)+liftUid6 fn a b c d e f = do+ z <- generateUid+ return (fn z a b c d e f)++-- | 10-parameter Uid lift.+liftUid10 :: Uid m => (Int -> Base.Fn10 a b c d e f g h i j k) -> Base.Fn10 a b c d e f g h i j (m k)+liftUid10 fn a b c d e f g h i j = do+ z <- generateUid+ return (fn z a b c d e f g h i j)++-- | 11-parameter Uid lift.+liftUid11 :: Uid m => (Int -> Base.Fn11 a b c d e f g h i j k l) -> Base.Fn11 a b c d e f g h i j k (m l)+liftUid11 fn a b c d e f g h i j k = do+ z <- generateUid+ return (fn z a b c d e f g h i j k)++-- * ID++{- | Typeclass to constrain Ugen identifiers.+Char inputs are hashed to generate longer seeds for when ir (constant) random Ugens are optimised.++> map resolveID [0::Int,1] == [0, 1]+> map resolveID ['α', 'β'] == [1439603815, 4131151318]+> map resolveID [('α', 'β'),('β', 'α')] == [3538183581, 3750624898]+> map resolveID [('α',('α', 'β')),('β',('α', 'β'))] == [0020082907, 2688286317]+> map resolveID [('α', 'α', 'β'),('β', 'α', 'β')] == [0020082907, 2688286317]+-}+class Murmur32.Hashable32 a => ID a where+ resolveID :: a -> Id+ resolveID = fromIntegral . Murmur32.asWord32 . Murmur32.hash32++instance ID Char+instance ID Int where resolveID = id+instance (ID p, ID q) => ID (p, q)+instance (ID p, ID q, ID r) => ID (p, q, r)++{- | /n/ identifiers from /x/.++> id_seq 10 'α' == [1439603815 .. 1439603824]+-}+id_seq :: ID a => Int -> a -> [Id]+id_seq n x = take n [resolveID x ..]
+ Sound/Sc3/Common/Unsafe.hs view
@@ -0,0 +1,58 @@+-- | Unsafe variants of monadic functions.+module Sound.Sc3.Common.Unsafe where++import System.IO.Unsafe {- base -}++-- * Lift++-- | Lift monadic r to unsafe form.+liftUnsafe0 :: (IO r) -> (x -> r)+liftUnsafe0 fn _ = unsafePerformIO fn++-- | Lift monadic r to unsafe form.+liftUnsafe1 :: (a -> IO r) -> (a -> r)+liftUnsafe1 fn = unsafePerformIO . fn++-- | Lift monadic r to unsafe form.+liftUnsafe2 :: (a -> b -> IO r) -> (a -> b -> r)+liftUnsafe2 fn a = unsafePerformIO . fn a++-- | Lift monadic r to unsafe form.+liftUnsafe3 :: (a -> b -> c -> IO r) -> (a -> b -> c -> r)+liftUnsafe3 fn a b = unsafePerformIO . fn a b++-- | Lift monadic r to unsafe form.+liftUnsafe4 :: (a -> b -> c -> d -> IO r) -> (a -> b -> c -> d -> r)+liftUnsafe4 fn a b c = unsafePerformIO . fn a b c++-- | Lift monadic r to unsafe form.+liftUnsafe5 :: (a -> b -> c -> d -> e -> IO r) -> (a -> b -> c -> d -> e -> r)+liftUnsafe5 fn a b c d = unsafePerformIO . fn a b c d++-- | Lift monadic r to unsafe form.+liftUnsafe6 :: (a -> b -> c -> d -> e -> f -> IO r) -> (a -> b -> c -> d -> e -> f -> r)+liftUnsafe6 fn a b c d e = unsafePerformIO . fn a b c d e++-- | Lift monadic r to unsafe form.+liftUnsafe7 :: (a -> b -> c -> d -> e -> f -> g -> IO r) -> (a -> b -> c -> d -> e -> f -> g -> r)+liftUnsafe7 fn a b c d e f = unsafePerformIO . fn a b c d e f++-- | Lift monadic r to unsafe form.+liftUnsafe8 :: (a -> b -> c -> d -> e -> f -> g -> h -> IO r) -> (a -> b -> c -> d -> e -> f -> g -> h -> r)+liftUnsafe8 fn a b c d e f g = unsafePerformIO . fn a b c d e f g++-- | Lift monadic r to unsafe form.+liftUnsafe9 :: (a -> b -> c -> d -> e -> f -> g -> h -> i -> IO r) -> (a -> b -> c -> d -> e -> f -> g -> h -> i -> r)+liftUnsafe9 fn a b c d e f g h = unsafePerformIO . fn a b c d e f g h++-- | Lift monadic r to unsafe form.+liftUnsafe10 :: (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> IO r) -> (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> r)+liftUnsafe10 fn a b c d e f g h i = unsafePerformIO . fn a b c d e f g h i++-- | Lift monadic r to unsafe form.+liftUnsafe11 :: (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> IO r) -> (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> r)+liftUnsafe11 fn a b c d e f g h i j = unsafePerformIO . fn a b c d e f g h i j++-- | Lift monadic r to unsafe form.+liftUnsafe12 :: (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> IO r) -> (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> r)+liftUnsafe12 fn a b c d e f g h i j k = unsafePerformIO . fn a b c d e f g h i j k
+ Sound/Sc3/Fd.hs view
@@ -0,0 +1,9 @@+{- | Composite of "Sound.Sc3.Common", "Sound.Sc3.Server.Fd",+ "Sound.Sc3.Ugen" and "Sound.Sc3.Ugen.Bindings".+-}+module Sound.Sc3.Fd (module M) where++import Sound.Sc3.Common as M+import Sound.Sc3.Server.Fd as M+import Sound.Sc3.Ugen as M+import Sound.Sc3.Ugen.Bindings as M
+ Sound/Sc3/Server.hs view
@@ -0,0 +1,16 @@+{- | Collection of modules for communicating with the SuperCollider+synthesis server, see also "Sound.Sc3.Server.FD" and+"Sound.Sc3.Server.Monad".+-}+module Sound.Sc3.Server (module S) where++import Sound.Sc3.Server.Command as S+import Sound.Sc3.Server.Enum as S+import Sound.Sc3.Server.Nrt as S+import Sound.Sc3.Server.Nrt.Edit as S+import Sound.Sc3.Server.Nrt.Render as S+import Sound.Sc3.Server.Param as S+import Sound.Sc3.Server.Recorder as S+import Sound.Sc3.Server.Scsynth as S+import Sound.Sc3.Server.Status as S+import Sound.Sc3.Server.Synthdef as S
+ Sound/Sc3/Server/Command.hs view
@@ -0,0 +1,6 @@+-- | Collection of standard /command/ modules.+module Sound.Sc3.Server.Command (module S) where++import Sound.Sc3.Server.Command.Completion as S+import Sound.Sc3.Server.Command.Enum as S+import Sound.Sc3.Server.Command.Plain as S
+ Sound/Sc3/Server/Command/Completion.hs view
@@ -0,0 +1,26 @@+-- | Modify existing message to include completion message+module Sound.Sc3.Server.Command.Completion where++import Sound.Osc.Core {- hosc -}++import qualified Sound.Sc3.Server.Command.Enum as Server.Command.Enum {- hsc3 -}++-- | Add a completion packet to an existing asynchronous command.+with_completion_packet :: Message -> PacketOf Message -> Message+with_completion_packet (Message c xs) cm =+ if c `elem` Server.Command.Enum.async_cmds+ then+ let xs' = xs ++ [Blob (encodePacket cm)]+ in Message c xs'+ else error ("with_completion_packet: not async: " ++ c)++{- | Add a completion message to an existing asynchronous command.++>>> import Sound.Sc3.Server.Command.Plain+>>> let m = n_set1 0 "0" 0+>>> let e = encodeMessage m+>>> withCm (b_close 0) m == Message "/b_close" [Int32 0,Blob e]+True+-}+withCm :: Message -> Message -> Message+withCm m cm = with_completion_packet m (Packet_Message cm)
+ Sound/Sc3/Server/Command/Enum.hs view
@@ -0,0 +1,165 @@+-- | Enumeration of SC3 server commands.+module Sound.Sc3.Server.Command.Enum where++import Data.List {- base -}+import Data.Maybe {- base -}++import qualified Sound.Osc.Packet as Osc {- hosc -}++-- | SC3 server commands are strings.+type SC3_Command = String++-- | Enumerate server command numbers.+sc3_cmd_enumeration :: [(SC3_Command, Int)]+sc3_cmd_enumeration =+ [ ("/notify", 1)+ , ("/status", 2)+ , ("/quit", 3)+ , ("/cmd", 4)+ , -- /d = synthdef+ ("/d_recv", 5)+ , ("/d_load", 6)+ , ("/d_loadDir", 7)+ , ("/d_freeAll", 8)+ , -- /s = synth+ ("/s_new", 9)+ , -- /n = node+ ("/n_trace", 10)+ , ("/n_free", 11)+ , ("/n_run", 12)+ , ("/n_cmd", 13)+ , ("/n_map", 14)+ , ("/n_set", 15)+ , ("/n_setn", 16)+ , ("/n_fill", 17)+ , ("/n_before", 18)+ , ("/n_after", 19)+ , -- /u = ugen+ ("/u_cmd", 20)+ , -- /g = group+ ("/g_new", 21)+ , ("/g_head", 22)+ , ("/g_tail", 23)+ , ("/g_freeAll", 24)+ , -- /c = control+ ("/c_set", 25)+ , ("/c_setn", 26)+ , ("/c_fill", 27)+ , -- /b = buffer+ ("/b_alloc", 28)+ , ("/b_allocRead", 29)+ , ("/b_read", 30)+ , ("/b_write", 31)+ , ("/b_free", 32)+ , ("/b_close", 33)+ , ("/b_zero", 34)+ , ("/b_set", 35)+ , ("/b_setn", 36)+ , ("/b_fill", 37)+ , ("/b_gen", 38)+ , --+ ("/dumpOSC", 39)+ , -- _get+ ("/c_get", 40)+ , ("/c_getn", 41)+ , ("/b_get", 42)+ , ("/b_getn", 43)+ , ("/s_get", 44)+ , ("/s_getn", 45)+ , -- _query+ ("/n_query", 46)+ , ("/b_query", 47)+ , --+ ("/n_mapn", 48)+ , ("/s_noid", 49)+ , --+ ("/g_deepFree", 50)+ , ("/clearSched", 51)+ , --+ ("/sync", 52)+ , --+ ("/d_free", 53)+ , -- _channel+ ("/b_allocReadChannel", 54)+ , ("/b_readChannel", 55)+ , -- _tree+ ("/g_dumpTree", 56)+ , ("/g_queryTree", 57)+ , -- error+ ("/error", 58)+ , -- _args+ ("/s_newargs", 59)+ , --+ ("/n_mapa", 60)+ , ("/n_mapan", 61)+ , ("/n_order", 62)+ ]++{- | Lookup command number in 'sc3_cmd_enumeration'.++>>> map sc3_cmd_number ["/b_alloc","/s_new"]+[Just 28,Just 9]+-}+sc3_cmd_number :: SC3_Command -> Maybe Int+sc3_cmd_number = flip lookup sc3_cmd_enumeration++-- | 'isJust' of 'sc3_cmd_number'.+known_sc3_cmd :: SC3_Command -> Bool+known_sc3_cmd = isJust . sc3_cmd_number++-- | List of asynchronous server commands, ie. commands that reply with @/done@.+async_cmds :: [SC3_Command]+async_cmds =+ [ "/b_alloc"+ , "/b_allocRead"+ , "/b_allocReadChannel"+ , "/b_close"+ , "/b_free"+ , "/b_read"+ , "/b_readChannel"+ , "/b_write"+ , "/b_zero"+ , "/d_load"+ , "/d_loadDir"+ , "/d_recv"+ , "/notify"+ , "/quit"+ , "/sync"+ ]++{- | 'True' if 'Message' is an asynchronous 'Message'.++> import Sound.Sc3.Server.Command.Plain+> map isAsync [b_close 0,n_set1 0 "0" 0,status] == [True,False,False]+-}+isAsync :: Osc.Message -> Bool+isAsync (Osc.Message a _) = a `elem` async_cmds++{- | Asynchronous commands are at the left.+This function should preserve the ordering of both branches.++> partition_async [b_close 0,n_set1 0 "0" 0]+-}+partition_async :: [Osc.Message] -> ([Osc.Message], [Osc.Message])+partition_async = partition isAsync++-- | Types & names for @b_info@ message fields.+b_info_fields :: [(String, String)]+b_info_fields =+ [ ("int", "buffer-id")+ , ("int", "frame-count")+ , ("int", "channels-count")+ , ("float", "sample-rate")+ ]++-- | Type, name and value descriptors for fields of @n_info@ message.+n_info_fields :: [(String, String, String)]+n_info_fields =+ [ ("int", "node-id", "")+ , ("int", "parent group-id", "-1 = nil")+ , ("int", "previous node-id", "-1 = nil")+ , ("int", "next node-id", "-1 = nil")+ , ("int", "node-type", "0 = synth,1 = group")+ , ("int", "head node-id", "-1 = nil")+ , ("int", "tail node-id", "-1 = nil")+ ]
+ Sound/Sc3/Server/Command/Generic.hs view
@@ -0,0 +1,560 @@+-- | Generic constructors for the command set implemented by the SuperCollider synthesis server.+module Sound.Sc3.Server.Command.Generic where++import Data.List {- base -}+import Data.Maybe {- base -}++import Sound.Osc.Core {- hosc -}++import qualified Sound.Sc3.Common.Base as Common.Base+import qualified Sound.Sc3.Server.Command.Completion as Server.Command.Completion+import qualified Sound.Sc3.Server.Enum as Server.Enum+import qualified Sound.Sc3.Server.Graphdef as Server.Graphdef+import qualified Sound.Sc3.Server.Graphdef.Binary as Server.Graphdef+import qualified Sound.Sc3.Server.Synthdef as Server.Synthdef++cmd_check_arg :: String -> (t -> Bool) -> t -> t+cmd_check_arg e f x = if not (f x) then error e else x++-- * Buffer commands (b_)++-- | Buf-Num must be >= 0+b_bufnum :: Integral t => t -> Datum+b_bufnum = int32 . cmd_check_arg "buffer-number < 0?" (>= 0)++-- | Buf-Frame-Ix must be >= 0+b_ix :: Integral t => t -> Datum+b_ix = int32 . cmd_check_arg "buffer-ix < 0?" (>= 0)++-- | Buf-Channel must be >= 0+b_ch :: Integral t => t -> Datum+b_ch = int32 . cmd_check_arg "buffer-channel < 0?" (>= 0)++-- | Buf-Frame-Cnt must be >= 0+b_size :: Integral t => t -> Datum+b_size = int32 . cmd_check_arg "buffer-size < 0?" (>= 0)++-- | Allocates zero filled buffer to number of channels and samples. (Asynchronous)+b_alloc :: Integral i => i -> i -> i -> Message+b_alloc b frames channels = message "/b_alloc" [b_bufnum b, b_size frames, int32 channels]++-- | Allocate buffer space and read a sound file. (Asynchronous)+b_allocRead :: Integral i => i -> String -> i -> i -> Message+b_allocRead bufferNumber fileName startFrame frameCount =+ message+ "/b_allocRead"+ [ b_bufnum bufferNumber+ , string fileName+ , b_ix startFrame+ , b_ix frameCount+ ]++-- | Allocate buffer space and read a sound file, picking specific channels. (Asynchronous)+b_allocReadChannel :: Integral i => i -> String -> i -> i -> [i] -> Message+b_allocReadChannel bufferNumber fileName startFrame frameCount channels =+ message+ "/b_allocReadChannel"+ ( [ b_bufnum bufferNumber+ , string fileName+ , b_ix startFrame+ , b_ix frameCount+ ]+ ++ map b_ch channels+ )++-- | Close attached soundfile and write header information. (Asynchronous)+b_close :: Integral i => i -> Message+b_close b = message "/b_close" [b_bufnum b]++-- | Fill ranges of sample values.+b_fill :: (Integral i, Real n) => i -> [(i, i, n)] -> Message+b_fill b l = message "/b_fill" (b_bufnum b : Common.Base.mk_triples int32 int32 float l)++-- | Free buffer data. (Asynchronous)+b_free :: Integral i => i -> Message+b_free b = message "/b_free" [b_bufnum b]++-- | Call a command to fill a buffer. (Asynchronous)+b_gen :: Integral i => i -> String -> [Datum] -> Message+b_gen b name arg = message "/b_gen" (b_bufnum b : string name : arg)++-- | Call @sine1@ 'b_gen' command.+b_gen_sine1 :: (Integral i, Real n) => i -> [Server.Enum.B_Gen] -> [n] -> Message+b_gen_sine1 z f n = b_gen z "sine1" (int32 (Server.Enum.b_gen_flag f) : map float n)++-- | Call @sine2@ 'b_gen' command.+b_gen_sine2 :: (Integral i, Real n) => i -> [Server.Enum.B_Gen] -> [(n, n)] -> Message+b_gen_sine2 z f n = b_gen z "sine2" (int32 (Server.Enum.b_gen_flag f) : Common.Base.mk_duples float float n)++-- | Call @sine3@ 'b_gen' command.+b_gen_sine3 :: (Integral i, Real n) => i -> [Server.Enum.B_Gen] -> [(n, n, n)] -> Message+b_gen_sine3 z f n = b_gen z "sine3" (int32 (Server.Enum.b_gen_flag f) : Common.Base.mk_triples float float float n)++-- | Call @cheby@ 'b_gen' command.+b_gen_cheby :: (Integral i, Real n) => i -> [Server.Enum.B_Gen] -> [n] -> Message+b_gen_cheby z f n = b_gen z "cheby" (int32 (Server.Enum.b_gen_flag f) : map float n)++-- | Call @copy@ 'b_gen' command.+b_gen_copy :: Integral i => i -> i -> i -> i -> Maybe i -> Message+b_gen_copy dst_b dst_ix src_b src_ix nf =+ let nf' = fromMaybe (-1) nf+ in b_gen dst_b "copy" (map int32 [dst_ix, src_b, src_ix, nf'])++-- | Get sample values.+b_get :: Integral i => i -> [i] -> Message+b_get b i = message "/b_get" (b_bufnum b : map int32 i)++-- | Get ranges of sample values.+b_getn :: Integral i => i -> [(i, i)] -> Message+b_getn b l = message "/b_getn" (b_bufnum b : Common.Base.mk_duples b_ix b_size l)++-- | Request \/b_info messages.+b_query :: Integral i => [i] -> Message+b_query = message "/b_query" . map int32++{- | Read sound file data into an existing buffer. (Asynchronous)+ Param: bufId pathName startFrame numFrames bufFrame leaveOpen+-}+b_read :: Integral i => i -> String -> i -> i -> i -> Bool -> Message+b_read bufId pathName startFrame numFrames bufFrame leaveOpen =+ message "/b_read" [b_bufnum bufId, string pathName, int32 startFrame, int32 numFrames, int32 bufFrame, int32 (fromEnum leaveOpen)]++-- | Read sound file data into an existing buffer, picking specific channels. (Asynchronous)+b_readChannel :: Integral i => i -> String -> i -> i -> i -> Bool -> [i] -> Message+b_readChannel b p f n f' z cs = message "/b_readChannel" ([b_bufnum b, string p, int32 f, int32 n, int32 f', int32 (fromEnum z)] ++ map int32 cs)++-- | Set sample values.+b_set :: (Integral i, Real n) => i -> [(i, n)] -> Message+b_set b l = message "/b_set" (b_bufnum b : Common.Base.mk_duples int32 float l)++-- | Set ranges of sample values.+b_setn :: (Integral i, Real n) => i -> [(i, [n])] -> Message+b_setn b l =+ let f (i, d) = int32 i : int32 (length d) : map float d+ in message "/b_setn" (b_bufnum b : concatMap f l)++-- | Write sound file data. (Asynchronous)+b_write :: Integral i => i -> String -> Server.Enum.SoundFileFormat -> Server.Enum.SampleFormat -> i -> i -> Bool -> Message+b_write b p h t f s z =+ let h' = string (Server.Enum.soundFileFormatString h)+ t' = string (Server.Enum.sampleFormatString t)+ in message "/b_write" [b_bufnum b, string p, h', t', int32 f, int32 s, int32 (fromEnum z)]++-- | Zero sample data. (Asynchronous)+b_zero :: Integral i => i -> Message+b_zero b = message "/b_zero" [b_bufnum b]++-- * Control bus commands (c_)++-- | Fill ranges of bus values.+c_fill :: (Integral i, Real n) => [(i, i, n)] -> Message+c_fill = message "/c_fill" . Common.Base.mk_triples int32 int32 float++-- | Get bus values.+c_get :: Integral i => [i] -> Message+c_get = message "/c_get" . map int32++-- | Get ranges of bus values.+c_getn :: Integral i => [(i, i)] -> Message+c_getn = message "/c_getn" . Common.Base.mk_duples int32 int32++-- | Set bus values.+c_set :: (Integral i, Real n) => [(i, n)] -> Message+c_set = message "/c_set" . Common.Base.mk_duples int32 float++-- | Set ranges of bus values.+c_setn :: (Integral i, Real n) => [(i, [n])] -> Message+c_setn l =+ let f (i, d) = int32 i : int32 (length d) : map float d+ in message "/c_setn" (concatMap f l)++-- * Instrument definition commands (d_)++-- | Install a bytecode instrument definition. (Asynchronous)+d_recv_bytes :: Blob -> Message+d_recv_bytes b = message "/d_recv" [Blob b]++-- | Graphdef encoding variant.+d_recv_gr :: Server.Graphdef.Graphdef -> Message+d_recv_gr = d_recv_bytes . Server.Graphdef.encode_graphdef++-- | Synthdef encoding variant.+d_recv :: Server.Synthdef.Synthdef -> Message+d_recv = d_recv_bytes . Server.Synthdef.synthdefData++-- | Load an instrument definition from a named file. (Asynchronous)+d_load :: String -> Message+d_load p = message "/d_load" [string p]++-- | Load a directory of instrument definitions files. (Asynchronous)+d_loadDir :: String -> Message+d_loadDir p = message "/d_loadDir" [string p]++-- | Remove definition once all nodes using it have ended.+d_free :: [String] -> Message+d_free = message "/d_free" . map string++-- * Group node commands (g_)++-- | Free all synths in this group and all its sub-groups.+g_deepFree :: Integral i => [i] -> Message+g_deepFree = message "/g_deepFree" . map int32++-- | Delete all nodes in a group.+g_freeAll :: Integral i => [i] -> Message+g_freeAll = message "/g_freeAll" . map int32++-- | Add node to head of group.+g_head :: Integral i => [(i, i)] -> Message+g_head = message "/g_head" . Common.Base.mk_duples int32 int32++-- | Create a new group.+g_new :: Integral i => [(i, Server.Enum.AddAction, i)] -> Message+g_new = message "/g_new" . Common.Base.mk_triples int32 (int32 . fromEnum) int32++-- | Add node to tail of group.+g_tail :: Integral i => [(i, i)] -> Message+g_tail = message "/g_tail" . Common.Base.mk_duples int32 int32++-- | Post a representation of a group's node subtree, optionally including the current control values for synths.+g_dumpTree :: Integral i => [(i, Bool)] -> Message+g_dumpTree = message "/g_dumpTree" . Common.Base.mk_duples int32 (int32 . fromEnum)++{- | Request a representation of a group's node subtree, optionally including the current control values for synths.++Replies to the sender with a @/g_queryTree.reply@ message listing all of the nodes contained within the group in the following format:++@+int32 - if synth control values are included 1, else 0+int32 - node ID of the requested group+int32 - number of child nodes contained within the requested group++For each node in the subtree:+[+ int32 - node ID+ int32 - number of child nodes contained within this node. If -1 this is a synth, if >= 0 it's a group.++ If this node is a synth:+ symbol - the SynthDef name for this node.++ If flag (see above) is true:+ int32 - numControls for this synth (M)+ [+ symbol or int: control name or index+ float or symbol: value or control bus mapping symbol (e.g. 'c1')+ ] * M+] * the number of nodes in the subtree+@+N.b. The order of nodes corresponds to their execution order on the server. Thus child nodes (those contained within a group) are listed immediately following their parent.+-}+g_queryTree :: Integral i => [(i, Bool)] -> Message+g_queryTree = message "/g_queryTree" . Common.Base.mk_duples int32 (int32 . fromEnum)++-- * Node commands (n_)++-- | Node-Id must be >= -1+n_id :: Integral t => t -> Datum+n_id = int32 . cmd_check_arg "node-id < -1?" (>= (-1))++-- | Place a node after another.+n_after :: Integral i => [(i, i)] -> Message+n_after = message "/n_after" . Common.Base.mk_duples n_id n_id++-- | Place a node before another.+n_before :: Integral i => [(i, i)] -> Message+n_before = message "/n_before" . Common.Base.mk_duples int32 int32++-- | Fill ranges of a node's control values.+n_fill :: (Integral i, Real f) => i -> [(String, i, f)] -> Message+n_fill n l = message "/n_fill" (n_id n : Common.Base.mk_triples string int32 float l)++-- | Delete a node.+n_free :: Integral i => [i] -> Message+n_free = message "/n_free" . map n_id++n_map :: Integral i => i -> [(String, i)] -> Message+n_map n l = message "/n_map" (n_id n : Common.Base.mk_duples string int32 l)++{- | Map a node's controls to read from buses.+ n_mapn only works if the control is given as an index and not as a name (3.8.0).+-}+n_mapn :: Integral i => i -> [(i, i, i)] -> Message+n_mapn n l = message "/n_mapn" (n_id n : Common.Base.mk_triples int32 int32 int32 l)++-- | Map a node's controls to read from an audio bus.+n_mapa :: Integral i => i -> [(String, i)] -> Message+n_mapa n l = message "/n_mapa" (n_id n : Common.Base.mk_duples string int32 l)++-- | Map a node's controls to read from audio buses.+n_mapan :: Integral i => i -> [(String, i, i)] -> Message+n_mapan n l = message "/n_mapan" (n_id n : Common.Base.mk_triples string int32 int32 l)++-- | Get info about a node.+n_query :: Integral i => [i] -> Message+n_query = message "/n_query" . map n_id++-- | Turn node on or off.+n_run :: Integral i => [(i, Bool)] -> Message+n_run = message "/n_run" . Common.Base.mk_duples n_id (int32 . fromEnum)++-- | Set a node's control values.+n_set :: (Integral i, Real n) => i -> [(String, n)] -> Message+n_set n c = message "/n_set" (n_id n : Common.Base.mk_duples string float c)++{- | Set ranges of a node's control values.+n_mapn and n_setn only work if the control is given as an index and not as a name.+-}+n_setn :: (Integral i, Real n) => i -> [(i, [n])] -> Message+n_setn n l =+ let f (s, d) = int32 s : int32 (length d) : map float d+ in message "/n_setn" (n_id n : concatMap f l)++-- | Trace a node.+n_trace :: Integral i => [i] -> Message+n_trace = message "/n_trace" . map int32++-- | Move an ordered sequence of nodes.+n_order :: Integral i => Server.Enum.AddAction -> i -> [i] -> Message+n_order a n ns = message "/n_order" (int32 (fromEnum a) : int32 n : map int32 ns)++-- * Par commands (p_)++-- | Create a new parallel group (supernova specific).+p_new :: Integral i => [(i, Server.Enum.AddAction, i)] -> Message+p_new = message "/p_new" . Common.Base.mk_triples int32 (int32 . fromEnum) int32++-- * Synthesis node commands (s_)++-- | Get control values.+s_get :: Integral i => i -> [String] -> Message+s_get n i = message "/s_get" (n_id n : map string i)++-- | Get ranges of control values.+s_getn :: Integral i => i -> [(String, i)] -> Message+s_getn n l = message "/s_getn" (n_id n : Common.Base.mk_duples string int32 l)++-- | Create a new synth.+s_new :: (Integral i, Real n) => String -> i -> Server.Enum.AddAction -> i -> [(String, n)] -> Message+s_new synthdefName nodeId addAction targetId controlValues =+ message+ "/s_new"+ ( string synthdefName+ : int32 nodeId+ : int32 (fromEnum addAction)+ : int32 targetId+ : Common.Base.mk_duples string float controlValues+ )++-- | Auto-reassign synth's ID to a reserved value.+s_noid :: Integral i => [i] -> Message+s_noid = message "/s_noid" . map int32++-- * Ugen commands (u_)++-- | Send a command to a unit generator.+u_cmd :: Integral i => i -> i -> String -> [Datum] -> Message+u_cmd n uid name arg = message "/u_cmd" ([n_id n, int32 uid, string name] ++ arg)++-- * Server operation commands++-- | Send a plugin command.+cmd :: String -> [Datum] -> Message+cmd name = message "/cmd" . (string name :)++-- | Remove all bundles from the scheduling queue.+clearSched :: Message+clearSched = message "/clearSched" []++-- | Select printing of incoming Open Sound Control messages.+dumpOsc :: Server.Enum.PrintLevel -> Message+dumpOsc c = message "/dumpOSC" [int32 (fromEnum c)]++-- | Set error posting scope and mode.+errorMode :: Server.Enum.ErrorScope -> Server.Enum.ErrorMode -> Message+errorMode scope mode =+ let e = case scope of+ Server.Enum.Globally -> fromEnum mode+ Server.Enum.Locally -> -1 - fromEnum mode+ in message "/error" [int32 e]++-- | Select reception of notification messages. (Asynchronous)+notify :: Bool -> Message+notify c = message "/notify" [int32 (fromEnum c)]++-- | End real time mode, close file (un-implemented).+nrt_end :: Message+nrt_end = message "/nrt_end" []++-- | Stop synthesis server.+quit :: Message+quit = message "/quit" []++-- | Request \/status.reply message.+status :: Message+status = message "/status" []++-- | Request \/synced message when all current asynchronous commands complete.+sync :: Integral i => i -> Message+sync sid = message "/sync" [int32 sid]++-- * Variants to simplify common cases++-- | Pre-allocate for b_setn1, values preceding offset are zeroed.+b_alloc_setn1 :: (Integral i, Real n) => i -> i -> [n] -> Message+b_alloc_setn1 b i xs =+ let k = i + genericLength xs+ xs' = genericReplicate i 0 ++ xs+ in Server.Command.Completion.withCm (b_alloc b k 1) (b_setn1 b 0 xs')++-- | Get ranges of sample values.+b_getn1 :: Integral i => i -> (i, i) -> Message+b_getn1 b = b_getn b . return++-- | Variant on 'b_query'.+b_query1 :: Integral i => i -> Message+b_query1 = b_query . return++-- | Set single sample value.+b_set1 :: (Integral i, Real n) => i -> i -> n -> Message+b_set1 b i x = b_set b [(i, x)]++-- | Set a range of sample values.+b_setn1 :: (Integral i, Real n) => i -> i -> [n] -> Message+b_setn1 b i xs = b_setn b [(i, xs)]++-- | Segmented variant of 'b_setn1'.+b_setn1_segmented :: (Integral i, Real n) => i -> i -> i -> [n] -> [Message]+b_setn1_segmented k b i d =+ if genericLength d < k+ then [b_setn1 b i d]+ else b_setn1 b i (genericTake k d) : b_setn1_segmented k b (i + k) (genericDrop k d)++-- | Get ranges of sample values.+c_getn1 :: Integral i => (i, i) -> Message+c_getn1 = c_getn . return++-- | Set single bus values.+c_set1 :: (Integral i, Real n) => i -> n -> Message+c_set1 i x = c_set [(i, x)]++-- | Set single range of bus values.+c_setn1 :: (Integral i, Real n) => (i, [n]) -> Message+c_setn1 = c_setn . return++-- | Turn a single node on or off.+n_run1 :: Integral i => i -> Bool -> Message+n_run1 n k = n_run [(n, k)]++-- | Set a single node control value.+n_set1 :: (Integral i, Real n) => i -> String -> n -> Message+n_set1 n k v = n_set n [(k, v)]++-- | @s_new@ with no parameters.+s_new0 :: Integral i => String -> i -> Server.Enum.AddAction -> i -> Message+s_new0 n i a t = s_new n i a t ([] :: [(String, Double)])++-- * Buffer segmentation and indices++{- | Segment a request for /m/ places into sets of at most /n/.++>>> b_segment 1024 2056+[8,1024,1024]++>>> b_segment 1 5 == replicate 5 1+True+-}+b_segment :: Integral i => i -> i -> [i]+b_segment n m =+ let (q, r) = m `quotRem` n+ s = genericReplicate q n+ in if r == 0 then s else r : s++{- | Variant of 'b_segment' that takes a starting index and returns /(index,size)/ duples.++>>> b_indices 1 5 0 == zip [0..4] (replicate 5 1)+True++>>> b_indices 1024 2056 16+[(16,8),(24,1024),(1048,1024)]+-}+b_indices :: Integral i => i -> i -> i -> [(i, i)]+b_indices n m k =+ let s = b_segment n m+ i = 0 : Common.Base.dx_d s+ in zip (map (+ k) i) s++-- * Ugen commands.++-- | Generate accumulation buffer given time-domain IR buffer and FFT size.+partConv_preparePartConv :: Integral i => i -> i -> i -> Message+partConv_preparePartConv b irb fft_size = b_gen b "PreparePartConv" (map int32 [irb, fft_size])++-- * Unpack++-- | Result is null for non-conforming data, or has five or seven elements.+unpack_n_info_datum_plain :: Num i => [Datum] -> [i]+unpack_n_info_datum_plain m =+ let to_i = fromIntegral+ in case m of+ [Int32 i1, Int32 i2, Int32 i3, Int32 i4, Int32 i5] -> [to_i i1, to_i i2, to_i i3, to_i i4, to_i i5]+ [Int32 i1, Int32 i2, Int32 i3, Int32 i4, Int32 i5, Int32 i6, Int32 i7] -> [to_i i1, to_i i2, to_i i3, to_i i4, to_i i5, to_i i6, to_i i7]+ _ -> []++unpack_n_info_plain :: Num i => Message -> [i]+unpack_n_info_plain m =+ case m of+ Message "/n_info" dat -> unpack_n_info_datum_plain dat+ _ -> []++-- | Unpack @n_info@ message.+unpack_n_info :: Num i => Message -> Maybe (i, i, i, i, i, Maybe (i, i))+unpack_n_info m =+ case unpack_n_info_plain m of+ [i1, i2, i3, i4, i5] -> Just (i1, i2, i3, i4, i5, Nothing)+ [i1, i2, i3, i4, i5, i6, i7] -> Just (i1, i2, i3, i4, i5, Just (i6, i7))+ _ -> Nothing++unpack_n_info_err :: Num i => Message -> (i, i, i, i, i, Maybe (i, i))+unpack_n_info_err = fromMaybe (error "unpack_n_info") . unpack_n_info++-- | Unpack the '/tr' messages sent by 'sendTrig'.+unpack_tr :: (Num i, Fractional f) => Message -> Maybe (i, i, f)+unpack_tr m =+ let to_i = fromIntegral+ to_f = realToFrac+ in case m of+ Message "/tr" [Int32 p, Int32 q, Float r] -> Just (to_i p, to_i q, to_f r)+ _ -> Nothing++unpack_tr_err :: (Num i, Fractional f) => Message -> (i, i, f)+unpack_tr_err = fromMaybe (error "unpack_tr") . unpack_tr++unpack_b_setn :: (Num i, Fractional f) => Message -> Maybe (i, i, i, [f])+unpack_b_setn m =+ let to_i = fromIntegral+ to_f d = case d of+ Float n -> realToFrac n+ _ -> error "unpack_b_setn: non-float data"+ in case m of+ Message "/b_setn" (Int32 p : Int32 q : Int32 r : z) -> Just (to_i p, to_i q, to_i r, map to_f z)+ _ -> Nothing++unpack_b_setn_err :: (Num i, Fractional f) => Message -> (i, i, i, [f])+unpack_b_setn_err = fromMaybe (error "unpack_b_setn") . unpack_b_setn++-- | Unpack b_info message, fields are (id,frames,channels,sample-rate).+unpack_b_info :: (Num i, Fractional f) => Message -> Maybe (i, i, i, f)+unpack_b_info m =+ let to_i = fromIntegral+ to_f = realToFrac+ in case m of+ Message "/b_info" [Int32 p, Int32 q, Int32 r, Float s] -> Just (to_i p, to_i q, to_i r, to_f s)+ _ -> Nothing++-- | Variant generating 'error'.+unpack_b_info_err :: (Num i, Fractional f) => Message -> (i, i, i, f)+unpack_b_info_err = fromMaybe (error "unpack_b_info") . unpack_b_info++-- Local Variables:+-- truncate-lines:t+-- End:
+ Sound/Sc3/Server/Command/Plain.hs view
@@ -0,0 +1,437 @@+-- | Functions from "Sound.Sc3.Server.Command.Generic" specialised to 'Int' and 'Double'.+module Sound.Sc3.Server.Command.Plain where++import Sound.Osc.Datum (Blob, Datum {- hosc3 -})+import Sound.Osc.Packet (Message {- hosc -})++import qualified Sound.Sc3.Server.Command.Generic as G+import qualified Sound.Sc3.Server.Enum as E+import Sound.Sc3.Server.Graphdef (Graphdef)+import Sound.Sc3.Server.Synthdef (Synthdef)++-- * Types++-- | Buffer identifier (buffer number).+type Buffer_Id = Int++-- | Buffer index (frame index).+type Buffer_Ix = Int++-- | File connection flag.+type Buffer_Leave_File_Open = Bool++-- | Audio/control bus identifier (number).+type Bus_Id = Int++-- | Node identifier (number).+type Node_Id = Int++-- | Group-node identifier (number).+type Group_Id = Int++-- | Synth-node identifier (number).+type Synth_Id = Int++-- * Buffer commands (b_)++-- | Allocates zero filled buffer to number of channels and samples. (Asynchronous)+b_alloc :: Buffer_Id -> Int -> Int -> Message+b_alloc = G.b_alloc++-- | Allocate buffer space and read a sound file. (Asynchronous)+b_allocRead :: Buffer_Id -> String -> Int -> Int -> Message+b_allocRead = G.b_allocRead++-- | Allocate buffer space and read a sound file, picking specific channels. (Asynchronous)+b_allocReadChannel :: Buffer_Id -> String -> Int -> Int -> [Int] -> Message+b_allocReadChannel = G.b_allocReadChannel++-- | Close attached soundfile and write header information. (Asynchronous)+b_close :: Buffer_Id -> Message+b_close = G.b_close++-- | Fill ranges of sample values.+b_fill :: Buffer_Id -> [(Buffer_Ix, Int, Double)] -> Message+b_fill = G.b_fill++-- | Free buffer data. (Asynchronous)+b_free :: Buffer_Id -> Message+b_free = G.b_free++-- | Call a command to fill a buffer. (Asynchronous)+b_gen :: Buffer_Id -> String -> [Datum] -> Message+b_gen = G.b_gen++-- | Get sample values.+b_get :: Buffer_Id -> [Buffer_Ix] -> Message+b_get = G.b_get++-- | Get ranges of sample values.+b_getn :: Buffer_Id -> [(Buffer_Ix, Int)] -> Message+b_getn = G.b_getn++-- | Request \/b_info messages.+b_query :: [Buffer_Id] -> Message+b_query = G.b_query++-- | Read sound file data into an existing buffer. (Asynchronous)+b_read :: Buffer_Id -> String -> Int -> Int -> Buffer_Ix -> Buffer_Leave_File_Open -> Message+b_read = G.b_read++-- | Read sound file data into an existing buffer, picking specific channels. (Asynchronous)+b_readChannel :: Buffer_Id -> String -> Int -> Int -> Buffer_Ix -> Buffer_Leave_File_Open -> [Int] -> Message+b_readChannel = G.b_readChannel++-- | Set sample values.+b_set :: Buffer_Id -> [(Buffer_Ix, Double)] -> Message+b_set = G.b_set++-- | Set ranges of sample values.+b_setn :: Buffer_Id -> [(Buffer_Ix, [Double])] -> Message+b_setn = G.b_setn++-- | Write sound file data. (Asynchronous)+b_write :: Buffer_Id -> String -> E.SoundFileFormat -> E.SampleFormat -> Int -> Buffer_Ix -> Buffer_Leave_File_Open -> Message+b_write = G.b_write++-- | Zero sample data. (Asynchronous)+b_zero :: Buffer_Id -> Message+b_zero = G.b_zero++-- * Control bus commands++-- | Fill ranges of bus values.+c_fill :: [(Bus_Id, Int, Double)] -> Message+c_fill = G.c_fill++-- | Get bus values.+c_get :: [Bus_Id] -> Message+c_get = G.c_get++-- | Get ranges of bus values.+c_getn :: [(Bus_Id, Int)] -> Message+c_getn = G.c_getn++-- | Set bus values.+c_set :: [(Bus_Id, Double)] -> Message+c_set = G.c_set++-- | Set ranges of bus values.+c_setn :: [(Bus_Id, [Double])] -> Message+c_setn = G.c_setn++-- * Instrument definition commands (d_)++-- | Install a bytecode instrument definition. (Asynchronous)+d_recv_bytes :: Blob -> Message+d_recv_bytes = G.d_recv_bytes++-- | 'Graphdef' encoding variant.+d_recv_gr :: Graphdef -> Message+d_recv_gr = G.d_recv_gr++-- | 'Synthdef' encoding variant.+d_recv :: Synthdef -> Message+d_recv = G.d_recv++-- | Load an instrument definition from a named file. (Asynchronous)+d_load :: String -> Message+d_load = G.d_load++-- | Load a directory of instrument definitions files. (Asynchronous)+d_loadDir :: String -> Message+d_loadDir = G.d_loadDir++-- | Remove definition once all nodes using it have ended.+d_free :: [String] -> Message+d_free = G.d_free++-- * Group node commands (g_)++-- | Free all synths in this group and all its sub-groups.+g_deepFree :: [Group_Id] -> Message+g_deepFree = G.g_deepFree++-- | Delete all nodes in a set of groups.+g_freeAll :: [Group_Id] -> Message+g_freeAll = G.g_freeAll++-- | Add node to head of group.+g_head :: [(Group_Id, Node_Id)] -> Message+g_head = G.g_head++-- | Create a new group.+g_new :: [(Group_Id, E.AddAction, Node_Id)] -> Message+g_new = G.g_new++-- | Add node to tail of group.+g_tail :: [(Group_Id, Node_Id)] -> Message+g_tail = G.g_tail++-- | Post a representation of a group's node subtree, optionally including the current control values for synths.+g_dumpTree :: [(Group_Id, Bool)] -> Message+g_dumpTree = G.g_dumpTree++-- | Request a representation of a group's node subtree, optionally including the current control values for synths.+g_queryTree :: [(Group_Id, Bool)] -> Message+g_queryTree = G.g_queryTree++-- * Node commands (n_)++-- | Place a node after another.+n_after :: [(Node_Id, Node_Id)] -> Message+n_after = G.n_after++-- | Place a node before another.+n_before :: [(Node_Id, Node_Id)] -> Message+n_before = G.n_before++-- | Fill ranges of a node's control values.+n_fill :: Node_Id -> [(String, Int, Double)] -> Message+n_fill = G.n_fill++-- | Delete a node.+n_free :: [Node_Id] -> Message+n_free = G.n_free++n_map :: Node_Id -> [(String, Bus_Id)] -> Message+n_map = G.n_map++{- | Map a node's controls to read from buses.+ n_mapn only works if the control is given as an index and not as a name (3.8.0).+-}+n_mapn :: Node_Id -> [(Int, Bus_Id, Int)] -> Message+n_mapn = G.n_mapn++-- | Map a node's controls to read from an audio bus.+n_mapa :: Node_Id -> [(String, Bus_Id)] -> Message+n_mapa = G.n_mapa++-- | Map a node's controls to read from audio buses.+n_mapan :: Node_Id -> [(String, Bus_Id, Int)] -> Message+n_mapan = G.n_mapan++-- | Get info about a node.+n_query :: [Node_Id] -> Message+n_query = G.n_query++-- | Turn node on or off.+n_run :: [(Node_Id, Bool)] -> Message+n_run = G.n_run++-- | Set a node's control values.+n_set :: Node_Id -> [(String, Double)] -> Message+n_set = G.n_set++-- | Set ranges of a node's control values.+n_setn :: Node_Id -> [(Int, [Double])] -> Message+n_setn = G.n_setn++-- | Trace a node.+n_trace :: [Node_Id] -> Message+n_trace = G.n_trace++-- | Move and order a sequence of nodes.+n_order :: E.AddAction -> Node_Id -> [Node_Id] -> Message+n_order = G.n_order++-- * Par commands (p_)++-- | Create a new parallel group (supernova specific).+p_new :: [(Group_Id, E.AddAction, Node_Id)] -> Message+p_new = G.p_new++-- * Synthesis node commands (s_)++-- | Get control values.+s_get :: Synth_Id -> [String] -> Message+s_get = G.s_get++-- | Get ranges of control values.+s_getn :: Synth_Id -> [(String, Int)] -> Message+s_getn = G.s_getn++-- | Create a new synth.+s_new :: String -> Synth_Id -> E.AddAction -> Node_Id -> [(String, Double)] -> Message+s_new = G.s_new++-- | Auto-reassign synth's ID to a reserved value.+s_noid :: [Synth_Id] -> Message+s_noid = G.s_noid++-- * Unit Generator commands (u_)++-- | Send a command to a unit generator.+u_cmd :: Int -> Int -> String -> [Datum] -> Message+u_cmd = G.u_cmd++-- * Server operation commands++-- | Send a plugin command.+cmd :: String -> [Datum] -> Message+cmd = G.cmd++-- | Remove all bundles from the scheduling queue.+clearSched :: Message+clearSched = G.clearSched++-- | Select printing of incoming Open Sound Control messages.+dumpOsc :: E.PrintLevel -> Message+dumpOsc = G.dumpOsc++-- | Set error posting scope and mode.+errorMode :: E.ErrorScope -> E.ErrorMode -> Message+errorMode = G.errorMode++-- | Select reception of notification messages. (Asynchronous)+notify :: Bool -> Message+notify = G.notify++-- | End real time mode, close file (un-implemented).+nrt_end :: Message+nrt_end = G.nrt_end++-- | Stop synthesis server.+quit :: Message+quit = G.quit++-- | Request \/status.reply message.+status :: Message+status = G.status++-- | Request \/synced message when all current asynchronous commands complete.+sync :: Int -> Message+sync = G.sync++-- * Variants to simplify common cases++-- | Get ranges of sample values.+b_getn1 :: Buffer_Id -> (Buffer_Ix, Int) -> Message+b_getn1 = G.b_getn1++-- | Variant on 'b_query'.+b_query1 :: Buffer_Id -> Message+b_query1 = b_query . return++-- | Get ranges of sample values.+c_getn1 :: (Bus_Id, Int) -> Message+c_getn1 = G.c_getn1++-- | Set single bus values.+c_set1 :: Bus_Id -> Double -> Message+c_set1 = G.c_set1++-- | Set single range of bus values.+c_setn1 :: (Bus_Id, [Double]) -> Message+c_setn1 = G.c_setn1++-- | Turn a single node on or off.+n_run1 :: Node_Id -> Bool -> Message+n_run1 = G.n_run1++-- | Set a single node control value.+n_set1 :: Node_Id -> String -> Double -> Message+n_set1 = G.n_set1++-- | @s_new@ with no parameters.+s_new0 :: String -> Synth_Id -> E.AddAction -> Node_Id -> Message+s_new0 = G.s_new0++-- * Buffer segmentation and indices++{- | Segment a request for /m/ places into sets of at most /n/.++>>> b_segment 1024 2056+[8,1024,1024]++>>> b_segment 1 5 == replicate 5 1+True+-}+b_segment :: Int -> Int -> [Int]+b_segment = G.b_segment++{- | Variant of 'b_segment' that takes a starting index and returns /(index,size)/ duples.++>>> b_indices 1 5 0 == zip [0..4] (replicate 5 1)+True++>>> b_indices 1024 2056 16+[(16,8),(24,1024),(1048,1024)]+-}+b_indices :: Int -> Int -> Int -> [(Int, Int)]+b_indices = G.b_indices++-- | Call @copy@ 'b_gen' command.+b_gen_copy :: Buffer_Id -> Int -> Buffer_Id -> Int -> Maybe Int -> Message+b_gen_copy = G.b_gen_copy++-- | Call @sine1@ 'b_gen' command.+b_gen_sine1 :: Buffer_Id -> [E.B_Gen] -> [Double] -> Message+b_gen_sine1 = G.b_gen_sine1++-- | Call @sine2@ 'b_gen' command.+b_gen_sine2 :: Buffer_Id -> [E.B_Gen] -> [(Double, Double)] -> Message+b_gen_sine2 = G.b_gen_sine2++-- | Call @sine3@ 'b_gen' command.+b_gen_sine3 :: Buffer_Id -> [E.B_Gen] -> [(Double, Double, Double)] -> Message+b_gen_sine3 = G.b_gen_sine3++-- | Call @cheby@ 'b_gen' command.+b_gen_cheby :: Buffer_Id -> [E.B_Gen] -> [Double] -> Message+b_gen_cheby = G.b_gen_cheby++-- | Pre-allocate for b_setn1, values preceding offset are zeroed.+b_alloc_setn1 :: Buffer_Id -> Buffer_Ix -> [Double] -> Message+b_alloc_setn1 = G.b_alloc_setn1++-- | Set single sample value.+b_set1 :: Buffer_Id -> Buffer_Ix -> Double -> Message+b_set1 = G.b_set1++-- | Set a range of sample values.+b_setn1 :: Buffer_Id -> Buffer_Ix -> [Double] -> Message+b_setn1 = G.b_setn1++-- | Segmented variant of 'b_setn1'.+b_setn1_segmented :: Int -> Buffer_Id -> Buffer_Ix -> [Double] -> [Message]+b_setn1_segmented = G.b_setn1_segmented++-- * Ugen commands.++-- | Generate accumulation buffer given time-domain IR buffer and FFT size.+partConv_preparePartConv :: Int -> Int -> Int -> Message+partConv_preparePartConv = G.partConv_preparePartConv++-- * Unpack++unpack_n_info_plain :: Message -> [Int]+unpack_n_info_plain = G.unpack_n_info_plain++unpack_n_info :: Message -> Maybe (Int, Int, Int, Int, Int, Maybe (Int, Int))+unpack_n_info = G.unpack_n_info++unpack_n_info_err :: Message -> (Int, Int, Int, Int, Int, Maybe (Int, Int))+unpack_n_info_err = G.unpack_n_info_err++unpack_tr :: Message -> Maybe (Int, Int, Double)+unpack_tr = G.unpack_tr++unpack_tr_err :: Message -> (Int, Int, Double)+unpack_tr_err = G.unpack_tr_err++unpack_b_setn :: Message -> Maybe (Int, Int, Int, [Double])+unpack_b_setn = G.unpack_b_setn++unpack_b_setn_err :: Message -> (Int, Int, Int, [Double])+unpack_b_setn_err = G.unpack_b_setn_err++unpack_b_info :: Message -> Maybe (Int, Int, Int, Double)+unpack_b_info = G.unpack_b_info++unpack_b_info_err :: Message -> (Int, Int, Int, Double)+unpack_b_info_err = G.unpack_b_info_err++-- Local Variables:+-- truncate-lines:t+-- End:
+ Sound/Sc3/Server/Command/Plain/Completion.hs view
@@ -0,0 +1,69 @@+{- | This module provides variations of the asynchronous server commands that+expect a /completion packet/ as the first argument. The completion packet+is executed by the server when the asynchronous command has finished. Note+that this mechanism is for synchronizing server side processes only, for+client side synchronization use @\/done@ message notification or the+@\/sync@ barrier.+-}+module Sound.Sc3.Server.Command.Plain.Completion where++import Sound.Osc.Core {- hosc -}++import Sound.Sc3.Server.Enum+import Sound.Sc3.Server.Synthdef++-- | Encode an Osc packet as an Osc blob.+encode_blob :: PacketOf Message -> Datum+encode_blob = Blob . encodePacket++-- | Install a bytecode instrument definition. (Asynchronous)+d_recv :: PacketOf Message -> Synthdef -> Message+d_recv pkt d = Message "/d_recv" [Blob (synthdefData d), encode_blob pkt]++-- | Load an instrument definition from a named file. (Asynchronous)+d_load :: PacketOf Message -> String -> Message+d_load pkt p = Message "/d_load" [string p, encode_blob pkt]++-- | Load a directory of instrument definitions files. (Asynchronous)+d_loadDir :: PacketOf Message -> String -> Message+d_loadDir pkt p = Message "/d_loadDir" [string p, encode_blob pkt]++-- | Allocates zero filled buffer to number of channels and samples. (Asynchronous)+b_alloc :: PacketOf Message -> Int -> Int -> Int -> Message+b_alloc pkt nid frames channels = Message "/b_alloc" [int32 nid, int32 frames, int32 channels, encode_blob pkt]++-- | Allocate buffer space and read a sound file. (Asynchronous)+b_allocRead :: PacketOf Message -> Int -> String -> Int -> Int -> Message+b_allocRead pkt nid p f n = Message "/b_allocRead" [int32 nid, string p, int32 f, int32 n, encode_blob pkt]++-- | Allocate buffer space and read a sound file, picking specific channels. (Asynchronous)+b_allocReadChannel :: PacketOf Message -> Int -> String -> Int -> Int -> [Int] -> Message+b_allocReadChannel pkt nid p f n cs = Message "/b_allocReadChannel" ([int32 nid, string p, int32 f, int32 n] ++ map int32 cs ++ [encode_blob pkt])++-- | Free buffer data. (Asynchronous)+b_free :: PacketOf Message -> Int -> Message+b_free pkt nid = Message "/b_free" [int32 nid, encode_blob pkt]++-- | Close attached soundfile and write header information. (Asynchronous)+b_close :: PacketOf Message -> Int -> Message+b_close pkt nid = Message "/b_close" [int32 nid, encode_blob pkt]++-- | Read sound file data into an existing buffer. (Asynchronous)+b_read :: PacketOf Message -> Int -> String -> Int -> Int -> Int -> Bool -> Message+b_read pkt nid p f n f' z = Message "/b_read" [int32 nid, string p, int32 f, int32 n, int32 f', int32 (fromEnum z), encode_blob pkt]++-- | Read sound file data into an existing buffer. (Asynchronous)+b_readChannel :: PacketOf Message -> Int -> String -> Int -> Int -> Int -> Bool -> [Int] -> Message+b_readChannel pkt nid p f n f' z cs = Message "/b_readChannel" ([int32 nid, string p, int32 f, int32 n, int32 f', int32 (fromEnum z)] ++ map int32 cs ++ [encode_blob pkt])++-- | Write sound file data. (Asynchronous)+b_write :: PacketOf Message -> Int -> String -> SoundFileFormat -> SampleFormat -> Int -> Int -> Bool -> Message+b_write pkt nid p h t f s z = Message "/b_write" [int32 nid, string p, string (soundFileFormatString h), string (sampleFormatString t), int32 f, int32 s, int32 (fromEnum z), encode_blob pkt]++-- | Zero sample data. (Asynchronous)+b_zero :: PacketOf Message -> Int -> Message+b_zero pkt nid = Message "/b_zero" [int32 nid, encode_blob pkt]++-- Local Variables:+-- truncate-lines:t+-- End:
+ Sound/Sc3/Server/Enum.hs view
@@ -0,0 +1,121 @@+-- | Server input enumerations.+module Sound.Sc3.Server.Enum where++import Data.Maybe {- base -}++{- | Enumeration of possible locations to add new nodes (s_new and g_new).++>>> fromEnum AddToTail+1+-}+data AddAction+ = AddToHead+ | AddToTail+ | AddBefore+ | AddAfter+ | AddReplace+ deriving (Eq, Show, Enum)++-- | Enumeration of flags for '/b_gen' command.+data B_Gen = Normalise | Wavetable | Clear+ deriving (Eq, Enum, Bounded, Show)++{- | 'B_Gen' to bit number.++>>> map b_gen_bit [minBound .. maxBound]+[0,1,2]+-}+b_gen_bit :: B_Gen -> Int+b_gen_bit = fromEnum++{- | Set of 'B_Gen' to flag.++>>> b_gen_flag [minBound .. maxBound]+7+-}+b_gen_flag :: [B_Gen] -> Int+b_gen_flag = sum . map ((2 ^) . b_gen_bit)++-- | Error posting scope.+data ErrorScope+ = -- | Global scope+ Globally+ | -- | Bundle scope+ Locally+ deriving (Eq, Show, Enum)++-- | Error posting mode.+data ErrorMode+ = -- | Turn error posting off+ ErrorsOff+ | -- | Turn error posting on+ ErrorsOn+ deriving (Eq, Show, Enum)++-- | Enumeration of Message printer types.+data PrintLevel+ = NoPrinter+ | TextPrinter+ | HexPrinter+ | AllPrinter+ deriving (Eq, Show, Enum)++-- | Sound file format.+data SoundFileFormat = Aiff | Flac | Ircam | Next | Raw | Wave+ deriving (Enum, Eq, Read, Show)++-- | Sample format.+data SampleFormat+ = PcmInt8+ | PcmInt16+ | PcmInt24+ | PcmInt32+ | PcmFloat+ | PcmDouble+ | PcmMulaw+ | PcmAlaw+ deriving (Enum, Eq, Read, Show)++-- | Sample format to standard file extension name.+soundFileFormatString :: SoundFileFormat -> String+soundFileFormatString f =+ case f of+ Aiff -> "aiff"+ Flac -> "flac"+ Ircam -> "ircam"+ Next -> "next"+ Raw -> "raw"+ Wave -> "wav"++-- | Infer sample format from file extension name.+soundFileFormat_from_extension :: String -> Maybe SoundFileFormat+soundFileFormat_from_extension =+ let tbl =+ [ ("aif", Aiff)+ , ("aiff", Aiff)+ , ("flac", Flac)+ , ("ircam", Ircam)+ , ("next", Next)+ , ("raw", Raw)+ , ("wav", Wave)+ ]+ in flip lookup tbl++-- | Erroring variant.+soundFileFormat_from_extension_err :: String -> SoundFileFormat+soundFileFormat_from_extension_err =+ fromMaybe (error "soundFileFormat_from_extension: unknown sf extension")+ . soundFileFormat_from_extension++-- | 'SampleFormat' string as recognised by scsynth NRT mode.+sampleFormatString :: SampleFormat -> String+sampleFormatString f =+ case f of+ PcmInt8 -> "int8"+ PcmInt16 -> "int16"+ PcmInt24 -> "int24"+ PcmInt32 -> "int32"+ PcmFloat -> "float"+ PcmDouble -> "double"+ PcmMulaw -> "mulaw"+ PcmAlaw -> "alaw"
+ Sound/Sc3/Server/Fd.hs view
@@ -0,0 +1,5 @@+-- | Composite of "Sound.Sc3.Server" and /Fd/ transport.+module Sound.Sc3.Server.Fd (module M) where++import Sound.Sc3.Server as M+import Sound.Sc3.Server.Transport.Fd as M
+ Sound/Sc3/Server/Graphdef.hs view
@@ -0,0 +1,316 @@+{- | Binary 'Graph Definition' as understood by @scsynth@.+ There are both binary and text encoders and decoders.+-}+module Sound.Sc3.Server.Graphdef where++import Control.Monad {- base -}+import Data.List {- base -}+import Data.Maybe {- base -}+import Text.Printf {- base -}++import qualified Safe {- safe -}++import qualified Sound.Osc.Datum as Datum {- hosc -}++import qualified Sound.Sc3.Common.Math.Operator as Operator {- hsc3 -}+import qualified Sound.Sc3.Common.Rate as Rate {- hsc3 -}++-- * Type++-- | Names are Ascii strings (ie. ByteString.Char8)+type Name = Datum.Ascii++-- | Controls are a name and a ugen-index.+type Control = (Name, Int)++-- | Constants are floating point.+type Sample = Double++-- | Ugen indices are Int.+type Ugen_Index = Int++-- | Port indices are Int.+type Port_Index = Int++{- | Index used to indicate constants at Ugen inputs.+ Ie. if the ugen-index is this value (-1) it indicates a constant.+-}+constant_index :: Ugen_Index+constant_index = -1++-- | Inputs are a ugen-index and a port-index.+data Input = Input Ugen_Index Port_Index deriving (Eq, Show)++-- | Rates are encoded as integers (IR = 0, KR = 1, AR = 2, DR = 3).+type Rate = Int++-- | Outputs each indicate a Rate.+type Output = Rate++-- | Secondary (special) index, used by operator Ugens to select operation.+type Special = Int++-- | Unit generator type.+type Ugen = (Name, Rate, [Input], [Output], Special)++-- | 'Ugen' name.+ugen_name_str :: Ugen -> String+ugen_name_str (nm, _, _, _, _) = Datum.ascii_to_string nm++-- | 'Ugen' name, using operator name if appropriate.+ugen_name_op :: Ugen -> String+ugen_name_op (nm, _, _, _, k) =+ let s = Datum.ascii_to_string nm+ in fromMaybe s (Operator.ugen_operator_name s k)++-- | 'Ugen' 'Rate'.+ugen_rate :: Ugen -> Rate+ugen_rate (_, r, _, _, _) = r++ugen_rate_enum :: Ugen -> Rate.Rate+ugen_rate_enum = toEnum . ugen_rate++-- | 'Ugen' 'Input's.+ugen_inputs :: Ugen -> [Input]+ugen_inputs (_, _, i, _, _) = i++-- | 'Ugen' 'Output's.+ugen_outputs :: Ugen -> [Output]+ugen_outputs (_, _, _, o, _) = o++-- | Predicate to examine Ugen name and decide if it is a control.+ugen_is_control :: Ugen -> Bool+ugen_is_control =+ (`elem` ["Control", "LagControl", "TrigControl"])+ . ugen_name_str++-- | Input is a Ugen (ie. not a constant, indicated by a ugen-index of -1) and the Ugen is a control.+input_is_control :: Graphdef -> Input -> Bool+input_is_control g (Input u _) = (u /= constant_index) && ugen_is_control (graphdef_ugen g u)++-- | Graph definition type.+data Graphdef = Graphdef+ { graphdef_name :: Name+ , graphdef_constants :: [Sample]+ , graphdef_controls :: [(Control, Sample)]+ , graphdef_ugens :: [Ugen]+ }+ deriving (Eq, Show)++-- | Lookup Ugen by index.+graphdef_ugen :: Graphdef -> Ugen_Index -> Ugen+graphdef_ugen g = Safe.atNote "graphdef_ugen" (graphdef_ugens g)++-- | Lookup Control and default value by index.+graphdef_control :: Graphdef -> Int -> (Control, Sample)+graphdef_control g = Safe.atNote "graphdef_controls" (graphdef_controls g)++-- | nid of constant.+graphdef_constant_nid :: Graphdef -> Int -> Int+graphdef_constant_nid _ = id++-- | nid of control.+graphdef_control_nid :: Graphdef -> Int -> Int+graphdef_control_nid g = (+) (length (graphdef_constants g))++-- | nid of Ugen.+graphdef_ugen_nid :: Graphdef -> Int -> Int+graphdef_ugen_nid g n = graphdef_control_nid g 0 + length (graphdef_controls g) + n++{- | "SCgf" encoded as 32-bit unsigned integer.++>> map fromEnum "SCgf"+[83, 67, 103, 102]++>>> import Sound.Osc.Coding.Byte+>>> decode_i32 (encode_ascii (Datum.ascii "SCgf")) == scgf_i32+True+-}+scgf_i32 :: Num n => n+scgf_i32 = 1396926310++-- * Get++-- | Get functions for Graphdef types, (str_f,i8_f,i16_f,i32_f,f32_f)+type Get_Functions m = (m Name, m Int, m Int, m Int, m Double)++-- | Get a 'Control'.+get_control :: Monad m => (Get_Functions m, m Int) -> m Control+get_control ((get_str, _, _, _, _), get_i) = do+ nm <- get_str+ ix <- get_i+ return (nm, ix)++-- | Get an 'Input'.+get_input :: Monad m => m Int -> m Input+get_input get_i = liftM2 Input get_i get_i++-- | Get a 'Ugen'+get_ugen :: Monad m => (Get_Functions m, m Int) -> m Ugen+get_ugen ((get_str, get_i8, get_i16, _, _), get_i) = do+ name <- get_str+ rate <- get_i8+ number_of_inputs <- get_i+ number_of_outputs <- get_i+ special <- get_i16+ inputs <- replicateM number_of_inputs (get_input get_i)+ outputs <- replicateM number_of_outputs get_i8+ return+ ( name+ , rate+ , inputs+ , outputs+ , special+ )++-- | Get a 'Graphdef'. Supports version 0|1 and version 2 files. Ignores variants.+get_graphdef :: Monad m => Get_Functions m -> m Graphdef+get_graphdef c@(get_str, _, get_i16, get_i32, get_f32) = do+ magic <- get_i32+ version <- get_i32+ let get_i =+ case version of+ 0 -> get_i16+ 1 -> get_i16 -- version one allows variants, which are not allowed by hsc3+ 2 -> get_i32+ _ -> error ("get_graphdef: version not at {zero | one | two}: " ++ show version)+ number_of_definitions <- get_i16+ when+ (magic /= scgf_i32)+ (error "get_graphdef: illegal magic string")+ when+ (number_of_definitions /= 1)+ (error "get_graphdef: non unary graphdef file")+ name <- get_str+ number_of_constants <- get_i+ constants <- replicateM number_of_constants get_f32+ number_of_control_defaults <- get_i+ control_defaults <- replicateM number_of_control_defaults get_f32+ number_of_controls <- get_i+ controls <- replicateM number_of_controls (get_control (c, get_i))+ number_of_ugens <- get_i+ ugens <- replicateM number_of_ugens (get_ugen (c, get_i))+ return+ ( Graphdef+ name+ constants+ (zip controls control_defaults)+ ugens+ )++-- * Encode (version zero)++-- | Encode functions for Graphdef types (join_f,str_f,i8_f,i16_f,i32_f,f32_f,com_f)+type Encode_Functions t = ([t] -> t, Name -> t, Int -> t, Int -> t, Int -> t, Double -> t, String -> t)++encode_input_f :: Encode_Functions t -> Input -> t+encode_input_f (join_f, _, _, i16_f, _, _, _) (Input u p) = join_f (map i16_f [u, p])++encode_control_f :: Encode_Functions t -> Control -> t+encode_control_f (join_f, str_f, _, i16_f, _, _, _) (nm, k) = join_f [str_f nm, i16_f k]++encode_ugen_f :: Encode_Functions t -> Ugen -> t+encode_ugen_f enc (nm, r, i, o, s) =+ let (join_f, str_f, i8_f, i16_f, _, _, com_f) = enc+ in join_f+ [ com_f "ugen-name"+ , str_f nm+ , com_f "ugen-rate"+ , i8_f r+ , com_f "ugen-number-of-inputs"+ , i16_f (length i)+ , com_f "ugen-number-of-outputs"+ , i16_f (length o)+ , com_f "ugen-special"+ , i16_f s+ , com_f "ugen-inputs (ugen-index,port-index)"+ , join_f (map (encode_input_f enc) i)+ , com_f "ugen-output-rates"+ , join_f (map i8_f o)+ ]++encode_graphdef_f :: Encode_Functions t -> Graphdef -> t+encode_graphdef_f enc (Graphdef nm cs ks us) =+ let (join_f, str_f, _, i16_f, i32_f, f32_f, com_f) = enc+ (ks_ctl, ks_def) = unzip ks+ in join_f+ [ com_f "SCgf"+ , i32_f scgf_i32+ , com_f "version"+ , i32_f 0+ , com_f "number of graphs"+ , i16_f 1+ , com_f "name"+ , str_f nm+ , com_f "number-of-constants"+ , i16_f (length cs)+ , com_f "constant-values"+ , join_f (map f32_f cs)+ , com_f "number-of-controls"+ , i16_f (length ks_def)+ , com_f "control-default-values"+ , join_f (map f32_f ks_def)+ , com_f "number-of-controls"+ , i16_f (length ks_ctl)+ , com_f "controls"+ , join_f (map (encode_control_f enc) ks_ctl)+ , com_f "number-of-ugens"+ , i16_f (length us)+ , join_f (map (encode_ugen_f enc) us)+ ]++-- * Stat++-- | Simple statistics printer for 'Graphdef'.+graphdef_stat :: Graphdef -> String+graphdef_stat (Graphdef nm cs ks us) =+ let f g =+ let h (x : xs) = (x, length (x : xs))+ h [] = error "graphdef_stat"+ in show . map h . group . sort . map g+ sq pp_f = intercalate "," (pp_f (map ugen_name_op us))+ in unlines+ [ "name : " ++ show nm+ , "number of constants : " ++ show (length cs)+ , "number of controls : " ++ show (length ks)+ , "number of unit generators : " ++ show (length us)+ , "unit generator rates : " ++ f ugen_rate us+ , "unit generator set : " ++ sq (nub . sort)+ , "unit generator sequence : " ++ sq id+ ]++-- * Dump Ugens++-- | Pretty print Ugen in the manner of SynthDef>>dumpUgens.+ugen_dump_ugen_str :: [Sample] -> [Ugen] -> Ugen_Index -> Ugen -> String+ugen_dump_ugen_str c_sq u_sq ix u =+ let in_brackets :: String -> String+ in_brackets x = printf "[%s]" x+ input_pp (Input i j) =+ let ui = u_sq !! i+ in if i >= 0+ then+ if length (ugen_outputs ui) > 1+ then printf "%d_%s:%d" i (ugen_name_op ui) j+ else printf "%d_%s" i (ugen_name_op ui)+ else printf "%f" (c_sq !! j)+ inputs_pp = in_brackets . intercalate "," . map input_pp+ in printf "%d_%s, %s, %s" ix (ugen_name_op u) (show (ugen_rate_enum u)) (inputs_pp (ugen_inputs u))++-- | Print graphdef in format equivalent to SynthDef>>dumpUgens in SuperCollider+graphdef_dump_ugens_str :: Graphdef -> [String]+graphdef_dump_ugens_str (Graphdef _nm cs _ks us) = zipWith (ugen_dump_ugen_str cs us) [0 ..] us++{- | 'putStrLn' of 'unlines' of 'graphdef_dump_ugens_str'++> import Sound.Sc3.Server.Graphdef+> import Sound.Sc3.Server.Graphdef.Io+> dir = "/home/rohan/sw/rsc3-disassembler/scsyndef/"+> pp nm = read_graphdef_file (dir ++ nm) >>= graphdef_dump_ugens+> pp "simple.scsyndef"+> pp "with-ctl.scsyndef"+> pp "mce.scsyndef"+> pp "mrg.scsyndef"+-}+graphdef_dump_ugens :: Graphdef -> IO ()+graphdef_dump_ugens = putStrLn . unlines . graphdef_dump_ugens_str
+ Sound/Sc3/Server/Graphdef/Binary.hs view
@@ -0,0 +1,111 @@+-- | Binary encoders and decoders.+module Sound.Sc3.Server.Graphdef.Binary where++import System.FilePath {- filepath -}++import qualified Data.Binary.Get as Get {- binary -}+import qualified Data.Binary.IEEE754 as IEEE754 {- data-binary-ieee754 -}+import qualified Data.ByteString.Lazy as ByteString {- bytestring -}++import qualified Sound.Osc.Coding.Byte as Byte {- hosc -}+import qualified Sound.Osc.Coding.Cast as Cast {- hosc -}+import qualified Sound.Osc.Datum as Datum {- hosc -}++import Sound.Sc3.Server.Graphdef {- hsc3 -}++-- * Binary Get (version 0|1 or 2)++-- | Get a 'Name' (Pascal string).+get_pstr :: Get.Get Name+get_pstr = do+ n <- fmap fromIntegral Get.getWord8+ fmap Byte.decode_ascii (Get.getLazyByteString n)++-- | Get_Functions for binary .scsyndef files.+binary_get_f :: Get_Functions Get.Get+binary_get_f =+ ( get_pstr+ , fmap fromIntegral Get.getInt8+ , fmap fromIntegral Get.getInt16be+ , fmap fromIntegral Get.getInt32be+ , fmap realToFrac IEEE754.getFloat32be+ )++-- * Read++{- | Read Graphdef from .scsyndef file.++> dir = "/home/rohan/sw/rsc3-disassembler/scsyndef/"+> pp nm = read_graphdef_file (dir ++ nm) >>= putStrLn . graphdef_stat+> pp "simple.scsyndef"+> pp "with-ctl.scsyndef"+> pp "mce.scsyndef"+> pp "mrg.scsyndef"+-}+read_graphdef_file :: FilePath -> IO Graphdef+read_graphdef_file nm = do+ b <- ByteString.readFile nm+ return (Get.runGet (get_graphdef binary_get_f) b)++-- * Stat++-- | 'read_graphdef_file' and run 'graphdef_stat'.+scsyndef_stat :: FilePath -> IO String+scsyndef_stat fn = do+ g <- read_graphdef_file fn+ return (graphdef_stat g)++-- * Encode (version zero)++-- | 'Encode_Functions' for 'ByteString.ByteString'+enc_bytestring :: Encode_Functions ByteString.ByteString+enc_bytestring =+ ( ByteString.concat+ , encode_pstr+ , Byte.encode_i8+ , Byte.encode_i16+ , Byte.encode_i32+ , encode_sample+ , const ByteString.empty+ )++{- | Pascal (length prefixed) encoding of 'Name'.++> ByteString.unpack (encode_pstr (ascii "string")) == [6, 115, 116, 114, 105, 110, 103]+-}+encode_pstr :: Name -> ByteString.ByteString+encode_pstr = ByteString.pack . Cast.str_pstr . Datum.ascii_to_string++-- | Byte-encode 'Input'.+encode_input :: Input -> ByteString.ByteString+encode_input = encode_input_f enc_bytestring++-- | Byte-encode 'Control'.+encode_control :: Control -> ByteString.ByteString+encode_control = encode_control_f enc_bytestring++-- | Byte-encode 'Ugen'.+encode_ugen :: Ugen -> ByteString.ByteString+encode_ugen = encode_ugen_f enc_bytestring++-- | Encode 'Sample' as 32-bit IEEE float.+encode_sample :: Sample -> ByteString.ByteString+encode_sample = Byte.encode_f32 . realToFrac++-- | Encode 'Graphdef'.+encode_graphdef :: Graphdef -> ByteString.ByteString+encode_graphdef = encode_graphdef_f enc_bytestring++-- * IO++-- | Write 'Graphdef' to indicated file.+graphdefWrite :: FilePath -> Graphdef -> IO ()+graphdefWrite fn = ByteString.writeFile fn . encode_graphdef++{- | Write 'Graphdef' to indicated directory. The filename is the+'graphdef_name' with the appropriate extension (@scsyndef@).+-}+graphdefWrite_dir :: FilePath -> Graphdef -> IO ()+graphdefWrite_dir dir s =+ let fn = dir </> Datum.ascii_to_string (graphdef_name s) <.> "scsyndef"+ in graphdefWrite fn s
+ Sound/Sc3/Server/Graphdef/Graph.hs view
@@ -0,0 +1,81 @@+-- | Transform 'Graph.U_Graph' to 'Graphdef.Graphdef'.+module Sound.Sc3.Server.Graphdef.Graph where++import Data.Maybe {- base -}++import qualified Data.IntMap as M {- containers -}++import qualified Sound.Osc.Datum as Datum {- hosc -}++import qualified Sound.Sc3.Common.Rate as Rate {- hsc3 -}+import qualified Sound.Sc3.Common.Uid as Uid {- hsc3 -}+import qualified Sound.Sc3.Server.Graphdef as Graphdef {- hsc3 -}+import qualified Sound.Sc3.Ugen.Graph as Graph {- hsc3 -}+import qualified Sound.Sc3.Ugen.Types as Types {- hsc3 -}++-- * Maps++-- | (Int,Int) map.+type Int_Map = M.IntMap Int++-- | (constants-map,controls,controls-map,ugen-map,ktype-map)+type Encoding_Maps = (Int_Map, [Graph.U_Node], Int_Map, Int_Map, [(Rate.K_Type, Int)])++-- | Generate 'Encoding_Maps' translating node identifiers to synthdef indexes.+mk_encoding_maps :: Graph.U_Graph -> Encoding_Maps+mk_encoding_maps (Graph.U_Graph _ cs ks us) =+ ( M.fromList (zip (map Graph.u_node_id cs) [0 ..])+ , ks+ , M.fromList (zip (map Graph.u_node_id ks) [0 ..])+ , M.fromList (zip (map Graph.u_node_id us) [0 ..])+ , Graph.u_node_mk_ktype_map us+ )++-- | Locate index in map given node identifer 'UID_t'.+uid_lookup :: Uid.Id -> Int_Map -> Int+uid_lookup = M.findWithDefault (error "uid_lookup")++-- | Lookup 'K_Type' index from map (erroring variant of 'lookup').+ktype_map_lookup :: Rate.K_Type -> [(Rate.K_Type, Int)] -> Int+ktype_map_lookup k m =+ let e = error (show ("ktype_map_lookup", k, m))+ in fromMaybe e (lookup k m)++-- * Encoding++-- | Byte-encode 'Graph.From_Port' primitive node.+make_input :: Encoding_Maps -> Graph.From_Port -> Graphdef.Input+make_input (cs, ks, _, us, kt) fp =+ case fp of+ Graph.From_Port_C n -> Graphdef.Input (-1) (uid_lookup n cs)+ Graph.From_Port_K n t ->+ let i = ktype_map_lookup t kt+ in Graphdef.Input i (Graph.u_node_fetch_k n t ks)+ Graph.From_Port_U n p -> Graphdef.Input (uid_lookup n us) (fromMaybe 0 p)++-- | Byte-encode 'Graph.U_Node_K' primitive node.+make_control :: Encoding_Maps -> Graph.U_Node -> Graphdef.Control+make_control (_, _, ks, _, _) nd =+ case nd of+ Graph.U_Node_K n _ _ nm _ _ _ -> (Datum.ascii nm, uid_lookup n ks)+ _ -> error "make_control"++-- | Byte-encode 'Graph.U_Node_U' primitive node.+make_ugen :: Encoding_Maps -> Graph.U_Node -> Graphdef.Ugen+make_ugen m n =+ case n of+ Graph.U_Node_U _ r nm i o (Types.Special s) _ ->+ let i' = map (make_input m) i+ in (Datum.ascii nm, Rate.rateId r, i', map Rate.rateId o, s)+ _ -> error "encode_node_u: illegal input"++-- | Construct instrument definition bytecode.+graph_to_graphdef :: String -> Graph.U_Graph -> Graphdef.Graphdef+graph_to_graphdef nm g =+ let Graph.U_Graph _ cs ks us = g+ cs' = map Graph.u_node_c_value cs+ mm = mk_encoding_maps g+ ks_def = map Graph.u_node_k_default ks+ ks_ctl = map (make_control mm) ks+ us' = map (make_ugen mm) us+ in Graphdef.Graphdef (Datum.ascii nm) cs' (zip ks_ctl ks_def) us'
+ Sound/Sc3/Server/Graphdef/Io.hs view
@@ -0,0 +1,19 @@+-- | Encoding agnostic i/o.+module Sound.Sc3.Server.Graphdef.Io where++import Data.List {- base -}++import Sound.Sc3.Server.Graphdef {- hsc3 -}+import qualified Sound.Sc3.Server.Graphdef.Binary as Binary {- hsc3 -}+import qualified Sound.Sc3.Server.Graphdef.Text as Text {- hsc3 -}++{- | Encoding agnostic file reader.+If the file has a .scsyndef.text extension it's read as a text file, else as a binary file.++read_graphdef_file "/tmp/stsc3.scsyndef.text"+-}+read_graphdef_file :: FilePath -> IO Graphdef+read_graphdef_file fn =+ if ".scsyndef.text" `isSuffixOf` fn+ then Text.read_graphdef_file fn+ else Binary.read_graphdef_file fn
+ Sound/Sc3/Server/Graphdef/Read.hs view
@@ -0,0 +1,66 @@+-- | Decode (read) a 'Graphdef' into a 'Graph'.+module Sound.Sc3.Server.Graphdef.Read where++import qualified Sound.Osc.Datum as Datum {- hosc -}++import qualified Sound.Sc3.Common.Rate as Rate {- hsc3 -}+import qualified Sound.Sc3.Common.Uid as Uid {- hsc3 -}+import qualified Sound.Sc3.Server.Graphdef as Graphdef {- hsc3 -}+import qualified Sound.Sc3.Server.Graphdef.Binary as Graphdef {- hsc3 -}+import qualified Sound.Sc3.Ugen.Graph as Graph {- hsc3 -}+import qualified Sound.Sc3.Ugen.Types as Types {- hsc3 -}++control_to_node :: Graphdef.Graphdef -> Uid.Id -> (Graphdef.Control, Types.Sample) -> Graph.U_Node+control_to_node g z ((nm, ix), v) =+ let z' = Graphdef.graphdef_control_nid g z+ nm' = Datum.ascii_to_string nm+ in Graph.U_Node_K z' Rate.ControlRate (Just ix) nm' v Rate.K_ControlRate Nothing++-- | Note: Graphs with multiple Control Ugens are not accounted for.+input_to_from_port :: Graphdef.Graphdef -> Graphdef.Input -> Graph.From_Port+input_to_from_port g (Graphdef.Input u p) =+ if u == -1+ then Graph.From_Port_C (Graphdef.graphdef_constant_nid g p)+ else+ if Graphdef.input_is_control g (Graphdef.Input u p)+ then Graph.From_Port_K (Graphdef.graphdef_control_nid g p) Rate.K_ControlRate+ else+ let ugen = Graphdef.graphdef_ugens g !! u+ port =+ if length (Graphdef.ugen_outputs ugen) > 1+ then Just p+ else Nothing+ in Graph.From_Port_U (Graphdef.graphdef_ugen_nid g u) port++ugen_to_node :: Graphdef.Graphdef -> Uid.Id -> Graphdef.Ugen -> Graph.U_Node+ugen_to_node g z u =+ let (name, rate, inputs, outputs, special) = u+ z' = Graphdef.graphdef_ugen_nid g z+ rate' = toEnum rate+ name' = Datum.ascii_to_string name+ inputs' = map (input_to_from_port g) inputs+ outputs' = map toEnum outputs+ special' = Types.Special special+ in Graph.U_Node_U z' rate' name' inputs' outputs' special' (Types.Uid z')++graphdef_to_graph :: Graphdef.Graphdef -> (String, Graph.U_Graph)+graphdef_to_graph g =+ let constants_nd = zipWith Graph.U_Node_C [0 ..] (Graphdef.graphdef_constants g)+ controls_nd = zipWith (control_to_node g) [0 ..] (Graphdef.graphdef_controls g)+ ugens_nd = zipWith (ugen_to_node g) [0 ..] (Graphdef.graphdef_ugens g)+ nm = Datum.ascii_to_string (Graphdef.graphdef_name g)+ gr = Graph.U_Graph (-1) constants_nd controls_nd ugens_nd+ in (nm, gr) -- S.Synthdef nm gr++-- | Read graphdef file and translate to graph.+read_graph :: FilePath -> IO Graph.U_Graph+read_graph sy_nm = do+ d <- Graphdef.read_graphdef_file sy_nm+ let (_, g) = graphdef_to_graph d+ return g++-- | Read graphdef file, translate to graph, and run 'ug_stat_ln'.+scsyndef_ug_stat :: FilePath -> IO String+scsyndef_ug_stat sy_nm = do+ g <- read_graph sy_nm+ return (unlines (Graph.ug_stat_ln g))
+ Sound/Sc3/Server/Graphdef/Text.hs view
@@ -0,0 +1,91 @@+{- | .scsyndef file encoded in plain text.+There are reader and writer functions.+-}+module Sound.Sc3.Server.Graphdef.Text where++import Data.Char {- base -}+import Data.Functor.Identity {- base -}+import Data.List {- base -}++import qualified Numeric {- base -}++import qualified Control.Monad.State as S {- mtl -}++import qualified Sound.Osc.Datum as Datum {- hosc -}++import Sound.Sc3.Server.Graphdef {- hsc3 -}++-- | * Printer++-- | Print string. Strings must not have internal whitespace or semi-colons. A quoting system could allow these if required.+print_string :: Datum.Ascii -> String+print_string a =+ let s = Datum.ascii_to_string a+ in if any isSpace s || ';' `elem` s then error "print_string" else s++-- | 'Encode_Functions' for plain text output.+enc_text :: (String -> String) -> Encode_Functions String+enc_text com_f =+ ( unwords . filter (not . null)+ , print_string+ , show+ , show+ , show+ , \n -> Numeric.showFFloat Nothing n ""+ , com_f+ )++{- | 'encode_graphdef_f' of 'enc_text' with optional semi-colon delimited comments.++> dir = "/home/rohan/sw/rsc3-disassembler/scsyndef/"+> pp nm = Sound.Sc3.Server.Graphdef.Io.read_graphdef_file (dir ++ nm) >>= putStrLn . print_graphdef True+> pp "simple.scsyndef"+> pp "with-ctl.scsyndef"+> pp "mce.scsyndef"+> pp "mrg.scsyndef"+-}+print_graphdef :: Bool -> Graphdef -> String+print_graphdef with_com =+ let com_f = if with_com then \c -> concat ["\n; ", c, "\n"] else const ""+ in encode_graphdef_f (enc_text com_f)++-- * List Input++-- | Read the next value from a list.+list_read_f :: (t -> u) -> S.State [t] u+list_read_f f = do+ l <- S.get+ case uncons l of+ Nothing -> error "list_read_f"+ Just (h, t) -> S.put t >> return (f h)++-- | Read function for floating point that admits inf and infinity.+read_float :: (Fractional p, Read p) => String -> p+read_float txt =+ case map toLower txt of+ "inf" -> 1 / 0+ "infinity" -> 1 / 0+ _ -> read txt++-- | Get_Functions for text representation of Graphdef.+text_get_f :: Get_Functions (S.StateT [String] Identity)+text_get_f = (list_read_f Datum.ascii, list_read_f read, list_read_f read, list_read_f read, list_read_f read_float)++-- | Is line empty or starts with ';'+is_nil_or_comment :: String -> Bool+is_nil_or_comment txt =+ case uncons txt of+ Nothing -> True+ Just (h, _) -> h == ';'++{- | Read text representation of Graphdef, as written by 'print_graphdef'.++> read_graphdef "1396926310 0 1 simple 2 0.0 440.0 0 0 2 SinOsc 2 2 1 0 -1 1 -1 0 2 Out 2 2 0 0 -1 0 0 0"+-}+read_graphdef :: String -> Graphdef+read_graphdef txt =+ let delete_comments = filter (not . is_nil_or_comment)+ in S.evalState (get_graphdef text_get_f) (concatMap words (delete_comments (lines txt)))++read_graphdef_file :: FilePath -> IO Graphdef+read_graphdef_file = fmap read_graphdef . readFile
+ Sound/Sc3/Server/Monad.hs view
@@ -0,0 +1,5 @@+-- | Composite of "Sound.Sc3.Server" and 'Monad' transport.+module Sound.Sc3.Server.Monad (module S) where++import Sound.Sc3.Server as S+import Sound.Sc3.Server.Transport.Monad as S
+ Sound/Sc3/Server/Nrt.hs view
@@ -0,0 +1,87 @@+-- | Non-realtime score generation.+module Sound.Sc3.Server.Nrt where++import Data.List {- base -}+import Data.Maybe {- base -}+import System.IO {- base -}++import qualified Data.ByteString.Lazy as B {- bytestring -}++import qualified Sound.Osc.Coding.Byte as Byte {- hosc -}+import qualified Sound.Osc.Coding.Decode.Binary as Decode {- hosc3 -}+import qualified Sound.Osc.Coding.Encode.Builder as Encode {- hosc3 -}+import Sound.Osc.Datum {- hosc -}+import Sound.Osc.Packet {- hosc -}++-- | Encode Bundle and prefix with encoded length.+oscWithSize :: BundleOf Message -> B.ByteString+oscWithSize o =+ let b = Encode.encodeBundle o+ l = Byte.encode_i32 (fromIntegral (B.length b))+ in B.append l b++-- | An 'Nrt' score is a sequence of 'Bundle's.+newtype Nrt = Nrt {nrt_bundles :: [BundleOf Message]} deriving (Show)++{- | 'span' of 'f' of 'bundleTime'.+ Can be used to separate the /initialisation/ and /remainder/ parts of a score.+-}+nrt_span :: (Time -> Bool) -> Nrt -> ([BundleOf Message], [BundleOf Message])+nrt_span f = span (f . bundleTime) . nrt_bundles++-- | Encode an 'Nrt' score.+encodeNrt :: Nrt -> B.ByteString+encodeNrt = B.concat . map oscWithSize . nrt_bundles++{- | Write an 'Nrt' score.++> import Sound.Osc {\- hosc -\}+> import Sound.Sc3 {\- hsc3 -\}+> m1 = g_new [(1, AddToTail, 0)]+> m2 = d_recv (synthdef "sin" (out 0 (sinOsc ar 660 0 * 0.15)))+> m3 = s_new "sin" 100 AddToTail 1 []+> m4 = n_free [100]+> m5 = nrt_end+> sc = Nrt [bundle 0 [m1,m2],bundle 1 [m3],bundle 10 [m4],bundle 15 [m5]]+> writeNrt "/tmp/t.osc" sc+-}+writeNrt :: FilePath -> Nrt -> IO ()+writeNrt fn = B.writeFile fn . encodeNrt++-- | Write an 'Nrt' score to a file handle.+putNrt :: Handle -> Nrt -> IO ()+putNrt h = B.hPut h . encodeNrt++-- | Decode an 'Nrt' 'B.ByteString' to a list of 'Bundle's.+decode_nrt_bundles :: B.ByteString -> [BundleOf Message]+decode_nrt_bundles s =+ let (p, q) = B.splitAt 4 s+ n = fromIntegral (Byte.decode_i32 p)+ (r, s') = B.splitAt n q+ r' = Decode.decodeBundle r+ in if B.null s'+ then [r']+ else r' : decode_nrt_bundles s'++-- | Decode an 'Nrt' 'B.ByteString'.+decodeNrt :: B.ByteString -> Nrt+decodeNrt = Nrt . decode_nrt_bundles++{- | 'decodeNrt' of 'B.readFile'.++> readNrt "/tmp/t.osc"+-}+readNrt :: FilePath -> IO Nrt+readNrt = fmap decodeNrt . B.readFile++-- * Query++-- | Find any non-ascending sequences.+nrt_non_ascending :: Nrt -> [(BundleOf Message, BundleOf Message)]+nrt_non_ascending (Nrt b) =+ case uncons b of+ Nothing -> error "nrt_non_ascending: empty nrt"+ Just (_, t) ->+ let p = zip b t+ f (i, j) = if bundleTime i > bundleTime j then Just (i, j) else Nothing+ in mapMaybe f p
+ Sound/Sc3/Server/Nrt/Edit.hs view
@@ -0,0 +1,55 @@+-- | Nrt editing+module Sound.Sc3.Server.Nrt.Edit where++import Data.List {- base -}++import qualified Data.List.Ordered {- data-ordlist -}++import qualified Sound.Osc.Datum as Osc {- hosc -}+import qualified Sound.Osc.Packet as Osc {- hosc -}++import qualified Sound.Sc3.Common.Base {- hsc3 -}+import qualified Sound.Sc3.Server.Command {- hsc3 -}+import Sound.Sc3.Server.Nrt {- hsc3 -}++-- | Merge two Nrt scores. Retains internal nrt_end messages.+nrt_merge :: Nrt -> Nrt -> Nrt+nrt_merge (Nrt p) (Nrt q) = Nrt (Data.List.Ordered.merge p q)++-- | Merge a set of Nrt. Retains internal 'nrt_end' messages.+nrt_merge_set :: [Nrt] -> Nrt+nrt_merge_set = foldr nrt_merge nrt_empty++-- | The empty Nrt.+nrt_empty :: Nrt+nrt_empty = Nrt []++-- | Add bundle at first permissable location of Nrt.+nrt_insert_pre :: Osc.BundleOf Osc.Message -> Nrt -> Nrt+nrt_insert_pre p (Nrt q) = Nrt (insert p q)++-- | Add bundle at last permissable location of Nrt.+nrt_insert_post :: Osc.BundleOf Osc.Message -> Nrt -> Nrt+nrt_insert_post p (Nrt q) = Nrt (Sound.Sc3.Common.Base.insert_post p q)++-- | bundleTime of last of nrt_bundles.+nrt_end_time :: Nrt -> Osc.Time+nrt_end_time = Osc.bundleTime . last . nrt_bundles++-- | Delete any internal nrt_end messages, and require one at the final bundle.+nrt_close :: Nrt -> Nrt+nrt_close (Nrt l) =+ let is_nrt_end_msg = (== "/nrt_end") . Osc.messageAddress+ bundle_map t_f m_f (Osc.Bundle t m) = Osc.Bundle (t_f t) (m_f m) -- apply temporal and message functions to bundle+ rem_end_msg = bundle_map id (filter (not . is_nrt_end_msg))+ req_end_msg =+ let f m =+ if any is_nrt_end_msg m+ then m+ else m ++ [Sound.Sc3.Server.Command.nrt_end]+ in bundle_map id f+ in Nrt (Sound.Sc3.Common.Base.at_last rem_end_msg req_end_msg l)++-- | Append /q/ to /p/, assumes last timestamp at /p/ precedes first at /q/.+nrt_append :: Nrt -> Nrt -> Nrt+nrt_append (Nrt p) (Nrt q) = Nrt (p ++ q)
+ Sound/Sc3/Server/Nrt/Render.hs view
@@ -0,0 +1,83 @@+-- | Non-realtime score rendering.+module Sound.Sc3.Server.Nrt.Render where++import System.FilePath {- filepath -}+import System.Process {- process -}++import Sound.Sc3.Server.Enum+import Sound.Sc3.Server.Nrt++{- | Minimal Nrt rendering parameters.++The sound file type is inferred from the file name extension.+Structure is:+Osc file name,+input audio file name and input number of channels (use ("_",0) for no input file),+output audio file name and output number of channels,+sample rate (int),+sample format,+further parameters (ie. ["-m","32768"]) to be inserted before the Nrt -N option.+-}+type Nrt_Param_Plain = (FilePath, (FilePath, Int), (FilePath, Int), Int, SampleFormat, [String])++{- | Compile argument list from Nrt_Param_Plain.++>>> let opt = ("/tmp/t.osc",("_",0),("/tmp/t.wav",1),48000,PcmInt16,[])+>>> nrt_param_plain_to_arg opt+["-i","0","-o","1","-N","/tmp/t.osc","_","/tmp/t.wav","48000","wav","int16"]+-}+nrt_param_plain_to_arg :: Nrt_Param_Plain -> [String]+nrt_param_plain_to_arg (osc_nm, (in_sf, in_nc), (out_sf, out_nc), sr, sf, param) =+ let sf_ty = case takeExtension out_sf of+ '.' : ext -> soundFileFormat_from_extension_err ext+ _ -> error "nrt_exec_plain: invalid sf extension"+ in concat+ [+ [ "-i"+ , show in_nc+ , "-o"+ , show out_nc+ ]+ , param+ ,+ [ "-N"+ , osc_nm+ , in_sf+ , out_sf+ , show sr+ , soundFileFormatString sf_ty+ , sampleFormatString sf+ ]+ ]++{- | Compile argument list from Nrt_Param_Plain and run scynth.++> nrt_exec_plain opt+-}+nrt_exec_plain :: Nrt_Param_Plain -> IO ()+nrt_exec_plain opt = callProcess "scsynth" (nrt_param_plain_to_arg opt)++{- | Minimal Nrt rendering, for more control see Stefan Kersten's+/hsc3-process/ package at:+<https://github.com/kaoskorobase/hsc3-process>.+-}+nrt_proc_plain :: Nrt_Param_Plain -> Nrt -> IO ()+nrt_proc_plain opt sc = do+ let (osc_nm, _, _, _, _, _) = opt+ writeNrt osc_nm sc+ nrt_exec_plain opt++{- | Variant for no input case.++(osc-file-name, audio-file-name, number-of-channels, sample-rate, sample-format, param)+-}+type Nrt_Render_Plain = (FilePath, FilePath, Int, Int, SampleFormat, [String])++{- | Add ("-",0) as input parameters and run 'nrt_proc_plain'.++> nrt_render_plain opt sc+-}+nrt_render_plain :: Nrt_Render_Plain -> Nrt -> IO ()+nrt_render_plain (osc_nm, sf_nm, nc, sr, sf, param) sc =+ let opt = (osc_nm, ("_", 0), (sf_nm, nc), sr, sf, param)+ in nrt_proc_plain opt sc
+ Sound/Sc3/Server/Nrt/Stat.hs view
@@ -0,0 +1,32 @@+-- | Nrt statistics.+module Sound.Sc3.Server.Nrt.Stat where++import Sound.Osc.Datum {- hosc -}+import Sound.Osc.Packet {- hosc -}++import Sound.Sc3.Common.Base {- hsc3 -}+import Sound.Sc3.Server.Nrt {- hsc3 -}++-- | Nrt statistics, see nrt_stat_param for meanings.+type Nrt_Stat =+ ( (String, Time)+ , (String, Int)+ , (String, Int)+ , (String, [(String, Int)])+ )++-- | Nrt_Stat names.+nrt_stat_param :: (String, String, String, String)+nrt_stat_param = ("duration", "# bundles", "# messages", "command set")++-- | Trivial Nrt statistics.+nrt_stat :: Nrt -> Nrt_Stat+nrt_stat (Nrt b_seq) =+ let b_msg = map bundleMessages b_seq+ in p4_zip+ nrt_stat_param+ ( bundleTime (last b_seq)+ , length b_seq+ , sum (map length b_msg)+ , histogram (concatMap (map messageAddress) b_msg)+ )
+ Sound/Sc3/Server/Nrt/Ugen.hs view
@@ -0,0 +1,62 @@+-- | Nrt from Ugen+module Sound.Sc3.Server.Nrt.Ugen where++import qualified Sound.Osc.Datum as Osc {- hosc -}+import qualified Sound.Osc.Packet as Osc {- hosc -}++import qualified Sound.Sc3.Common.Rate as Rate+import qualified Sound.Sc3.Server.Command.Plain as Server.Command+import qualified Sound.Sc3.Server.Enum as Server.Enum+import qualified Sound.Sc3.Server.Graphdef as Graphdef+import qualified Sound.Sc3.Server.Graphdef.Binary as Graphdef.Binary+import qualified Sound.Sc3.Server.Nrt as Nrt+import qualified Sound.Sc3.Server.Nrt.Render as Nrt.Render+import qualified Sound.Sc3.Server.Synthdef as Synthdef+import qualified Sound.Sc3.Ugen.Bindings.Db as Ugen.Binding+import qualified Sound.Sc3.Ugen.Ugen as Ugen++nrt_encoded_graphdef_rec :: Osc.Time -> Osc.Blob -> Nrt.Nrt+nrt_encoded_graphdef_rec dur graphdef =+ let m0 = Server.Command.d_recv_bytes graphdef+ m1 = Server.Command.s_new0 "Anonymous" 1 Server.Enum.AddToHead 0+ in Nrt.Nrt [Osc.bundle 0 [m0, m1], Osc.bundle dur [Server.Command.nrt_end]]++nrt_graphdef_rec :: Osc.Time -> Graphdef.Graphdef -> Nrt.Nrt+nrt_graphdef_rec dur graphdef = nrt_encoded_graphdef_rec dur (Graphdef.Binary.encode_graphdef graphdef)++nrt_syndef_rec :: Osc.Time -> Synthdef.Synthdef -> Nrt.Nrt+nrt_syndef_rec dur syndef = nrt_graphdef_rec dur (Synthdef.synthdef_to_graphdef syndef)++{- | Make Nrt score that runs Ugen for Time seconds to output bus zero.+If Ugen is at ControlRate insert 'k2a' Ugen.+-}+nrt_ugen_rec :: Osc.Time -> Ugen.Ugen -> Nrt.Nrt+nrt_ugen_rec dur ugen =+ let ugen' =+ case Ugen.rateOf ugen of+ Rate.AudioRate -> ugen+ Rate.ControlRate -> Ugen.Binding.k2a ugen+ _ -> error "nrt_ugen_rec: rate?"+ in nrt_syndef_rec dur (Synthdef.synthdef "Anonymous" (Ugen.Binding.out 0 ugen'))++-- | (osc-file, sound-file, sample-rate, sample-format, scsynth-options)+type Nrt_Opt = (FilePath, FilePath, Int, Server.Enum.SampleFormat, [String])++nrt_encoded_graphdef_render :: Nrt_Opt -> Osc.Time -> Int -> Osc.Blob -> IO ()+nrt_encoded_graphdef_render (osc_fn, sf_fn, sample_rate, fmt, opt) dur nc syndef = do+ let sc = nrt_encoded_graphdef_rec dur syndef+ Nrt.Render.nrt_render_plain (osc_fn, sf_fn, nc, sample_rate, fmt, opt) sc++nrt_syndef_render :: Nrt_Opt -> Osc.Time -> Int -> Synthdef.Synthdef -> IO ()+nrt_syndef_render (osc_fn, sf_fn, sample_rate, fmt, opt) dur nc syndef = do+ let sc = nrt_syndef_rec dur syndef+ Nrt.Render.nrt_render_plain (osc_fn, sf_fn, nc, sample_rate, fmt, opt) sc++{- | 'nrt_render_plain' of 'ugen_rec_nrt'.+The number of channels is equal to the degree of the Ugen.+-}+nrt_ugen_render :: Nrt_Opt -> Osc.Time -> Ugen.Ugen -> IO ()+nrt_ugen_render (osc_fn, sf_fn, sample_rate, fmt, opt) dur u = do+ let sc = nrt_ugen_rec dur u+ nc = length (Ugen.mceChannels u)+ Nrt.Render.nrt_render_plain (osc_fn, sf_fn, nc, sample_rate, fmt, opt) sc
+ Sound/Sc3/Server/Options.hs view
@@ -0,0 +1,113 @@+-- | scsynth server command-line options.+module Sound.Sc3.Server.Options where++import Data.List {- base -}++-- | (short-option, long-option, default-value)+type Sc3_Opt i = (Char, String, i)++-- | Get value from option.+sc3_opt_value :: Sc3_Opt i -> i+sc3_opt_value (_, _, v) = v++-- | Default host name string.+sc3_host_name_def :: String+sc3_host_name_def = "127.0.0.1"++-- | Default port number, either a 'u' or a 't' option is required.+sc3_port_def :: Num i => i+sc3_port_def = 57110++-- | Protocol is either Udp or Tcp.+data Sc3_Protocol = Sc3_Udp | Sc3_Tcp++sc3_protocol_def :: Sc3_Protocol+sc3_protocol_def = Sc3_Tcp++-- | Default port option.+sc3_opt_port_def :: Num i => Sc3_Protocol -> Sc3_Opt i+sc3_opt_port_def p =+ case p of+ Sc3_Udp -> ('u', "udp-port-number", sc3_port_def)+ Sc3_Tcp -> ('t', "tcp-port-number", sc3_port_def)++-- | Sc3 default options.+sc3_opt_def :: Num i => Sc3_Protocol -> [Sc3_Opt i]+sc3_opt_def p =+ sc3_opt_port_def p+ : [ ('a', "number-of-audio-bus-channels", 1024)+ , ('b', "number-of-sample-buffers", 1024)+ , -- ,('B',"bind-to-address","127.0.0.1")+ ('c', "number-of-control-bus-channels", 16384)+ , ('D', "load-synthdefs?", 1)+ , ('d', "max-number-of-synth-defs", 1024)+ , ('i', "number-of-input-bus-channels", 8)+ , ('l', "max-logins", 64)+ , ('m', "real-time-memory-size", 8192)+ , ('n', "max-number-of-nodes", 1024)+ , ('o', "number-of-output-bus-channels", 8)+ , ('r', "number-of-random-seeds", 64)+ , ('R', "publish-to-rendezvous?", 1)+ , ('S', "hardware-sample-rate", 0)+ , ('V', "verbosity", 0)+ , ('w', "number-of-wire-buffers", 64)+ , ('z', "block-size", 64)+ , ('Z', "hardware-buffer-size", 0)+ ]++-- | SC3 default options for Udp.+sc3_opt_def_udp :: Num i => [Sc3_Opt i]+sc3_opt_def_udp = sc3_opt_def Sc3_Udp++{- | Is option boolean, ie. 0=False and 1=True.++>>> filter sc3_opt_bool sc3_opt_def_udp+[('D',"load-synthdefs?",1),('R',"publish-to-rendezvous?",1)]+-}+sc3_opt_bool :: Sc3_Opt i -> Bool+sc3_opt_bool (_, s, _) = last s == '?'++-- | Lookup option given either short or long name.+sc3_opt_get :: [Sc3_Opt i] -> Either Char String -> Maybe i+sc3_opt_get opt k =+ case k of+ Left c -> fmap sc3_opt_value (find (\(o, _, _) -> o == c) opt)+ Right s -> fmap sc3_opt_value (find (\(_, o, _) -> o == s) opt)++{- | Set option given either short or long name.++>>> sc3_opt_get (sc3_opt_set sc3_opt_def_udp (Left 'w',256)) (Right "number-of-wire-buffers")+Just 256+-}+sc3_opt_set :: [Sc3_Opt i] -> (Either Char String, i) -> [Sc3_Opt i]+sc3_opt_set opt (k, v) =+ case k of+ Left x -> map (\(c, s, y) -> if c == x then (c, s, v) else (c, s, y)) opt+ Right x -> map (\(c, s, y) -> if s == x then (c, s, v) else (c, s, y)) opt++{- | Apply set of edits to options.++>>> unwords (sc3_opt_arg (sc3_opt_edit sc3_opt_def_udp [(Left 'w',256),(Left 'm',2 ^ 16)]))+"-u 57110 -a 1024 -b 1024 -c 16384 -D 1 -d 1024 -i 8 -l 64 -m 65536 -n 1024 -o 8 -r 64 -R 1 -S 0 -V 0 -w 256 -z 64 -Z 0"+-}+sc3_opt_edit :: [Sc3_Opt i] -> [(Either Char String, i)] -> [Sc3_Opt i]+sc3_opt_edit opt edt =+ case edt of+ [] -> opt+ x : rst -> sc3_opt_edit (sc3_opt_set opt x) rst++{- | Generate scsynth argument list.++>>> unwords (sc3_opt_arg sc3_opt_def_udp)+"-u 57110 -a 1024 -b 1024 -c 16384 -D 1 -d 1024 -i 8 -l 64 -m 8192 -n 1024 -o 8 -r 64 -R 1 -S 0 -V 0 -w 64 -z 64 -Z 0"+-}+sc3_opt_arg :: Show i => [Sc3_Opt i] -> [String]+sc3_opt_arg = concatMap (\(c, _, v) -> [['-', c], show v])++{- | Generate arguments for 'System.Process.callProcess' or related functions.++>>> let o = sc3_opt_def_udp in sc3_opt_cmd o == ("scsynth", sc3_opt_arg o)+True+-}+sc3_opt_cmd :: Show i => [Sc3_Opt i] -> (FilePath, [String])+sc3_opt_cmd opt = ("scsynth", sc3_opt_arg opt)
+ Sound/Sc3/Server/Param.hs view
@@ -0,0 +1,77 @@+-- | Synthesis parameters+module Sound.Sc3.Server.Param where++import Data.Function {- base -}+import Data.List {- base -}+import Data.Maybe {- base -}++import Data.List.Split {- split -}++import Sound.Sc3.Common.Math {- hsc3 -}++-- | An Sc3 synthesis parameter, ie. (controlName, controlValue).+type Param1 = (String, Double)++-- | Set of Sc3 synthesiser parameters.+type Param = [Param1]++-- | Add new, or overwrite existing, parameter.+param_insert :: Param -> Param1 -> Param+param_insert p z = z : deleteBy ((==) `on` fst) z p++{- | Merge, require keys be unique.++>>> param_merge_uniq [("a",1),("b",2)] [("c",3),("d",4)]+[("a",1.0),("b",2.0),("c",3.0),("d",4.0)]++> param_merge_uniq [("a",1)] [("a",2)] -- error+-}+param_merge_uniq :: Param -> Param -> Param+param_merge_uniq p1 p2 =+ case map fst p1 `intersect` map fst p2 of+ [] -> p1 ++ p2+ _ -> error "param_merge_uniq?"++{- | Merge, right biased.++>>> param_merge_r [("a",1),("b",2)] [("c",3),("a",4)]+[("b",2.0),("c",3.0),("a",4.0)]+-}+param_merge_r :: Param -> Param -> Param+param_merge_r p1 p2 =+ let p3 = let k2 = map fst p2 in filter (\(x, _) -> x `notElem` k2) p1+ in p3 ++ p2++{- | Right-fold (right-biased) of 'param_merge'++>>> param_merge_r_seq [[("a",1),("b",2)],[("c",3),("a",4)],[("b",5)]]+[("c",3.0),("a",4.0),("b",5.0)]+-}+param_merge_r_seq :: [Param] -> Param+param_merge_r_seq = foldr1 param_merge_r++-- | Lookup parameter value, with default.+param_get :: Param -> String -> Double -> Double+param_get p k v = fromMaybe v (lookup k p)++{- | Given (param-separator,key-value-separator) parse paramter string.++>>> param_parse (';','=') "a=1;b=2"+[("a",1.0),("b",2.0)]+-}+param_parse :: (Char, Char) -> String -> Param+param_parse (c1, c2) str =+ let f x = case splitOn [c2] x of+ [lhs, rhs] -> (lhs, read rhs)+ _ -> error ("param_parse: " ++ x)+ in if null str then [] else map f (splitOn [c1] str)++{- | Inverse of 'param_parse', /k/ is the precision to print values to.++>>> param_pp (';','=') 4 [("a",1),("b",2)]+"a=1.0;b=2.0"+-}+param_pp :: (Char, Char) -> Int -> Param -> String+param_pp (c1, c2) k =+ let f (lhs, rhs) = concat [lhs, [c2], double_pp k rhs]+ in concat . intersperse [c1] . map f
+ Sound/Sc3/Server/Recorder.hs view
@@ -0,0 +1,122 @@+-- | Recording scsynth.+module Sound.Sc3.Server.Recorder where++import Sound.Osc.Datum {- hosc -}+import Sound.Osc.Packet {- hosc -}++import Sound.Sc3.Common.Rate++import Sound.Sc3.Ugen.Bindings+import Sound.Sc3.Ugen.Util++import Sound.Sc3.Server.Command+import Sound.Sc3.Server.Enum+import Sound.Sc3.Server.Nrt+import Sound.Sc3.Server.Synthdef++-- | Parameters for recording scsynth.+data SC3_Recorder = SC3_Recorder+ { rec_sftype :: SoundFileFormat+ -- ^ Sound file format.+ , rec_coding :: SampleFormat+ -- ^ Sample format.+ , rec_fname :: FilePath+ -- ^ File name.+ , rec_nc :: Int+ -- ^ Number of channels.+ , rec_bus :: Int+ -- ^ Bus number.+ , rec_buf_id :: Int+ -- ^ ID of buffer to allocate.+ , rec_buf_frames :: Int+ -- ^ Number of frames at buffer.+ , rec_node_id :: Int+ -- ^ ID to allocate for node.+ , rec_group_id :: Int+ -- ^ Group to allocate node within.+ , rec_dur :: Maybe Time+ -- ^ Recoring duration if fixed.+ }++-- | Default recording structure.+default_SC3_Recorder :: SC3_Recorder+default_SC3_Recorder =+ SC3_Recorder+ { rec_sftype = Wave+ , rec_coding = PcmFloat+ , rec_fname = "/tmp/sc3-recorder.wav"+ , rec_nc = 2+ , rec_bus = 0+ , rec_buf_id = 10+ , rec_buf_frames = 65536+ , rec_node_id = 2001+ , rec_group_id = 0+ , rec_dur = Just 60+ }++-- | The name indicates the number of channels.+rec_synthdef_nm :: Int -> String+rec_synthdef_nm nc = "sc3-recorder-" ++ show nc++{- | Generate 'Synthdef' with required number of channels.++> Sound.Sc3.Ugen.Dot.draw (rec_synthdef 2)+-}+rec_synthdef :: Int -> Synthdef+rec_synthdef nc =+ let bufnum = control kr "bufnum" 0+ bus = control kr "bus" 0+ in synthdef (rec_synthdef_nm nc) (diskOut bufnum (in' nc ar bus))++{- | Asyncronous initialisation 'Message's ('d_recv', 'b_alloc' and 'b_write').++> withSc3 (sendBundle (bundle immediately (rec_init_m def)))+-}+rec_init_m :: SC3_Recorder -> [Message]+rec_init_m r =+ let buf = rec_buf_id r+ in [ d_recv (rec_synthdef (rec_nc r))+ , b_alloc buf (rec_buf_frames r) (rec_nc r)+ , b_write buf (rec_fname r) (rec_sftype r) (rec_coding r) (-1) 0 True+ ]++{- | Begin recording 'Message' ('s_new').++> withSc3 (sendMessage (rec_begin_m def))+-}+rec_begin_m :: SC3_Recorder -> Message+rec_begin_m r =+ s_new+ (rec_synthdef_nm (rec_nc r))+ (rec_node_id r)+ AddToTail+ (rec_group_id r)+ [ ("bus", fromIntegral (rec_bus r))+ , ("bufnum", fromIntegral (rec_buf_id r))+ ]++{- | End recording 'Message's ('n_free', 'b_close' and 'b_free').++> withSc3 (sendBundle (bundle immediately (rec_end_m def)))+-}+rec_end_m :: SC3_Recorder -> [Message]+rec_end_m r =+ [ n_free [rec_node_id r]+ , b_close (rec_buf_id r)+ , b_free (rec_buf_id r)+ ]++{- | 'Nrt' score for recorder, if 'rec_dur' is given schedule 'rec_end_m'.++> import Sound.Sc3+> withSc3 (Sound.Osc.sendMessage (dumpOSC TextPrinter))+> audition (out 0 (sinOsc ar (mce2 440 441) 0 * 0.1))+> let rc = default_SC3_Recorder {rec_dur = Just 5.0}+> nrt_audition (sc3_recorder rc)+-}+sc3_recorder :: SC3_Recorder -> Nrt+sc3_recorder r =+ let b0 = bundle 0 (rec_init_m r ++ [rec_begin_m r])+ in case rec_dur r of+ Nothing -> Nrt [b0]+ Just d -> Nrt [b0, bundle d (rec_end_m r)]
+ Sound/Sc3/Server/Scsynth.hs view
@@ -0,0 +1,64 @@+{- | Module to provide a stateful connection to scsynth.++The purpose is to store Osc Messages that should be sent when resetting the synthesiser.++This should, but does not:++- allow for Scsynth to be at a non-standard address+- allow for multiple Scsynth instances+-}+module Sound.Sc3.Server.Scsynth where++import Data.IORef {- base -}++import qualified Sound.Osc.Packet as Osc {- hosc -}++import Sound.Sc3.Ugen.Ugen {- hsc3 -}+import Sound.Sc3.Ugen.Util {- hsc3 -}++import Sound.Sc3.Server.Transport.Monad {- hsc3 -}++-- | Scsynth state.+data Scsynth = Scsynth {scsynthResetMessages :: IORef [Osc.Message]}++-- | Scsynth with no messages or allocated buffers.+newScsynth :: IO Scsynth+newScsynth = fmap Scsynth (newIORef [])++-- | Print onReset messages.+scsynthPrint :: Scsynth -> IO ()+scsynthPrint (Scsynth mRef) = do+ m <- readIORef mRef+ print m++{- | Add a sequence of messages to be sent on scsynth reset.++> scsynth <- newScsynth+> scsynthOnReset scsynth [b_free 100]+> scsynthPrint scsynth+-}+scsynthOnReset :: Scsynth -> [Osc.Message] -> IO ()+scsynthOnReset (Scsynth mRef) messages =+ if not (null messages)+ then modifyIORef' mRef (++ messages)+ else return ()++-- | reset scsynth, send all stored onReset messages, clear the onReset message store.+scsynthReset :: Scsynth -> IO ()+scsynthReset (Scsynth mRef) = do+ onResetMessages <- readIORef mRef+ writeIORef mRef []+ withSc3 (reset >> mapM_ maybe_async onResetMessages)++{- | Play Ugen at Scsynth.+Send any required initialisation messages and stores and onReset messages.+-}+scsynthPlayAt :: Scsynth -> Play_Opt -> Ugen -> IO ()+scsynthPlayAt scsynth opt ugen = do+ let (pre, post) = ugenCollectBrackets ugen+ if not (null post) then scsynthOnReset scsynth post else return ()+ withSc3 (mapM_ maybe_async pre >> playAt opt ugen)++-- | scsynthPlayAt with default options.+scsynthPlay :: Scsynth -> Ugen -> IO ()+scsynthPlay scsynth = scsynthPlayAt scsynth def_play_opt
+ Sound/Sc3/Server/Status.hs view
@@ -0,0 +1,180 @@+{- | Request and display status information from the synthesis server.++\/status messages receive \/status.reply messages.++\/g_queryTree messages recieve \/g_queryTree.reply messages.+-}+module Sound.Sc3.Server.Status where++import Data.List {- base -}+import Data.Maybe {- base -}+import Text.Printf {- base -}++import qualified Data.ByteString.Char8 as C {- bytestring -}+import qualified Data.Tree as T {- containers -}+import qualified Safe {- safe -}++import Sound.Osc.Datum {- hosc -}+import Sound.Osc.Text {- hosc -}++import Sound.Sc3.Server.Command.Plain++-- * Status++-- | Get /n/th field of /status.reply message as 'Floating'.+extractStatusField :: Floating n => Int -> [Datum] -> n+extractStatusField n =+ fromMaybe (error "extractStatusField")+ . datum_floating+ . flip (Safe.atNote "extractStatusField") n++-- | Names of /status.reply fields sent in reply to /status request.+statusFields :: [String]+statusFields =+ [ "Unused "+ , "# Ugens "+ , "# Synths "+ , "# Groups "+ , "# Synthdefs "+ , "% CPU (Average) "+ , "% CPU (Peak) "+ , "Sample Rate (Nominal) "+ , "Sample Rate (Actual) "+ ]++-- | Status pretty printer.+statusFormat :: [Datum] -> [String]+statusFormat d =+ let s = "***** SuperCollider Server Status *****"+ t = Safe.tailNote "statusFormat"+ in s : zipWith (++) (t statusFields) (map (showDatum (Just 5)) (t d))++-- | Concise pretty printer, one line, omits Peak-Cpu and Nominal-Sr.+status_format_concise :: [Datum] -> String+status_format_concise d =+ case d of+ [Int32 _, Int32 ugn, Int32 grp, Int32 syn, Int32 ins, Float cpu1, Float _cpu2, Double _sr1, Double sr2] ->+ printf+ "UGN=%-5d GRP=%-5d SYN=%-5d INS=%-5d CPU=%-5.1f SR=%-7.1f"+ ugn+ grp+ syn+ ins+ cpu1+ sr2+ _ -> error "status_format_concise?"++-- * Query Group++-- | Name or index and value or bus mapping.+type Query_Ctl = (Either String Int, Either Double Int)++-- | Nodes are either groups of synths.+data Query_Node+ = Query_Group Group_Id [Query_Node]+ | Query_Synth Synth_Id String (Maybe [Query_Ctl])+ deriving (Eq, Show)++-- | Pretty-print 'Query_Ctl'+query_ctl_pp :: Query_Ctl -> String+query_ctl_pp (p, q) = either id show p ++ ":" ++ either show show q++-- | Pretty-print 'Query_Node'+query_node_pp :: Query_Node -> String+query_node_pp n =+ case n of+ Query_Group k _ -> show k+ Query_Synth k nm c ->+ let c' = unwords (maybe [] (map query_ctl_pp) c)+ in show (k, nm, c')++{- | Control (parameter) data may be given as names or indices and as+values or bus mappings.++> queryTree_ctl (string "freq",float 440) == (Left "freq",Left 440.0)+> queryTree_ctl (int32 1,string "c0") == (Right 1,Right 0)+-}+queryTree_ctl :: (Datum, Datum) -> Query_Ctl+queryTree_ctl (p, q) =+ let err msg val = error (show ("queryTree_ctl", msg, val))+ f d = case d of+ AsciiString nm -> Left (C.unpack nm)+ Int32 ix -> Right (fromIntegral ix)+ _ -> err "string/int32" d+ g d = case d of+ Float k -> Left (realToFrac k)+ AsciiString b -> case C.unpack b of+ 'c' : n -> Right (read n)+ _ -> err "c:_" d+ _ -> err "float/string" d+ in (f p, g q)++{- | If /rc/ is 'True' then 'Query_Ctl' data is expected (ie. flag was set at @\/g_queryTree@).+/k/ is the synth-id, and /nm/ the name.++> let d = [int32 1,string "freq",float 440]+> in queryTree_synth True 1000 "saw" d+-}+queryTree_synth :: Bool -> Synth_Id -> String -> [Datum] -> (Query_Node, [Datum])+queryTree_synth rc k nm d =+ let pairs l = case l of+ e0 : e1 : l' -> (e0, e1) : pairs l'+ _ -> []+ f r = case r of+ Int32 n : r' ->+ let (p, r'') = genericSplitAt (n * 2) r'+ in (map queryTree_ctl (pairs p), r'')+ _ -> error "queryTree_synth"+ in if rc+ then+ let (p, d') = f d+ in (Query_Synth k nm (Just p), d')+ else (Query_Synth k nm Nothing, d)++-- | Generate 'Query_Node' for indicated 'Group_Id'.+queryTree_group :: Bool -> Group_Id -> Int -> [Datum] -> (Query_Node, [Datum])+queryTree_group rc gid nc =+ let recur n r d =+ if n == 0+ then (Query_Group gid (reverse r), d)+ else+ let (c, d') = queryTree_child rc d+ in recur (n - 1) (c : r) d'+ in recur nc []++-- | Either 'queryTree_synth' or 'queryTree_group'.+queryTree_child :: Bool -> [Datum] -> (Query_Node, [Datum])+queryTree_child rc d =+ case d of+ Int32 nid : Int32 (-1) : AsciiString nm : d' ->+ queryTree_synth rc (fromIntegral nid) (C.unpack nm) d'+ Int32 gid : Int32 nc : d' ->+ queryTree_group rc (fromIntegral gid) (fromIntegral nc) d'+ _ -> error "queryTree_child"++-- | Parse result of ' g_queryTree '.+queryTree :: [Datum] -> Query_Node+queryTree d =+ case d of+ Int32 rc : Int32 gid : Int32 nc : d' ->+ let rc' = rc /= 0+ gid' = fromIntegral gid+ nc' = fromIntegral nc+ in case queryTree_group rc' gid' nc' d' of+ (r, []) -> r+ _ -> error "queryTree"+ _ -> error "queryTree"++-- | Extact sequence of 'Group_Id's from 'Query_Node'.+queryNode_to_group_seq :: Query_Node -> [Group_Id]+queryNode_to_group_seq nd =+ case nd of+ Query_Group k ch -> k : concatMap queryNode_to_group_seq ch+ Query_Synth _ _ _ -> []++-- | Transform 'Query_Node' to 'T.Tree'.+queryTree_rt :: Query_Node -> T.Tree Query_Node+queryTree_rt n =+ case n of+ Query_Synth _ _ _ -> T.Node n []+ Query_Group _ c -> T.Node n (map queryTree_rt c)
+ Sound/Sc3/Server/Synthdef.hs view
@@ -0,0 +1,108 @@+-- | The unit-generator graph structure implemented by the SuperCollider synthesis server.+module Sound.Sc3.Server.Synthdef where++import qualified Data.ByteString.Lazy as L {- bytestring -}++import qualified Sound.Sc3.Ugen.Graph as Graph {- hsc3 -}+import qualified Sound.Sc3.Ugen.Help.Graph as Help.Graph {- hsc3 -}+import qualified Sound.Sc3.Ugen.Ugen as Ugen {- hsc3 -}++import qualified Sound.Sc3.Server.Graphdef as Graphdef {- hsc3 -}+import qualified Sound.Sc3.Server.Graphdef.Binary as Graphdef.Binary {- hsc3 -}+import qualified Sound.Sc3.Server.Graphdef.Graph as Graphdef.Graph {- hsc3 -}+import qualified Sound.Sc3.Server.Param as Param {- hsc3 -}++-- | A named unit generator graph.+data Synthdef = Synthdef+ { synthdefName :: String+ , synthdefUgen :: Ugen.Ugen+ }+ deriving (Eq, Show)++-- | Alias for 'Synthdef'.+synthdef :: String -> Ugen.Ugen -> Synthdef+synthdef = Synthdef++{- | The Sc3 /default/ instrument 'Synthdef', see 'default_ugen_graph'.++> import Sound.Osc {\- hosc -\}+> import Sound.Sc3 {\- hsc3 -\}+> withSc3 (sendMessage (d_recv defaultSynthdef))+> audition defaultSynthdef+-}+defaultSynthdef :: Synthdef+defaultSynthdef = synthdef "default" Help.Graph.default_ugen_graph++{- | The Sc3 /default/ sample (buffer) playback instrument 'Synthdef',+see 'default_sampler_ugen_graph'.++> withSc3 (sendMessage (d_recv (defaultSampler False)))+> audition (defaultSampler False)+-}+defaultSampler :: Bool -> Synthdef+defaultSampler use_gate =+ let nm = "default-sampler-" ++ if use_gate then "gate" else "fixed"+ in synthdef nm (Help.Graph.default_sampler_ugen_graph use_gate)++-- | 'ugen_to_graph' of 'synthdefUgen'.+synthdefGraph :: Synthdef -> Graph.U_Graph+synthdefGraph = Graph.ugen_to_graph . synthdefUgen++{- | Parameter names at 'Synthdef'.++>>> synthdefParam defaultSynthdef+[("amp",0.1),("pan",0.0),("gate",1.0),("freq",440.0),("out",0.0)]+-}+synthdefParam :: Synthdef -> Param.Param+synthdefParam =+ map (\n -> (Graph.u_node_k_name n, Graph.u_node_k_default n))+ . Graph.ug_controls+ . synthdefGraph++-- | 'graph_to_graphdef' at 'Synthdef'.+synthdef_to_graphdef :: Synthdef -> Graphdef.Graphdef+synthdef_to_graphdef (Synthdef nm u) = Graphdef.Graph.graph_to_graphdef nm (Graph.ugen_to_graph u)++-- | 'graph_to_graphdef' at 'Synthdef'.+ugen_to_graphdef :: Ugen.Ugen -> Graphdef.Graphdef+ugen_to_graphdef = synthdef_to_graphdef . Synthdef "anonymous"++-- | Encode 'Synthdef' as a binary data stream.+synthdefData :: Synthdef -> L.ByteString+synthdefData = Graphdef.Binary.encode_graphdef . synthdef_to_graphdef++-- | Write 'Synthdef' to indicated file.+synthdefWrite :: FilePath -> Synthdef -> IO ()+synthdefWrite fn = Graphdef.Binary.graphdefWrite fn . synthdef_to_graphdef++{- | Write 'Synthdef' to indicated directory. The filename is the+'synthdefName' with the appropriate extension (@scsyndef@).+-}+synthdefWrite_dir :: FilePath -> Synthdef -> IO ()+synthdefWrite_dir dir = Graphdef.Binary.graphdefWrite_dir dir . synthdef_to_graphdef++-- | 'graph_stat_ln' of 'synth'.+synthstat_ln :: Ugen.Ugen -> [String]+synthstat_ln = Graph.ug_stat_ln . Graph.ugen_to_graph++-- | 'unlines' of 'synthstat_ln'.+synthstat :: Ugen.Ugen -> String+synthstat = unlines . synthstat_ln++{- | 'putStrLn' of 'synthstat'.++> synthstat_wr Sound.Sc3.Ugen.Help.Graph.default_ugen_graph+-}+synthstat_wr :: Ugen.Ugen -> IO ()+synthstat_wr = putStrLn . synthstat++{- | Variant without Ugen sequence.++> putStrLn $ synthstat_concise (default_sampler_ugen_graph True)+-}+synthstat_concise :: Ugen.Ugen -> String+synthstat_concise = unlines . reverse . drop 1 . reverse . synthstat_ln++-- | 'graphdef_dump_ugens' of 'ugen_to_graphdef'+ugen_dump_ugens :: Ugen.Ugen -> IO ()+ugen_dump_ugens = Graphdef.graphdef_dump_ugens . ugen_to_graphdef
+ Sound/Sc3/Server/Transport/Fd.hs view
@@ -0,0 +1,210 @@+{- | /Fd/ variant of interaction with the scsynth server.++This duplicates functions at 'Sound.Sc3.Server.Transport.Monad' and+at some point at least part of the duplication will be removed.+-}+module Sound.Sc3.Server.Transport.Fd where++import Control.Monad {- base -}+import Data.List {- base -}+import Data.Maybe {- base -}+import System.Environment {- base -}+import System.FilePath {- filepath -}++import qualified Data.ByteString.Lazy as L {- bytestring -}+import qualified Data.List.Split as Split {- split -}+import qualified Safe {- safe -}++import Sound.Osc.Fd {- hosc -}++import Sound.Sc3.Server.Command+import Sound.Sc3.Server.Enum+import qualified Sound.Sc3.Server.Graphdef as Graphdef+import qualified Sound.Sc3.Server.Graphdef.Binary as Graphdef+import qualified Sound.Sc3.Server.Nrt as Nrt+import qualified Sound.Sc3.Server.Status as Status+import Sound.Sc3.Server.Synthdef+import Sound.Sc3.Ugen.Ugen++-- * hosc variants++-- | Send a 'Message' and 'waitReply' for a @\/done@ reply.+async :: Transport t => t -> Message -> IO Message+async fd m = sendMessage fd m >> waitReply fd "/done"++-- | If 'isAsync' then 'void' 'async' else 'sendMessage'.+maybe_async :: (Transport t) => t -> Message -> IO ()+maybe_async fd m = if isAsync m then void (async fd m) else sendMessage fd m++-- | Variant that timestamps synchronous messages.+maybe_async_at :: (Transport t) => t -> Time -> Message -> IO ()+maybe_async_at fd t m =+ if isAsync m+ then void (async fd m)+ else sendBundle fd (bundle t [m])++{- | Read ScTransport, ScHostname and ScPort environment variables.+Default values are: Tcp, 127.0.0.1 and 57110.+-}+defaultSc3OscSocketAddress :: IO OscSocketAddress+defaultSc3OscSocketAddress = do+ let f key defaultValue = fmap (fromMaybe defaultValue) (lookupEnv key)+ protocol <- f "ScTransport" "Tcp"+ hostname <- f "ScHostname" "127.0.0.1"+ port <- f "ScPort" "57110"+ return (read protocol, hostname, read port)++-- | Bracket @Sc3@ communication.+withSc3 :: (OscSocket -> IO a) -> IO a+withSc3 process = do+ address <- defaultSc3OscSocketAddress+ withTransport (openOscSocket address) process++-- * Server control++-- | Free all nodes ('g_freeAll') at group @1@.+stop :: Transport t => t -> IO ()+stop fd = sendMessage fd (g_freeAll [1])++-- | Free all nodes ('g_freeAll') at and re-create groups @1@ and @2@.+reset :: Transport t => t -> IO ()+reset fd = do+ sendMessage fd (g_freeAll [1, 2])+ sendMessage fd (g_new [(1, AddToTail, 0), (2, AddToTail, 0)])++-- | Send 'd_recv' and 's_new' messages to scsynth.+playGraphdef :: Transport t => Int -> t -> Graphdef.Graphdef -> IO ()+playGraphdef k fd g = do+ let nm = ascii_to_string (Graphdef.graphdef_name g)+ fn = "/tmp" </> nm <.> "scsyndef"+ by = Graphdef.encode_graphdef g+ sz = L.length by+ if sz < 65507+ then void (async fd (d_recv_bytes by))+ else Graphdef.graphdefWrite fn g >> async fd (d_load fn) >> sendMessage fd (s_new0 nm k AddToTail 1)++-- | 'playGraphdef' of 'synthdef_to_graphdef'.+playSynthdef :: Transport t => Int -> t -> Synthdef -> IO ()+playSynthdef k fd = playGraphdef k fd . synthdef_to_graphdef++-- | Send an /anonymous/ instrument definition using 'playSynthdef'.+playUgen :: Transport t => Int -> t -> Ugen -> IO ()+playUgen k fd = playSynthdef k fd . synthdef "Anonymous"++-- * Non-real time++{- | Wait ('pauseThreadUntil') until bundle is due to be sent relative+to initial 'Time', then send each message, asynchronously if+required.+-}+run_bundle :: Transport t => t -> Time -> BundleOf Message -> IO ()+run_bundle fd t0 b = do+ let t = t0 + bundleTime b+ latency = 0.1+ pauseThreadUntil (t - latency)+ mapM_ (maybe_async_at fd t) (bundleMessages b)++{- | Perform an 'Nrt' score (as would be rendered by 'writeNrt'). In+particular note that all timestamps /must/ be in 'NTPr' form.+-}+nrt_play :: Transport t => t -> Nrt.Nrt -> IO ()+nrt_play fd sc = time >>= \t0 -> mapM_ (run_bundle fd t0) (Nrt.nrt_bundles sc)++-- | 'withSc3' of 'nrt_play'+nrt_audition :: Nrt.Nrt -> IO ()+nrt_audition sc = withSc3 (`nrt_play` sc)++-- * Audible++-- | Class for values that can be encoded and sent to @scsynth@ for audition.+class Audible e where+ play_id :: Transport t => Int -> t -> e -> IO ()+ play :: Transport t => t -> e -> IO ()+ play = play_id (-1)++instance Audible Graphdef.Graphdef where+ play_id = playGraphdef++instance Audible Synthdef where+ play_id = playSynthdef++instance Audible Ugen where+ play_id = playUgen++-- | 'withSc3' of 'play_id'+audition_id :: Audible e => Int -> e -> IO ()+audition_id k e = withSc3 (\fd -> play_id k fd e)++-- | 'audition_id' of @-1@.+audition :: Audible e => e -> IO ()+audition = audition_id (-1)++-- * Notifications++{- | Turn on notifications, run /f/, turn off notifications, return+result.+-}+withNotifications :: Transport t => t -> (t -> IO a) -> IO a+withNotifications fd f = do+ _ <- async fd (notify True)+ r <- f fd+ _ <- async fd (notify False)+ return r++-- * Buffer++{- | Variant of 'b_getn1' that waits for return message and unpacks it.++> withSc3 (\fd -> b_getn1_data fd 0 (0,5))+-}+b_getn1_data :: Transport t => t -> Int -> (Int, Int) -> IO [Double]+b_getn1_data fd b s = do+ let f m = let (_, _, _, r) = unpack_b_setn_err m in r+ sendMessage fd (b_getn1 b s)+ fmap f (waitReply fd "/b_setn")++{- | Variant of 'b_getn1_data' that segments individual 'b_getn'+messages to /n/ elements.++> withSc3 (\fd -> b_getn1_data_segment fd 1 0 (0,5))+-}+b_getn1_data_segment :: Transport t => t -> Int -> Int -> (Int, Int) -> IO [Double]+b_getn1_data_segment fd n b (i, j) = do+ let ix = b_indices n j i+ d <- mapM (b_getn1_data fd b) ix+ return (concat d)++-- | Variant of 'b_getn1_data_segment' that gets the entire buffer.+b_fetch :: Transport t => t -> Int -> Int -> IO [[Double]]+b_fetch fd n b = do+ let f m =+ let (_, nf, nc, _) = unpack_b_info_err m+ ix = (0, nf * nc)+ deinterleave = transpose . Split.chunksOf nc+ in fmap deinterleave (b_getn1_data_segment fd n b ix)+ sendMessage fd (b_query1 b)+ waitReply fd "/b_info" >>= f++-- | 'head' of 'b_fetch'.+b_fetch1 :: Transport t => t -> Int -> Int -> IO [Double]+b_fetch1 fd n b = fmap (Safe.headNote "b_fetch1") (b_fetch fd n b)++-- * Status++-- | Collect server status information.+serverStatus :: Transport t => t -> IO [String]+serverStatus = fmap Status.statusFormat . serverStatusData++-- | Read nominal sample rate of server.+serverSampleRateNominal :: Transport t => t -> IO Double+serverSampleRateNominal = fmap (Status.extractStatusField 7) . serverStatusData++-- | Read actual sample rate of server.+serverSampleRateActual :: Transport t => t -> IO Double+serverSampleRateActual = fmap (Status.extractStatusField 8) . serverStatusData++-- | Retrieve status data from server.+serverStatusData :: Transport t => t -> IO [Datum]+serverStatusData fd = do+ sendMessage fd status+ waitDatum fd "/status.reply"
+ Sound/Sc3/Server/Transport/Monad.hs view
@@ -0,0 +1,433 @@+-- | /Monad/ variant of interaction with the scsynth server.+module Sound.Sc3.Server.Transport.Monad where++import Control.Monad {- base -}+import Data.List {- base -}+import Data.Maybe {- base -}++import System.Directory {- directory -}+import System.FilePath {- filepath -}++import qualified Data.ByteString.Lazy as L {- bytestring -}+import qualified Data.List.Split as Split {- split -}+import qualified Data.Tree as Tree {- containers -}+import qualified Safe {- safe -}++import Sound.Osc {- hosc -}+import qualified Sound.Osc.Time.Timeout {- hosc -}++import qualified Sound.Sc3.Common.Base.System as System+import qualified Sound.Sc3.Server.Command as Command+import qualified Sound.Sc3.Server.Command.Generic as Generic+import qualified Sound.Sc3.Server.Enum as Enum+import qualified Sound.Sc3.Server.Graphdef as Graphdef+import qualified Sound.Sc3.Server.Graphdef.Binary as Graphdef+import qualified Sound.Sc3.Server.Nrt as Nrt+import qualified Sound.Sc3.Server.Status as Status+import qualified Sound.Sc3.Server.Synthdef as Synthdef+import qualified Sound.Sc3.Ugen.Bindings.Composite as Composite+import qualified Sound.Sc3.Ugen.Ugen as Ugen++{-+import qualified Control.Monad.IO.Class as M {- transformers -}+import qualified Control.Monad.Trans.Reader as R {- transformers -}+import qualified Sound.Sc3.Server.Transport.FD as FD+-}++-- * hosc variants++-- | 'sendMessage' and 'waitReply' for a @\/done@ reply.+async :: DuplexOsc m => Message -> m Message+async m = sendMessage m >> waitReply "/done"++-- | 'void' of 'async'.+async_ :: DuplexOsc m => Message -> m ()+async_ = void . async++-- | If 'isAsync' then 'async_' else 'sendMessage'.+maybe_async :: DuplexOsc m => Message -> m ()+maybe_async m = if Command.isAsync m then async_ m else sendMessage m++-- | Variant that timestamps synchronous messages.+maybe_async_at :: DuplexOsc m => Time -> Message -> m ()+maybe_async_at t m =+ if Command.isAsync m+ then async_ m+ else sendBundle (bundle t [m])++{- | Hostname and port number.+By default Tcp, 127.0.0.1 and 57110.+-}+type Sc3_Address = OscSocketAddress++{- | Sc3 default address.++>>> sc3_default_address+(Tcp,"127.0.0.1",57110)+-}+sc3_default_address :: Sc3_Address+sc3_default_address = (Tcp, "127.0.0.1", 57110)++{- | Lookup ScSynth address at ScHostname and ScPort.+If either is no set default values are used.++>>> import System.Environment+>>> setEnv "ScHostname" "192.168.1.53"+>>> sc3_env_or_default_address+(Udp,"192.168.1.53",57110)+-}+sc3_env_or_default_address :: IO Sc3_Address+sc3_env_or_default_address = do+ protocol <- System.lookup_env_default "ScProtocol" "Tcp"+ hostname <- System.lookup_env_default "ScHostname" "127.0.0.1"+ port <- System.lookup_env_default "ScPort" "57110"+ return (read protocol, hostname, read port)++{- | Maximum packet size, in bytes, that can be sent over Udp.+However, see also <https://tools.ietf.org/html/rfc2675>.+Tcp is now the default transport mechanism for Hsc3.+-}+sc3_udp_limit :: Num n => n+sc3_udp_limit = 65507++-- | Bracket @Sc3@ communication at indicated host and port.+withSc3At :: Sc3_Address -> Connection OscSocket a -> IO a+withSc3At address = withTransport (openOscSocket address)++{- | Bracket @Sc3@ communication, ie. 'withSc3At' 'sc3_env_or_default_address'.++> import Sound.Sc3.Server.Command++> withSc3 (sendMessage status >> waitReply "/status.reply")+-}+withSc3 :: Connection OscSocket a -> IO a+withSc3 f = do+ addr <- sc3_env_or_default_address+ withSc3At addr f++-- | 'void' of 'withSc3'.+withSc3_ :: Connection OscSocket a -> IO ()+withSc3_ = void . withSc3++-- | 'timeout_r' of 'withSc3'+withSc3_tm :: Double -> Connection OscSocket a -> IO (Maybe a)+withSc3_tm tm = Sound.Osc.Time.Timeout.timeout_r tm . withSc3++{- | Run /f/ at /k/ scsynth servers with sequential port numbers starting at 'Options.sc3_port_def'.++> withSc3AtSeq sc3_default_address 2 (sendMessage status >> waitReply "/status.reply")+-}+withSc3AtSeq :: Sc3_Address -> Int -> Connection OscSocket a -> IO [a]+withSc3AtSeq (protocol, hostname, port) k f = do+ let mk_socket i = openOscSocket (protocol, hostname, port + i)+ mapM (\i -> withTransport (mk_socket i) f) [0 .. k - 1]++-- | 'void' of 'withSc3AtSeq'.+withSc3AtSeq_ :: Sc3_Address -> Int -> Connection OscSocket a -> IO ()+withSc3AtSeq_ loc k = void . withSc3AtSeq loc k++-- * Server control++-- | Free all nodes ('g_freeAll') at group @1@.+stop :: SendOsc m => m ()+stop = sendMessage (Command.g_freeAll [1])++-- * Composite++-- | Runs 'clearSched' and then frees and re-creates groups @1@ and @2@.+reset :: SendOsc m => m ()+reset =+ let m =+ [ Command.clearSched+ , Command.n_free [1, 2]+ , Command.g_new [(1, Enum.AddToHead, 0), (2, Enum.AddToTail, 0)]+ ]+ in sendBundle (bundle immediately m)++-- | (node-id,add-action,group-id,parameters)+type Play_Opt = (Command.Node_Id, Enum.AddAction, Command.Group_Id, [(String, Double)])++-- | Make 's_new' message to play 'Graphdef.Graphdef'.+play_graphdef_msg :: Play_Opt -> Graphdef.Graphdef -> Message+play_graphdef_msg (nid, act, gid, param) g =+ let nm = ascii_to_string (Graphdef.graphdef_name g)+ in Command.s_new nm nid act gid param++{- | If the graph size is less than 'sc3_udp_limit' encode and send+using 'd_recv_bytes', else write to temporary directory and read+using 'd_load'.+-}+recv_or_load_graphdef :: Transport m => Graphdef.Graphdef -> m Message+recv_or_load_graphdef g = do+ tmp <- liftIO getTemporaryDirectory+ let nm = ascii_to_string (Graphdef.graphdef_name g)+ fn = tmp </> nm <.> "scsyndef"+ by = Graphdef.encode_graphdef g+ sz = L.length by+ if sz < sc3_udp_limit+ then async (Command.d_recv_bytes by)+ else liftIO (Graphdef.graphdefWrite fn g) >> async (Command.d_load fn)++-- | Send 'd_recv' and 's_new' messages to scsynth.+playGraphdef :: Transport m => Play_Opt -> Graphdef.Graphdef -> m ()+playGraphdef opt g = recv_or_load_graphdef g >> sendMessage (play_graphdef_msg opt g)++-- | Send 'd_recv' and 's_new' messages to scsynth.+playSynthdef :: Transport m => Play_Opt -> Synthdef.Synthdef -> m ()+playSynthdef opt = playGraphdef opt . Synthdef.synthdef_to_graphdef++-- | Send an /anonymous/ instrument definition using 'playSynthdef'.+playUgen :: Transport m => Play_Opt -> Ugen.Ugen -> m ()+playUgen loc =+ playSynthdef loc+ . Synthdef.synthdef "Anonymous"+ . Composite.wrapOut Nothing++-- * Nrt++-- | Read latency from environment, defaulting to 0.1 seconds.+sc_latency :: IO Double+sc_latency = fmap read (System.lookup_env_default "ScLatency" "0.1")++{- | Wait ('pauseThreadUntil') until bundle is due to be sent relative+to the initial 'Time', then send each message, asynchronously if+required.+-}+run_bundle :: Transport m => Double -> Time -> BundleOf Message -> m ()+run_bundle latency t0 b = do+ let t = t0 + bundleTime b+ liftIO (pauseThreadUntil (t - latency))+ mapM_ (maybe_async_at t) (bundleMessages b)++{- | Play an 'Nrt' score (as would be rendered by 'writeNrt').++> let sc = Nrt [bundle 1 [s_new0 "default" (-1) AddToHead 1]+> ,bundle 2 [n_set1 (-1) "gate" 0]]+> in withSc3 (nrt_play sc)+-}+nrt_play :: Transport m => Nrt.Nrt -> m ()+nrt_play sc = do+ t0 <- liftIO time+ latency <- liftIO sc_latency+ mapM_ (run_bundle latency t0) (Nrt.nrt_bundles sc)++{- | Variant where asynchronous commands at time @0@ are separated out and run before+the initial time-stamp is taken. This re-orders synchronous+commands in relation to asynchronous at time @0@.+-}+nrt_play_reorder :: Transport m => Nrt.Nrt -> m ()+nrt_play_reorder s = do+ let (i, r) = Nrt.nrt_span (<= 0) s+ i' = concatMap bundleMessages i+ (a, b) = Command.partition_async i'+ mapM_ async a+ t0 <- liftIO time+ latency <- liftIO sc_latency+ mapM_ (run_bundle latency t0) (Bundle 0 b : r)++-- | 'withSc3' of 'nrt_play'.+nrt_audition :: Nrt.Nrt -> IO ()+nrt_audition = withSc3 . nrt_play++-- * Audible++-- | Class for values that can be encoded and send to @scsynth@ for audition.+class Audible e where+ playAt :: Transport m => Play_Opt -> e -> m ()++ -- | Variant where /id/ is @-1@.+ play :: Transport m => e -> m ()+ play = playAt (-1, Enum.AddToHead, 1, [])++instance Audible Graphdef.Graphdef where+ playAt = playGraphdef++instance Audible Synthdef.Synthdef where+ playAt = playSynthdef++instance Audible Ugen.Ugen where+ playAt = playUgen++-- | 'withSc3At' of 'playAt'.+auditionAt :: Audible e => Sc3_Address -> Play_Opt -> e -> IO ()+auditionAt loc opt = withSc3At loc . playAt opt++-- | 'withSc3AtSeq' of 'playAt'.+auditionAtSeq :: Audible e => Sc3_Address -> Play_Opt -> Int -> e -> IO ()+auditionAtSeq loc opt k = withSc3AtSeq_ loc k . playAt opt++-- | Default 'Play_Opt', ie. (-1,addToHead,1,[])+def_play_opt :: Play_Opt+def_play_opt = (-1, Enum.AddToHead, 1, [])++-- | 'auditionAt' 'sc3_env_or_default_address'+auditionOpt :: Audible e => Play_Opt -> e -> IO ()+auditionOpt o e = do+ addr <- sc3_env_or_default_address+ auditionAt addr o e++-- | 'auditionOpt' 'def_play_opt'+audition :: Audible e => e -> IO ()+audition = auditionOpt def_play_opt++-- | 'auditionAtSeq' 'def_play_opt'+auditionSeq :: Audible e => Int -> e -> IO ()+auditionSeq k x = do+ addr <- sc3_env_or_default_address+ auditionAtSeq addr def_play_opt k x++-- * Notifications++-- | Turn on notifications, run /f/, turn off notifications, return result.+withNotifications :: DuplexOsc m => m a -> m a+withNotifications f = do+ async_ (Command.notify True)+ r <- f+ async_ (Command.notify False)+ return r++-- * Buffer & control & node variants.++{- | Variant of 'b_getn1' that waits for return message and unpacks it.++> withSc3_tm 1.0 (b_getn1_data 0 (0,5))+-}+b_getn1_data :: DuplexOsc m => Int -> (Int, Int) -> m [Double]+b_getn1_data b s = do+ let f m = let (_, _, _, r) = Command.unpack_b_setn_err m in r+ sendMessage (Command.b_getn1 b s)+ fmap f (waitReply "/b_setn")++{- | Variant of 'b_getn1_data' that segments individual 'b_getn'+messages to /n/ elements.++> withSc3_tm 1.0 (b_getn1_data_segment 1 0 (0,5))+-}+b_getn1_data_segment ::+ DuplexOsc m =>+ Int ->+ Int ->+ (Int, Int) ->+ m [Double]+b_getn1_data_segment n b (i, j) = do+ let ix = Command.b_indices n j i+ d <- mapM (b_getn1_data b) ix+ return (concat d)++-- | Variant of 'b_getn1_data_segment' that gets the entire buffer.+b_fetch :: DuplexOsc m => Int -> Int -> m [[Double]]+b_fetch n b = do+ let f m =+ let (_, nf, nc, _) = Command.unpack_b_info_err m+ ix = (0, nf * nc)+ deinterleave = transpose . Split.chunksOf nc+ in fmap deinterleave (b_getn1_data_segment n b ix)+ sendMessage (Command.b_query1 b)+ waitReply "/b_info" >>= f++{- | First channel of 'b_fetch', errors if there is no data.++> withSc3 (b_fetch1 512 123456789)+-}+b_fetch1 :: DuplexOsc m => Int -> Int -> m [Double]+b_fetch1 n b = fmap (Safe.headNote "b_fetch1: no data") (b_fetch n b)++-- | Combination of 'b_query1_unpack' and 'b_fetch'.+b_fetch_hdr :: Transport m => Int -> Int -> m ((Int, Int, Int, Double), [[Double]])+b_fetch_hdr k b = do+ q <- b_query1_unpack b+ d <- b_fetch k b+ return (q, d)++-- | 'b_info_unpack_err' of 'b_query1'.+b_query1_unpack_generic :: (DuplexOsc m, Num n, Fractional r) => Int -> m (n, n, n, r)+b_query1_unpack_generic n = do+ sendMessage (Command.b_query1 n)+ q <- waitReply "/b_info"+ return (Generic.unpack_b_info_err q)++{- | Type specialised 'b_query1_unpack_generic'.++> withSc3 (b_query1_unpack 0)+-}+b_query1_unpack :: DuplexOsc m => Command.Buffer_Id -> m (Int, Int, Int, Double)+b_query1_unpack = b_query1_unpack_generic++-- | Variant of 'c_getn1' that waits for the reply and unpacks the data.+c_getn1_data :: (DuplexOsc m, Floating t) => (Int, Int) -> m [t]+c_getn1_data s = do+ let f d = case d of+ Int32 _ : Int32 _ : x -> mapMaybe datum_floating x+ _ -> error "c_getn1_data"+ sendMessage (Command.c_getn1 s)+ fmap f (waitDatum "/c_setn")++-- | Apply /f/ to result of 'n_query'.+n_query1_unpack_f :: DuplexOsc m => (Message -> t) -> Command.Node_Id -> m t+n_query1_unpack_f f n = do+ sendMessage (Command.n_query [n])+ r <- waitReply "/n_info"+ return (f r)++-- | Variant of 'n_query' that waits for and unpacks the reply.+n_query1_unpack :: DuplexOsc m => Command.Node_Id -> m (Maybe (Int, Int, Int, Int, Int, Maybe (Int, Int)))+n_query1_unpack = n_query1_unpack_f Command.unpack_n_info++-- | Variant of 'n_query1_unpack' that returns plain (un-lifted) result.+n_query1_unpack_plain :: DuplexOsc m => Command.Node_Id -> m [Int]+n_query1_unpack_plain = n_query1_unpack_f Command.unpack_n_info_plain++-- | Variant of 'g_queryTree' that waits for and unpacks the reply.+g_queryTree1_unpack :: DuplexOsc m => Command.Group_Id -> m Status.Query_Node+g_queryTree1_unpack n = do+ sendMessage (Command.g_queryTree [(n, True)])+ r <- waitReply "/g_queryTree.reply"+ return (Status.queryTree (messageDatum r))++-- * Status++{- | Collect server status information.++> withSc3 serverStatus >>= mapM putStrLn+-}+serverStatus :: DuplexOsc m => m [String]+serverStatus = fmap Status.statusFormat serverStatusData++{- | Collect server status information.++> withSc3 server_status_concise >>= putStrLn+-}+server_status_concise :: DuplexOsc m => m String+server_status_concise = fmap Status.status_format_concise serverStatusData++{- | Read nominal sample rate of server.++> withSc3 serverSampleRateNominal+-}+serverSampleRateNominal :: DuplexOsc m => m Double+serverSampleRateNominal = fmap (Status.extractStatusField 7) serverStatusData++{- | Read actual sample rate of server.++> withSc3 serverSampleRateActual+-}+serverSampleRateActual :: DuplexOsc m => m Double+serverSampleRateActual = fmap (Status.extractStatusField 8) serverStatusData++-- | Retrieve status data from server.+serverStatusData :: DuplexOsc m => m [Datum]+serverStatusData = do+ sendMessage Command.status+ waitDatum "/status.reply"++-- * Tree++{- | Collect server node tree information.++> withSc3 serverTree >>= mapM_ putStrLn+-}+serverTree :: DuplexOsc m => m [String]+serverTree = do+ qt <- g_queryTree1_unpack 0+ let tr = Status.queryTree_rt qt+ return ["***** SuperCollider Server Tree *****", Tree.drawTree (fmap Status.query_node_pp tr)]
+ Sound/Sc3/Ugen.hs view
@@ -0,0 +1,24 @@+-- | Collection of modules for writing unit-generator graphs.+module Sound.Sc3.Ugen (module M) where++import Sound.Sc3.Ugen.Analysis as M+import Sound.Sc3.Ugen.Bracketed as M+import Sound.Sc3.Ugen.Brackets as M+import Sound.Sc3.Ugen.Constant as M+import Sound.Sc3.Ugen.Control as M+import Sound.Sc3.Ugen.Enum as M+import Sound.Sc3.Ugen.Envelope as M+import Sound.Sc3.Ugen.Event as M+import Sound.Sc3.Ugen.Help.Graph as M+import Sound.Sc3.Ugen.Label as M+import Sound.Sc3.Ugen.Math as M+import Sound.Sc3.Ugen.Math.Composite as M+import Sound.Sc3.Ugen.Mce as M+import Sound.Sc3.Ugen.Mrg as M+import Sound.Sc3.Ugen.Name as M+import Sound.Sc3.Ugen.Optimise as M+import Sound.Sc3.Ugen.Pp as M+import Sound.Sc3.Ugen.Primitive as M+import Sound.Sc3.Ugen.Proxy as M+import Sound.Sc3.Ugen.Ugen as M+import Sound.Sc3.Ugen.Util as M
+ Sound/Sc3/Ugen/Analysis.hs view
@@ -0,0 +1,86 @@+-- | Ugen analysis+module Sound.Sc3.Ugen.Analysis where++import Data.List {- base -}++import qualified Sound.Sc3.Common.Mce as Mce {- hsc3 -}+import qualified Sound.Sc3.Common.Rate as Rate {- hsc3 -}+import qualified Sound.Sc3.Ugen.Bindings.Db as Db {- hsc3 -}++import Sound.Sc3.Ugen.Types++{- | Ugen primitive set.+Sees through Proxy and Mrg, possible multiple primitives for Mce.+-}+ugen_primitive_set :: Ugen -> [Primitive Ugen]+ugen_primitive_set u =+ case u of+ Constant_U _ -> []+ Control_U _ -> []+ Label_U _ -> []+ Primitive_U p -> [p]+ Proxy_U p -> [proxySource p]+ Mce_U m -> concatMap ugen_primitive_set (Mce.mce_to_list m)+ Mrg_U m -> ugen_primitive_set (mrgLeft m)++{- | Heuristic based on primitive name (FFT, PV_...).+Note that IFFT is at /control/ rate, not PV_... rate.+-}+primitive_is_pv_rate :: String -> Bool+primitive_is_pv_rate nm = nm == "FFT" || "PV_" `isPrefixOf` nm++-- | Variant on primitive_is_pv_rate.+ugen_is_pv_rate :: Ugen -> Bool+ugen_is_pv_rate = any (primitive_is_pv_rate . ugenName) . ugen_primitive_set++{- | Traverse input graph until an FFT or PV_Split node is encountered, and then locate the buffer input.+Biases left at Mce nodes.++> import Sound.Sc3+> let z = soundIn 4+> let f1 = fft 10 z 0.5 0 1 0+> let f2 = ffta 'a' 1024 z 0.5 0 1 0+> pv_track_buffer (pv_BrickWall f1 0.5) == Right 10+> pv_track_buffer (pv_BrickWall f2 0.5) == Right (localBuf 'a' 1024 1)+-}+pv_track_buffer :: Ugen -> Either String Ugen+pv_track_buffer u =+ case ugen_primitive_set u of+ [] -> Left "pv_track_buffer: not located"+ p : _ -> case ugenName p of+ "FFT" -> Right (ugenInputs p !! 0)+ "PV_Split" -> Right (ugenInputs p !! 1)+ _ -> pv_track_buffer (ugenInputs p !! 0)++{- | Buffer node number of frames. Biases left at Mce nodes.+Sees through LocalBuf, otherwise uses 'bufFrames'.++> buffer_nframes 10 == bufFrames IR 10+> buffer_nframes (control KR "b" 0) == bufFrames KR (control KR "b" 0)+> buffer_nframes (localBuf 'α' 2048 1) == 2048+-}+buffer_nframes :: Ugen -> Ugen+buffer_nframes u =+ case ugen_primitive_set u of+ [] -> Db.bufFrames (rateOf u) u+ p : _ -> case ugenName p of+ "LocalBuf" -> ugenInputs p !! 1+ _ -> Db.bufFrames (rateOf u) u++-- | 'pv_track_buffer' then 'buffer_nframes'.+pv_track_nframes :: Ugen -> Either String Ugen+pv_track_nframes u = pv_track_buffer u >>= Right . buffer_nframes++{- | Ugen is required to be the root node of complete graph.+This function returns the name of the output Ugen (ie. "Out" or an allowed variant) and the input to that Ugen.+It allows multiple-root graphs.+It is in some sense the inverse of 'wrapOut'.+-}+ugen_remove_out_node :: Ugen -> (String, Ugen)+ugen_remove_out_node u =+ let err = error "ugen_remove_out_node?"+ assert_is_output x = if x `elem` ["Out", "ReplaceOut", "OffsetOut"] then x else err+ in case u of+ Primitive_U (Primitive Rate.AudioRate nm (_bus : inputs) [] _special _uid _brk) -> (assert_is_output nm, mce inputs)+ Mrg_U (Mrg lhs rhs) -> let (nm, res) = ugen_remove_out_node lhs in (nm, Mrg_U (Mrg res rhs))+ _ -> err
+ Sound/Sc3/Ugen/Bindings.hs view
@@ -0,0 +1,9 @@+-- | SC3 Ugen bindings (composite module).+module Sound.Sc3.Ugen.Bindings (module B) where++import Sound.Sc3.Ugen.Bindings.Composite as B+import Sound.Sc3.Ugen.Bindings.Db as B+import Sound.Sc3.Ugen.Bindings.Hw as B++-- import Sound.Sc3.Ugen.Bindings.Hw.External as B+-- import Sound.Sc3.Ugen.Bindings.Monad as B
+ Sound/Sc3/Ugen/Bindings/Composite.hs view
@@ -0,0 +1,603 @@+-- | Common unit generator graphs.+module Sound.Sc3.Ugen.Bindings.Composite where++import Data.List {- base -}+import Data.Maybe {- base -}++import Sound.Sc3.Common.Enum+import Sound.Sc3.Common.Envelope+import Sound.Sc3.Common.Math+import Sound.Sc3.Common.Math.Filter.Beq+import Sound.Sc3.Common.Math.Operator+import Sound.Sc3.Common.Rate+import Sound.Sc3.Common.Uid+import Sound.Sc3.Common.Unsafe++import Sound.Sc3.Ugen.Bindings.Db+import Sound.Sc3.Ugen.Bindings.Hw+import Sound.Sc3.Ugen.Math+import Sound.Sc3.Ugen.Mce+import Sound.Sc3.Ugen.Types+import Sound.Sc3.Ugen.Util++-- | Generate a localBuf and use setBuf to initialise it.+asLocalBufId :: ID i => i -> [Ugen] -> Ugen+asLocalBufId z xs =+ let b = localBufId z 1 (fromIntegral (length xs))+ s = setBuf' b xs 0+ in mrg2 b s++asLocalBufM :: Uid m => [Ugen] -> m Ugen+asLocalBufM = liftUid1 asLocalBufId++asLocalBuf :: [Ugen] -> Ugen+asLocalBuf = liftUnsafe1 asLocalBufM++-- | balance2 with Mce input.+balanceStereo :: Ugen -> Ugen -> Ugen -> Ugen+balanceStereo sig pos level = let (x, y) = unmce2 sig in balance2 x y pos level++-- | 24db/oct rolloff - 4th order resonant Low Pass Filter+bLowPass4 :: Ugen -> Ugen -> Ugen -> Ugen+bLowPass4 i f rq =+ let (a0, a1, a2, b1, b2) = bLowPassCoef sampleRate f rq+ flt z = sos z a0 a1 a2 b1 b2+ in flt (flt i)++-- | 24db/oct rolloff - 4th order resonant Hi Pass Filter+bHiPass4 :: Ugen -> Ugen -> Ugen -> Ugen+bHiPass4 i f rq =+ let (a0, a1, a2, b1, b2) = bHiPassCoef sampleRate f rq+ flt z = sos z a0 a1 a2 b1 b2+ in flt (flt i)++-- | Buffer reader (no interpolation).+bufRdN :: Int -> Rate -> Ugen -> Ugen -> Loop Ugen -> Ugen+bufRdN n r b p l = bufRd n r b p l NoInterpolation++-- | Buffer reader (linear interpolation).+bufRdL :: Int -> Rate -> Ugen -> Ugen -> Loop Ugen -> Ugen+bufRdL n r b p l = bufRd n r b p l LinearInterpolation++-- | Buffer reader (cubic interpolation).+bufRdC :: Int -> Rate -> Ugen -> Ugen -> Loop Ugen -> Ugen+bufRdC n r b p l = bufRd n r b p l CubicInterpolation++-- | Triggers when a value changes+changed :: Ugen -> Ugen -> Ugen+changed input threshold = abs (hpz1 input) `greater_than` threshold++-- | 'mce' variant of 'lchoose'.+chooseId :: ID m => m -> Ugen -> Ugen+chooseId z = lchooseId z . mceChannels++-- | 'liftUid' of 'choose'.+chooseM :: Uid m => Ugen -> m Ugen+chooseM = liftUid1 chooseId++choose :: Ugen -> Ugen+choose = liftUnsafe1 chooseM++-- | 'clearBuf' of 'localBuf'.+clearLocalBufId :: ID a => a -> Ugen -> Ugen -> Ugen+clearLocalBufId z nc nf = clearBuf (localBufId z nc nf)++clearLocalBufM :: Uid m => Ugen -> Ugen -> m Ugen+clearLocalBufM = liftUid2 clearLocalBufId++clearLocalBuf :: Ugen -> Ugen -> Ugen+clearLocalBuf = liftUnsafe2 clearLocalBufM++-- | Demand rate (:) function.+dconsId :: ID m => (m, m, m) -> Ugen -> Ugen -> Ugen+dconsId (z0, z1, z2) x xs =+ let i = dseqId z0 1 (mce2 0 1)+ a = dseqId z1 1 (mce2 x xs)+ in dswitchId z2 i a++-- | Demand rate (:) function.+dconsM :: (Uid m) => Ugen -> Ugen -> m Ugen+dconsM x xs = do+ i <- dseqM 1 (mce2 0 1)+ a <- dseqM 1 (mce2 x xs)+ dswitchM i a++dcons :: Ugen -> Ugen -> Ugen+dcons = liftUnsafe2 dconsM++-- | Dynamic klang, dynamic sine oscillator bank+dynKlang :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+dynKlang r fs fo s =+ let gen (f : a : ph : xs) = sinOsc r (f * fs + fo) ph * a + gen xs+ gen _ = 0+ in gen (mceChannels s)++-- | Dynamic klank, set of non-fixed resonating filters.+dynKlank :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dynKlank i fs fo ds s =+ let gen (f : a : d : xs) = ringz i (f * fs + fo) (d * ds) * a + gen xs+ gen _ = 0+ in gen (mceChannels s)++-- | Pan2 without (k-rate only) level input+eqPan2 :: Ugen -> Ugen -> Ugen+eqPan2 input pos = pan2 input pos 1++-- | 'linExp' with input range of (-1,1).+exprange :: Ugen -> Ugen -> Ugen -> Ugen+exprange l r s = linExp s (-1) 1 l r++-- | Variant of `exprange` with arguments to make writing post-fix nicer.+in_exprange :: Ugen -> (Ugen, Ugen) -> Ugen+in_exprange s (l, r) = exprange l r s++{- | Variant FFT constructor with default values for hop size (0.5),+window type (0), active status (1) and window size (0).+-}+fft' :: Ugen -> Ugen -> Ugen+fft' buf i = fft buf i 0.5 0 1 0++{- | 'fft' variant that allocates 'localBuf'.++> let c = ffta 'α' 2048 (soundIn 0) 0.5 0 1 0+> in audition (out 0 (ifft c 0 0))+-}+fftAllocId :: ID i => i -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fftAllocId z nf i h wt a ws =+ let b = localBufId z 1 nf+ in fft b i h wt a ws++fftAllocM :: Uid m => Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> m Ugen+fftAllocM = liftUid6 fftAllocId++fftAlloc :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fftAlloc = liftUnsafe6 fftAllocM++-- | Sum of 'numInputBuses' and 'numOutputBuses'.+firstPrivateBus :: Ugen+firstPrivateBus = numInputBuses + numOutputBuses++-- | Frequency shifter, in terms of 'hilbert' (see also 'freqShift').+freqShift_hilbert :: Ugen -> Ugen -> Ugen -> Ugen+freqShift_hilbert i f p =+ let o = sinOsc ar f (mce [p + 0.5 * pi, p])+ h = hilbert i+ in mix (h * o)++{- | Ugen function to re-trigger an EnvGen envelope.+ Inputs are /gate/ (as set at EnvGen) and /reset/.+ The four state logic is: (1,0)->1 (1,1)->-1 (0,1)->0 (0,0)->0.+ If the gate input to EnvGen.kr is -1 the envelope ramps to zero in one control period.+ The reset input sequence 0,1,0 when the gate is open produces (1,-1,1), which resets the envelope.++>>> map (uncurry gateReset) [(1,0),(1,1),(0,1),(0,0)]+[1,-1,0,0]+-}+gateReset :: Num a => a -> a -> a+gateReset gt tr = gt - (gt * tr * 2)++{- | Variant of 'hilbert' using FFT (with a delay) for better results.+Buffer should be 2048 or 1024.+2048 = better results, more delay.+1024 = less delay, little choppier results.+-}+hilbertFIR :: Ugen -> Ugen -> Ugen+hilbertFIR s b =+ let c0 = fft' b s+ c1 = pv_PhaseShift90 c0+ delay = bufDur kr b+ in mce2 (delayN s delay delay) (ifft' c1)++-- | Variant ifft with default value for window type.+ifft' :: Ugen -> Ugen+ifft' buf = ifft buf 0 0++{-+-- | Linear interpolating variant on index.+indexL :: Ugen -> Ugen -> Ugen+indexL b i =+ let x = index b i+ y = index b (i + 1)+ in linLin (frac i) 0 1 x y+-}++{- | Generalised Klan(k/g) specification rule. /f/ unwraps inputs, /g/ wraps output.++> let r = [220,0.2,0,219,0.1,1,221,0.1,2]+> in klanx_spec_f id id [220,219,221] [0.2,0.1,0.1] [0,1,2] == r+-}+klanx_spec_f :: (a -> [b]) -> ([b] -> c) -> a -> a -> a -> c+klanx_spec_f f g fr am z = g ((concat . transpose) [f fr, f am, f z])++-- | Format frequency, amplitude and decay time data as required for klank.+klangSpec :: [Ugen] -> [Ugen] -> [Ugen] -> Ugen+klangSpec = klanx_spec_f id mce++-- | Variant of 'klangSpec' for non-Ugen inputs.+klangSpec_k :: Real n => [n] -> [n] -> [n] -> Ugen+klangSpec_k = klanx_spec_f (map constant) mce++-- | Variant of 'klangSpec' for 'Mce' inputs.+klangSpec_mce :: Ugen -> Ugen -> Ugen -> Ugen+klangSpec_mce = klanx_spec_f mceChannels mce++-- | Format frequency, amplitude and decay time data as required for klank.+klankSpec :: [Ugen] -> [Ugen] -> [Ugen] -> Ugen+klankSpec = klanx_spec_f id mce++-- | Variant for non-Ugen inputs.+klankSpec_k :: Real n => [n] -> [n] -> [n] -> Ugen+klankSpec_k = klanx_spec_f (map constant) mce++-- | Variant of 'klankSpec' for 'Mce' inputs.+klankSpec_mce :: Ugen -> Ugen -> Ugen -> Ugen+klankSpec_mce = klanx_spec_f mceChannels mce++-- | Randomly select one of a list of Ugens (initialisation rate).+lchooseId :: ID m => m -> [Ugen] -> Ugen+lchooseId z a = select (iRandId z 0 (fromIntegral (length a))) (mce a)++-- | 'liftUid' of 'lchoose'.+lchooseM :: Uid m => [Ugen] -> m Ugen+lchooseM = liftUid1 lchooseId++lchoose :: [Ugen] -> Ugen+lchoose = liftUnsafe1 lchooseM++-- | 'linExp' of (-1,1).+linExp_b :: Ugen -> Ugen -> Ugen -> Ugen+linExp_b i = linExp i (-1) 1++-- | 'linExp' of (0,1).+linExp_u :: Ugen -> Ugen -> Ugen -> Ugen+linExp_u i = linExp i 0 1++-- | Map from one linear range to another linear range.+linLin :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+linLin = linlin_ma mulAdd++-- | 'linLin' where source is (0,1).+linLin_u :: Ugen -> Ugen -> Ugen -> Ugen+linLin_u i = linLin i 0 1++-- | 'linLin' where source is (-1,1).+linLin_b :: Ugen -> Ugen -> Ugen -> Ugen+linLin_b i = linLin i (-1) 1++-- | Variant with defaults of zero.+localIn' :: Int -> Rate -> Ugen+localIn' nc r = localIn nc r (mce (replicate nc 0))++{- | Generate an 'envGen' Ugen with @fadeTime@ and @gate@ controls.++> import Sound.Sc3+> audition (out 0 (makeFadeEnv 1 * sinOsc ar 440 0 * 0.1))+> withSc3 (send (n_set1 (-1) "gate" 0))+-}+makeFadeEnv :: Double -> Ugen+makeFadeEnv fadeTime =+ let dt = control kr "fadeTime" (realToFrac fadeTime)+ gate_ = control kr "gate" 1+ startVal = dt `less_than_or_equal_to` 0+ env = Envelope [startVal, 1, 0] [1, 1] [EnvLin, EnvLin] (Just 1) Nothing 0+ in envGen kr gate_ 1 0 dt RemoveSynth env++-- | Variant that is randomly pressed.+mouseButtonRand :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+mouseButtonRand rt l r tm =+ let o = lfClipNoiseId 'z' rt 1+ in lag (linLin o (-1) 1 l r) tm++-- | Randomised mouse Ugen (see also 'mouseX'' and 'mouseY'').+mouseRandId :: ID a => a -> Rate -> Ugen -> Ugen -> Warp Ugen -> Ugen -> Ugen+mouseRandId z rt l r ty tm =+ let f = case ty of+ Linear -> linLin+ Exponential -> linExp+ _ -> undefined+ in lag (f (lfNoise1Id z rt 1) (-1) 1 l r) tm++mouseRandM :: Uid m => Rate -> Ugen -> Ugen -> Warp Ugen -> Ugen -> m Ugen+mouseRandM = liftUid5 mouseRandId++mouseRand :: Rate -> Ugen -> Ugen -> Warp Ugen -> Ugen -> Ugen+mouseRand = liftUnsafe5 mouseRandM++-- | Variant that randomly traverses the mouseX space.+mouseXRand :: Rate -> Ugen -> Ugen -> Warp Ugen -> Ugen -> Ugen+mouseXRand = mouseRandId 'x'++-- | Variant that randomly traverses the mouseY space.+mouseYRand :: Rate -> Ugen -> Ugen -> Warp Ugen -> Ugen -> Ugen+mouseYRand = mouseRandId 'y'++-- | Translate onset type string to constant Ugen value.+onsetType :: Num a => String -> a+onsetType s =+ let t = ["power", "magsum", "complex", "rcomplex", "phase", "wphase", "mkl"]+ in fromIntegral (fromMaybe 3 (elemIndex s t))++-- | Onset detector with default values for minor parameters.+onsetsDefault :: Ugen -> Ugen -> Ugen -> Ugen+onsetsDefault c t o = onsets c t o 1 0.1 10 11 1 0++-- | Format magnitude and phase data data as required for packFFT.+packFFTSpec :: [Ugen] -> [Ugen] -> Ugen+packFFTSpec m p =+ let interleave x = concat . zipWith (\a b -> [a, b]) x+ in mce (interleave m p)++-- | Calculate size of accumulation buffer given FFT and IR sizes.+partConv_calcAccumSize :: Int -> Int -> Int+partConv_calcAccumSize fft_size ir_length =+ let partition_size = fft_size `div` 2+ num_partitions = (ir_length `div` partition_size) + 1+ in fft_size * num_partitions++{- | PM oscillator.+cf = carrier frequency, mf = modulation frequency, pm = pm-index = 0.0, mp = mod-phase = 0.0+-}+pmOsc :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pmOsc r cf mf pm mp = sinOsc r cf (sinOsc r mf mp * pm)++{- | Variant of 'poll' that generates an 'mrg' value with the input+signal at left, and that allows a constant /frequency/ input in+place of a trigger.+-}+pollExt :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pollExt optTrig in_ label_ trigId =+ let tr = if isConstant optTrig then impulse kr optTrig 0 else optTrig+ in mrg [in_, poll tr in_ label_ trigId]++-- | Variant of 'in'' offset so zero if the first private bus.+privateIn :: Int -> Rate -> Ugen -> Ugen+privateIn nc rt k = in' nc rt (k + firstPrivateBus)++-- | Variant of 'out' offset so zero if the first private bus.+privateOut :: Ugen -> Ugen -> Ugen+privateOut k = out (k + firstPrivateBus)++{- | Apply function /f/ to each bin of an @FFT@ chain, /f/ receives+magnitude, phase and index and returns a (magnitude,phase).+-}+pvcollect :: Ugen -> Int -> (Ugen -> Ugen -> Int -> (Ugen, Ugen)) -> Int -> Int -> Ugen -> Ugen+pvcollect c nf f from to z =+ let m = unpackFFT c nf from to 0+ p = unpackFFT c nf from to 1+ i = [from .. to]+ e = zipWith3 f m p i+ mp = uncurry packFFTSpec (unzip e)+ in packFFT c nf from to z mp++{- | /dur/ and /hop/ are in seconds, /frameSize/ and /sampleRate/ in+frames, though the latter maybe fractional.++> pv_calcPVRecSize 4.2832879818594 1024 0.25 48000.0 == 823299+-}+pv_calcPVRecSize :: Double -> Int -> Double -> Double -> Int+pv_calcPVRecSize dur frame_size hop sample_rate =+ let frame_size' = fromIntegral frame_size+ raw_size = ceiling ((dur * sample_rate) / frame_size') * frame_size+ in ceiling (fromIntegral raw_size * recip hop + 3)++-- | 'rand' with left edge set to zero.+rand0Id :: ID a => a -> Ugen -> Ugen+rand0Id z = randId z 0++-- | 'Uid' form of 'rand0'.+rand0M :: Uid m => Ugen -> m Ugen+rand0M = randM 0++rand0 :: Ugen -> Ugen+rand0 = liftUnsafe1 rand0M++{- | 'rand' with left edge set to negative /n/.+ Note rand2 is also a UnaryOp Ugen, however hsc3 does not store Ids for operators.+-}+rand2Id :: ID a => a -> Ugen -> Ugen+rand2Id z n = randId z (negate n) n++-- | 'Uid' form of 'rand2'.+rand2M :: Uid m => Ugen -> m Ugen+rand2M n = randM (negate n) n++rand2 :: Ugen -> Ugen+rand2 = liftUnsafe1 rand2M++-- | rotate2 with Mce input.+rotateStereo :: Ugen -> Ugen -> Ugen+rotateStereo sig pos = let (x, y) = unmce2 sig in rotate2 x y pos++-- | RMS variant of 'runningSum'.+runningSumRMS :: Ugen -> Ugen -> Ugen+runningSumRMS z n = sqrt (runningSum (z * z) n * recip n)++-- | Mix one output from many sources+selectX :: Ugen -> Ugen -> Ugen+selectX ix xs =+ let s0 = select (roundTo ix 2) xs+ s1 = select (trunc ix 2 + 1) xs+ in xFade2 s0 s1 (fold2 (ix * 2 - 1) 1) 1++-- | Set local buffer values.+setBuf' :: Ugen -> [Ugen] -> Ugen -> Ugen+setBuf' b xs o = Sound.Sc3.Ugen.Bindings.Db.setBuf b o (fromIntegral (length xs)) (mce xs)++-- | Silence.+silent :: Int -> Ugen+silent n = let s = dc ar 0 in mce (replicate n s)++{- | Zero indexed audio input buses.+ Optimises case of consecutive Ugens.++>>> soundIn (mce2 0 1) == in' 2 ar numOutputBuses+True++>>> soundIn (mce2 0 2) == in' 1 ar (numOutputBuses + mce2 0 2)+True+-}+soundIn :: Ugen -> Ugen+soundIn u =+ let r = in' 1 ar (numOutputBuses + u)+ in case u of+ Mce_U m ->+ let n = mceProxies m+ in case uncons n of+ Nothing -> error "soundIn"+ Just (h, t) ->+ if all (== 1) (zipWith (-) t n)+ then in' (length n) ar (numOutputBuses + h)+ else r+ _ -> r++{- | Pan a set of channels across the stereo field.++input, spread:1, level:1, center:0, levelComp:true+-}+splay :: Ugen -> Ugen -> Ugen -> Ugen -> Bool -> Ugen+splay i s l c lc =+ let n = max 2 (fromIntegral (fromMaybe 1 (mceDegree i)))+ m = n - 1+ p = map ((+ (-1.0)) . (* (2 / m))) [0 .. m]+ a = if lc then sqrt (1 / n) else 1+ in mix (pan2 i (s * mce p + c) 1) * l * a++-- | Single tap into a delayline. ar only.+tap :: Int -> Rate -> Ugen -> Ugen -> Ugen+tap numChannels rt bufnum delaytime =+ let n = delaytime * negate sampleRate+ in playBuf numChannels rt bufnum 1 0 n Loop DoNothing++-- | Randomly select one of several inputs on trigger.+tChooseId :: ID m => m -> Ugen -> Ugen -> Ugen+tChooseId z t a = select (tiRandId z 0 (mceSize a - 1) t) a++-- | Randomly select one of several inputs.+tChooseM :: (Uid m) => Ugen -> Ugen -> m Ugen+tChooseM t a = do+ r <- tiRandM 0 (constant (length (mceChannels a) - 1)) t+ return (select r a)++tChoose :: Ugen -> Ugen -> Ugen+tChoose = liftUnsafe2 tChooseM++-- | Triggered Line, implemented in terms of EnvGen.+tLine :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+tLine rt start end dur trig_ =+ let p = envCoord [(0, 0), (0, start), (dur, end)] 1 1 EnvLin+ in envGen rt trig_ 1 0 1 DoNothing p++-- | Triggered xLine, implemented in terms of EnvGen.+tXLine :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+tXLine rt start end dur trig_ =+ let p = envCoord [(0, 0), (0, start), (dur, end)] 1 1 EnvExp+ in envGen rt trig_ 1 0 1 DoNothing p++{- | Triangle wave as sum of /n/ sines.+For partial n, amplitude is (1 / square n) and phase is pi at every other odd partial.+-}+triAS :: Int -> Ugen -> Ugen+triAS n f0 =+ let mk_freq i = f0 * fromIntegral i+ mk_amp i = if even i then 0 else 1 / fromIntegral (i * i)+ mk_ph i = if i + 1 `mod` 4 == 0 then pi else 0+ m = [1, 3 .. n]+ param = zip3 (map mk_freq m) (map mk_ph m) (map mk_amp m)+ in sum_opt (map (\(fr, ph, am) -> sinOsc ar fr ph * am) param)++-- | Randomly select one of several inputs on trigger (weighted).+tWChooseId :: ID m => m -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+tWChooseId z t a w n =+ let i = tWindexId z t n w+ in select i a++-- | Randomly select one of several inputs (weighted).+tWChooseM :: (Uid m) => Ugen -> Ugen -> Ugen -> Ugen -> m Ugen+tWChooseM t a w n = do+ i <- tWindexM t n w+ return (select i a)++tWChoose :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+tWChoose = liftUnsafe4 tWChooseM++-- | Unpack an FFT chain into separate demand-rate FFT bin streams.+unpackFFT :: Ugen -> Int -> Int -> Int -> Ugen -> [Ugen]+unpackFFT c nf from to w = map (\i -> unpack1FFT c (constant nf) (constant i) w) [from .. to]++-- | VarLag in terms of envGen. Note: in SC3 curvature and warp are separate arguments.+varLag_env :: Ugen -> Ugen -> Envelope_Curve Ugen -> Maybe Ugen -> Ugen+varLag_env in_ time warp start =+ let rt = rateOf in_+ start_ = fromMaybe in_ start+ e = Envelope [start_, in_] [time] [warp] Nothing Nothing 0+ -- e[6] = curve; e[7] = curvature;+ time_ch = if rateOf time == InitialisationRate then 0 else changed time 0+ tr = changed in_ 0 + time_ch + impulse rt 0 0+ in envGen rt tr 1 0 1 DoNothing e++{- | k channel white noise.++> whiteNoiseN 2 ar * 0.1+-}+whiteNoiseMN :: Uid m => Int -> Rate -> m Ugen+whiteNoiseMN k r = fmap mce (mapM (\_ -> whiteNoiseM r) [1 .. k])++whiteNoiseN :: Int -> Rate -> Ugen+whiteNoiseN k = liftUnsafe1 (whiteNoiseMN k)++{- | If @z@ isn't a sink node route to an @out@ node writing to @bus@.+ If @fadeTime@ is given multiply by 'makeFadeEnv'.++> import Sound.Sc3 {\- hsc3 -\}+> audition (wrapOut (Just 1) (sinOsc ar 440 0 * 0.1))++> import Sound.Osc {\- hosc -\}+> withSc3 (sendMessage (n_set1 (-1) "gate" 0))+-}+wrapOut :: Maybe Double -> Ugen -> Ugen+wrapOut fadeTime z =+ if isSink z+ then z+ else out (control kr "out" 0) (maybe z ((* z) . makeFadeEnv) fadeTime)++-- * wslib++-- | Cross-fading version of 'playBuf'.+playBufCF :: Int -> Ugen -> Ugen -> Ugen -> Ugen -> Loop Ugen -> Ugen -> Int -> Ugen+playBufCF nc bufnum rate trigger startPos loop lag' n =+ let trigger' =+ if rateOf trigger == DemandRate+ then tDuty ar trigger 0 DoNothing 1 0+ else trigger+ index' = stepper trigger' 0 0 (constant n - 1) 1 0+ on =+ map+ (\i -> inRange index' (i - 0.5) (i + 0.5))+ [0 .. constant n - 1]+ rate' = case rateOf rate of+ DemandRate -> map (\on' -> demand on' 0 rate) on+ ControlRate -> map (gate rate) on+ AudioRate -> map (gate rate) on+ InitialisationRate -> map (const rate) on+ startPos' =+ if rateOf startPos == DemandRate+ then demand trigger' 0 startPos+ else startPos+ lag'' = 1 / lag'+ s =+ zipWith+ ( \on' r ->+ let p = playBuf nc ar bufnum r on' startPos' loop DoNothing+ in p * sqrt (slew on' lag'' lag'')+ )+ on+ rate'+ in sum_opt s++-- * adc++-- | An oscillator that reads through a table once.+osc1 :: Rate -> Ugen -> Ugen -> DoneAction Ugen -> Ugen+osc1 rt buf dur doneAction =+ let ph = line rt 0 (bufFrames ir buf - 1) dur doneAction+ in bufRd 1 rt buf ph NoLoop LinearInterpolation
+ Sound/Sc3/Ugen/Bindings/Composite/External.hs view
@@ -0,0 +1,196 @@+-- | Common unit generator graphs.+module Sound.Sc3.Ugen.Bindings.Composite.External where++import Data.List {- base -}+import Data.Maybe {- base -}++import Sound.Sc3.Common.Math {- hsc3 -}+import Sound.Sc3.Common.Rate {- hsc3 -}+import Sound.Sc3.Common.Uid {- hsc3 -}+import Sound.Sc3.Common.Unsafe {- hsc3 -}++import Sound.Sc3.Ugen.Analysis {- hsc3 -}+import Sound.Sc3.Ugen.Ugen {- hsc3 -}+import Sound.Sc3.Ugen.Util {- hsc3 -}++import qualified Sound.Sc3.Ugen.Bindings.Db as Db {- hsc3 -}+import qualified Sound.Sc3.Ugen.Bindings.Db.External as External {- hsc3 -}++-- | FM7 variant where input matrices are not in Mce form.+fm7_mx :: [[Ugen]] -> [[Ugen]] -> Ugen+fm7_mx ctlMatrix modMatrix = External.fm7 ar (mce (concat ctlMatrix)) (mce (concat modMatrix))++{- | greyhole re-orders parameters as well as unpacking the input signal.++in1=0.0 in2=0.0 damping=0.0 delayTime=2.0 diffusion=0.5 feedback=0.9 moddepth=0.1 modfreq=2.0 size=1.0+in delayTime=2.0 damping=0.0 size=1.0 diffusion=0.7 feedback=0.9 modDepth=0.1 modFreq=2.0+-}+greyhole :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+greyhole i delayTime damping size diffusion feedback modDepth modFreq =+ let (i1, i2) = unmce2 i+ in External.greyholeRaw i1 i2 damping delayTime diffusion feedback modDepth modFreq size++-- | Association list giving names for MiBraids modes.+miBraids_mode_dict :: Num n => [(n, String)]+miBraids_mode_dict =+ [ (0, "CSAW")+ , (1, "MORPH")+ , (2, "SAW_SQUARE")+ , (3, "SINE_TRIANGLE")+ , (4, "BUZZ")+ , (5, "SQUARE_SUB")+ , (6, "SAW_SUB")+ , (7, "SQUARE_SYNC")+ , (8, "SAW_SYNC")+ , (9, "TRIPLE_SAW")+ , (10, "TRIPLE_SQUARE")+ , (11, "TRIPLE_TRIANGLE")+ , (12, "TRIPLE_SINE")+ , (13, "TRIPLE_RING_MOD")+ , (14, "SAW_SWARM")+ , (15, "SAW_COMB")+ , (16, "TOY")+ , (17, "DIGITAL_FILTER_LP")+ , (18, "DIGITAL_FILTER_PK")+ , (19, "DIGITAL_FILTER_BP")+ , (20, "DIGITAL_FILTER_HP")+ , (21, "VOSIM")+ , (22, "VOWEL")+ , (23, "VOWEL_FOF")+ , (24, "HARMONICS")+ , (25, "FM")+ , (26, "FEEDbACK_FM")+ , (27, "CHAOTIC_FEEDbACK_FM")+ , (28, "PLUCKED")+ , (29, "BOWED")+ , (30, "BLOWN")+ , (31, "FLUTED")+ , (32, "STRUCK_BELL")+ , (33, "STRUCK_DRUM")+ , (34, "KICK")+ , (35, "CYMBAL")+ , (36, "SNARE")+ , (37, "WAVETABLES")+ , (38, "WAVE_MAP")+ , (39, "WAVE_LINE")+ , (40, "WAVE_PARAPHONIC")+ , (41, "FILTERED_NOISE")+ , (42, "TWIN_PEAKS_NOISE")+ , (43, "CLOCKED_NOISE")+ , (44, "GRANULAR_CLOUD")+ , (45, "PARTICLE_NOISE")+ , (46, "DIGITAL_MODULATION")+ , (47, "QUESTION_MARK")+ ]++-- | Reverse lookup of 'miBraids_mode_dict'.+miBraids_mode_maybe :: Num n => String -> Maybe n+miBraids_mode_maybe x = fmap fst (find ((== x) . snd) miBraids_mode_dict)++-- | 'error' of 'miBraids_mode_maybe'+miBraids_mode :: Num n => String -> n+miBraids_mode = fromMaybe (error "miBraids_mode?") . miBraids_mode_maybe++-- | Association list giving names for MiClouds modes.+miClouds_mode_dict :: Num n => [(n, String)]+miClouds_mode_dict =+ [ (0, "GRANULAR")+ , (1, "STRETCH")+ , (2, "LOOPING_DELAY")+ , (3, "SPECTRAL")+ ]++-- | Reverse lookup of 'miClouds_mode_dict'.+miClouds_mode_maybe :: Num n => String -> Maybe n+miClouds_mode_maybe x = fmap fst (find ((== x) . snd) miClouds_mode_dict)++-- | 'error' of 'miClouds_mode_maybe'+miClouds_mode :: Num n => String -> n+miClouds_mode = fromMaybe (error "miClouds_mode?") . miClouds_mode_maybe++-- | Association list giving names for MiPlaits modes.+miPlaits_mode_dict :: Num n => [(n, String)]+miPlaits_mode_dict =+ [ (0, "virtual_analog")+ , (1, "waveshaping")+ , (2, "fm")+ , (3, "grain")+ , (4, "additive")+ , (5, "wavetable")+ , (6, "chord")+ , (7, "speech")+ , (8, "swarm")+ , (9, "noise")+ , (10, "particle")+ , (11, "string")+ , (12, "modal")+ , (13, "bass_drum")+ , (14, "snare_drum")+ , (15, "hi_hat")+ ]++-- | Reverse lookup of 'miPlaits_mode_dict'.+miPlaits_mode_maybe :: Num n => String -> Maybe n+miPlaits_mode_maybe x = fmap fst (find ((== x) . snd) miPlaits_mode_dict)++-- | 'error' of 'miPlaits_mode_maybe'+miPlaits_mode :: Num n => String -> n+miPlaits_mode = fromMaybe (error "miPlaits_mode?") . miPlaits_mode_maybe++-- | Association list giving names for MiPlaits modes.+miRings_mode_dict :: Num n => [(n, String)]+miRings_mode_dict =+ [ (0, "MODAL_RESONATOR")+ , (1, "SYMPATHETIC_STRING")+ , (2, "MODULATED/INHARMONIC_STRING")+ , (3, "2-OP_FM_VOICE")+ , (4, "SYMPATHETIC_STRING_QUANTIZED")+ , (5, "STRING_AND_REVERB")+ ]++-- | Reverse lookup of 'miRings_mode_dict'.+miRings_mode_maybe :: Num n => String -> Maybe n+miRings_mode_maybe x = fmap fst (find ((== x) . snd) miRings_mode_dict)++-- | 'error' of 'miRings_mode_maybe'+miRings_mode :: Num n => String -> n+miRings_mode = fromMaybe (error "miRings_mode?") . miRings_mode_maybe++-- | pulse signal as difference of two 'sawDPW' signals.+pulseDPW :: Rate -> Ugen -> Ugen -> Ugen+pulseDPW rt freq width =+ let o1 = External.sawDPW rt freq 0+ o2 = External.sawDPW rt freq (wrap_hs (-1, 1) (width + width))+ in o1 - o2++-- * rdu++-- | Variant that unpacks the output /mce/ node.+pv_SplitUnpack :: Ugen -> Ugen -> (Ugen, Ugen)+pv_SplitUnpack a b =+ case mceChannels (External.pv_Split a b) of+ [p, q] -> (p, q)+ _ -> error "pv_SplitUnpack"++{- | A 'pv_Split' variant, like 'ffta', that allocates a 'localBuf' by+tracing the input graph to locate the parent @FFT@ or @PV_Split@+node.+-}+pv_SplitAllocId :: ID i => i -> Ugen -> Ugen+pv_SplitAllocId z u =+ case pv_track_nframes u of+ Left err -> error err+ Right nf -> let b = Db.localBufId z nf 1 in External.pv_Split u b++pv_SplitAllocM :: Uid m => Ugen -> m Ugen+pv_SplitAllocM = liftUid1 pv_SplitAllocId++pv_SplitAlloc :: Ugen -> Ugen+pv_SplitAlloc = liftUnsafe1 pv_SplitAllocM++-- | Variant that unpacks the output /mce/ node.+pv_SplitAllocUnpackId :: ID i => i -> Ugen -> (Ugen, Ugen)+pv_SplitAllocUnpackId z u =+ case mceChannels (pv_SplitAllocId z u) of+ [p, q] -> (p, q)+ _ -> error "pv_SplitAllocUnpackId"
+ Sound/Sc3/Ugen/Bindings/Db.hs view
@@ -0,0 +1,3052 @@+-- | Sc3 Ugen bindings (auto-generated).+module Sound.Sc3.Ugen.Bindings.Db where++import Sound.Sc3.Common.Enum+import Sound.Sc3.Common.Envelope+import Sound.Sc3.Common.Rate+import Sound.Sc3.Common.Uid+import Sound.Sc3.Common.Unsafe++import Sound.Sc3.Ugen.Primitive+import Sound.Sc3.Ugen.Ugen+import Sound.Sc3.Ugen.Util++{- | Apply a binary operation to the values of an input Ugen++ BinaryOpUgen [InitialisationRate,ControlRate,AudioRate,DemandRate] a=0 b=0; FILTER: TRUE+-}+binaryOpUgen :: Ugen -> Ugen -> Ugen+binaryOpUgen a b = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate, DemandRate] (Right [0, 1]) "BinaryOpUGen" [a, b] Nothing 1 (Special 0) NoId++{- | Apply a unary operation to the values of an input ugen++ UnaryOpUgen [InitialisationRate,ControlRate,AudioRate,DemandRate] a=0; FILTER: TRUE+-}+unaryOpUgen :: Ugen -> Ugen+unaryOpUgen a = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate, DemandRate] (Right [0]) "UnaryOpUGen" [a] Nothing 1 (Special 0) NoId++{- | Audio to control rate converter.++ A2K [ControlRate] in=0+-}+a2k :: Ugen -> Ugen+a2k in_ = mkUgen Nothing [ControlRate] (Left ControlRate) "A2K" [in_] Nothing 1 (Special 0) NoId++{- | FIXME: APF purpose.++ APF [ControlRate,AudioRate] in=0 freq=440 radius=0.8; FILTER: TRUE+-}+apf :: Ugen -> Ugen -> Ugen -> Ugen+apf in_ freq radius = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "APF" [in_, freq, radius] Nothing 1 (Special 0) NoId++{- | Schroeder allpass delay line with cubic interpolation.++ AllpassC [ControlRate,AudioRate] in=0 maxdelaytime=0.2 delaytime=0.2 decaytime=1; FILTER: TRUE+-}+allpassC :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+allpassC in_ maxdelaytime delaytime decaytime = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "AllpassC" [in_, maxdelaytime, delaytime, decaytime] Nothing 1 (Special 0) NoId++{- | Schroeder allpass delay line with linear interpolation.++ AllpassL [ControlRate,AudioRate] in=0 maxdelaytime=0.2 delaytime=0.2 decaytime=1; FILTER: TRUE+-}+allpassL :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+allpassL in_ maxdelaytime delaytime decaytime = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "AllpassL" [in_, maxdelaytime, delaytime, decaytime] Nothing 1 (Special 0) NoId++{- | Schroeder allpass delay line with no interpolation.++ AllpassN [ControlRate,AudioRate] in=0 maxdelaytime=0.2 delaytime=0.2 decaytime=1; FILTER: TRUE+-}+allpassN :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+allpassN in_ maxdelaytime delaytime decaytime = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "AllpassN" [in_, maxdelaytime, delaytime, decaytime] Nothing 1 (Special 0) NoId++{- | Basic psychoacoustic amplitude compensation.++ AmpComp [InitialisationRate,ControlRate,AudioRate] freq=0 root=0 exp=0.3333+-}+ampComp :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+ampComp rate freq root exp_ = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate] (Left rate) "AmpComp" [freq, root, exp_] Nothing 1 (Special 0) NoId++{- | Basic psychoacoustic amplitude compensation (ANSI A-weighting curve).++ AmpCompA [InitialisationRate,ControlRate,AudioRate] freq=1000 root=0 minAmp=0.32 rootAmp=1+-}+ampCompA :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+ampCompA rate freq root minAmp rootAmp = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate] (Left rate) "AmpCompA" [freq, root, minAmp, rootAmp] Nothing 1 (Special 0) NoId++{- | Amplitude follower++ Amplitude [ControlRate,AudioRate] in=0 attackTime=0.01 releaseTime=0.01+-}+amplitude :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+amplitude rate in_ attackTime releaseTime = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Amplitude" [in_, attackTime, releaseTime] Nothing 1 (Special 0) NoId++{- | All Pass Filter++ BAllPass [AudioRate] in=0 freq=1200 rq=1; FILTER: TRUE+-}+bAllPass :: Ugen -> Ugen -> Ugen -> Ugen+bAllPass in_ freq rq = mkUgen Nothing [AudioRate] (Right [0]) "BAllPass" [in_, freq, rq] Nothing 1 (Special 0) NoId++{- | Band Pass Filter++ BBandPass [AudioRate] in=0 freq=1200 bw=1; FILTER: TRUE+-}+bBandPass :: Ugen -> Ugen -> Ugen -> Ugen+bBandPass in_ freq bw = mkUgen Nothing [AudioRate] (Right [0]) "BBandPass" [in_, freq, bw] Nothing 1 (Special 0) NoId++{- | Band reject filter++ BBandStop [AudioRate] in=0 freq=1200 bw=1; FILTER: TRUE+-}+bBandStop :: Ugen -> Ugen -> Ugen -> Ugen+bBandStop in_ freq bw = mkUgen Nothing [AudioRate] (Right [0]) "BBandStop" [in_, freq, bw] Nothing 1 (Special 0) NoId++{- | 12db/oct rolloff - 2nd order resonant Hi Pass Filter++ BHiPass [AudioRate] in=0 freq=1200 rq=1; FILTER: TRUE+-}+bHiPass :: Ugen -> Ugen -> Ugen -> Ugen+bHiPass in_ freq rq = mkUgen Nothing [AudioRate] (Right [0]) "BHiPass" [in_, freq, rq] Nothing 1 (Special 0) NoId++{- | Hi Shelf++ BHiShelf [AudioRate] in=0 freq=1200 rs=1 db=0; FILTER: TRUE+-}+bHiShelf :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+bHiShelf in_ freq rs db = mkUgen Nothing [AudioRate] (Right [0]) "BHiShelf" [in_, freq, rs, db] Nothing 1 (Special 0) NoId++{- | 12db/oct rolloff - 2nd order resonant Low Pass Filter++ BLowPass [AudioRate] in=0 freq=1200 rq=1; FILTER: TRUE+-}+bLowPass :: Ugen -> Ugen -> Ugen -> Ugen+bLowPass in_ freq rq = mkUgen Nothing [AudioRate] (Right [0]) "BLowPass" [in_, freq, rq] Nothing 1 (Special 0) NoId++{- | Low Shelf++ BLowShelf [AudioRate] in=0 freq=1200 rs=1 db=0; FILTER: TRUE+-}+bLowShelf :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+bLowShelf in_ freq rs db = mkUgen Nothing [AudioRate] (Right [0]) "BLowShelf" [in_, freq, rs, db] Nothing 1 (Special 0) NoId++{- | 2nd order Butterworth bandpass filter.++ BPF [ControlRate,AudioRate] in=0 freq=440 rq=1; FILTER: TRUE+-}+bpf :: Ugen -> Ugen -> Ugen -> Ugen+bpf in_ freq rq = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "BPF" [in_, freq, rq] Nothing 1 (Special 0) NoId++{- | Two zero fixed midpass.++ BPZ2 [ControlRate,AudioRate] in=0; FILTER: TRUE+-}+bpz2 :: Ugen -> Ugen+bpz2 in_ = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "BPZ2" [in_] Nothing 1 (Special 0) NoId++{- | Parametric equalizer++ BPeakEQ [AudioRate] in=0 freq=1200 rq=1 db=0; FILTER: TRUE+-}+bPeakEQ :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+bPeakEQ in_ freq rq db = mkUgen Nothing [AudioRate] (Right [0]) "BPeakEQ" [in_, freq, rq, db] Nothing 1 (Special 0) NoId++{- | 2nd order Butterworth band reject filter.++ BRF [ControlRate,AudioRate] in=0 freq=440 rq=1; FILTER: TRUE+-}+brf :: Ugen -> Ugen -> Ugen -> Ugen+brf in_ freq rq = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "BRF" [in_, freq, rq] Nothing 1 (Special 0) NoId++{- | Two zero fixed midcut.++ BRZ2 [ControlRate,AudioRate] in=0; FILTER: TRUE+-}+brz2 :: Ugen -> Ugen+brz2 in_ = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "BRZ2" [in_] Nothing 1 (Special 0) NoId++{- | Stereo signal balancer++ Balance2 [ControlRate,AudioRate] left=0 right=0 pos=0 level=1; FILTER: TRUE+-}+balance2 :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+balance2 left right pos level = mkUgen Nothing [ControlRate, AudioRate] (Right [0, 1]) "Balance2" [left, right, pos, level] Nothing 2 (Special 0) NoId++{- | physical model of bouncing object++ Ball [ControlRate,AudioRate] in=0 g=1 damp=0 friction=0.01+-}+ball :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+ball rate in_ g damp friction_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Ball" [in_, g, damp, friction_] Nothing 1 (Special 0) NoId++{- | Autocorrelation beat tracker++ BeatTrack [ControlRate] chain=0 lock=0+-}+beatTrack :: Rate -> Ugen -> Ugen -> Ugen+beatTrack rate chain lock = mkUgen Nothing [ControlRate] (Left rate) "BeatTrack" [chain, lock] Nothing 4 (Special 0) NoId++{- | Template matching beat tracker++ BeatTrack2 [ControlRate] busindex=0 numfeatures=0 windowsize=2 phaseaccuracy=0.02 lock=0 weightingscheme=0+-}+beatTrack2 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+beatTrack2 rate busindex numfeatures windowsize phaseaccuracy lock weightingscheme = mkUgen Nothing [ControlRate] (Left rate) "BeatTrack2" [busindex, numfeatures, windowsize, phaseaccuracy, lock, weightingscheme] Nothing 6 (Special 0) NoId++{- | 2D Ambisonic B-format panner.++ BiPanB2 [ControlRate,AudioRate] inA=0 inB=0 azimuth=0 gain=1+-}+biPanB2 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+biPanB2 rate inA inB azimuth gain = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "BiPanB2" [inA, inB, azimuth, gain] Nothing 3 (Special 0) NoId++{- | Band limited impulse oscillator.++ Blip [ControlRate,AudioRate] freq=440 numharm=200+-}+blip :: Rate -> Ugen -> Ugen -> Ugen+blip rate freq numharm = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Blip" [freq, numharm] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ BlockSize [InitialisationRate]+-}+blockSize :: Ugen+blockSize = mkUgen Nothing [InitialisationRate] (Left InitialisationRate) "BlockSize" [] Nothing 1 (Special 0) NoId++{- | Brown Noise.++ BrownNoise [ControlRate,AudioRate] ; NONDET+-}+brownNoiseId :: ID a => a -> Rate -> Ugen+brownNoiseId z rate = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "BrownNoise" [] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of BrownNoise.+brownNoiseM :: Uid m => Rate -> m Ugen+brownNoiseM = liftUid1 brownNoiseId++-- | Unsafe variant of BrownNoise.+brownNoise :: Rate -> Ugen+brownNoise = liftUnsafe1 brownNoiseM++{- | Buffer based all pass delay line with cubic interpolation.++ BufAllpassC [AudioRate] buf=0 in=0 delaytime=0.2 decaytime=1; FILTER: TRUE+-}+bufAllpassC :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+bufAllpassC buf in_ delaytime decaytime = mkUgen Nothing [AudioRate] (Right [1]) "BufAllpassC" [buf, in_, delaytime, decaytime] Nothing 1 (Special 0) NoId++{- | Buffer based all pass delay line with linear interpolation.++ BufAllpassL [AudioRate] buf=0 in=0 delaytime=0.2 decaytime=1; FILTER: TRUE+-}+bufAllpassL :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+bufAllpassL buf in_ delaytime decaytime = mkUgen Nothing [AudioRate] (Right [1]) "BufAllpassL" [buf, in_, delaytime, decaytime] Nothing 1 (Special 0) NoId++{- | Buffer based all pass delay line with no interpolation.++ BufAllpassN [AudioRate] buf=0 in=0 delaytime=0.2 decaytime=1; FILTER: TRUE+-}+bufAllpassN :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+bufAllpassN buf in_ delaytime decaytime = mkUgen Nothing [AudioRate] (Right [1]) "BufAllpassN" [buf, in_, delaytime, decaytime] Nothing 1 (Special 0) NoId++{- | Current number of channels of soundfile in buffer.++ BufChannels [InitialisationRate,ControlRate] bufnum=0+-}+bufChannels :: Rate -> Ugen -> Ugen+bufChannels rate bufnum = mkUgen Nothing [InitialisationRate, ControlRate] (Left rate) "BufChannels" [bufnum] Nothing 1 (Special 0) NoId++{- | Buffer based comb delay line with cubic interpolation.++ BufCombC [AudioRate] buf=0 in=0 delaytime=0.2 decaytime=1; FILTER: TRUE+-}+bufCombC :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+bufCombC buf in_ delaytime decaytime = mkUgen Nothing [AudioRate] (Right [1]) "BufCombC" [buf, in_, delaytime, decaytime] Nothing 1 (Special 0) NoId++{- | Buffer based comb delay line with linear interpolation.++ BufCombL [AudioRate] buf=0 in=0 delaytime=0.2 decaytime=1; FILTER: TRUE+-}+bufCombL :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+bufCombL buf in_ delaytime decaytime = mkUgen Nothing [AudioRate] (Right [1]) "BufCombL" [buf, in_, delaytime, decaytime] Nothing 1 (Special 0) NoId++{- | Buffer based comb delay line with no interpolation.++ BufCombN [AudioRate] buf=0 in=0 delaytime=0.2 decaytime=1; FILTER: TRUE+-}+bufCombN :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+bufCombN buf in_ delaytime decaytime = mkUgen Nothing [AudioRate] (Right [1]) "BufCombN" [buf, in_, delaytime, decaytime] Nothing 1 (Special 0) NoId++{- | Buffer based simple delay line with cubic interpolation.++ BufDelayC [ControlRate,AudioRate] buf=0 in=0 delaytime=0.2; FILTER: TRUE+-}+bufDelayC :: Ugen -> Ugen -> Ugen -> Ugen+bufDelayC buf in_ delaytime = mkUgen Nothing [ControlRate, AudioRate] (Right [1]) "BufDelayC" [buf, in_, delaytime] Nothing 1 (Special 0) NoId++{- | Buffer based simple delay line with linear interpolation.++ BufDelayL [ControlRate,AudioRate] buf=0 in=0 delaytime=0.2; FILTER: TRUE+-}+bufDelayL :: Ugen -> Ugen -> Ugen -> Ugen+bufDelayL buf in_ delaytime = mkUgen Nothing [ControlRate, AudioRate] (Right [1]) "BufDelayL" [buf, in_, delaytime] Nothing 1 (Special 0) NoId++{- | Buffer based simple delay line with no interpolation.++ BufDelayN [ControlRate,AudioRate] buf=0 in=0 delaytime=0.2; FILTER: TRUE+-}+bufDelayN :: Ugen -> Ugen -> Ugen -> Ugen+bufDelayN buf in_ delaytime = mkUgen Nothing [ControlRate, AudioRate] (Right [1]) "BufDelayN" [buf, in_, delaytime] Nothing 1 (Special 0) NoId++{- | Current duration of soundfile in buffer.++ BufDur [InitialisationRate,ControlRate] bufnum=0+-}+bufDur :: Rate -> Ugen -> Ugen+bufDur rate bufnum = mkUgen Nothing [InitialisationRate, ControlRate] (Left rate) "BufDur" [bufnum] Nothing 1 (Special 0) NoId++{- | Current number of frames allocated in the buffer.++ BufFrames [InitialisationRate,ControlRate] bufnum=0+-}+bufFrames :: Rate -> Ugen -> Ugen+bufFrames rate bufnum = mkUgen Nothing [InitialisationRate, ControlRate] (Left rate) "BufFrames" [bufnum] Nothing 1 (Special 0) NoId++{- | Buffer rate scaling in respect to server samplerate.++ BufRateScale [InitialisationRate,ControlRate] bufnum=0+-}+bufRateScale :: Rate -> Ugen -> Ugen+bufRateScale rate bufnum = mkUgen Nothing [InitialisationRate, ControlRate] (Left rate) "BufRateScale" [bufnum] Nothing 1 (Special 0) NoId++{- | Buffer reading oscillator.++ BufRd [ControlRate,AudioRate] bufnum=0 phase=0 loop=1 interpolation=2; NC INPUT: True, ENUMERATION INPUTS: 2=Loop, 3=Interpolation+-}+bufRd :: Int -> Rate -> Ugen -> Ugen -> Loop Ugen -> Interpolation Ugen -> Ugen+bufRd numChannels rate bufnum phase loop interpolation = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "BufRd" [bufnum, phase, (from_loop loop), (from_interpolation interpolation)] Nothing numChannels (Special 0) NoId++{- | Buffer sample rate.++ BufSampleRate [InitialisationRate,ControlRate] bufnum=0+-}+bufSampleRate :: Rate -> Ugen -> Ugen+bufSampleRate rate bufnum = mkUgen Nothing [InitialisationRate, ControlRate] (Left rate) "BufSampleRate" [bufnum] Nothing 1 (Special 0) NoId++{- | Current number of samples in buffer.++ BufSamples [InitialisationRate,ControlRate] bufnum=0+-}+bufSamples :: Rate -> Ugen -> Ugen+bufSamples rate bufnum = mkUgen Nothing [InitialisationRate, ControlRate] (Left rate) "BufSamples" [bufnum] Nothing 1 (Special 0) NoId++{- | Buffer writing oscillator.++ BufWr [ControlRate,AudioRate] bufnum=0 phase=0 loop=1 *inputArray=0; MCE=1, FILTER: TRUE, REORDERS INPUTS: [3,0,1,2], ENUMERATION INPUTS: 2=Loop+-}+bufWr :: Ugen -> Ugen -> Loop Ugen -> Ugen -> Ugen+bufWr bufnum phase loop inputArray = mkUgen Nothing [ControlRate, AudioRate] (Right [3]) "BufWr" [bufnum, phase, (from_loop loop)] (Just [inputArray]) 1 (Special 0) NoId++{- | Chorusing wavetable oscillator.++ COsc [ControlRate,AudioRate] bufnum=0 freq=440 beats=0.5+-}+cOsc :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+cOsc rate bufnum freq beats = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "COsc" [bufnum, freq, beats] Nothing 1 (Special 0) NoId++{- | Test for infinity, not-a-number, and denormals++ CheckBadValues [ControlRate,AudioRate] in=0 id=0 post=2; FILTER: TRUE+-}+checkBadValues :: Ugen -> Ugen -> Ugen -> Ugen+checkBadValues in_ id_ post = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "CheckBadValues" [in_, id_, post] Nothing 1 (Special 0) NoId++{- | Clip a signal outside given thresholds.++ Clip [InitialisationRate,ControlRate,AudioRate] in=0 lo=0 hi=1; FILTER: TRUE+-}+clip :: Ugen -> Ugen -> Ugen -> Ugen+clip in_ lo hi = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate] (Right [0]) "Clip" [in_, lo, hi] Nothing 1 (Special 0) NoId++{- | Clip Noise.++ ClipNoise [ControlRate,AudioRate] ; NONDET+-}+clipNoiseId :: ID a => a -> Rate -> Ugen+clipNoiseId z rate = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "ClipNoise" [] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of ClipNoise.+clipNoiseM :: Uid m => Rate -> m Ugen+clipNoiseM = liftUid1 clipNoiseId++-- | Unsafe variant of ClipNoise.+clipNoise :: Rate -> Ugen+clipNoise = liftUnsafe1 clipNoiseM++{- | Statistical gate.++ CoinGate [ControlRate,AudioRate] prob=0 in=0; FILTER: TRUE, NONDET+-}+coinGateId :: ID a => a -> Ugen -> Ugen -> Ugen+coinGateId z prob in_ = mkUgen Nothing [ControlRate, AudioRate] (Right [1]) "CoinGate" [prob, in_] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of CoinGate.+coinGateM :: Uid m => Ugen -> Ugen -> m Ugen+coinGateM = liftUid2 coinGateId++-- | Unsafe variant of CoinGate.+coinGate :: Ugen -> Ugen -> Ugen+coinGate = liftUnsafe2 coinGateM++{- | Comb delay line with cubic interpolation.++ CombC [ControlRate,AudioRate] in=0 maxdelaytime=0.2 delaytime=0.2 decaytime=1; FILTER: TRUE+-}+combC :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+combC in_ maxdelaytime delaytime decaytime = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "CombC" [in_, maxdelaytime, delaytime, decaytime] Nothing 1 (Special 0) NoId++{- | Comb delay line with linear interpolation.++ CombL [ControlRate,AudioRate] in=0 maxdelaytime=0.2 delaytime=0.2 decaytime=1; FILTER: TRUE+-}+combL :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+combL in_ maxdelaytime delaytime decaytime = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "CombL" [in_, maxdelaytime, delaytime, decaytime] Nothing 1 (Special 0) NoId++{- | Comb delay line with no interpolation.++ CombN [ControlRate,AudioRate] in=0 maxdelaytime=0.2 delaytime=0.2 decaytime=1; FILTER: TRUE+-}+combN :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+combN in_ maxdelaytime delaytime decaytime = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "CombN" [in_, maxdelaytime, delaytime, decaytime] Nothing 1 (Special 0) NoId++{- | Compressor, expander, limiter, gate, ducker++ Compander [AudioRate] in=0 control=0 thresh=0.5 slopeBelow=1 slopeAbove=1 clampTime=0.01 relaxTime=0.1; FILTER: TRUE+-}+compander :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+compander in_ control_ thresh slopeBelow slopeAbove clampTime relaxTime = mkUgen Nothing [AudioRate] (Right [0]) "Compander" [in_, control_, thresh, slopeBelow, slopeAbove, clampTime, relaxTime] Nothing 1 (Special 0) NoId++{- | Compressor, expander, limiter, gate, ducker.++ CompanderD [AudioRate] in=0 thresh=0.5 slopeBelow=1 slopeAbove=1 clampTime=0.01 relaxTime=0.01+-}+companderD :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+companderD rate in_ thresh slopeBelow slopeAbove clampTime relaxTime = mkUgen Nothing [AudioRate] (Left rate) "CompanderD" [in_, thresh, slopeBelow, slopeAbove, clampTime, relaxTime] Nothing 1 (Special 0) NoId++{- | Duration of one block++ ControlDur [InitialisationRate]+-}+controlDur :: Ugen+controlDur = mkUgen Nothing [InitialisationRate] (Left InitialisationRate) "ControlDur" [] Nothing 1 (Special 0) NoId++{- | Server control rate.++ ControlRate [InitialisationRate]+-}+controlRate :: Ugen+controlRate = mkUgen Nothing [InitialisationRate] (Left InitialisationRate) "ControlRate" [] Nothing 1 (Special 0) NoId++{- | Real-time convolver.++ Convolution [AudioRate] in=0 kernel=0 framesize=512+-}+convolution :: Ugen -> Ugen -> Ugen -> Ugen+convolution in_ kernel framesize = mkUgen Nothing [AudioRate] (Left AudioRate) "Convolution" [in_, kernel, framesize] Nothing 1 (Special 0) NoId++{- | Real-time fixed kernel convolver.++ Convolution2 [AudioRate] in=0 kernel=0 trigger=0 framesize=2048+-}+convolution2 :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+convolution2 in_ kernel trigger framesize = mkUgen Nothing [AudioRate] (Left AudioRate) "Convolution2" [in_, kernel, trigger, framesize] Nothing 1 (Special 0) NoId++{- | Real-time convolver with linear interpolation++ Convolution2L [AudioRate] in=0 kernel=0 trigger=0 framesize=2048 crossfade=1+-}+convolution2L :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+convolution2L rate in_ kernel trigger framesize crossfade = mkUgen Nothing [AudioRate] (Left rate) "Convolution2L" [in_, kernel, trigger, framesize, crossfade] Nothing 1 (Special 0) NoId++{- | Time based convolver.++ Convolution3 [ControlRate,AudioRate] in=0 kernel=0 trigger=0 framesize=2048+-}+convolution3 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+convolution3 rate in_ kernel trigger framesize = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Convolution3" [in_, kernel, trigger, framesize] Nothing 1 (Special 0) NoId++{- | Chaotic noise function.++ Crackle [ControlRate,AudioRate] chaosParam=1.5+-}+crackle :: Rate -> Ugen -> Ugen+crackle rate chaosParam = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Crackle" [chaosParam] Nothing 1 (Special 0) NoId++{- | Cusp map chaotic generator++ CuspL [AudioRate] freq=22050 a=1 b=1.9 xi=0+-}+cuspL :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+cuspL rate freq a b xi = mkUgen Nothing [AudioRate] (Left rate) "CuspL" [freq, a, b, xi] Nothing 1 (Special 0) NoId++{- | Cusp map chaotic generator++ CuspN [AudioRate] freq=22050 a=1 b=1.9 xi=0+-}+cuspN :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+cuspN rate freq a b xi = mkUgen Nothing [AudioRate] (Left rate) "CuspN" [freq, a, b, xi] Nothing 1 (Special 0) NoId++{- | Create a constant amplitude signal++ DC [ControlRate,AudioRate] in=0+-}+dc :: Rate -> Ugen -> Ugen+dc rate in_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "DC" [in_] Nothing 1 (Special 0) NoId++{- | Demand rate brownian movement generator.++ Dbrown [DemandRate] length=100000000 lo=0 hi=1 step=0.01; REORDERS INPUTS: [1,2,3,0], DEMAND/NONDET+-}+dbrownId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dbrownId z length_ lo hi step = mkUgen Nothing [DemandRate] (Left DemandRate) "Dbrown" [length_, lo, hi, step] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of Dbrown.+dbrownM :: Uid m => Ugen -> Ugen -> Ugen -> Ugen -> m Ugen+dbrownM = liftUid4 dbrownId++-- | Unsafe variant of Dbrown.+dbrown :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dbrown = liftUnsafe4 dbrownM++{- | Buffer read demand ugen++ Dbufrd [DemandRate] bufnum=0 phase=0 loop=1; ENUMERATION INPUTS: 2=Loop, DEMAND/NONDET+-}+dbufrdId :: ID a => a -> Ugen -> Ugen -> Loop Ugen -> Ugen+dbufrdId z bufnum phase loop = mkUgen Nothing [DemandRate] (Left DemandRate) "Dbufrd" [bufnum, phase, (from_loop loop)] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of Dbufrd.+dbufrdM :: Uid m => Ugen -> Ugen -> Loop Ugen -> m Ugen+dbufrdM = liftUid3 dbufrdId++-- | Unsafe variant of Dbufrd.+dbufrd :: Ugen -> Ugen -> Loop Ugen -> Ugen+dbufrd = liftUnsafe3 dbufrdM++{- | Buffer write demand ugen++ Dbufwr [DemandRate] bufnum=0 phase=0 input=0 loop=1; REORDERS INPUTS: [2,0,1,3], ENUMERATION INPUTS: 3=Loop, DEMAND/NONDET+-}+dbufwrId :: ID a => a -> Ugen -> Ugen -> Ugen -> Loop Ugen -> Ugen+dbufwrId z bufnum phase input loop = mkUgen Nothing [DemandRate] (Left DemandRate) "Dbufwr" [bufnum, phase, input, (from_loop loop)] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of Dbufwr.+dbufwrM :: Uid m => Ugen -> Ugen -> Ugen -> Loop Ugen -> m Ugen+dbufwrM = liftUid4 dbufwrId++-- | Unsafe variant of Dbufwr.+dbufwr :: Ugen -> Ugen -> Ugen -> Loop Ugen -> Ugen+dbufwr = liftUnsafe4 dbufwrM++{- | Constrain a demand-rate stream to a given sum++ Dconst [DemandRate] sum=0 in=0 tolerance=0.001; DEMAND/NONDET+-}+dconstId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen+dconstId z sum_ in_ tolerance = mkUgen Nothing [DemandRate] (Left DemandRate) "Dconst" [sum_, in_, tolerance] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of Dconst.+dconstM :: Uid m => Ugen -> Ugen -> Ugen -> m Ugen+dconstM = liftUid3 dconstId++-- | Unsafe variant of Dconst.+dconst :: Ugen -> Ugen -> Ugen -> Ugen+dconst = liftUnsafe3 dconstM++{- | Exponential decay++ Decay [ControlRate,AudioRate] in=0 decayTime=1; FILTER: TRUE+-}+decay :: Ugen -> Ugen -> Ugen+decay in_ decayTime = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Decay" [in_, decayTime] Nothing 1 (Special 0) NoId++{- | Exponential decay++ Decay2 [ControlRate,AudioRate] in=0 attackTime=0.01 decayTime=1; FILTER: TRUE+-}+decay2 :: Ugen -> Ugen -> Ugen -> Ugen+decay2 in_ attackTime decayTime = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Decay2" [in_, attackTime, decayTime] Nothing 1 (Special 0) NoId++{- | 2D Ambisonic B-format decoder.++ DecodeB2 [ControlRate,AudioRate] w=0 x=0 y=0 orientation=0.5; NC INPUT: True, FILTER: TRUE+-}+decodeB2 :: Int -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+decodeB2 numChannels w x y orientation = mkUgen Nothing [ControlRate, AudioRate] (Right [0, 1, 2]) "DecodeB2" [w, x, y, orientation] Nothing numChannels (Special 0) NoId++{- | Convert signal to modal pitch.++ DegreeToKey [ControlRate,AudioRate] bufnum=0 in=0 octave=12; FILTER: TRUE+-}+degreeToKey :: Ugen -> Ugen -> Ugen -> Ugen+degreeToKey bufnum in_ octave = mkUgen Nothing [ControlRate, AudioRate] (Right [1]) "DegreeToKey" [bufnum, in_, octave] Nothing 1 (Special 0) NoId++{- | Tap a delay line from a DelTapWr Ugen++ DelTapRd [ControlRate,AudioRate] buffer=0 phase=0 delTime=0 interp=1; FILTER: TRUE+-}+delTapRd :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+delTapRd buffer phase delTime interp = mkUgen Nothing [ControlRate, AudioRate] (Right [1]) "DelTapRd" [buffer, phase, delTime, interp] Nothing 1 (Special 0) NoId++{- | Write to a buffer for a DelTapRd Ugen++ DelTapWr [ControlRate,AudioRate] buffer=0 in=0; FILTER: TRUE+-}+delTapWr :: Ugen -> Ugen -> Ugen+delTapWr buffer in_ = mkUgen Nothing [ControlRate, AudioRate] (Right [1]) "DelTapWr" [buffer, in_] Nothing 1 (Special 0) NoId++{- | Single sample delay.++ Delay1 [ControlRate,AudioRate] in=0; FILTER: TRUE+-}+delay1 :: Ugen -> Ugen+delay1 in_ = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Delay1" [in_] Nothing 1 (Special 0) NoId++{- | Two sample delay.++ Delay2 [ControlRate,AudioRate] in=0; FILTER: TRUE+-}+delay2 :: Ugen -> Ugen+delay2 in_ = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Delay2" [in_] Nothing 1 (Special 0) NoId++{- | Simple delay line with cubic interpolation.++ DelayC [ControlRate,AudioRate] in=0 maxdelaytime=0.2 delaytime=0.2; FILTER: TRUE+-}+delayC :: Ugen -> Ugen -> Ugen -> Ugen+delayC in_ maxdelaytime delaytime = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "DelayC" [in_, maxdelaytime, delaytime] Nothing 1 (Special 0) NoId++{- | Simple delay line with linear interpolation.++ DelayL [ControlRate,AudioRate] in=0 maxdelaytime=0.2 delaytime=0.2; FILTER: TRUE+-}+delayL :: Ugen -> Ugen -> Ugen -> Ugen+delayL in_ maxdelaytime delaytime = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "DelayL" [in_, maxdelaytime, delaytime] Nothing 1 (Special 0) NoId++{- | Simple delay line with no interpolation.++ DelayN [ControlRate,AudioRate] in=0 maxdelaytime=0.2 delaytime=0.2; FILTER: TRUE+-}+delayN :: Ugen -> Ugen -> Ugen -> Ugen+delayN in_ maxdelaytime delaytime = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "DelayN" [in_, maxdelaytime, delaytime] Nothing 1 (Special 0) NoId++{- | Demand results from demand rate Ugens.++ Demand [ControlRate,AudioRate] trig=0 reset=0 *demandUgens=0; MCE=1, FILTER: TRUE+-}+demand :: Ugen -> Ugen -> Ugen -> Ugen+demand trig_ reset demandUgens = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Demand" [trig_, reset] (Just [demandUgens]) (length (mceChannels demandUgens) + 0) (Special 0) NoId++{- | Demand rate envelope generator++ DemandEnvGen [ControlRate,AudioRate] level=0 dur=0 shape=1 curve=0 gate=1 reset=1 levelScale=1 levelBias=0 timeScale=1 doneAction=0; ENUMERATION INPUTS: 9=DoneAction+-}+demandEnvGen :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> DoneAction Ugen -> Ugen+demandEnvGen rate level dur shape curve gate_ reset levelScale levelBias timeScale doneAction = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "DemandEnvGen" [level, dur, shape, curve, gate_, reset, levelScale, levelBias, timeScale, (from_done_action doneAction)] Nothing 1 (Special 0) NoId++{- | Search a buffer for a value++ DetectIndex [ControlRate,AudioRate] bufnum=0 in=0; FILTER: TRUE+-}+detectIndex :: Ugen -> Ugen -> Ugen+detectIndex bufnum in_ = mkUgen Nothing [ControlRate, AudioRate] (Right [1]) "DetectIndex" [bufnum, in_] Nothing 1 (Special 0) NoId++{- | Detect when input falls below an amplitude threshold++ DetectSilence [ControlRate,AudioRate] in=0 amp=0.0001 time=0.1 doneAction=0; FILTER: TRUE, ENUMERATION INPUTS: 3=DoneAction+-}+detectSilence :: Ugen -> Ugen -> Ugen -> DoneAction Ugen -> Ugen+detectSilence in_ amp time doneAction = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "DetectSilence" [in_, amp, time, (from_done_action doneAction)] Nothing 1 (Special 0) NoId++{- | Demand rate geometric series Ugen.++ Dgeom [DemandRate] length=100000000 start=1 grow=2; REORDERS INPUTS: [1,2,0], DEMAND/NONDET+-}+dgeomId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen+dgeomId z length_ start grow = mkUgen Nothing [DemandRate] (Left DemandRate) "Dgeom" [length_, start, grow] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of Dgeom.+dgeomM :: Uid m => Ugen -> Ugen -> Ugen -> m Ugen+dgeomM = liftUid3 dgeomId++-- | Unsafe variant of Dgeom.+dgeom :: Ugen -> Ugen -> Ugen -> Ugen+dgeom = liftUnsafe3 dgeomM++{- | Demand rate brownian movement generator.++ Dibrown [DemandRate] length=100000000 lo=0 hi=1 step=0.01; REORDERS INPUTS: [1,2,3,0], DEMAND/NONDET+-}+dibrownId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dibrownId z length_ lo hi step = mkUgen Nothing [DemandRate] (Left DemandRate) "Dibrown" [length_, lo, hi, step] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of Dibrown.+dibrownM :: Uid m => Ugen -> Ugen -> Ugen -> Ugen -> m Ugen+dibrownM = liftUid4 dibrownId++-- | Unsafe variant of Dibrown.+dibrown :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dibrown = liftUnsafe4 dibrownM++{- | Stream in audio from a file.++ DiskIn [AudioRate] bufnum=0 loop=0; NC INPUT: True, ENUMERATION INPUTS: 1=Loop+-}+diskIn :: Int -> Ugen -> Loop Ugen -> Ugen+diskIn numChannels bufnum loop = mkUgen Nothing [AudioRate] (Left AudioRate) "DiskIn" [bufnum, (from_loop loop)] Nothing numChannels (Special 0) NoId++{- | Record to a soundfile to disk.++ DiskOut [AudioRate] bufnum=0 *channelsArray=0; MCE=1+-}+diskOut :: Ugen -> Ugen -> Ugen+diskOut bufnum input = mkUgen Nothing [AudioRate] (Left AudioRate) "DiskOut" [bufnum] (Just [input]) 1 (Special 0) NoId++{- | Demand rate white noise random generator.++ Diwhite [DemandRate] length=100000000 lo=0 hi=1; REORDERS INPUTS: [1,2,0], DEMAND/NONDET+-}+diwhiteId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen+diwhiteId z length_ lo hi = mkUgen Nothing [DemandRate] (Left DemandRate) "Diwhite" [length_, lo, hi] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of Diwhite.+diwhiteM :: Uid m => Ugen -> Ugen -> Ugen -> m Ugen+diwhiteM = liftUid3 diwhiteId++-- | Unsafe variant of Diwhite.+diwhite :: Ugen -> Ugen -> Ugen -> Ugen+diwhite = liftUnsafe3 diwhiteM++{- | Monitors another Ugen to see when it is finished++ Done [ControlRate] src=0+-}+done :: Ugen -> Ugen+done src = mkUgen Nothing [ControlRate] (Left ControlRate) "Done" [src] Nothing 1 (Special 0) NoId++{- | Print the current output value of a demand rate Ugen++ Dpoll [DemandRate] in=0 label=0 run=1 trigid=-1; DEMAND/NONDET+-}+dpollId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dpollId z in_ label_ run trigid = mkUgen Nothing [DemandRate] (Left DemandRate) "Dpoll" [in_, label_, run, trigid] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of Dpoll.+dpollM :: Uid m => Ugen -> Ugen -> Ugen -> Ugen -> m Ugen+dpollM = liftUid4 dpollId++-- | Unsafe variant of Dpoll.+dpoll :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dpoll = liftUnsafe4 dpollM++{- | Demand rate random sequence generator.++ Drand [DemandRate] repeats=1 *list=0; MCE=1, REORDERS INPUTS: [1,0], DEMAND/NONDET+-}+drandId :: ID a => a -> Ugen -> Ugen -> Ugen+drandId z repeats list_ = mkUgen Nothing [DemandRate] (Left DemandRate) "Drand" [repeats] (Just [list_]) 1 (Special 0) (toUid z)++-- | Monad variant of Drand.+drandM :: Uid m => Ugen -> Ugen -> m Ugen+drandM = liftUid2 drandId++-- | Unsafe variant of Drand.+drand :: Ugen -> Ugen -> Ugen+drand = liftUnsafe2 drandM++{- | demand rate reset++ Dreset [DemandRate] in=0 reset=0; DEMAND/NONDET+-}+dresetId :: ID a => a -> Ugen -> Ugen -> Ugen+dresetId z in_ reset = mkUgen Nothing [DemandRate] (Left DemandRate) "Dreset" [in_, reset] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of Dreset.+dresetM :: Uid m => Ugen -> Ugen -> m Ugen+dresetM = liftUid2 dresetId++-- | Unsafe variant of Dreset.+dreset :: Ugen -> Ugen -> Ugen+dreset = liftUnsafe2 dresetM++{- | Demand rate sequence generator.++ Dseq [DemandRate] repeats=1 *list=0; MCE=1, REORDERS INPUTS: [1,0], DEMAND/NONDET+-}+dseqId :: ID a => a -> Ugen -> Ugen -> Ugen+dseqId z repeats list_ = mkUgen Nothing [DemandRate] (Left DemandRate) "Dseq" [repeats] (Just [list_]) 1 (Special 0) (toUid z)++-- | Monad variant of Dseq.+dseqM :: Uid m => Ugen -> Ugen -> m Ugen+dseqM = liftUid2 dseqId++-- | Unsafe variant of Dseq.+dseq :: Ugen -> Ugen -> Ugen+dseq = liftUnsafe2 dseqM++{- | Demand rate sequence generator.++ Dser [DemandRate] repeats=1 *list=0; MCE=1, REORDERS INPUTS: [1,0], DEMAND/NONDET+-}+dserId :: ID a => a -> Ugen -> Ugen -> Ugen+dserId z repeats list_ = mkUgen Nothing [DemandRate] (Left DemandRate) "Dser" [repeats] (Just [list_]) 1 (Special 0) (toUid z)++-- | Monad variant of Dser.+dserM :: Uid m => Ugen -> Ugen -> m Ugen+dserM = liftUid2 dserId++-- | Unsafe variant of Dser.+dser :: Ugen -> Ugen -> Ugen+dser = liftUnsafe2 dserM++{- | Demand rate arithmetic series Ugen.++ Dseries [DemandRate] length=100000000 start=1 step=1; REORDERS INPUTS: [1,2,0], DEMAND/NONDET+-}+dseriesId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen+dseriesId z length_ start step = mkUgen Nothing [DemandRate] (Left DemandRate) "Dseries" [length_, start, step] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of Dseries.+dseriesM :: Uid m => Ugen -> Ugen -> Ugen -> m Ugen+dseriesM = liftUid3 dseriesId++-- | Unsafe variant of Dseries.+dseries :: Ugen -> Ugen -> Ugen -> Ugen+dseries = liftUnsafe3 dseriesM++{- | Demand rate random sequence generator++ Dshuf [DemandRate] repeats=1 *list=0; MCE=1, REORDERS INPUTS: [1,0], DEMAND/NONDET+-}+dshufId :: ID a => a -> Ugen -> Ugen -> Ugen+dshufId z repeats list_ = mkUgen Nothing [DemandRate] (Left DemandRate) "Dshuf" [repeats] (Just [list_]) 1 (Special 0) (toUid z)++-- | Monad variant of Dshuf.+dshufM :: Uid m => Ugen -> Ugen -> m Ugen+dshufM = liftUid2 dshufId++-- | Unsafe variant of Dshuf.+dshuf :: Ugen -> Ugen -> Ugen+dshuf = liftUnsafe2 dshufM++{- | Demand rate input replicator++ Dstutter [DemandRate] n=0 in=0; DEMAND/NONDET+-}+dstutterId :: ID a => a -> Ugen -> Ugen -> Ugen+dstutterId z n in_ = mkUgen Nothing [DemandRate] (Left DemandRate) "Dstutter" [n, in_] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of Dstutter.+dstutterM :: Uid m => Ugen -> Ugen -> m Ugen+dstutterM = liftUid2 dstutterId++-- | Unsafe variant of Dstutter.+dstutter :: Ugen -> Ugen -> Ugen+dstutter = liftUnsafe2 dstutterM++{- | Demand rate generator for embedding different inputs++ Dswitch [DemandRate] index=0 *list=0; MCE=1, REORDERS INPUTS: [1,0], DEMAND/NONDET+-}+dswitchId :: ID a => a -> Ugen -> Ugen -> Ugen+dswitchId z index_ list_ = mkUgen Nothing [DemandRate] (Left DemandRate) "Dswitch" [index_] (Just [list_]) 1 (Special 0) (toUid z)++-- | Monad variant of Dswitch.+dswitchM :: Uid m => Ugen -> Ugen -> m Ugen+dswitchM = liftUid2 dswitchId++-- | Unsafe variant of Dswitch.+dswitch :: Ugen -> Ugen -> Ugen+dswitch = liftUnsafe2 dswitchM++{- | Demand rate generator for switching between inputs.++ Dswitch1 [DemandRate] index=0 *list=0; MCE=1, REORDERS INPUTS: [1,0], DEMAND/NONDET+-}+dswitch1Id :: ID a => a -> Ugen -> Ugen -> Ugen+dswitch1Id z index_ list_ = mkUgen Nothing [DemandRate] (Left DemandRate) "Dswitch1" [index_] (Just [list_]) 1 (Special 0) (toUid z)++-- | Monad variant of Dswitch1.+dswitch1M :: Uid m => Ugen -> Ugen -> m Ugen+dswitch1M = liftUid2 dswitch1Id++-- | Unsafe variant of Dswitch1.+dswitch1 :: Ugen -> Ugen -> Ugen+dswitch1 = liftUnsafe2 dswitch1M++{- | Return the same unique series of values for several demand streams++ Dunique [DemandRate] source=0 maxBufferSize=1024 protected=1; DEMAND/NONDET+-}+duniqueId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen+duniqueId z source maxBufferSize protected = mkUgen Nothing [DemandRate] (Left DemandRate) "Dunique" [source, maxBufferSize, protected] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of Dunique.+duniqueM :: Uid m => Ugen -> Ugen -> Ugen -> m Ugen+duniqueM = liftUid3 duniqueId++-- | Unsafe variant of Dunique.+dunique :: Ugen -> Ugen -> Ugen -> Ugen+dunique = liftUnsafe3 duniqueM++{- | Random impulses.++ Dust [ControlRate,AudioRate] density=0; NONDET+-}+dustId :: ID a => a -> Rate -> Ugen -> Ugen+dustId z rate density = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Dust" [density] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of Dust.+dustM :: Uid m => Rate -> Ugen -> m Ugen+dustM = liftUid2 dustId++-- | Unsafe variant of Dust.+dust :: Rate -> Ugen -> Ugen+dust = liftUnsafe2 dustM++{- | Random impulses.++ Dust2 [ControlRate,AudioRate] density=0; NONDET+-}+dust2Id :: ID a => a -> Rate -> Ugen -> Ugen+dust2Id z rate density = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Dust2" [density] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of Dust2.+dust2M :: Uid m => Rate -> Ugen -> m Ugen+dust2M = liftUid2 dust2Id++-- | Unsafe variant of Dust2.+dust2 :: Rate -> Ugen -> Ugen+dust2 = liftUnsafe2 dust2M++{- | Demand results from demand rate Ugens.++ Duty [ControlRate,AudioRate] dur=1 reset=0 doneAction=0 level=1; REORDERS INPUTS: [0,1,3,2], ENUMERATION INPUTS: 2=DoneAction+-}+duty :: Rate -> Ugen -> Ugen -> DoneAction Ugen -> Ugen -> Ugen+duty rate dur reset doneAction level = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Duty" [dur, reset, (from_done_action doneAction), level] Nothing 1 (Special 0) NoId++{- | Demand rate white noise random generator.++ Dwhite [DemandRate] length=100000000 lo=0 hi=1; REORDERS INPUTS: [1,2,0], DEMAND/NONDET+-}+dwhiteId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen+dwhiteId z length_ lo hi = mkUgen Nothing [DemandRate] (Left DemandRate) "Dwhite" [length_, lo, hi] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of Dwhite.+dwhiteM :: Uid m => Ugen -> Ugen -> Ugen -> m Ugen+dwhiteM = liftUid3 dwhiteId++-- | Unsafe variant of Dwhite.+dwhite :: Ugen -> Ugen -> Ugen -> Ugen+dwhite = liftUnsafe3 dwhiteM++{-+-- | Demand rate weighted random sequence generator+--+-- Dwrand [DemandRate] repeats=1 weights=0 *list=0; MCE=1, REORDERS INPUTS: [2,1,0], DEMAND/NONDET+dwrandId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen+dwrandId z repeats weights list_ = mkUgen Nothing [DemandRate] (Left DemandRate) "Dwrand" [repeats,weights] (Just [list_]) 1 (Special 0) (toUid z)++-- | Monad variant of Dwrand.+dwrandM :: Uid m => Ugen -> Ugen -> Ugen -> m Ugen+dwrandM = liftUid3 dwrandId++-- | Unsafe variant of Dwrand.+dwrand :: Ugen -> Ugen -> Ugen -> Ugen+dwrand = liftUnsafe3 dwrandM+-}++{- | Demand rate random sequence generator.++ Dxrand [DemandRate] repeats=1 *list=0; MCE=1, REORDERS INPUTS: [1,0], DEMAND/NONDET+-}+dxrandId :: ID a => a -> Ugen -> Ugen -> Ugen+dxrandId z repeats list_ = mkUgen Nothing [DemandRate] (Left DemandRate) "Dxrand" [repeats] (Just [list_]) 1 (Special 0) (toUid z)++-- | Monad variant of Dxrand.+dxrandM :: Uid m => Ugen -> Ugen -> m Ugen+dxrandM = liftUid2 dxrandId++-- | Unsafe variant of Dxrand.+dxrand :: Ugen -> Ugen -> Ugen+dxrand = liftUnsafe2 dxrandM++{- | Envelope generator++ EnvGen [ControlRate,AudioRate] gate=1 levelScale=1 levelBias=0 timeScale=1 doneAction=0 *envelope=0; MCE=1, REORDERS INPUTS: [5,0,1,2,3,4], ENUMERATION INPUTS: 4=DoneAction, 5=Envelope+-}+envGen :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> DoneAction Ugen -> Envelope Ugen -> Ugen+envGen rate gate_ levelScale levelBias timeScale doneAction envelope_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "EnvGen" [gate_, levelScale, levelBias, timeScale, (from_done_action doneAction)] (Just [(envelope_to_ugen envelope_)]) 1 (Special 0) NoId++{- | Exponential single random number generator.++ ExpRand [InitialisationRate] lo=0.01 hi=1; NONDET+-}+expRandId :: ID a => a -> Ugen -> Ugen -> Ugen+expRandId z lo hi = mkUgen Nothing [InitialisationRate] (Left InitialisationRate) "ExpRand" [lo, hi] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of ExpRand.+expRandM :: Uid m => Ugen -> Ugen -> m Ugen+expRandM = liftUid2 expRandId++-- | Unsafe variant of ExpRand.+expRand :: Ugen -> Ugen -> Ugen+expRand = liftUnsafe2 expRandM++{- | Feedback sine with chaotic phase indexing++ FBSineC [AudioRate] freq=22050 im=1 fb=0.1 a=1.1 c=0.5 xi=0.1 yi=0.1+-}+fbSineC :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fbSineC rate freq im fb a c xi yi = mkUgen Nothing [AudioRate] (Left rate) "FBSineC" [freq, im, fb, a, c, xi, yi] Nothing 1 (Special 0) NoId++{- | Feedback sine with chaotic phase indexing++ FBSineL [AudioRate] freq=22050 im=1 fb=0.1 a=1.1 c=0.5 xi=0.1 yi=0.1+-}+fbSineL :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fbSineL rate freq im fb a c xi yi = mkUgen Nothing [AudioRate] (Left rate) "FBSineL" [freq, im, fb, a, c, xi, yi] Nothing 1 (Special 0) NoId++{- | Feedback sine with chaotic phase indexing++ FBSineN [AudioRate] freq=22050 im=1 fb=0.1 a=1.1 c=0.5 xi=0.1 yi=0.1+-}+fbSineN :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fbSineN rate freq im fb a c xi yi = mkUgen Nothing [AudioRate] (Left rate) "FBSineN" [freq, im, fb, a, c, xi, yi] Nothing 1 (Special 0) NoId++{- | Fast Fourier Transform++ FFT [ControlRate] buffer=0 in=0 hop=0.5 wintype=0 active=1 winsize=0+-}+fft :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fft buffer in_ hop wintype active winsize = mkUgen Nothing [ControlRate] (Left ControlRate) "FFT" [buffer, in_, hop, wintype, active, winsize] Nothing 1 (Special 0) NoId++{- | First order filter section.++ FOS [ControlRate,AudioRate] in=0 a0=0 a1=0 b1=0; FILTER: TRUE+-}+fos :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fos in_ a0 a1 b1 = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "FOS" [in_, a0, a1, b1] Nothing 1 (Special 0) NoId++{- | Fast sine oscillator.++ FSinOsc [ControlRate,AudioRate] freq=440 iphase=0+-}+fSinOsc :: Rate -> Ugen -> Ugen -> Ugen+fSinOsc rate freq iphase = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "FSinOsc" [freq, iphase] Nothing 1 (Special 0) NoId++{- | Fold a signal outside given thresholds.++ Fold [InitialisationRate,ControlRate,AudioRate] in=0 lo=0 hi=1; FILTER: TRUE+-}+fold :: Ugen -> Ugen -> Ugen -> Ugen+fold in_ lo hi = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate] (Right [0]) "Fold" [in_, lo, hi] Nothing 1 (Special 0) NoId++{- | Formant oscillator++ Formant [AudioRate] fundfreq=440 formfreq=1760 bwfreq=880+-}+formant :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+formant rate fundfreq formfreq bwfreq = mkUgen Nothing [AudioRate] (Left rate) "Formant" [fundfreq, formfreq, bwfreq] Nothing 1 (Special 0) NoId++{- | FOF-like filter.++ Formlet [ControlRate,AudioRate] in=0 freq=440 attacktime=1 decaytime=1; FILTER: TRUE+-}+formlet :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+formlet in_ freq attacktime decaytime = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Formlet" [in_, freq, attacktime, decaytime] Nothing 1 (Special 0) NoId++{- | When triggered, frees a node.++ Free [ControlRate] trig=0 id=0; FILTER: TRUE+-}+free :: Ugen -> Ugen -> Ugen+free trig_ id_ = mkUgen Nothing [ControlRate] (Right [0]) "Free" [trig_, id_] Nothing 1 (Special 0) NoId++{- | When triggered, free enclosing synth.++ FreeSelf [ControlRate] in=0+-}+freeSelf :: Ugen -> Ugen+freeSelf in_ = mkUgen Nothing [ControlRate] (Left ControlRate) "FreeSelf" [in_] Nothing 1 (Special 0) NoId++{- | Free the enclosing synth when a Ugen is finished++ FreeSelfWhenDone [ControlRate] src=0+-}+freeSelfWhenDone :: Ugen -> Ugen+freeSelfWhenDone src = mkUgen Nothing [ControlRate] (Left ControlRate) "FreeSelfWhenDone" [src] Nothing 1 (Special 0) NoId++{- | A reverb++ FreeVerb [AudioRate] in=0 mix=0.33 room=0.5 damp=0.5; FILTER: TRUE+-}+freeVerb :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+freeVerb in_ mix room damp = mkUgen Nothing [AudioRate] (Right [0]) "FreeVerb" [in_, mix, room, damp] Nothing 1 (Special 0) NoId++{- | A two-channel reverb++ FreeVerb2 [AudioRate] in=0 in2=0 mix=0.33 room=0.5 damp=0.5; FILTER: TRUE+-}+freeVerb2 :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+freeVerb2 in_ in2 mix room damp = mkUgen Nothing [AudioRate] (Right [0]) "FreeVerb2" [in_, in2, mix, room, damp] Nothing 2 (Special 0) NoId++{- | Frequency Shifter.++ FreqShift [AudioRate] in=0 freq=0 phase=0+-}+freqShift :: Ugen -> Ugen -> Ugen -> Ugen+freqShift in_ freq phase = mkUgen Nothing [AudioRate] (Left AudioRate) "FreqShift" [in_, freq, phase] Nothing 1 (Special 0) NoId++{- | A two-channel reverb++ GVerb [AudioRate] in=0 roomsize=10 revtime=3 damping=0.5 inputbw=0.5 spread=15 drylevel=1 earlyreflevel=0.7 taillevel=0.5 maxroomsize=300; FILTER: TRUE+-}+gVerb :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+gVerb in_ roomsize revtime damping inputbw spread drylevel earlyreflevel taillevel maxroomsize = mkUgen Nothing [AudioRate] (Right [0]) "GVerb" [in_, roomsize, revtime, damping, inputbw, spread, drylevel, earlyreflevel, taillevel, maxroomsize] Nothing 2 (Special 0) NoId++{- | Gate or hold.++ Gate [ControlRate,AudioRate] in=0 trig=0; FILTER: TRUE+-}+gate :: Ugen -> Ugen -> Ugen+gate in_ trig_ = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Gate" [in_, trig_] Nothing 1 (Special 0) NoId++{- | Gingerbreadman map chaotic generator++ GbmanL [AudioRate] freq=22050 xi=1.2 yi=2.1+-}+gbmanL :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+gbmanL rate freq xi yi = mkUgen Nothing [AudioRate] (Left rate) "GbmanL" [freq, xi, yi] Nothing 1 (Special 0) NoId++{- | Gingerbreadman map chaotic generator++ GbmanN [AudioRate] freq=22050 xi=1.2 yi=2.1+-}+gbmanN :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+gbmanN rate freq xi yi = mkUgen Nothing [AudioRate] (Left rate) "GbmanN" [freq, xi, yi] Nothing 1 (Special 0) NoId++{- | Dynamic stochastic synthesis generator.++ Gendy1 [ControlRate,AudioRate] ampdist=1 durdist=1 adparam=1 ddparam=1 minfreq=440 maxfreq=660 ampscale=0.5 durscale=0.5 initCPs=12 knum=0; NONDET+-}+gendy1Id :: ID a => a -> Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+gendy1Id z rate ampdist durdist adparam ddparam minfreq maxfreq ampscale durscale initCPs knum = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Gendy1" [ampdist, durdist, adparam, ddparam, minfreq, maxfreq, ampscale, durscale, initCPs, knum] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of Gendy1.+gendy1M :: Uid m => Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> m Ugen+gendy1M = liftUid11 gendy1Id++-- | Unsafe variant of Gendy1.+gendy1 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+gendy1 = liftUnsafe11 gendy1M++{- | Dynamic stochastic synthesis generator.++ Gendy2 [ControlRate,AudioRate] ampdist=1 durdist=1 adparam=1 ddparam=1 minfreq=440 maxfreq=660 ampscale=0.5 durscale=0.5 initCPs=12 knum=0 a=1.17 c=0.31; NONDET+-}+gendy2Id :: ID a => a -> Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+gendy2Id z rate ampdist durdist adparam ddparam minfreq maxfreq ampscale durscale initCPs knum a c = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Gendy2" [ampdist, durdist, adparam, ddparam, minfreq, maxfreq, ampscale, durscale, initCPs, knum, a, c] Nothing 1 (Special 0) (toUid z)++{-+-- | Monad variant of Gendy2.+gendy2M :: Uid m => Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> m Ugen+gendy2M = liftUid13 gendy2Id++-- | Unsafe variant of Gendy2.+gendy2 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+gendy2 = liftUnsafe13 gendy2M+-}++{- | Dynamic stochastic synthesis generator.++ Gendy3 [ControlRate,AudioRate] ampdist=1 durdist=1 adparam=1 ddparam=1 freq=440 ampscale=0.5 durscale=0.5 initCPs=12 knum=0; NONDET+-}+gendy3Id :: ID a => a -> Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+gendy3Id z rate ampdist durdist adparam ddparam freq ampscale durscale initCPs knum = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Gendy3" [ampdist, durdist, adparam, ddparam, freq, ampscale, durscale, initCPs, knum] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of Gendy3.+gendy3M :: Uid m => Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> m Ugen+gendy3M = liftUid10 gendy3Id++-- | Unsafe variant of Gendy3.+gendy3 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+gendy3 = liftUnsafe10 gendy3M++{- | Granular synthesis with sound stored in a buffer++ GrainBuf [AudioRate] trigger=0 dur=1 sndbuf=0 rate=1 pos=0 interp=2 pan=0 envbufnum=-1 maxGrains=512; NC INPUT: True+-}+grainBuf :: Int -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+grainBuf numChannels trigger dur sndbuf rate_ pos interp pan envbufnum maxGrains = mkUgen Nothing [AudioRate] (Left AudioRate) "GrainBuf" [trigger, dur, sndbuf, rate_, pos, interp, pan, envbufnum, maxGrains] Nothing numChannels (Special 0) NoId++{- | Granular synthesis with frequency modulated sine tones++ GrainFM [AudioRate] trigger=0 dur=1 carfreq=440 modfreq=200 index=1 pan=0 envbufnum=-1 maxGrains=512; NC INPUT: True+-}+grainFM :: Int -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+grainFM numChannels trigger dur carfreq modfreq index_ pan envbufnum maxGrains = mkUgen Nothing [AudioRate] (Left AudioRate) "GrainFM" [trigger, dur, carfreq, modfreq, index_, pan, envbufnum, maxGrains] Nothing numChannels (Special 0) NoId++{- | Granulate an input signal++ GrainIn [AudioRate] trigger=0 dur=1 in=0 pan=0 envbufnum=-1 maxGrains=512; NC INPUT: True+-}+grainIn :: Int -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+grainIn numChannels trigger dur in_ pan envbufnum maxGrains = mkUgen Nothing [AudioRate] (Left AudioRate) "GrainIn" [trigger, dur, in_, pan, envbufnum, maxGrains] Nothing numChannels (Special 0) NoId++{- | Granular synthesis with sine tones++ GrainSin [AudioRate] trigger=0 dur=1 freq=440 pan=0 envbufnum=-1 maxGrains=512; NC INPUT: True+-}+grainSin :: Int -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+grainSin numChannels trigger dur freq pan envbufnum maxGrains = mkUgen Nothing [AudioRate] (Left AudioRate) "GrainSin" [trigger, dur, freq, pan, envbufnum, maxGrains] Nothing numChannels (Special 0) NoId++{- | Gray Noise.++ GrayNoise [ControlRate,AudioRate] ; NONDET+-}+grayNoiseId :: ID a => a -> Rate -> Ugen+grayNoiseId z rate = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "GrayNoise" [] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of GrayNoise.+grayNoiseM :: Uid m => Rate -> m Ugen+grayNoiseM = liftUid1 grayNoiseId++-- | Unsafe variant of GrayNoise.+grayNoise :: Rate -> Ugen+grayNoise = liftUnsafe1 grayNoiseM++{- | 2nd order Butterworth highpass filter.++ HPF [ControlRate,AudioRate] in=0 freq=440; FILTER: TRUE+-}+hpf :: Ugen -> Ugen -> Ugen+hpf in_ freq = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "HPF" [in_, freq] Nothing 1 (Special 0) NoId++{- | Two point difference filter++ HPZ1 [ControlRate,AudioRate] in=0; FILTER: TRUE+-}+hpz1 :: Ugen -> Ugen+hpz1 in_ = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "HPZ1" [in_] Nothing 1 (Special 0) NoId++{- | Two zero fixed midcut.++ HPZ2 [ControlRate,AudioRate] in=0; FILTER: TRUE+-}+hpz2 :: Ugen -> Ugen+hpz2 in_ = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "HPZ2" [in_] Nothing 1 (Special 0) NoId++{- | Scrambled value with a hash function.++ Hasher [ControlRate,AudioRate] in=0; FILTER: TRUE+-}+hasher :: Ugen -> Ugen+hasher in_ = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Hasher" [in_] Nothing 1 (Special 0) NoId++{- | Henon map chaotic generator++ HenonC [AudioRate] freq=22050 a=1.4 b=0.3 x0=0 x1=0+-}+henonC :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+henonC rate freq a b x0 x1 = mkUgen Nothing [AudioRate] (Left rate) "HenonC" [freq, a, b, x0, x1] Nothing 1 (Special 0) NoId++{- | Henon map chaotic generator++ HenonL [AudioRate] freq=22050 a=1.4 b=0.3 x0=0 x1=0+-}+henonL :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+henonL rate freq a b x0 x1 = mkUgen Nothing [AudioRate] (Left rate) "HenonL" [freq, a, b, x0, x1] Nothing 1 (Special 0) NoId++{- | Henon map chaotic generator++ HenonN [AudioRate] freq=22050 a=1.4 b=0.3 x0=0 x1=0+-}+henonN :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+henonN rate freq a b x0 x1 = mkUgen Nothing [AudioRate] (Left rate) "HenonN" [freq, a, b, x0, x1] Nothing 1 (Special 0) NoId++{- | Applies the Hilbert transform to an input signal.++ Hilbert [AudioRate] in=0; FILTER: TRUE+-}+hilbert :: Ugen -> Ugen+hilbert in_ = mkUgen Nothing [AudioRate] (Right [0]) "Hilbert" [in_] Nothing 2 (Special 0) NoId++{- | Envelope generator for polling values from an Env++ IEnvGen [ControlRate,AudioRate] index=0 *envelope=0; MCE=1, REORDERS INPUTS: [1,0], ENUMERATION INPUTS: 1=IEnvelope+-}+iEnvGen :: Rate -> Ugen -> Envelope Ugen -> Ugen+iEnvGen rate index_ envelope_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "IEnvGen" [index_] (Just [(envelope_to_ienvgen_ugen envelope_)]) 1 (Special 0) NoId++{- | Inverse Fast Fourier Transform++ IFFT [ControlRate,AudioRate] buffer=0 wintype=0 winsize=0+-}+ifft :: Ugen -> Ugen -> Ugen -> Ugen+ifft buffer wintype winsize = mkUgen Nothing [ControlRate, AudioRate] (Left AudioRate) "IFFT" [buffer, wintype, winsize] Nothing 1 (Special 0) NoId++{- | Single integer random number generator.++ iRand [InitialisationRate] lo=0 hi=127; NONDET+-}+iRandId :: ID a => a -> Ugen -> Ugen -> Ugen+iRandId z lo hi = mkUgen Nothing [InitialisationRate] (Left InitialisationRate) "IRand" [lo, hi] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of irand.+iRandM :: Uid m => Ugen -> Ugen -> m Ugen+iRandM = liftUid2 iRandId++-- | Unsafe variant of irand.+iRand :: Ugen -> Ugen -> Ugen+iRand = liftUnsafe2 iRandM++{- | Impulse oscillator.++ Impulse [ControlRate,AudioRate] freq=440 phase=0+-}+impulse :: Rate -> Ugen -> Ugen -> Ugen+impulse rate freq phase = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Impulse" [freq, phase] Nothing 1 (Special 0) NoId++{- | Read a signal from a bus.++ In [ControlRate,AudioRate] bus=0; NC INPUT: True+-}+in' :: Int -> Rate -> Ugen -> Ugen+in' numChannels rate bus = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "In" [bus] Nothing numChannels (Special 0) NoId++{- | Read signal from a bus with a current or one cycle old timestamp.++ InFeedback [AudioRate] bus=0; NC INPUT: True+-}+inFeedback :: Int -> Ugen -> Ugen+inFeedback numChannels bus = mkUgen Nothing [AudioRate] (Left AudioRate) "InFeedback" [bus] Nothing numChannels (Special 0) NoId++{- | Tests if a signal is within a given range.++ InRange [InitialisationRate,ControlRate,AudioRate] in=0 lo=0 hi=1; FILTER: TRUE+-}+inRange :: Ugen -> Ugen -> Ugen -> Ugen+inRange in_ lo hi = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate] (Right [0]) "InRange" [in_, lo, hi] Nothing 1 (Special 0) NoId++{- | Test if a point is within a given rectangle.++ InRect [ControlRate,AudioRate] x=0 y=0 rect=0+-}+inRect :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+inRect rate x y rect = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "InRect" [x, y, rect] Nothing 1 (Special 0) NoId++{- | Generate a trigger anytime a bus is set.++ InTrig [ControlRate] bus=0; NC INPUT: True+-}+inTrig :: Int -> Ugen -> Ugen+inTrig numChannels bus = mkUgen Nothing [ControlRate] (Left ControlRate) "InTrig" [bus] Nothing numChannels (Special 0) NoId++{- | Index into a table with a signal++ Index [ControlRate,AudioRate] bufnum=0 in=0; FILTER: TRUE+-}+index :: Ugen -> Ugen -> Ugen+index bufnum in_ = mkUgen Nothing [ControlRate, AudioRate] (Right [1]) "Index" [bufnum, in_] Nothing 1 (Special 0) NoId++{- | Finds the (lowest) point in the Buffer at which the input signal lies in-between the two values++ IndexInBetween [ControlRate,AudioRate] bufnum=0 in=0; FILTER: TRUE+-}+indexInBetween :: Ugen -> Ugen -> Ugen+indexInBetween bufnum in_ = mkUgen Nothing [ControlRate, AudioRate] (Right [1]) "IndexInBetween" [bufnum, in_] Nothing 1 (Special 0) NoId++{- | Index into a table with a signal, linear interpolated++ IndexL [ControlRate,AudioRate] bufnum=0 in=0; FILTER: TRUE+-}+indexL :: Ugen -> Ugen -> Ugen+indexL bufnum in_ = mkUgen Nothing [ControlRate, AudioRate] (Right [1]) "IndexL" [bufnum, in_] Nothing 1 (Special 0) NoId++{- | Base class for info ugens++ InfoUgenBase [InitialisationRate]+-}+infoUgenBase :: Rate -> Ugen+infoUgenBase rate = mkUgen Nothing [InitialisationRate] (Left rate) "InfoUgenBase" [] Nothing 1 (Special 0) NoId++{- | A leaky integrator.++ Integrator [ControlRate,AudioRate] in=0 coef=1; FILTER: TRUE+-}+integrator :: Ugen -> Ugen -> Ugen+integrator in_ coef = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Integrator" [in_, coef] Nothing 1 (Special 0) NoId++{- | Control to audio rate converter.++ K2A [AudioRate] in=0+-}+k2a :: Ugen -> Ugen+k2a in_ = mkUgen Nothing [AudioRate] (Left AudioRate) "K2A" [in_] Nothing 1 (Special 0) NoId++{- | Respond to the state of a key++ KeyState [ControlRate] keycode=0 minval=0 maxval=1 lag=0.2+-}+keyState :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+keyState rate keycode minval maxval lag_ = mkUgen Nothing [ControlRate] (Left rate) "KeyState" [keycode, minval, maxval, lag_] Nothing 1 (Special 0) NoId++{- | Key tracker++ KeyTrack [ControlRate] chain=0 keydecay=2 chromaleak=0.5+-}+keyTrack :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+keyTrack rate chain keydecay chromaleak = mkUgen Nothing [ControlRate] (Left rate) "KeyTrack" [chain, keydecay, chromaleak] Nothing 1 (Special 0) NoId++{- | Sine oscillator bank++ Klang [AudioRate] freqscale=1 freqoffset=0 *specificationsArrayRef=0; MCE=1, REORDERS INPUTS: [2,0,1]+-}+klang :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+klang rate freqscale freqoffset specificationsArrayRef = mkUgen Nothing [AudioRate] (Left rate) "Klang" [freqscale, freqoffset] (Just [specificationsArrayRef]) 1 (Special 0) NoId++{- | Bank of resonators++ Klank [AudioRate] input=0 freqscale=1 freqoffset=0 decayscale=1 *specificationsArrayRef=0; MCE=1, FILTER: TRUE, REORDERS INPUTS: [4,0,1,2,3]+-}+klank :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+klank input freqscale freqoffset decayscale specificationsArrayRef = mkUgen Nothing [AudioRate] (Right [0]) "Klank" [input, freqscale, freqoffset, decayscale] (Just [specificationsArrayRef]) 1 (Special 0) NoId++{- | Clipped noise++ LFClipNoise [ControlRate,AudioRate] freq=500; NONDET+-}+lfClipNoiseId :: ID a => a -> Rate -> Ugen -> Ugen+lfClipNoiseId z rate freq = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "LFClipNoise" [freq] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of LFClipNoise.+lfClipNoiseM :: Uid m => Rate -> Ugen -> m Ugen+lfClipNoiseM = liftUid2 lfClipNoiseId++-- | Unsafe variant of LFClipNoise.+lfClipNoise :: Rate -> Ugen -> Ugen+lfClipNoise = liftUnsafe2 lfClipNoiseM++{- | A sine like shape made of two cubic pieces++ LFCub [ControlRate,AudioRate] freq=440 iphase=0+-}+lfCub :: Rate -> Ugen -> Ugen -> Ugen+lfCub rate freq iphase = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "LFCub" [freq, iphase] Nothing 1 (Special 0) NoId++{- | Dynamic clipped noise++ LFDClipNoise [ControlRate,AudioRate] freq=500; NONDET+-}+lfdClipNoiseId :: ID a => a -> Rate -> Ugen -> Ugen+lfdClipNoiseId z rate freq = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "LFDClipNoise" [freq] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of LFDClipNoise.+lfdClipNoiseM :: Uid m => Rate -> Ugen -> m Ugen+lfdClipNoiseM = liftUid2 lfdClipNoiseId++-- | Unsafe variant of LFDClipNoise.+lfdClipNoise :: Rate -> Ugen -> Ugen+lfdClipNoise = liftUnsafe2 lfdClipNoiseM++{- | Dynamic step noise++ LFDNoise0 [ControlRate,AudioRate] freq=500; NONDET+-}+lfdNoise0Id :: ID a => a -> Rate -> Ugen -> Ugen+lfdNoise0Id z rate freq = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "LFDNoise0" [freq] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of LFDNoise0.+lfdNoise0M :: Uid m => Rate -> Ugen -> m Ugen+lfdNoise0M = liftUid2 lfdNoise0Id++-- | Unsafe variant of LFDNoise0.+lfdNoise0 :: Rate -> Ugen -> Ugen+lfdNoise0 = liftUnsafe2 lfdNoise0M++{- | Dynamic ramp noise++ LFDNoise1 [ControlRate,AudioRate] freq=500; NONDET+-}+lfdNoise1Id :: ID a => a -> Rate -> Ugen -> Ugen+lfdNoise1Id z rate freq = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "LFDNoise1" [freq] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of LFDNoise1.+lfdNoise1M :: Uid m => Rate -> Ugen -> m Ugen+lfdNoise1M = liftUid2 lfdNoise1Id++-- | Unsafe variant of LFDNoise1.+lfdNoise1 :: Rate -> Ugen -> Ugen+lfdNoise1 = liftUnsafe2 lfdNoise1M++{- | Dynamic cubic noise++ LFDNoise3 [ControlRate,AudioRate] freq=500; NONDET+-}+lfdNoise3Id :: ID a => a -> Rate -> Ugen -> Ugen+lfdNoise3Id z rate freq = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "LFDNoise3" [freq] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of LFDNoise3.+lfdNoise3M :: Uid m => Rate -> Ugen -> m Ugen+lfdNoise3M = liftUid2 lfdNoise3Id++-- | Unsafe variant of LFDNoise3.+lfdNoise3 :: Rate -> Ugen -> Ugen+lfdNoise3 = liftUnsafe2 lfdNoise3M++{- | Gaussian function oscillator++ LFGauss [ControlRate,AudioRate] duration=1 width=0.1 iphase=0 loop=1 doneAction=0; ENUMERATION INPUTS: 3=Loop, 4=DoneAction+-}+lfGauss :: Rate -> Ugen -> Ugen -> Ugen -> Loop Ugen -> DoneAction Ugen -> Ugen+lfGauss rate duration width iphase loop doneAction = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "LFGauss" [duration, width, iphase, (from_loop loop), (from_done_action doneAction)] Nothing 1 (Special 0) NoId++{- | Step noise++ LFNoise0 [ControlRate,AudioRate] freq=500; NONDET+-}+lfNoise0Id :: ID a => a -> Rate -> Ugen -> Ugen+lfNoise0Id z rate freq = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "LFNoise0" [freq] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of LFNoise0.+lfNoise0M :: Uid m => Rate -> Ugen -> m Ugen+lfNoise0M = liftUid2 lfNoise0Id++-- | Unsafe variant of LFNoise0.+lfNoise0 :: Rate -> Ugen -> Ugen+lfNoise0 = liftUnsafe2 lfNoise0M++{- | Ramp noise++ LFNoise1 [ControlRate,AudioRate] freq=500; NONDET+-}+lfNoise1Id :: ID a => a -> Rate -> Ugen -> Ugen+lfNoise1Id z rate freq = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "LFNoise1" [freq] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of LFNoise1.+lfNoise1M :: Uid m => Rate -> Ugen -> m Ugen+lfNoise1M = liftUid2 lfNoise1Id++-- | Unsafe variant of LFNoise1.+lfNoise1 :: Rate -> Ugen -> Ugen+lfNoise1 = liftUnsafe2 lfNoise1M++{- | Quadratic noise.++ LFNoise2 [ControlRate,AudioRate] freq=500; NONDET+-}+lfNoise2Id :: ID a => a -> Rate -> Ugen -> Ugen+lfNoise2Id z rate freq = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "LFNoise2" [freq] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of LFNoise2.+lfNoise2M :: Uid m => Rate -> Ugen -> m Ugen+lfNoise2M = liftUid2 lfNoise2Id++-- | Unsafe variant of LFNoise2.+lfNoise2 :: Rate -> Ugen -> Ugen+lfNoise2 = liftUnsafe2 lfNoise2M++{- | Parabolic oscillator++ LFPar [ControlRate,AudioRate] freq=440 iphase=0+-}+lfPar :: Rate -> Ugen -> Ugen -> Ugen+lfPar rate freq iphase = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "LFPar" [freq, iphase] Nothing 1 (Special 0) NoId++{- | pulse oscillator++ LFPulse [ControlRate,AudioRate] freq=440 iphase=0 width=0.5+-}+lfPulse :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+lfPulse rate freq iphase width = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "LFPulse" [freq, iphase, width] Nothing 1 (Special 0) NoId++{- | Sawtooth oscillator++ LFSaw [ControlRate,AudioRate] freq=440 iphase=0+-}+lfSaw :: Rate -> Ugen -> Ugen -> Ugen+lfSaw rate freq iphase = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "LFSaw" [freq, iphase] Nothing 1 (Special 0) NoId++{- | Triangle oscillator++ LFTri [ControlRate,AudioRate] freq=440 iphase=0+-}+lfTri :: Rate -> Ugen -> Ugen -> Ugen+lfTri rate freq iphase = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "LFTri" [freq, iphase] Nothing 1 (Special 0) NoId++{- | 2nd order Butterworth lowpass filter++ LPF [ControlRate,AudioRate] in=0 freq=440; FILTER: TRUE+-}+lpf :: Ugen -> Ugen -> Ugen+lpf in_ freq = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "LPF" [in_, freq] Nothing 1 (Special 0) NoId++{- | Two point average filter++ LPZ1 [ControlRate,AudioRate] in=0; FILTER: TRUE+-}+lpz1 :: Ugen -> Ugen+lpz1 in_ = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "LPZ1" [in_] Nothing 1 (Special 0) NoId++{- | Two zero fixed lowpass++ LPZ2 [ControlRate,AudioRate] in=0; FILTER: TRUE+-}+lpz2 :: Ugen -> Ugen+lpz2 in_ = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "LPZ2" [in_] Nothing 1 (Special 0) NoId++{- | Exponential lag++ Lag [ControlRate,AudioRate] in=0 lagTime=0.1; FILTER: TRUE+-}+lag :: Ugen -> Ugen -> Ugen+lag in_ lagTime = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Lag" [in_, lagTime] Nothing 1 (Special 0) NoId++{- | Exponential lag++ Lag2 [ControlRate,AudioRate] in=0 lagTime=0.1; FILTER: TRUE+-}+lag2 :: Ugen -> Ugen -> Ugen+lag2 in_ lagTime = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Lag2" [in_, lagTime] Nothing 1 (Special 0) NoId++{- | Exponential lag++ Lag2UD [ControlRate,AudioRate] in=0 lagTimeU=0.1 lagTimeD=0.1; FILTER: TRUE+-}+lag2UD :: Ugen -> Ugen -> Ugen -> Ugen+lag2UD in_ lagTimeU lagTimeD = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Lag2UD" [in_, lagTimeU, lagTimeD] Nothing 1 (Special 0) NoId++{- | Exponential lag++ Lag3 [ControlRate,AudioRate] in=0 lagTime=0.1; FILTER: TRUE+-}+lag3 :: Ugen -> Ugen -> Ugen+lag3 in_ lagTime = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Lag3" [in_, lagTime] Nothing 1 (Special 0) NoId++{- | Exponential lag++ Lag3UD [ControlRate,AudioRate] in=0 lagTimeU=0.1 lagTimeD=0.1; FILTER: TRUE+-}+lag3UD :: Ugen -> Ugen -> Ugen -> Ugen+lag3UD in_ lagTimeU lagTimeD = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Lag3UD" [in_, lagTimeU, lagTimeD] Nothing 1 (Special 0) NoId++{- | Read a control signal from a bus with a lag++ LagIn [ControlRate] bus=0 lag=0.1; NC INPUT: True+-}+lagIn :: Int -> Ugen -> Ugen -> Ugen+lagIn numChannels bus lag_ = mkUgen Nothing [ControlRate] (Left ControlRate) "LagIn" [bus, lag_] Nothing numChannels (Special 0) NoId++{- | Exponential lag++ LagUD [ControlRate,AudioRate] in=0 lagTimeU=0.1 lagTimeD=0.1; FILTER: TRUE+-}+lagUD :: Ugen -> Ugen -> Ugen -> Ugen+lagUD in_ lagTimeU lagTimeD = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "LagUD" [in_, lagTimeU, lagTimeD] Nothing 1 (Special 0) NoId++{- | Output the last value before the input changed++ LastValue [ControlRate,AudioRate] in=0 diff=0.01; FILTER: TRUE+-}+lastValue :: Ugen -> Ugen -> Ugen+lastValue in_ diff = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "LastValue" [in_, diff] Nothing 1 (Special 0) NoId++{- | Sample and hold++ Latch [ControlRate,AudioRate] in=0 trig=0; FILTER: TRUE+-}+latch :: Ugen -> Ugen -> Ugen+latch in_ trig_ = mkUgen Nothing [ControlRate, AudioRate] (Right [0, 1]) "Latch" [in_, trig_] Nothing 1 (Special 0) NoId++{- | Latoocarfian chaotic generator++ LatoocarfianC [AudioRate] freq=22050 a=1 b=3 c=0.5 d=0.5 xi=0.5 yi=0.5+-}+latoocarfianC :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+latoocarfianC rate freq a b c d xi yi = mkUgen Nothing [AudioRate] (Left rate) "LatoocarfianC" [freq, a, b, c, d, xi, yi] Nothing 1 (Special 0) NoId++{- | Latoocarfian chaotic generator++ LatoocarfianL [AudioRate] freq=22050 a=1 b=3 c=0.5 d=0.5 xi=0.5 yi=0.5+-}+latoocarfianL :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+latoocarfianL rate freq a b c d xi yi = mkUgen Nothing [AudioRate] (Left rate) "LatoocarfianL" [freq, a, b, c, d, xi, yi] Nothing 1 (Special 0) NoId++{- | Latoocarfian chaotic generator++ LatoocarfianN [AudioRate] freq=22050 a=1 b=3 c=0.5 d=0.5 xi=0.5 yi=0.5+-}+latoocarfianN :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+latoocarfianN rate freq a b c d xi yi = mkUgen Nothing [AudioRate] (Left rate) "LatoocarfianN" [freq, a, b, c, d, xi, yi] Nothing 1 (Special 0) NoId++{- | Remove DC++ LeakDC [ControlRate,AudioRate] in=0 coef=0.995; FILTER: TRUE+-}+leakDC :: Ugen -> Ugen -> Ugen+leakDC in_ coef = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "LeakDC" [in_, coef] Nothing 1 (Special 0) NoId++{- | Output least changed++ LeastChange [ControlRate,AudioRate] a=0 b=0+-}+leastChange :: Rate -> Ugen -> Ugen -> Ugen+leastChange rate a b = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "LeastChange" [a, b] Nothing 1 (Special 0) NoId++{- | Peak limiter++ Limiter [AudioRate] in=0 level=1 dur=0.01; FILTER: TRUE+-}+limiter :: Ugen -> Ugen -> Ugen -> Ugen+limiter in_ level dur = mkUgen Nothing [AudioRate] (Right [0]) "Limiter" [in_, level, dur] Nothing 1 (Special 0) NoId++{- | Linear congruential chaotic generator++ LinCongC [AudioRate] freq=22050 a=1.1 c=0.13 m=1 xi=0+-}+linCongC :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+linCongC rate freq a c m xi = mkUgen Nothing [AudioRate] (Left rate) "LinCongC" [freq, a, c, m, xi] Nothing 1 (Special 0) NoId++{- | Linear congruential chaotic generator++ LinCongL [AudioRate] freq=22050 a=1.1 c=0.13 m=1 xi=0+-}+linCongL :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+linCongL rate freq a c m xi = mkUgen Nothing [AudioRate] (Left rate) "LinCongL" [freq, a, c, m, xi] Nothing 1 (Special 0) NoId++{- | Linear congruential chaotic generator++ LinCongN [AudioRate] freq=22050 a=1.1 c=0.13 m=1 xi=0+-}+linCongN :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+linCongN rate freq a c m xi = mkUgen Nothing [AudioRate] (Left rate) "LinCongN" [freq, a, c, m, xi] Nothing 1 (Special 0) NoId++{- | Map a linear range to an exponential range++ LinExp [InitialisationRate,ControlRate,AudioRate] in=0 srclo=0 srchi=1 dstlo=1 dsthi=2; FILTER: TRUE+-}+linExp :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+linExp in_ srclo srchi dstlo dsthi = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate] (Right [0]) "LinExp" [in_, srclo, srchi, dstlo, dsthi] Nothing 1 (Special 0) NoId++{- | Two channel linear pan.++ LinPan2 [ControlRate,AudioRate] in=0 pos=0 level=1; FILTER: TRUE+-}+linPan2 :: Ugen -> Ugen -> Ugen -> Ugen+linPan2 in_ pos level = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "LinPan2" [in_, pos, level] Nothing 2 (Special 0) NoId++{- | Skewed random number generator.++ LinRand [InitialisationRate] lo=0 hi=1 minmax=0; NONDET+-}+linRandId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen+linRandId z lo hi minmax = mkUgen Nothing [InitialisationRate] (Left InitialisationRate) "LinRand" [lo, hi, minmax] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of LinRand.+linRandM :: Uid m => Ugen -> Ugen -> Ugen -> m Ugen+linRandM = liftUid3 linRandId++-- | Unsafe variant of LinRand.+linRand :: Ugen -> Ugen -> Ugen -> Ugen+linRand = liftUnsafe3 linRandM++{- | Two channel linear crossfade.++ LinXFade2 [ControlRate,AudioRate] inA=0 inB=0 pan=0 level=1; FILTER: TRUE, PSUEDO INPUTS: [3]+-}+linXFade2 :: Ugen -> Ugen -> Ugen -> Ugen+linXFade2 inA inB pan = mkUgen Nothing [ControlRate, AudioRate] (Right [0, 1]) "LinXFade2" [inA, inB, pan] Nothing 1 (Special 0) NoId++{- | Line generator.++ Line [ControlRate,AudioRate] start=0 end=1 dur=1 doneAction=0; ENUMERATION INPUTS: 3=DoneAction+-}+line :: Rate -> Ugen -> Ugen -> Ugen -> DoneAction Ugen -> Ugen+line rate start end dur doneAction = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Line" [start, end, dur, (from_done_action doneAction)] Nothing 1 (Special 0) NoId++{- | Simple linear envelope generator.++ Linen [ControlRate] gate=1 attackTime=0.01 susLevel=1 releaseTime=1 doneAction=0; ENUMERATION INPUTS: 4=DoneAction+-}+linen :: Ugen -> Ugen -> Ugen -> Ugen -> DoneAction Ugen -> Ugen+linen gate_ attackTime susLevel releaseTime doneAction = mkUgen Nothing [ControlRate] (Left ControlRate) "Linen" [gate_, attackTime, susLevel, releaseTime, (from_done_action doneAction)] Nothing 1 (Special 0) NoId++{- | Allocate a buffer local to the synth++ LocalBuf [InitialisationRate] numChannels=1 numFrames=1; REORDERS INPUTS: [1,0], NONDET+-}+localBufId :: ID a => a -> Ugen -> Ugen -> Ugen+localBufId z numChannels numFrames = mkUgen Nothing [InitialisationRate] (Left InitialisationRate) "LocalBuf" [numChannels, numFrames] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of LocalBuf.+localBufM :: Uid m => Ugen -> Ugen -> m Ugen+localBufM = liftUid2 localBufId++-- | Unsafe variant of LocalBuf.+localBuf :: Ugen -> Ugen -> Ugen+localBuf = liftUnsafe2 localBufM++{- | Define and read from buses local to a synth.++ LocalIn [ControlRate,AudioRate] *default=0; MCE=1, NC INPUT: True+-}+localIn :: Int -> Rate -> Ugen -> Ugen+localIn numChannels rate default_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "LocalIn" [] (Just [default_]) numChannels (Special 0) NoId++{- | Write to buses local to a synth.++ LocalOut [ControlRate,AudioRate] *channelsArray=0; MCE=1, FILTER: TRUE+-}+localOut :: Ugen -> Ugen+localOut input = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "LocalOut" [] (Just [input]) 0 (Special 0) NoId++{- | Chaotic noise function++ Logistic [ControlRate,AudioRate] chaosParam=3 freq=1000 init=0.5+-}+logistic :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+logistic rate chaosParam freq init_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Logistic" [chaosParam, freq, init_] Nothing 1 (Special 0) NoId++{- | Lorenz chaotic generator++ LorenzL [AudioRate] freq=22050 s=10 r=28 b=2.667 h=0.05 xi=0.1 yi=0 zi=0+-}+lorenzL :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+lorenzL rate freq s r b h xi yi zi = mkUgen Nothing [AudioRate] (Left rate) "LorenzL" [freq, s, r, b, h, xi, yi, zi] Nothing 1 (Special 0) NoId++{- | Extraction of instantaneous loudness in sones++ Loudness [ControlRate] chain=0 smask=0.25 tmask=1+-}+loudness :: Ugen -> Ugen -> Ugen -> Ugen+loudness chain smask tmask = mkUgen Nothing [ControlRate] (Left ControlRate) "Loudness" [chain, smask, tmask] Nothing 1 (Special 0) NoId++{- | Mel frequency cepstral coefficients++ MFCC [ControlRate] chain=0 numcoeff=13+-}+mfcc :: Rate -> Ugen -> Ugen -> Ugen+mfcc rate chain numcoeff = mkUgen Nothing [ControlRate] (Left rate) "MFCC" [chain, numcoeff] Nothing 13 (Special 0) NoId++{- | Reduce precision.++ MantissaMask [ControlRate,AudioRate] in=0 bits=3; FILTER: TRUE+-}+mantissaMask :: Ugen -> Ugen -> Ugen+mantissaMask in_ bits = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "MantissaMask" [in_, bits] Nothing 1 (Special 0) NoId++{- | Median filter.++ Median [ControlRate,AudioRate] length=3 in=0; FILTER: TRUE+-}+median :: Ugen -> Ugen -> Ugen+median length_ in_ = mkUgen Nothing [ControlRate, AudioRate] (Right [1]) "Median" [length_, in_] Nothing 1 (Special 0) NoId++{- | Parametric filter.++ MidEQ [ControlRate,AudioRate] in=0 freq=440 rq=1 db=0; FILTER: TRUE+-}+midEQ :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+midEQ in_ freq rq db = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "MidEQ" [in_, freq, rq, db] Nothing 1 (Special 0) NoId++{- | Minimum difference of two values in modulo arithmetics++ ModDif [InitialisationRate,ControlRate,AudioRate] x=0 y=0 mod=1; FILTER: TRUE+-}+modDif :: Ugen -> Ugen -> Ugen -> Ugen+modDif x y mod_ = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate] (Right [0]) "ModDif" [x, y, mod_] Nothing 1 (Special 0) NoId++{- | Moog VCF implementation, designed by Federico Fontana++ MoogFF [ControlRate,AudioRate] in=0 freq=100 gain=2 reset=0; FILTER: TRUE+-}+moogFF :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+moogFF in_ freq gain reset = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "MoogFF" [in_, freq, gain, reset] Nothing 1 (Special 0) NoId++{- | Output most changed.++ MostChange [ControlRate,AudioRate] a=0 b=0; FILTER: TRUE+-}+mostChange :: Ugen -> Ugen -> Ugen+mostChange a b = mkUgen Nothing [ControlRate, AudioRate] (Right [0, 1]) "MostChange" [a, b] Nothing 1 (Special 0) NoId++{- | Mouse button Ugen.++ MouseButton [ControlRate] minval=0 maxval=1 lag=0.2+-}+mouseButton :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+mouseButton rate minval maxval lag_ = mkUgen Nothing [ControlRate] (Left rate) "MouseButton" [minval, maxval, lag_] Nothing 1 (Special 0) NoId++{- | Cursor tracking Ugen.++ MouseX [ControlRate] minval=0 maxval=1 warp=0 lag=0.2; ENUMERATION INPUTS: 2=Warp+-}+mouseX :: Rate -> Ugen -> Ugen -> Warp Ugen -> Ugen -> Ugen+mouseX rate minval maxval warp lag_ = mkUgen Nothing [ControlRate] (Left rate) "MouseX" [minval, maxval, (from_warp warp), lag_] Nothing 1 (Special 0) NoId++{- | Cursor tracking Ugen.++ MouseY [ControlRate] minval=0 maxval=1 warp=0 lag=0.2; ENUMERATION INPUTS: 2=Warp+-}+mouseY :: Rate -> Ugen -> Ugen -> Warp Ugen -> Ugen -> Ugen+mouseY rate minval maxval warp lag_ = mkUgen Nothing [ControlRate] (Left rate) "MouseY" [minval, maxval, (from_warp warp), lag_] Nothing 1 (Special 0) NoId++{- | Sum of uniform distributions.++ NRand [InitialisationRate] lo=0 hi=1 n=0; NONDET+-}+nRandId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen+nRandId z lo hi n = mkUgen Nothing [InitialisationRate] (Left InitialisationRate) "NRand" [lo, hi, n] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of NRand.+nRandM :: Uid m => Ugen -> Ugen -> Ugen -> m Ugen+nRandM = liftUid3 nRandId++-- | Unsafe variant of NRand.+nRand :: Ugen -> Ugen -> Ugen -> Ugen+nRand = liftUnsafe3 nRandM++{- | (Undocumented class)++ NodeID [InitialisationRate]+-}+nodeID :: Rate -> Ugen+nodeID rate = mkUgen Nothing [InitialisationRate] (Left rate) "NodeID" [] Nothing 1 (Special 0) NoId++{- | Flattens dynamics.++ Normalizer [AudioRate] in=0 level=1 dur=0.01; FILTER: TRUE+-}+normalizer :: Ugen -> Ugen -> Ugen -> Ugen+normalizer in_ level dur = mkUgen Nothing [AudioRate] (Right [0]) "Normalizer" [in_, level, dur] Nothing 1 (Special 0) NoId++{- | Number of audio busses.++ NumAudioBuses [InitialisationRate]+-}+numAudioBuses :: Ugen+numAudioBuses = mkUgen Nothing [InitialisationRate] (Left InitialisationRate) "NumAudioBuses" [] Nothing 1 (Special 0) NoId++{- | Number of open buffers.++ NumBuffers [InitialisationRate]+-}+numBuffers :: Ugen+numBuffers = mkUgen Nothing [InitialisationRate] (Left InitialisationRate) "NumBuffers" [] Nothing 1 (Special 0) NoId++{- | Number of control busses.++ NumControlBuses [InitialisationRate]+-}+numControlBuses :: Ugen+numControlBuses = mkUgen Nothing [InitialisationRate] (Left InitialisationRate) "NumControlBuses" [] Nothing 1 (Special 0) NoId++{- | Number of input busses.++ NumInputBuses [InitialisationRate]+-}+numInputBuses :: Ugen+numInputBuses = mkUgen Nothing [InitialisationRate] (Left InitialisationRate) "NumInputBuses" [] Nothing 1 (Special 0) NoId++{- | Number of output busses.++ NumOutputBuses [InitialisationRate]+-}+numOutputBuses :: Ugen+numOutputBuses = mkUgen Nothing [InitialisationRate] (Left InitialisationRate) "NumOutputBuses" [] Nothing 1 (Special 0) NoId++{- | Number of currently running synths.++ NumRunningSynths [InitialisationRate,ControlRate]+-}+numRunningSynths :: Ugen+numRunningSynths = mkUgen Nothing [InitialisationRate, ControlRate] (Left InitialisationRate) "NumRunningSynths" [] Nothing 1 (Special 0) NoId++{- | Write a signal to a bus with sample accurate timing.++ OffsetOut [ControlRate,AudioRate] bus=0 *channelsArray=0; MCE=1, FILTER: TRUE+-}+offsetOut :: Ugen -> Ugen -> Ugen+offsetOut bus input = mkUgen Nothing [ControlRate, AudioRate] (Right [1]) "OffsetOut" [bus] (Just [input]) 0 (Special 0) NoId++{- | One pole filter.++ OnePole [ControlRate,AudioRate] in=0 coef=0.5; FILTER: TRUE+-}+onePole :: Ugen -> Ugen -> Ugen+onePole in_ coef = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "OnePole" [in_, coef] Nothing 1 (Special 0) NoId++{- | One zero filter.++ OneZero [ControlRate,AudioRate] in=0 coef=0.5; FILTER: TRUE+-}+oneZero :: Ugen -> Ugen -> Ugen+oneZero in_ coef = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "OneZero" [in_, coef] Nothing 1 (Special 0) NoId++{- | Onset detector++ Onsets [ControlRate] chain=0 threshold=0.5 odftype=3 relaxtime=1 floor=0.1 mingap=10 medianspan=11 whtype=1 rawodf=0+-}+onsets :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+onsets chain threshold odftype relaxtime floor_ mingap medianspan whtype rawodf = mkUgen Nothing [ControlRate] (Left ControlRate) "Onsets" [chain, threshold, odftype, relaxtime, floor_, mingap, medianspan, whtype, rawodf] Nothing 1 (Special 0) NoId++{- | Interpolating wavetable oscillator.++ Osc [ControlRate,AudioRate] bufnum=0 freq=440 phase=0+-}+osc :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+osc rate bufnum freq phase = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Osc" [bufnum, freq, phase] Nothing 1 (Special 0) NoId++{- | Noninterpolating wavetable oscillator.++ OscN [ControlRate,AudioRate] bufnum=0 freq=440 phase=0+-}+oscN :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+oscN rate bufnum freq phase = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "OscN" [bufnum, freq, phase] Nothing 1 (Special 0) NoId++{- | Write a signal to a bus.++ Out [ControlRate,AudioRate] bus=0 *channelsArray=0; MCE=1, FILTER: TRUE+-}+out :: Ugen -> Ugen -> Ugen+out bus input = mkUgen Nothing [ControlRate, AudioRate] (Right [1]) "Out" [bus] (Just [input]) 0 (Special 0) NoId++{- | Very fast sine grain with a parabolic envelope++ PSinGrain [AudioRate] freq=440 dur=0.2 amp=0.1+-}+pSinGrain :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+pSinGrain rate freq dur amp = mkUgen Nothing [AudioRate] (Left rate) "PSinGrain" [freq, dur, amp] Nothing 1 (Special 0) NoId++{- | Complex addition.++ PV_Add [ControlRate] bufferA=0 bufferB=0+-}+pv_Add :: Ugen -> Ugen -> Ugen+pv_Add bufferA bufferB = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_Add" [bufferA, bufferB] Nothing 1 (Special 0) NoId++{- | Scramble bins.++ PV_BinScramble [ControlRate] buffer=0 wipe=0 width=0.2 trig=0; NONDET+-}+pv_BinScrambleId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_BinScrambleId z buffer wipe width trig_ = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_BinScramble" [buffer, wipe, width, trig_] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of PV_BinScramble.+pv_BinScrambleM :: Uid m => Ugen -> Ugen -> Ugen -> Ugen -> m Ugen+pv_BinScrambleM = liftUid4 pv_BinScrambleId++-- | Unsafe variant of PV_BinScramble.+pv_BinScramble :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_BinScramble = liftUnsafe4 pv_BinScrambleM++{- | Shift and stretch bin position.++ PV_BinShift [ControlRate] buffer=0 stretch=1 shift=0 interp=0+-}+pv_BinShift :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_BinShift buffer stretch shift interp = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_BinShift" [buffer, stretch, shift, interp] Nothing 1 (Special 0) NoId++{- | Combine low and high bins from two inputs.++ PV_BinWipe [ControlRate] bufferA=0 bufferB=0 wipe=0+-}+pv_BinWipe :: Ugen -> Ugen -> Ugen -> Ugen+pv_BinWipe bufferA bufferB wipe = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_BinWipe" [bufferA, bufferB, wipe] Nothing 1 (Special 0) NoId++{- | Zero bins.++ PV_BrickWall [ControlRate] buffer=0 wipe=0+-}+pv_BrickWall :: Ugen -> Ugen -> Ugen+pv_BrickWall buffer wipe = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_BrickWall" [buffer, wipe] Nothing 1 (Special 0) NoId++{- | Complex plane attack.++ PV_ConformalMap [ControlRate] buffer=0 areal=0 aimag=0+-}+pv_ConformalMap :: Ugen -> Ugen -> Ugen -> Ugen+pv_ConformalMap buffer areal aimag = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_ConformalMap" [buffer, areal, aimag] Nothing 1 (Special 0) NoId++{- | Complex conjugate++ PV_Conj [ControlRate] buffer=0+-}+pv_Conj :: Ugen -> Ugen+pv_Conj buffer = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_Conj" [buffer] Nothing 1 (Special 0) NoId++{- | Copy an FFT buffer++ PV_Copy [ControlRate] bufferA=0 bufferB=0+-}+pv_Copy :: Ugen -> Ugen -> Ugen+pv_Copy bufferA bufferB = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_Copy" [bufferA, bufferB] Nothing 1 (Special 0) NoId++{- | Copy magnitudes and phases.++ PV_CopyPhase [ControlRate] bufferA=0 bufferB=0+-}+pv_CopyPhase :: Ugen -> Ugen -> Ugen+pv_CopyPhase bufferA bufferB = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_CopyPhase" [bufferA, bufferB] Nothing 1 (Special 0) NoId++{- | Random phase shifting.++ PV_Diffuser [ControlRate] buffer=0 trig=0+-}+pv_Diffuser :: Ugen -> Ugen -> Ugen+pv_Diffuser buffer trig_ = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_Diffuser" [buffer, trig_] Nothing 1 (Special 0) NoId++{- | Complex division++ PV_Div [ControlRate] bufferA=0 bufferB=0+-}+pv_Div :: Ugen -> Ugen -> Ugen+pv_Div bufferA bufferB = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_Div" [bufferA, bufferB] Nothing 1 (Special 0) NoId++{-+-- | FFT onset detector.+--+-- PV_HainsworthFoote [ControlRate,AudioRate] maxSize=0+pv_HainsworthFoote :: Ugen -> Ugen+pv_HainsworthFoote maxSize = mkUgen Nothing [ControlRate,AudioRate] (Left ControlRate) "PV_HainsworthFoote" [maxSize] Nothing 1 (Special 0) NoId++-- | FFT feature detector for onset detection.+--+-- PV_JensenAndersen [ControlRate,AudioRate] maxSize=0+pv_JensenAndersen :: Ugen -> Ugen+pv_JensenAndersen maxSize = mkUgen Nothing [ControlRate,AudioRate] (Left ControlRate) "PV_JensenAndersen" [maxSize] Nothing 1 (Special 0) NoId+-}++{- | Pass bins which are a local maximum.++ PV_LocalMax [ControlRate] buffer=0 threshold=0+-}+pv_LocalMax :: Ugen -> Ugen -> Ugen+pv_LocalMax buffer threshold = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_LocalMax" [buffer, threshold] Nothing 1 (Special 0) NoId++{- | Pass bins above a threshold.++ PV_MagAbove [ControlRate] buffer=0 threshold=0+-}+pv_MagAbove :: Ugen -> Ugen -> Ugen+pv_MagAbove buffer threshold = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_MagAbove" [buffer, threshold] Nothing 1 (Special 0) NoId++{- | Pass bins below a threshold.++ PV_MagBelow [ControlRate] buffer=0 threshold=0+-}+pv_MagBelow :: Ugen -> Ugen -> Ugen+pv_MagBelow buffer threshold = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_MagBelow" [buffer, threshold] Nothing 1 (Special 0) NoId++{- | Clip bins to a threshold.++ PV_MagClip [ControlRate] buffer=0 threshold=0+-}+pv_MagClip :: Ugen -> Ugen -> Ugen+pv_MagClip buffer threshold = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_MagClip" [buffer, threshold] Nothing 1 (Special 0) NoId++{- | Division of magnitudes++ PV_MagDiv [ControlRate] bufferA=0 bufferB=0 zeroed=0.0001+-}+pv_MagDiv :: Ugen -> Ugen -> Ugen -> Ugen+pv_MagDiv bufferA bufferB zeroed = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_MagDiv" [bufferA, bufferB, zeroed] Nothing 1 (Special 0) NoId++{- | Freeze magnitudes.++ PV_MagFreeze [ControlRate] buffer=0 freeze=0+-}+pv_MagFreeze :: Ugen -> Ugen -> Ugen+pv_MagFreeze buffer freeze = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_MagFreeze" [buffer, freeze] Nothing 1 (Special 0) NoId++{- | Multiply magnitudes.++ PV_MagMul [ControlRate] bufferA=0 bufferB=0+-}+pv_MagMul :: Ugen -> Ugen -> Ugen+pv_MagMul bufferA bufferB = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_MagMul" [bufferA, bufferB] Nothing 1 (Special 0) NoId++{- | Multiply magnitudes by noise.++ PV_MagNoise [ControlRate] buffer=0+-}+pv_MagNoise :: Ugen -> Ugen+pv_MagNoise buffer = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_MagNoise" [buffer] Nothing 1 (Special 0) NoId++{- | shift and stretch magnitude bin position.++ PV_MagShift [ControlRate] buffer=0 stretch=1 shift=0+-}+pv_MagShift :: Ugen -> Ugen -> Ugen -> Ugen+pv_MagShift buffer stretch shift = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_MagShift" [buffer, stretch, shift] Nothing 1 (Special 0) NoId++{- | Average magnitudes across bins.++ PV_MagSmear [ControlRate] buffer=0 bins=0+-}+pv_MagSmear :: Ugen -> Ugen -> Ugen+pv_MagSmear buffer bins = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_MagSmear" [buffer, bins] Nothing 1 (Special 0) NoId++{- | Square magnitudes.++ PV_MagSquared [ControlRate] buffer=0+-}+pv_MagSquared :: Ugen -> Ugen+pv_MagSquared buffer = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_MagSquared" [buffer] Nothing 1 (Special 0) NoId++{- | Maximum magnitude.++ PV_Max [ControlRate] bufferA=0 bufferB=0+-}+pv_Max :: Ugen -> Ugen -> Ugen+pv_Max bufferA bufferB = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_Max" [bufferA, bufferB] Nothing 1 (Special 0) NoId++{- | Minimum magnitude.++ PV_Min [ControlRate] bufferA=0 bufferB=0+-}+pv_Min :: Ugen -> Ugen -> Ugen+pv_Min bufferA bufferB = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_Min" [bufferA, bufferB] Nothing 1 (Special 0) NoId++{- | Complex multiply.++ PV_Mul [ControlRate] bufferA=0 bufferB=0+-}+pv_Mul :: Ugen -> Ugen -> Ugen+pv_Mul bufferA bufferB = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_Mul" [bufferA, bufferB] Nothing 1 (Special 0) NoId++{- | Shift phase.++ PV_PhaseShift [ControlRate] buffer=0 shift=0 integrate=0+-}+pv_PhaseShift :: Ugen -> Ugen -> Ugen -> Ugen+pv_PhaseShift buffer shift integrate = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_PhaseShift" [buffer, shift, integrate] Nothing 1 (Special 0) NoId++{- | Shift phase by 270 degrees.++ PV_PhaseShift270 [ControlRate] buffer=0+-}+pv_PhaseShift270 :: Ugen -> Ugen+pv_PhaseShift270 buffer = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_PhaseShift270" [buffer] Nothing 1 (Special 0) NoId++{- | Shift phase by 90 degrees.++ PV_PhaseShift90 [ControlRate] buffer=0+-}+pv_PhaseShift90 :: Ugen -> Ugen+pv_PhaseShift90 buffer = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_PhaseShift90" [buffer] Nothing 1 (Special 0) NoId++{- | Pass random bins.++ PV_RandComb [ControlRate] buffer=0 wipe=0 trig=0; NONDET+-}+pv_RandCombId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen+pv_RandCombId z buffer wipe trig_ = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_RandComb" [buffer, wipe, trig_] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of PV_RandComb.+pv_RandCombM :: Uid m => Ugen -> Ugen -> Ugen -> m Ugen+pv_RandCombM = liftUid3 pv_RandCombId++-- | Unsafe variant of PV_RandComb.+pv_RandComb :: Ugen -> Ugen -> Ugen -> Ugen+pv_RandComb = liftUnsafe3 pv_RandCombM++{- | Crossfade in random bin order.++ PV_RandWipe [ControlRate] bufferA=0 bufferB=0 wipe=0 trig=0; NONDET+-}+pv_RandWipeId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_RandWipeId z bufferA bufferB wipe trig_ = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_RandWipe" [bufferA, bufferB, wipe, trig_] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of PV_RandWipe.+pv_RandWipeM :: Uid m => Ugen -> Ugen -> Ugen -> Ugen -> m Ugen+pv_RandWipeM = liftUid4 pv_RandWipeId++-- | Unsafe variant of PV_RandWipe.+pv_RandWipe :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_RandWipe = liftUnsafe4 pv_RandWipeM++{- | Make gaps in spectrum.++ PV_RectComb [ControlRate] buffer=0 numTeeth=0 phase=0 width=0.5+-}+pv_RectComb :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_RectComb buffer numTeeth phase width = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_RectComb" [buffer, numTeeth, phase, width] Nothing 1 (Special 0) NoId++{- | Make gaps in spectrum.++ PV_RectComb2 [ControlRate] bufferA=0 bufferB=0 numTeeth=0 phase=0 width=0.5+-}+pv_RectComb2 :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_RectComb2 bufferA bufferB numTeeth phase width = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_RectComb2" [bufferA, bufferB, numTeeth, phase, width] Nothing 1 (Special 0) NoId++{- | Two channel equal power pan.++ Pan2 [ControlRate,AudioRate] in=0 pos=0 level=1; FILTER: TRUE+-}+pan2 :: Ugen -> Ugen -> Ugen -> Ugen+pan2 in_ pos level = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Pan2" [in_, pos, level] Nothing 2 (Special 0) NoId++{- | Four channel equal power pan.++ Pan4 [ControlRate,AudioRate] in=0 xpos=0 ypos=0 level=1+-}+pan4 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pan4 rate in_ xpos ypos level = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Pan4" [in_, xpos, ypos, level] Nothing 4 (Special 0) NoId++{- | Azimuth panner++ PanAz [ControlRate,AudioRate] in=0 pos=0 level=1 width=2 orientation=0.5; NC INPUT: True, FILTER: TRUE+-}+panAz :: Int -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+panAz numChannels in_ pos level width orientation = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "PanAz" [in_, pos, level, width, orientation] Nothing numChannels (Special 0) NoId++{- | Ambisonic B-format panner.++ PanB [ControlRate,AudioRate] in=0 azimuth=0 elevation=0 gain=1+-}+panB :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+panB rate in_ azimuth elevation gain = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "PanB" [in_, azimuth, elevation, gain] Nothing 4 (Special 0) NoId++{- | 2D Ambisonic B-format panner.++ PanB2 [ControlRate,AudioRate] in=0 azimuth=0 gain=1; FILTER: TRUE+-}+panB2 :: Ugen -> Ugen -> Ugen -> Ugen+panB2 in_ azimuth gain = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "PanB2" [in_, azimuth, gain] Nothing 3 (Special 0) NoId++{- | Real-time partitioned convolution++ PartConv [AudioRate] in=0 fftsize=0 irbufnum=0+-}+partConv :: Ugen -> Ugen -> Ugen -> Ugen+partConv in_ fftsize irbufnum = mkUgen Nothing [AudioRate] (Left AudioRate) "PartConv" [in_, fftsize, irbufnum] Nothing 1 (Special 0) NoId++{- | When triggered, pauses a node.++ Pause [ControlRate] gate=0 id=0+-}+pause :: Ugen -> Ugen -> Ugen+pause gate_ id_ = mkUgen Nothing [ControlRate] (Left ControlRate) "Pause" [gate_, id_] Nothing 1 (Special 0) NoId++{- | When triggered, pause enclosing synth.++ PauseSelf [ControlRate] in=0+-}+pauseSelf :: Ugen -> Ugen+pauseSelf in_ = mkUgen Nothing [ControlRate] (Left ControlRate) "PauseSelf" [in_] Nothing 1 (Special 0) NoId++{- | FIXME: PauseSelfWhenDone purpose.++ PauseSelfWhenDone [ControlRate] src=0+-}+pauseSelfWhenDone :: Ugen -> Ugen+pauseSelfWhenDone src = mkUgen Nothing [ControlRate] (Left ControlRate) "PauseSelfWhenDone" [src] Nothing 1 (Special 0) NoId++{- | Track peak signal amplitude.++ Peak [ControlRate,AudioRate] in=0 trig=0; FILTER: TRUE+-}+peak :: Ugen -> Ugen -> Ugen+peak in_ trig_ = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Peak" [in_, trig_] Nothing 1 (Special 0) NoId++{- | Track peak signal amplitude.++ PeakFollower [ControlRate,AudioRate] in=0 decay=0.999; FILTER: TRUE+-}+peakFollower :: Ugen -> Ugen -> Ugen+peakFollower in_ decay_ = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "PeakFollower" [in_, decay_] Nothing 1 (Special 0) NoId++{- | A resettable linear ramp between two levels.++ Phasor [ControlRate,AudioRate] trig=0 rate=1 start=0 end=1 resetPos=0+-}+phasor :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+phasor rate trig_ rate_ start end resetPos = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Phasor" [trig_, rate_, start, end, resetPos] Nothing 1 (Special 0) NoId++{- | Pink Noise.++ PinkNoise [ControlRate,AudioRate] ; NONDET+-}+pinkNoiseId :: ID a => a -> Rate -> Ugen+pinkNoiseId z rate = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "PinkNoise" [] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of PinkNoise.+pinkNoiseM :: Uid m => Rate -> m Ugen+pinkNoiseM = liftUid1 pinkNoiseId++-- | Unsafe variant of PinkNoise.+pinkNoise :: Rate -> Ugen+pinkNoise = liftUnsafe1 pinkNoiseM++{- | Autocorrelation pitch follower++ Pitch [ControlRate] in=0 initFreq=440 minFreq=60 maxFreq=4000 execFreq=100 maxBinsPerOctave=16 median=1 ampThreshold=0.01 peakThreshold=0.5 downSample=1 clar=0+-}+pitch :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pitch in_ initFreq minFreq maxFreq execFreq maxBinsPerOctave median_ ampThreshold peakThreshold downSample clar = mkUgen Nothing [ControlRate] (Left ControlRate) "Pitch" [in_, initFreq, minFreq, maxFreq, execFreq, maxBinsPerOctave, median_, ampThreshold, peakThreshold, downSample, clar] Nothing 2 (Special 0) NoId++{- | Time domain pitch shifter.++ PitchShift [AudioRate] in=0 windowSize=0.2 pitchRatio=1 pitchDispersion=0 timeDispersion=0; FILTER: TRUE+-}+pitchShift :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pitchShift in_ windowSize pitchRatio pitchDispersion timeDispersion = mkUgen Nothing [AudioRate] (Right [0]) "PitchShift" [in_, windowSize, pitchRatio, pitchDispersion, timeDispersion] Nothing 1 (Special 0) NoId++{- | Sample playback oscillator.++ PlayBuf [ControlRate,AudioRate] bufnum=0 rate=1 trigger=1 startPos=0 loop=0 doneAction=0; NC INPUT: True, ENUMERATION INPUTS: 4=Loop, 5=DoneAction+-}+playBuf :: Int -> Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Loop Ugen -> DoneAction Ugen -> Ugen+playBuf numChannels rate bufnum rate_ trigger startPos loop doneAction = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "PlayBuf" [bufnum, rate_, trigger, startPos, (from_loop loop), (from_done_action doneAction)] Nothing numChannels (Special 0) NoId++{- | A Karplus-Strong Ugen++ Pluck [AudioRate] in=0 trig=1 maxdelaytime=0.2 delaytime=0.2 decaytime=1 coef=0.5; FILTER: TRUE+-}+pluck :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pluck in_ trig_ maxdelaytime delaytime decaytime coef = mkUgen Nothing [AudioRate] (Right [0]) "Pluck" [in_, trig_, maxdelaytime, delaytime, decaytime, coef] Nothing 1 (Special 0) NoId++{-+-- | Print the current output value of a Ugen+--+-- Poll [ControlRate,AudioRate] trig=0 in=0 trigid=-1 label=0; FILTER: TRUE, REORDERS INPUTS: [0,1,3,2]+poll :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+poll trig_ in_ trigid label_ = mkUgen Nothing [ControlRate,AudioRate] (Right [1]) "Poll" [trig_,in_,trigid,label_] Nothing 1 (Special 0) NoId+-}++{- | Band limited pulse wave.++ Pulse [ControlRate,AudioRate] freq=440 width=0.5+-}+pulse :: Rate -> Ugen -> Ugen -> Ugen+pulse rate freq width = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Pulse" [freq, width] Nothing 1 (Special 0) NoId++{- | Pulse counter.++ PulseCount [ControlRate,AudioRate] trig=0 reset=0; FILTER: TRUE+-}+pulseCount :: Ugen -> Ugen -> Ugen+pulseCount trig_ reset = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "PulseCount" [trig_, reset] Nothing 1 (Special 0) NoId++{- | Pulse divider.++ PulseDivider [ControlRate,AudioRate] trig=0 div=2 start=0; FILTER: TRUE+-}+pulseDivider :: Ugen -> Ugen -> Ugen -> Ugen+pulseDivider trig_ div_ start = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "PulseDivider" [trig_, div_, start] Nothing 1 (Special 0) NoId++{- | General quadratic map chaotic generator++ QuadC [AudioRate] freq=22050 a=1 b=-1 c=-0.75 xi=0+-}+quadC :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+quadC rate freq a b c xi = mkUgen Nothing [AudioRate] (Left rate) "QuadC" [freq, a, b, c, xi] Nothing 1 (Special 0) NoId++{- | General quadratic map chaotic generator++ QuadL [AudioRate] freq=22050 a=1 b=-1 c=-0.75 xi=0+-}+quadL :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+quadL rate freq a b c xi = mkUgen Nothing [AudioRate] (Left rate) "QuadL" [freq, a, b, c, xi] Nothing 1 (Special 0) NoId++{- | General quadratic map chaotic generator++ QuadN [AudioRate] freq=22050 a=1 b=-1 c=-0.75 xi=0+-}+quadN :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+quadN rate freq a b c xi = mkUgen Nothing [AudioRate] (Left rate) "QuadN" [freq, a, b, c, xi] Nothing 1 (Special 0) NoId++{- | A resonant high pass filter.++ RHPF [ControlRate,AudioRate] in=0 freq=440 rq=1; FILTER: TRUE+-}+rhpf :: Ugen -> Ugen -> Ugen -> Ugen+rhpf in_ freq rq = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "RHPF" [in_, freq, rq] Nothing 1 (Special 0) NoId++{- | A resonant low pass filter.++ RLPF [ControlRate,AudioRate] in=0 freq=440 rq=1; FILTER: TRUE+-}+rlpf :: Ugen -> Ugen -> Ugen -> Ugen+rlpf in_ freq rq = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "RLPF" [in_, freq, rq] Nothing 1 (Special 0) NoId++{- | Number of radians per sample.++ RadiansPerSample [InitialisationRate]+-}+radiansPerSample :: Ugen+radiansPerSample = mkUgen Nothing [InitialisationRate] (Left InitialisationRate) "RadiansPerSample" [] Nothing 1 (Special 0) NoId++{- | Break a continuous signal into line segments++ Ramp [ControlRate,AudioRate] in=0 lagTime=0.1; FILTER: TRUE+-}+ramp :: Ugen -> Ugen -> Ugen+ramp in_ lagTime = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Ramp" [in_, lagTime] Nothing 1 (Special 0) NoId++{- | Single random number generator.++ Rand [InitialisationRate] lo=0 hi=1; NONDET+-}+randId :: ID a => a -> Ugen -> Ugen -> Ugen+randId z lo hi = mkUgen Nothing [InitialisationRate] (Left InitialisationRate) "Rand" [lo, hi] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of Rand.+randM :: Uid m => Ugen -> Ugen -> m Ugen+randM = liftUid2 randId++-- | Unsafe variant of Rand.+rand :: Ugen -> Ugen -> Ugen+rand = liftUnsafe2 randM++{- | Set the synth's random generator ID.++ RandID [InitialisationRate,ControlRate] id=0+-}+randID :: Rate -> Ugen -> Ugen+randID rate id_ = mkUgen Nothing [InitialisationRate, ControlRate] (Left rate) "RandID" [id_] Nothing 0 (Special 0) NoId++{- | Sets the synth's random generator seed.++ RandSeed [InitialisationRate,ControlRate,AudioRate] trig=0 seed=56789+-}+randSeed :: Rate -> Ugen -> Ugen -> Ugen+randSeed rate trig_ seed = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate] (Left rate) "RandSeed" [trig_, seed] Nothing 0 (Special 0) NoId++{- | Record or overdub into a Buffer.++ RecordBuf [ControlRate,AudioRate] bufnum=0 offset=0 recLevel=1 preLevel=0 run=1 loop=1 trigger=1 doneAction=0 *inputArray=0; MCE=1, REORDERS INPUTS: [8,0,1,2,3,4,5,6,7], ENUMERATION INPUTS: 5=Loop, 7=DoneAction+-}+recordBuf :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Loop Ugen -> Ugen -> DoneAction Ugen -> Ugen -> Ugen+recordBuf rate bufnum offset recLevel preLevel run loop trigger doneAction inputArray = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "RecordBuf" [bufnum, offset, recLevel, preLevel, run, (from_loop loop), trigger, (from_done_action doneAction)] (Just [inputArray]) 1 (Special 0) NoId++{- | Send signal to a bus, overwriting previous contents.++ ReplaceOut [ControlRate,AudioRate] bus=0 *channelsArray=0; MCE=1, FILTER: TRUE+-}+replaceOut :: Ugen -> Ugen -> Ugen+replaceOut bus input = mkUgen Nothing [ControlRate, AudioRate] (Right [1]) "ReplaceOut" [bus] (Just [input]) 0 (Special 0) NoId++{- | Resonant filter.++ Resonz [ControlRate,AudioRate] in=0 freq=440 bwr=1; FILTER: TRUE+-}+resonz :: Ugen -> Ugen -> Ugen -> Ugen+resonz in_ freq bwr = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Resonz" [in_, freq, bwr] Nothing 1 (Special 0) NoId++{- | Ringing filter.++ Ringz [ControlRate,AudioRate] in=0 freq=440 decaytime=1; FILTER: TRUE+-}+ringz :: Ugen -> Ugen -> Ugen -> Ugen+ringz in_ freq decaytime = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Ringz" [in_, freq, decaytime] Nothing 1 (Special 0) NoId++{- | Rotate a sound field.++ Rotate2 [ControlRate,AudioRate] x=0 y=0 pos=0; FILTER: TRUE+-}+rotate2 :: Ugen -> Ugen -> Ugen -> Ugen+rotate2 x y pos = mkUgen Nothing [ControlRate, AudioRate] (Right [0, 1]) "Rotate2" [x, y, pos] Nothing 2 (Special 0) NoId++{- | Track maximum level.++ RunningMax [ControlRate,AudioRate] in=0 trig=0; FILTER: TRUE+-}+runningMax :: Ugen -> Ugen -> Ugen+runningMax in_ trig_ = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "RunningMax" [in_, trig_] Nothing 1 (Special 0) NoId++{- | Track minimum level.++ RunningMin [ControlRate,AudioRate] in=0 trig=0; FILTER: TRUE+-}+runningMin :: Ugen -> Ugen -> Ugen+runningMin in_ trig_ = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "RunningMin" [in_, trig_] Nothing 1 (Special 0) NoId++{- | Running sum over n frames++ RunningSum [ControlRate,AudioRate] in=0 numsamp=40; FILTER: TRUE+-}+runningSum :: Ugen -> Ugen -> Ugen+runningSum in_ numsamp = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "RunningSum" [in_, numsamp] Nothing 1 (Special 0) NoId++{- | Second order filter section (biquad).++ SOS [ControlRate,AudioRate] in=0 a0=0 a1=0 a2=0 b1=0 b2=0; FILTER: TRUE+-}+sos :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+sos in_ a0 a1 a2 b1 b2 = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "SOS" [in_, a0, a1, a2, b1, b2] Nothing 1 (Special 0) NoId++{- | Duration of one sample.++ SampleDur [InitialisationRate]+-}+sampleDur :: Ugen+sampleDur = mkUgen Nothing [InitialisationRate] (Left InitialisationRate) "SampleDur" [] Nothing 1 (Special 0) NoId++{- | Server sample rate.++ SampleRate [InitialisationRate]+-}+sampleRate :: Ugen+sampleRate = mkUgen Nothing [InitialisationRate] (Left InitialisationRate) "SampleRate" [] Nothing 1 (Special 0) NoId++{- | Remove infinity, NaN, and denormals++ Sanitize [ControlRate,AudioRate] in=0 replace=0; FILTER: TRUE+-}+sanitize :: Ugen -> Ugen -> Ugen+sanitize in_ replace = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Sanitize" [in_, replace] Nothing 1 (Special 0) NoId++{- | Band limited sawtooth.++ Saw [ControlRate,AudioRate] freq=440+-}+saw :: Rate -> Ugen -> Ugen+saw rate freq = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Saw" [freq] Nothing 1 (Special 0) NoId++{- | Schmidt trigger.++ Schmidt [InitialisationRate,ControlRate,AudioRate] in=0 lo=0 hi=1; FILTER: TRUE+-}+schmidt :: Ugen -> Ugen -> Ugen -> Ugen+schmidt in_ lo hi = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate] (Right [0]) "Schmidt" [in_, lo, hi] Nothing 1 (Special 0) NoId++{- | Select output from an array of inputs.++ Select [InitialisationRate,ControlRate,AudioRate] which=0 *array=0; MCE=1, FILTER: TRUE+-}+select :: Ugen -> Ugen -> Ugen+select which array = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate] (Right [0, 1]) "Select" [which] (Just [array]) 1 (Special 0) NoId++{- | Send a trigger message from the server back to the client.++ SendTrig [ControlRate,AudioRate] in=0 id=0 value=0; FILTER: TRUE+-}+sendTrig :: Ugen -> Ugen -> Ugen -> Ugen+sendTrig in_ id_ value = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "SendTrig" [in_, id_, value] Nothing 0 (Special 0) NoId++{- | Set-reset flip flop.++ SetResetFF [ControlRate,AudioRate] trig=0 reset=0; FILTER: TRUE+-}+setResetFF :: Ugen -> Ugen -> Ugen+setResetFF trig_ reset = mkUgen Nothing [ControlRate, AudioRate] (Right [0, 1]) "SetResetFF" [trig_, reset] Nothing 1 (Special 0) NoId++{- | Wave shaper.++ Shaper [ControlRate,AudioRate] bufnum=0 in=0; FILTER: TRUE+-}+shaper :: Ugen -> Ugen -> Ugen+shaper bufnum in_ = mkUgen Nothing [ControlRate, AudioRate] (Right [1]) "Shaper" [bufnum, in_] Nothing 1 (Special 0) NoId++{- | Interpolating sine wavetable oscillator.++ SinOsc [ControlRate,AudioRate] freq=440 phase=0+-}+sinOsc :: Rate -> Ugen -> Ugen -> Ugen+sinOsc rate freq phase = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "SinOsc" [freq, phase] Nothing 1 (Special 0) NoId++{- | Feedback FM oscillator++ SinOscFB [ControlRate,AudioRate] freq=440 feedback=0+-}+sinOscFB :: Rate -> Ugen -> Ugen -> Ugen+sinOscFB rate freq feedback = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "SinOscFB" [freq, feedback] Nothing 1 (Special 0) NoId++{- | Slew rate limiter.++ Slew [ControlRate,AudioRate] in=0 up=1 dn=1; FILTER: TRUE+-}+slew :: Ugen -> Ugen -> Ugen -> Ugen+slew in_ up dn = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Slew" [in_, up, dn] Nothing 1 (Special 0) NoId++{- | Slope of signal++ Slope [ControlRate,AudioRate] in=0; FILTER: TRUE+-}+slope :: Ugen -> Ugen+slope in_ = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Slope" [in_] Nothing 1 (Special 0) NoId++{- | Spectral centroid++ SpecCentroid [ControlRate] buffer=0+-}+specCentroid :: Rate -> Ugen -> Ugen+specCentroid rate buffer = mkUgen Nothing [ControlRate] (Left rate) "SpecCentroid" [buffer] Nothing 1 (Special 0) NoId++{- | Spectral Flatness measure++ SpecFlatness [ControlRate] buffer=0+-}+specFlatness :: Rate -> Ugen -> Ugen+specFlatness rate buffer = mkUgen Nothing [ControlRate] (Left rate) "SpecFlatness" [buffer] Nothing 1 (Special 0) NoId++{- | Find a percentile of FFT magnitude spectrum++ SpecPcile [ControlRate] buffer=0 fraction=0.5 interpolate=0+-}+specPcile :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+specPcile rate buffer fraction interpolate = mkUgen Nothing [ControlRate] (Left rate) "SpecPcile" [buffer, fraction, interpolate] Nothing 1 (Special 0) NoId++{- | physical model of resonating spring++ Spring [ControlRate,AudioRate] in=0 spring=1 damp=0+-}+spring :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+spring rate in_ spring_ damp = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Spring" [in_, spring_, damp] Nothing 1 (Special 0) NoId++{- | Standard map chaotic generator++ StandardL [AudioRate] freq=22050 k=1 xi=0.5 yi=0+-}+standardL :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+standardL rate freq k xi yi = mkUgen Nothing [AudioRate] (Left rate) "StandardL" [freq, k, xi, yi] Nothing 1 (Special 0) NoId++{- | Standard map chaotic generator++ StandardN [AudioRate] freq=22050 k=1 xi=0.5 yi=0+-}+standardN :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+standardN rate freq k xi yi = mkUgen Nothing [AudioRate] (Left rate) "StandardN" [freq, k, xi, yi] Nothing 1 (Special 0) NoId++{- | Pulse counter.++ Stepper [ControlRate,AudioRate] trig=0 reset=0 min=0 max=7 step=1 resetval=0; FILTER: TRUE+-}+stepper :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+stepper trig_ reset min_ max_ step resetval = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Stepper" [trig_, reset, min_, max_, step, resetval] Nothing 1 (Special 0) NoId++{- | Stereo real-time convolver with linear interpolation++ StereoConvolution2L [AudioRate] in=0 kernelL=0 kernelR=0 trigger=0 framesize=2048 crossfade=1+-}+stereoConvolution2L :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+stereoConvolution2L rate in_ kernelL kernelR trigger framesize crossfade = mkUgen Nothing [AudioRate] (Left rate) "StereoConvolution2L" [in_, kernelL, kernelR, trigger, framesize, crossfade] Nothing 2 (Special 0) NoId++{- | Offset from synth start within one sample.++ SubsampleOffset [InitialisationRate]+-}+subsampleOffset :: Ugen+subsampleOffset = mkUgen Nothing [InitialisationRate] (Left InitialisationRate) "SubsampleOffset" [] Nothing 1 (Special 0) NoId++{- | Sum three signals++ Sum3 [] in0=0 in1=0 in2=0; FILTER: TRUE+-}+sum3 :: Ugen -> Ugen -> Ugen -> Ugen+sum3 in0 in1 in2 = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate, DemandRate] (Right [0, 1, 2]) "Sum3" [in0, in1, in2] Nothing 1 (Special 0) NoId++{- | Sum four signals++ Sum4 [] in0=0 in1=0 in2=0 in3=0; FILTER: TRUE+-}+sum4 :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+sum4 in0 in1 in2 in3 = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate, DemandRate] (Right [0, 1, 2, 3]) "Sum4" [in0, in1, in2, in3] Nothing 1 (Special 0) NoId++{- | Triggered linear ramp++ Sweep [ControlRate,AudioRate] trig=0 rate=1; FILTER: TRUE+-}+sweep :: Rate -> Ugen -> Ugen -> Ugen+sweep rate trig_ rate_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Sweep" [trig_, rate_] Nothing 1 (Special 0) NoId++{- | Hard sync sawtooth wave.++ SyncSaw [ControlRate,AudioRate] syncFreq=440 sawFreq=440+-}+syncSaw :: Rate -> Ugen -> Ugen -> Ugen+syncSaw rate syncFreq sawFreq = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "SyncSaw" [syncFreq, sawFreq] Nothing 1 (Special 0) NoId++{- | Control rate trigger to audio rate trigger converter++ T2A [AudioRate] in=0 offset=0+-}+t2a :: Ugen -> Ugen -> Ugen+t2a in_ offset = mkUgen Nothing [AudioRate] (Left AudioRate) "T2A" [in_, offset] Nothing 1 (Special 0) NoId++{- | Audio rate trigger to control rate trigger converter++ T2K [ControlRate] in=0+-}+t2k :: Ugen -> Ugen+t2k in_ = mkUgen Nothing [ControlRate] (Left ControlRate) "T2K" [in_] Nothing 1 (Special 0) NoId++{- | physical model of bouncing object++ TBall [ControlRate,AudioRate] in=0 g=10 damp=0 friction=0.01+-}+tBall :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+tBall rate in_ g damp friction_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "TBall" [in_, g, damp, friction_] Nothing 1 (Special 0) NoId++{- | Trigger delay.++ TDelay [ControlRate,AudioRate] in=0 dur=0.1; FILTER: TRUE+-}+tDelay :: Ugen -> Ugen -> Ugen+tDelay in_ dur = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "TDelay" [in_, dur] Nothing 1 (Special 0) NoId++{- | Demand results as trigger from demand rate Ugens.++ TDuty [ControlRate,AudioRate] dur=1 reset=0 doneAction=0 level=1 gapFirst=0; REORDERS INPUTS: [0,1,3,2,4], ENUMERATION INPUTS: 2=DoneAction+-}+tDuty :: Rate -> Ugen -> Ugen -> DoneAction Ugen -> Ugen -> Ugen -> Ugen+tDuty rate dur reset doneAction level gapFirst = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "TDuty" [dur, reset, (from_done_action doneAction), level, gapFirst] Nothing 1 (Special 0) NoId++{- | Triggered exponential random number generator.++ TExpRand [ControlRate,AudioRate] lo=0.01 hi=1 trig=0; FILTER: TRUE, NONDET+-}+tExpRandId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen+tExpRandId z lo hi trig_ = mkUgen Nothing [ControlRate, AudioRate] (Right [2]) "TExpRand" [lo, hi, trig_] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of TExpRand.+tExpRandM :: Uid m => Ugen -> Ugen -> Ugen -> m Ugen+tExpRandM = liftUid3 tExpRandId++-- | Unsafe variant of TExpRand.+tExpRand :: Ugen -> Ugen -> Ugen -> Ugen+tExpRand = liftUnsafe3 tExpRandM++{- | Buffer granulator.++ TGrains [AudioRate] trigger=0 bufnum=0 rate=1 centerPos=0 dur=0.1 pan=0 amp=0.1 interp=4; NC INPUT: True+-}+tGrains :: Int -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+tGrains numChannels trigger bufnum rate_ centerPos dur pan amp interp = mkUgen Nothing [AudioRate] (Left AudioRate) "TGrains" [trigger, bufnum, rate_, centerPos, dur, pan, amp, interp] Nothing numChannels (Special 0) NoId++{- | Triggered integer random number generator.++ TIRand [ControlRate,AudioRate] lo=0 hi=127 trig=0; FILTER: TRUE, NONDET+-}+tiRandId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen+tiRandId z lo hi trig_ = mkUgen Nothing [ControlRate, AudioRate] (Right [2]) "TIRand" [lo, hi, trig_] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of Tirand.+tiRandM :: Uid m => Ugen -> Ugen -> Ugen -> m Ugen+tiRandM = liftUid3 tiRandId++-- | Unsafe variant of Tirand.+tiRand :: Ugen -> Ugen -> Ugen -> Ugen+tiRand = liftUnsafe3 tiRandM++{- | Triggered random number generator.++ TRand [ControlRate,AudioRate] lo=0 hi=1 trig=0; FILTER: TRUE, NONDET+-}+tRandId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen+tRandId z lo hi trig_ = mkUgen Nothing [ControlRate, AudioRate] (Right [2]) "TRand" [lo, hi, trig_] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of TRand.+tRandM :: Uid m => Ugen -> Ugen -> Ugen -> m Ugen+tRandM = liftUid3 tRandId++-- | Unsafe variant of TRand.+tRand :: Ugen -> Ugen -> Ugen -> Ugen+tRand = liftUnsafe3 tRandM++{- | Triggered windex.++ TWindex [ControlRate,AudioRate] in=0 normalize=0 *array=0; MCE=1, FILTER: TRUE, REORDERS INPUTS: [0,2,1], NONDET+-}+tWindexId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen+tWindexId z in_ normalize array = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "TWindex" [in_, normalize] (Just [array]) 1 (Special 0) (toUid z)++-- | Monad variant of TWindex.+tWindexM :: Uid m => Ugen -> Ugen -> Ugen -> m Ugen+tWindexM = liftUid3 tWindexId++-- | Unsafe variant of TWindex.+tWindex :: Ugen -> Ugen -> Ugen -> Ugen+tWindex = liftUnsafe3 tWindexM++{- | Returns time since last triggered.++ Timer [ControlRate,AudioRate] trig=0; FILTER: TRUE+-}+timer :: Ugen -> Ugen+timer trig_ = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Timer" [trig_] Nothing 1 (Special 0) NoId++{- | Toggle flip flop.++ ToggleFF [ControlRate,AudioRate] trig=0; FILTER: TRUE+-}+toggleFF :: Ugen -> Ugen+toggleFF trig_ = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "ToggleFF" [trig_] Nothing 1 (Special 0) NoId++{- | Timed trigger.++ Trig [ControlRate,AudioRate] in=0 dur=0.1; FILTER: TRUE+-}+trig :: Ugen -> Ugen -> Ugen+trig in_ dur = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Trig" [in_, dur] Nothing 1 (Special 0) NoId++{- | Timed trigger.++ Trig1 [ControlRate,AudioRate] in=0 dur=0.1; FILTER: TRUE+-}+trig1 :: Ugen -> Ugen -> Ugen+trig1 in_ dur = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Trig1" [in_, dur] Nothing 1 (Special 0) NoId++{- | Two pole filter.++ TwoPole [ControlRate,AudioRate] in=0 freq=440 radius=0.8; FILTER: TRUE+-}+twoPole :: Ugen -> Ugen -> Ugen -> Ugen+twoPole in_ freq radius = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "TwoPole" [in_, freq, radius] Nothing 1 (Special 0) NoId++{- | Two zero filter.++ TwoZero [ControlRate,AudioRate] in=0 freq=440 radius=0.8; FILTER: TRUE+-}+twoZero :: Ugen -> Ugen -> Ugen -> Ugen+twoZero in_ freq radius = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "TwoZero" [in_, freq, radius] Nothing 1 (Special 0) NoId++{- | Stream in audio from a file, with variable rate++ VDiskIn [AudioRate] bufnum=0 rate=1 loop=0 sendID=0; NC INPUT: True, ENUMERATION INPUTS: 2=Loop+-}+vDiskIn :: Int -> Ugen -> Ugen -> Loop Ugen -> Ugen -> Ugen+vDiskIn numChannels bufnum rate_ loop sendID = mkUgen Nothing [AudioRate] (Left AudioRate) "VDiskIn" [bufnum, rate_, (from_loop loop), sendID] Nothing numChannels (Special 0) NoId++{- | Variable wavetable oscillator.++ VOsc [ControlRate,AudioRate] bufpos=0 freq=440 phase=0+-}+vOsc :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+vOsc rate bufpos freq phase = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "VOsc" [bufpos, freq, phase] Nothing 1 (Special 0) NoId++{- | Three variable wavetable oscillators.++ VOsc3 [ControlRate,AudioRate] bufpos=0 freq1=110 freq2=220 freq3=440+-}+vOsc3 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+vOsc3 rate bufpos freq1 freq2 freq3 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "VOsc3" [bufpos, freq1, freq2, freq3] Nothing 1 (Special 0) NoId++{- | Variable shaped lag++ VarLag [ControlRate,AudioRate] in=0 time=0.1 curvature=0 warp=5 start=0; FILTER: TRUE+-}+varLag :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+varLag in_ time curvature warp start = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "VarLag" [in_, time, curvature, warp, start] Nothing 1 (Special 0) NoId++{- | Variable duty saw++ VarSaw [ControlRate,AudioRate] freq=440 iphase=0 width=0.5+-}+varSaw :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+varSaw rate freq iphase width = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "VarSaw" [freq, iphase, width] Nothing 1 (Special 0) NoId++{- | The Vibrato oscillator models a slow frequency modulation.++ Vibrato [ControlRate,AudioRate] freq=440 rate=6 depth=0.02 delay=0 onset=0 rateVariation=0.04 depthVariation=0.1 iphase=0 trig=0; NONDET+-}+vibratoId :: ID a => a -> Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+vibratoId z rate freq rate_ depth delay onset rateVariation depthVariation iphase trig_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Vibrato" [freq, rate_, depth, delay, onset, rateVariation, depthVariation, iphase, trig_] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of Vibrato.+vibratoM :: Uid m => Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> m Ugen+vibratoM = liftUid10 vibratoId++-- | Unsafe variant of Vibrato.+vibrato :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+vibrato = liftUnsafe10 vibratoM++{- | Warp a buffer with a time pointer++ Warp1 [AudioRate] bufnum=0 pointer=0 freqScale=1 windowSize=0.2 envbufnum=-1 overlaps=8 windowRandRatio=0 interp=1; NC INPUT: True+-}+warp1 :: Int -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+warp1 numChannels bufnum pointer freqScale windowSize envbufnum overlaps windowRandRatio interp = mkUgen Nothing [AudioRate] (Left AudioRate) "Warp1" [bufnum, pointer, freqScale, windowSize, envbufnum, overlaps, windowRandRatio, interp] Nothing numChannels (Special 0) NoId++{- | White noise.++ WhiteNoise [ControlRate,AudioRate] ; NONDET+-}+whiteNoiseId :: ID a => a -> Rate -> Ugen+whiteNoiseId z rate = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "WhiteNoise" [] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of WhiteNoise.+whiteNoiseM :: Uid m => Rate -> m Ugen+whiteNoiseM = liftUid1 whiteNoiseId++-- | Unsafe variant of WhiteNoise.+whiteNoise :: Rate -> Ugen+whiteNoise = liftUnsafe1 whiteNoiseM++{- | Wrap a signal outside given thresholds.++ Wrap [InitialisationRate,ControlRate,AudioRate] in=0 lo=0 hi=1; FILTER: TRUE+-}+wrap :: Ugen -> Ugen -> Ugen -> Ugen+wrap in_ lo hi = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate] (Right [0]) "Wrap" [in_, lo, hi] Nothing 1 (Special 0) NoId++{- | Index into a table with a signal.++ WrapIndex [ControlRate,AudioRate] bufnum=0 in=0; FILTER: TRUE+-}+wrapIndex :: Ugen -> Ugen -> Ugen+wrapIndex bufnum in_ = mkUgen Nothing [ControlRate, AudioRate] (Right [1]) "WrapIndex" [bufnum, in_] Nothing 1 (Special 0) NoId++{- | Equal power two channel cross fade.++ XFade2 [ControlRate,AudioRate] inA=0 inB=0 pan=0 level=1; FILTER: TRUE+-}+xFade2 :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+xFade2 inA inB pan level = mkUgen Nothing [ControlRate, AudioRate] (Right [0, 1]) "XFade2" [inA, inB, pan, level] Nothing 1 (Special 0) NoId++{- | Exponential line generator.++ XLine [ControlRate,AudioRate] start=1 end=2 dur=1 doneAction=0; ENUMERATION INPUTS: 3=DoneAction+-}+xLine :: Rate -> Ugen -> Ugen -> Ugen -> DoneAction Ugen -> Ugen+xLine rate start end dur doneAction = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "XLine" [start, end, dur, (from_done_action doneAction)] Nothing 1 (Special 0) NoId++{- | Send signal to a bus, crossfading with previous contents.++ XOut [ControlRate,AudioRate] bus=0 xfade=0 *channelsArray=0; MCE=1, FILTER: TRUE+-}+xOut :: Ugen -> Ugen -> Ugen -> Ugen+xOut bus xfade input = mkUgen Nothing [ControlRate, AudioRate] (Right [2]) "XOut" [bus, xfade] (Just [input]) 0 (Special 0) NoId++{- | Zero crossing frequency follower++ ZeroCrossing [ControlRate,AudioRate] in=0; FILTER: TRUE+-}+zeroCrossing :: Ugen -> Ugen+zeroCrossing in_ = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "ZeroCrossing" [in_] Nothing 1 (Special 0) NoId++{- | LocalBuf count++ MaxLocalBufs [InitialisationRate,ControlRate] count=0+-}+maxLocalBufs :: Ugen -> Ugen+maxLocalBufs count = mkUgen Nothing [InitialisationRate, ControlRate] (Left ControlRate) "MaxLocalBufs" [count] Nothing 1 (Special 0) NoId++{- | Multiply add++ MulAdd [InitialisationRate,ControlRate,AudioRate] in=0 mul=0 add=0; FILTER: TRUE+-}+mulAdd :: Ugen -> Ugen -> Ugen -> Ugen+mulAdd in_ mul add = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate] (Right [0, 1, 2]) "MulAdd" [in_, mul, add] Nothing 1 (Special 0) NoId++{- | Set local buffer++ SetBuf [InitialisationRate] buf=0 offset=0 length=0 *array=0; MCE=1, REORDERS INPUTS: [0,1,2,3]+-}+setBuf :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+setBuf buf offset length_ array = mkUgen Nothing [InitialisationRate] (Left InitialisationRate) "SetBuf" [buf, offset, length_] (Just [array]) 1 (Special 0) NoId
+ Sound/Sc3/Ugen/Bindings/Db/External.hs view
@@ -0,0 +1,3541 @@+-- | SC3 Ugen bindings (auto-generated).+module Sound.Sc3.Ugen.Bindings.Db.External where++-- import Sound.Sc3.Common.Enum+-- import Sound.Sc3.Common.Envelope+import Sound.Sc3.Common.Rate+import Sound.Sc3.Common.Uid+import Sound.Sc3.Common.Unsafe++import Sound.Sc3.Ugen.Primitive+import Sound.Sc3.Ugen.Ugen+import Sound.Sc3.Ugen.Util++{- | (Undocumented class)++ A2B [AudioRate] a=0 b=0 c=0 d=0+-}+a2b :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+a2b rate a b c d = mkUgen Nothing [AudioRate] (Left rate) "A2B" [a, b, c, d] Nothing 4 (Special 0) NoId++{- | Emulator of the AY (aka YM) soundchip, used in Spectrum/Atari++ AY [AudioRate] tonea=1777 toneb=1666 tonec=1555 noise=1 control=7 vola=15 volb=15 volc=15 envfreq=4 envstyle=1 chiptype=0+-}+ay :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+ay rate tonea toneb tonec noise control_ vola volb volc envfreq envstyle chiptype = mkUgen Nothing [AudioRate] (Left rate) "AY" [tonea, toneb, tonec, noise, control_, vola, volb, volc, envfreq, envstyle, chiptype] Nothing 1 (Special 0) NoId++{- | AY-3-891X Chip Sound Simulator++ AY8910 [AudioRate] r0=0 r1=0 r2=0 r3=0 r4=0 r5=0 r6=0 r7=0 r8=0 r9=0 rA=0 rB=0 rC=0 rD=0 rate=1+-}+ay8910 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+ay8910 rate r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 rA rB rC rD rate_ = mkUgen Nothing [AudioRate] (Left rate) "AY8910" [r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, rA, rB, rC, rD, rate_] Nothing 3 (Special 0) NoId++{- | (Undocumented class)++ Allpass1 [AudioRate] in=0 freq=1200+-}+allpass1 :: Rate -> Ugen -> Ugen -> Ugen+allpass1 rate in_ freq = mkUgen Nothing [AudioRate] (Left rate) "Allpass1" [in_, freq] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ Allpass2 [AudioRate] in=0 freq=1200 rq=1+-}+allpass2 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+allpass2 rate in_ freq rq = mkUgen Nothing [AudioRate] (Left rate) "Allpass2" [in_, freq, rq] Nothing 1 (Special 0) NoId++{- | amplitude follower (deprecated)++ AmplitudeMod [ControlRate,AudioRate] in=0 attackTime=0.01 releaseTime=0.01+-}+amplitudeMod :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+amplitudeMod rate in_ attackTime releaseTime = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "AmplitudeMod" [in_, attackTime, releaseTime] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ AnalogBassDrum [AudioRate] trig=0 infsustain=0 accent=0.5 freq=50 tone=0.5 decay=0.5 attackfm=0.5 selffm=0.25+-}+analogBassDrum :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+analogBassDrum rate trig_ infsustain accent freq tone decay_ attackfm selffm = mkUgen Nothing [AudioRate] (Left rate) "AnalogBassDrum" [trig_, infsustain, accent, freq, tone, decay_, attackfm, selffm] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ AnalogFoldOsc [AudioRate] freq=100 amp=1+-}+analogFoldOsc :: Rate -> Ugen -> Ugen -> Ugen+analogFoldOsc rate freq amp = mkUgen Nothing [AudioRate] (Left rate) "AnalogFoldOsc" [freq, amp] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ AnalogPhaser [AudioRate] input=0 lfoinput=0 skew=0 feedback=0.25 modulation=0.5 stages=8; FILTER: TRUE+-}+analogPhaser :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+analogPhaser input lfoinput skew feedback modulation stages = mkUgen Nothing [AudioRate] (Right [0]) "AnalogPhaser" [input, lfoinput, skew, feedback, modulation, stages] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ AnalogPhaserMod [ControlRate,AudioRate] input=0 skew=0 modulation=0.5 stages=8; FILTER: TRUE+-}+analogPhaserMod :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+analogPhaserMod input skew modulation stages = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "AnalogPhaserMod" [input, skew, modulation, stages] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ AnalogPulseShaper [AudioRate] pulseinput=0 width=0.5 decay=0.5 double=0.5+-}+analogPulseShaper :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+analogPulseShaper rate pulseinput width decay_ double = mkUgen Nothing [AudioRate] (Left rate) "AnalogPulseShaper" [pulseinput, width, decay_, double] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ AnalogSnareDrum [AudioRate] trig=0 infsustain=0 accent=0.1 freq=200 tone=0.5 decay=0.5 snappy=0.5+-}+analogSnareDrum :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+analogSnareDrum rate trig_ infsustain accent freq tone decay_ snappy = mkUgen Nothing [AudioRate] (Left rate) "AnalogSnareDrum" [trig_, infsustain, accent, freq, tone, decay_, snappy] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ AnalogTape [AudioRate] input=0 bias=0.5 saturation=0.5 drive=0.5 oversample=1 mode=0; FILTER: TRUE+-}+analogTape :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+analogTape input bias saturation drive oversample mode = mkUgen Nothing [AudioRate] (Right [0]) "AnalogTape" [input, bias, saturation, drive, oversample, mode] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ AnalogVintageDistortion [AudioRate] input=0 drivegain=0.5 bias=0 lowgain=0.1 highgain=0.1 shelvingfreq=600 oversample=0; FILTER: TRUE+-}+analogVintageDistortion :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+analogVintageDistortion input drivegain bias lowgain highgain shelvingfreq oversample = mkUgen Nothing [AudioRate] (Right [0]) "AnalogVintageDistortion" [input, drivegain, bias, lowgain, highgain, shelvingfreq, oversample] Nothing 1 (Special 0) NoId++{- | event analyser (BBCut)++ AnalyseEvents2 [AudioRate] in=0 bufnum=0 threshold=0.34 triggerid=101 circular=0 pitch=0+-}+analyseEvents2 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+analyseEvents2 rate in_ bufnum threshold triggerid circular pitch_ = mkUgen Nothing [AudioRate] (Left rate) "AnalyseEvents2" [in_, bufnum, threshold, triggerid, circular, pitch_] Nothing 1 (Special 0) NoId++{- | 2-species Predator-Prey model++ ArneodoCoulletTresser [AudioRate] freq=22050 alpha=1.5 h=0.05 xi=0.5 yi=0.5 zi=0.5+-}+arneodoCoulletTresser :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+arneodoCoulletTresser rate freq alpha h xi yi zi = mkUgen Nothing [AudioRate] (Left rate) "ArneodoCoulletTresser" [freq, alpha, h, xi, yi, zi] Nothing 3 (Special 0) NoId++{- | detect the largest value (and its position) in an array of Ugens++ ArrayMax [ControlRate,AudioRate] *array=0; MCE=1, FILTER: TRUE+-}+arrayMax :: Ugen -> Ugen+arrayMax array = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "ArrayMax" [] (Just [array]) 2 (Special 0) NoId++{- | detect the smallest value (and its position) in an array of Ugens++ ArrayMin [ControlRate,AudioRate] *array=0; MCE=1, FILTER: TRUE+-}+arrayMin :: Ugen -> Ugen+arrayMin array = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "ArrayMin" [] (Just [array]) 2 (Special 0) NoId++{- | Sound Chip Simulator++ Astrocade [AudioRate] reg0=0 reg1=127 reg2=0 reg3=0 reg4=0 reg5=0 reg6=15 reg7=0+-}+astrocade :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+astrocade rate reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 = mkUgen Nothing [AudioRate] (Left rate) "Astrocade" [reg0, reg1, reg2, reg3, reg4, reg5, reg6, reg7] Nothing 1 (Special 0) NoId++{- | TIA Chip Sound Simulator++ Atari2600 [AudioRate] audc0=1 audc1=2 audf0=3 audf1=4 audv0=5 audv1=5 rate=1+-}+atari2600 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+atari2600 rate audc0 audc1 audf0 audf1 audv0 audv1 rate_ = mkUgen Nothing [AudioRate] (Left rate) "Atari2600" [audc0, audc1, audf0, audf1, audv0, audv1, rate_] Nothing 1 (Special 0) NoId++{- | Use Amp data from a given partial++ AtsAmp [ControlRate,AudioRate] atsbuffer=0 partialNum=0 filePointer=0+-}+atsAmp :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+atsAmp rate atsbuffer partialNum filePointer = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "AtsAmp" [atsbuffer, partialNum, filePointer] Nothing 1 (Special 0) NoId++{- | (put short description here)++ AtsBand [AudioRate] atsbuffer=0 band=0 filePointer=0+-}+atsBand :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+atsBand rate atsbuffer band filePointer = mkUgen Nothing [AudioRate] (Left rate) "AtsBand" [atsbuffer, band, filePointer] Nothing 1 (Special 0) NoId++{- | Use Freq data from a given partial++ AtsFreq [ControlRate,AudioRate] atsbuffer=0 partialNum=0 filePointer=0+-}+atsFreq :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+atsFreq rate atsbuffer partialNum filePointer = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "AtsFreq" [atsbuffer, partialNum, filePointer] Nothing 1 (Special 0) NoId++{- | Resynthesize sine and noise data from an ATS analysis file++ AtsNoiSynth [AudioRate] atsbuffer=0 numPartials=0 partialStart=0 partialSkip=1 filePointer=0 sinePct=1 noisePct=1 freqMul=1 freqAdd=0 numBands=25 bandStart=0 bandSkip=1+-}+atsNoiSynth :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+atsNoiSynth rate atsbuffer numPartials partialStart partialSkip filePointer sinePct noisePct freqMul freqAdd numBands bandStart bandSkip = mkUgen Nothing [AudioRate] (Left rate) "AtsNoiSynth" [atsbuffer, numPartials, partialStart, partialSkip, filePointer, sinePct, noisePct, freqMul, freqAdd, numBands, bandStart, bandSkip] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ AtsNoise [ControlRate,AudioRate] atsbuffer=0 bandNum=0 filePointer=0+-}+atsNoise :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+atsNoise rate atsbuffer bandNum filePointer = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "AtsNoise" [atsbuffer, bandNum, filePointer] Nothing 1 (Special 0) NoId++{- | One Ugen to return both Amp and Freq info++ AtsParInfo [ControlRate,AudioRate] atsbuffer=0 partialNum=0 filePointer=0+-}+atsParInfo :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+atsParInfo rate atsbuffer partialNum filePointer = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "AtsParInfo" [atsbuffer, partialNum, filePointer] Nothing 2 (Special 0) NoId++{- | (Undocumented class)++ AtsPartial [AudioRate] atsbuffer=0 partial=0 filePointer=0 freqMul=1 freqAdd=0+-}+atsPartial :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+atsPartial rate atsbuffer partial filePointer freqMul freqAdd = mkUgen Nothing [AudioRate] (Left rate) "AtsPartial" [atsbuffer, partial, filePointer, freqMul, freqAdd] Nothing 1 (Special 0) NoId++{- | Resynthesize sine data from an ATS analysis file++ AtsSynth [AudioRate] atsbuffer=0 numPartials=0 partialStart=0 partialSkip=1 filePointer=0 freqMul=1 freqAdd=0+-}+atsSynth :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+atsSynth rate atsbuffer numPartials partialStart partialSkip filePointer freqMul freqAdd = mkUgen Nothing [AudioRate] (Left rate) "AtsSynth" [atsbuffer, numPartials, partialStart, partialSkip, filePointer, freqMul, freqAdd] Nothing 1 (Special 0) NoId++{- | Detect onsets and assess the nature of the attack slope++ AttackSlope [ControlRate] input=0 windowsize=1024 peakpicksize=20 leak=0.999 energythreshold=0.01 sumthreshold=20 mingap=30 numslopesaveraged=10+-}+attackSlope :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+attackSlope rate input windowsize peakpicksize leak energythreshold sumthreshold mingap numslopesaveraged = mkUgen Nothing [ControlRate] (Left rate) "AttackSlope" [input, windowsize, peakpicksize, leak, energythreshold, sumthreshold, mingap, numslopesaveraged] Nothing 6 (Special 0) NoId++{- | (Undocumented class)++ AudioMSG [AudioRate] in=0 index=0; FILTER: TRUE+-}+audioMSG :: Ugen -> Ugen -> Ugen+audioMSG in_ index_ = mkUgen Nothing [AudioRate] (Right [0]) "AudioMSG" [in_, index_] Nothing 1 (Special 0) NoId++{- | calculates mean average of audio or control rate signal++ AverageOutput [ControlRate,AudioRate] in=0 trig=0; FILTER: TRUE+-}+averageOutput :: Ugen -> Ugen -> Ugen+averageOutput in_ trig_ = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "AverageOutput" [in_, trig_] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ B2A [AudioRate] w=0 x=0 y=0 z=0+-}+b2a :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+b2a rate w x y z = mkUgen Nothing [AudioRate] (Left rate) "B2A" [w, x, y, z] Nothing 4 (Special 0) NoId++{- | (Undocumented class)++ B2Ster [AudioRate] w=0 x=0 y=0+-}+b2Ster :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+b2Ster rate w x y = mkUgen Nothing [AudioRate] (Left rate) "B2Ster" [w, x, y] Nothing 2 (Special 0) NoId++{- | (Undocumented class)++ B2UHJ [AudioRate] w=0 x=0 y=0+-}+b2uhj :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+b2uhj rate w x y = mkUgen Nothing [AudioRate] (Left rate) "B2UHJ" [w, x, y] Nothing 2 (Special 0) NoId++{- | MultiOut BetaBlocker VChip++ BBlockerBuf [AudioRate] freq=0 bufnum=0 startpoint=0+-}+bBlockerBuf :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+bBlockerBuf rate freq bufnum startpoint = mkUgen Nothing [AudioRate] (Left rate) "BBlockerBuf" [freq, bufnum, startpoint] Nothing 9 (Special 0) NoId++{- | 3D Ambisonic decoder++ BFDecode1 [AudioRate] w=0 x=0 y=0 z=0 azimuth=0 elevation=0 wComp=0+-}+bfDecode1 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+bfDecode1 rate w x y z azimuth elevation wComp = mkUgen Nothing [AudioRate] (Left rate) "BFDecode1" [w, x, y, z, azimuth, elevation, wComp] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ BFDecoder [] maxSize=0+-}+bfDecoder :: Rate -> Ugen -> Ugen+bfDecoder rate maxSize = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate, DemandRate] (Left rate) "BFDecoder" [maxSize] Nothing 1 (Special 0) NoId++{- | Ambisonic B format encoder++ BFEncode1 [AudioRate] in=0 azimuth=0 elevation=0 rho=1 gain=1 wComp=0+-}+bfEncode1 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+bfEncode1 rate in_ azimuth elevation rho gain wComp = mkUgen Nothing [AudioRate] (Left rate) "BFEncode1" [in_, azimuth, elevation, rho, gain, wComp] Nothing 4 (Special 0) NoId++{- | Ambisonic B format encoder++ BFEncode2 [AudioRate] in=0 point_x=1 point_y=1 elevation=0 gain=1 wComp=0+-}+bfEncode2 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+bfEncode2 rate in_ point_x point_y elevation gain wComp = mkUgen Nothing [AudioRate] (Left rate) "BFEncode2" [in_, point_x, point_y, elevation, gain, wComp] Nothing 4 (Special 0) NoId++{- | Ambisonic B format encoder for stereo signals++ BFEncodeSter [AudioRate] l=0 r=0 azimuth=0 width=1.5708 elevation=0 rho=1 gain=1 wComp=0+-}+bfEncodeSter :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+bfEncodeSter rate l r azimuth width elevation rho gain wComp = mkUgen Nothing [AudioRate] (Left rate) "BFEncodeSter" [l, r, azimuth, width, elevation, rho, gain, wComp] Nothing 4 (Special 0) NoId++{- | (Undocumented class)++ BFGrainPanner [] maxSize=0+-}+bfGrainPanner :: Rate -> Ugen -> Ugen+bfGrainPanner rate maxSize = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate, DemandRate] (Left rate) "BFGrainPanner" [maxSize] Nothing 1 (Special 0) NoId++{- | BFormat sound manipulation++ BFManipulate [AudioRate] w=0 x=0 y=0 z=0 rotate=0 tilt=0 tumble=0+-}+bfManipulate :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+bfManipulate rate w x y z rotate_ tilt_ tumble_ = mkUgen Nothing [AudioRate] (Left rate) "BFManipulate" [w, x, y, z, rotate_, tilt_, tumble_] Nothing 4 (Special 0) NoId++{- | (Undocumented class)++ BFPanner [] maxSize=0+-}+bfPanner :: Rate -> Ugen -> Ugen+bfPanner rate maxSize = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate, DemandRate] (Left rate) "BFPanner" [maxSize] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ BLBufRd [ControlRate,AudioRate] bufnum=0 phase=0 ratio=1+-}+blBufRd :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+blBufRd rate bufnum phase ratio = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "BLBufRd" [bufnum, phase, ratio] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ BLOsc [ControlRate,AudioRate] freq=100 pulsewidth=0.5 waveform=0+-}+blOsc :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+blOsc rate freq pulsewidth waveform = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "BLOsc" [freq, pulsewidth, waveform] Nothing 1 (Special 0) NoId++{- | 24db/oct rolloff - 4nd order resonant Low/High/Band Pass Filter++ BMoog [AudioRate] in=0 freq=440 q=0.2 mode=0 saturation=0.95; FILTER: TRUE+-}+bMoog :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+bMoog in_ freq q mode saturation = mkUgen Nothing [AudioRate] (Right [0]) "BMoog" [in_, freq, q, mode, saturation] Nothing 1 (Special 0) NoId++{- | Balances two signals with each other++ Balance [AudioRate] in=0 test=0 hp=10 stor=0+-}+balance :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+balance rate in_ test hp stor = mkUgen Nothing [AudioRate] (Left rate) "Balance" [in_, test, hp, stor] Nothing 1 (Special 0) NoId++{- | Extracts statistics on a beat histogram++ BeatStatistics [ControlRate] fft=0 leak=0.995 numpreviousbeats=4+-}+beatStatistics :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+beatStatistics rate fft_ leak numpreviousbeats = mkUgen Nothing [ControlRate] (Left rate) "BeatStatistics" [fft_, leak, numpreviousbeats] Nothing 4 (Special 0) NoId++{- | Sound Chip Simulator (well...)++ Beep [AudioRate] freq=3250 vol=1+-}+beep :: Rate -> Ugen -> Ugen -> Ugen+beep rate freq vol = mkUgen Nothing [AudioRate] (Left rate) "Beep" [freq, vol] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ BeepU [] maxSize=0+-}+beepU :: Rate -> Ugen -> Ugen+beepU rate maxSize = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate, DemandRate] (Left rate) "BeepU" [maxSize] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ BinData [ControlRate,AudioRate] buffer=0 bin=0 overlaps=0.5+-}+binData :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+binData rate buffer bin overlaps = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "BinData" [buffer, bin, overlaps] Nothing 2 (Special 0) NoId++{- | Band limited impulse generation++ BlitB3 [AudioRate] freq=440+-}+blitB3 :: Rate -> Ugen -> Ugen+blitB3 rate freq = mkUgen Nothing [AudioRate] (Left rate) "BlitB3" [freq] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ BlitB3D [AudioRate] freq=440+-}+blitB3D :: Rate -> Ugen -> Ugen+blitB3D rate freq = mkUgen Nothing [AudioRate] (Left rate) "BlitB3D" [freq] Nothing 1 (Special 0) NoId++{- | BLIT derived sawtooth++ BlitB3Saw [AudioRate] freq=440 leak=0.99+-}+blitB3Saw :: Rate -> Ugen -> Ugen -> Ugen+blitB3Saw rate freq leak = mkUgen Nothing [AudioRate] (Left rate) "BlitB3Saw" [freq, leak] Nothing 1 (Special 0) NoId++{- | Bipolar BLIT derived square waveform++ BlitB3Square [AudioRate] freq=440 leak=0.99+-}+blitB3Square :: Rate -> Ugen -> Ugen -> Ugen+blitB3Square rate freq leak = mkUgen Nothing [AudioRate] (Left rate) "BlitB3Square" [freq, leak] Nothing 1 (Special 0) NoId++{- | Bipolar BLIT derived triangle++ BlitB3Tri [AudioRate] freq=440 leak=0.99 leak2=0.99+-}+blitB3Tri :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+blitB3Tri rate freq leak leak2 = mkUgen Nothing [AudioRate] (Left rate) "BlitB3Tri" [freq, leak, leak2] Nothing 1 (Special 0) NoId++{- | breakcore simulator++ Breakcore [AudioRate] bufnum=0 capturein=0 capturetrigger=0 duration=0.1 ampdropout=0+-}+breakcore :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+breakcore rate bufnum capturein capturetrigger duration ampdropout = mkUgen Nothing [AudioRate] (Left rate) "Breakcore" [bufnum, capturein, capturetrigger, duration, ampdropout] Nothing 1 (Special 0) NoId++{- | Prigogine oscillator++ Brusselator [AudioRate] reset=0 rate=0.01 mu=1 gamma=1 initx=0.5 inity=0.5+-}+brusselator :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+brusselator rate reset rate_ mu gamma initx inity = mkUgen Nothing [AudioRate] (Left rate) "Brusselator" [reset, rate_, mu, gamma, initx, inity] Nothing 2 (Special 0) NoId++{- | Granular synthesis with sound sampled in a buffer++ BufGrain [AudioRate] trigger=0 dur=1 sndbuf=0 rate=1 pos=0 interp=2+-}+bufGrain :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+bufGrain rate trigger dur sndbuf rate_ pos interp = mkUgen Nothing [AudioRate] (Left rate) "BufGrain" [trigger, dur, sndbuf, rate_, pos, interp] Nothing 1 (Special 0) NoId++{- | Granular synthesis with sound sampled in a buffer and user supplied envelope++ BufGrainB [AudioRate] trigger=0 dur=1 sndbuf=0 rate=1 pos=0 envbuf=0 interp=2+-}+bufGrainB :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+bufGrainB rate trigger dur sndbuf rate_ pos envbuf interp = mkUgen Nothing [AudioRate] (Left rate) "BufGrainB" [trigger, dur, sndbuf, rate_, pos, envbuf, interp] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ BufGrainBBF [AudioRate] trigger=0 dur=1 sndbuf=0 rate=1 pos=0 envbuf=0 azimuth=0 elevation=0 rho=1 interp=2 wComp=0+-}+bufGrainBBF :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+bufGrainBBF rate trigger dur sndbuf rate_ pos envbuf azimuth elevation rho interp wComp = mkUgen Nothing [AudioRate] (Left rate) "BufGrainBBF" [trigger, dur, sndbuf, rate_, pos, envbuf, azimuth, elevation, rho, interp, wComp] Nothing 4 (Special 0) NoId++{- | (Undocumented class)++ BufGrainBF [AudioRate] trigger=0 dur=1 sndbuf=0 rate=1 pos=0 azimuth=0 elevation=0 rho=1 interp=2 wComp=0+-}+bufGrainBF :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+bufGrainBF rate trigger dur sndbuf rate_ pos azimuth elevation rho interp wComp = mkUgen Nothing [AudioRate] (Left rate) "BufGrainBF" [trigger, dur, sndbuf, rate_, pos, azimuth, elevation, rho, interp, wComp] Nothing 4 (Special 0) NoId++{- | Granular synthesis with sound sampled in a buffer and user supplied envelopes++ BufGrainI [AudioRate] trigger=0 dur=1 sndbuf=0 rate=1 pos=0 envbuf1=0 envbuf2=0 ifac=0.5 interp=2+-}+bufGrainI :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+bufGrainI rate trigger dur sndbuf rate_ pos envbuf1 envbuf2 ifac interp = mkUgen Nothing [AudioRate] (Left rate) "BufGrainI" [trigger, dur, sndbuf, rate_, pos, envbuf1, envbuf2, ifac, interp] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ BufGrainIBF [AudioRate] trigger=0 dur=1 sndbuf=0 rate=1 pos=0 envbuf1=0 envbuf2=0 ifac=0.5 azimuth=0 elevation=0 rho=1 interp=2 wComp=0+-}+bufGrainIBF :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+bufGrainIBF rate trigger dur sndbuf rate_ pos envbuf1 envbuf2 ifac azimuth elevation rho interp wComp = mkUgen Nothing [AudioRate] (Left rate) "BufGrainIBF" [trigger, dur, sndbuf, rate_, pos, envbuf1, envbuf2, ifac, azimuth, elevation, rho, interp, wComp] Nothing 4 (Special 0) NoId++{- | detect the largest value (and its position) in an array of Ugens++ BufMax [ControlRate] bufnum=0 gate=1+-}+bufMax :: Rate -> Ugen -> Ugen -> Ugen+bufMax rate bufnum gate_ = mkUgen Nothing [ControlRate] (Left rate) "BufMax" [bufnum, gate_] Nothing 2 (Special 0) NoId++{- | detect the largest value (and its position) in an array of Ugens++ BufMin [ControlRate] bufnum=0 gate=1+-}+bufMin :: Rate -> Ugen -> Ugen -> Ugen+bufMin rate bufnum gate_ = mkUgen Nothing [ControlRate] (Left rate) "BufMin" [bufnum, gate_] Nothing 2 (Special 0) NoId++{- | (Undocumented class)++ CQ_Diff [ControlRate] in1=0 in2=0 databufnum=0+-}+cq_Diff :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+cq_Diff rate in1 in2 databufnum = mkUgen Nothing [ControlRate] (Left rate) "CQ_Diff" [in1, in2, databufnum] Nothing 1 (Special 0) NoId++{- | Quefrency analysis and liftering++ Cepstrum [] cepbuf=0 fftchain=0+-}+cepstrum :: Rate -> Ugen -> Ugen -> Ugen+cepstrum rate cepbuf fftchain = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate, DemandRate] (Left rate) "Cepstrum" [cepbuf, fftchain] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ Chen [ControlRate,AudioRate] speed=0.5 a=0.5 b=0.3 c=0.28+-}+chen :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+chen rate speed a b c = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Chen" [speed, a, b, c] Nothing 3 (Special 0) NoId++{- | Octave chroma band based representation of energy in a signal; Chromagram for nTET tuning systems with any base reference++ Chromagram [ControlRate] fft=0 fftsize=2048 n=12 tuningbase=32.7032 octaves=8 integrationflag=0 coeff=0.9 octaveratio=2 perframenormalize=0+-}+chromagram :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+chromagram rate fft_ fftsize n tuningbase octaves integrationflag coeff octaveratio perframenormalize = mkUgen Nothing [ControlRate] (Left rate) "Chromagram" [fft_, fftsize, n, tuningbase, octaves, integrationflag, coeff, octaveratio, perframenormalize] Nothing 12 (Special 0) NoId++{- | circular linear lag++ CircleRamp [ControlRate,AudioRate] in=0 lagTime=0.1 circmin=-180 circmax=180+-}+circleRamp :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+circleRamp rate in_ lagTime circmin circmax = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "CircleRamp" [in_, lagTime, circmin, circmax] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ Clipper32 [AudioRate] in=0 lo=-0.8 hi=0.8+-}+clipper32 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+clipper32 rate in_ lo hi = mkUgen Nothing [AudioRate] (Left rate) "Clipper32" [in_, lo, hi] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ Clipper4 [AudioRate] in=0 lo=-0.8 hi=0.8+-}+clipper4 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+clipper4 rate in_ lo hi = mkUgen Nothing [AudioRate] (Left rate) "Clipper4" [in_, lo, hi] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ Clipper8 [AudioRate] in=0 lo=-0.8 hi=0.8+-}+clipper8 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+clipper8 rate in_ lo hi = mkUgen Nothing [AudioRate] (Left rate) "Clipper8" [in_, lo, hi] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ Clockmus [ControlRate]+-}+clockmus :: Rate -> Ugen+clockmus rate = mkUgen Nothing [ControlRate] (Left rate) "Clockmus" [] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ CombLP [AudioRate] in=0 gate=1 maxdelaytime=0.2 delaytime=0.2 decaytime=1 coef=0.5+-}+combLP :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+combLP rate in_ gate_ maxdelaytime delaytime decaytime coef = mkUgen Nothing [AudioRate] (Left rate) "CombLP" [in_, gate_, maxdelaytime, delaytime, decaytime, coef] Nothing 1 (Special 0) NoId++{- | FM-modulable resonating filter++ ComplexRes [AudioRate] in=0 freq=100 decay=0.2; FILTER: TRUE+-}+complexRes :: Ugen -> Ugen -> Ugen -> Ugen+complexRes in_ freq decay_ = mkUgen Nothing [AudioRate] (Right [0]) "ComplexRes" [in_, freq, decay_] Nothing 1 (Special 0) NoId++{- | Concatenative Cross-Synthesis on Live Streams++ Concat [AudioRate] control=0 source=0 storesize=1 seektime=1 seekdur=1 matchlength=0.05 freezestore=0 zcr=1 lms=1 sc=1 st=0 randscore=0+-}+concat :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+concat rate control_ source storesize seektime seekdur matchlength freezestore zcr lms sc st randscore = mkUgen Nothing [AudioRate] (Left rate) "Concat" [control_, source, storesize, seektime, seekdur, matchlength, freezestore, zcr, lms, sc, st, randscore] Nothing 1 (Special 0) NoId++{- | Concatenative Cross-Synthesis on Live Streams++ Concat2 [AudioRate] control=0 source=0 storesize=1 seektime=1 seekdur=1 matchlength=0.05 freezestore=0 zcr=1 lms=1 sc=1 st=0 randscore=0 threshold=0.01+-}+concat2 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+concat2 rate control_ source storesize seektime seekdur matchlength freezestore zcr lms sc st randscore threshold = mkUgen Nothing [AudioRate] (Left rate) "Concat2" [control_, source, storesize, seektime, seekdur, matchlength, freezestore, zcr, lms, sc, st, randscore, threshold] Nothing 1 (Special 0) NoId++{- | an amplitude tracking based onset detector++ Coyote [ControlRate] in=0 trackFall=0.2 slowLag=0.2 fastLag=0.01 fastMul=0.5 thresh=0.05 minDur=0.1+-}+coyote :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+coyote rate in_ trackFall slowLag fastLag fastMul thresh minDur = mkUgen Nothing [ControlRate] (Left rate) "Coyote" [in_, trackFall, slowLag, fastLag, fastMul, thresh, minDur] Nothing 1 (Special 0) NoId++{- | Measure the temporal crest factor of a signal++ Crest [ControlRate] in=0 numsamps=400 gate=1+-}+crest :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+crest rate in_ numsamps gate_ = mkUgen Nothing [ControlRate] (Left rate) "Crest" [in_, numsamps, gate_] Nothing 1 (Special 0) NoId++{- | class B/AB power amp distortion simulation++ CrossoverDistortion [AudioRate] in=0 amp=0.5 smooth=0.5; FILTER: TRUE+-}+crossoverDistortion :: Ugen -> Ugen -> Ugen -> Ugen+crossoverDistortion in_ amp smooth = mkUgen Nothing [AudioRate] (Right [0]) "CrossoverDistortion" [in_, amp, smooth] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ DCompressor [AudioRate] input=0 sidechainIn=0 sidechain=0 ratio=4 threshold=-40 attack=0.1 release=100.1 makeup=0.5 automakeup=1; FILTER: TRUE+-}+dCompressor :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dCompressor input sidechainIn sidechain ratio threshold attack release makeup automakeup = mkUgen Nothing [AudioRate] (Right [0]) "DCompressor" [input, sidechainIn, sidechain, ratio, threshold, attack, release, makeup, automakeup] Nothing 1 (Special 0) NoId++{- | Digitally modelled analog filter++ DFM1 [AudioRate] in=0 freq=1000 res=0.1 inputgain=1 type=0 noiselevel=0.0003; FILTER: TRUE+-}+dfm1 :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dfm1 in_ freq res inputgain type_ noiselevel = mkUgen Nothing [AudioRate] (Right [0]) "DFM1" [in_, freq, res, inputgain, type_, noiselevel] Nothing 1 (Special 0) NoId++{- | Demand rate implementation of a Wiard noise ring++ DNoiseRing [DemandRate] change=0.5 chance=0.5 shift=1 numBits=8 resetval=0; DEMAND/NONDET+-}+dNoiseRingId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dNoiseRingId z change chance shift numBits resetval = mkUgen Nothing [DemandRate] (Left DemandRate) "DNoiseRing" [change, chance, shift, numBits, resetval] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of DNoiseRing.+dNoiseRingM :: Uid m => Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> m Ugen+dNoiseRingM = liftUid5 dNoiseRingId++-- | Unsafe variant of DNoiseRing.+dNoiseRing :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dNoiseRing = liftUnsafe5 dNoiseRingM++{- | Triangle via 3rd order differerentiated polynomial waveform++ DPW3Tri [AudioRate] freq=440+-}+dpw3Tri :: Rate -> Ugen -> Ugen+dpw3Tri rate freq = mkUgen Nothing [AudioRate] (Left rate) "DPW3Tri" [freq] Nothing 1 (Special 0) NoId++{- | Sawtooth via 4th order differerentiated polynomial waveform++ DPW4Saw [AudioRate] freq=440+-}+dpw4Saw :: Rate -> Ugen -> Ugen+dpw4Saw rate freq = mkUgen Nothing [AudioRate] (Left rate) "DPW4Saw" [freq] Nothing 1 (Special 0) NoId++{- | Plucked physical model.++ DWGBowed [AudioRate] freq=440 velb=0.5 force=1 gate=1 pos=0.14 release=0.1 c1=1 c3=3 impZ=0.55 fB=2+-}+dwgBowed :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dwgBowed rate freq velb force gate_ pos release c1 c3 impZ fB = mkUgen Nothing [AudioRate] (Left rate) "DWGBowed" [freq, velb, force, gate_, pos, release, c1, c3, impZ, fB] Nothing 1 (Special 0) NoId++{- | Plucked physical model.++ DWGBowedSimple [AudioRate] freq=440 velb=0.5 force=1 gate=1 pos=0.14 release=0.1 c1=1 c3=30+-}+dwgBowedSimple :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dwgBowedSimple rate freq velb force gate_ pos release c1 c3 = mkUgen Nothing [AudioRate] (Left rate) "DWGBowedSimple" [freq, velb, force, gate_, pos, release, c1, c3] Nothing 1 (Special 0) NoId++{- | Plucked physical model.++ DWGBowedTor [AudioRate] freq=440 velb=0.5 force=1 gate=1 pos=0.14 release=0.1 c1=1 c3=3 impZ=0.55 fB=2 mistune=5.2 c1tor=1 c3tor=3000 iZtor=1.8+-}+dwgBowedTor :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dwgBowedTor rate freq velb force gate_ pos release c1 c3 impZ fB mistune c1tor c3tor iZtor = mkUgen Nothing [AudioRate] (Left rate) "DWGBowedTor" [freq, velb, force, gate_, pos, release, c1, c3, impZ, fB, mistune, c1tor, c3tor, iZtor] Nothing 1 (Special 0) NoId++{- | Clarinet physical model.++ DWGClarinet3 [AudioRate] freq=440.0 pm=1.0 pc=1.0 m=0.8 gate=1.0 release=1.0e-2 c1=0.25 c3=7.0+-}+dwgClarinet3 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dwgClarinet3 rate freq pm pc m gate_ release c1 c3 = mkUgen Nothing [AudioRate] (Left rate) "DWGClarinet3" [freq, pm, pc, m, gate_, release, c1, c3] Nothing 1 (Special 0) NoId++{- | Reimplementation of STK flute model.++ DWGFlute [AudioRate] freq=400.0 pm=1.0 endr=0.5 jetr=0.25 jetRa=0.33 gate=1.0 release=0.1+-}+dwgFlute :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dwgFlute rate freq pm endr jetr jetRa gate_ release = mkUgen Nothing [AudioRate] (Left rate) "DWGFlute" [freq, pm, endr, jetr, jetRa, gate_, release] Nothing 1 (Special 0) NoId++{- | Plucked physical model.++ DWGPlucked [AudioRate] freq=440 amp=0.5 gate=1 pos=0.14 c1=1 c3=30 inp=0 release=0.1+-}+dwgPlucked :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dwgPlucked rate freq amp gate_ pos c1 c3 inp release = mkUgen Nothing [AudioRate] (Left rate) "DWGPlucked" [freq, amp, gate_, pos, c1, c3, inp, release] Nothing 1 (Special 0) NoId++{- | Plucked physical model.++ DWGPlucked2 [AudioRate] freq=440 amp=0.5 gate=1 pos=0.14 c1=1 c3=30 inp=0 release=0.1 mistune=1.008 mp=0.55 gc=0.01+-}+dwgPlucked2 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dwgPlucked2 rate freq amp gate_ pos c1 c3 inp release mistune mp gc = mkUgen Nothing [AudioRate] (Left rate) "DWGPlucked2" [freq, amp, gate_, pos, c1, c3, inp, release, mistune, mp, gc] Nothing 1 (Special 0) NoId++{- | Plucked physical model.++ DWGPluckedStiff [AudioRate] freq=440 amp=0.5 gate=1 pos=0.14 c1=1 c3=30 inp=0 release=0.1 fB=2+-}+dwgPluckedStiff :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dwgPluckedStiff rate freq amp gate_ pos c1 c3 inp release fB = mkUgen Nothing [AudioRate] (Left rate) "DWGPluckedStiff" [freq, amp, gate_, pos, c1, c3, inp, release, fB] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ DWGSoundBoard [AudioRate] inp=0 c1=20 c3=20 mix=0.8 d1=199 d2=211 d3=223 d4=227 d5=229 d6=233 d7=239 d8=241; FILTER: TRUE+-}+dwgSoundBoard :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dwgSoundBoard inp c1 c3 mix d1 d2 d3 d4 d5 d6 d7 d8 = mkUgen Nothing [AudioRate] (Right [0]) "DWGSoundBoard" [inp, c1, c3, mix, d1, d2, d3, d4, d5, d6, d7, d8] Nothing 1 (Special 0) NoId++{- | demand rate brownian movement with Gendyn distributions++ Dbrown2 [] lo=0 hi=0 step=0 dist=0 length=100000000+-}+dbrown2 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dbrown2 rate lo hi step dist length_ = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate, DemandRate] (Left rate) "Dbrown2" [lo, hi, step, dist, length_] Nothing 1 (Special 0) NoId++{- | demand rate tag system on a buffer++ DbufTag [DemandRate] bufnum=0 v=0 axiom=0 rules=0 recycle=0 mode=0; DEMAND/NONDET+-}+dbufTagId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dbufTagId z bufnum v axiom rules recycle mode = mkUgen Nothing [DemandRate] (Left DemandRate) "DbufTag" [bufnum, v, axiom, rules, recycle, mode] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of DbufTag.+dbufTagM :: Uid m => Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> m Ugen+dbufTagM = liftUid6 dbufTagId++-- | Unsafe variant of DbufTag.+dbufTag :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dbufTag = liftUnsafe6 dbufTagM++{- | Samplerate and bitrate reduction++ Decimator [AudioRate] in=0 rate=44100 bits=24+-}+decimator :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+decimator rate in_ rate_ bits = mkUgen Nothing [AudioRate] (Left rate) "Decimator" [in_, rate_, bits] Nothing 1 (Special 0) NoId++{- | Demand version of the BetaBlocker VChip++ DetaBlockerBuf [DemandRate] bufnum=0 startpoint=0; DEMAND/NONDET+-}+detaBlockerBufId :: ID a => a -> Ugen -> Ugen -> Ugen+detaBlockerBufId z bufnum startpoint = mkUgen Nothing [DemandRate] (Left DemandRate) "DetaBlockerBuf" [bufnum, startpoint] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of DetaBlockerBuf.+detaBlockerBufM :: Uid m => Ugen -> Ugen -> m Ugen+detaBlockerBufM = liftUid2 detaBlockerBufId++-- | Unsafe variant of DetaBlockerBuf.+detaBlockerBuf :: Ugen -> Ugen -> Ugen+detaBlockerBuf = liftUnsafe2 detaBlockerBufM++{- | demand rate finite state machine++ Dfsm [DemandRate] rules=0 n=1 rgen=0; DEMAND/NONDET+-}+dfsmId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen+dfsmId z rules n rgen = mkUgen Nothing [DemandRate] (Left DemandRate) "Dfsm" [rules, n, rgen] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of Dfsm.+dfsmM :: Uid m => Ugen -> Ugen -> Ugen -> m Ugen+dfsmM = liftUid3 dfsmId++-- | Unsafe variant of Dfsm.+dfsm :: Ugen -> Ugen -> Ugen -> Ugen+dfsm = liftUnsafe3 dfsmM++{- | (Undocumented class)++ Dgauss [] lo=0 hi=0 length=100000000+-}+dgauss :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+dgauss rate lo hi length_ = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate, DemandRate] (Left rate) "Dgauss" [lo, hi, length_] Nothing 1 (Special 0) NoId++{- | Ring modulation based on the physical model of a diode.++ DiodeRingMod [AudioRate] car=0 mod=0; FILTER: TRUE+-}+diodeRingMod :: Ugen -> Ugen -> Ugen+diodeRingMod car mod_ = mkUgen Nothing [AudioRate] (Right [0]) "DiodeRingMod" [car, mod_] Nothing 1 (Special 0) NoId++{- | port of some ladspa plugins++ Disintegrator [AudioRate] in=0 probability=0.5 multiplier=0; FILTER: TRUE, NONDET+-}+disintegratorId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen+disintegratorId z in_ probability multiplier = mkUgen Nothing [AudioRate] (Right [0]) "Disintegrator" [in_, probability, multiplier] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of Disintegrator.+disintegratorM :: Uid m => Ugen -> Ugen -> Ugen -> m Ugen+disintegratorM = liftUid3 disintegratorId++-- | Unsafe variant of Disintegrator.+disintegrator :: Ugen -> Ugen -> Ugen -> Ugen+disintegrator = liftUnsafe3 disintegratorM++{- | discrete time neurodynamics++ Dneuromodule [ControlRate,AudioRate,DemandRate] dt=0 *theta=0 *x=0 *weights=0; MCE=3, NC INPUT: True, NONDET+-}+dneuromoduleId :: ID a => Int -> a -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dneuromoduleId numChannels z dt theta x weights = mkUgen Nothing [ControlRate, AudioRate, DemandRate] (Left DemandRate) "Dneuromodule" [dt] (Just [theta, x, weights]) numChannels (Special 0) (toUid z)++-- | Monad variant of Dneuromodule.+dneuromoduleM :: Uid m => Int -> Ugen -> Ugen -> Ugen -> Ugen -> m Ugen+dneuromoduleM = liftUid5 dneuromoduleId++-- | Unsafe variant of Dneuromodule.+dneuromodule :: Int -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dneuromodule = liftUnsafe5 dneuromoduleM++{- | Nested Allpass filters as proposed by Vercoe and Pluckett++ DoubleNestedAllpassC [AudioRate] in=0 maxdelay1=0.0047 delay1=0.0047 gain1=0.15 maxdelay2=0.022 delay2=0.022 gain2=0.25 maxdelay3=0.0083 delay3=0.0083 gain3=0.3; FILTER: TRUE+-}+doubleNestedAllpassC :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+doubleNestedAllpassC in_ maxdelay1 delay1_ gain1 maxdelay2 delay2_ gain2 maxdelay3 delay3 gain3 = mkUgen Nothing [AudioRate] (Right [0]) "DoubleNestedAllpassC" [in_, maxdelay1, delay1_, gain1, maxdelay2, delay2_, gain2, maxdelay3, delay3, gain3] Nothing 1 (Special 0) NoId++{- | Nested Allpass filters as proposed by Vercoe and Pluckett++ DoubleNestedAllpassL [AudioRate] in=0 maxdelay1=0.0047 delay1=0.0047 gain1=0.15 maxdelay2=0.022 delay2=0.022 gain2=0.25 maxdelay3=0.0083 delay3=0.0083 gain3=0.3; FILTER: TRUE+-}+doubleNestedAllpassL :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+doubleNestedAllpassL in_ maxdelay1 delay1_ gain1 maxdelay2 delay2_ gain2 maxdelay3 delay3 gain3 = mkUgen Nothing [AudioRate] (Right [0]) "DoubleNestedAllpassL" [in_, maxdelay1, delay1_, gain1, maxdelay2, delay2_, gain2, maxdelay3, delay3, gain3] Nothing 1 (Special 0) NoId++{- | Nested Allpass filters as proposed by Vercoe and Pluckett++ DoubleNestedAllpassN [AudioRate] in=0 maxdelay1=0.0047 delay1=0.0047 gain1=0.15 maxdelay2=0.022 delay2=0.022 gain2=0.25 maxdelay3=0.0083 delay3=0.0083 gain3=0.3; FILTER: TRUE+-}+doubleNestedAllpassN :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+doubleNestedAllpassN in_ maxdelay1 delay1_ gain1 maxdelay2 delay2_ gain2 maxdelay3 delay3 gain3 = mkUgen Nothing [AudioRate] (Right [0]) "DoubleNestedAllpassN" [in_, maxdelay1, delay1_, gain1, maxdelay2, delay2_, gain2, maxdelay3, delay3, gain3] Nothing 1 (Special 0) NoId++{- | Forced DoubleWell Oscillator++ DoubleWell [AudioRate] reset=0 ratex=0.01 ratey=0.01 f=1 w=0.001 delta=1 initx=0 inity=0+-}+doubleWell :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+doubleWell rate reset ratex ratey f w delta initx inity = mkUgen Nothing [AudioRate] (Left rate) "DoubleWell" [reset, ratex, ratey, f, w, delta, initx, inity] Nothing 1 (Special 0) NoId++{- | Forced DoubleWell Oscillator++ DoubleWell2 [AudioRate] reset=0 ratex=0.01 ratey=0.01 f=1 w=0.001 delta=1 initx=0 inity=0+-}+doubleWell2 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+doubleWell2 rate reset ratex ratey f w delta initx inity = mkUgen Nothing [AudioRate] (Left rate) "DoubleWell2" [reset, ratex, ratey, f, w, delta, initx, inity] Nothing 1 (Special 0) NoId++{- | Forced DoubleWell Oscillator++ DoubleWell3 [AudioRate] reset=0 rate=0.01 f=0 delta=0.25 initx=0 inity=0+-}+doubleWell3 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+doubleWell3 rate reset rate_ f delta initx inity = mkUgen Nothing [AudioRate] (Left rate) "DoubleWell3" [reset, rate_, f, delta, initx, inity] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ DriveNoise [AudioRate] in=0 amount=1 multi=5+-}+driveNoise :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+driveNoise rate in_ amount multi = mkUgen Nothing [AudioRate] (Left rate) "DriveNoise" [in_, amount, multi] Nothing 1 (Special 0) NoId++{- | Crosscorrelation search and drum pattern matching beat tracker++ DrumTrack [ControlRate] in=0 lock=0 dynleak=0 tempowt=0 phasewt=0 basswt=0 patternwt=1 prior=0 kicksensitivity=1 snaresensitivity=1 debugmode=0+-}+drumTrack :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+drumTrack rate in_ lock dynleak tempowt phasewt basswt patternwt prior kicksensitivity snaresensitivity debugmode = mkUgen Nothing [ControlRate] (Left rate) "DrumTrack" [in_, lock, dynleak, tempowt, phasewt, basswt, patternwt, prior, kicksensitivity, snaresensitivity, debugmode] Nothing 4 (Special 0) NoId++{- | demand rate tag system++ Dtag [] bufsize=0 v=0 axiom=0 rules=0 recycle=0 mode=0+-}+dtag :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dtag rate bufsize v axiom rules recycle mode = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate, DemandRate] (Left rate) "Dtag" [bufsize, v, axiom, rules, recycle, mode] Nothing 1 (Special 0) NoId++{- | Envelope Follower Filter++ EnvDetect [AudioRate] in=0 attack=100 release=0+-}+envDetect :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+envDetect rate in_ attack release = mkUgen Nothing [AudioRate] (Left rate) "EnvDetect" [in_, attack, release] Nothing 1 (Special 0) NoId++{- | Envelope Follower++ EnvFollow [ControlRate,AudioRate] input=0 decaycoeff=0.99+-}+envFollow :: Rate -> Ugen -> Ugen -> Ugen+envFollow rate input decaycoeff = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "EnvFollow" [input, decaycoeff] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ FFTComplexDev [ControlRate] buffer=0 rectify=0 powthresh=0.1+-}+fftComplexDev :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+fftComplexDev rate buffer rectify powthresh = mkUgen Nothing [ControlRate] (Left rate) "FFTComplexDev" [buffer, rectify, powthresh] Nothing 1 (Special 0) NoId++{- | Spectral crest measure++ FFTCrest [ControlRate] buffer=0 freqlo=0 freqhi=50000+-}+fftCrest :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+fftCrest rate buffer freqlo freqhi = mkUgen Nothing [ControlRate] (Left rate) "FFTCrest" [buffer, freqlo, freqhi] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ FFTDiffMags [ControlRate] bufferA=0 bufferB=0+-}+fftDiffMags :: Rate -> Ugen -> Ugen -> Ugen+fftDiffMags rate bufferA bufferB = mkUgen Nothing [ControlRate] (Left rate) "FFTDiffMags" [bufferA, bufferB] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ FFTFlux [ControlRate] buffer=0 normalise=1+-}+fftFlux :: Rate -> Ugen -> Ugen -> Ugen+fftFlux rate buffer normalise = mkUgen Nothing [ControlRate] (Left rate) "FFTFlux" [buffer, normalise] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ FFTFluxPos [ControlRate] buffer=0 normalise=1+-}+fftFluxPos :: Rate -> Ugen -> Ugen -> Ugen+fftFluxPos rate buffer normalise = mkUgen Nothing [ControlRate] (Left rate) "FFTFluxPos" [buffer, normalise] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ FFTMKL [ControlRate] buffer=0 epsilon=0.0+-}+fftmkl :: Rate -> Ugen -> Ugen -> Ugen+fftmkl rate buffer epsilon = mkUgen Nothing [ControlRate] (Left rate) "FFTMKL" [buffer, epsilon] Nothing 1 (Special 0) NoId++{- | Find peak value in an FFT frame++ FFTPeak [ControlRate] buffer=0 freqlo=0 freqhi=50000+-}+fftPeak :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+fftPeak rate buffer freqlo freqhi = mkUgen Nothing [ControlRate] (Left rate) "FFTPeak" [buffer, freqlo, freqhi] Nothing 2 (Special 0) NoId++{- | (Undocumented class)++ FFTPhaseDev [ControlRate] buffer=0 weight=0 powthresh=0.1+-}+fftPhaseDev :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+fftPhaseDev rate buffer weight powthresh = mkUgen Nothing [ControlRate] (Left rate) "FFTPhaseDev" [buffer, weight, powthresh] Nothing 1 (Special 0) NoId++{- | Instantaneous spectral power++ FFTPower [ControlRate] buffer=0 square=1+-}+fftPower :: Rate -> Ugen -> Ugen -> Ugen+fftPower rate buffer square = mkUgen Nothing [ControlRate] (Left rate) "FFTPower" [buffer, square] Nothing 1 (Special 0) NoId++{- | Spectral slope++ FFTSlope [ControlRate] buffer=0+-}+fftSlope :: Rate -> Ugen -> Ugen+fftSlope rate buffer = mkUgen Nothing [ControlRate] (Left rate) "FFTSlope" [buffer] Nothing 1 (Special 0) NoId++{- | Spectral spread++ FFTSpread [ControlRate] buffer=0 centroid=0+-}+fftSpread :: Rate -> Ugen -> Ugen -> Ugen+fftSpread rate buffer centroid = mkUgen Nothing [ControlRate] (Left rate) "FFTSpread" [buffer, centroid] Nothing 1 (Special 0) NoId++{- | Spectral flatness, divided into subbands++ FFTSubbandFlatness [ControlRate] chain=0 cutfreqs=0+-}+fftSubbandFlatness :: Rate -> Ugen -> Ugen -> Ugen+fftSubbandFlatness rate chain cutfreqs = mkUgen Nothing [ControlRate] (Left rate) "FFTSubbandFlatness" [chain, cutfreqs] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ FFTSubbandFlux [ControlRate] chain=0 cutfreqs=0 posonly=0+-}+fftSubbandFlux :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+fftSubbandFlux rate chain cutfreqs posonly = mkUgen Nothing [ControlRate] (Left rate) "FFTSubbandFlux" [chain, cutfreqs, posonly] Nothing 1 (Special 0) NoId++{- | Spectral power, divided into subbands++ FFTSubbandPower [ControlRate] chain=0 cutfreqs=0 square=1 scalemode=1+-}+fftSubbandPower :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fftSubbandPower rate chain cutfreqs square scalemode = mkUgen Nothing [ControlRate] (Left rate) "FFTSubbandPower" [chain, cutfreqs, square, scalemode] Nothing 1 (Special 0) NoId++{- | Phase modulation oscillator matrix.++ FM7 [AudioRate] *ctlMatrix=0 *modMatrix=0; MCE=2+-}+fm7 :: Rate -> Ugen -> Ugen -> Ugen+fm7 rate ctlMatrix modMatrix = mkUgen Nothing [AudioRate] (Left rate) "FM7" [] (Just [ctlMatrix, modMatrix]) 6 (Special 0) NoId++{- | Granular synthesis with FM grains++ FMGrain [AudioRate] trigger=0 dur=1 carfreq=440 modfreq=200 index=1; FILTER: TRUE+-}+fmGrain :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fmGrain trigger dur carfreq modfreq index_ = mkUgen Nothing [AudioRate] (Right [0]) "FMGrain" [trigger, dur, carfreq, modfreq, index_] Nothing 1 (Special 0) NoId++{- | Granular synthesis with FM grains and user supplied envelope++ FMGrainB [AudioRate] trigger=0 dur=1 carfreq=440 modfreq=200 index=1 envbuf=0; FILTER: TRUE+-}+fmGrainB :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fmGrainB trigger dur carfreq modfreq index_ envbuf = mkUgen Nothing [AudioRate] (Right [0]) "FMGrainB" [trigger, dur, carfreq, modfreq, index_, envbuf] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ FMGrainBBF [AudioRate] trigger=0 dur=1 carfreq=440 modfreq=200 index=1 envbuf=0 azimuth=0 elevation=0 rho=1 wComp=0+-}+fmGrainBBF :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fmGrainBBF rate trigger dur carfreq modfreq index_ envbuf azimuth elevation rho wComp = mkUgen Nothing [AudioRate] (Left rate) "FMGrainBBF" [trigger, dur, carfreq, modfreq, index_, envbuf, azimuth, elevation, rho, wComp] Nothing 4 (Special 0) NoId++{- | (Undocumented class)++ FMGrainBF [AudioRate] trigger=0 dur=1 carfreq=440 modfreq=200 index=1 azimuth=0 elevation=0 rho=1 wComp=0+-}+fmGrainBF :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fmGrainBF rate trigger dur carfreq modfreq index_ azimuth elevation rho wComp = mkUgen Nothing [AudioRate] (Left rate) "FMGrainBF" [trigger, dur, carfreq, modfreq, index_, azimuth, elevation, rho, wComp] Nothing 4 (Special 0) NoId++{- | Granular synthesis with FM grains and user supplied envelopes++ FMGrainI [AudioRate] trigger=0 dur=1 carfreq=440 modfreq=200 index=1 envbuf1=0 envbuf2=0 ifac=0.5+-}+fmGrainI :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fmGrainI rate trigger dur carfreq modfreq index_ envbuf1 envbuf2 ifac = mkUgen Nothing [AudioRate] (Left rate) "FMGrainI" [trigger, dur, carfreq, modfreq, index_, envbuf1, envbuf2, ifac] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ FMGrainIBF [AudioRate] trigger=0 dur=1 carfreq=440 modfreq=200 index=1 envbuf1=0 envbuf2=0 ifac=0.5 azimuth=0 elevation=0 rho=1 wComp=0+-}+fmGrainIBF :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fmGrainIBF rate trigger dur carfreq modfreq index_ envbuf1 envbuf2 ifac azimuth elevation rho wComp = mkUgen Nothing [AudioRate] (Left rate) "FMGrainIBF" [trigger, dur, carfreq, modfreq, index_, envbuf1, envbuf2, ifac, azimuth, elevation, rho, wComp] Nothing 4 (Special 0) NoId++{- | Decode an FMH signal for a specific speaker++ FMHDecode1 [AudioRate] w=0 x=0 y=0 z=0 r=0 s=0 t=0 u=0 v=0 azimuth=0 elevation=0+-}+fmhDecode1 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fmhDecode1 rate w x y z r s t u v azimuth elevation = mkUgen Nothing [AudioRate] (Left rate) "FMHDecode1" [w, x, y, z, r, s, t, u, v, azimuth, elevation] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ FMHEncode0 [AudioRate] in=0 azimuth=0 elevation=0 gain=1+-}+fmhEncode0 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fmhEncode0 rate in_ azimuth elevation gain = mkUgen Nothing [AudioRate] (Left rate) "FMHEncode0" [in_, azimuth, elevation, gain] Nothing 9 (Special 0) NoId++{- | Second Order Ambisonic encoder++ FMHEncode1 [AudioRate] in=0 azimuth=0 elevation=0 rho=1 gain=1 wComp=0+-}+fmhEncode1 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fmhEncode1 rate in_ azimuth elevation rho gain wComp = mkUgen Nothing [AudioRate] (Left rate) "FMHEncode1" [in_, azimuth, elevation, rho, gain, wComp] Nothing 9 (Special 0) NoId++{- | Second Order Ambisonic encoder++ FMHEncode2 [AudioRate] in=0 point_x=0 point_y=0 elevation=0 gain=1 wComp=0+-}+fmhEncode2 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fmhEncode2 rate in_ point_x point_y elevation gain wComp = mkUgen Nothing [AudioRate] (Left rate) "FMHEncode2" [in_, point_x, point_y, elevation, gain, wComp] Nothing 9 (Special 0) NoId++{- | Storing feature data from Ugens in NRT mode++ FeatureSave [ControlRate] features=0 trig=0+-}+featureSave :: Rate -> Ugen -> Ugen -> Ugen+featureSave rate features trig_ = mkUgen Nothing [ControlRate] (Left rate) "FeatureSave" [features, trig_] Nothing 1 (Special 0) NoId++{- | FitzHughNagumo Neuron Firing Oscillator++ Fhn2DC [ControlRate,AudioRate] minfreq=11025 maxfreq=22050 urate=0.1 wrate=0.1 b0=0.6 b1=0.8 i=0 u0=0 w0=0+-}+fhn2DC :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fhn2DC rate minfreq maxfreq urate wrate b0 b1 i u0 w0 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Fhn2DC" [minfreq, maxfreq, urate, wrate, b0, b1, i, u0, w0] Nothing 1 (Special 0) NoId++{- | FitzHughNagumo Neuron Firing Oscillator++ Fhn2DL [ControlRate,AudioRate] minfreq=11025 maxfreq=22050 urate=0.1 wrate=0.1 b0=0.6 b1=0.8 i=0 u0=0 w0=0+-}+fhn2DL :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fhn2DL rate minfreq maxfreq urate wrate b0 b1 i u0 w0 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Fhn2DL" [minfreq, maxfreq, urate, wrate, b0, b1, i, u0, w0] Nothing 1 (Special 0) NoId++{- | FitzHughNagumo Neuron Firing Oscillator++ Fhn2DN [ControlRate,AudioRate] minfreq=11025 maxfreq=22050 urate=0.1 wrate=0.1 b0=0.6 b1=0.8 i=0 u0=0 w0=0+-}+fhn2DN :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fhn2DN rate minfreq maxfreq urate wrate b0 b1 i u0 w0 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Fhn2DN" [minfreq, maxfreq, urate, wrate, b0, b1, i, u0, w0] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ FhnTrig [ControlRate,AudioRate] minfreq=4 maxfreq=10 urate=0.1 wrate=0.1 b0=0.6 b1=0.8 i=0 u0=0 w0=0+-}+fhnTrig :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fhnTrig rate minfreq maxfreq urate wrate b0 b1 i u0 w0 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "FhnTrig" [minfreq, maxfreq, urate, wrate, b0, b1, i, u0, w0] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ FincoSprottL [AudioRate] freq=22050 a=2.45 h=0.05 xi=0 yi=0 zi=0+-}+fincoSprottL :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fincoSprottL rate freq a h xi yi zi = mkUgen Nothing [AudioRate] (Left rate) "FincoSprottL" [freq, a, h, xi, yi, zi] Nothing 3 (Special 0) NoId++{- | (Undocumented class)++ FincoSprottM [AudioRate] freq=22050 a=-7 b=4 h=0.05 xi=0 yi=0 zi=0+-}+fincoSprottM :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fincoSprottM rate freq a b h xi yi zi = mkUgen Nothing [AudioRate] (Left rate) "FincoSprottM" [freq, a, b, h, xi, yi, zi] Nothing 3 (Special 0) NoId++{- | (Undocumented class)++ FincoSprottS [AudioRate] freq=22050 a=8 b=2 h=0.05 xi=0 yi=0 zi=0+-}+fincoSprottS :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fincoSprottS rate freq a b h xi yi zi = mkUgen Nothing [AudioRate] (Left rate) "FincoSprottS" [freq, a, b, h, xi, yi, zi] Nothing 3 (Special 0) NoId++{- | Neuron Firing Model Oscillator++ FitzHughNagumo [AudioRate] reset=0 rateu=0.01 ratew=0.01 b0=1 b1=1 initu=0 initw=0+-}+fitzHughNagumo :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+fitzHughNagumo rate reset rateu ratew b0 b1 initu initw = mkUgen Nothing [AudioRate] (Left rate) "FitzHughNagumo" [reset, rateu, ratew, b0, b1, initu, initw] Nothing 1 (Special 0) NoId++{- | calculates spectral MSE distance of two fft chains++ FrameCompare [ControlRate] buffer1=0 buffer2=0 wAmount=0.5+-}+frameCompare :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+frameCompare rate buffer1 buffer2 wAmount = mkUgen Nothing [ControlRate] (Left rate) "FrameCompare" [buffer1, buffer2, wAmount] Nothing 1 (Special 0) NoId++{- | A physical model of a system with dry-friction. A chaotic filter.++ Friction [ControlRate,AudioRate] in=0 friction=0.5 spring=0.414 damp=0.313 mass=0.1 beltmass=1+-}+friction :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+friction rate in_ friction_ spring_ damp mass beltmass = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Friction" [in_, friction_, spring_, damp, mass, beltmass] Nothing 1 (Special 0) NoId++{- | Single gammatone filter++ Gammatone [AudioRate] input=0 centrefrequency=440 bandwidth=200; FILTER: TRUE+-}+gammatone :: Ugen -> Ugen -> Ugen -> Ugen+gammatone input centrefrequency bandwidth = mkUgen Nothing [AudioRate] (Right [0]) "Gammatone" [input, centrefrequency, bandwidth] Nothing 1 (Special 0) NoId++{- | Gaussian classifier++ GaussClass [ControlRate] in=0 bufnum=0 gate=0+-}+gaussClass :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+gaussClass rate in_ bufnum gate_ = mkUgen Nothing [ControlRate] (Left rate) "GaussClass" [in_, bufnum, gate_] Nothing 1 (Special 0) NoId++{- | impulses around a certain frequency++ GaussTrig [ControlRate,AudioRate] freq=440 dev=0.3+-}+gaussTrig :: Rate -> Ugen -> Ugen -> Ugen+gaussTrig rate freq dev = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "GaussTrig" [freq, dev] Nothing 1 (Special 0) NoId++{- | gingerbreadman map 2D chaotic generator++ Gbman2DC [ControlRate,AudioRate] minfreq=11025 maxfreq=22050 x0=1.2 y0=2.1+-}+gbman2DC :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+gbman2DC rate minfreq maxfreq x0 y0 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Gbman2DC" [minfreq, maxfreq, x0, y0] Nothing 1 (Special 0) NoId++{- | gingerbreadman map 2D chaotic generator++ Gbman2DL [ControlRate,AudioRate] minfreq=11025 maxfreq=22050 x0=1.2 y0=2.1+-}+gbman2DL :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+gbman2DL rate minfreq maxfreq x0 y0 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Gbman2DL" [minfreq, maxfreq, x0, y0] Nothing 1 (Special 0) NoId++{- | gingerbreadman map 2D chaotic generator++ Gbman2DN [ControlRate,AudioRate] minfreq=11025 maxfreq=22050 x0=1.2 y0=2.1+-}+gbman2DN :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+gbman2DN rate minfreq maxfreq x0 y0 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Gbman2DN" [minfreq, maxfreq, x0, y0] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ GbmanTrig [ControlRate,AudioRate] minfreq=5 maxfreq=10 x0=1.2 y0=2.1+-}+gbmanTrig :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+gbmanTrig rate minfreq maxfreq x0 y0 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "GbmanTrig" [minfreq, maxfreq, x0, y0] Nothing 1 (Special 0) NoId++{- | Dynamic stochastic synthesis generator++ Gendy4 [ControlRate,AudioRate] ampdist=1 durdist=1 adparam=1 ddparam=1 minfreq=440 maxfreq=660 ampscale=0.5 durscale=0.5 initCPs=12 knum=0+-}+gendy4 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+gendy4 rate ampdist durdist adparam ddparam minfreq maxfreq ampscale durscale initCPs knum = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Gendy4" [ampdist, durdist, adparam, ddparam, minfreq, maxfreq, ampscale, durscale, initCPs, knum] Nothing 1 (Special 0) NoId++{- | Dynamic stochastic synthesis generator++ Gendy5 [ControlRate,AudioRate] ampdist=1 durdist=1 adparam=1 ddparam=1 minfreq=440 maxfreq=660 ampscale=0.5 durscale=0.5 initCPs=12 knum=0+-}+gendy5 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+gendy5 rate ampdist durdist adparam ddparam minfreq maxfreq ampscale durscale initCPs knum = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Gendy5" [ampdist, durdist, adparam, ddparam, minfreq, maxfreq, ampscale, durscale, initCPs, knum] Nothing 1 (Special 0) NoId++{- | Read (numeric) shell environment variables into a synth++ Getenv [] key=0 defaultval=0+-}+getenv :: Rate -> Ugen -> Ugen -> Ugen+getenv rate key defaultval = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate, DemandRate] (Left rate) "Getenv" [key, defaultval] Nothing 1 (Special 0) NoId++{- | backward compatibility++ GlitchBPF [ControlRate,AudioRate] in=0 freq=440 rq=1+-}+glitchBPF :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+glitchBPF rate in_ freq rq = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "GlitchBPF" [in_, freq, rq] Nothing 1 (Special 0) NoId++{- | backward compatibility++ GlitchBRF [ControlRate,AudioRate] in=0 freq=440 rq=1+-}+glitchBRF :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+glitchBRF rate in_ freq rq = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "GlitchBRF" [in_, freq, rq] Nothing 1 (Special 0) NoId++{- | backward compatibility++ GlitchHPF [ControlRate,AudioRate] in=0 freq=440+-}+glitchHPF :: Rate -> Ugen -> Ugen -> Ugen+glitchHPF rate in_ freq = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "GlitchHPF" [in_, freq] Nothing 1 (Special 0) NoId++{- | backward compatibility++ GlitchRHPF [ControlRate,AudioRate] in=0 freq=440 rq=1; FILTER: TRUE+-}+glitchRHPF :: Ugen -> Ugen -> Ugen -> Ugen+glitchRHPF in_ freq rq = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "GlitchRHPF" [in_, freq, rq] Nothing 1 (Special 0) NoId++{- | Calculate a single DFT bin, to detect presence of a frequency++ Goertzel [ControlRate] in=0 bufsize=1024 freq=0 hop=1+-}+goertzel :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+goertzel rate in_ bufsize freq hop = mkUgen Nothing [ControlRate] (Left rate) "Goertzel" [in_, bufsize, freq, hop] Nothing 2 (Special 0) NoId++{- | (Undocumented class)++ GrainBufJ [AudioRate] numChannels=1 trigger=0 dur=1 sndbuf=0 rate=1 pos=0 loop=0 interp=2 grainAmp=1 pan=0 envbufnum=-1 maxGrains=512+-}+grainBufJ :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+grainBufJ rate numChannels trigger dur sndbuf rate_ pos loop interp grainAmp pan envbufnum maxGrains = mkUgen Nothing [AudioRate] (Left rate) "GrainBufJ" [numChannels, trigger, dur, sndbuf, rate_, pos, loop, interp, grainAmp, pan, envbufnum, maxGrains] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ GrainFMJ [AudioRate] numChannels=1 trigger=0 dur=1 carfreq=440 modfreq=200 index=1 grainAmp=1 pan=0 envbufnum=-1 maxGrains=512+-}+grainFMJ :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+grainFMJ rate numChannels trigger dur carfreq modfreq index_ grainAmp pan envbufnum maxGrains = mkUgen Nothing [AudioRate] (Left rate) "GrainFMJ" [numChannels, trigger, dur, carfreq, modfreq, index_, grainAmp, pan, envbufnum, maxGrains] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ GrainInJ [AudioRate] numChannels=1 trigger=0 dur=1 in=0 grainAmp=1 pan=0 envbufnum=-1 maxGrains=512+-}+grainInJ :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+grainInJ rate numChannels trigger dur in_ grainAmp pan envbufnum maxGrains = mkUgen Nothing [AudioRate] (Left rate) "GrainInJ" [numChannels, trigger, dur, in_, grainAmp, pan, envbufnum, maxGrains] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ GrainSinJ [AudioRate] numChannels=1 trigger=0 dur=1 freq=440 grainAmp=1 pan=0 envbufnum=-1 maxGrains=512+-}+grainSinJ :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+grainSinJ rate numChannels trigger dur freq grainAmp pan envbufnum maxGrains = mkUgen Nothing [AudioRate] (Left rate) "GrainSinJ" [numChannels, trigger, dur, freq, grainAmp, pan, envbufnum, maxGrains] Nothing 1 (Special 0) NoId++{- | dynamical system simulation (Newtonian gravitational force)++ GravityGrid [AudioRate] reset=0 rate=0.1 newx=0 newy=0 bufnum=0+-}+gravityGrid :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+gravityGrid rate reset rate_ newx newy bufnum = mkUgen Nothing [AudioRate] (Left rate) "GravityGrid" [reset, rate_, newx, newy, bufnum] Nothing 1 (Special 0) NoId++{- | dynamical system simulation (Newtonian gravitational force)++ GravityGrid2 [AudioRate] reset=0 rate=0.1 newx=0 newy=0 bufnum=0+-}+gravityGrid2 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+gravityGrid2 rate reset rate_ newx newy bufnum = mkUgen Nothing [AudioRate] (Left rate) "GravityGrid2" [reset, rate_, newx, newy, bufnum] Nothing 1 (Special 0) NoId++{- | algorithmic delay++ GreyholeRaw [AudioRate] in1=0 in2=0 damping=0 delaytime=2 diffusion=0.5 feedback=0.9 moddepth=0.1 modfreq=2 size=1; FILTER: TRUE+-}+greyholeRaw :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+greyholeRaw in1 in2 damping delaytime diffusion feedback moddepth modfreq size = mkUgen Nothing [AudioRate] (Right [0, 1]) "GreyholeRaw" [in1, in2, damping, delaytime, diffusion, feedback, moddepth, modfreq, size] Nothing 2 (Special 0) NoId++{- | Simple cochlear hair cell model++ HairCell [ControlRate,AudioRate] input=0 spontaneousrate=0 boostrate=200 restorerate=1000 loss=0.99; FILTER: TRUE+-}+hairCell :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+hairCell input spontaneousrate boostrate restorerate loss = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "HairCell" [input, spontaneousrate, boostrate, restorerate, loss] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ HarmonicOsc [ControlRate,AudioRate] freq=100 firstharmonic=1 *amplitudes=0; MCE=1+-}+harmonicOsc :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+harmonicOsc rate freq firstharmonic amplitudes = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "HarmonicOsc" [freq, firstharmonic] (Just [amplitudes]) 1 (Special 0) NoId++{- | henon map 2D chaotic generator++ Henon2DC [ControlRate,AudioRate] minfreq=11025 maxfreq=22050 a=1.4 b=0.3 x0=0.30502 y0=0.20939+-}+henon2DC :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+henon2DC rate minfreq maxfreq a b x0 y0 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Henon2DC" [minfreq, maxfreq, a, b, x0, y0] Nothing 1 (Special 0) NoId++{- | henon map 2D chaotic generator++ Henon2DL [ControlRate,AudioRate] minfreq=11025 maxfreq=22050 a=1.4 b=0.3 x0=0.30502 y0=0.20939+-}+henon2DL :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+henon2DL rate minfreq maxfreq a b x0 y0 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Henon2DL" [minfreq, maxfreq, a, b, x0, y0] Nothing 1 (Special 0) NoId++{- | henon map 2D chaotic generator++ Henon2DN [ControlRate,AudioRate] minfreq=11025 maxfreq=22050 a=1.4 b=0.3 x0=0.30502 y0=0.20939+-}+henon2DN :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+henon2DN rate minfreq maxfreq a b x0 y0 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Henon2DN" [minfreq, maxfreq, a, b, x0, y0] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ HenonTrig [ControlRate,AudioRate] minfreq=5 maxfreq=10 a=1.4 b=0.3 x0=0.30502 y0=0.20939+-}+henonTrig :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+henonTrig rate minfreq maxfreq a b x0 y0 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "HenonTrig" [minfreq, maxfreq, a, b, x0, y0] Nothing 1 (Special 0) NoId++{- | Transform a cepstrum back to a spectrum++ ICepstrum [] cepchain=0 fftbuf=0+-}+iCepstrum :: Rate -> Ugen -> Ugen -> Ugen+iCepstrum rate cepchain fftbuf = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate, DemandRate] (Left rate) "ICepstrum" [cepchain, fftbuf] Nothing 1 (Special 0) NoId++{- | 24db/oct rolloff, 4nd order resonant Low Pass Filter++ IirFilter [AudioRate] in=0 freq=440 rq=1; FILTER: TRUE+-}+iirFilter :: Ugen -> Ugen -> Ugen -> Ugen+iirFilter in_ freq rq = mkUgen Nothing [AudioRate] (Right [0]) "IirFilter" [in_, freq, rq] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ InGrain [AudioRate] trigger=0 dur=1 in=0+-}+inGrain :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+inGrain rate trigger dur in_ = mkUgen Nothing [AudioRate] (Left rate) "InGrain" [trigger, dur, in_] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ InGrainB [AudioRate] trigger=0 dur=1 in=0 envbuf=0+-}+inGrainB :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+inGrainB rate trigger dur in_ envbuf = mkUgen Nothing [AudioRate] (Left rate) "InGrainB" [trigger, dur, in_, envbuf] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ InGrainBBF [AudioRate] trigger=0 dur=1 in=0 envbuf=0 azimuth=0 elevation=0 rho=1 wComp=0+-}+inGrainBBF :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+inGrainBBF rate trigger dur in_ envbuf azimuth elevation rho wComp = mkUgen Nothing [AudioRate] (Left rate) "InGrainBBF" [trigger, dur, in_, envbuf, azimuth, elevation, rho, wComp] Nothing 4 (Special 0) NoId++{- | (Undocumented class)++ InGrainBF [AudioRate] trigger=0 dur=1 in=0 azimuth=0 elevation=0 rho=1 wComp=0+-}+inGrainBF :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+inGrainBF rate trigger dur in_ azimuth elevation rho wComp = mkUgen Nothing [AudioRate] (Left rate) "InGrainBF" [trigger, dur, in_, azimuth, elevation, rho, wComp] Nothing 4 (Special 0) NoId++{- | (Undocumented class)++ InGrainI [AudioRate] trigger=0 dur=1 in=0 envbuf1=0 envbuf2=0 ifac=0.5+-}+inGrainI :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+inGrainI rate trigger dur in_ envbuf1 envbuf2 ifac = mkUgen Nothing [AudioRate] (Left rate) "InGrainI" [trigger, dur, in_, envbuf1, envbuf2, ifac] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ InGrainIBF [AudioRate] trigger=0 dur=1 in=0 envbuf1=0 envbuf2=0 ifac=0.5 azimuth=0 elevation=0 rho=1 wComp=0+-}+inGrainIBF :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+inGrainIBF rate trigger dur in_ envbuf1 envbuf2 ifac azimuth elevation rho wComp = mkUgen Nothing [AudioRate] (Left rate) "InGrainIBF" [trigger, dur, in_, envbuf1, envbuf2, ifac, azimuth, elevation, rho, wComp] Nothing 4 (Special 0) NoId++{- | Distortion by subtracting magnitude from 1++ InsideOut [ControlRate,AudioRate] in=0+-}+insideOut :: Rate -> Ugen -> Ugen+insideOut rate in_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "InsideOut" [in_] Nothing 1 (Special 0) NoId++{- | instruction synthesis (breakpoint set interpreter)++ Instruction [AudioRate] bufnum=0+-}+instruction :: Rate -> Ugen -> Ugen+instruction rate bufnum = mkUgen Nothing [AudioRate] (Left rate) "Instruction" [bufnum] Nothing 1 (Special 0) NoId++{- | Raw version of the JPverb algorithmic reverberator, designed to produce long tails with chorusing++ JPverbRaw [ControlRate,AudioRate] in1=0 in2=0 damp=0 earlydiff=0.707 highband=2000 highx=1 lowband=500 lowx=1 mdepth=0.1 mfreq=2 midx=1 size=1 t60=1; FILTER: TRUE+-}+jPverbRaw :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+jPverbRaw in1 in2 damp earlydiff highband highx lowband lowx mdepth mfreq midx size t60 = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "JPverbRaw" [in1, in2, damp, earlydiff, highband, highx, lowband, lowx, mdepth, mfreq, midx, size, t60] Nothing 2 (Special 0) NoId++{- | k-means classification in real time++ KMeansRT [ControlRate] bufnum=0 inputdata=0 k=5 gate=1 reset=0 learn=1+-}+kMeansRT :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+kMeansRT rate bufnum inputdata k gate_ reset learn = mkUgen Nothing [ControlRate] (Left rate) "KMeansRT" [bufnum, inputdata, k, gate_, reset, learn] Nothing 1 (Special 0) NoId++{- | Running score of maximum correlation of chromagram with key profiles++ KeyClarity [ControlRate] chain=0 keydecay=2 chromaleak=0.5+-}+keyClarity :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+keyClarity rate chain keydecay chromaleak = mkUgen Nothing [ControlRate] (Left rate) "KeyClarity" [chain, keydecay, chromaleak] Nothing 1 (Special 0) NoId++{- | Find best correlated key mode with chromagram between major, minor and chromatic cluster++ KeyMode [ControlRate] chain=0 keydecay=2 chromaleak=0.5+-}+keyMode :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+keyMode rate chain keydecay chromaleak = mkUgen Nothing [ControlRate] (Left rate) "KeyMode" [chain, keydecay, chromaleak] Nothing 1 (Special 0) NoId++{- | K-means Oscillator++ KmeansToBPSet1 [AudioRate] freq=440 numdatapoints=20 maxnummeans=4 nummeans=4 tnewdata=1 tnewmeans=1 soft=1 bufnum=0+-}+kmeansToBPSet1 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+kmeansToBPSet1 rate freq numdatapoints maxnummeans nummeans tnewdata tnewmeans soft bufnum = mkUgen Nothing [AudioRate] (Left rate) "KmeansToBPSet1" [freq, numdatapoints, maxnummeans, nummeans, tnewdata, tnewmeans, soft, bufnum] Nothing 1 (Special 0) NoId++{-+-- | Run any LADSPA plugin inside SuperCollider+--+-- LADSPA [AudioRate] nChans=0 id=0 args=0+ladspa :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+ladspa rate nChans id_ args = mkUgen Nothing [AudioRate] (Left rate) "LADSPA" [nChans,id_,args] Nothing 0 (Special 0) NoId+-}++{- | random walk step++ LFBrownNoise0 [ControlRate,AudioRate] freq=20 dev=1 dist=0; NONDET+-}+lfBrownNoise0Id :: ID a => a -> Rate -> Ugen -> Ugen -> Ugen -> Ugen+lfBrownNoise0Id z rate freq dev dist = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "LFBrownNoise0" [freq, dev, dist] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of LFBrownNoise0.+lfBrownNoise0M :: Uid m => Rate -> Ugen -> Ugen -> Ugen -> m Ugen+lfBrownNoise0M = liftUid4 lfBrownNoise0Id++-- | Unsafe variant of LFBrownNoise0.+lfBrownNoise0 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+lfBrownNoise0 = liftUnsafe4 lfBrownNoise0M++{- | random walk linear interp++ LFBrownNoise1 [ControlRate,AudioRate] freq=20 dev=1 dist=0; NONDET+-}+lfBrownNoise1Id :: ID a => a -> Rate -> Ugen -> Ugen -> Ugen -> Ugen+lfBrownNoise1Id z rate freq dev dist = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "LFBrownNoise1" [freq, dev, dist] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of LFBrownNoise1.+lfBrownNoise1M :: Uid m => Rate -> Ugen -> Ugen -> Ugen -> m Ugen+lfBrownNoise1M = liftUid4 lfBrownNoise1Id++-- | Unsafe variant of LFBrownNoise1.+lfBrownNoise1 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+lfBrownNoise1 = liftUnsafe4 lfBrownNoise1M++{- | random walk cubic interp++ LFBrownNoise2 [ControlRate,AudioRate] freq=20 dev=1 dist=0; NONDET+-}+lfBrownNoise2Id :: ID a => a -> Rate -> Ugen -> Ugen -> Ugen -> Ugen+lfBrownNoise2Id z rate freq dev dist = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "LFBrownNoise2" [freq, dev, dist] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of LFBrownNoise2.+lfBrownNoise2M :: Uid m => Rate -> Ugen -> Ugen -> Ugen -> m Ugen+lfBrownNoise2M = liftUid4 lfBrownNoise2Id++-- | Unsafe variant of LFBrownNoise2.+lfBrownNoise2 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+lfBrownNoise2 = liftUnsafe4 lfBrownNoise2M++{- | Live Linear Predictive Coding Analysis and Resynthesis++ LPCAnalyzer [AudioRate] input=0 source=0.01 n=256 p=10 testE=0 delta=0.999 windowtype=0; FILTER: TRUE+-}+lpcAnalyzer :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+lpcAnalyzer input source n p testE delta windowtype = mkUgen Nothing [AudioRate] (Right [0, 1]) "LPCAnalyzer" [input, source, n, p, testE, delta, windowtype] Nothing 1 (Special 0) NoId++{- | Linear Predictive Coding Gone Wrong++ LPCError [AudioRate] input=0 p=10+-}+lpcError :: Rate -> Ugen -> Ugen -> Ugen+lpcError rate input p = mkUgen Nothing [AudioRate] (Left rate) "LPCError" [input, p] Nothing 1 (Special 0) NoId++{- | Utilize LPC data++ LPCSynth [AudioRate] buffer=0 signal=0 pointer=0+-}+lpcSynth :: Ugen -> Ugen -> Ugen -> Ugen+lpcSynth buffer signal pointer = mkUgen Nothing [AudioRate] (Left AudioRate) "LPCSynth" [buffer, signal, pointer] Nothing 1 (Special 0) NoId++{- | Utilize LPC data++ LPCVals [ControlRate,AudioRate] buffer=0 pointer=0+-}+lpcVals :: Ugen -> Ugen -> Ugen+lpcVals buffer pointer = mkUgen Nothing [ControlRate, AudioRate] (Left AudioRate) "LPCVals" [buffer, pointer] Nothing 3 (Special 0) NoId++{- | (Undocumented class)++ LPF1 [ControlRate,AudioRate] in=0 freq=1000+-}+lpf1 :: Rate -> Ugen -> Ugen -> Ugen+lpf1 rate in_ freq = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "LPF1" [in_, freq] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ LPF18 [AudioRate] in=0 freq=100 res=1 dist=0.4+-}+lpf18 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+lpf18 rate in_ freq res dist = mkUgen Nothing [AudioRate] (Left rate) "LPF18" [in_, freq, res, dist] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ LPFVS6 [ControlRate,AudioRate] in=0 freq=1000 slope=0.5+-}+lpfvs6 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+lpfvs6 rate in_ freq slope_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "LPFVS6" [in_, freq, slope_] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ LPG [AudioRate] input=0 controlinput=0 controloffset=0 controlscale=1 vca=1 resonance=1.5 lowpassmode=1 linearity=1; FILTER: TRUE+-}+lpg :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+lpg input controlinput controloffset controlscale vca resonance lowpassmode linearity = mkUgen Nothing [AudioRate] (Right [0]) "LPG" [input, controlinput, controloffset, controlscale, vca, resonance, lowpassmode, linearity] Nothing 1 (Special 0) NoId++{- | Linear Time Invariant General Filter Equation++ LTI [AudioRate] input=0 bufnuma=0 bufnumb=1+-}+lti :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+lti rate input bufnuma bufnumb = mkUgen Nothing [AudioRate] (Left rate) "LTI" [input, bufnuma, bufnumb] Nothing 1 (Special 0) NoId++{- | latoocarfian 2D chaotic generator++ Latoocarfian2DC [ControlRate,AudioRate] minfreq=11025 maxfreq=22050 a=1 b=3 c=0.5 d=0.5 x0=0.34082 y0=-0.3827+-}+latoocarfian2DC :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+latoocarfian2DC rate minfreq maxfreq a b c d x0 y0 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Latoocarfian2DC" [minfreq, maxfreq, a, b, c, d, x0, y0] Nothing 1 (Special 0) NoId++{- | latoocarfian 2D chaotic generator++ Latoocarfian2DL [ControlRate,AudioRate] minfreq=11025 maxfreq=22050 a=1 b=3 c=0.5 d=0.5 x0=0.34082 y0=-0.3827+-}+latoocarfian2DL :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+latoocarfian2DL rate minfreq maxfreq a b c d x0 y0 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Latoocarfian2DL" [minfreq, maxfreq, a, b, c, d, x0, y0] Nothing 1 (Special 0) NoId++{- | latoocarfian 2D chaotic generator++ Latoocarfian2DN [ControlRate,AudioRate] minfreq=11025 maxfreq=22050 a=1 b=3 c=0.5 d=0.5 x0=0.34082 y0=-0.3827+-}+latoocarfian2DN :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+latoocarfian2DN rate minfreq maxfreq a b c d x0 y0 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Latoocarfian2DN" [minfreq, maxfreq, a, b, c, d, x0, y0] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ LatoocarfianTrig [ControlRate,AudioRate] minfreq=5 maxfreq=10 a=1 b=3 c=0.5 d=0.5 x0=0.34082 y0=-0.3827+-}+latoocarfianTrig :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+latoocarfianTrig rate minfreq maxfreq a b c d x0 y0 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "LatoocarfianTrig" [minfreq, maxfreq, a, b, c, d, x0, y0] Nothing 1 (Special 0) NoId++{- | Emit a sequence of triggers at specified time offsets++ ListTrig [ControlRate] bufnum=0 reset=0 offset=0 numframes=0+-}+listTrig :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+listTrig rate bufnum reset offset numframes = mkUgen Nothing [ControlRate] (Left rate) "ListTrig" [bufnum, reset, offset, numframes] Nothing 1 (Special 0) NoId++{- | Emit a sequence of triggers at specified time offsets++ ListTrig2 [ControlRate] bufnum=0 reset=0 numframes=0+-}+listTrig2 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+listTrig2 rate bufnum reset numframes = mkUgen Nothing [ControlRate] (Left rate) "ListTrig2" [bufnum, reset, numframes] Nothing 1 (Special 0) NoId++{- | Store values to a buffer, whenever triggered++ Logger [ControlRate] inputArray=0 trig=0 bufnum=0 reset=0+-}+logger :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+logger rate inputArray trig_ bufnum reset = mkUgen Nothing [ControlRate] (Left rate) "Logger" [inputArray, trig_, bufnum, reset] Nothing 1 (Special 0) NoId++{- | sample looping oscillator++ LoopBuf [AudioRate] bufnum=0 rate=1 gate=1 startPos=0 startLoop=0 endLoop=0 interpolation=2; NC INPUT: True+-}+loopBuf :: Int -> Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+loopBuf numChannels rate bufnum rate_ gate_ startPos startLoop endLoop interpolation = mkUgen Nothing [AudioRate] (Left rate) "LoopBuf" [bufnum, rate_, gate_, startPos, startLoop, endLoop, interpolation] Nothing numChannels (Special 0) NoId++{- | lorenz 2D chaotic generator++ Lorenz2DC [ControlRate,AudioRate] minfreq=11025 maxfreq=22050 s=10 r=28 b=2.66667 h=0.02 x0=0.09088 y0=2.97077 z0=24.28204+-}+lorenz2DC :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+lorenz2DC rate minfreq maxfreq s r b h x0 y0 z0 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Lorenz2DC" [minfreq, maxfreq, s, r, b, h, x0, y0, z0] Nothing 1 (Special 0) NoId++{- | lorenz 2D chaotic generator++ Lorenz2DL [ControlRate,AudioRate] minfreq=11025 maxfreq=22050 s=10 r=28 b=2.66667 h=0.02 x0=0.09088 y0=2.97077 z0=24.28204+-}+lorenz2DL :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+lorenz2DL rate minfreq maxfreq s r b h x0 y0 z0 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Lorenz2DL" [minfreq, maxfreq, s, r, b, h, x0, y0, z0] Nothing 1 (Special 0) NoId++{- | lorenz 2D chaotic generator++ Lorenz2DN [ControlRate,AudioRate] minfreq=11025 maxfreq=22050 s=10 r=28 b=2.66667 h=0.02 x0=0.09088 y0=2.97077 z0=24.28204+-}+lorenz2DN :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+lorenz2DN rate minfreq maxfreq s r b h x0 y0 z0 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Lorenz2DN" [minfreq, maxfreq, s, r, b, h, x0, y0, z0] Nothing 1 (Special 0) NoId++{- | lorenz chaotic trigger generator++ LorenzTrig [ControlRate,AudioRate] minfreq=11025 maxfreq=22050 s=10 r=28 b=2.66667 h=0.02 x0=0.09088 y0=2.97077 z0=24.28204+-}+lorenzTrig :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+lorenzTrig rate minfreq maxfreq s r b h x0 y0 z0 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "LorenzTrig" [minfreq, maxfreq, s, r, b, h, x0, y0, z0] Nothing 1 (Special 0) NoId++{- | simple resonating lowpass filter++ Lores [AudioRate] in=0 freq=880 res=0.5; FILTER: TRUE+-}+lores :: Ugen -> Ugen -> Ugen -> Ugen+lores in_ freq res = mkUgen Nothing [AudioRate] (Right [0]) "Lores" [in_, freq, res] Nothing 1 (Special 0) NoId++{- | 2-species Predator-Prey model++ LotkaVolterra [AudioRate] freq=22050 a=1.5 b=1.5 c=0.5 d=1.5 h=0.05 xi=1 yi=0.2+-}+lotkaVolterra :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+lotkaVolterra rate freq a b c d h xi yi = mkUgen Nothing [AudioRate] (Left rate) "LotkaVolterra" [freq, a, b, c, d, h, xi, yi] Nothing 2 (Special 0) NoId++{- | (Undocumented class)++ MCLDChaosGen [] maxSize=0+-}+mcldChaosGen :: Rate -> Ugen -> Ugen+mcldChaosGen rate maxSize = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate, DemandRate] (Left rate) "MCLDChaosGen" [maxSize] Nothing 1 (Special 0) NoId++{- | POKEY Chip Sound Simulator++ MZPokey [AudioRate] audf1=0 audc1=0 audf2=0 audc2=0 audf3=0 audc3=0 audf4=0 audc4=0 audctl=0+-}+mzPokey :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+mzPokey rate audf1 audc1 audf2 audc2 audf3 audc3 audf4 audc4 audctl = mkUgen Nothing [AudioRate] (Left rate) "MZPokey" [audf1, audc1, audf2, audc2, audf3, audc3, audf4, audc4, audctl] Nothing 1 (Special 0) NoId++{- | First order Markov Chain implementation for audio signals++ MarkovSynth [AudioRate] in=0 isRecording=1 waitTime=2 tableSize=10+-}+markovSynth :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+markovSynth rate in_ isRecording waitTime tableSize = mkUgen Nothing [AudioRate] (Left rate) "MarkovSynth" [in_, isRecording, waitTime, tableSize] Nothing 1 (Special 0) NoId++{- | Real time sparse representation++ MatchingP [ControlRate,AudioRate] dict=0 in=0 dictsize=1 ntofind=1 hop=1 method=0+-}+matchingP :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+matchingP rate dict in_ dictsize ntofind hop method = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "MatchingP" [dict, in_, dictsize, ntofind, hop, method] Nothing 4 (Special 0) NoId++{- | (Undocumented class)++ MatchingPResynth [ControlRate,AudioRate] dict=0 method=0 trigger=0 residual=0 activs=0+-}+matchingPResynth :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+matchingPResynth rate dict method trigger residual activs = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "MatchingPResynth" [dict, method, trigger, residual, activs] Nothing 1 (Special 0) NoId++{- | maximum within last x samples++ Max [ControlRate] in=0 numsamp=64+-}+max :: Rate -> Ugen -> Ugen -> Ugen+max rate in_ numsamp = mkUgen Nothing [ControlRate] (Left rate) "Max" [in_, numsamp] Nothing 1 (Special 0) NoId++{- | Tracks and prints amplitudes++ Maxamp [AudioRate] in=0 numSamps=1000+-}+maxamp :: Rate -> Ugen -> Ugen -> Ugen+maxamp rate in_ numSamps = mkUgen Nothing [AudioRate] (Left rate) "Maxamp" [in_, numSamps] Nothing 1 (Special 0) NoId++{- | Piano synthesiser++ MdaPiano [AudioRate] freq=440 gate=1 vel=100 decay=0.8 release=0.8 hard=0.8 velhard=0.8 muffle=0.8 velmuff=0.8 velcurve=0.8 stereo=0.2 tune=0.5 random=0.1 stretch=0.1 sustain=0+-}+mdaPiano :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+mdaPiano rate freq gate_ vel decay_ release hard velhard muffle velmuff velcurve stereo tune random stretch sustain = mkUgen Nothing [AudioRate] (Left rate) "MdaPiano" [freq, gate_, vel, decay_, release, hard, velhard, muffle, velmuff, velcurve, stereo, tune, random, stretch, sustain] Nothing 2 (Special 0) NoId++{- | Mean of recent values, triggered++ MeanTriggered [ControlRate,AudioRate] in=0 trig=0 length=10+-}+meanTriggered :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+meanTriggered rate in_ trig_ length_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "MeanTriggered" [in_, trig_, length_] Nothing 1 (Special 0) NoId++{- | Meddis cochlear hair cell model++ Meddis [ControlRate,AudioRate] input=0; FILTER: TRUE+-}+meddis :: Ugen -> Ugen+meddis input = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Meddis" [input] Nothing 1 (Special 0) NoId++{- | Separate harmonic and percussive parts of a signal++ MedianSeparation [] fft=0 fftharmonic=0 fftpercussive=0 fftsize=1024 mediansize=17 hardorsoft=0 p=2 medianormax=0+-}+medianSeparation :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+medianSeparation rate fft_ fftharmonic fftpercussive fftsize mediansize hardorsoft p medianormax = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate, DemandRate] (Left rate) "MedianSeparation" [fft_, fftharmonic, fftpercussive, fftsize, mediansize, hardorsoft, p, medianormax] Nothing 2 (Special 0) NoId++{- | Median of recent values, triggered++ MedianTriggered [ControlRate,AudioRate] in=0 trig=0 length=10+-}+medianTriggered :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+medianTriggered rate in_ trig_ length_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "MedianTriggered" [in_, trig_, length_] Nothing 1 (Special 0) NoId++{- | Waveguide mesh physical models of drum membranes++ MembraneCircle [AudioRate] excitation=0 tension=0.05 loss=0.99999+-}+membraneCircle :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+membraneCircle rate excitation tension loss = mkUgen Nothing [AudioRate] (Left rate) "MembraneCircle" [excitation, tension, loss] Nothing 1 (Special 0) NoId++{- | Waveguide mesh physical models of drum membranes++ MembraneHexagon [AudioRate] excitation=0 tension=0.05 loss=0.99999+-}+membraneHexagon :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+membraneHexagon rate excitation tension loss = mkUgen Nothing [AudioRate] (Left rate) "MembraneHexagon" [excitation, tension, loss] Nothing 1 (Special 0) NoId++{- | Metronome++ Metro [ControlRate,AudioRate] bpm=0 numBeats=0+-}+metro :: Rate -> Ugen -> Ugen -> Ugen+metro rate bpm numBeats = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Metro" [bpm, numBeats] Nothing 1 (Special 0) NoId++{- | a macro oscillator++ MiBraids [AudioRate] pitch=60 timbre=0.5 color=0.5 model=0 trig=0 resamp=0 decim=0 bits=0 ws=0+-}+miBraids :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+miBraids rate pitch_ timbre color model trig_ resamp decim bits ws = mkUgen Nothing [AudioRate] (Left rate) "MiBraids" [pitch_, timbre, color, model, trig_, resamp, decim, bits, ws] Nothing 1 (Special 0) NoId++{- | granular audio processor and texture synthesizer++ MiClouds [AudioRate] pit=0 pos=0.5 size=0.25 dens=0.4 tex=0.5 drywet=0.5 in_gain=1 spread=0.5 rvb=0 fb=0 freeze=0 mode=0 lofi=0 trig=0 *inputArray=0; MCE=1, REORDERS INPUTS: [14,0,1,2,3,4,5,6,7,8,9,10,11,12,13]+-}+miClouds :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+miClouds rate pit pos size dens tex drywet in_gain spread rvb fb freeze mode lofi trig_ inputArray = mkUgen Nothing [AudioRate] (Left rate) "MiClouds" [pit, pos, size, dens, tex, drywet, in_gain, spread, rvb, fb, freeze, mode, lofi, trig_] (Just [inputArray]) 2 (Special 0) NoId++{- | Physical modelling based on Modal Synthesis.++ MiElements [AudioRate] blow_in=0 strike_in=0 gate=0 pit=48 strength=0.5 contour=0.2 bow_level=0 blow_level=0 strike_level=0 flow=0.5 mallet=0.5 bow_timb=0.5 blow_timb=0.5 strike_timb=0.5 geom=0.25 bright=0.5 damp=0.7 pos=0.2 space=0.3 model=0 easteregg=0+-}+miElements :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+miElements rate blow_in strike_in gate_ pit strength contour bow_level blow_level strike_level flow mallet bow_timb blow_timb strike_timb geom bright damp pos space model easteregg = mkUgen Nothing [AudioRate] (Left rate) "MiElements" [blow_in, strike_in, gate_, pit, strength, contour, bow_level, blow_level, strike_level, flow, mallet, bow_timb, blow_timb, strike_timb, geom, bright, damp, pos, space, model, easteregg] Nothing 2 (Special 0) NoId++{- | topographic drum sequencer++ MiGrids [AudioRate] bpm=120 map_x=0.5 map_y=0.5 chaos=0 bd_density=0.25 sd_density=0.25 hh_density=0.25 mode=1 swing=0 config=0+-}+miGrids :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+miGrids rate bpm map_x map_y chaos bd_density sd_density hh_density mode swing config = mkUgen Nothing [AudioRate] (Left rate) "MiGrids" [bpm, map_x, map_y, chaos, bd_density, sd_density, hh_density, mode, swing, config] Nothing 6 (Special 0) NoId++{- | µ-law audio companding++ MiMu [AudioRate] in=0 gain=1 bypass=0+-}+miMu :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+miMu rate in_ gain bypass = mkUgen Nothing [AudioRate] (Left rate) "MiMu" [in_, gain, bypass] Nothing 1 (Special 0) NoId++{- | FM Synth-Voice based on 'ominous'++ MiOmi [AudioRate] audio_in=0 gate=0 pit=48 contour=0.2 detune=0.25 level1=0.5 level2=0.5 ratio1=0.5 ratio2=0.5 fm1=0 fm2=0 fb=0 xfb=0 filter_mode=0 cutoff=0.5 reson=0 strength=0.5 env=0.5 rotate=0.2 space=0.5+-}+miOmi :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+miOmi rate audio_in gate_ pit contour detune level1 level2 ratio1 ratio2 fm1 fm2 fb xfb filter_mode cutoff reson strength env rotate_ space = mkUgen Nothing [AudioRate] (Left rate) "MiOmi" [audio_in, gate_, pit, contour, detune, level1, level2, ratio1, ratio2, fm1, fm2, fb, xfb, filter_mode, cutoff, reson, strength, env, rotate_, space] Nothing 2 (Special 0) NoId++{- | a macro oscillator++ MiPlaits [AudioRate] pitch=60 engine=0 harm=0.1 timbre=0.5 morph=0.5 trigger=0 level=0 fm_mod=0 timb_mod=0 morph_mod=0 decay=0.5 lpg_colour=0.5+-}+miPlaits :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+miPlaits rate pitch_ engine harm timbre morph trigger level fm_mod timb_mod morph_mod decay_ lpg_colour = mkUgen Nothing [AudioRate] (Left rate) "MiPlaits" [pitch_, engine, harm, timbre, morph, trigger, level, fm_mod, timb_mod, morph_mod, decay_, lpg_colour] Nothing 2 (Special 0) NoId++{- | a resonator++ MiRings [AudioRate] in=0 trig=0 pit=60 struct=0.25 bright=0.5 damp=0.7 pos=0.25 model=0 poly=1 intern_exciter=0 easteregg=0 bypass=0+-}+miRings :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+miRings rate in_ trig_ pit struct bright damp pos model poly intern_exciter easteregg bypass = mkUgen Nothing [AudioRate] (Left rate) "MiRings" [in_, trig_, pit, struct, bright, damp, pos, model, poly, intern_exciter, easteregg, bypass] Nothing 2 (Special 0) NoId++{- | Classic resonant LP filter++ MiRipples [AudioRate] in=0 cf=0.3 reson=0.2 drive=1; FILTER: TRUE+-}+miRipples :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+miRipples in_ cf reson drive = mkUgen Nothing [AudioRate] (Right [0]) "MiRipples" [in_, cf, reson, drive] Nothing 1 (Special 0) NoId++{- | a quad LFO++ MiTides [AudioRate] freq=1 shape=0.5 slope=0.5 smooth=0.5 shift=0.2 trig=0 clock=0 output_mode=3 ramp_mode=1 ratio=9 rate=1+-}+miTides :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+miTides rate freq shape slope_ smooth shift trig_ clock output_mode ramp_mode ratio rate_ = mkUgen Nothing [AudioRate] (Left rate) "MiTides" [freq, shape, slope_, smooth, shift, trig_, clock, output_mode, ramp_mode, ratio, rate_] Nothing 4 (Special 0) NoId++{- | stereo reverb++ MiVerb [AudioRate] time=0.7 drywet=0.5 damp=0.5 hp=0.05 freeze=0 diff=0.625 *inputArray=0; MCE=1, FILTER: TRUE, REORDERS INPUTS: [6,0,1,2,3,4,5]+-}+miVerb :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+miVerb time drywet damp hp freeze diff inputArray = mkUgen Nothing [AudioRate] (Right [6]) "MiVerb" [time, drywet, damp, hp, freeze, diff] (Just [inputArray]) 2 (Special 0) NoId++{- | a meta modulator++ MiWarps [AudioRate] carrier=0 modulator=0 lev1=0.5 lev2=0.5 algo=0 timb=0 osc=0 freq=110 vgain=1 easteregg=0+-}+miWarps :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+miWarps rate carrier modulator lev1 lev2 algo timb osc_ freq vgain easteregg = mkUgen Nothing [AudioRate] (Left rate) "MiWarps" [carrier, modulator, lev1, lev2, algo, timb, osc_, freq, vgain, easteregg] Nothing 2 (Special 0) NoId++{- | Granulates real-time input++ MonoGrain [AudioRate] in=0 winsize=0.1 grainrate=10 winrandpct=0+-}+monoGrain :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+monoGrain rate in_ winsize grainrate winrandpct = mkUgen Nothing [AudioRate] (Left rate) "MonoGrain" [in_, winsize, grainrate, winrandpct] Nothing 1 (Special 0) NoId++{- | Granulates real-time input with Ambisonic panning++ MonoGrainBF [AudioRate] in=0 winsize=0.1 grainrate=10 winrandpct=0 azimuth=0 azrand=0 elevation=0 elrand=0 rho=1+-}+monoGrainBF :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+monoGrainBF rate in_ winsize grainrate winrandpct azimuth azrand elevation elrand rho = mkUgen Nothing [AudioRate] (Left rate) "MonoGrainBF" [in_, winsize, grainrate, winrandpct, azimuth, azrand, elevation, elrand, rho] Nothing 4 (Special 0) NoId++{- | Moog Filter Emulation++ MoogLadder [ControlRate,AudioRate] in=0 ffreq=440 res=0; FILTER: TRUE+-}+moogLadder :: Ugen -> Ugen -> Ugen -> Ugen+moogLadder in_ ffreq res = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "MoogLadder" [in_, ffreq, res] Nothing 1 (Special 0) NoId++{- | Moog filter emulation++ MoogVCF [AudioRate] in=0 fco=0 res=0; FILTER: TRUE+-}+moogVCF :: Ugen -> Ugen -> Ugen -> Ugen+moogVCF in_ fco res = mkUgen Nothing [AudioRate] (Right [0]) "MoogVCF" [in_, fco, res] Nothing 1 (Special 0) NoId++{- | Stereo reverb++ NHHall [AudioRate] in1=0.0 in2=0.0 rt60=1.0 stereo=0.5 lowFreq=200.0 lowRatio=0.5 hiFreq=4000.0 hiRatio=0.5 earlyDiffusion=0.5 lateDiffusion=0.5 modRate=0.2 modDepth=0.3+-}+nhHall :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+nhHall in1 in2 rt60 stereo lowFreq lowRatio hiFreq hiRatio earlyDiffusion lateDiffusion modRate modDepth = mkUgen Nothing [AudioRate] (Right [0, 1]) "NHHall" [in1, in2, rt60, stereo, lowFreq, lowRatio, hiFreq, hiRatio, earlyDiffusion, lateDiffusion, modRate, modDepth] Nothing 2 (Special 0) NoId++{- | Non Linear Filter Equation++ NL [AudioRate] input=0 bufnuma=0 bufnumb=1 guard1=1000 guard2=100+-}+nl :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+nl rate input bufnuma bufnumb guard1 guard2 = mkUgen Nothing [AudioRate] (Left rate) "NL" [input, bufnuma, bufnumb, guard1, guard2] Nothing 1 (Special 0) NoId++{- | Arbitrary Non Linear Filter Equation++ NL2 [AudioRate] input=0 bufnum=0 maxsizea=10 maxsizeb=10 guard1=1000 guard2=100+-}+nl2 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+nl2 rate input bufnum maxsizea maxsizeb guard1 guard2 = mkUgen Nothing [AudioRate] (Left rate) "NL2" [input, bufnum, maxsizea, maxsizeb, guard1, guard2] Nothing 1 (Special 0) NoId++{- | Non-linear Filter++ NLFiltC [ControlRate,AudioRate] input=0 a=0 b=0 d=0 c=0 l=0+-}+nlFiltC :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+nlFiltC rate input a b d c l = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "NLFiltC" [input, a, b, d, c, l] Nothing 1 (Special 0) NoId++{- | Non-linear Filter++ NLFiltL [ControlRate,AudioRate] input=0 a=0 b=0 d=0 c=0 l=0+-}+nlFiltL :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+nlFiltL rate input a b d c l = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "NLFiltL" [input, a, b, d, c, l] Nothing 1 (Special 0) NoId++{- | Non-linear Filter++ NLFiltN [ControlRate,AudioRate] input=0 a=0 b=0 d=0 c=0 l=0+-}+nlFiltN :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+nlFiltN rate input a b d c l = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "NLFiltN" [input, a, b, d, c, l] Nothing 1 (Special 0) NoId++{- | physical modeling simulation; N tubes++ NTube [AudioRate] input=0 lossarray=1 karray=0 delaylengtharray=0+-}+nTube :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+nTube rate input lossarray karray delaylengtharray = mkUgen Nothing [AudioRate] (Left rate) "NTube" [input, lossarray, karray, delaylengtharray] Nothing 1 (Special 0) NoId++{- | Find the nearest-neighbours in a set of points++ NearestN [ControlRate] treebuf=0 in=0 gate=1 num=1+-}+nearestN :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+nearestN rate treebuf in_ gate_ num = mkUgen Nothing [ControlRate] (Left rate) "NearestN" [treebuf, in_, gate_, num] Nothing 3 (Special 0) NoId++{- | (Undocumented class)++ NeedleRect [AudioRate] rate=1 imgWidth=100 imgHeight=100 rectX=0 rectY=0 rectW=100 rectH=100+-}+needleRect :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+needleRect rate rate_ imgWidth imgHeight rectX rectY rectW rectH = mkUgen Nothing [AudioRate] (Left rate) "NeedleRect" [rate_, imgWidth, imgHeight, rectX, rectY, rectW, rectH] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ NeoFormant [ControlRate,AudioRate] formantfreq=100 carrierfreq=200 phaseshift=0.5+-}+neoFormant :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+neoFormant rate formantfreq carrierfreq phaseshift = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "NeoFormant" [formantfreq, carrierfreq, phaseshift] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ NeoVarSawOsc [ControlRate,AudioRate] freq=100 pw=0.5 waveshape=0.5+-}+neoVarSawOsc :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+neoVarSawOsc rate freq pw waveshape = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "NeoVarSawOsc" [freq, pw, waveshape] Nothing 1 (Special 0) NoId++{- | APU Chip Sound Simulator++ Nes2 [AudioRate] trig=0 a0=0 a1=0 a2=0 a3=0 b0=0 b1=0 b2=0 b3=0 c0=0 c2=0 c3=0 d0=0 d2=0 d3=0 e0=0 e1=0 e2=0 e3=0 smask=0+-}+nes2 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+nes2 rate trig_ a0 a1 a2 a3 b0 b1 b2 b3 c0 c2 c3 d0 d2 d3 e0 e1 e2 e3 smask = mkUgen Nothing [AudioRate] (Left rate) "Nes2" [trig_, a0, a1, a2, a3, b0, b1, b2, b3, c0, c2, c3, d0, d2, d3, e0, e1, e2, e3, smask] Nothing 1 (Special 0) NoId++{- | Nested Allpass filters as proposed by Vercoe and Pluckett++ NestedAllpassC [AudioRate] in=0 maxdelay1=0.036 delay1=0.036 gain1=0.08 maxdelay2=0.03 delay2=0.03 gain2=0.3; FILTER: TRUE+-}+nestedAllpassC :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+nestedAllpassC in_ maxdelay1 delay1_ gain1 maxdelay2 delay2_ gain2 = mkUgen Nothing [AudioRate] (Right [0]) "NestedAllpassC" [in_, maxdelay1, delay1_, gain1, maxdelay2, delay2_, gain2] Nothing 1 (Special 0) NoId++{- | Nested Allpass filters as proposed by Vercoe and Pluckett++ NestedAllpassL [AudioRate] in=0 maxdelay1=0.036 delay1=0.036 gain1=0.08 maxdelay2=0.03 delay2=0.03 gain2=0.3; FILTER: TRUE+-}+nestedAllpassL :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+nestedAllpassL in_ maxdelay1 delay1_ gain1 maxdelay2 delay2_ gain2 = mkUgen Nothing [AudioRate] (Right [0]) "NestedAllpassL" [in_, maxdelay1, delay1_, gain1, maxdelay2, delay2_, gain2] Nothing 1 (Special 0) NoId++{- | Nested Allpass filters as proposed by Vercoe and Pluckett++ NestedAllpassN [AudioRate] in=0 maxdelay1=0.036 delay1=0.036 gain1=0.08 maxdelay2=0.03 delay2=0.03 gain2=0.3; FILTER: TRUE+-}+nestedAllpassN :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+nestedAllpassN in_ maxdelay1 delay1_ gain1 maxdelay2 delay2_ gain2 = mkUgen Nothing [AudioRate] (Right [0]) "NestedAllpassN" [in_, maxdelay1, delay1_, gain1, maxdelay2, delay2_, gain2] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ OSFold4 [AudioRate] in=0 lo=0 hi=0+-}+osFold4 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+osFold4 rate in_ lo hi = mkUgen Nothing [AudioRate] (Left rate) "OSFold4" [in_, lo, hi] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ OSFold8 [AudioRate] in=0 lo=0 hi=0+-}+osFold8 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+osFold8 rate in_ lo hi = mkUgen Nothing [AudioRate] (Left rate) "OSFold8" [in_, lo, hi] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ OSTrunc4 [AudioRate] in=0 quant=0.5+-}+osTrunc4 :: Rate -> Ugen -> Ugen -> Ugen+osTrunc4 rate in_ quant = mkUgen Nothing [AudioRate] (Left rate) "OSTrunc4" [in_, quant] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ OSTrunc8 [AudioRate] in=0 quant=0.5+-}+osTrunc8 :: Rate -> Ugen -> Ugen -> Ugen+osTrunc8 rate in_ quant = mkUgen Nothing [AudioRate] (Left rate) "OSTrunc8" [in_, quant] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ OSWrap4 [AudioRate] in=0 lo=0 hi=0+-}+osWrap4 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+osWrap4 rate in_ lo hi = mkUgen Nothing [AudioRate] (Left rate) "OSWrap4" [in_, lo, hi] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ OSWrap8 [AudioRate] in=0 lo=0 hi=0+-}+osWrap8 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+osWrap8 rate in_ lo hi = mkUgen Nothing [AudioRate] (Left rate) "OSWrap8" [in_, lo, hi] Nothing 1 (Special 0) NoId++{- | Extract basic statistics from a series of onset triggers++ OnsetStatistics [ControlRate] input=0 windowsize=1 hopsize=0.1+-}+onsetStatistics :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+onsetStatistics rate input windowsize hopsize = mkUgen Nothing [ControlRate] (Left rate) "OnsetStatistics" [input, windowsize, hopsize] Nothing 3 (Special 0) NoId++{- | Chemical reaction modelling Oscillator++ Oregonator [AudioRate] reset=0 rate=0.01 epsilon=1 mu=1 q=1 initx=0.5 inity=0.5 initz=0.5+-}+oregonator :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+oregonator rate reset rate_ epsilon mu q initx inity initz = mkUgen Nothing [AudioRate] (Left rate) "Oregonator" [reset, rate_, epsilon, mu, q, initx, inity, initz] Nothing 3 (Special 0) NoId++{- | (Undocumented class)++ OscBank [ControlRate,AudioRate] freq=100 gain=1 saw8=0.5 square8=0.5 saw4=0.5 square4=0.5 saw2=0.5 square2=0.5 saw1=0.5+-}+oscBank :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+oscBank rate freq gain saw8 square8 saw4 square4 saw2 square2 saw1 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "OscBank" [freq, gain, saw8, square8, saw4, square4, saw2, square2, saw1] Nothing 1 (Special 0) NoId++{- | Piano physical model.++ OteyPiano [AudioRate] freq=440 vel=1 t_gate=0 rmin=0.35 rmax=2 rampl=4 rampr=8 rcore=1 lmin=0.07 lmax=1.4 lampl=-4 lampr=4 rho=1 e=1 zb=1 zh=0 mh=1 k=0.2 alpha=1 p=1 hpos=0.142 loss=1 detune=0.0003 hammer_type=1+-}+oteyPiano :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+oteyPiano rate freq vel t_gate rmin rmax rampl rampr rcore lmin lmax lampl lampr rho e zb zh mh k alpha p hpos loss detune hammer_type = mkUgen Nothing [AudioRate] (Left rate) "OteyPiano" [freq, vel, t_gate, rmin, rmax, rampl, rampr, rcore, lmin, lmax, lampl, lampr, rho, e, zb, zh, mh, k, alpha, p, hpos, loss, detune, hammer_type] Nothing 1 (Special 0) NoId++{- | Piano physical model.++ OteyPianoStrings [AudioRate] freq=440 vel=1 t_gate=0 rmin=0.35 rmax=2 rampl=4 rampr=8 rcore=1 lmin=0.07 lmax=1.4 lampl=-4 lampr=4 rho=1 e=1 zb=1 zh=0 mh=1 k=0.2 alpha=1 p=1 hpos=0.142 loss=1 detune=0.0003 hammer_type=1+-}+oteyPianoStrings :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+oteyPianoStrings rate freq vel t_gate rmin rmax rampl rampr rcore lmin lmax lampl lampr rho e zb zh mh k alpha p hpos loss detune hammer_type = mkUgen Nothing [AudioRate] (Left rate) "OteyPianoStrings" [freq, vel, t_gate, rmin, rmax, rampl, rampr, rcore, lmin, lmax, lampl, lampr, rho, e, zb, zh, mh, k, alpha, p, hpos, loss, detune, hammer_type] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ OteySoundBoard [AudioRate] inp=0 c1=20 c3=20 mix=0.8; FILTER: TRUE+-}+oteySoundBoard :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+oteySoundBoard inp c1 c3 mix = mkUgen Nothing [AudioRate] (Right [0]) "OteySoundBoard" [inp, c1, c3, mix] Nothing 1 (Special 0) NoId++{- | Return mag and freq data from a CSound pv++ PVInfo [ControlRate,AudioRate] pvbuffer=0 binNum=0 filePointer=0+-}+pvInfo :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+pvInfo rate pvbuffer binNum filePointer = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "PVInfo" [pvbuffer, binNum, filePointer] Nothing 2 (Special 0) NoId++{- | Resynthesize Csound PV data++ PVSynth [AudioRate] pvbuffer=0 numBins=0 binStart=0 binSkip=1 filePointer=0 freqMul=1 freqAdd=0+-}+pvSynth :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pvSynth rate pvbuffer numBins binStart binSkip filePointer freqMul freqAdd = mkUgen Nothing [AudioRate] (Left rate) "PVSynth" [pvbuffer, numBins, binStart, binSkip, filePointer, freqMul, freqAdd] Nothing 1 (Special 0) NoId++{- | Plays FFT data to a memory buffer++ PV_BinBufRd [ControlRate] buffer=0 playbuf=0 point=1 binStart=0 binSkip=1 numBins=1 clear=0+-}+pv_BinBufRd :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_BinBufRd buffer playbuf_ point binStart binSkip numBins clear = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_BinBufRd" [buffer, playbuf_, point, binStart, binSkip, numBins, clear] Nothing 1 (Special 0) NoId++{- | Delay and Feedback on a bin by bin basis.++ PV_BinDelay [ControlRate] buffer=0 maxdelay=0 delaybuf=0 fbbuf=0 hop=0.5+-}+pv_BinDelay :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_BinDelay buffer maxdelay delaybuf fbbuf hop = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_BinDelay" [buffer, maxdelay, delaybuf, fbbuf, hop] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ PV_BinFilter [ControlRate] buffer=0 start=0 end=0+-}+pv_BinFilter :: Ugen -> Ugen -> Ugen -> Ugen+pv_BinFilter buffer start end = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_BinFilter" [buffer, start, end] Nothing 1 (Special 0) NoId++{- | Plays FFT data to a memory buffer++ PV_BinPlayBuf [ControlRate] buffer=0 playbuf=0 rate=1 offset=0 binStart=0 binSkip=1 numBins=1 loop=0 clear=0+-}+pv_BinPlayBuf :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_BinPlayBuf buffer playbuf_ rate_ offset binStart binSkip numBins loop clear = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_BinPlayBuf" [buffer, playbuf_, rate_, offset, binStart, binSkip, numBins, loop, clear] Nothing 1 (Special 0) NoId++{- | Plays FFT data from a memory buffer++ PV_BufRd [ControlRate] buffer=0 playbuf=0 point=1+-}+pv_BufRd :: Ugen -> Ugen -> Ugen -> Ugen+pv_BufRd buffer playbuf_ point = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_BufRd" [buffer, playbuf_, point] Nothing 1 (Special 0) NoId++{- | returns common magnitudes++ PV_CommonMag [ControlRate] bufferA=0 bufferB=0 tolerance=0 remove=0+-}+pv_CommonMag :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_CommonMag bufferA bufferB tolerance remove = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_CommonMag" [bufferA, bufferB, tolerance, remove] Nothing 1 (Special 0) NoId++{- | multiplies common magnitudes++ PV_CommonMul [ControlRate] bufferA=0 bufferB=0 tolerance=0 remove=0+-}+pv_CommonMul :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_CommonMul bufferA bufferB tolerance remove = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_CommonMul" [bufferA, bufferB, tolerance, remove] Nothing 1 (Special 0) NoId++{- | simple spectral compression/expansion++ PV_Compander [ControlRate] buffer=0 thresh=50 slopeBelow=1 slopeAbove=1+-}+pv_Compander :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_Compander buffer thresh slopeBelow slopeAbove = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_Compander" [buffer, thresh, slopeBelow, slopeAbove] Nothing 1 (Special 0) NoId++{- | zero bins with interpolation++ PV_Cutoff [ControlRate] bufferA=0 bufferB=0 wipe=0+-}+pv_Cutoff :: Ugen -> Ugen -> Ugen -> Ugen+pv_Cutoff bufferA bufferB wipe = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_Cutoff" [bufferA, bufferB, wipe] Nothing 1 (Special 0) NoId++{- | Return the even numbered bins in an FFT buffer++ PV_EvenBin [ControlRate] buffer=0+-}+pv_EvenBin :: Ugen -> Ugen+pv_EvenBin buffer = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_EvenBin" [buffer] Nothing 1 (Special 0) NoId++{- | extract a repeating loop out from audio++ PV_ExtractRepeat [ControlRate] buffer=0 loopbuf=0 loopdur=0 memorytime=30 which=0 ffthop=0.5 thresh=1+-}+pv_ExtractRepeat :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_ExtractRepeat buffer loopbuf_ loopdur memorytime which ffthop thresh = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_ExtractRepeat" [buffer, loopbuf_, loopdur, memorytime, which, ffthop, thresh] Nothing 1 (Special 0) NoId++{- | Freeze FFT frames++ PV_Freeze [ControlRate] buffer=0 freeze=0+-}+pv_Freeze :: Ugen -> Ugen -> Ugen+pv_Freeze buffer freeze = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_Freeze" [buffer, freeze] Nothing 1 (Special 0) NoId++{- | Store FFT data in another buffer for other use++ PV_FreqBuffer [ControlRate] buffer=0 databuffer=0+-}+pv_FreqBuffer :: Ugen -> Ugen -> Ugen+pv_FreqBuffer buffer databuffer = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_FreqBuffer" [buffer, databuffer] Nothing 1 (Special 0) NoId++{- | Invert FFT frames++ PV_Invert [ControlRate] buffer=0+-}+pv_Invert :: Ugen -> Ugen+pv_Invert buffer = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_Invert" [buffer] Nothing 1 (Special 0) NoId++{- | Store FFT data in another buffer for other use++ PV_MagBuffer [ControlRate] buffer=0 databuffer=0+-}+pv_MagBuffer :: Ugen -> Ugen -> Ugen+pv_MagBuffer buffer databuffer = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_MagBuffer" [buffer, databuffer] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ PV_MagExp [ControlRate] buffer=0+-}+pv_MagExp :: Ugen -> Ugen+pv_MagExp buffer = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_MagExp" [buffer] Nothing 1 (Special 0) NoId++{- | reduces magnitudes above or below thresh++ PV_MagGate [ControlRate] buffer=0 thresh=1 remove=0+-}+pv_MagGate :: Ugen -> Ugen -> Ugen -> Ugen+pv_MagGate buffer thresh remove = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_MagGate" [buffer, thresh, remove] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ PV_MagLog [ControlRate] buffer=0+-}+pv_MagLog :: Ugen -> Ugen+pv_MagLog buffer = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_MagLog" [buffer] Nothing 1 (Special 0) NoId++{- | Remap magnitudes to a new mag curve++ PV_MagMap [ControlRate] buffer=0 mapbuf=0+-}+pv_MagMap :: Ugen -> Ugen -> Ugen+pv_MagMap buffer mapbuf = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_MagMap" [buffer, mapbuf] Nothing 1 (Special 0) NoId++{- | subtract spectral energy++ PV_MagMinus [ControlRate] bufferA=0 bufferB=0 remove=1+-}+pv_MagMinus :: Ugen -> Ugen -> Ugen -> Ugen+pv_MagMinus bufferA bufferB remove = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_MagMinus" [bufferA, bufferB, remove] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ PV_MagMulAdd [ControlRate] buffer=0+-}+pv_MagMulAdd :: Ugen -> Ugen+pv_MagMulAdd buffer = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_MagMulAdd" [buffer] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ PV_MagScale [ControlRate] bufferA=0 bufferB=0+-}+pv_MagScale :: Ugen -> Ugen -> Ugen+pv_MagScale bufferA bufferB = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_MagScale" [bufferA, bufferB] Nothing 1 (Special 0) NoId++{- | Smooth spectral magnitudes over time++ PV_MagSmooth [ControlRate] buffer=0 factor=0.1+-}+pv_MagSmooth :: Ugen -> Ugen -> Ugen+pv_MagSmooth buffer factor = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_MagSmooth" [buffer, factor] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ PV_MagSubtract [ControlRate] bufferA=0 bufferB=0 zerolimit=0+-}+pv_MagSubtract :: Ugen -> Ugen -> Ugen -> Ugen+pv_MagSubtract bufferA bufferB zerolimit = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_MagSubtract" [bufferA, bufferB, zerolimit] Nothing 1 (Special 0) NoId++{- | Return the N strongest bins++ PV_MaxMagN [ControlRate] buffer=0 numbins=0+-}+pv_MaxMagN :: Ugen -> Ugen -> Ugen+pv_MaxMagN buffer numbins = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_MaxMagN" [buffer, numbins] Nothing 1 (Special 0) NoId++{- | Return the N weakest bins++ PV_MinMagN [ControlRate] buffer=0 numbins=0+-}+pv_MinMagN :: Ugen -> Ugen -> Ugen+pv_MinMagN buffer numbins = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_MinMagN" [buffer, numbins] Nothing 1 (Special 0) NoId++{- | one kind of spectral morphing++ PV_Morph [ControlRate] bufferA=0 bufferB=0 morph=0+-}+pv_Morph :: Ugen -> Ugen -> Ugen -> Ugen+pv_Morph bufferA bufferB morph = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_Morph" [bufferA, bufferB, morph] Nothing 1 (Special 0) NoId++{- | Return only bins that are unstable++ PV_NoiseSynthF [ControlRate] buffer=0 threshold=0.1 numFrames=2 initflag=0+-}+pv_NoiseSynthF :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_NoiseSynthF buffer threshold numFrames initflag = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_NoiseSynthF" [buffer, threshold, numFrames, initflag] Nothing 1 (Special 0) NoId++{- | Return only bins that are unstable++ PV_NoiseSynthP [ControlRate] buffer=0 threshold=0.1 numFrames=2 initflag=0+-}+pv_NoiseSynthP :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_NoiseSynthP buffer threshold numFrames initflag = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_NoiseSynthP" [buffer, threshold, numFrames, initflag] Nothing 1 (Special 0) NoId++{- | Return the odd numbered bins in an FFT buffer++ PV_OddBin [ControlRate] buffer=0+-}+pv_OddBin :: Ugen -> Ugen+pv_OddBin buffer = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_OddBin" [buffer] Nothing 1 (Special 0) NoId++{- | Return only bins that are stable++ PV_PartialSynthF [ControlRate] buffer=0 threshold=0.1 numFrames=2 initflag=0+-}+pv_PartialSynthF :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_PartialSynthF buffer threshold numFrames initflag = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_PartialSynthF" [buffer, threshold, numFrames, initflag] Nothing 1 (Special 0) NoId++{- | Return only bins that are stable++ PV_PartialSynthP [ControlRate] buffer=0 threshold=0.1 numFrames=2 initflag=0+-}+pv_PartialSynthP :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_PartialSynthP buffer threshold numFrames initflag = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_PartialSynthP" [buffer, threshold, numFrames, initflag] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ PV_PitchShift [ControlRate] buffer=0 ratio=0+-}+pv_PitchShift :: Ugen -> Ugen -> Ugen+pv_PitchShift buffer ratio = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_PitchShift" [buffer, ratio] Nothing 1 (Special 0) NoId++{- | Plays FFT data to a memory buffer++ PV_PlayBuf [ControlRate] buffer=0 playbuf=0 rate=1 offset=0 loop=0+-}+pv_PlayBuf :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_PlayBuf buffer playbuf_ rate_ offset loop = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_PlayBuf" [buffer, playbuf_, rate_, offset, loop] Nothing 1 (Special 0) NoId++{- | Records FFT data to a memory buffer++ PV_RecordBuf [ControlRate] buffer=0 recbuf=0 offset=0 run=0 loop=0 hop=0.5 wintype=0+-}+pv_RecordBuf :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_RecordBuf buffer recbuf offset run loop hop wintype = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_RecordBuf" [buffer, recbuf, offset, run, loop, hop, wintype] Nothing 1 (Special 0) NoId++{- | combine low and high bins from two inputs with interpolation++ PV_SoftWipe [ControlRate] bufferA=0 bufferB=0 wipe=0+-}+pv_SoftWipe :: Ugen -> Ugen -> Ugen -> Ugen+pv_SoftWipe bufferA bufferB wipe = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_SoftWipe" [bufferA, bufferB, wipe] Nothing 1 (Special 0) NoId++{- | A harmonic enhancer++ PV_SpectralEnhance [ControlRate] buffer=0 numPartials=8 ratio=2 strength=0.1+-}+pv_SpectralEnhance :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_SpectralEnhance buffer numPartials ratio strength = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_SpectralEnhance" [buffer, numPartials, ratio, strength] Nothing 1 (Special 0) NoId++{- | Maps the spectral envelope of one FFT process onto another++ PV_SpectralMap [ControlRate] buffer=0 specBuffer=0 floor=0 freeze=0 mode=0 norm=0 window=0+-}+pv_SpectralMap :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_SpectralMap buffer specBuffer floor_ freeze mode norm window = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_SpectralMap" [buffer, specBuffer, floor_, freeze, mode, norm, window] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ PV_Split [ControlRate] bufferA=0 bufferB=0+-}+pv_Split :: Ugen -> Ugen -> Ugen+pv_Split bufferA bufferB = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_Split" [bufferA, bufferB] Nothing 2 (Special 0) NoId++{- | (Undocumented class)++ PV_Whiten [ControlRate] chain=0 trackbufnum=0 relaxtime=2 floor=0.1 smear=0 bindownsample=0+-}+pv_Whiten :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_Whiten chain trackbufnum relaxtime floor_ smear bindownsample = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_Whiten" [chain, trackbufnum, relaxtime, floor_, smear, bindownsample] Nothing 1 (Special 0) NoId++{- | one kind of spectral morphing++ PV_XFade [ControlRate] bufferA=0 bufferB=0 fade=0+-}+pv_xFade :: Ugen -> Ugen -> Ugen -> Ugen+pv_xFade bufferA bufferB fade = mkUgen Nothing [ControlRate] (Left ControlRate) "PV_XFade" [bufferA, bufferB, fade] Nothing 1 (Special 0) NoId++{- | Equal power pan across an array of speakers++ PanX [ControlRate,AudioRate] numChans=0 in=0 pos=0 level=1 width=2+-}+panX :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+panX rate numChans in_ pos level width = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "PanX" [numChans, in_, pos, level, width] Nothing 0 (Special 0) NoId++{- | (Undocumented class)++ PanX2D [ControlRate,AudioRate] numChansX=0 numChansY=0 in=0 posX=0 posY=0 level=1 widthX=2 widthY=2+-}+panX2D :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+panX2D rate numChansX numChansY in_ posX posY level widthX widthY = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "PanX2D" [numChansX, numChansY, in_, posX, posY, level, widthX, widthY] Nothing 0 (Special 0) NoId++{- | (Undocumented class)++ PeakEQ2 [AudioRate] in=0 freq=1200 rs=1 db=0+-}+peakEQ2 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+peakEQ2 rate in_ freq rs db = mkUgen Nothing [AudioRate] (Left rate) "PeakEQ2" [in_, freq, rs, db] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ PeakEQ4 [AudioRate] in=0 freq=1200 rs=1 db=0+-}+peakEQ4 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+peakEQ4 rate in_ freq rs db = mkUgen Nothing [AudioRate] (Left rate) "PeakEQ4" [in_, freq, rs, db] Nothing 1 (Special 0) NoId++{- | 3D Perlin Noise++ Perlin3 [ControlRate,AudioRate] x=0 y=0 z=0+-}+perlin3 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+perlin3 rate x y z = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Perlin3" [x, y, z] Nothing 1 (Special 0) NoId++{- | Sample permutation Ugen.++ PermMod [AudioRate] in=0 freq=100+-}+permMod :: Rate -> Ugen -> Ugen -> Ugen+permMod rate in_ freq = mkUgen Nothing [AudioRate] (Left rate) "PermMod" [in_, freq] Nothing 1 (Special 0) NoId++{- | Sample permutation Ugen with programmable pattern.++ PermModArray [AudioRate] in=0 freq=50 pattern=0+-}+permModArray :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+permModArray rate in_ freq pattern_ = mkUgen Nothing [AudioRate] (Left rate) "PermModArray" [in_, freq, pattern_] Nothing 1 (Special 0) NoId++{- | Sample permutation Ugen with tail.++ PermModT [AudioRate] in=0 outfreq=440 infreq=5000+-}+permModT :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+permModT rate in_ outfreq infreq = mkUgen Nothing [AudioRate] (Left rate) "PermModT" [in_, outfreq, infreq] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ PhasorModal [AudioRate] input=0 freq=100 decay=0.25 damp=1 amp=0.5 phase=0; FILTER: TRUE+-}+phasorModal :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+phasorModal input freq decay_ damp amp phase = mkUgen Nothing [AudioRate] (Right [0]) "PhasorModal" [input, freq, decay_, damp, amp, phase] Nothing 1 (Special 0) NoId++{- | Tree classifier using (hyper)planes – Ugen or language-side++ PlaneTree [ControlRate] treebuf=0 in=0 gate=1+-}+planeTree :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+planeTree rate treebuf in_ gate_ = mkUgen Nothing [ControlRate] (Left rate) "PlaneTree" [treebuf, in_, gate_] Nothing 1 (Special 0) NoId++{- | POKEY Chip Sound Simulator++ Pokey [AudioRate] audf1=0 audc1=0 audf2=0 audc2=0 audf3=0 audc3=0 audf4=0 audc4=0 audctl=0+-}+pokey :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pokey rate audf1 audc1 audf2 audc2 audf3 audc3 audf4 audc4 audctl = mkUgen Nothing [AudioRate] (Left rate) "Pokey" [audf1, audc1, audf2, audc2, audf3, audc3, audf4, audc4, audctl] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ PosRatio [AudioRate] in=0 period=100 thresh=0.1+-}+posRatio :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+posRatio rate in_ period thresh = mkUgen Nothing [AudioRate] (Left rate) "PosRatio" [in_, period, thresh] Nothing 1 (Special 0) NoId++{- | debug assistance++ PrintVal [ControlRate] in=0 numblocks=100 id=0+-}+printVal :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+printVal rate in_ numblocks id_ = mkUgen Nothing [ControlRate] (Left rate) "PrintVal" [in_, numblocks, id_] Nothing 1 (Special 0) NoId++{- | constant Q transform pitch follower++ Qitch [ControlRate] in=0 databufnum=0 ampThreshold=0.01 algoflag=1 ampbufnum=0 minfreq=0 maxfreq=2500+-}+qitch :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+qitch rate in_ databufnum ampThreshold algoflag ampbufnum minfreq maxfreq = mkUgen Nothing [ControlRate] (Left rate) "Qitch" [in_, databufnum, ampThreshold, algoflag, ampbufnum, minfreq, maxfreq] Nothing 2 (Special 0) NoId++{- | (Undocumented class)++ Bezier [ControlRate,AudioRate] haltAfter=100 dx=0.0001 freq=440 phase=0 *param=0; MCE=1+-}+bezier :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+bezier rate haltAfter dx freq phase param = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Bezier" [haltAfter, dx, freq, phase] (Just [param]) 1 (Special 0) NoId++{- | rotating clock divider++ RCD [AudioRate] clock=0 rotate=0 reset=0 div=0 spread=0 auto=0 len=0 down=0 gates=0; FILTER: TRUE+-}+rcd :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+rcd clock rotate_ reset div_ spread auto len down gates = mkUgen Nothing [AudioRate] (Right [0]) "RCD" [clock, rotate_, reset, div_, spread, auto, len, down, gates] Nothing 8 (Special 0) NoId++{- | (Undocumented class)++ RDL [AudioRate] numChannels=1 inputArray=0+-}+rdl :: Rate -> Ugen -> Ugen -> Ugen+rdl rate numChannels inputArray = mkUgen Nothing [AudioRate] (Left rate) "RDL" [numChannels, inputArray] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ DX7 [AudioRate] bufnum=0 on=0 off=0 data=0 vc=0 mnn=60 vel=99 pw=0 mw=0 bc=0 fc=0+-}+dx7 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dx7 rate bufnum on off data_ vc mnn vel pw mw bc fc = mkUgen Nothing [AudioRate] (Left rate) "DX7" [bufnum, on, off, data_, vc, mnn, vel, pw, mw, bc, fc] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ RDX7Env [AudioRate] gate=0 data=0 r1=0 r2=0 r3=0 r4=0 l1=0 l2=0 l3=0 l4=0 ol=0+-}+rdx7Env :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+rdx7Env rate gate_ data_ r1 r2 r3 r4 l1 l2 l3 l4 ol = mkUgen Nothing [AudioRate] (Left rate) "RDX7Env" [gate_, data_, r1, r2, r3, r4, l1, l2, l3, l4, ol] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ RDelayMap [AudioRate] bufnum=0 in=0 dynamic=0 *spec=0; MCE=1, FILTER: TRUE+-}+rDelayMap :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+rDelayMap bufnum in_ dynamic spec = mkUgen Nothing [AudioRate] (Right [1]) "RDelayMap" [bufnum, in_, dynamic] (Just [spec]) 1 (Special 0) NoId++{- | (Undocumented class)++ RDelaySet [AudioRate] input=0 *setArray=0; MCE=1, FILTER: TRUE+-}+rDelaySet :: Ugen -> Ugen -> Ugen+rDelaySet input setArray = mkUgen Nothing [AudioRate] (Right [0]) "RDelaySet" [input] (Just [setArray]) 1 (Special 0) NoId++{- | (Undocumented class)++ RDelaySetBuf [AudioRate] bufnum=0 in=0 spec=0+-}+rDelaySetBuf :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+rDelaySetBuf rate bufnum in_ spec = mkUgen Nothing [AudioRate] (Left rate) "RDelaySetBuf" [bufnum, in_, spec] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ dustRange [AudioRate] iot_min=0.1 iot_max=1+-}+dustRangeId :: ID a => a -> Rate -> Ugen -> Ugen -> Ugen+dustRangeId z rate iot_min iot_max = mkUgen Nothing [AudioRate] (Left rate) "DustRange" [iot_min, iot_max] Nothing 1 (Special 0) (toUid z)++{- | (Undocumented class)++ ExpRandN [InitialisationRate] lo=0 hi=1; NC INPUT: True, NONDET+-}+expRandNId :: ID a => Int -> a -> Ugen -> Ugen -> Ugen+expRandNId numChannels z lo hi = mkUgen Nothing [InitialisationRate] (Left InitialisationRate) "ExpRandN" [lo, hi] Nothing numChannels (Special 0) (toUid z)++-- | Monad variant of ExpRandN.+expRandNM :: Uid m => Int -> Ugen -> Ugen -> m Ugen+expRandNM nc = liftUid2 (expRandNId nc)++-- | Unsafe variant of ExpRandN.+expRandN :: Int -> Ugen -> Ugen -> Ugen+expRandN nc = liftUnsafe2 (expRandNM nc)++{- | (Undocumented class)++ Freezer [AudioRate] bufnum=0 left=0 right=1 gain=1 increment=1 incrementOffset=0 incrementRandom=0 rightRandom=0 syncPhaseTrigger=0 randomizePhaseTrigger=0 numberOfLoops=4+-}+freezer :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+freezer bufnum left right gain increment incrementOffset incrementRandom rightRandom syncPhaseTrigger randomizePhaseTrigger numberOfLoops = mkUgen Nothing [AudioRate] (Left AudioRate) "Freezer" [bufnum, left, right, gain, increment, incrementOffset, incrementRandom, rightRandom, syncPhaseTrigger, randomizePhaseTrigger, numberOfLoops] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ IRandN [] numChannels=2 lo=0 hi=127+-}+iRandNId :: ID a => a -> Int -> Ugen -> Ugen -> Ugen+iRandNId z numChannels lo hi = mkUgen Nothing [InitialisationRate] (Left InitialisationRate) "IRandN" [lo, hi] Nothing numChannels (Special 0) (toUid z)++-- | Monad variant of IRandN.+iRandNM :: Uid m => Int -> Ugen -> Ugen -> m Ugen+iRandNM nc = liftUid2 (iRandNId nc)++-- | Unsafe variant of IRandN.+iRandN :: Int -> Ugen -> Ugen -> Ugen+iRandN nc = liftUnsafe2 (iRandNM nc)++{- | TB303 Filter Emulation++ RLPFD [ControlRate,AudioRate] in=0 ffreq=440 res=0 dist=0; FILTER: TRUE+-}+rlpfd :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+rlpfd in_ ffreq res dist = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "RLPFD" [in_, ffreq, res, dist] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ RLagC [ControlRate] in=0 timeUp=0.1 curveUp=0 timeDown=0.1 curveDown=0; FILTER: TRUE+-}+rLagC :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+rLagC in_ timeUp curveUp timeDown curveDown = mkUgen Nothing [ControlRate] (Right [0]) "RLagC" [in_, timeUp, curveUp, timeDown, curveDown] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ LinRandN [InitialisationRate] lo=0 hi=1 minmax=0; NC INPUT: True, NONDET+-}+linRandNId :: ID a => Int -> a -> Ugen -> Ugen -> Ugen -> Ugen+linRandNId numChannels z lo hi minmax = mkUgen Nothing [InitialisationRate] (Left InitialisationRate) "LinRandN" [lo, hi, minmax] Nothing numChannels (Special 0) (toUid z)++-- | Monad variant of LinRandN.+linRandNM :: Uid m => Int -> Ugen -> Ugen -> Ugen -> m Ugen+linRandNM nc = liftUid3 (linRandNId nc)++-- | Unsafe variant of LinRandN.+linRandN :: Int -> Ugen -> Ugen -> Ugen -> Ugen+linRandN nc = liftUnsafe3 (linRandNM nc)++{- | (Undocumented class)++ RLoopSet [AudioRate] bufnum=0 left=0 right=1 gain=1 increment=1 spec=0+-}+rLoopSet :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+rLoopSet rate bufnum left right gain increment spec = mkUgen Nothing [AudioRate] (Left rate) "RLoopSet" [bufnum, left, right, gain, increment, spec] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ RMAFoodChainL [AudioRate] freq=22050 a1=5 b1=3 d1=0.4 a2=0.1 b2=2 d2=0.01 k=1.0943 r=0.8904 h=0.05 xi=0.1 yi=0 zi=0+-}+rmaFoodChainL :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+rmaFoodChainL rate freq a1 b1 d1 a2 b2 d2 k r h xi yi zi = mkUgen Nothing [AudioRate] (Left rate) "RMAFoodChainL" [freq, a1, b1, d1, a2, b2, d2, k, r, h, xi, yi, zi] Nothing 3 (Special 0) NoId++{- | (Undocumented class)++ RMEQ [AudioRate] in=0 freq=440 rq=0.1 k=0; FILTER: TRUE+-}+rmeq :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+rmeq in_ freq rq k = mkUgen Nothing [AudioRate] (Right [0]) "RMEQ" [in_, freq, rq, k] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ RMEQSuite [] maxSize=0+-}+rmeqSuite :: Rate -> Ugen -> Ugen+rmeqSuite rate maxSize = mkUgen Nothing [InitialisationRate, ControlRate, AudioRate, DemandRate] (Left rate) "RMEQSuite" [maxSize] Nothing 1 (Special 0) NoId++{- | root mean square++ RMS [ControlRate,AudioRate] in=0 lpFreq=10+-}+rms :: Rate -> Ugen -> Ugen -> Ugen+rms rate in_ lpFreq = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "RMS" [in_, lpFreq] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ RMShelf [AudioRate] in=0 freq=440 k=0+-}+rmShelf :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+rmShelf rate in_ freq k = mkUgen Nothing [AudioRate] (Left rate) "RMShelf" [in_, freq, k] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ RMShelf2 [AudioRate] in=0 freq=440 k=0+-}+rmShelf2 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+rmShelf2 rate in_ freq k = mkUgen Nothing [AudioRate] (Left rate) "RMShelf2" [in_, freq, k] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ ObxdFilter [AudioRate] in=0 cutoff=440 resonance=0 multimode=0.5 bandpass=0 fourpole=0+-}+obxdFilter :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+obxdFilter in_ cutoff resonance multimode bandpass fourpole = mkUgen Nothing [AudioRate] (Right [0]) "ObxdFilter" [in_, cutoff, resonance, multimode, bandpass, fourpole] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ RPVDecayTbl [] fft_buf=0 decay_rate_buf=0 history_buf=0+-}+rpvDecayTbl :: Ugen -> Ugen -> Ugen -> Ugen+rpvDecayTbl fft_buf decay_rate_buf history_buf = mkUgen Nothing [ControlRate] (Left ControlRate) "RPVDecayTbl" [fft_buf, decay_rate_buf, history_buf] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ RandN [InitialisationRate] lo=0 hi=1; NC INPUT: True, NONDET+-}+randNId :: ID a => Int -> a -> Ugen -> Ugen -> Ugen+randNId numChannels z lo hi = mkUgen Nothing [InitialisationRate] (Left InitialisationRate) "RandN" [lo, hi] Nothing numChannels (Special 0) (toUid z)++-- | Monad variant of RandN.+randNM :: Uid m => Int -> Ugen -> Ugen -> m Ugen+randNM nc = liftUid2 (randNId nc)++-- | Unsafe variant of RandN.+randN :: Int -> Ugen -> Ugen -> Ugen+randN nc = liftUnsafe2 (randNM nc)++{- | (Undocumented class)++ RSVFBP [AudioRate] in=0 freq=440 q=0+-}+svfBp :: Ugen -> Ugen -> Ugen -> Ugen+svfBp in_ freq q = mkUgen Nothing [AudioRate] (Right [0]) "SvfBp" [in_, freq, q] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ SvfHp [AudioRate] in=0 freq=440 q=0+-}+svfHp :: Ugen -> Ugen -> Ugen -> Ugen+svfHp in_ freq q = mkUgen Nothing [AudioRate] (Right [0]) "SvfHp" [in_, freq, q] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ SvflP [AudioRate] in=0 freq=440 q=0+-}+svfLp :: Ugen -> Ugen -> Ugen -> Ugen+svfLp in_ freq q = mkUgen Nothing [AudioRate] (Right [0]) "SvfLp" [in_, freq, q] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ ShufflerB [AudioRate] bufnum=0 readLocationMinima=0.01 readLocationMaxima=0.02 readIncrementMinima=1 readIncrementMaxima=1 durationMinima=0.2 durationMaxima=0.2 envelopeAmplitudeMinima=0.5 envelopeAmplitudeMaxima=0.5 envelopeShapeMinima=0.5 envelopeShapeMaxima=0.5 envelopeSkewMinima=0.5 envelopeSkewMaxima=0.5 stereoLocationMinima=0.5 stereoLocationMaxima=0.5 interOffsetTimeMinima=0.05 interOffsetTimeMaxima=0.01 ftableReadLocationIncrement=1 readIncrementQuanta=0 interOffsetTimeQuanta=0+-}+shufflerB :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+shufflerB bufnum readLocationMinima readLocationMaxima readIncrementMinima readIncrementMaxima durationMinima durationMaxima envelopeAmplitudeMinima envelopeAmplitudeMaxima envelopeShapeMinima envelopeShapeMaxima envelopeSkewMinima envelopeSkewMaxima stereoLocationMinima stereoLocationMaxima interOffsetTimeMinima interOffsetTimeMaxima ftableReadLocationIncrement readIncrementQuanta interOffsetTimeQuanta = mkUgen Nothing [AudioRate] (Left AudioRate) "ShufflerB" [bufnum, readLocationMinima, readLocationMaxima, readIncrementMinima, readIncrementMaxima, durationMinima, durationMaxima, envelopeAmplitudeMinima, envelopeAmplitudeMaxima, envelopeShapeMinima, envelopeShapeMaxima, envelopeSkewMinima, envelopeSkewMaxima, stereoLocationMinima, stereoLocationMaxima, interOffsetTimeMinima, interOffsetTimeMaxima, ftableReadLocationIncrement, readIncrementQuanta, interOffsetTimeQuanta] Nothing 2 (Special 0) NoId++{- | (Undocumented class)++ RShufflerL [AudioRate] in=0 fragmentSize=0.01 maxDelay=0.01+-}+rShufflerL :: Ugen -> Ugen -> Ugen -> Ugen+rShufflerL in_ fragmentSize maxDelay = mkUgen Nothing [AudioRate] (Right [0]) "RShufflerL" [in_, fragmentSize, maxDelay] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ RSmplrIndex [ControlRate] buf=0 size=0 mnn=60+-}+rSmplrIndex :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+rSmplrIndex rate buf size mnn = mkUgen Nothing [ControlRate] (Left rate) "RSmplrIndex" [buf, size, mnn] Nothing 2 (Special 0) NoId++{- | (Undocumented class)++ TExpRandN [ControlRate] lo=0 hi=1 trigger=0; NC INPUT: True, FILTER: TRUE, NONDET+-}+tExpRandNId :: ID a => Int -> a -> Ugen -> Ugen -> Ugen -> Ugen+tExpRandNId numChannels z lo hi trigger = mkUgen Nothing [ControlRate] (Right [2]) "TExpRandN" [lo, hi, trigger] Nothing numChannels (Special 0) (toUid z)++-- | Monad variant of TExpRandN.+tExpRandNM :: Uid m => Int -> Ugen -> Ugen -> Ugen -> m Ugen+tExpRandNM nc = liftUid3 (tExpRandNId nc)++-- | Unsafe variant of TExpRandN.+tExpRandN :: Int -> Ugen -> Ugen -> Ugen -> Ugen+tExpRandN nc = liftUnsafe3 (tExpRandNM nc)++{- | (Undocumented class)++ TLinRandN [ControlRate] lo=0 hi=1 minmax=0 trigger=0; NC INPUT: True, FILTER: TRUE, NONDET+-}+tLinRandNId :: ID a => Int -> a -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+tLinRandNId numChannels z lo hi minmax trigger = mkUgen Nothing [ControlRate] (Right [3]) "TLinRandN" [lo, hi, minmax, trigger] Nothing numChannels (Special 0) (toUid z)++-- | Monad variant of TLinRandN.+tLinRandNM :: Uid m => Int -> Ugen -> Ugen -> Ugen -> Ugen -> m Ugen+tLinRandNM nc = liftUid4 (tLinRandNId nc)++-- | Unsafe variant of TLinRandN.+tLinRandN :: Int -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+tLinRandN nc = liftUnsafe4 (tLinRandNM nc)++{- | (Undocumented class)++ TRandN [ControlRate] lo=0 hi=1 trigger=0; NC INPUT: True, FILTER: TRUE, NONDET+-}+tRandNId :: ID a => Int -> a -> Ugen -> Ugen -> Ugen -> Ugen+tRandNId numChannels z lo hi trigger = mkUgen Nothing [ControlRate] (Right [2]) "TRandN" [lo, hi, trigger] Nothing numChannels (Special 0) (toUid z)++-- | Monad variant of TRandN.+tRandNM :: Uid m => Int -> Ugen -> Ugen -> Ugen -> m Ugen+tRandNM nc = liftUid3 (tRandNId nc)++-- | Unsafe variant of TRandN.+tRandN :: Int -> Ugen -> Ugen -> Ugen -> Ugen+tRandN nc = liftUnsafe3 (tRandNM nc)++{- | (Undocumented class)++ TScramble [InitialisationRate,ControlRate] trigger=0 *inputs=0; MCE=1, FILTER: TRUE, NONDET+-}+tScrambleId :: ID a => a -> Ugen -> Ugen -> Ugen+tScrambleId z trigger inputs = mkUgen Nothing [InitialisationRate, ControlRate] (Right [0]) "TScramble" [trigger] (Just [inputs]) (length (mceChannels inputs) + 0) (Special 0) (toUid z)++-- | Monad variant of TScramble.+tScrambleM :: Uid m => Ugen -> Ugen -> m Ugen+tScrambleM = liftUid2 tScrambleId++-- | Unsafe variant of TScramble.+tScramble :: Ugen -> Ugen -> Ugen+tScramble = liftUnsafe2 tScrambleM++{- | (Undocumented class)++ RTracePlay [ControlRate,AudioRate] bufnum=0 degree=4 rate=0 axis=1+-}+rTracePlay :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+rTracePlay rate bufnum degree rate_ axis = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "RTracePlay" [bufnum, degree, rate_, axis] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ RTraceRd [ControlRate,AudioRate] bufnum=0 degree=4 index=0 axis=1+-}+rTraceRd :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+rTraceRd rate bufnum degree index_ axis = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "RTraceRd" [bufnum, degree, index_, axis] Nothing 1 (Special 0) NoId++{- | differential pulse-code modulation++ RedDPCMdecode [ControlRate,AudioRate] in=0+-}+redDPCMdecode :: Rate -> Ugen -> Ugen+redDPCMdecode rate in_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "RedDPCMdecode" [in_] Nothing 1 (Special 0) NoId++{- | differential pulse-code modulation++ RedDPCMencode [ControlRate,AudioRate] in=0 round=0+-}+redDPCMencode :: Rate -> Ugen -> Ugen -> Ugen+redDPCMencode rate in_ round_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "RedDPCMencode" [in_, round_] Nothing 1 (Special 0) NoId++{- | look before you leap++ RedLbyl [ControlRate,AudioRate] in=0 thresh=0.5 samples=2+-}+redLbyl :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+redLbyl rate in_ thresh samples = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "RedLbyl" [in_, thresh, samples] Nothing 1 (Special 0) NoId++{- | a really bad pseudo-random noise generator++ RedNoise [ControlRate,AudioRate] clock=0+-}+redNoise :: Rate -> Ugen -> Ugen+redNoise rate clock = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "RedNoise" [clock] Nothing 1 (Special 0) NoId++{- | a phasor that can loop++ RedPhasor [ControlRate,AudioRate] trig=0 rate=1 start=0 end=1 loop=0 loopstart=0 loopend=1+-}+redPhasor :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+redPhasor rate trig_ rate_ start end loop loopstart loopend = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "RedPhasor" [trig_, rate_, start, end, loop, loopstart, loopend] Nothing 1 (Special 0) NoId++{- | a phasor that can loop - version2++ RedPhasor2 [ControlRate,AudioRate] trig=0 rate=1 start=0 end=1 loop=0 loopstart=0 loopend=1+-}+redPhasor2 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+redPhasor2 rate trig_ rate_ start end loop loopstart loopend = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "RedPhasor2" [trig_, rate_, start, end, loop, loopstart, loopend] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ RegaliaMitraEQ [AudioRate] in=0 freq=440 rq=0.1 k=0+-}+regaliaMitraEQ :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+regaliaMitraEQ rate in_ freq rq k = mkUgen Nothing [AudioRate] (Left rate) "RegaliaMitraEQ" [in_, freq, rq, k] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ Resonator [AudioRate] input=0 freq=100 position=0.001 resolution=24 structure=0.5 brightness=0.5 damping=0.5; FILTER: TRUE+-}+resonator :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+resonator input freq position resolution structure brightness damping = mkUgen Nothing [AudioRate] (Right [0]) "Resonator" [input, freq, position, resolution, structure, brightness, damping] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ Rongs [AudioRate] trigger=0 sustain=1 f0=0.01 structure=0.5 brightness=0.5 damping=0.75 accent=0.9 stretch=0.5 position=0.15 loss=0.15 modeNum=2 cosFreq=0.25+-}+rongs :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+rongs rate trigger sustain f0 structure brightness damping accent stretch position loss modeNum cosFreq = mkUgen Nothing [AudioRate] (Left rate) "Rongs" [trigger, sustain, f0, structure, brightness, damping, accent, stretch, position, loss, modeNum, cosFreq] Nothing 1 (Special 0) NoId++{- | Rossler chaotic generator++ RosslerL [AudioRate] freq=22050 a=0.2 b=0.2 c=5.7 h=0.05 xi=0.1 yi=0 zi=0+-}+rosslerL :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+rosslerL rate freq a b c h xi yi zi = mkUgen Nothing [AudioRate] (Left rate) "RosslerL" [freq, a, b, c, h, xi, yi, zi] Nothing 3 (Special 0) NoId++{- | (Undocumented class)++ RosslerResL [AudioRate] in=0 stiff=1 freq=22050 a=0.2 b=0.2 c=5.7 h=0.05 xi=0.1 yi=0 zi=0+-}+rosslerResL :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+rosslerResL rate in_ stiff freq a b c h xi yi zi = mkUgen Nothing [AudioRate] (Left rate) "RosslerResL" [in_, stiff, freq, a, b, c, h, xi, yi, zi] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ Rotate [AudioRate] w=0 x=0 y=0 z=0 rotate=0+-}+rotate :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+rotate rate w x y z rotate_ = mkUgen Nothing [AudioRate] (Left rate) "Rotate" [w, x, y, z, rotate_] Nothing 1 (Special 0) NoId++{- | (faulty) SID Sound Chip Simulator++ SID6581f [AudioRate] freqLo0=0 freqHi0=0 pwLo0=0 pwHi0=0 ctrl0=0 atkDcy0=0 susRel0=0 freqLo1=0 freqHi1=0 pwLo1=0 pwHi1=0 ctrl1=0 atkDcy1=0 susRel1=0 freqLo2=0 freqHi2=0 pwLo2=0 pwHi2=0 ctrl2=0 atkDcy2=0 susRel2=0 fcLo=0 fcHi=0 resFilt=0 modeVol=0 rate=1+-}+sid6581f :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+sid6581f rate freqLo0 freqHi0 pwLo0 pwHi0 ctrl0 atkDcy0 susRel0 freqLo1 freqHi1 pwLo1 pwHi1 ctrl1 atkDcy1 susRel1 freqLo2 freqHi2 pwLo2 pwHi2 ctrl2 atkDcy2 susRel2 fcLo fcHi resFilt modeVol rate_ = mkUgen Nothing [AudioRate] (Left rate) "SID6581f" [freqLo0, freqHi0, pwLo0, pwHi0, ctrl0, atkDcy0, susRel0, freqLo1, freqHi1, pwLo1, pwHi1, ctrl1, atkDcy1, susRel1, freqLo2, freqHi2, pwLo2, pwHi2, ctrl2, atkDcy2, susRel2, fcLo, fcHi, resFilt, modeVol, rate_] Nothing 1 (Special 0) NoId++{- | experimental time domain onset detector++ SLOnset [ControlRate] input=0 memorysize1=20 before=5 after=5 threshold=10 hysteresis=10+-}+slOnset :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+slOnset rate input memorysize1 before after threshold hysteresis = mkUgen Nothing [ControlRate] (Left rate) "SLOnset" [input, memorysize1, before, after, threshold, hysteresis] Nothing 1 (Special 0) NoId++{- | Spectral Modeling Synthesis++ SMS [AudioRate] input=0 maxpeaks=80 currentpeaks=80 tolerance=4 noisefloor=0.2 freqmult=1 freqadd=0 formantpreserve=0 useifft=0 ampmult=1 graphicsbufnum=0; FILTER: TRUE+-}+sms :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+sms input maxpeaks currentpeaks tolerance noisefloor freqmult freqadd formantpreserve useifft ampmult graphicsbufnum = mkUgen Nothing [AudioRate] (Right [0]) "SMS" [input, maxpeaks, currentpeaks, tolerance, noisefloor, freqmult, freqadd, formantpreserve, useifft, ampmult, graphicsbufnum] Nothing 2 (Special 0) NoId++{- | Sound Chip Simulator++ SN76489 [AudioRate] tone0=512 tone1=0 tone2=0 noise=0 vol0=15 vol1=0 vol2=0 vol3=0 rate=1+-}+sn76489 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+sn76489 rate tone0 tone1 tone2 noise vol0 vol1 vol2 vol3 rate_ = mkUgen Nothing [AudioRate] (Left rate) "SN76489" [tone0, tone1, tone2, noise, vol0, vol1, vol2, vol3, rate_] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ SOMAreaWr [ControlRate] bufnum=0 inputdata=0 coords=0 netsize=10 numdims=2 nhood=0.5 gate=1+-}+somAreaWr :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+somAreaWr rate bufnum inputdata coords netsize numdims nhood gate_ = mkUgen Nothing [ControlRate] (Left rate) "SOMAreaWr" [bufnum, inputdata, coords, netsize, numdims, nhood, gate_] Nothing 1 (Special 0) NoId++{- | Map an input using a Self-Organising Map++ SOMRd [ControlRate,AudioRate] bufnum=0 inputdata=0 netsize=10 numdims=2 gate=1+-}+somRd :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+somRd rate bufnum inputdata netsize numdims gate_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "SOMRd" [bufnum, inputdata, netsize, numdims, gate_] Nothing 2 (Special 0) NoId++{- | Create (train) a Self-Organising Map++ SOMTrain [ControlRate] bufnum=0 inputdata=0 netsize=10 numdims=2 traindur=5000 nhood=0.5 gate=1 initweight=1+-}+somTrain :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+somTrain rate bufnum inputdata netsize numdims traindur nhood gate_ initweight = mkUgen Nothing [ControlRate] (Left rate) "SOMTrain" [bufnum, inputdata, netsize, numdims, traindur, nhood, gate_, initweight] Nothing 3 (Special 0) NoId++{- | 12db/Oct State Variable Filter++ SVF [ControlRate,AudioRate] signal=0 cutoff=2200 res=0.1 lowpass=1 bandpass=0 highpass=0 notch=0 peak=0; FILTER: TRUE+-}+svf :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+svf signal cutoff res lowpass bandpass highpass notch peak_ = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "SVF" [signal, cutoff, res, lowpass, bandpass, highpass, notch, peak_] Nothing 1 (Special 0) NoId++{- | super-efficient sawtooth oscillator with low aliasing++ SawDPW [ControlRate,AudioRate] freq=440 iphase=0+-}+sawDPW :: Rate -> Ugen -> Ugen -> Ugen+sawDPW rate freq iphase = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "SawDPW" [freq, iphase] Nothing 1 (Special 0) NoId++{- | Perceptual feature modeling sensory dissonance++ SensoryDissonance [ControlRate] fft=0 maxpeaks=100 peakthreshold=0.1 norm=0 clamp=1+-}+sensoryDissonance :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+sensoryDissonance rate fft_ maxpeaks peakthreshold norm clamp = mkUgen Nothing [ControlRate] (Left rate) "SensoryDissonance" [fft_, maxpeaks, peakthreshold, norm, clamp] Nothing 1 (Special 0) NoId++{- | Fuzzy sieve based synthesis++ Sieve1 [ControlRate,AudioRate] bufnum=0 gap=2 alternate=1+-}+sieve1 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+sieve1 rate bufnum gap alternate = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Sieve1" [bufnum, gap, alternate] Nothing 1 (Special 0) NoId++{- | Granular synthesis with sinusoidal grains++ SinGrain [AudioRate] trigger=0 dur=1 freq=440+-}+sinGrain :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+sinGrain rate trigger dur freq = mkUgen Nothing [AudioRate] (Left rate) "SinGrain" [trigger, dur, freq] Nothing 1 (Special 0) NoId++{- | Granular synthesis with sinusoidal grains and user supplied envelope++ SinGrainB [AudioRate] trigger=0 dur=1 freq=440 envbuf=0+-}+sinGrainB :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+sinGrainB rate trigger dur freq envbuf = mkUgen Nothing [AudioRate] (Left rate) "SinGrainB" [trigger, dur, freq, envbuf] Nothing 1 (Special 0) NoId++{- | Granular synthesis with sinusoidal grains with Ambisonic panning and user supplied envelope++ SinGrainBBF [AudioRate] trigger=0 dur=1 freq=440 envbuf=0 azimuth=0 elevation=0 rho=1 wComp=0+-}+sinGrainBBF :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+sinGrainBBF rate trigger dur freq envbuf azimuth elevation rho wComp = mkUgen Nothing [AudioRate] (Left rate) "SinGrainBBF" [trigger, dur, freq, envbuf, azimuth, elevation, rho, wComp] Nothing 4 (Special 0) NoId++{- | Granular synthesis with sinusoidal grains with Ambisonic panning++ SinGrainBF [AudioRate] trigger=0 dur=1 freq=440 azimuth=0 elevation=0 rho=1 wComp=0+-}+sinGrainBF :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+sinGrainBF rate trigger dur freq azimuth elevation rho wComp = mkUgen Nothing [AudioRate] (Left rate) "SinGrainBF" [trigger, dur, freq, azimuth, elevation, rho, wComp] Nothing 4 (Special 0) NoId++{- | Granular synthesis with sinusoidal grains and user supplied envelopes++ SinGrainI [AudioRate] trigger=0 dur=1 freq=440 envbuf1=0 envbuf2=0 ifac=0.5+-}+sinGrainI :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+sinGrainI rate trigger dur freq envbuf1 envbuf2 ifac = mkUgen Nothing [AudioRate] (Left rate) "SinGrainI" [trigger, dur, freq, envbuf1, envbuf2, ifac] Nothing 1 (Special 0) NoId++{- | Granular synthesis with sinusoidal grains with Ambisonic panning and user supplied envelopes++ SinGrainIBF [AudioRate] trigger=0 dur=1 freq=440 envbuf1=0 envbuf2=0 ifac=0.5 azimuth=0 elevation=0 rho=1 wComp=0+-}+sinGrainIBF :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+sinGrainIBF rate trigger dur freq envbuf1 envbuf2 ifac azimuth elevation rho wComp = mkUgen Nothing [AudioRate] (Left rate) "SinGrainIBF" [trigger, dur, freq, envbuf1, envbuf2, ifac, azimuth, elevation, rho, wComp] Nothing 4 (Special 0) NoId++{- | (Undocumented class)++ SinTone [AudioRate] freq=440 phase=0+-}+sinTone :: Rate -> Ugen -> Ugen -> Ugen+sinTone rate freq phase = mkUgen Nothing [AudioRate] (Left rate) "SinTone" [freq, phase] Nothing 1 (Special 0) NoId++{- | port of some ladspa plugins++ SineShaper [AudioRate] in=0 limit=1; FILTER: TRUE+-}+sineShaper :: Ugen -> Ugen -> Ugen+sineShaper in_ limit = mkUgen Nothing [AudioRate] (Right [0]) "SineShaper" [in_, limit] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ SkipNeedle [AudioRate] range=44100 rate=10 offset=0+-}+skipNeedle :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+skipNeedle rate range rate_ offset = mkUgen Nothing [AudioRate] (Left rate) "SkipNeedle" [range, rate_, offset] Nothing 1 (Special 0) NoId++{- | lowpass filter for envelope following++ Slide [ControlRate,AudioRate] in=0 slideup=50 slidedown=3000+-}+slide :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+slide rate in_ slideup slidedown = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Slide" [in_, slideup, slidedown] Nothing 1 (Special 0) NoId++{- | generate cpu spikes++ Slub [ControlRate,AudioRate] trig=0 spike=4.04+-}+slub :: Rate -> Ugen -> Ugen -> Ugen+slub rate trig_ spike = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Slub" [trig_, spike] Nothing 1 (Special 0) NoId++{- | Smooth samplerate and bitrate reduction++ SmoothDecimator [AudioRate] in=0 rate=44100 smoothing=0.5+-}+smoothDecimator :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+smoothDecimator rate in_ rate_ smoothing = mkUgen Nothing [AudioRate] (Left rate) "SmoothDecimator" [in_, rate_, smoothing] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ SoftClipAmp [AudioRate] in=0 pregain=1; FILTER: TRUE+-}+softClipAmp :: Ugen -> Ugen -> Ugen+softClipAmp in_ pregain = mkUgen Nothing [AudioRate] (Right [0]) "SoftClipAmp" [in_, pregain] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ SoftClipAmp4 [AudioRate] in=0 pregain=1; FILTER: TRUE+-}+softClipAmp4 :: Ugen -> Ugen -> Ugen+softClipAmp4 in_ pregain = mkUgen Nothing [AudioRate] (Right [0]) "SoftClipAmp4" [in_, pregain] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ SoftClipAmp8 [AudioRate] in=0 pregain=1; FILTER: TRUE+-}+softClipAmp8 :: Ugen -> Ugen -> Ugen+softClipAmp8 in_ pregain = mkUgen Nothing [AudioRate] (Right [0]) "SoftClipAmp8" [in_, pregain] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ SoftClipper4 [AudioRate] in=0+-}+softClipper4 :: Rate -> Ugen -> Ugen+softClipper4 rate in_ = mkUgen Nothing [AudioRate] (Left rate) "SoftClipper4" [in_] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ SoftClipper8 [AudioRate] in=0+-}+softClipper8 :: Rate -> Ugen -> Ugen+softClipper8 rate in_ = mkUgen Nothing [AudioRate] (Left rate) "SoftClipper8" [in_] Nothing 1 (Special 0) NoId++{- | LPC analizer.++ SonLPC [AudioRate] buff=-1.0 in=0.0 hop=0.5 poles=10.0+-}+sonLPC :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+sonLPC rate buff in_ hop poles = mkUgen Nothing [AudioRate] (Left rate) "SonLPC" [buff, in_, hop, poles] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ SonLPCSynth [AudioRate] chain=-1.0+-}+sonLPCSynth :: Rate -> Ugen -> Ugen+sonLPCSynth rate chain = mkUgen Nothing [AudioRate] (Left rate) "SonLPCSynth" [chain] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ SonLPCSynthIn [AudioRate] chain=-1.0 in=0.0+-}+sonLPCSynthIn :: Rate -> Ugen -> Ugen -> Ugen+sonLPCSynthIn rate chain in_ = mkUgen Nothing [AudioRate] (Left rate) "SonLPCSynthIn" [chain, in_] Nothing 1 (Special 0) NoId++{- | Karplus-Strong via a sorting algorithm++ SortBuf [AudioRate] bufnum=0 sortrate=10 reset=0+-}+sortBuf :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+sortBuf rate bufnum sortrate reset = mkUgen Nothing [AudioRate] (Left rate) "SortBuf" [bufnum, sortrate, reset] Nothing 1 (Special 0) NoId++{- | Spectral feature extraction++ SpectralEntropy [ControlRate] fft=0 fftsize=2048 numbands=1; NC INPUT: True+-}+spectralEntropy :: Int -> Rate -> Ugen -> Ugen -> Ugen -> Ugen+spectralEntropy numChannels rate fft_ fftsize numbands = mkUgen Nothing [ControlRate] (Left rate) "SpectralEntropy" [fft_, fftsize, numbands] Nothing numChannels (Special 0) NoId++{- | (Undocumented class)++ Spreader [AudioRate] in=0 theta=1.5708 filtsPerOctave=8+-}+spreader :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+spreader rate in_ theta filtsPerOctave = mkUgen Nothing [AudioRate] (Left rate) "Spreader" [in_, theta, filtsPerOctave] Nothing 2 (Special 0) NoId++{- | Spruce bud worm model equations++ SpruceBudworm [AudioRate] reset=0 rate=0.1 k1=27.9 k2=1.5 alpha=0.1 beta=10.1 mu=0.3 rho=10.1 initx=0.9 inity=0.1+-}+spruceBudworm :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+spruceBudworm rate reset rate_ k1 k2 alpha beta mu rho initx inity = mkUgen Nothing [AudioRate] (Left rate) "SpruceBudworm" [reset, rate_, k1, k2, alpha, beta, mu, rho, initx, inity] Nothing 2 (Special 0) NoId++{- | Wave squeezer. Maybe a kind of pitch shifter.++ Squiz [ControlRate,AudioRate] in=0 pitchratio=2 zcperchunk=1 memlen=0.1; FILTER: TRUE+-}+squiz :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+squiz in_ pitchratio zcperchunk memlen = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Squiz" [in_, pitchratio, zcperchunk, memlen] Nothing 1 (Special 0) NoId++{- | standard map 2D chaotic generator++ Standard2DC [ControlRate,AudioRate] minfreq=11025 maxfreq=22050 k=1.4 x0=4.97898 y0=5.74734+-}+standard2DC :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+standard2DC rate minfreq maxfreq k x0 y0 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Standard2DC" [minfreq, maxfreq, k, x0, y0] Nothing 1 (Special 0) NoId++{- | standard map 2D chaotic generator++ Standard2DL [ControlRate,AudioRate] minfreq=11025 maxfreq=22050 k=1.4 x0=4.97898 y0=5.74734+-}+standard2DL :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+standard2DL rate minfreq maxfreq k x0 y0 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Standard2DL" [minfreq, maxfreq, k, x0, y0] Nothing 1 (Special 0) NoId++{- | standard map 2D chaotic generator++ Standard2DN [ControlRate,AudioRate] minfreq=11025 maxfreq=22050 k=1.4 x0=4.97898 y0=5.74734+-}+standard2DN :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+standard2DN rate minfreq maxfreq k x0 y0 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "Standard2DN" [minfreq, maxfreq, k, x0, y0] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ StandardTrig [ControlRate,AudioRate] minfreq=5 maxfreq=10 k=1.4 x0=4.97898 y0=5.74734+-}+standardTrig :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+standardTrig rate minfreq maxfreq k x0 y0 = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "StandardTrig" [minfreq, maxfreq, k, x0, y0] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ StkBandedWG [ControlRate,AudioRate] freq=440 instr=0 bowpressure=0 bowmotion=0 integration=0 modalresonance=64 bowvelocity=0 setstriking=0 trig=1+-}+stkBandedWG :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+stkBandedWG rate freq instr bowpressure bowmotion integration modalresonance bowvelocity setstriking trig_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "StkBandedWG" [freq, instr, bowpressure, bowmotion, integration, modalresonance, bowvelocity, setstriking, trig_] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ StkBeeThree [ControlRate,AudioRate] freq=440 op4gain=10 op3gain=20 lfospeed=64 lfodepth=0 adsrtarget=64 trig=1+-}+stkBeeThree :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+stkBeeThree rate freq op4gain op3gain lfospeed lfodepth adsrtarget trig_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "StkBeeThree" [freq, op4gain, op3gain, lfospeed, lfodepth, adsrtarget, trig_] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ StkBlowHole [ControlRate,AudioRate] freq=440 reedstiffness=64 noisegain=20 tonehole=64 register=11 breathpressure=64+-}+stkBlowHole :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+stkBlowHole rate freq reedstiffness noisegain tonehole register breathpressure = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "StkBlowHole" [freq, reedstiffness, noisegain, tonehole, register, breathpressure] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ StkBowed [ControlRate,AudioRate] freq=220 bowpressure=64 bowposition=64 vibfreq=64 vibgain=64 loudness=64 gate=1 attackrate=1 decayrate=1+-}+stkBowed :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+stkBowed rate freq bowpressure bowposition vibfreq vibgain loudness_ gate_ attackrate decayrate = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "StkBowed" [freq, bowpressure, bowposition, vibfreq, vibgain, loudness_, gate_, attackrate, decayrate] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ StkClarinet [ControlRate,AudioRate] freq=440 reedstiffness=64 noisegain=4 vibfreq=64 vibgain=11 breathpressure=64 trig=1+-}+stkClarinet :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+stkClarinet rate freq reedstiffness noisegain vibfreq vibgain breathpressure trig_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "StkClarinet" [freq, reedstiffness, noisegain, vibfreq, vibgain, breathpressure, trig_] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ StkFlute [ControlRate,AudioRate] freq=440 jetDelay=49 noisegain=0.15 jetRatio=0.32+-}+stkFlute :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+stkFlute rate freq jetDelay noisegain jetRatio = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "StkFlute" [freq, jetDelay, noisegain, jetRatio] Nothing 1 (Special 0) NoId++{-+-- | Wrapping Synthesis toolkit.+--+-- StkGlobals [AudioRate] showWarnings=0 printErrors=0 rawfilepath=0+stkGlobals :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+stkGlobals rate showWarnings printErrors rawfilepath = mkUgen Nothing [AudioRate] (Left rate) "StkGlobals" [showWarnings,printErrors,rawfilepath] Nothing 1 (Special 0) NoId+-}++{- | Wrapping Synthesis toolkit.++ StkInst [AudioRate] freq=220 gate=1 onamp=1 offamp=0.5 instNumber=6 *args=0; MCE=1, REORDERS INPUTS: [4,0,1,2,3,5]+-}+stkInst :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+stkInst rate freq gate_ onamp offamp instNumber args = mkUgen Nothing [AudioRate] (Left rate) "StkInst" [freq, gate_, onamp, offamp, instNumber] (Just [args]) 1 (Special 0) NoId++{- | (Undocumented class)++ StkMandolin [ControlRate,AudioRate] freq=520 bodysize=64 pickposition=64 stringdamping=69 stringdetune=10 aftertouch=64 trig=1+-}+stkMandolin :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+stkMandolin rate freq bodysize pickposition stringdamping stringdetune aftertouch trig_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "StkMandolin" [freq, bodysize, pickposition, stringdamping, stringdetune, aftertouch, trig_] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ StkModalBar [ControlRate,AudioRate] freq=440 instrument=0 stickhardness=64 stickposition=64 vibratogain=20 vibratofreq=20 directstickmix=64 volume=64 trig=1+-}+stkModalBar :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+stkModalBar rate freq instrument stickhardness stickposition vibratogain vibratofreq directstickmix volume trig_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "StkModalBar" [freq, instrument, stickhardness, stickposition, vibratogain, vibratofreq, directstickmix, volume, trig_] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ StkMoog [ControlRate,AudioRate] freq=440 filterQ=10 sweeprate=20 vibfreq=64 vibgain=0 gain=64 trig=1+-}+stkMoog :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+stkMoog rate freq filterQ sweeprate vibfreq vibgain gain trig_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "StkMoog" [freq, filterQ, sweeprate, vibfreq, vibgain, gain, trig_] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ StkPluck [ControlRate,AudioRate] freq=440 decay=0.99+-}+stkPluck :: Rate -> Ugen -> Ugen -> Ugen+stkPluck rate freq decay_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "StkPluck" [freq, decay_] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ StkSaxofony [ControlRate,AudioRate] freq=220 reedstiffness=64 reedaperture=64 noisegain=20 blowposition=26 vibratofrequency=20 vibratogain=20 breathpressure=128 trig=1+-}+stkSaxofony :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+stkSaxofony rate freq reedstiffness reedaperture noisegain blowposition vibratofrequency vibratogain breathpressure trig_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "StkSaxofony" [freq, reedstiffness, reedaperture, noisegain, blowposition, vibratofrequency, vibratogain, breathpressure, trig_] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ StkShakers [ControlRate,AudioRate] instr=0 energy=64 decay=64 objects=64 resfreq=64+-}+stkShakers :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+stkShakers rate instr energy decay_ objects resfreq = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "StkShakers" [instr, energy, decay_, objects, resfreq] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ StkVoicForm [ControlRate,AudioRate] freq=440 vuvmix=64 vowelphon=64 vibfreq=64 vibgain=20 loudness=64 trig=1+-}+stkVoicForm :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+stkVoicForm rate freq vuvmix vowelphon vibfreq vibgain loudness_ trig_ = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "StkVoicForm" [freq, vuvmix, vowelphon, vibfreq, vibgain, loudness_, trig_] Nothing 1 (Special 0) NoId++{- | String resonance filter++ Streson [ControlRate,AudioRate] input=0 delayTime=0.003 res=0.9; FILTER: TRUE+-}+streson :: Ugen -> Ugen -> Ugen -> Ugen+streson input delayTime res = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Streson" [input, delayTime, res] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ StringVoice [AudioRate] trig=0 infsustain=0 freq=100 accent=0.5 structure=0.5 brightness=0.5 damping=0.5+-}+stringVoice :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+stringVoice rate trig_ infsustain freq accent structure brightness damping = mkUgen Nothing [AudioRate] (Left rate) "StringVoice" [trig_, infsustain, freq, accent, structure, brightness, damping] Nothing 1 (Special 0) NoId++{- | Pulse counter with floating point steps++ Summer [ControlRate,AudioRate] trig=0 step=1 reset=0 resetval=0; FILTER: TRUE+-}+summer :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+summer trig_ step reset resetval = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "Summer" [trig_, step, reset, resetval] Nothing 1 (Special 0) NoId++{- | feedback delay line implementing switch-and-ramp buffer jumping++ SwitchDelay [AudioRate] in=0 drylevel=1 wetlevel=1 delaytime=1 delayfactor=0.7 maxdelaytime=20; FILTER: TRUE+-}+switchDelay :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+switchDelay in_ drylevel wetlevel delaytime delayfactor maxdelaytime = mkUgen Nothing [AudioRate] (Right [0]) "SwitchDelay" [in_, drylevel, wetlevel, delaytime, delayfactor, maxdelaytime] Nothing 1 (Special 0) NoId++{- | triggered beta random distribution++ TBetaRand [ControlRate,AudioRate] lo=0 hi=1 prob1=0 prob2=0 trig=0; FILTER: TRUE, NONDET+-}+tBetaRandId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+tBetaRandId z lo hi prob1 prob2 trig_ = mkUgen Nothing [ControlRate, AudioRate] (Right [4]) "TBetaRand" [lo, hi, prob1, prob2, trig_] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of TBetaRand.+tBetaRandM :: Uid m => Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> m Ugen+tBetaRandM = liftUid5 tBetaRandId++-- | Unsafe variant of TBetaRand.+tBetaRand :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+tBetaRand = liftUnsafe5 tBetaRandM++{- | triggered random walk generator++ TBrownRand [ControlRate,AudioRate] lo=0 hi=1 dev=1 dist=0 trig=0; FILTER: TRUE, NONDET+-}+tBrownRandId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+tBrownRandId z lo hi dev dist trig_ = mkUgen Nothing [ControlRate, AudioRate] (Right [4]) "TBrownRand" [lo, hi, dev, dist, trig_] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of TBrownRand.+tBrownRandM :: Uid m => Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> m Ugen+tBrownRandM = liftUid5 tBrownRandId++-- | Unsafe variant of TBrownRand.+tBrownRand :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+tBrownRand = liftUnsafe5 tBrownRandM++{- | triggered gaussian random distribution++ TGaussRand [ControlRate,AudioRate] lo=0 hi=1 trig=0; FILTER: TRUE, NONDET+-}+tGaussRandId :: ID a => a -> Ugen -> Ugen -> Ugen -> Ugen+tGaussRandId z lo hi trig_ = mkUgen Nothing [ControlRate, AudioRate] (Right [2]) "TGaussRand" [lo, hi, trig_] Nothing 1 (Special 0) (toUid z)++-- | Monad variant of TGaussRand.+tGaussRandM :: Uid m => Ugen -> Ugen -> Ugen -> m Ugen+tGaussRandM = liftUid3 tGaussRandId++-- | Unsafe variant of TGaussRand.+tGaussRand :: Ugen -> Ugen -> Ugen -> Ugen+tGaussRand = liftUnsafe3 tGaussRandM++{- | buffer granulator with linear att/dec++ TGrains2 [AudioRate] trigger=0 bufnum=0 rate=1 centerPos=0 dur=0.1 pan=0 amp=0.1 att=0.5 dec=0.5 interp=4; NC INPUT: True+-}+tGrains2 :: Int -> Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+tGrains2 numChannels rate trigger bufnum rate_ centerPos dur pan amp att dec interp = mkUgen Nothing [AudioRate] (Left rate) "TGrains2" [trigger, bufnum, rate_, centerPos, dur, pan, amp, att, dec, interp] Nothing numChannels (Special 0) NoId++{- | buffer granulator with user envelope++ TGrains3 [AudioRate] trigger=0 bufnum=0 rate=1 centerPos=0 dur=0.1 pan=0 amp=0.1 att=0.5 dec=0.5 window=1 interp=4; NC INPUT: True+-}+tGrains3 :: Int -> Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+tGrains3 numChannels rate trigger bufnum rate_ centerPos dur pan amp att dec window interp = mkUgen Nothing [AudioRate] (Left rate) "TGrains3" [trigger, bufnum, rate_, centerPos, dur, pan, amp, att, dec, window, interp] Nothing numChannels (Special 0) NoId++{- | Tracking Phase Vocoder++ TPV [AudioRate] chain=0 windowsize=1024 hopsize=512 maxpeaks=80 currentpeaks=0 freqmult=1 tolerance=4 noisefloor=0.2+-}+tpv :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+tpv chain windowsize hopsize maxpeaks currentpeaks freqmult tolerance noisefloor = mkUgen Nothing [AudioRate] (Left AudioRate) "TPV" [chain, windowsize, hopsize, maxpeaks, currentpeaks, freqmult, tolerance, noisefloor] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ TTendency [ControlRate,AudioRate] trigger=0 dist=0 parX=0 parY=1 parA=0 parB=0+-}+tTendency :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+tTendency rate trigger dist parX parY parA parB = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "TTendency" [trigger, dist, parX, parY, parA, parB] Nothing 1 (Special 0) NoId++{- | pitch tracker++ Tartini [ControlRate] in=0 threshold=0.93 n=2048 k=0 overlap=1024 smallCutoff=0.5+-}+tartini :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+tartini rate in_ threshold n k overlap smallCutoff = mkUgen Nothing [ControlRate] (Left rate) "Tartini" [in_, threshold, n, k, overlap, smallCutoff] Nothing 2 (Special 0) NoId++{- | Neural Oscillator++ TermanWang [AudioRate] input=0 reset=0 ratex=0.01 ratey=0.01 alpha=1 beta=1 eta=1 initx=0 inity=0+-}+termanWang :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+termanWang rate input reset ratex ratey alpha beta eta initx inity = mkUgen Nothing [AudioRate] (Left rate) "TermanWang" [input, reset, ratex, ratey, alpha, beta, eta, initx, inity] Nothing 1 (Special 0) NoId++{- | display level of a Ugen as a textual meter++ TextVU [ControlRate,AudioRate] trig=2 in=0 label=0 width=21 reset=0 ana=0+-}+textVU :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+textVU rate trig_ in_ label_ width reset ana = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "TextVU" [trig_, in_, label_, width, reset, ana] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ Tilt [AudioRate] w=0 x=0 y=0 z=0 tilt=0+-}+tilt :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+tilt rate w x y z tilt_ = mkUgen Nothing [AudioRate] (Left rate) "Tilt" [w, x, y, z, tilt_] Nothing 1 (Special 0) NoId++{- | triggered signal averager++ TrigAvg [ControlRate] in=0 trig=0+-}+trigAvg :: Rate -> Ugen -> Ugen -> Ugen+trigAvg rate in_ trig_ = mkUgen Nothing [ControlRate] (Left rate) "TrigAvg" [in_, trig_] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ Tumble [AudioRate] w=0 x=0 y=0 z=0 tilt=0+-}+tumble :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+tumble rate w x y z tilt_ = mkUgen Nothing [AudioRate] (Left rate) "Tumble" [w, x, y, z, tilt_] Nothing 1 (Special 0) NoId++{- | physical modeling simulation; two tubes++ TwoTube [AudioRate] input=0 k=0.01 loss=1 d1length=100 d2length=100+-}+twoTube :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+twoTube rate input k loss d1length d2length = mkUgen Nothing [AudioRate] (Left rate) "TwoTube" [input, k, loss, d1length, d2length] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ UHJ2B [AudioRate] ls=0 rs=0+-}+uhj2b :: Rate -> Ugen -> Ugen -> Ugen+uhj2b rate ls rs = mkUgen Nothing [AudioRate] (Left rate) "UHJ2B" [ls, rs] Nothing 3 (Special 0) NoId++{- | Vector Base Amplitude Panner++ VBAP [ControlRate,AudioRate] in=0 bufnum=0 azimuth=0 elevation=1 spread=0; NC INPUT: True+-}+vbap :: Int -> Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+vbap numChannels rate in_ bufnum azimuth elevation spread = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "VBAP" [in_, bufnum, azimuth, elevation, spread] Nothing numChannels (Special 0) NoId++{- | a Chebyshev low/highpass filter++ VBChebyFilt [AudioRate] in=0 freq=880 mode=0 order=4+-}+vbChebyFilt :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+vbChebyFilt rate in_ freq mode order = mkUgen Nothing [AudioRate] (Left rate) "VBChebyFilt" [in_, freq, mode, order] Nothing 1 (Special 0) NoId++{- | a chaotic oscillator network++ VBFourses [AudioRate] smoother=0.5 *freqarray=0; MCE=1, REORDERS INPUTS: [1,0]+-}+vbFourses :: Rate -> Ugen -> Ugen -> Ugen+vbFourses rate smoother freqarray = mkUgen Nothing [AudioRate] (Left rate) "VBFourses" [smoother] (Just [freqarray]) 4 (Special 0) NoId++{- | artifical reverberator++ VBJonVerb [AudioRate] in=0 decay=0.6 damping=0.3 inputbw=0.8 erfl=0.5 tail=0.5; FILTER: TRUE+-}+vbJonVerb :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+vbJonVerb in_ decay_ damping inputbw erfl tail_ = mkUgen Nothing [AudioRate] (Right [0]) "VBJonVerb" [in_, decay_, damping, inputbw, erfl, tail_] Nothing 2 (Special 0) NoId++{- | a simple phase vocoder for time-stretching++ VBPVoc [AudioRate] numChannels=0 bufnum=0 playpos=0 fftsize=2048+-}+vbpVoc :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+vbpVoc rate numChannels bufnum playpos fftsize = mkUgen Nothing [AudioRate] (Left rate) "VBPVoc" [numChannels, bufnum, playpos, fftsize] Nothing 1 (Special 0) NoId++{- | lowpass filter for envelope following++ VBSlide [KR,AR] in=0.0 slideup=50.0 slidedown=3000.0; FILTER: TRUE+-}+vbSlide :: Ugen -> Ugen -> Ugen -> Ugen+vbSlide in_ slideup slidedown = mkUgen Nothing [ControlRate, AudioRate] (Right [0]) "VBSlide" [in_, slideup, slidedown] Nothing 1 (Special 0) NoId++{- | 2D scanning pattern virtual machine++ VMScan2D [AudioRate] bufnum=0+-}+vmScan2D :: Rate -> Ugen -> Ugen+vmScan2D rate bufnum = mkUgen Nothing [AudioRate] (Left rate) "VMScan2D" [bufnum] Nothing 2 (Special 0) NoId++{- | vosim pulse generator++ VOSIM [AudioRate] trig=0.1 freq=400 nCycles=1 decay=0.9+-}+vosim :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+vosim rate trig_ freq nCycles decay_ = mkUgen Nothing [AudioRate] (Left rate) "VOSIM" [trig_, freq, nCycles, decay_] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ VarShapeOsc [ControlRate,AudioRate] freq=100 pw=0.5 waveshape=0.5 sync=1 syncfreq=105+-}+varShapeOsc :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+varShapeOsc rate freq pw waveshape sync syncfreq = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "VarShapeOsc" [freq, pw, waveshape, sync, syncfreq] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ VosimOsc [ControlRate,AudioRate] freq=100 form1freq=951 form2freq=919 shape=0+-}+vosimOsc :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+vosimOsc rate freq form1freq form2freq shape = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "VosimOsc" [freq, form1freq, form2freq, shape] Nothing 1 (Special 0) NoId++{- | windowed amplitude follower++ WAmp [ControlRate] in=0 winSize=0.1+-}+wAmp :: Rate -> Ugen -> Ugen -> Ugen+wAmp rate in_ winSize = mkUgen Nothing [ControlRate] (Left rate) "WAmp" [in_, winSize] Nothing 1 (Special 0) NoId++{- | decomposition into square waves, and reconstruction++ WalshHadamard [AudioRate] input=0 which=0+-}+walshHadamard :: Rate -> Ugen -> Ugen -> Ugen+walshHadamard rate input which = mkUgen Nothing [AudioRate] (Left rate) "WalshHadamard" [input, which] Nothing 1 (Special 0) NoId++{- | Warp a buffer with a time pointer++ WarpZ [AudioRate] bufnum=0 pointer=0 freqScale=1 windowSize=0.2 envbufnum=-1 overlaps=8 windowRandRatio=0 interp=1 zeroSearch=0 zeroStart=0; NC INPUT: True+-}+warpZ :: Int -> Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+warpZ numChannels rate bufnum pointer freqScale windowSize envbufnum overlaps windowRandRatio interp zeroSearch zeroStart = mkUgen Nothing [AudioRate] (Left rate) "WarpZ" [bufnum, pointer, freqScale, windowSize, envbufnum, overlaps, windowRandRatio, interp, zeroSearch, zeroStart] Nothing numChannels (Special 0) NoId++{- | Lose bits of your waves++ WaveLoss [ControlRate,AudioRate] in=0 drop=20 outof=40 mode=1+-}+waveLoss :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+waveLoss rate in_ drop_ outof mode = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "WaveLoss" [in_, drop_, outof, mode] Nothing 1 (Special 0) NoId++{- | wave terrain synthesis++ WaveTerrain [AudioRate] bufnum=0 x=0 y=0 xsize=100 ysize=100+-}+waveTerrain :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+waveTerrain rate bufnum x y xsize ysize = mkUgen Nothing [AudioRate] (Left rate) "WaveTerrain" [bufnum, x, y, xsize, ysize] Nothing 1 (Special 0) NoId++{- | decomposition into Daub4 wavelets, and reconstruction++ WaveletDaub [AudioRate] input=0 n=64 which=0+-}+waveletDaub :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+waveletDaub rate input n which = mkUgen Nothing [AudioRate] (Left rate) "WaveletDaub" [input, n, which] Nothing 1 (Special 0) NoId++{- | Weakly Nonlinear Oscillator++ WeaklyNonlinear [AudioRate] input=0 reset=0 ratex=1 ratey=1 freq=440 initx=0 inity=0 alpha=0 xexponent=0 beta=0 yexponent=0+-}+weaklyNonlinear :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+weaklyNonlinear rate input reset ratex ratey freq initx inity alpha xexponent beta yexponent = mkUgen Nothing [AudioRate] (Left rate) "WeaklyNonlinear" [input, reset, ratex, ratey, freq, initx, inity, alpha, xexponent, beta, yexponent] Nothing 1 (Special 0) NoId++{- | Weakly Nonlinear Oscillator++ WeaklyNonlinear2 [AudioRate] input=0 reset=0 ratex=1 ratey=1 freq=440 initx=0 inity=0 alpha=0 xexponent=0 beta=0 yexponent=0+-}+weaklyNonlinear2 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+weaklyNonlinear2 rate input reset ratex ratey freq initx inity alpha xexponent beta yexponent = mkUgen Nothing [AudioRate] (Left rate) "WeaklyNonlinear2" [input, reset, ratex, ratey, freq, initx, inity, alpha, xexponent, beta, yexponent] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ Werner [AudioRate] input=0 freq=0.5 damp=0.5 feedback=0.5 drive=0 oversample=1+-}+werner :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+werner rate input freq damp feedback drive oversample = mkUgen Nothing [AudioRate] (Left rate) "Werner" [input, freq, damp, feedback, drive, oversample] Nothing 1 (Special 0) NoId++{- | Pulse counter with floating point steps++ WrapSummer [ControlRate,AudioRate] trig=0 step=1 min=0 max=1 reset=0 resetval=0+-}+wrapSummer :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+wrapSummer rate trig_ step min_ max_ reset resetval = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "WrapSummer" [trig_, step, min_, max_, reset, resetval] Nothing 1 (Special 0) NoId++{- | (Undocumented class)++ ZOsc [ControlRate,AudioRate] freq=100 formantfreq=91 shape=0.5 mode=0.5+-}+zOsc :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+zOsc rate freq formantfreq shape mode = mkUgen Nothing [ControlRate, AudioRate] (Left rate) "ZOsc" [freq, formantfreq, shape, mode] Nothing 1 (Special 0) NoId
+ Sound/Sc3/Ugen/Bindings/Hw.hs view
@@ -0,0 +1,77 @@+-- | Hand-written bindings.+module Sound.Sc3.Ugen.Bindings.Hw where++import Sound.Sc3.Common.Rate+import Sound.Sc3.Common.Uid+import Sound.Sc3.Common.Unsafe++import qualified Sound.Sc3.Ugen.Bindings.Hw.Construct as C+import Sound.Sc3.Ugen.Types+import qualified Sound.Sc3.Ugen.Util as Util++{- | Zero local buffer.++ClearBuf does not copy the buffer number through so this is an Mrg node.+-}+clearBuf :: Ugen -> Ugen+clearBuf b = Util.mrg2 b (C.mkOsc ir "ClearBuf" [b] 1)++-- | Demand rate weighted random sequence generator.+dwrandId :: ID i => i -> Ugen -> Ugen -> Ugen -> Ugen+dwrandId z repeats weights list_ =+ let n = mceDegree_err list_+ weights' = mceExtend n weights+ inp = repeats : constant n : weights'+ in mkUgen Nothing [dr] (Left dr) "Dwrand" inp (Just [list_]) 1 (Special 0) (Util.toUid z)++dwrandM :: Uid m => Ugen -> Ugen -> Ugen -> m Ugen+dwrandM = liftUid3 dwrandId++dwrand :: Ugen -> Ugen -> Ugen -> Ugen+dwrand = liftUnsafe3 dwrandM++-- | Variant on 'envGen' without enumeration types.+envGen_ll :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+envGen_ll rate gate_ levelScale levelBias timeScale doneAction envelope_ = mkUgen Nothing [kr, ar] (Left rate) "EnvGen" [gate_, levelScale, levelBias, timeScale, doneAction] (Just [envelope_]) 1 (Special 0) NoId++-- | Outputs signal for @FFT@ chains, without performing FFT.+fftTrigger :: Ugen -> Ugen -> Ugen -> Ugen+fftTrigger b h p = C.mkOsc kr "FFTTrigger" [b, h, p] 1++-- | Pack demand-rate FFT bin streams into an FFT chain.+packFFT :: Ugen -> Int -> Int -> Int -> Ugen -> Ugen -> Ugen+packFFT b sz from to z mp =+ let n = constant (mceDegree_err mp)+ in C.mkOscMCE kr "PackFFT" [b, constant sz, constant from, constant to, z, n] mp 1++-- | Poll value of input Ugen when triggered.+poll :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+poll trig_ in_ trigid label_ =+ let q = Util.unpackLabel True label_+ in C.mkFilter "Poll" ([trig_, in_, trigid] ++ q) 0++-- | FFT onset detector.+pv_HainsworthFoote :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_HainsworthFoote buf h f thr wt = C.mkOsc ar "PV_HainsworthFoote" [buf, h, f, thr, wt] 1++{- | FFT feature detector for onset detection.++buffer, propsc=0.25, prophfe=0.25, prophfc=0.25, propsf=0.25, threshold=1.0, waittime=0.04+-}+pv_JensenAndersen :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+pv_JensenAndersen buffer propsc prophfe prophfc propsf threshold waittime = C.mkOsc ar "PV_JensenAndersen" [buffer, propsc, prophfe, prophfc, propsf, threshold, waittime] 1++{- | Ascii string to length prefixed list of constant Ugens.++> string_to_ugens "/label" == map fromIntegral [6,47,108,97,98,101,108]+-}+string_to_ugens :: String -> [Ugen]+string_to_ugens nm = fromIntegral (length nm) : map (fromIntegral . fromEnum) nm++-- | Send a reply message from the server back to all registered clients.+sendReply :: Ugen -> Ugen -> String -> [Ugen] -> Ugen+sendReply i k n v = C.mkFilter "SendReply" ([i, k] ++ string_to_ugens n ++ v) 0++-- | Unpack a single value (magnitude or phase) from an FFT chain+unpack1FFT :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+unpack1FFT buf size index_ which = C.mkOsc dr "Unpack1FFT" [buf, size, index_, which] 1
+ Sound/Sc3/Ugen/Bindings/Hw/Construct.hs view
@@ -0,0 +1,83 @@+-- | For hand-writing Ugens.+module Sound.Sc3.Ugen.Bindings.Hw.Construct where++import Sound.Sc3.Common.Rate++import Sound.Sc3.Ugen.Types++-- | Oscillator constructor with constrained set of operating 'Rate's.+mk_osc :: [Rate] -> UgenId -> Rate -> String -> [Ugen] -> Int -> Ugen+mk_osc rs z r c i o =+ if r `elem` rs+ then mkUgen Nothing rs (Left r) c i Nothing o (Special 0) z+ else error ("mk_osc: rate restricted: " ++ show (r, rs, c))++-- | Oscillator constructor with 'all_rates'.+mkOsc :: Rate -> String -> [Ugen] -> Int -> Ugen+mkOsc = mk_osc all_rates no_id++-- | Oscillator constructor, rate restricted variant.+mkOscR :: [Rate] -> Rate -> String -> [Ugen] -> Int -> Ugen+mkOscR rs = mk_osc rs no_id++-- | Rate restricted oscillator constructor, setting identifier.+mkOscIdR :: [Rate] -> UgenId -> Rate -> String -> [Ugen] -> Int -> Ugen+mkOscIdR = mk_osc++-- | Oscillator constructor, setting identifier.+mkOscId :: UgenId -> Rate -> String -> [Ugen] -> Int -> Ugen+mkOscId = mk_osc all_rates++-- | Provided 'UgenId' variant of 'mkOscMCE'.+mk_osc_mce :: UgenId -> Rate -> String -> [Ugen] -> Ugen -> Int -> Ugen+mk_osc_mce z r c i j =+ let i' = i ++ mceChannels j+ in mk_osc all_rates z r c i'++-- | Variant oscillator constructor with MCE collapsing input.+mkOscMCE :: Rate -> String -> [Ugen] -> Ugen -> Int -> Ugen+mkOscMCE = mk_osc_mce no_id++-- | Variant oscillator constructor with MCE collapsing input.+mkOscMCEId :: UgenId -> Rate -> String -> [Ugen] -> Ugen -> Int -> Ugen+mkOscMCEId = mk_osc_mce++-- | Rate constrained filter 'Ugen' constructor.+mk_filter :: [Rate] -> [Int] -> UgenId -> String -> [Ugen] -> Int -> Ugen+mk_filter rs ix z c i o = mkUgen Nothing rs (Right ix) c i Nothing o (Special 0) z++-- | Filter Ugen constructor.+mkFilterIdR :: [Rate] -> UgenId -> String -> [Ugen] -> Int -> Ugen+mkFilterIdR rs z nm i = mk_filter rs [0 .. length i - 1] z nm i++-- | Filter Ugen constructor.+mkFilterR :: [Rate] -> String -> [Ugen] -> Int -> Ugen+mkFilterR rs = mkFilterIdR rs no_id++-- | Filter 'Ugen' constructor.+mkFilter :: String -> [Ugen] -> Int -> Ugen+mkFilter = mkFilterR all_rates++-- | Filter Ugen constructor.+mkFilterId :: UgenId -> String -> [Ugen] -> Int -> Ugen+mkFilterId = mkFilterIdR all_rates++-- | Provided 'UgenId' filter with 'mce' input.+mk_filter_mce :: [Rate] -> UgenId -> String -> [Ugen] -> Ugen -> Int -> Ugen+mk_filter_mce rs z c i j = mkFilterIdR rs z c (i ++ mceChannels j)++-- | Variant filter constructor with MCE collapsing input.+mkFilterMCER :: [Rate] -> String -> [Ugen] -> Ugen -> Int -> Ugen+mkFilterMCER rs = mk_filter_mce rs no_id++-- | Variant filter constructor with MCE collapsing input.+mkFilterMCE :: String -> [Ugen] -> Ugen -> Int -> Ugen+mkFilterMCE = mk_filter_mce all_rates no_id++-- | Variant filter constructor with MCE collapsing input.+mkFilterMCEId :: UgenId -> String -> [Ugen] -> Ugen -> Int -> Ugen+mkFilterMCEId = mk_filter_mce all_rates++-- | Information unit generators are very specialized.+mkInfo :: String -> Ugen+mkInfo name = mkOsc InitialisationRate name [] 1
+ Sound/Sc3/Ugen/Bindings/Hw/External.hs view
@@ -0,0 +1,6 @@+-- | Bindings to unit generators not distributed with SuperCollider proper.+module Sound.Sc3.Ugen.Bindings.Hw.External (module U) where++import Sound.Sc3.Ugen.Bindings.Hw.External.F0 as U+import Sound.Sc3.Ugen.Bindings.Hw.External.Sc3_Plugins as U+import Sound.Sc3.Ugen.Bindings.Hw.External.Zita as U
+ Sound/Sc3/Ugen/Bindings/Hw/External/F0.hs view
@@ -0,0 +1,26 @@+-- | F0 Ugens (f0plugins)+module Sound.Sc3.Ugen.Bindings.Hw.External.F0 where++import Sound.Sc3.Common.Rate+import qualified Sound.Sc3.Ugen.Bindings.Hw.Construct as C+import Sound.Sc3.Ugen.Ugen++-- | Emulation of the sound generation hardware of the Atari TIA chip.+atari2600 :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+atari2600 audc0 audc1 audf0 audf1 audv0 audv1 rate = C.mkOsc ar "Atari2600" [audc0, audc1, audf0, audf1, audv0, audv1, rate] 1++-- | POKEY Chip Sound Simulator+mzPokey :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+mzPokey f1 c1 f2 c2 f3 c3 f4 c4 ctl = C.mkOsc ar "MZPokey" [f1, c1, f2, c2, f3, c3, f4, c4, ctl] 1++-- | A phasor that can loop.+redPhasor :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+redPhasor rate trig rate_ start end loop loopstart loopend = C.mkOsc rate "RedPhasor" [trig, rate_, start, end, loop, loopstart, loopend] 1++-- | A phasor that can loop.+redPhasor2 :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+redPhasor2 rate trig rate_ start end loop loopstart loopend = C.mkOsc rate "RedPhasor2" [trig, rate_, start, end, loop, loopstart, loopend] 1++-- Local Variables:+-- truncate-lines:t+-- End:
+ Sound/Sc3/Ugen/Bindings/Hw/External/Sc3_Plugins.hs view
@@ -0,0 +1,69 @@+-- | Bindings to unit generators in sc3-plugins.+module Sound.Sc3.Ugen.Bindings.Hw.External.Sc3_Plugins where++import Sound.Sc3.Common.Rate++import qualified Sound.Sc3.Ugen.Bindings.Db.External as X+import qualified Sound.Sc3.Ugen.Bindings.Hw.Construct as C+import Sound.Sc3.Ugen.Types+import qualified Sound.Sc3.Ugen.Util as Util++-- | Convert frequency value to value appropriate for Ay tone inputs.+ayFreqToTone :: Fractional a => a -> a+ayFreqToTone f = 110300 / (f - 0.5)++-- | Ladspa plugins inside SuperCollider.+ladspa :: Int -> Rate -> Ugen -> [Ugen] -> Ugen+ladspa nc rt k z = C.mkOsc rt "LADSPA" (constant nc : k : z) nc++-- | Lookup index of Stk instrument by name.+stkAt :: (Num t, Enum t) => String -> t+stkAt nm =+ let nm_seq =+ [ "Clarinet"+ , "BlowHole"+ , "Saxofony"+ , "Flute"+ , "Brass"+ , "BlowBotl"+ , "Bowed"+ , "Plucked"+ , "StifKarp"+ , "Sitar"+ , "Mandolin"+ , "Rhodey"+ , "Wurley"+ , "TubeBell"+ , "HevyMetl"+ , "PercFlut"+ , "BeeThree"+ , "FMVoices"+ , "VoicForm"+ , "Moog"+ , "Simple"+ , "Drummer"+ , "BandedWG"+ , "Shakers"+ , "ModalBar"+ , "Mesh2D"+ , "Resonate"+ , "Whistle"+ ]+ tbl = zip nm_seq [0 ..]+ in case lookup nm tbl of+ Just ix -> ix+ Nothing -> error "stkAt: unknown instr"++-- | freq=220, gate=1, onamp=1, offamp=1, bowpressure=64, bowposition=64, vibfreq=64, vibgain=64, loudness=64+stkBowedI :: Rate -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+stkBowedI rt freq gate_ onamp offamp bowpressure bowposition vibfreq vibgain loudness =+ let args = mce [2, bowpressure, 4, bowposition, 11, vibfreq, 1, vibgain, 128, loudness]+ in X.stkInst rt (stkAt "Bowed") freq gate_ onamp offamp args++{- | Wrapping Synthesis toolkit.++ StkGlobals [ar] showWarnings=0.0 printErrors=0.0 rawfilepath=0.0+-}+stkGlobals :: Rate -> Ugen -> Ugen -> Ugen -> Ugen+stkGlobals rate showWarnings printErrors rawfilepath =+ mkUgen Nothing [ar] (Left rate) "StkGlobals" ([showWarnings, printErrors] ++ Util.unpackLabel False rawfilepath) Nothing 1 (Special 0) NoId
+ Sound/Sc3/Ugen/Bindings/Hw/External/Wavelets.hs view
@@ -0,0 +1,30 @@+-- | Wavelet unit generators (Nick Collins).+module Sound.Sc3.Ugen.Bindings.Hw.External.Wavelets where++import Sound.Sc3.Common.Rate+import Sound.Sc3.Ugen.Bindings.Hw.Construct+import Sound.Sc3.Ugen.Ugen++-- | Forward wavelet transform.+dwt :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+dwt buf i h wnt a wns wlt = mkOsc kr "DWT" [buf, i, h, wnt, a, wns, wlt] 1++-- | Inverse of 'dwt'.+idwt :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen+idwt buf wnt wns wlt = mkOsc ar "IDWT" [buf, wnt, wns, wlt] 1++-- | Pass wavelets above a threshold, ie. 'pv_MagAbove'.+wt_MagAbove :: Ugen -> Ugen -> Ugen+wt_MagAbove buf thr = mkOsc kr "WT_MagAbove" [buf, thr] 1++-- | Pass wavelets with /scale/ above threshold.+wt_FilterScale :: Ugen -> Ugen -> Ugen+wt_FilterScale buf wp = mkOsc kr "WT_FilterScale" [buf, wp] 1++-- | Pass wavelets with /time/ above threshold.+wt_TimeWipe :: Ugen -> Ugen -> Ugen+wt_TimeWipe buf wp = mkOsc kr "WT_TimeWipe" [buf, wp] 1++-- | Product in /W/ domain, ie. 'pv_Mul'.+wt_Mul :: Ugen -> Ugen -> Ugen+wt_Mul ba bb = mkOsc kr "WT_Mul" [ba, bb] 1
+ Sound/Sc3/Ugen/Bindings/Hw/External/Zita.hs view
@@ -0,0 +1,29 @@+{- | Zita Ugen definitions.++See hsc3/ext/faust to build the SC3 plugin.+-}+module Sound.Sc3.Ugen.Bindings.Hw.External.Zita where++import Sound.Sc3.Common.Rate+import Sound.Sc3.Ugen.Bindings.Hw.Construct+import Sound.Sc3.Ugen.Ugen++-- | Parameter (name,value) pairs.+zitaRev_param :: Num n => [(String, n, (n, n, String))]+zitaRev_param =+ [ ("in_delay", 60, (20, 100, "lin")) -- ms+ , ("lf_x", 200, (50, 1000, "exp"))+ , ("low_rt60", 3, (1, 8, "exp"))+ , ("mid_rt60", 2, (1, 8, "exp"))+ , ("hf_damping", 6000, (1500, 24000, "exp"))+ , ("eq1_freq", 315, (40, 2500, "exp"))+ , ("eq1_level", 0, (-15, 15, "lin"))+ , ("eq2_freq", 1500, (160, 10000, "exp"))+ , ("eq2_level", 0, (-15, 15, "lin"))+ , ("dry_wet_mix", 0, (0, 1, "lin"))+ , ("level", -20, (-9, 9, "lin"))+ ]++-- | ZitaRev binding.+zitaRev :: Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen -> Ugen+zitaRev in1 in2 in_delay lf_x low_rt60 mid_rt60 hf_damping eq1_freq eq1_level eq2_freq eq2_level dry_wet_mix level = mkFilterR [ar] "FaustZitaRev" [in1, in2, in_delay, lf_x, low_rt60, mid_rt60, hf_damping, eq1_freq, eq1_level, eq2_freq, eq2_level, dry_wet_mix, level] 2
+ Sound/Sc3/Ugen/Bracketed.hs view
@@ -0,0 +1,109 @@+{- | Bracketed Ugens.++ScSynth is controlled by sending instructions in the form of Open Sound Control (Osc) messages.+One family of messages allocate, set and free Buffers.+Ugen graphs that utilise Buffers don't contain the messages to manage them.+These messages are ordinarily written and sent outside of the graph context.++The bracketUgen function attaches a pair of Osc message sequences to a Ugen value.+The first sequence is to be sent before the graph the Ugen belongs to is started, the other after it has ended.+The messages are stored in the Ugen type, but are not written to the SynthDef file representing the Ugen graph.+The scsynthPlayAt function reads and sends Ugen bracket messages, in addition to the Ugen graph itself.++The functions defined here return Ugen values with brackets attached to them.+-}+module Sound.Sc3.Ugen.Bracketed where++import Sound.Sc3.Common.Enum {- hsc3 -}+import Sound.Sc3.Common.Rate {- hsc3 -}+import Sound.Sc3.Common.SoundFile {- hsc3 -}++import Sound.Sc3.Ugen.Bindings.Db {- hsc3 -}+import Sound.Sc3.Ugen.Ugen {- hsc3 -}+import Sound.Sc3.Ugen.Util {- hsc3 -}++import Sound.Sc3.Server.Command.Plain {- hsc3 -}+import Sound.Sc3.Server.Enum {- hsc3 -}++{- | sfNc is the number of channels at a sound file.+ readChan is a list of channels indexed to read.+ Returns a channel count, either sfNc or the length of readChan.+ If readChan in empty returns sfNc, else returns the length of readChan.+ This function checks that requested channels are in range.+-}+readChanToNc :: Int -> [Int] -> Int+readChanToNc sfNc readChan =+ if null readChan+ then sfNc+ else+ if maximum readChan < sfNc+ then length readChan+ else error "readChanToNc: channel error"++{- | diskIn or vDiskIn with brackets to 1. allocate and read and then 2. close and free buffer.+ If ctlName is empty the buffer is returned as a constant, else as a control with the given name.+ Ignoring the brackets, this is equivalent to writing a diskIn or vDiskIn Ugen,+ with the number of channels given by readChan or derived from the named file.+ If readChan is empty all channels are read.+-}+sndfileDiskIn :: (String, Buffer_Id, [Int]) -> FilePath -> Maybe Ugen -> Loop Ugen -> Ugen+sndfileDiskIn (ctlName, bufId, readChan) sndFileName maybeRate loop =+ let fileName = sfResolve sndFileName+ (sfNc, _sr, _nf) = sfInfo fileName+ bufSize = 65536+ buf = if null ctlName then constant bufId else control kr ctlName (fromIntegral bufId)+ bufNc = readChanToNc sfNc readChan+ in bracketUgen+ (maybe (diskIn bufNc buf loop) (\rate -> vDiskIn bufNc buf rate loop 0) maybeRate)+ ( [b_alloc bufId bufSize bufNc, b_readChannel bufId fileName 0 (-1) 0 True readChan]+ , [b_close bufId, b_free bufId]+ )++-- | diskIn form of sndfileDiskIn+sndfileIn :: (String, Buffer_Id, [Int]) -> FilePath -> Loop Ugen -> Ugen+sndfileIn opt sndFileName loop = sndfileDiskIn opt sndFileName Nothing loop++-- | vDiskIn form of sndfileDiskIn+sndfileVarIn :: (String, Buffer_Id, [Int]) -> FilePath -> Ugen -> Loop Ugen -> Ugen+sndfileVarIn opt sndFileName rate loop = sndfileDiskIn opt sndFileName (Just rate) loop++{- | Returns Buffer_Id as a bracketed buffer identifier Ugen,+ along with basic sound file information: numberOfChannels, sampleRate, numberOfFrames.+ If ctlName is empty the buffer is returned as a constant, else as a control with the given name.+ The brackets will 1. allocate and read and then 2. free the buffer.+ Ignoring the brackets, and the sample rate and frame count, this is equivalent to declaring a buffer identifier.+ If readChan is empty all channels are read.+-}+sndfileRead :: (String, Buffer_Id, [Int]) -> FilePath -> (Ugen, Int, Ugen, Ugen)+sndfileRead (ctlName, bufId, readChan) sndFileName =+ let fileName = sfResolve sndFileName+ (sfNc, sfSr, sfNf) = sfInfo fileName+ buf = if null ctlName then constant bufId else control kr ctlName (fromIntegral bufId)+ bufNc = readChanToNc sfNc readChan+ in (bracketUgen buf ([b_allocReadChannel bufId fileName 0 0 readChan], [b_free bufId]), bufNc, constant sfSr, constant sfNf)++{- | Bracketed b_gen sine1+ If ctlName is empty the buffer is returned as a constant, else as a control with the given name.+-}+bGenSine1 :: (String, Buffer_Id, Int) -> [B_Gen] -> [Double] -> Ugen+bGenSine1 (ctlName, bufId, numFrames) flags param =+ let buf = if null ctlName then constant bufId else control kr ctlName (fromIntegral bufId)+ bufNc = 1+ in bracketUgen buf ([b_alloc bufId numFrames bufNc, b_gen_sine1 bufId flags param], [b_free bufId])++-- | bGenSine1 with standard wavetable flags (normalise and wavetable and clear).+bGenSine1Tbl :: (String, Buffer_Id, Int) -> [Double] -> Ugen+bGenSine1Tbl opt = bGenSine1 opt [Normalise, Wavetable, Clear]++{- | Bracketed b_gen sine1+ If ctlName is empty the buffer is returned as a constant, else as a control with the given name.+-}+bGenCheby :: (String, Buffer_Id, Int) -> [B_Gen] -> [Double] -> Ugen+bGenCheby (ctlName, bufId, numFrames) flags param =+ let buf = if null ctlName then constant bufId else control kr ctlName (fromIntegral bufId)+ bufNc = 1+ in bracketUgen buf ([b_alloc bufId numFrames bufNc, b_gen_cheby bufId flags param], [b_free bufId])++-- | bGenCheby with standard wavetable flags (normalise and wavetable and clear).+bGenChebyTbl :: (String, Buffer_Id, Int) -> [Double] -> Ugen+bGenChebyTbl opt = bGenCheby opt [Normalise, Wavetable, Clear]
+ Sound/Sc3/Ugen/Brackets.hs view
@@ -0,0 +1,24 @@+-- | Brackets+module Sound.Sc3.Ugen.Brackets where++import Data.Bifunctor {- base -}++import qualified Sound.Osc.Packet as Osc {- hosc -}++{- | Brackets are two sets of Open Sound Control messages that can be associated with a Ugen.+The first is to be run prior to the graph being executed, the other after it has ended.+-}+type Brackets = ([Osc.Message], [Osc.Message])++-- | No messages.+emptyBrackets :: Brackets+emptyBrackets = ([], [])++{- | Combine a sequence of Brackets into one Bracket.++>>> f = Data.Bifunctor.bimap concat concat . unzip+>>> f [(['a'],['A']),(['b'],['B'])]+("ab","AB")+-}+concatBrackets :: [Brackets] -> Brackets+concatBrackets = bimap concat concat . unzip
+ Sound/Sc3/Ugen/Constant.hs view
@@ -0,0 +1,32 @@+-- | Constant+module Sound.Sc3.Ugen.Constant where++import Sound.Sc3.Ugen.Brackets {- hsc3 -}++{- | Constants.+Constants may have brackets.+This allows for buffer allocation and deallocation to be associated with a buffer identifier.++>>> Constant 3 emptyBrackets == Constant 3 emptyBrackets+True++>>> Constant 3 emptyBrackets > Constant 1 emptyBrackets+True+-}+data Constant = Constant+ { constantValue :: Double+ , constantBrackets :: Brackets+ }+ deriving (Ord, Eq, Read, Show)++-- | Get fractional part of a double.+fractionPart :: Double -> Double+fractionPart = snd . (properFraction :: Double -> (Integer, Double))++{- | Is integer?++>>> constantIsInteger (Constant 1 emptyBrackets)+True+-}+constantIsInteger :: Constant -> Bool+constantIsInteger (Constant n _) = fractionPart n == 0
+ Sound/Sc3/Ugen/Control.hs view
@@ -0,0 +1,98 @@+-- | Control+module Sound.Sc3.Ugen.Control where++import Text.Printf {- base -}++import Sound.Sc3.Common.Rate {- hsc3 -}+import Sound.Sc3.Ugen.Brackets {- hsc3 -}++-- * Control Group++{- | Controls may form part of a control group.+There are presently three types of groups.+Ranges controls have two values (minima, maxima) and are ordinarily drawn as a range slider.+Array controls have n values [e1 .. eN] and are ordinarily drawn as a multislider.+Xy controls have two values (x, y) and are ordinarily drawn as a two dimensional slider.+-}+data Control_Group+ = Control_Range+ | Control_Array Int+ | Control_Xy+ deriving (Ord, Eq, Read, Show)++-- | The number of elements in a control group.+control_group_degree :: Control_Group -> Int+control_group_degree grp =+ case grp of+ Control_Range -> 2+ Control_Array n -> n+ Control_Xy -> 2++{- | Grouped controls have names that have equal prefixes and identifying suffixes.+ Range controls have two elements, minima and maxima, suffixes are [ and ].+ Array controls have n elements and have zero-indexed numerical suffixes.+ Xy controls have two elements, X and Y coordinates, suffixes are X and Y.+-}+control_group_suffixes :: Control_Group -> [String]+control_group_suffixes grp =+ case grp of+ Control_Range -> ["[", "]"]+ Control_Array n -> map (printf "%02d") [0 .. n - 1]+ Control_Xy -> ["X", "Y"]++-- * Control Meta++-- | Control meta-data.+data Control_Meta n = Control_Meta+ { ctl_min :: n+ -- ^ Minimum+ , ctl_max :: n+ -- ^ Maximum+ , ctl_warp :: String+ -- ^ @(0,1)@ @(min,max)@ transfer function.+ , ctl_step :: n+ -- ^ The step to increment & decrement by.+ , ctl_units :: String+ -- ^ Unit of measure (ie hz, ms etc.).+ , controlGroup :: Maybe Control_Group+ -- ^ Control group.+ }+ deriving (Ord, Eq, Read, Show)++-- * Control Meta (T)++-- | 3-tuple form of 'Control_Meta' data.+type Control_Meta_T3 n = (n, n, String)++-- | Lift 'Control_Meta_T3' to 'Control_Meta' allowing type coercion.+control_meta_t3 :: Num m => (n -> m) -> Control_Meta_T3 n -> Control_Meta m+control_meta_t3 f (l, r, w) = Control_Meta (f l) (f r) w 0 "" Nothing++-- | 5-tuple form of 'Control_Meta' data.+type Control_Meta_T5 n = (n, n, String, n, String)++-- | Lift 'Control_Meta_T5' to 'Control_Meta' allowing type coercion.+control_meta_t5 :: (n -> m) -> Control_Meta_T5 n -> Control_Meta m+control_meta_t5 f (l, r, w, stp, u) = Control_Meta (f l) (f r) w (f stp) u Nothing++-- * Control++{- | Control inputs.+It is an unchecked invariant that controls with equal names within a Ugen graph must be equal in all other respects.+-}+data Control = Control+ { controlOperatingRate :: Rate+ , controlIndex :: Maybe Int+ , controlName :: String+ , controlDefault :: Double+ , controlTriggered :: Bool+ , controlMeta :: Maybe (Control_Meta Double)+ , controlBrackets :: Brackets+ }+ deriving (Ord, Eq, Read, Show)++{-+-- | Control type+data CVarTy = CVarInit | CVarControl | CVarTrigger deriving (Eq,Read,Show)+CVar CVarTy String Double -- ^ Control input (named)+-}
+ Sound/Sc3/Ugen/Enum.hs view
@@ -0,0 +1,16 @@+-- | Data types for enumerated and non signal unit generator inputs.+module Sound.Sc3.Ugen.Enum where++import Sound.Sc3.Common.Enum {- hsc3 -}+import Sound.Sc3.Common.Envelope {- hsc3 -}+import Sound.Sc3.Ugen.Ugen {- hsc3 -}++-- | Type specialised envelope curve.+type EnvCurve = Envelope_Curve Ugen++-- | Lift to Ugen.+from_buffer :: Buffer Ugen -> Ugen+from_buffer b =+ case b of+ Buffer_Id i -> constant i+ Buffer u -> u
+ Sound/Sc3/Ugen/Envelope.hs view
@@ -0,0 +1,47 @@+-- | Envelope / Ugen.+module Sound.Sc3.Ugen.Envelope where++import Sound.Sc3.Common.Enum+import Sound.Sc3.Common.Envelope+import Sound.Sc3.Common.Math.Operator+import Sound.Sc3.Common.Rate++import Sound.Sc3.Ugen.Bindings+import Sound.Sc3.Ugen.Ugen+import Sound.Sc3.Ugen.Util++{- | Trapezoidal envelope generator.++> import Sound.Sc3.Plot+> plotEnvelope [envTrapezoid 0.99 0.5 1 1,envTrapezoid 0.5 0.75 0.65 0.35]+-}+envTrapezoid :: OrdE t => t -> t -> t -> t -> Envelope t+envTrapezoid = envTrapezoid_f (less_than_or_equal_to, greater_than_or_equal_to)++-- | 'latch' 1 of 'impulse' 0.+first_zero_then_one :: Rate -> Ugen+first_zero_then_one rt = latch 1 (impulse rt 0 0)++-- | 'env_circle_z' of k-rate 'first_zero_thereafter_one'.+env_circle_u :: Ugen -> Envelope_Curve Ugen -> Envelope Ugen -> Envelope Ugen+env_circle_u = env_circle_z (first_zero_then_one ControlRate)++-- | Singleton fade envelope.+envGate :: Ugen -> Ugen -> Ugen -> DoneAction Ugen -> Envelope_Curve Ugen -> Ugen+envGate level gate_ fadeTime doneAction curve =+ let startVal = fadeTime `less_than_or_equal_to` 0+ e = Envelope [startVal, 1, 0] [1, 1] [curve] (Just 1) Nothing 0+ in envGen ControlRate gate_ level 0 fadeTime doneAction e++{- | Variant with default values for all inputs. @gate@ and+@fadeTime@ are 'control's, @doneAction@ is 'RemoveSynth', @curve@+is 'EnvSin'.+-}+envGate_def :: Ugen+envGate_def =+ let level = 1+ gate_ = control_m ControlRate "gate" 1 (0, 1, "gate")+ fadeTime = control_m ControlRate "fadeTime" 0.02 (0, 10, "lin")+ doneAction = RemoveSynth+ curve = EnvSin+ in envGate level gate_ fadeTime doneAction curve
+ Sound/Sc3/Ugen/Event.hs view
@@ -0,0 +1,235 @@+-- | Continous controller event and Ctl systems for external control interfaces.+module Sound.Sc3.Ugen.Event where++import Data.List {- base -}++import Data.List.Split {- split -}++import Sound.Sc3.Common.Math {- hsc3 -}+import Sound.Sc3.Common.Rate {- hsc3 -}+import Sound.Sc3.Ugen.Bindings.Composite {- hsc3 -}+import Sound.Sc3.Ugen.Bindings.Db {- hsc3 -}+import Sound.Sc3.Ugen.Types {- hsc3 -}+import Sound.Sc3.Ugen.Util {- hsc3 -}++-- * Cc Event++{- | (v, w, x, y, z, o, rx, ry, p, px, _)++ v = voice, w = gate, z = force/pressure,+ o = orientation/angle, r = radius, p = pitch+-}+type CcEvent t = (Int, t, t, t, t, t, t, t, t, t, t)++-- | Translate list to Event.+cc_event_from_list :: Num t => Int -> [t] -> CcEvent t+cc_event_from_list v l =+ case l of+ [w, x, y, z, o, rx, ry, p, px, py] -> (v, w, x, y, z, o, rx, ry, p, px, py)+ _ -> error "cc_event_from_list?"++{- | (ccEventAddr, ccEventIncr, ccEventZero)++ccEventAddr = k0 = index of control bus zero for event system,+ccEventIncr = stp = voice index increment,+ccEventZero = c0 = offset for event voices at current server+-}+type CcEventMeta t = (t, t, t)++ccEventMetaDefault :: Num n => CcEventMeta n+ccEventMetaDefault = (13000, 10, 0)++ccEventMetaControls :: CcEventMeta Int -> CcEventMeta Ugen+ccEventMetaControls (p, q, r) =+ let k nm i = control kr nm (fromIntegral i)+ in (k "ccEventAddr" p, k "ccEventIncr" q, k "ccEventZero" r)++-- | c = event number (zero indexed)+ccEventAddr :: (Ugen, Ugen, Ugen) -> Int -> CcEvent Ugen+ccEventAddr (k0, stp, c0) c =+ let u = in' 10 kr (k0 + ((c0 + fromIntegral c) * stp))+ in cc_event_from_list c (mceChannels u)++-- | c0 = index of voice (channel) zero for event set, n = number of voices (channels)+ccEventVoicerAddr :: CcEventMeta Ugen -> Int -> (CcEvent Ugen -> Ugen) -> Ugen+ccEventVoicerAddr m n f = mce (map (\c -> f (ccEventAddr m c)) [0 .. n - 1])++-- | 'eventVoicerAddr' with default (addr, inct, zero).+ccEventVoicer :: Int -> (CcEvent Ugen -> Ugen) -> Ugen+ccEventVoicer = ccEventVoicerAddr ccEventMetaDefault++-- | Synonym for ccEventVoicer.+voicer :: Int -> (CcEvent Ugen -> Ugen) -> Ugen+voicer = ccEventVoicer++-- | 'eventVoicerAddr' with 'control' inputs for /eventAddr/, /eventIncr/ and /eventZero/.+ccEventVoicerParam :: Int -> (CcEvent Ugen -> Ugen) -> Ugen+ccEventVoicerParam = ccEventVoicerAddr (ccEventMetaControls ccEventMetaDefault)++{- | Given /w|g/ and /p/ fields of an 'CcEvent' derive a 'gateReset' from g+and a trigger derived from monitoring /w|g/ and /p/ for changed values.+-}+ccEventGateReset :: Ugen -> Ugen -> (Ugen, Ugen)+ccEventGateReset g p =+ let tr = changed p 0.01 + changed g 0.01+ in (gateReset g tr, tr)++-- * Ctl++-- | Sequence of 8 continous controller inputs in range (0-1).+type Ctl8 = (Ugen, Ugen, Ugen, Ugen, Ugen, Ugen, Ugen, Ugen)++-- | k0 = index of control bus zero+ctl8At :: Int -> Ctl8+ctl8At k0 =+ let u = in' 8 kr (constant k0)+ in case mceChannels u of+ [cc0, cc1, cc2, cc3, cc4, cc5, cc6, cc7] -> (cc0, cc1, cc2, cc3, cc4, cc5, cc6, cc7)+ _ -> error "ctl8At?"++-- | 'ctlVoicerAddr' with 'control' inputs for /CtlAddr/ and /CtlZero/.+ctl8Voicer :: Int -> (Int -> Ctl8 -> Ugen) -> Ugen+ctl8Voicer n f = mce (map (\c -> f c (ctl8At (11000 + (8 * c)))) [0 .. n - 1])++-- | Sequence of 16 continous controller inputs arranged as two Ctl8 sequences.+type Ctl16 = (Ctl8, Ctl8)++-- | 'ctl16VoicerAddr' with 'control' inputs for /CtlAddr/ and /CtlZero/.+ctl16Voicer :: Int -> (Int -> Ctl16 -> Ugen) -> Ugen+ctl16Voicer n f = mce (map (\c -> let i = 11000 + (16 * c) in f c (ctl8At i, ctl8At (i + 8))) [0 .. n - 1])++-- * Names++-- | Control Specificier. (name,default,(minValue,maxValue,warpName))+type ControlSpec t = (String, t, (t, t, String))++control_spec_name :: ControlSpec t -> String+control_spec_name (name, _, _) = name++-- | Comma separated, no spaces.+control_spec_parse :: String -> ControlSpec Double+control_spec_parse str =+ case splitOn "," str of+ [cnmdef, lhs, rhs, wrp] -> case splitOn ":" cnmdef of+ [cnm, def] -> (cnm, read def, (read lhs, read rhs, wrp))+ _ -> error ("control_spec_parse: " ++ cnmdef)+ _ -> error ("control_spec_parse: " ++ str)++{- | Semicolon separated, no spaces.++>>> control_spec_seq_parse "freq:220,110,440,exp;amp:0.1,0,1,amp;pan:0,-1,1,lin"+[("freq",220.0,(110.0,440.0,"exp")),("amp",0.1,(0.0,1.0,"amp")),("pan",0.0,(-1.0,1.0,"lin"))]+-}+control_spec_seq_parse :: String -> [ControlSpec Double]+control_spec_seq_parse = map control_spec_parse . splitOn ";"++-- | Comma separated, 6 decimal places, no spaces.+control_spec_print :: ControlSpec Double -> String+control_spec_print (cnm, def, (lhs, rhs, wrp)) = intercalate "," [concat [cnm, ":", double_pp 6 def], double_pp 6 lhs, double_pp 6 rhs, wrp]++{- | Semicolon separated, no spaces.++>>> control_spec_seq_print (control_spec_seq_parse "freq:220,220,440,exp;amp:0.1,0,1,amp;pan:0,-1,1,lin")+"freq:220.0,220.0,440.0,exp;amp:0.1,0.0,1.0,amp;pan:0.0,-1.0,1.0,lin"+-}+control_spec_seq_print :: [ControlSpec Double] -> String+control_spec_seq_print = intercalate ";" . map control_spec_print++control_spec_to_control :: ControlSpec Double -> Control+control_spec_to_control (cnm, def, (lhs, rhs, wrp)) =+ let grp = if last cnm `elem` "[]" then Just Control_Range else Nothing+ in Control ControlRate Nothing cnm def False (Just (Control_Meta lhs rhs wrp 0 "" grp)) emptyBrackets++{- | See SCClassLibrary/Common/Control/Spec:ControlSpec.initClass++"ControlSpec defines the range and curve of a control"++This list adds default values.+-}+sc3_control_spec :: Fractional t => [ControlSpec t]+sc3_control_spec =+ [ ("amp", 0.1, (0, 1, "amp"))+ , ("beats", 1, (0, 20, "lin"))+ , ("bipolar", 0, (-1, 1, "lin"))+ , ("boostcut", 0, (-20, 20, "lin"))+ , ("db", -12, (-180, 0, "db"))+ , ("delay", 0.01, (0.0001, 1, "exp"))+ , ("detune", 0, (-20, 20, "lin"))+ , ("freq", 440, (20, 20000, "exp"))+ , ("lofreq", 20, (0.1, 100, "exp"))+ , ("midfreq", 440, (25, 4200, "exp"))+ , ("midi", 64, (0, 127, "lin"))+ , ("midinote", 64, (0, 127, "lin"))+ , ("midivelocity", 64, (1, 127, "lin"))+ , ("pan", 0, (-1, 1, "lin"))+ , ("phase", 0, (0, 6.28318, "lin"))+ , ("rate", 1, (0.125, 8, "exp"))+ , ("rq", 0.1, (0.001, 2, "exp"))+ , ("unipolar", 0, (0, 1, "lin"))+ , ("widefreq", 440, (0.1, 20000, "exp"))+ ]++{- | See Kyma X Revealed, p.403++"The following EventValue names are associated with initial ranges+other than (0,1). EventValue names are not case-sensitive."++This list adds curve specifiers as strings and default values.++>>> Data.List.intersect (map control_spec_name sc3_control_spec) (map control_spec_name kyma_event_value_ranges)+["beats","boostcut","freq","rate"]++>>> let f i = filter ((== i) . control_spec_name)+>>> let c (p,q) = (f p sc3_control_spec, f q kyma_event_value_ranges)+>>> c ("lofreq","freqlow")+([("lofreq",20.0,(0.1,100.0,"exp"))],[("freqlow",120.0,(0.0,1000.0,"exp"))])++>>> c ("midfreq","freqmid")+([("midfreq",440.0,(25.0,4200.0,"exp"))],[("freqmid",1200.0,(1000.0,8000.0,"exp"))])++>>> find ((==) "freqhigh" . control_spec_name) kyma_event_value_ranges+Just ("freqhigh",12000.0,(8000.0,24000.0,"exp"))+-}+kyma_event_value_ranges :: Fractional t => [ControlSpec t]+kyma_event_value_ranges =+ [ ("angle", 0, (-0.5, 1.5, "lin"))+ , ("beats", 1, (1, 16, "lin"))+ , ("boostcut", 0, (-12, 12, "lin"))+ , ("bpm", 60, (0, 2000, "lin"))+ , ("centervalue", 0, (-1, 1, "lin"))+ , ("coef", 0, (-1, 1, "lin"))+ , ("cutoff", 440, (0, 10000, "exp"))+ , ("cycles", 1, (0, 100, "lin"))+ , ("dcoffset", 0, (-1, 1, "lin"))+ , ("direction", 0, (-1, 1, "lin"))+ , ("distance", 0, (-2, 2, "lin"))+ , ("fmntshift", 1, (0.75, 1.25, "lin"))+ , ("freq", 440, (0, 10000, "exp"))+ , ("freqhigh", 12000, (8000, 24000, "exp")) -- sampleRate / 2+ , ("freqjitter", 0, (0, 1, "lin"))+ , ("freqlow", 120, (0, 1000, "exp"))+ , ("freqmid", 1200, (1000, 8000, "exp"))+ , ("gain", 0.1, (0, 10, "amp"))+ , ("gaindb", -12, (-128, 128, "lin"))+ , ("interval", 0, (-24, 24, "lin"))+ , ("keynumber", 64, (0, 127, "lin"))+ , ("logfreq", 20, (0, 127, "lin"))+ , ("looplength", 0, (-1, 1, "lin"))+ , ("offset", 0, (-1, 1, "lin"))+ , ("onduration", 0.1, (0, 30, "lin"))+ , ("panner", 0, (-0.5, 1.5, "lin"))+ , ("pitch", 64, (0, 127, "lin"))+ , ("q", 0.1, (0, 10, "lin"))+ , ("radius", 1, (-2, 2, "lin"))+ , ("rate", 1, (0, 2, "lin"))+ , ("ratio", 1, (0, 100, "lin"))+ , ("scale", 0, (-2, 2, "lin"))+ , ("smallInterval", 0, (0, 12, "lin"))+ , ("steps", 1, (1, 128, "lin"))+ , ("swing", 0, (0, 0.5, "lin"))+ , ("threshdb", -12, (-60, 0, "lin"))+ , ("timeconstant", 1, (0.0001, 5, "lin"))+ , ("timeindex", 0, (-1, 1, "lin"))+ , ("tune", 0, (-1, 1, "lin"))+ , ("upinterval", 0, (0, 24, "lin"))+ ]
+ Sound/Sc3/Ugen/Graph.hs view
@@ -0,0 +1,617 @@+{- | 'U_Graph' and related types.++The Ugen type is recursive, inputs to Ugens are Ugens.++This makes writing Ugen graphs simple, but manipulating them awkward.++Ugen equality is structural, and can be slow to determine for some Ugen graph structures.++A U_Node is a non-recursive notation for a Ugen, all U_Nodes have unique identifiers.++A U_Graph is constructed by a stateful traversal of a Ugen.++A U_Graph is represented as a partioned (by type) set of U_Nodes, edges are implicit.+-}+module Sound.Sc3.Ugen.Graph where++import Data.Function {- base -}+import Data.List {- base -}+import Data.Maybe {- base -}++import qualified Safe {- safe -}++import qualified Sound.Sc3.Common.Rate as Rate {- hsc3 -}+import qualified Sound.Sc3.Common.Uid as Uid {- hsc3 -}++import qualified Sound.Sc3.Ugen.Analysis as Analysis {- hsc3 -}+import Sound.Sc3.Ugen.Types {- hsc3 -}+import qualified Sound.Sc3.Ugen.Util as Util {- hsc3 -}++-- * Types++-- | Port index.+type Port_Index = Int++{- | Type to represent the left hand side of an edge in a unit generator graph.+C = constant, K = control, U = ugen.+-}+data From_Port+ = From_Port_C {from_port_nid :: Uid.Id}+ | From_Port_K {from_port_nid :: Uid.Id, from_port_kt :: Rate.K_Type}+ | From_Port_U {from_port_nid :: Uid.Id, from_port_idx :: Maybe Port_Index}+ deriving (Eq, Show)++-- | A destination port.+data To_Port = To_Port {to_port_nid :: Uid.Id, to_port_idx :: Port_Index}+ deriving (Eq, Show)++-- | A connection from 'From_Port' to 'To_Port'.+type U_Edge = (From_Port, To_Port)++{- | Sum-type to represent nodes in unit generator graph.+ _C = constant, _K = control, _U = ugen, _P = proxy.+-}+data U_Node+ = U_Node_C+ { u_node_id :: Uid.Id+ , u_node_c_value :: Sample+ }+ | U_Node_K+ { u_node_id :: Uid.Id+ , u_node_k_rate :: Rate.Rate+ , u_node_k_index :: Maybe Int+ , u_node_k_name :: String+ , u_node_k_default :: Sample+ , u_node_k_type :: Rate.K_Type+ , u_node_k_meta :: Maybe (Control_Meta Sample)+ }+ | U_Node_U+ { u_node_id :: Uid.Id+ , u_node_u_rate :: Rate.Rate+ , u_node_u_name :: String+ , u_node_u_inputs :: [From_Port]+ , u_node_u_outputs :: [Output]+ , u_node_u_special :: Special+ , u_node_u_ugenid :: UgenId+ }+ | U_Node_P+ { u_node_id :: Uid.Id+ , u_node_p_id :: Uid.Id+ , u_node_p_index :: Port_Index+ , u_node_p_rate :: Rate.Rate+ }+ deriving (Eq, Show)++u_node_is_c, u_node_is_k, u_node_is_u :: U_Node -> Bool+u_node_is_c n = case n of U_Node_C {} -> True; _ -> False+u_node_is_k n = case n of U_Node_K {} -> True; _ -> False+u_node_is_u n = case n of U_Node_U {} -> True; _ -> False++-- | Convert from U_Node_K to Control (ie. discard index).+u_node_k_to_control :: U_Node -> Control+u_node_k_to_control nd =+ case nd of+ U_Node_K _ rt ix nm df ty mt -> Control rt ix nm df (ty == Rate.K_TriggerRate) mt emptyBrackets+ _ -> error "u_node_k_to_control?"++-- | Derive "user" name for U_Node+u_node_user_name :: U_Node -> String+u_node_user_name n = ugen_user_name (u_node_u_name n) (u_node_u_special n)++-- | Type to represent a unit generator graph.+data U_Graph = U_Graph+ { ug_next_id :: Uid.Id+ , ug_constants :: [U_Node]+ , ug_controls :: [U_Node]+ , ug_ugens :: [U_Node]+ }+ deriving (Show)++-- * Ports++-- | Get 'port_idx' for 'From_Port_U', else @0@.+port_idx_or_zero :: From_Port -> Port_Index+port_idx_or_zero p =+ case p of+ From_Port_U _ (Just x) -> x+ _ -> 0++-- | Is 'From_Port' 'From_Port_U'.+is_from_port_u :: From_Port -> Bool+is_from_port_u p =+ case p of+ From_Port_U _ _ -> True+ _ -> False++-- * Nodes++-- | Is 'U_Node' a /constant/.+is_u_node_c :: U_Node -> Bool+is_u_node_c n =+ case n of+ U_Node_C _ _ -> True+ _ -> False++-- | Predicate to determine if 'U_Node' is a constant with indicated /value/.+is_u_node_c_of :: Sample -> U_Node -> Bool+is_u_node_c_of x n =+ case n of+ U_Node_C _ y -> x == y+ _ -> error "is_u_node_c_of: non U_Node_C"++-- | Is 'U_Node' a /control/.+is_u_node_k :: U_Node -> Bool+is_u_node_k n =+ case n of+ U_Node_K {} -> True+ _ -> False++{- | Predicate to determine if 'U_Node' is a control with indicated+/name/. Names must be unique.+-}+is_u_node_k_of :: String -> U_Node -> Bool+is_u_node_k_of x n =+ case n of+ U_Node_K _ _ _ y _ _ _ -> x == y+ _ -> error "is_u_node_k_of"++-- | Is 'U_Node' a /Ugen/.+is_u_node_u :: U_Node -> Bool+is_u_node_u n =+ case n of+ U_Node_U {} -> True+ _ -> False++-- | Compare 'U_Node_K' values 'on' 'u_node_k_type'.+u_node_k_cmp :: U_Node -> U_Node -> Ordering+u_node_k_cmp = compare `on` u_node_k_type++-- | Sort by 'u_node_id'.+u_node_sort :: [U_Node] -> [U_Node]+u_node_sort = sortBy (compare `on` u_node_id)++-- | Equality test, error if not U_Node_K.+u_node_k_eq :: U_Node -> U_Node -> Bool+u_node_k_eq p q =+ if is_u_node_k p && is_u_node_k q+ then p == q+ else error "u_node_k_eq? not U_Node_K"++{- | 'Rate' of 'U_Node', ie. 'InitialisationRate' for constants. See through 'U_Node_P'.+ Not used at hsc3 but used by hsc3-dot &etc.+-}+u_node_rate :: U_Node -> Rate.Rate+u_node_rate n =+ case n of+ U_Node_C {} -> Rate.InitialisationRate+ U_Node_K {} -> u_node_k_rate n+ U_Node_U {} -> u_node_u_rate n+ U_Node_P {} -> u_node_p_rate n++-- | Generate a label for 'U_Node' using the /type/ and the 'u_node_id'.+u_node_label :: U_Node -> String+u_node_label nd =+ case nd of+ U_Node_C n _ -> "c_" ++ show n+ U_Node_K n _ _ _ _ _ _ -> "k_" ++ show n+ U_Node_U n _ _ _ _ _ _ -> "u_" ++ show n+ U_Node_P n _ _ _ -> "p_" ++ show n++-- | Calculate all in edges for a 'U_Node_U'.+u_node_in_edges :: U_Node -> [U_Edge]+u_node_in_edges n =+ case n of+ U_Node_U x _ _ i _ _ _ -> zip i (map (To_Port x) [0 ..])+ _ -> error "u_node_in_edges: non U_Node_U input node"++-- | Transform 'U_Node' to 'From_Port'.+u_node_from_port :: U_Node -> From_Port+u_node_from_port d =+ case d of+ U_Node_C n _ -> From_Port_C n+ U_Node_K n _ _ _ _ t _ -> From_Port_K n t+ U_Node_U n _ _ _ o _ _ ->+ case o of+ [_] -> From_Port_U n Nothing+ _ -> error (show ("u_node_from_port: non unary U_Node_U", d))+ U_Node_P _ u p _ -> From_Port_U u (Just p)++-- | If controls have been given indices they must be coherent.+u_node_sort_controls :: [U_Node] -> [U_Node]+u_node_sort_controls c =+ let u_node_k_ix n = fromMaybe maxBound (u_node_k_index n)+ cmp = compare `on` u_node_k_ix+ c' = sortBy cmp c+ coheres z = maybe True (== z) . u_node_k_index+ coherent = and (zipWith coheres [0 ..] c')+ in if coherent then c' else error (show ("u_node_sort_controls: incoherent", c))++-- | Determine 'K_Type' of a /control/ Ugen at 'U_Node_U', or not.+u_node_ktype :: U_Node -> Maybe Rate.K_Type+u_node_ktype n =+ case (u_node_u_name n, u_node_u_rate n) of+ ("Control", Rate.InitialisationRate) -> Just Rate.K_InitialisationRate+ ("Control", Rate.ControlRate) -> Just Rate.K_ControlRate+ ("TrigControl", Rate.ControlRate) -> Just Rate.K_TriggerRate+ ("AudioControl", Rate.AudioRate) -> Just Rate.K_AudioRate+ _ -> Nothing++-- | Is 'U_Node' a control Ugen?+u_node_is_control :: U_Node -> Bool+u_node_is_control n =+ let cs = ["AudioControl", "Control", "TrigControl"]+ in case n of+ U_Node_U _ _ s _ _ _ _ -> s `elem` cs+ _ -> False++-- | Is 'U_Node' an /implicit/ control Ugen?+u_node_is_implicit_control :: U_Node -> Bool+u_node_is_implicit_control n = u_node_is_control n && u_node_id n == -1++-- | Is U_Node implicit?+u_node_is_implicit :: U_Node -> Bool+u_node_is_implicit n = u_node_u_name n == "MaxLocalBufs" || u_node_is_implicit_control n++-- | Zero if no local buffers, or if maxLocalBufs is given.+u_node_localbuf_count :: [U_Node] -> Int+u_node_localbuf_count us =+ case find ((==) "MaxLocalBufs" . u_node_u_name) us of+ Nothing -> length (filter ((==) "LocalBuf" . u_node_u_name) us)+ Just _ -> 0++{- | Controls are a special case. We need to know not the overall+index but the index in relation to controls of the same type.+-}+u_node_fetch_k :: Uid.Id -> Rate.K_Type -> [U_Node] -> Int+u_node_fetch_k z t =+ let recur i ns =+ case ns of+ [] -> error "u_node_fetch_k"+ n : ns' ->+ if z == u_node_id n+ then i+ else+ if t == u_node_k_type n+ then recur (i + 1) ns'+ else recur i ns'+ in recur 0++-- | All the elements of a U_Node_U, except the u_node_id.+type U_Node_NoId = (Rate.Rate, String, [From_Port], [Output], Special, UgenId)++-- | Predicate to locate primitive, names must be unique.+u_node_eq_noid :: U_Node_NoId -> U_Node -> Bool+u_node_eq_noid x nd =+ case nd of+ U_Node_U _ r n i o s d -> (r, n, i, o, s, d) == x+ _ -> error "u_node_eq_noid"++-- | Make map associating 'K_Type' with Ugen index.+u_node_mk_ktype_map :: [U_Node] -> [(Rate.K_Type, Int)]+u_node_mk_ktype_map =+ let f (i, n) = let g ty = (ty, i) in fmap g (u_node_ktype n)+ in mapMaybe f . zip [0 ..]++-- * Nodes (Implicit)++-- | 4-tuple to count 'K_Type's, ie. (InitialisationRate,ControlRate,TriggerRate,AudioRate).+type U_NODE_KS_COUNT = (Int, Int, Int, Int)++-- | Count the number of /controls/ of each 'K_Type'.+u_node_ks_count :: [U_Node] -> U_NODE_KS_COUNT+u_node_ks_count =+ let recur r ns =+ let (i, k, t, a) = r+ in case ns of+ [] -> r+ n : ns' ->+ let r' = case u_node_k_type n of+ Rate.K_InitialisationRate -> (i + 1, k, t, a)+ Rate.K_ControlRate -> (i, k + 1, t, a)+ Rate.K_TriggerRate -> (i, k, t + 1, a)+ Rate.K_AudioRate -> (i, k, t, a + 1)+ in recur r' ns'+ in recur (0, 0, 0, 0)++{- | Construct implicit /control/ unit generator 'U_Nodes'.+Unit generators are only constructed for instances of control types that are present.+The special-index holds the accumulated offset where multiple Control Ugens (at different rates) are present.+-}+u_node_mk_implicit_ctl :: [U_Node] -> [U_Node]+u_node_mk_implicit_ctl ks =+ let (ni, nk, nt, na) = u_node_ks_count ks+ mk_n t n o =+ let (nm, r) = case t of+ Rate.K_InitialisationRate -> ("Control", Rate.InitialisationRate)+ Rate.K_ControlRate -> ("Control", Rate.ControlRate)+ Rate.K_TriggerRate -> ("TrigControl", Rate.ControlRate)+ Rate.K_AudioRate -> ("AudioControl", Rate.AudioRate)+ i = replicate n r+ in if n == 0+ then Nothing+ else Just (U_Node_U (-1) r nm [] i (Special o) no_id)+ in catMaybes+ [ mk_n Rate.K_InitialisationRate ni 0+ , mk_n Rate.K_ControlRate nk ni+ , mk_n Rate.K_TriggerRate nt (ni + nk)+ , mk_n Rate.K_AudioRate na (ni + nk + nt)+ ]++-- * Edges++-- | List of 'From_Port_U' at /e/ with multiple out edges.+u_edge_multiple_out_edges :: [U_Edge] -> [From_Port]+u_edge_multiple_out_edges e =+ let p = filter is_from_port_u (map fst e)+ p' = group (sortBy (compare `on` from_port_nid) p)+ in map (Safe.headNote "u_edge_multiple_out_edges") (filter ((> 1) . length) p')++-- * Graph++-- | Calculate all edges of a 'U_Graph'.+ug_edges :: U_Graph -> [U_Edge]+ug_edges = concatMap u_node_in_edges . ug_ugens++-- | The empty 'U_Graph'.+ug_empty_graph :: U_Graph+ug_empty_graph = U_Graph 0 [] [] []++-- | Find the maximum 'Uid.Id' used at 'U_Graph'. It is an error if this is not 'ug_next_id'.+ug_maximum_id :: U_Graph -> Uid.Id+ug_maximum_id (U_Graph z c k u) =+ let z' = maximum (map u_node_id (c ++ k ++ u))+ in if z' /= z+ then error (show ("ug_maximum_id: not ug_next_id?", z, z'))+ else z++-- | Find 'U_Node' with indicated 'Uid.Id'.+ug_find_node :: U_Graph -> Uid.Id -> Maybe U_Node+ug_find_node (U_Graph _ cs ks us) n =+ let f x = u_node_id x == n+ in find f (cs ++ ks ++ us)++-- | Locate 'U_Node' of 'From_Port' in 'U_Graph'.+ug_from_port_node :: U_Graph -> From_Port -> Maybe U_Node+ug_from_port_node g fp = ug_find_node g (from_port_nid fp)++-- | Erroring variant.+ug_from_port_node_err :: U_Graph -> From_Port -> U_Node+ug_from_port_node_err g fp =+ let e = error "ug_from_port_node_err"+ in fromMaybe e (ug_from_port_node g fp)++-- * Graph (Construct from Ugen)++-- | Insert a constant 'U_Node' into the 'U_Graph'.+ug_push_c :: Sample -> U_Graph -> (U_Node, U_Graph)+ug_push_c x g =+ let n = U_Node_C (ug_next_id g) x+ in ( n+ , g+ { ug_constants = n : ug_constants g+ , ug_next_id = ug_next_id g + 1+ }+ )++{- | Either find existing 'Constant' 'U_Node', or insert a new 'U_Node'.+ Brackets are discarded.+-}+ug_mk_node_c :: Constant -> U_Graph -> (U_Node, U_Graph)+ug_mk_node_c (Constant x _b) g =+ let y = find (is_u_node_c_of x) (ug_constants g)+ in maybe (ug_push_c x g) (\y' -> (y', g)) y++-- | Insert a control node into the 'U_Graph'.+ug_push_k :: Control -> U_Graph -> (U_Node, U_Graph)+ug_push_k (Control r ix nm d tr meta _brk) g =+ let n = U_Node_K (ug_next_id g) r ix nm d (Rate.ktype r tr) meta+ in ( n+ , g+ { ug_controls = n : ug_controls g+ , ug_next_id = ug_next_id g + 1+ }+ )++-- | Either find existing 'Control' 'U_Node', or insert a new 'U_Node'.+ug_mk_node_k :: Control -> U_Graph -> (U_Node, U_Graph)+ug_mk_node_k c g =+ let nm = controlName c+ y = find (is_u_node_k_of nm) (ug_controls g)+ in maybe (ug_push_k c g) (\y' -> (y', g)) y++-- | Insert a /primitive/ 'U_Node_U' into the 'U_Graph'.+ug_push_u :: U_Node_NoId -> U_Graph -> (U_Node, U_Graph)+ug_push_u (r, nm, i, o, s, d) g =+ let n = U_Node_U (ug_next_id g) r nm i o s d+ in ( n+ , g+ { ug_ugens = n : ug_ugens g+ , ug_next_id = ug_next_id g + 1+ }+ )++-- | Recursively traverse set of Ugen calling 'ug_mk_node'.+ug_mk_node_rec :: [Ugen] -> [U_Node] -> U_Graph -> ([U_Node], U_Graph)+ug_mk_node_rec u n g =+ case u of+ [] -> (reverse n, g)+ x : xs ->+ let (y, g') = ug_mk_node x g+ in ug_mk_node_rec xs (y : n) g'++{- | Run 'ug_mk_node_rec' at inputs and either find existing primitive node or insert a new one.+ Brackets are discarded.+-}+ug_mk_node_u :: Primitive Ugen -> U_Graph -> (U_Node, U_Graph)+ug_mk_node_u (Primitive r nm i o s d _b) g =+ let (i', g') = ug_mk_node_rec i [] g+ i'' = map u_node_from_port i'+ u = (r, nm, i'', o, s, d)+ y = find (u_node_eq_noid u) (ug_ugens g')+ in maybe (ug_push_u u g') (\y' -> (y', g')) y++-- | Proxies do not get stored in the graph. Proxies are always of U nodes.+ug_mk_node_p :: U_Node -> Port_Index -> U_Graph -> (U_Node, U_Graph)+ug_mk_node_p n p g =+ let z = ug_next_id g+ in (U_Node_P z (u_node_id n) p (u_node_u_rate n), g {ug_next_id = z + 1})++{- | Transform 'Ugen' into 'U_Graph', appending to existing 'U_Graph'.+ Allow rhs of Mrg node to be Mce (splice all nodes into graph).+-}+ug_mk_node :: Ugen -> U_Graph -> (U_Node, U_Graph)+ug_mk_node u g =+ case u of+ Constant_U c -> ug_mk_node_c c g+ Control_U k -> ug_mk_node_k k g+ Label_U _ -> error (show ("ug_mk_node: label", u))+ Primitive_U p -> ug_mk_node_u p g+ Proxy_U p ->+ let (n, g') = ug_mk_node_u (proxySource p) g+ in ug_mk_node_p n (proxyIndex p) g'+ Mrg_U m ->+ let f g' l = case l of+ [] -> g'+ n : l' -> let (_, g'') = ug_mk_node n g' in f g'' l'+ in ug_mk_node (mrgLeft m) (f g (mceChannels (mrgRight m)))+ Mce_U _ -> error (show ("ug_mk_node: mce", u))++-- * Implicit++-- | Add implicit /control/ Ugens to 'U_Graph'.+ug_add_implicit_ctl :: U_Graph -> U_Graph+ug_add_implicit_ctl g =+ let (U_Graph z cs ks us) = g+ ks' = sortBy u_node_k_cmp ks+ im = if null ks' then [] else u_node_mk_implicit_ctl ks'+ us' = im ++ us+ in U_Graph z cs ks' us'++-- | Add implicit 'maxLocalBufs' if not present.+ug_add_implicit_buf :: U_Graph -> U_Graph+ug_add_implicit_buf g =+ case u_node_localbuf_count (ug_ugens g) of+ 0 -> g+ n ->+ let (c, g') = ug_mk_node_c (Constant (fromIntegral n) ([], [])) g+ p = u_node_from_port c+ u = U_Node_U (-1) Rate.InitialisationRate "MaxLocalBufs" [p] [] (Special 0) no_id+ in g' {ug_ugens = u : ug_ugens g'}++-- | 'ug_add_implicit_buf' and 'ug_add_implicit_ctl'.+ug_add_implicit :: U_Graph -> U_Graph+ug_add_implicit = ug_add_implicit_buf . ug_add_implicit_ctl++-- | Remove implicit Ugens from 'U_Graph'+ug_remove_implicit :: U_Graph -> U_Graph+ug_remove_implicit g =+ let u = filter (not . u_node_is_implicit) (ug_ugens g)+ in g {ug_ugens = u}++-- * Graph (Queries)++-- | Descendents at 'U_Graph' of 'U_Node'.+u_node_descendents :: U_Graph -> U_Node -> [U_Node]+u_node_descendents g n =+ let e = ug_edges g+ c = filter ((== u_node_id n) . from_port_nid . fst) e+ f (To_Port k _) = k+ in mapMaybe (ug_find_node g . f . snd) c++-- * PV edge accounting++-- | List @PV@ 'U_Node's at 'U_Graph' with multiple out edges.+ug_pv_multiple_out_edges :: U_Graph -> [U_Node]+ug_pv_multiple_out_edges g =+ let e = ug_edges g+ p = u_edge_multiple_out_edges e+ n = mapMaybe (ug_find_node g . from_port_nid) p+ in filter (Analysis.primitive_is_pv_rate . u_node_u_name) n++{- | Error string if graph has an invalid @PV@ subgraph, ie. multiple out edges+at @PV@ node not connecting to @Unpack1FFT@ & @PackFFT@, else Nothing.+-}+ug_pv_check :: U_Graph -> Maybe String+ug_pv_check g =+ case ug_pv_multiple_out_edges g of+ [] -> Nothing+ n ->+ let d = concatMap (map u_node_u_name . u_node_descendents g) n+ in if any Analysis.primitive_is_pv_rate d || any (`elem` ["IFFT"]) d+ then Just (show ("PV: multiple out edges, see pv_Split", map u_node_u_name n, d))+ else Nothing++-- | Variant that runs 'error' as required.+ug_pv_validate :: U_Graph -> U_Graph+ug_pv_validate g = maybe g error (ug_pv_check g)++-- * Ugen to U_Graph++{- | Transform a unit generator into a graph.+ 'ug_mk_node' begins with an empty graph,+ then reverses the resulting 'Ugen' list and sorts the 'Control' list,+ and finally adds implicit nodes and validates PV sub-graphs.++> import Sound.Sc3 {\- hsc3 -\}+> ugen_to_graph (out 0 (pan2 (sinOsc ar 440 0) 0.5 0.1))+-}+ugen_to_graph_direct :: Ugen -> U_Graph+ugen_to_graph_direct u =+ let (_, g) = ug_mk_node (Util.prepare_root u) ug_empty_graph+ g' =+ g+ { ug_ugens = reverse (ug_ugens g)+ , ug_controls = u_node_sort_controls (ug_controls g)+ }+ in ug_pv_validate (ug_add_implicit g')++{-+ugen_to_graph_netlist :: Ugen -> U_Graph+ugen_to_graph_netlist u =+ let g = netlist_to_u_graph (ugenNetlist (Util.prepare_root u))+ g' = g {ug_ugens = reverse (ug_ugens g)+ ,ug_controls = u_node_sort_controls (ug_controls g)}+ in ug_pv_validate (ug_add_implicit g')+-}++ugen_to_graph :: Ugen -> U_Graph+ugen_to_graph = ugen_to_graph_direct++-- * Stat++-- | Simple statistical analysis of a unit generator graph.+ug_stat_ln :: U_Graph -> [String]+ug_stat_ln s =+ let cs = ug_constants s+ ks = ug_controls s+ us = ug_ugens s+ hist pp_f =+ let h (x : xs) = (x, length (x : xs))+ h [] = error "graph_stat_ln"+ in unwords . map ((\(p, q) -> pp_f p ++ "×" ++ show q) . h) . group . sort+ in [ "number of constants : " ++ show (length cs)+ , "number of controls : " ++ show (length ks)+ , "control rates : " ++ hist show (map u_node_k_rate ks)+ , "control names : " ++ unwords (map u_node_k_name ks)+ , "number of unit generators : " ++ show (length us)+ , "unit generator rates : " ++ hist Rate.rateAbbrev (map u_node_u_rate us)+ , "unit generator set : " ++ hist id (map u_node_user_name us)+ , "unit generator sequence : " ++ unwords (map u_node_user_name us)+ ]++-- | 'unlines' of 'ug_stat_ln'.+ug_stat :: U_Graph -> String+ug_stat = unlines . ug_stat_ln++-- * Indices++{- | Find indices of all instances of the named Ugen at 'Graph'.+The index is required when using 'Sound.Sc3.Server.Command.u_cmd'.+-}+ug_ugen_indices :: (Num n, Enum n) => String -> U_Graph -> [n]+ug_ugen_indices nm =+ let f (k, nd) =+ case nd of+ U_Node_U _ _ nm' _ _ _ _ -> if nm == nm' then Just k else Nothing+ _ -> Nothing+ in mapMaybe f . zip [0 ..] . ug_ugens
+ Sound/Sc3/Ugen/Graph/Reconstruct.hs view
@@ -0,0 +1,150 @@+-- | A disassembler for Ugen graphs.+module Sound.Sc3.Ugen.Graph.Reconstruct where++import Data.Char {- base -}+import Data.List {- base -}+import Text.Printf {- base -}++import qualified Sound.Sc3.Common.Math.Operator as Operator+import qualified Sound.Sc3.Common.Rate as Rate+import qualified Sound.Sc3.Ugen.Graph as Graph+import qualified Sound.Sc3.Ugen.Types as Types+import qualified Sound.Sc3.Ugen.Util as Util++-- | Generate label for 'Graph.From_Port'+from_port_label :: Char -> Graph.From_Port -> String+from_port_label jn fp =+ case fp of+ Graph.From_Port_C n -> printf "c_%d" n+ Graph.From_Port_K n _ -> printf "k_%d" n+ Graph.From_Port_U n Nothing -> printf "u_%d" n+ Graph.From_Port_U n (Just i) -> printf "u_%d%co_%d" n jn i++-- | Any name that does not begin with a letter is considered an operator.+is_operator_name :: String -> Bool+is_operator_name nm =+ case nm of+ c : _ -> not (isLetter c)+ _ -> False++parenthesise_operator :: String -> String+parenthesise_operator nm =+ if is_operator_name nm+ then printf "(%s)" nm+ else nm++reconstruct_graph :: Graph.U_Graph -> ([String], String)+reconstruct_graph g =+ let (Graph.U_Graph _ c k u) = g+ ls =+ concat+ [ map reconstruct_c_str (Graph.u_node_sort c)+ , map reconstruct_k_str (Graph.u_node_sort k)+ , concatMap reconstruct_u_str u+ ]+ in (filter (not . null) ls, reconstruct_mrg_str u)++reconstruct_graph_module :: String -> Graph.U_Graph -> [String]+reconstruct_graph_module nm gr =+ let imp =+ [ "import Sound.Sc3 {- hsc3 -}"+ , "import Sound.Sc3.Common.Base {- hsc3 -}"+ , "import Sound.Sc3.Ugen.Plain {- hsc3 -}"+ ]+ in case reconstruct_graph gr of+ (b0 : bnd, res) ->+ let hs = (" let " ++ b0) : map (" " ++) bnd ++ [" in " ++ res]+ pre = [nm ++ " :: Ugen", nm ++ " ="]+ in (imp ++ pre ++ hs)+ _ -> error "reconstruct_graph_module"++{- | Generate a reconstruction of a 'Graph'.++> import Sound.Sc3+> import Sound.Sc3.Ugen.Graph+> import Sound.Sc3.Ugen.Graph.Reconstruct++> let k = control kr "bus" 0+> let o = sinOsc ar 440 0 + whiteNoiseId 'α' ar+> let u = out k (pan2 (o * 0.1) 0 1)+> let m = mrg [u,out 1 (impulse ar 1 0 * 0.1)]+> putStrLn (reconstruct_graph_str "anon" (ugen_to_graph m))+-}+reconstruct_graph_str :: String -> Graph.U_Graph -> String+reconstruct_graph_str nm = unlines . reconstruct_graph_module nm++reconstruct_c_str :: Graph.U_Node -> String+reconstruct_c_str u =+ let l = Graph.u_node_label u+ c = Graph.u_node_c_value u+ in printf "%s = constant (%f::Sample)" l c++reconstruct_c_ugen :: Graph.U_Node -> Types.Ugen+reconstruct_c_ugen u = Types.constant (Graph.u_node_c_value u)++-- | Discards index.+reconstruct_k_rnd :: Graph.U_Node -> (Rate.Rate, String, Types.Sample)+reconstruct_k_rnd u =+ let r = Graph.u_node_k_rate u+ n = Graph.u_node_k_name u+ d = Graph.u_node_k_default u+ in (r, n, d)++reconstruct_k_str :: Graph.U_Node -> String+reconstruct_k_str u =+ let l = Graph.u_node_label u+ (r, n, d) = reconstruct_k_rnd u+ in printf "%s = control %s \"%s\" %f" l (show r) n d++reconstruct_k_ugen :: Graph.U_Node -> Types.Ugen+reconstruct_k_ugen u =+ let (r, n, d) = reconstruct_k_rnd u+ in Util.control_f64 r Nothing n d++ugen_qname :: String -> Types.Special -> (String, String)+ugen_qname nm (Types.Special n) =+ case nm of+ "UnaryOpUGen" -> ("uop Cs", Operator.unaryName n)+ "BinaryOpUGen" -> ("binop Cs", Operator.binaryName n)+ _ -> ("ugen", nm)++reconstruct_mce_str :: Graph.U_Node -> String+reconstruct_mce_str u =+ let o = length (Graph.u_node_u_outputs u)+ l = Graph.u_node_label u+ p = map (printf "%s_o_%d" l) [0 .. o - 1]+ p' = intercalate "," p+ in if o <= 1+ then ""+ else printf "[%s] = mceChannels %s" p' l++reconstruct_u_str :: Graph.U_Node -> [String]+reconstruct_u_str u =+ let l = Graph.u_node_label u+ r = Graph.u_node_u_rate u+ i = Graph.u_node_u_inputs u+ i_s = unwords (map (from_port_label '_') i)+ i_l = intercalate "," (map (from_port_label '_') i)+ s = Graph.u_node_u_special u+ (q, n) = ugen_qname (Graph.u_node_u_name u) s+ z = Graph.u_node_id u+ o = length (Graph.u_node_u_outputs u)+ u_s = printf "%s = ugen \"%s\" %s [%s] %d" l n (show r) i_l o+ nd_s =+ let t = "%s = nondet \"%s\" (Uid %d) %s [%s] %d"+ in printf t l n z (show r) i_l o+ c = case q of+ "ugen" -> if Graph.u_node_u_ugenid u == Types.NoId then u_s else nd_s+ _ -> printf "%s = %s \"%s\" %s %s" l q n (show r) i_s+ m = reconstruct_mce_str u+ in if Graph.u_node_is_implicit_control u+ then []+ else if null m then [c] else [c, m]++reconstruct_mrg_str :: [Graph.U_Node] -> String+reconstruct_mrg_str u =+ let zero_out n = not (Graph.u_node_is_implicit_control n) && null (Graph.u_node_u_outputs n)+ in case map Graph.u_node_label (filter zero_out u) of+ [] -> error "reconstruct_mrg_str: nil input?"+ [o] -> printf "%s" o+ o -> printf "mrg [%s]" (intercalate "," o)
+ Sound/Sc3/Ugen/Graph/Transform.hs view
@@ -0,0 +1,83 @@+-- | Transformations over 'Graph' structure.+module Sound.Sc3.Ugen.Graph.Transform where++import Data.Either {- base -}+import Data.List {- base -}++import qualified Sound.Sc3.Common.Rate as Rate {- hsc3 -}+import qualified Sound.Sc3.Common.Uid as Uid {- hsc3 -}+import Sound.Sc3.Ugen.Graph++-- * Lift constants++{- | Transform 'U_Node_C' to 'U_Node_K', 'id' for other 'U_Node' types.++> let k = U_Node_K 8 ControlRate Nothing "k_8" 0.1 K_ControlRate Nothing+> node_k_eq k (snd (constant_to_control 8 (U_Node_C 0 0.1)))+-}+constant_to_control :: Uid.Id -> U_Node -> (Uid.Id, U_Node)+constant_to_control z n =+ case n of+ U_Node_C _ k -> (z + 1, U_Node_K z Rate.ControlRate Nothing ("k_" ++ show z) k Rate.K_ControlRate Nothing)+ _ -> (z, n)++-- | If the 'From_Port' is a /constant/ generate a /control/ 'U_Node', else retain 'From_Port'.+c_lift_from_port :: U_Graph -> Uid.Id -> From_Port -> (Uid.Id, Either From_Port U_Node)+c_lift_from_port g z fp =+ case fp of+ From_Port_C _ ->+ let n = ug_from_port_node_err g fp+ (z', n') = constant_to_control z n+ in (z', Right n')+ _ -> (z, Left fp)++{- | Lift a set of 'U_NodeU' /inputs/ from constants to controls. The+result triple gives the incremented 'Uid.Id', the transformed+'From_Port' list, and the list of newly minted control 'U_Node's.+-}+c_lift_inputs :: U_Graph -> Uid.Id -> [From_Port] -> (Uid.Id, [From_Port], [U_Node])+c_lift_inputs g z i =+ let (z', r) = mapAccumL (c_lift_from_port g) z i+ f e = case e of+ Left fp -> fp+ Right n -> u_node_from_port n+ r' = map f r+ in (z', r', rights r)++-- | Lift inputs at 'U_Node_U' as required.+c_lift_ugen :: U_Graph -> Uid.Id -> U_Node -> (Uid.Id, U_Node, [U_Node])+c_lift_ugen g z n =+ case n of+ U_Node_U {} ->+ let i = u_node_u_inputs n+ (z', i', k) = c_lift_inputs g z i+ in (z', n {u_node_u_inputs = i'}, k)+ _ -> error "c_lift_ugen"++-- | 'c_lift_ugen' at list of 'U_Node_U'.+c_lift_ugens :: U_Graph -> Uid.Id -> [U_Node] -> (Uid.Id, [U_Node], [U_Node])+c_lift_ugens g =+ let recur (k, r) z u =+ case u of+ [] -> (z, k, reverse r)+ n : u' ->+ let (z', n', k') = c_lift_ugen g z n+ in recur (k ++ k', n' : r) z' u'+ in recur ([], [])++{- | Lift constants to controls.++> import Sound.Sc3 {\- hsc3 -\}+> import Sound.Sc3.Ugen.Dot {\- hsc3-dot -\}++> let u = out 0 (sinOsc AR 440 0 * 0.1)+> let g = ugen_to_graph u+> draw g+> draw (lift_constants g)+-}+lift_constants :: U_Graph -> U_Graph+lift_constants g =+ let (U_Graph z _ k u) = ug_remove_implicit g+ (z', k', u') = c_lift_ugens g z u+ g' = U_Graph z' [] (nubBy u_node_k_eq (k ++ k')) u'+ in ug_add_implicit g'
+ Sound/Sc3/Ugen/Help/Graph.hs view
@@ -0,0 +1,87 @@+-- | Standard SC3 graphs, referenced in documentation.+module Sound.Sc3.Ugen.Help.Graph where++import Sound.Sc3.Common.Enum+import Sound.Sc3.Common.Envelope+import Sound.Sc3.Common.Rate++import Sound.Sc3.Ugen.Bindings+import Sound.Sc3.Ugen.Mce+import Sound.Sc3.Ugen.Ugen+import Sound.Sc3.Ugen.Util++-- | The SC3 /default/ instrument 'Ugen' graph.+default_ugen_graph :: Ugen+default_ugen_graph =+ let f = control kr "freq" 440+ a = control kr "amp" 0.1+ p = control kr "pan" 0+ g = control kr "gate" 1+ o = control kr "out" 0+ e = linen g 0.01 0.7 0.3 RemoveSynth+ f3 = mce [f, f + randId 'α' (-0.4) 0, f + randId 'β' 0 0.4]+ l = xLine kr (randId 'γ' 4000 5000) (randId 'δ' 2500 3200) 1 DoNothing+ z = lpf (mix (varSaw ar f3 0 0.3 * 0.3)) l * e+ in out o (pan2 z p a)++-- | A /Gabor/ grain, envelope is by 'lfGauss'.+gabor_grain_ugen_graph :: Ugen+gabor_grain_ugen_graph =+ let o = control ir "out" 0+ f = control ir "freq" 440+ d = control ir "sustain" 1+ l = control ir "pan" 0+ a = control ir "amp" 0.1+ w = control ir "width" 0.25+ e = lfGauss ar d w 0 NoLoop RemoveSynth+ s = fSinOsc ar f (0.5 * pi) * e+ in offsetOut o (pan2 s l a)++-- | A /sine/ grain, envelope is by 'envGen' of 'envSine'.+sine_grain_ugen_graph :: Ugen+sine_grain_ugen_graph =+ let o = control ir "out" 0+ f = control ir "freq" 440+ d = control ir "sustain" 1+ l = control ir "pan" 0+ a = control ir "amp" 0.1+ w = control ir "width" 0.25+ e = envGen ar 1 1 0 1 RemoveSynth (envSine (d * w) 1)+ s = fSinOsc ar f (0.5 * pi) * e+ in offsetOut o (pan2 s l a)++{- | Trivial file playback instrument.++If /use_gate/ is 'True' there is a /gate/ parameter and the synth+ends either when the sound file ends or the gate closes, else there+is a /sustain/ parameter to indicate the duration. In both cases a+linear envelope with a decay time of /decay/ is applied.++The /rdelay/ parameter sets the maximum pre-delay time (in+seconds), each instance is randomly pre-delayed between zero and+the indicated time. The /ramplitude/ parameter sets the maximum+amplitude offset of the /amp/ parameter, each instance is randomly+amplified between zero and the indicated value.+-}+default_sampler_ugen_graph :: Bool -> Ugen+default_sampler_ugen_graph use_gate =+ let b = control kr "bufnum" 0+ l = control kr "pan" 0+ a = control kr "amp" 0.1+ r = control kr "rate" 1+ m = control kr "rdelay" 0+ v = control kr "ramplitude" 0+ w = control kr "attack" 0+ y = control kr "decay" 0.5+ r' = bufRateScale kr b * r+ p = playBuf 1 ar b r' 1 0 NoLoop RemoveSynth+ e =+ if use_gate+ then+ let g = control kr "gate" 1+ in envGen kr g 1 0 1 RemoveSynth (envAsr w 1 y EnvSin)+ else+ let s = control kr "sustain" 1+ in envGen kr 1 1 0 1 RemoveSynth (envLinen w s y 1)+ d = delayC (p * e) m (randId 'α' 0 m)+ in out 0 (pan2 d l (a + randId 'β' 0 v))
+ Sound/Sc3/Ugen/Hs.hs view
@@ -0,0 +1,392 @@+-- | Haskell implementations of Sc3 Ugens.+module Sound.Sc3.Ugen.Hs where++import Data.List {- base -}++import qualified Safe {- safe -}+import qualified System.Random as R {- random -}++import Sound.Sc3.Common.Base+import Sound.Sc3.Common.Math+import qualified Sound.Sc3.Common.Math.Filter as Filter++-- | F = function, St = state+type F_St0 st o = st -> (o, st)++type F_St1 st i o = (i, st) -> (o, st)++-- | U = uniform+type F_U2 n = n -> n -> n++type F_U3 n = n -> n -> n -> n+type F_U4 n = n -> n -> n -> n -> n+type F_U5 n = n -> n -> n -> n -> n -> n+type F_U6 n = n -> n -> n -> n -> n -> n -> n+type F_U7 n = n -> n -> n -> n -> n -> n -> n -> n+type F_U8 n = n -> n -> n -> n -> n -> n -> n -> n -> n+type F_U9 n = n -> n -> n -> n -> n -> n -> n -> n -> n -> n++-- | T = tuple (see Base for T2-T4)+type T5 n = (n, n, n, n, n)++type T6 n = (n, n, n, n, n, n)+type T7 n = (n, n, n, n, n, n, n)+type T8 n = (n, n, n, n, n, n, n, n)+type T9 n = (n, n, n, n, n, n, n, n, n)++-- | avg = average+avg2 :: Fractional n => F_U2 n+avg2 p q = (p + q) / 2++avg3 :: Fractional n => F_U3 n+avg3 p q r = (p + q + r) / 3++avg4 :: Fractional n => F_U4 n+avg4 p q r s = (p + q + r + s) / 4++avg5 :: Fractional n => F_U5 n+avg5 p q r s t = (p + q + r + s + t) / 5++avg9 :: Fractional n => F_U9 n+avg9 p q r s t u v w x = (p + q + r + s + t + u + v + w + x) / 9++{- | fir = finite impulse response++>>> l_apply_f_st1 (fir1 (\x z1 -> (x + z1) / 2)) 0 [0 .. 5]+[0.0,0.5,1.5,2.5,3.5,4.5]+-}+fir1 :: F_U2 n -> F_St1 n n n+fir1 f (n, z0) = (f n z0, n)++{- | fir = finite impulse response++>>> l_apply_f_st1 (fir2 (\x x1 x2 -> (x + x1 + x2) / 2)) (0,0) [0 .. 5]+[0.0,0.5,1.5,3.0,4.5,6.0]+-}+fir2 :: F_U3 n -> F_St1 (T2 n) n n+fir2 f (n, (z1, z0)) = (f n z0 z1, (z0, n))++fir3 :: F_U4 n -> F_St1 (T3 n) n n+fir3 f (n, (z2, z1, z0)) = (f n z0 z1 z2, (z1, z0, n))++fir4 :: F_U5 n -> F_St1 (T4 n) n n+fir4 f (n, (z3, z2, z1, z0)) = (f n z0 z1 z2 z3, (z2, z1, z0, n))++fir8 :: F_U9 n -> F_St1 (T8 n) n n+fir8 f (n, (z7, z6, z5, z4, z3, z2, z1, z0)) = (f n z0 z1 z2 z3 z4 z5 z6 z7, (z6, z5, z4, z4, z2, z1, z0, n))++{- | iir = infinite impulse response++>> l_apply_f_st1 (iir1 (\x y1 -> x + y1)) 0 (replicate 10 1)+[1,2,3,4,5,6,7,8,9,10]+-}+iir1 :: F_U2 n -> F_St1 n n n+iir1 f (n, y0) = let r = f n y0 in (r, r)++{- | Two place iir++>>> l_apply_f_st1 (iir2 (\x y1 y2 -> x + y1 + y2)) (0,0) (replicate 10 1)+[1,2,4,7,12,20,33,54,88,143]++>>> map (+1) [0+0,1+0,2+1,4+2,7+4,12+7,20+12,33+20,54+33,88+54] -- https://oeis.org/A000071+[1,2,4,7,12,20,33,54,88,143]+-}+iir2 :: F_U3 n -> F_St1 (T2 n) n n+iir2 f (n, (y1, y0)) = let r = f n y0 y1 in (r, (y0, r))++-- | ff = feed-forward, fb = feed-back+iir2_ff_fb :: (n -> n -> n -> T2 n) -> F_St1 (T2 n) n n+iir2_ff_fb f (n, (y1, y0)) = let (r, y0') = f n y0 y1 in (r, (y0, y0'))++biquad :: F_U5 n -> F_St1 (T4 n) n n+biquad f (n, (x1, x0, y1, y0)) = let r = f n x0 x1 y0 y1 in (r, (x0, n, y0, r))++-- | sos = second order section+sos_f :: Num n => T5 n -> F_U5 n+sos_f (a0, a1, a2, b1, b2) x x1 x2 y1 y2 = a0 * x + a1 * x1 + a2 * x2 - b1 * y1 - b2 * y2++sos :: Num n => T5 n -> F_St1 (T4 n) n n+sos p = biquad (sos_f p)++-- | hp = high pass+hpz1 :: Fractional n => F_St1 n n n+hpz1 = fir1 (\n z0 -> 0.5 * (n - z0))++hpz2 :: Fractional n => F_St1 (T2 n) n n+hpz2 = fir2 (\n z0 z1 -> 0.25 * (n - (2 * z0) + z1))++-- | lp = low pass+lpz1 :: Fractional n => F_St1 n n n+lpz1 = fir1 avg2++lpz2 :: Fractional n => F_St1 (T2 n) n n+lpz2 = fir2 (\n z0 z1 -> 0.25 * (n + (2 * z0) + z1))++-- | bp = band pass+bpz2 :: Fractional n => F_St1 (T2 n) n n+bpz2 = fir2 (\n _z0 z1 -> 0.5 * (n - z1))++-- | br = band reject+brz2 :: Fractional n => F_St1 (T2 n) n n+brz2 = fir2 (\n _z0 z1 -> 0.5 * (n + z1))++-- | mavg = moving average+mavg5 :: Fractional n => F_St1 (T4 n) n n+mavg5 = fir4 avg5++mavg9 :: Fractional n => F_St1 (T8 n) n n+mavg9 = fir8 avg9++{- | Sample rate (SR) to radians per sample (RPS).++>>> sr_to_rps 44100 == 0.00014247585730565955+True+-}+sr_to_rps :: Floating n => n -> n+sr_to_rps sr = two_pi / sr++-- | resonz iir2_ff_fb function. param are for 'Filter.resonz_coef'.+resonz_f :: Floating n => T3 n -> (n -> n -> n -> T2 n)+resonz_f param x y1 y2 =+ let (a0, b1, b2) = Filter.resonz_coef param+ y0 = x + b1 * y1 + b2 * y2+ in (a0 * (y0 - y2), y0)++-- | ir = initialization rate+resonz_ir :: Floating n => T3 n -> F_St1 (T2 n) n n+resonz_ir p = iir2_ff_fb (resonz_f p)++-- | rlpf = resonant low pass filter+rlpf_f :: Floating n => (n -> n -> n) -> T3 n -> F_U3 n+rlpf_f max_f param x y1 y2 =+ let (a0, b1, b2) = Filter.rlpf_coef max_f param+ in a0 * x + b1 * y1 + b2 * y2++rlpf_ir :: (Floating n, Ord n) => T3 n -> F_St1 (T2 n) n n+rlpf_ir p = iir2 (rlpf_f max p)++bw_hpf_ir :: Floating n => T2 n -> F_St1 (T4 n) n n+bw_hpf_ir (sample_rate, f) = sos (Filter.bw_lpf_or_hpf_coef True sample_rate f)++bw_lpf_ir :: Floating n => T2 n -> F_St1 (T4 n) n n+bw_lpf_ir (sample_rate, f) = sos (Filter.bw_lpf_or_hpf_coef False sample_rate f)++white_noise :: (R.RandomGen g, Fractional n, R.Random n) => F_St0 g n+white_noise = R.randomR (-1.0, 1.0)++brown_noise_f :: (Fractional n, Ord n) => n -> n -> n+brown_noise_f x y1 =+ let z = x + y1+ in if z > 1.0 then 2.0 - z else if z < (-1.0) then (-2.0) - z else z++brown_noise :: (R.RandomGen g, Fractional n, R.Random n, Ord n) => F_St0 (g, n) n+brown_noise (g, y1) =+ let (n, g') = white_noise g+ r = brown_noise_f (n / 8.0) y1+ in (r, (g', r))++-- | <http://musicdsp.org/files/pink.txt>+pk_pinking_filter_f :: Fractional a => (a, a, a, a, a, a, a) -> a -> (a, (a, a, a, a, a, a, a))+pk_pinking_filter_f (b0, b1, b2, b3, b4, b5, b6) w =+ let b0' = 0.99886 * b0 + w * 0.0555179+ b1' = 0.99332 * b1 + w * 0.0750759+ b2' = 0.96900 * b2 + w * 0.1538520+ b3' = 0.86650 * b3 + w * 0.3104856+ b4' = 0.55000 * b4 + w * 0.5329522+ b5' = -0.7616 * b5 - w * 0.0168980+ p = b0 + b1 + b2 + b3 + b4 + b5 + b6 + w * 0.5362+ b6' = w * 0.115926+ in (p, (b0', b1', b2', b3', b4', b5', b6'))++-- | <http://musicdsp.org/files/pink.txt>+pk_pinking_filter_economy_f :: Fractional a => (a, a, a) -> a -> (a, (a, a, a))+pk_pinking_filter_economy_f (b0, b1, b2) w =+ let b0' = 0.99765 * b0 + w * 0.0990460+ b1' = 0.96300 * b1 + w * 0.2965164+ b2' = 0.57000 * b2 + w * 1.0526913+ p = b0 + b1 + b2 + w * 0.1848+ in (p, (b0', b1', b2'))++-- | dt must not be zero.+decay_f :: Floating a => a -> a -> a -> a -> a+decay_f sr dt x y1 =+ let b1 = exp (log 0.001 / (dt * sr))+ in x + b1 * y1++{- | Given time /dt/ in frames construct 'iir1' 'lag' function.+ dt must not be zero.+-}+lag_f_frames :: Floating a => a -> a -> a -> a+lag_f_frames dt x y1 = let b1 = exp (log 0.001 / dt) in x + b1 * (y1 - x)++-- | 'lag_f_frames' with /dt/ in seconds.+lag_f :: Floating a => a -> a -> a -> a -> a+lag_f sr dt = lag_f_frames (dt * sr)++lag :: Floating t => t -> F_St1 t (t, t) t+lag sr ((i, t), st) = let r = lag_f sr t i st in (r, r)++slope :: Num t => t -> F_St1 t t t+slope sr = fir1 (\n z0 -> (n - z0) * sr)++latch :: F_St1 t (t, Bool) t+latch ((n, b), y1) = let r = if b then n else y1 in (r, r)++as_trig :: (Fractional t, Ord t) => F_St1 t t Bool+as_trig (n, y1) = (y1 <= 0.0 && n > 0.0, n)++phasor :: RealFrac t => F_St1 t (Bool, t, t, t, t) t+phasor ((trig, rate, start, end, resetPos), ph) =+ let r = if trig then resetPos else sc3_wrap (ph + rate) start end+ in (ph, r)++-- > Sound.Sc3.Plot.plot_fn_r1_ln (\x -> mod_dif x 0 1) (0,4)+mod_dif :: RealFrac a => a -> a -> a -> a+mod_dif i j m =+ let d = absdif i j `sc3_mod` m+ h = m * 0.5+ in h - absdif d h++{-+-- > Sound.Sc3.Plot.plot_fn_r1_ln (\x -> modDif x 0 1) (0,4)+modDif :: BinaryOp a => a -> a -> a -> a+modDif i j m =+ let d = absDif i j `modE` m+ h = m * 0.5+ in h - absDif d h+-}++-- | * List Processing+l_apply_f_st0 :: F_St0 st o -> st -> [o]+l_apply_f_st0 f st = let (r, st') = f st in r : l_apply_f_st0 f st'++{- | White noise++>>> take 4 (l_white_noise 'α')+[0.9687553280469108,0.808159221997721,-0.8993330152164296,0.23197278942699834]+-}+l_white_noise :: (Enum e, Fractional n, R.Random n) => e -> [n]+l_white_noise e = l_apply_f_st0 white_noise (R.mkStdGen (fromEnum e))++{- | Brown noise++>>> take 4 (l_brown_noise 'α')+[0.12109441600586385,0.22211431875557897,0.10969769185352526,0.13869429053190005]+-}+l_brown_noise :: (Enum e, Fractional n, Ord n, R.Random n) => e -> [n]+l_brown_noise e = l_apply_f_st0 brown_noise (R.mkStdGen (fromEnum e), 0.0)++l_apply_f_st1 :: F_St1 st i o -> st -> [i] -> [o]+l_apply_f_st1 f st xs =+ case xs of+ [] -> []+ x : xs' -> let (r, st') = f (x, st) in r : l_apply_f_st1 f st' xs'++l_lag :: Floating t => t -> [t] -> [t] -> [t]+l_lag sr i t = l_apply_f_st1 (lag sr) 0 (zip i t)++l_slope :: Floating t => t -> [t] -> [t]+l_slope sr = l_apply_f_st1 (slope sr) 0++{- | Phasor++>>> let rp = repeat+>>> take 10 (l_phasor (rp False) (rp 1) (rp 0) (rp 4) (rp 0))+[0.0,1.0,2.0,3.0,0.0,1.0,2.0,3.0,0.0,1.0]+-}+l_phasor :: RealFrac n => [Bool] -> [n] -> [n] -> [n] -> [n] -> [n]+l_phasor trig rate start end resetPos =+ let i = zip5 trig rate start end resetPos+ in l_apply_f_st1 phasor (Safe.headNote "l_phasor" start) i++l_phasor_osc :: RealFrac n => n -> n -> [n] -> [n]+l_phasor_osc sr k f =+ let rp = repeat+ in l_phasor (rp False) (map (cps_to_incr sr k) f) (rp 0) (rp k) (rp 0)++l_sin_osc :: (Floating n, RealFrac n) => n -> [n] -> [n]+l_sin_osc sr f = map sin (l_phasor_osc sr two_pi f)++l_cos_osc :: (Floating n, RealFrac n) => n -> [n] -> [n]+l_cos_osc sr f = map cos (l_phasor_osc sr two_pi f)++l_hpz1 :: Fractional n => [n] -> [n]+l_hpz1 = l_apply_f_st1 hpz1 0++l_hpz2 :: Fractional n => [n] -> [n]+l_hpz2 = l_apply_f_st1 hpz2 (0, 0)++l_lpz1 :: Fractional n => [n] -> [n]+l_lpz1 = l_apply_f_st1 lpz1 0++l_lpz2 :: Fractional n => [n] -> [n]+l_lpz2 = l_apply_f_st1 lpz2 (0, 0)++l_bpz2 :: Fractional n => [n] -> [n]+l_bpz2 = l_apply_f_st1 bpz2 (0, 0)++l_brz2 :: Fractional n => [n] -> [n]+l_brz2 = l_apply_f_st1 brz2 (0, 0)++l_bw_hpf :: Floating n => T2 n -> [n] -> [n]+l_bw_hpf p = l_apply_f_st1 (bw_hpf_ir p) (0, 0, 0, 0)++l_bw_lpf :: Floating n => T2 n -> [n] -> [n]+l_bw_lpf p = l_apply_f_st1 (bw_lpf_ir p) (0, 0, 0, 0)++l_resonz_ir :: Floating n => T3 n -> [n] -> [n]+l_resonz_ir p = l_apply_f_st1 (resonz_ir p) (0, 0)++l_rlpf_ir :: (Floating n, Ord n) => T3 n -> [n] -> [n]+l_rlpf_ir p = l_apply_f_st1 (rlpf_ir p) (0, 0)++l_mavg5 :: Fractional n => [n] -> [n]+l_mavg5 = l_apply_f_st1 mavg5 (0, 0, 0, 0)++l_mavg9 :: Fractional n => [n] -> [n]+l_mavg9 = l_apply_f_st1 mavg9 (0, 0, 0, 0, 0, 0, 0, 0)++{-++import Sound.Sc3.Plot {- hsc3-plot -}+import Sound.Sc3.Plot.FFT {- hsc3-plot -}++let n = take 4096 (l_white_noise 'α')+let plotTable1 = plot_p1_ln . return++plotTable1 n+plotTable1 (take 4096 (l_brown_noise 'α'))++plotTable1 (l_lpz1 n)+plotTable1 (l_lpz2 n)+plotTable1 (l_hpz1 n)+plotTable1 (l_hpz2 n)++plotTable1 (rfft_pure n)+plotTable1 (rfft_pure (l_lpz1 n))+plotTable1 (rfft_pure (l_lpz2 n))+plotTable1 (rfft_pure (l_hpz1 n))+plotTable1 (rfft_pure (l_hpz2 n))+plotTable1 (rfft_pure (l_bpz2 n))+plotTable1 (rfft_pure (l_brz2 n))+plotTable1 (rfft_pure (l_bw_lpf (44100,9000) n))+plotTable1 (rfft_pure (l_bw_hpf (44100,9000) n))+plotTable1 (rfft_pure (l_resonz_ir (sr_to_rps 44100,440,0.1) n))+plotTable1 (rfft_pure (l_rlpf_ir (sr_to_rps 44100,1200,0.1) n))++import Sound.Sc3.Common.Math {- hsc3 -}++plot_fft1_mnn 44100 (rfft_pure (l_bw_lpf (44100,midi_to_cps 60) n))+plot_fft1_mnn 44100 (rfft_pure (l_resonz_ir (sr_to_rps 44100,midi_to_cps 69,0.1) n))+plot_fft1_mnn 44100 (rfft_pure (l_rlpf_ir (sr_to_rps 44100,midi_to_cps 86,0.1) n))++plotTable1 (l_mavg9 (rfft_pure n))+plotTable1 (l_mavg9 (rfft_pure (l_lpz2 n)))+plotTable1 (l_mavg9 (rfft_pure (l_hpz2 n)))+plotTable1 (l_mavg9 (rfft_pure (l_bpz2 n)))+plotTable1 (l_mavg9 (l_mavg9 (l_mavg9 (l_mavg9 (rfft_pure (l_brz2 n))))))++plotTable1 (take 512 (l_sin_osc 48000 (repeat 440)))+plotTable1 (take 512 (l_cos_osc 48000 (repeat 440)))++-}
+ Sound/Sc3/Ugen/Label.hs view
@@ -0,0 +1,4 @@+-- | Label.+module Sound.Sc3.Ugen.Label where++newtype Label = Label {ugenLabel :: String} deriving (Ord, Eq, Read, Show)
+ Sound/Sc3/Ugen/Math.hs view
@@ -0,0 +1,35 @@+-- | Ugen math+module Sound.Sc3.Ugen.Math where++import qualified Sound.Sc3.Common.Math as Math+import qualified Sound.Sc3.Common.Math.Operator as Operator+import qualified Sound.Sc3.Common.Uid as Uid++import qualified Sound.Sc3.Ugen.Bindings.Db as Bindings+import qualified Sound.Sc3.Ugen.Ugen as Ugen++-- | Pseudo-infinite constant Ugen.+dinf :: Ugen.Ugen+dinf = Ugen.constant (9e8 :: Ugen.Sample)++-- | 'Ugen' form of 'ceilingE'.+ceil :: Ugen.Ugen -> Ugen.Ugen+ceil = Operator.ceilingE++-- | Midi note number and velocity data is in (0, 127). This maps (0,1) to (0,100), i.e. is it (* 100).+unitMidi :: Num t => t -> t+unitMidi = (*) 100++{- | midiCps of (0,1) scaled to (0,100).+ To make control signal data uniform, all control signals are in (0, 1).+-}+unitCps :: Operator.UnaryOp t => t -> t+unitCps = Operator.midiCps . (* 100)++-- | Optimised Ugen sum function.+sum_opt :: [Ugen.Ugen] -> Ugen.Ugen+sum_opt = Math.sum_opt_f Bindings.sum3 Bindings.sum4++-- | Apply the Ugen processor /f/ /k/ times in sequence to /i/, ie. for k=4 /f (f (f (f i)))/.+useqId :: (Uid.ID z, Enum z) => z -> Int -> (z -> Ugen.Ugen -> Ugen.Ugen) -> Ugen.Ugen -> Ugen.Ugen+useqId z k f i = if k <= 0 then i else useqId (succ z) (k - 1) f (f z i)
+ Sound/Sc3/Ugen/Math/Composite.hs view
@@ -0,0 +1,32 @@+-- | Non-primitve math Ugens.+module Sound.Sc3.Ugen.Math.Composite where++import Sound.Sc3.Common.Math.Operator++import Sound.Sc3.Ugen.Ugen+import Sound.Sc3.Ugen.Util++-- | Select /q/ or /r/ by /p/, ie. @if p == 1 then q else if p == 0 then r@.+ugen_if :: Num a => a -> a -> a -> a+ugen_if p q r = (p * q) + ((1 - p) * r)++{- | Separate input into integral and fractional parts.++>>> ugen_integral_and_fractional_parts 1.5 == mce2 1 0.5+True+-}+ugen_integral_and_fractional_parts :: Ugen -> Ugen+ugen_integral_and_fractional_parts n =+ let gt_eq_0 = let n' = floorE n in mce2 n' (n - n')+ lt_0 = let n' = ceilingE n in mce2 n' (n - n')+ in ugen_if (n `greater_than_or_equal_to` 0) gt_eq_0 lt_0++{- | Fractional midi into integral midi and cents detune.++>>> ugen_fmidi_to_midi_detune 60.5 == mce2 60 50+True+-}+ugen_fmidi_to_midi_detune :: Ugen -> Ugen+ugen_fmidi_to_midi_detune mnn =+ let (n, c) = unmce2 (ugen_integral_and_fractional_parts mnn)+ in mce2 n (c * 100)
+ Sound/Sc3/Ugen/Mce.hs view
@@ -0,0 +1,85 @@+-- | Multiple channel expansion+module Sound.Sc3.Ugen.Mce where++import Control.Monad {- base -}+import Data.List {- base -}++import qualified Data.List.Split as Split {- split -}++import Sound.Sc3.Common.Uid {- hsc3 -}+import qualified Sound.Sc3.Ugen.Math as Math {- hsc3 -}+import Sound.Sc3.Ugen.Ugen {- hsc3 -}++-- | Construct a list of Ugens by applying f to consecutive identifiers (from z) and indices (from 0).+listFillId :: (Integral n, ID z, Enum z) => z -> Int -> (z -> n -> Ugen) -> [Ugen]+listFillId z n f = zipWith f [z ..] [0 .. fromIntegral n - 1]++-- | Construct a list of Ugens by applying f at consecutive indices (from 0).+listFillM :: (Uid m, Integral n) => Int -> (n -> m Ugen) -> m [Ugen]+listFillM n f = mapM f [0 .. fromIntegral n - 1]++-- | Construct a list of Ugens by applying f at consecutive indices (from 0).+listFill :: Integral n => Int -> (n -> Ugen) -> [Ugen]+listFill n f = map f [0 .. fromIntegral n - 1]++-- | 'mce' of 'replicate'+mceConst :: Int -> Ugen -> Ugen+mceConst n = mce . replicate n++-- | 'mce' of 'map' /f/ of 'id_seq' /n/.+mceGenId :: ID z => (Id -> Ugen) -> Int -> z -> Ugen+mceGenId f n = mce . map f . id_seq n++-- | Applicative variant of mceGenId.+mceGenM :: Applicative f => f Ugen -> Int -> f Ugen+mceGenM f n = fmap mce (replicateM n f)++-- | Count 'mce' channels.+mceSize :: Ugen -> Ugen+mceSize = constant . length . mceChannels++-- | Mix divided by number of inputs.+mceMean :: Ugen -> Ugen+mceMean e = let p = mceChannels e in Math.sum_opt p / constant (length p)++-- | Construct an Mce array of Ugens.+mceFill :: Integral n => Int -> (n -> Ugen) -> Ugen+mceFill n = mce . listFill n++-- | 'mce' of 'listFillId'+mceFillId :: (Integral n, ID z, Enum z) => z -> Int -> (z -> n -> Ugen) -> Ugen+mceFillId z n = mce . listFillId z n++-- | Type specialised mceFill+mceFillInt :: Int -> (Int -> Ugen) -> Ugen+mceFillInt = mceFill++-- | Collapse possible mce by summing.+mix :: Ugen -> Ugen+mix = Math.sum_opt . mceChannels++-- | Mix variant, sum to n channels.+mixTo :: Int -> Ugen -> Ugen+mixTo n u =+ let xs = transpose (Split.chunksOf n (mceChannels u))+ in mce (map Math.sum_opt xs)++-- | 'mix' of 'mceFill'+mixFill :: Integral n => Int -> (n -> Ugen) -> Ugen+mixFill n = mix . mceFill n++-- | Type specialised mixFill+mixFillInt :: Int -> (Int -> Ugen) -> Ugen+mixFillInt = mixFill++-- | Type specialised mixFill+mixFillUgen :: Int -> (Ugen -> Ugen) -> Ugen+mixFillUgen = mixFill++-- | 'mix' of 'mceFillId'+mixFillId :: (Integral n, ID z, Enum z) => z -> Int -> (z -> n -> Ugen) -> Ugen+mixFillId z n = mix . mceFillId z n++-- | Monad variant on mixFill.+mixFillM :: (Integral n, Monad m) => Int -> (n -> m Ugen) -> m Ugen+mixFillM n f = fmap Math.sum_opt (mapM f [0 .. fromIntegral n - 1])
+ Sound/Sc3/Ugen/Mrg.hs view
@@ -0,0 +1,8 @@+-- | Multiple root graph (Mrg)+module Sound.Sc3.Ugen.Mrg where++data Mrg t = Mrg+ { mrgLeft :: t+ , mrgRight :: t+ }+ deriving (Ord, Eq, Read, Show)
+ Sound/Sc3/Ugen/Name.hs view
@@ -0,0 +1,97 @@+{- | Functions to normalise Ugen names.++@Sc3@ Ugen names are capitalised at word boundaries.+@hsc3@ cannot use these names for Ugen constructor functions.+Haskell names are given by lower-casing until the first word edge.+Lisp names are given by lower-casing everything and adding hyphens before edges.+-}+module Sound.Sc3.Ugen.Name where++import Data.Char {- base -}++import Sound.Sc3.Common.Base {- hsc3 -}+import Sound.Sc3.Common.Rate {- hsc3 -}++{-+import qualified Sound.Sc3.Common.Base {- hsc3 -}++is_uc_or_num :: Char -> Bool+is_uc_or_num c = isUpper c || isDigit c++is_lc_or_num :: Char -> Bool+is_lc_or_num c = isLower c || isDigit c+-}++{- | Find all Sc3 name edges. Edges occur at non lower-case letters.+ This rule is very simple but is coherent and predictable and works well for .hs names.+-}+sc3_name_edges_plain :: String -> [Bool]+sc3_name_edges_plain = map (not . isLower)++{- | Find non-initial Sc3 name edges.++>>> sc3_name_edges "SinOsc"+[False,False,False,True,False,False]++>>> sc3_name_edges "FFT"+[False,False,False]++>>> sc3_name_edges "DFM1"+[False,False,False,False]++>>> sc3_name_edges "PV_Add"+[False,False,False,True,False,False]++>>> sc3_name_edges "A2K"+[False,False,False]++>>> sc3_name_edges "Lag2UD"+[False,False,False,True,True,True]++>>> sc3_name_edges "PeakEQ"+[False,False,False,False,True,True]+-}+sc3_name_edges :: String -> [Bool]+sc3_name_edges s =+ let (p, q) = span (== True) (sc3_name_edges_plain s)+ n = length p+ in if n < 2 || null q+ then replicate n False ++ q+ else replicate (n - 1) False ++ [True] ++ q++{- | Convert from ScLang (class) name to Haskell (function) name.++>>> let f = unwords . map sc3_name_to_hs_name . words+>>> f "SinOsc LFSaw FFT PV_Add AllpassN BHiPass BinaryOpUGen HPZ1 RLPF"+"sinOsc lfSaw fft pv_Add allpassN bHiPass binaryOpUGen hpz1 rlpf"++>>> f "TGrains DFM1 FBSineC A2K Lag2UD IIRFilter FMGrainB Pan2 PeakEQ RIRandN"+"tGrains dfm1 fbSineC a2k lag2UD iirFilter fmGrainB pan2 peakEQ riRandN"+-}+sc3_name_to_hs_name :: String -> String+sc3_name_to_hs_name s =+ let f (c, e) = if e then toUpper c else c+ in zipWith (curry f) (map toLower s) (sc3_name_edges s)++{- | Convert from Sc3 name to Lisp style name.++>>> let f = unwords . map sc3_name_to_lisp_name . words+>>> f "SinOsc LFSaw FFT PV_Add AllpassN BHiPass BinaryOpUGen HPZ1 RLPF TGrains DFM1 BPeakEQ Pan2 RIRandN"+"sin-osc lf-saw fft pv-add allpass-n b-hi-pass binary-op-u-gen hpz1 rlpf t-grains dfm1 b-peak-e-q pan-2 ri-rand-n"+-}+sc3_name_to_lisp_name :: String -> String+sc3_name_to_lisp_name s =+ let f (c, e) = if e then ['-', c] else if c == '_' then [] else [c]+ in concatMap f (zip (map toLower s) (sc3_name_edges s))++{- | Sc3 Ugen /names/ are given with rate suffixes if oscillators, without if filters.++>>> map sc3_ugen_name_sep (words "SinOsc.ar LPF *")+[Just ("SinOsc",Just AudioRate),Just ("LPF",Nothing),Just ("*",Nothing)]+-}+sc3_ugen_name_sep :: String -> Maybe (String, Maybe Rate)+sc3_ugen_name_sep u =+ case string_split_at_char '.' u of+ [nm, rt] -> Just (nm, rate_parse (map toUpper rt))+ [nm] -> Just (nm, Nothing)+ _ -> Nothing
+ Sound/Sc3/Ugen/Optimise.hs view
@@ -0,0 +1,149 @@+-- | Optimisations of Ugen graphs.+module Sound.Sc3.Ugen.Optimise where++import System.Random {- random -}++import Sound.Sc3.Common.Math.Operator+import Sound.Sc3.Common.Rate++import qualified Sound.Sc3.Ugen.Bindings.Db as Bindings {- hsc3 -}+import Sound.Sc3.Ugen.Types+import Sound.Sc3.Ugen.Util++-- | Constant form of 'rand' Ugen.+c_rand :: Random a => Int -> a -> a -> a+c_rand z l r = fst (randomR (l, r) (mkStdGen z))++-- | Constant form of 'iRand' Ugen.+c_irand :: (Num b, RealFrac a, Random a) => Int -> a -> a -> b+c_irand z l r = fromInteger (round (c_rand z l r))++{- | Optimise 'Ugen' graph by re-writing 'rand' and 'iRand' Ugens that+have 'Constant' inputs. This, of course, changes the nature of the+graph, it is no longer randomised at the server. It's a useful+transformation for very large graphs which are being constructed+and sent each time the graph is played.++> import Sound.Sc3.Ugen.Dot {\- hsc3-dot -\}++> let u = sinOsc ar (randId 'a' 220 440) 0 * 0.1+> draw (u + ugen_optimise_ir_rand u)+-}+ugen_optimise_ir_rand :: Ugen -> Ugen+ugen_optimise_ir_rand =+ let f u =+ case u of+ Primitive_U p ->+ case p of+ Primitive+ InitialisationRate+ "Rand"+ [ Constant_U (Constant l ([], []))+ , Constant_U (Constant r ([], []))+ ]+ [InitialisationRate]+ _+ (Uid z)+ ([], []) -> Constant_U (Constant (c_rand z l r) ([], []))+ Primitive+ InitialisationRate+ "IRand"+ [ Constant_U (Constant l ([], []))+ , Constant_U (Constant r ([], []))+ ]+ [InitialisationRate]+ _+ (Uid z)+ ([], []) -> Constant_U (Constant (c_irand z l r) ([], []))+ _ -> u+ _ -> u+ in ugenTraverse (const False) f++{- | Optimise 'Ugen' graph by re-writing binary operators with+'Constant' inputs. The standard graph constructors already do+this, however subsequent optimisations, ie. 'ugen_optimise_ir_rand'+can re-introduce these sub-graphs, and the /Plain/ graph+constructors are un-optimised.++>>> let u = constant+>>> u 5 * u 10 == u 50+True++>>> u 5 ==** u 5 == u 1+True++>>> u 5 >** u 4 == u 1+True++>>> u 5 <=** u 5 == u 1+True++>>> abs (u (-1)) == u 1+True++>>> u 5 / u 2 == u 2.5+True++>>> min (u 2) (u 3) == u 2+True++>>> max (u 1) (u 3) == u 3+True++> let u = lfPulse ar (2 ** randId 'α' (-9) 1) 0 0.5+> let u' = ugen_optimise_ir_rand u+> draw (mix (mce [u,u',ugen_optimise_const_operator u']))++> ugen_optimise_const_operator (Bindings.mulAdd 3 1 0) == 3+-}+ugen_optimise_const_operator :: Ugen -> Ugen+ugen_optimise_const_operator =+ let f u =+ case u of+ Primitive_U p ->+ case p of+ Primitive+ _+ "BinaryOpUGen"+ [ Constant_U (Constant l ([], []))+ , Constant_U (Constant r ([], []))+ ]+ [_]+ (Special z)+ _+ ([], []) -> case binop_special_hs z of+ Just fn -> Constant_U (Constant (fn l r) ([], []))+ _ -> u+ Primitive+ _+ "UnaryOpUGen"+ [Constant_U (Constant i ([], []))]+ [_]+ (Special z)+ _+ ([], []) -> case uop_special_hs z of+ Just fn -> Constant_U (Constant (fn i) ([], []))+ _ -> u+ Primitive _ "MulAdd" [i, m, a] [_] _ _ ([], []) -> mulAddOptimised i m a+ _ -> u+ _ -> u+ in ugenTraverse (const False) f++-- | 'u_constant' of 'ugen_optimise_ir_rand'.+constant_opt :: Ugen -> Maybe Sample+constant_opt = u_constant . ugen_optimise_ir_rand++{- | Constant optimising MulAdd.++> mulAddOptimised (sinOsc ar 440 0) 1 0 == sinOsc ar 440 0+> mulAddOptimised (sinOsc ar 440 0) 0.1 0 == sinOsc ar 440 0 * 0.1+> mulAddOptimised (sinOsc ar 440 0) 1 1 == sinOsc ar 440 0 + 1+> mulAddOptimised (sinOsc ar 440 0) 0.1 1 == mulAdd (sinOsc ar 440 0) 0.1 1+-}+mulAddOptimised :: Ugen -> Ugen -> Ugen -> Ugen+mulAddOptimised u m a =+ case (is_constant_of 1 m, is_constant_of 0 a) of+ (True, True) -> u+ (False, True) -> u * m+ (True, False) -> u + a+ (False, False) -> Bindings.mulAdd u m a
+ Sound/Sc3/Ugen/Plain.hs view
@@ -0,0 +1,60 @@+{- | Plain notation for SuperCollider Ugen graphs.++> s = ugen "SinOsc" ar [440,0] 1+> m = binop Ci "*" ar s 0.1+> o = ugen "Out" ar [0,m] 0+> map Sound.Sc3.Ugen.Pp.ugen_concise_pp [s, m, o]+["SinOsc","*","Out"]+-}+module Sound.Sc3.Ugen.Plain where++import Sound.Sc3.Common.Base+import Sound.Sc3.Common.Math.Operator+import Sound.Sc3.Common.Rate++import Sound.Sc3.Ugen.Types++-- | Variant of 'mkUgen'.+mk_plain :: Rate -> String -> [Ugen] -> Int -> Special -> UgenId -> Ugen+mk_plain rt nm inp = mkUgen Nothing all_rates (Left rt) nm inp Nothing++{- | Construct unary operator.++> uop Ci "Neg" ar 1+-}+uop :: Case_Rule -> String -> Rate -> Ugen -> Ugen+uop cr nm r p =+ case unaryIndex cr nm of+ Just s -> mk_plain r "UnaryOpUGen" [p] 1 (Special s) NoId+ Nothing -> error "uop"++{- | Construct binary operator.++>>> binop Ci "*" ar 1 2 == binop Ci "Mul" ar 1 2+True++> binop Cs "*" ar (ugen "SinOsc" ar [440,0] 1) 0.1 == sinOsc ar 440 0 * 0.1+True+-}+binop :: Case_Rule -> String -> Rate -> Ugen -> Ugen -> Ugen+binop cr nm r p q =+ case binaryIndex cr nm of+ Just s -> mk_plain r "BinaryOpUGen" [p, q] 1 (Special s) NoId+ Nothing -> error "binop"++{- | Construct deterministic Ugen.++> let o = ugen "SinOsc" ar [440,0] 1+> o == sinOsc ar 440 0+> ugen "Out" ar [0, o] 0 == out 0 (sinOsc ar 440 0)+-}+ugen :: String -> Rate -> [Ugen] -> Int -> Ugen+ugen nm r i nc = mk_plain r nm i nc (Special 0) NoId++{- | Construct non-deterministic Ugen.++> import Sound.Sc3.Common.Uid+> binop Ci "*" ar (nondet "WhiteNoise" (Uid (fromEnum 'α')) ar [] 1) 0.05+-}+nondet :: String -> UgenId -> Rate -> [Ugen] -> Int -> Ugen+nondet nm z r i nc = mk_plain r nm i nc (Special 0) z
+ Sound/Sc3/Ugen/Pp.hs view
@@ -0,0 +1,32 @@+-- | 'Ugen' pretty-printer.+module Sound.Sc3.Ugen.Pp where++import Data.List {- split -}++import Sound.Sc3.Common.Math+import Sound.Sc3.Common.Mce++import Sound.Sc3.Ugen.Types++{- | Print constants and labels directly,+ primitives as un-adorned names,+ mce as [p,q],+ mrg as p&q,+ contols as nm=def,+ proxies as u@n.+ Brackets are not printed.+-}+ugen_concise_pp :: Ugen -> String+ugen_concise_pp u =+ let bracketed (l, r) x = l : x ++ [r]+ prim_pp (Primitive _ nm _ _ sp _ _) = ugen_user_name nm sp+ k = 5+ in case u of+ Constant_U (Constant n _) -> real_pp k n+ Control_U (Control _ _ nm def _ _ _) -> nm ++ "=" ++ real_pp k def+ Label_U (Label s) -> bracketed ('"', '"') s+ Primitive_U p -> prim_pp p+ Proxy_U (Proxy p n) -> prim_pp p ++ "@" ++ show n+ Mce_U (Mce_Scalar s) -> ugen_concise_pp s+ Mce_U (Mce_Vector v) -> bracketed ('[', ']') (concat (intersperse "," (map (ugen_concise_pp . mce_scalar_value) v))) -- hugs+ Mrg_U (Mrg l r) -> unwords [ugen_concise_pp l, "&", ugen_concise_pp r]
+ Sound/Sc3/Ugen/Primitive.hs view
@@ -0,0 +1,32 @@+-- | SuperCollider Ugen primitive.+module Sound.Sc3.Ugen.Primitive where++import Sound.Sc3.Common.Rate {- hsc3 -}++import Sound.Sc3.Ugen.Brackets {- hsc3 -}++-- | Identifier used to distinguish otherwise equal non-deterministic nodes.+data UgenId = NoId | Uid Int deriving (Ord, Eq, Read, Show)++-- | Alias of 'NoId', the 'UgenId' used for deterministic Ugens.+no_id :: UgenId+no_id = NoId++-- | Unit generator output descriptor.+type Output = Rate++-- | Selector for unary and binary operators.+newtype Special = Special Int+ deriving (Ord, Eq, Read, Show)++-- | Sc Ugen primitive.+data Primitive t = Primitive+ { ugenRate :: Rate+ , ugenName :: String+ , ugenInputs :: [t]+ , ugenOutputs :: [Output]+ , ugenSpecial :: Special+ , ugenId :: UgenId+ , primitiveBrackets :: Brackets+ }+ deriving (Ord, Eq, Read, Show)
+ Sound/Sc3/Ugen/Proxy.hs view
@@ -0,0 +1,15 @@+-- | Proxy indicating an output port at a multi-channel Primitive.+module Sound.Sc3.Ugen.Proxy where++import Sound.Sc3.Common.Rate {- hsc3 -}++import Sound.Sc3.Ugen.Primitive {- hsc3 -}++data Proxy t = Proxy+ { proxySource :: Primitive t+ , proxyIndex :: Int+ }+ deriving (Ord, Eq, Read, Show)++proxyRate :: Proxy t -> Rate+proxyRate = ugenRate . proxySource
+ Sound/Sc3/Ugen/Types.hs view
@@ -0,0 +1,11 @@+-- | Composite module of all Ugen related types.+module Sound.Sc3.Ugen.Types (module M) where++import Sound.Sc3.Ugen.Brackets as M+import Sound.Sc3.Ugen.Constant as M+import Sound.Sc3.Ugen.Control as M+import Sound.Sc3.Ugen.Label as M+import Sound.Sc3.Ugen.Mrg as M+import Sound.Sc3.Ugen.Primitive as M+import Sound.Sc3.Ugen.Proxy as M+import Sound.Sc3.Ugen.Ugen as M
+ Sound/Sc3/Ugen/Ugen.hs view
@@ -0,0 +1,753 @@+-- | Unit generator (Ugen) type and instances.+module Sound.Sc3.Ugen.Ugen where++import Data.Bits {- base -}+import qualified Data.Fixed as Fixed {- base -}+import Data.List {- base -}+import Data.Maybe {- base -}++import qualified System.Random as Random {- random -}++import qualified Sound.Sc3.Common.Math as Math+import Sound.Sc3.Common.Math.Operator+import Sound.Sc3.Common.Mce+import Sound.Sc3.Common.Rate++import Sound.Sc3.Ugen.Brackets+import Sound.Sc3.Ugen.Constant+import Sound.Sc3.Ugen.Control+import Sound.Sc3.Ugen.Label+import Sound.Sc3.Ugen.Mrg+import Sound.Sc3.Ugen.Primitive+import Sound.Sc3.Ugen.Proxy++-- * Basic types++{- | Sc3 samples are 32-bit 'Float'.+hsc3 uses 64-bit 'Double'.+If 'Ugen' values are used more generally (ie. see hsc3-forth) 'Float' may be too imprecise, i.e. for representing time stamps.+-}+type Sample = Double++-- | Union type of Unit Generator forms.+data Ugen+ = Constant_U Constant+ | Control_U Control+ | Label_U Label+ | Primitive_U (Primitive Ugen)+ | Proxy_U (Proxy Ugen)+ | Mce_U (Mce Ugen)+ | Mrg_U (Mrg Ugen)+ deriving (Eq, Read, Show)++-- * Name++{- | Lookup operator name for operator Ugens, else Ugen name.++>>> map (\k -> ugen_user_name "BinaryOpUGen" (Special k)) [0, 2, 4, 9, 12, 17, 25]+["+","*","/",">","Min","Lcm","**"]+-}+ugen_user_name :: String -> Special -> String+ugen_user_name nm (Special n) = fromMaybe nm (ugen_operator_name nm n)++-- * Instances++instance EqE Ugen where+ equal_to = mkBinaryOperator OpEq Math.sc3_eq+ not_equal_to = mkBinaryOperator OpNe Math.sc3_neq++instance OrdE Ugen where+ less_than = mkBinaryOperator OpLt Math.sc3_lt+ less_than_or_equal_to = mkBinaryOperator OpLe Math.sc3_lte+ greater_than = mkBinaryOperator OpGt Math.sc3_gt+ greater_than_or_equal_to = mkBinaryOperator OpGe Math.sc3_gte++-- | 'Ugen' form or 'Math.sc3_round_to'.+roundTo :: Ugen -> Ugen -> Ugen+roundTo = mkBinaryOperator OpRoundTo Math.sc3_round_to++instance RealFracE Ugen where+ properFractionE = error "Ugen.properFractionE"+ truncateE = error "Ugen.truncateE"+ roundE i = roundTo i 1+ ceilingE = mkUnaryOperator OpCeil ceilingE+ floorE = mkUnaryOperator OpFloor floorE++instance UnaryOp Ugen where+ ampDb = mkUnaryOperator OpAmpDb ampDb+ asFloat = mkUnaryOperator OpAsFloat asFloat+ asInt = mkUnaryOperator OpAsInt asInt+ cpsMidi = mkUnaryOperator OpCpsMidi cpsMidi+ cpsOct = mkUnaryOperator OpCpsOct cpsOct+ cubed = mkUnaryOperator OpCubed cubed+ dbAmp = mkUnaryOperator OpDbAmp dbAmp+ distort = mkUnaryOperator OpDistort distort+ frac = mkUnaryOperator OpFrac frac+ isNil = mkUnaryOperator OpIsNil isNil+ log10 = mkUnaryOperator OpLog10 log10+ log2 = mkUnaryOperator OpLog2 log2+ midiCps = mkUnaryOperator OpMidiCps midiCps+ midiRatio = mkUnaryOperator OpMidiRatio midiRatio+ notE = mkUnaryOperator OpNot notE+ notNil = mkUnaryOperator OpNotNil notNil+ octCps = mkUnaryOperator OpOctCps octCps+ ramp_ = mkUnaryOperator OpRamp_ ramp_+ ratioMidi = mkUnaryOperator OpRatioMidi ratioMidi+ softClip = mkUnaryOperator OpSoftClip softClip+ squared = mkUnaryOperator OpSquared squared++instance BinaryOp Ugen where+ iDiv = mkBinaryOperator OpIdiv iDiv+ modE = mkBinaryOperator OpMod Fixed.mod'+ lcmE = mkBinaryOperator OpLcm lcmE+ gcdE = mkBinaryOperator OpGcd gcdE+ roundUp = mkBinaryOperator OpRoundUp roundUp+ trunc = mkBinaryOperator OpTrunc trunc+ atan2E = mkBinaryOperator OpAtan2 atan2E+ hypot = mkBinaryOperator OpHypot hypot+ hypotx = mkBinaryOperator OpHypotx hypotx+ fill = mkBinaryOperator OpFill fill+ ring1 = mkBinaryOperator OpRing1 ring1+ ring2 = mkBinaryOperator OpRing2 ring2+ ring3 = mkBinaryOperator OpRing3 ring3+ ring4 = mkBinaryOperator OpRing4 ring4+ difSqr = mkBinaryOperator OpDifSqr difSqr+ sumSqr = mkBinaryOperator OpSumSqr sumSqr+ sqrSum = mkBinaryOperator OpSqrSum sqrSum+ sqrDif = mkBinaryOperator OpSqrDif sqrDif+ absDif = mkBinaryOperator OpAbsDif absDif+ thresh = mkBinaryOperator OpThresh thresh+ amClip = mkBinaryOperator OpAmClip amClip+ scaleNeg = mkBinaryOperator OpScaleNeg scaleNeg+ clip2 = mkBinaryOperator OpClip2 clip2+ excess = mkBinaryOperator OpExcess excess+ fold2 = mkBinaryOperator OpFold2 fold2+ wrap2 = mkBinaryOperator OpWrap2 wrap2+ firstArg = mkBinaryOperator OpFirstArg firstArg+ randRange = mkBinaryOperator OpRandRange randRange+ exprandRange = mkBinaryOperator OpExpRandRange exprandRange++-- instance MulAdd Ugen where mul_add = mulAdd++-- * Parser++-- | 'constant' of 'parse_double'.+parse_constant :: String -> Maybe Ugen+parse_constant = fmap constant . Math.parse_double++-- * Accessors++-- | See into 'Constant_U'.+un_constant :: Ugen -> Maybe Constant+un_constant u =+ case u of+ Constant_U c -> Just c+ _ -> Nothing++-- | Value of 'Constant_U' 'Constant'.+u_constant :: Ugen -> Maybe Sample+u_constant = fmap constantValue . un_constant++-- | Erroring variant.+u_constant_err :: Ugen -> Sample+u_constant_err = fromMaybe (error "u_constant") . u_constant++-- * Mrg++-- | Multiple root graph constructor.+mrg :: [Ugen] -> Ugen+mrg u =+ case u of+ [] -> error "mrg: []"+ [x] -> x+ (x : xs) -> Mrg_U (Mrg x (mrg xs))++-- | See into 'Mrg_U', follows leftmost rule until arriving at non-Mrg node.+mrg_leftmost :: Ugen -> Ugen+mrg_leftmost u =+ case u of+ Mrg_U m -> mrg_leftmost (mrgLeft m)+ _ -> u++-- * Predicates++-- | Constant node predicate.+isConstant :: Ugen -> Bool+isConstant = isJust . un_constant++-- | True if input is a sink 'Ugen', ie. has no outputs. Sees into Mrg.+isSink :: Ugen -> Bool+isSink u =+ case mrg_leftmost u of+ Primitive_U p -> null (ugenOutputs p)+ Mce_U m -> all isSink (mce_to_list m)+ _ -> False++-- | See into 'Proxy_U'.+un_proxy :: Ugen -> Maybe (Proxy Ugen)+un_proxy u =+ case u of+ Proxy_U p -> Just p+ _ -> Nothing++-- | Is 'Ugen' a 'Proxy'?+isProxy :: Ugen -> Bool+isProxy = isJust . un_proxy++-- | Get Primitive from Ugen if Ugen is a Primitive.+ugenPrimitive :: Ugen -> Maybe (Primitive Ugen)+ugenPrimitive u =+ case u of+ Primitive_U p -> Just p+ _ -> Nothing++-- | Is 'Ugen' a 'Primitive'?+isPrimitive :: Ugen -> Bool+isPrimitive = isJust . ugenPrimitive++-- * Mce++-- | Multiple channel expansion node constructor.+mce :: [Ugen] -> Ugen+mce xs =+ case xs of+ [] -> error "mce: []"+ [x] -> Mce_U (Mce_Scalar x)+ _ -> Mce_U (mce_from_list xs)++-- | Type specified 'mce_to_list'.+mceProxies :: Mce Ugen -> [Ugen]+mceProxies = mce_to_list++-- | Multiple channel expansion node ('Mce_U') predicate. Sees into Mrg.+isMce :: Ugen -> Bool+isMce u =+ case mrg_leftmost u of+ Mce_U _ -> True+ _ -> False++{- | Output channels of Ugen as a list.+If required, preserves the RHS of an Mrg node in channel 0.+See also: mceChannel+-}+mceChannels :: Ugen -> [Ugen]+mceChannels u =+ case u of+ Mce_U m -> mce_to_list m+ Mrg_U (Mrg x y) ->+ case mceChannels x of+ r : rs -> Mrg_U (Mrg r y) : rs+ _ -> error "mceChannels"+ _ -> [u]++-- | Number of channels to expand to. This function sees into Mrg, and is defined only for Mce nodes.+mceDegree :: Ugen -> Maybe Int+mceDegree u =+ case mrg_leftmost u of+ Mce_U m -> Just (length (mceProxies m))+ _ -> Nothing++-- | Erroring variant.+mceDegree_err :: Ugen -> Int+mceDegree_err = fromMaybe (error "mceDegree: not mce") . mceDegree++-- | Extend Ugen to specified degree. Follows "leftmost" rule for Mrg nodes.+mceExtend :: Int -> Ugen -> [Ugen]+mceExtend n u =+ case u of+ Mce_U m -> mceProxies (mce_extend n m)+ Mrg_U (Mrg x y) ->+ case mceExtend n x of+ r : rs -> Mrg_U (Mrg r y) : rs+ _ -> error "mceExtend"+ _ -> replicate n u++-- | Is Mce required, ie. are any input values Mce?+mceRequired :: [Ugen] -> Bool+mceRequired = any isMce++{- | Apply Mce transform to a list of inputs.+The transform extends each input so all are of equal length, and then transposes the matrix.++>>> mceInputTransform [mce [1, 2],mce [3, 4]] == Just [[1,3],[2,4]]+True++>>> mceInputTransform [mce [1, 2],mce [3, 4], mce [5, 6, 7]] == Just [[1,3,5],[2,4,6],[1,3,7]]+True++>>> mceInputTransform [mce [mce [1, 2], mce [3, 4]], mce [5, 6]] == Just [[mce [1, 2],5],[mce [3, 4],6]]+True+-}+mceInputTransform :: [Ugen] -> Maybe [[Ugen]]+mceInputTransform i =+ if mceRequired i+ then+ let n = maximum (map mceDegree_err (filter isMce i))+ in Just (transpose (map (mceExtend n) i))+ else Nothing++-- | Build a Ugen after Mce transformation of inputs.+mceBuild :: ([Ugen] -> Ugen) -> [Ugen] -> Ugen+mceBuild f i =+ case mceInputTransform i of+ Nothing -> f i+ Just i' -> let xs = map (mceBuild f) i' in Mce_U (mce_from_list xs)++{- | True if Mce is an immediate proxy for a multiple-out Primitive.+This is useful when disassembling graphs, ie. ugen_graph_forth_pp at hsc3-db.+It's also useful when editing a Primitive after it is constructed, as in bracketUgen.+-}+mce_is_direct_proxy :: Mce Ugen -> Bool+mce_is_direct_proxy m =+ case m of+ Mce_Scalar _ -> False+ Mce_Vector _ ->+ let p = map un_proxy (mce_to_list m)+ p' = catMaybes p+ in all isJust p+ && length (nub (map proxySource p')) == 1+ && map proxyIndex p' `isPrefixOf` [0 ..]++-- * Bracketed++{- | Attach Brackets (initialisation and cleanup message sequences) to Ugen.+ For simplicity and clarity, brackets can only be attached to Primitive, Constant and Control nodes.+ This will look into the direct (immediate) proxies of a Primitive.+-}+bracketUgen :: Ugen -> Brackets -> Ugen+bracketUgen u (pre, post) =+ let err = error "bracketUgen: only Constants or Primitive Ugens or immediate proxies may have brackets"+ rw_proxy pxy =+ case pxy of+ Proxy_U (Proxy p pix) ->+ let (lhs, rhs) = primitiveBrackets p in Proxy_U (Proxy (p {primitiveBrackets = (lhs ++ pre, rhs ++ post)}) pix)+ _ -> err+ in case u of+ Constant_U c -> let (lhs, rhs) = constantBrackets c in Constant_U (c {constantBrackets = (lhs ++ pre, rhs ++ post)})+ Control_U c -> let (lhs, rhs) = controlBrackets c in Control_U (c {controlBrackets = (lhs ++ pre, rhs ++ post)})+ Primitive_U p -> let (lhs, rhs) = primitiveBrackets p in Primitive_U (p {primitiveBrackets = (lhs ++ pre, rhs ++ post)})+ Mce_U m ->+ if mce_is_direct_proxy m+ then Mce_U (mce_map rw_proxy m)+ else err+ _ -> err++-- | Retrieve Brackets from Ugen.+ugenBrackets :: Ugen -> Brackets+ugenBrackets u =+ case u of+ Constant_U c -> constantBrackets c+ Control_U c -> controlBrackets c+ Primitive_U p -> primitiveBrackets p+ _ -> emptyBrackets++-- * Validators++-- | Ensure input 'Ugen' is valid, ie. not a sink.+checkInput :: Ugen -> Ugen+checkInput u =+ if isSink u+ then error ("checkInput: " ++ show u)+ else u++-- * Constructors++-- | Constant value node constructor.+constant :: Real n => n -> Ugen+constant = Constant_U . flip Constant emptyBrackets . realToFrac++-- | Type specialised 'constant'.+int_to_ugen :: Int -> Ugen+int_to_ugen = constant++-- | Type specialised 'constant'.+float_to_ugen :: Float -> Ugen+float_to_ugen = constant++-- | Type specialised 'constant'.+double_to_ugen :: Double -> Ugen+double_to_ugen = constant++-- | Unit generator proxy node constructor.+proxy :: Ugen -> Int -> Ugen+proxy u n =+ case u of+ Primitive_U p -> Proxy_U (Proxy p n)+ _ -> error "proxy: not primitive?"++-- | Determine the rate of a Ugen.+rateOf :: Ugen -> Rate+rateOf u =+ case u of+ Constant_U _ -> InitialisationRate+ Control_U c -> controlOperatingRate c+ Label_U _ -> InitialisationRate+ Primitive_U p -> ugenRate p+ Proxy_U p -> ugenRate (proxySource p)+ Mce_U _ -> maximum (map rateOf (mceChannels u))+ Mrg_U m -> rateOf (mrgLeft m)++-- | Apply proxy transformation if required.+proxify :: Ugen -> Ugen+proxify u =+ case u of+ Mce_U m -> mce (map proxify (mce_to_list m))+ Mrg_U m -> mrg [proxify (mrgLeft m), mrgRight m]+ Primitive_U p ->+ let o = ugenOutputs p+ in case o of+ _ : _ : _ -> mce (map (proxy u) [0 .. length o - 1])+ _ -> u+ Constant_U _ -> u+ _ -> error "proxify: illegal ugen"++{- | Filters with DemandRate inputs run at ControlRate.+This is a little unfortunate, it'd be nicer if the rate in this circumstance could be given.+-}+mk_ugen_select_rate :: String -> [Ugen] -> [Rate] -> Either Rate [Int] -> Rate+mk_ugen_select_rate nm h rs r =+ let at_note note list index = if index < 0 || index >= length list then error note else list !! index -- hugs...+ is_right e = case e of Right _ -> True; _ -> False -- hugs...+ r' = either id (maximum . map (rateOf . at_note ("mkUgen: " ++ nm) h)) r+ in if is_right r && r' == DemandRate && DemandRate `notElem` rs+ then if ControlRate `elem` rs then ControlRate else error "mkUgen: DemandRate input to non-ControlRate filter"+ else+ if r' `elem` rs || r' == DemandRate+ then r'+ else error ("mkUgen: rate restricted: " ++ show (r, r', rs, nm))++{- | Construct proxied and multiple channel expanded Ugen.++cf = constant function, rs = rate set, r = rate, nm = name, i = inputs, i_mce = list of Mce inputs, o = outputs.+-}+mkUgen ::+ Maybe ([Sample] -> Sample) ->+ [Rate] ->+ Either Rate [Int] ->+ String ->+ [Ugen] ->+ Maybe [Ugen] ->+ Int ->+ Special ->+ UgenId ->+ Ugen+mkUgen cf rs r nm i i_mce o s z =+ let i' = maybe i ((i ++) . concatMap mceChannels) i_mce+ f h =+ let r' = mk_ugen_select_rate nm h rs r+ o' = replicate o r'+ u = Primitive_U (Primitive r' nm h o' s z emptyBrackets)+ in case cf of+ Just cf' ->+ if all isConstant h+ then constant (cf' (mapMaybe u_constant h))+ else u+ Nothing -> u+ in proxify (mceBuild f (map checkInput i'))++-- * Operators++-- | Operator Ugen constructor.+mkOperator :: ([Sample] -> Sample) -> String -> [Ugen] -> Int -> Ugen+mkOperator f c i s =+ let ix = [0 .. length i - 1]+ in mkUgen (Just f) all_rates (Right ix) c i Nothing 1 (Special s) NoId++-- | Unary math constructor.+mkUnaryOperator :: Sc3_Unary_Op -> (Sample -> Sample) -> Ugen -> Ugen+mkUnaryOperator i f a =+ let g [x] = f x+ g _ = error "mkUnaryOperator: non unary input"+ in mkOperator g "UnaryOpUGen" [a] (fromEnum i)++{- | Binary math constructor with constant optimisation.++>>> constant 2 * constant 3 == constant 6+True++>>> let o = mkUgen Nothing [AudioRate] (Left AudioRate) "SinOsc" [constant 440, constant 0] Nothing 1 (Special 0) (Uid 0)+>>> o * 1 == o && 1 * o == o && o * 2 /= o+True++>>> o + 0 == o && 0 + o == o && o + 1 /= o+True++>>> o - 0 == o && 0 - o /= o+True++>>> o / 1 == o && 1 / o /= o+True++>>> o ** 1 == o && o ** 2 /= o+True+-}+mkBinaryOperator_optimise_constants ::+ Sc3_Binary_Op ->+ (Sample -> Sample -> Sample) ->+ (Either Sample Sample -> Bool) ->+ Ugen ->+ Ugen ->+ Ugen+mkBinaryOperator_optimise_constants i f o a b =+ let g [x, y] = f x y+ g _ = error "mkBinaryOperator: non binary input"+ r = case (a, b) of+ (Constant_U (Constant a' ([], [])), _) ->+ if o (Left a') then Just b else Nothing+ (_, Constant_U (Constant b' ([], []))) ->+ if o (Right b') then Just a else Nothing+ _ -> Nothing+ in fromMaybe (mkOperator g "BinaryOpUGen" [a, b] (fromEnum i)) r++-- | Plain (non-optimised) binary math constructor.+mkBinaryOperator :: Sc3_Binary_Op -> (Sample -> Sample -> Sample) -> Ugen -> Ugen -> Ugen+mkBinaryOperator i f a b =+ let g [x, y] = f x y+ g _ = error "mkBinaryOperator: non binary input"+ in mkOperator g "BinaryOpUGen" [a, b] (fromEnum i)++-- * Numeric instances++-- | Is /u/ the primitive for the named Ugen.+is_primitive_for :: String -> Ugen -> Bool+is_primitive_for k u =+ case u of+ Primitive_U (Primitive _ nm [_, _] [_] _ _ _) -> nm == k+ _ -> False++-- | Is /u/ the primitive for the named Ugen.+is_constant_of :: Sample -> Ugen -> Bool+is_constant_of k u =+ case u of+ Constant_U c -> constantValue c == k+ _ -> False++-- | Is /u/ a binary math operator with SPECIAL of /k/.+is_math_binop :: Int -> Ugen -> Bool+is_math_binop k u =+ case u of+ Primitive_U (Primitive _ "BinaryOpUGen" [_, _] [_] (Special s) NoId _) -> s == k+ _ -> False++-- | Is /u/ an ADD operator?+is_add_operator :: Ugen -> Bool+is_add_operator = is_math_binop 0++assert_is_add_operator :: String -> Ugen -> Ugen+assert_is_add_operator msg u = if is_add_operator u then u else error ("assert_is_add_operator: " ++ msg)++-- | Is /u/ an MUL operator?+is_mul_operator :: Ugen -> Bool+is_mul_operator = is_math_binop 2++{- | MulAdd re-writer, applicable only directly at add operator Ugen.+The MulAdd Ugen is very sensitive to input rates.+Add=AudioRate with In|Mul=InitialisationRate|Const will crash scsynth.+This only considers primitives that do not have bracketing messages.+-}+mul_add_optimise_direct :: Ugen -> Ugen+mul_add_optimise_direct u =+ let reorder (i, j, k) =+ let (ri, rj, rk) = (rateOf i, rateOf j, rateOf k)+ in if rk > max ri rj+ then Nothing+ else Just (max (max ri rj) rk, if rj > ri then (j, i, k) else (i, j, k))+ in case assert_is_add_operator "MUL-ADD" u of+ Primitive_U+ (Primitive _ _ [Primitive_U (Primitive _ "BinaryOpUGen" [i, j] [_] (Special 2) NoId ([], [])), k] [_] _ NoId ([], [])) ->+ case reorder (i, j, k) of+ Just (rt, (p, q, r)) -> Primitive_U (Primitive rt "MulAdd" [p, q, r] [rt] (Special 0) NoId ([], []))+ Nothing -> u+ Primitive_U+ (Primitive _ _ [k, Primitive_U (Primitive _ "BinaryOpUGen" [i, j] [_] (Special 2) NoId ([], []))] [_] _ NoId ([], [])) ->+ case reorder (i, j, k) of+ Just (rt, (p, q, r)) -> Primitive_U (Primitive rt "MulAdd" [p, q, r] [rt] (Special 0) NoId ([], []))+ Nothing -> u+ _ -> u++{- | MulAdd optimiser, applicable at any Ugen (ie. checks /u/ is an ADD ugen)++> import Sound.Sc3+> g1 = sinOsc ar 440 0 * 0.1 + control ir "x" 0.05+> g2 = sinOsc ar 440 0 * control ir "x" 0.1 + 0.05+> g3 = control ir "x" 0.1 * sinOsc ar 440 0 + 0.05+> g4 = 0.05 + sinOsc ar 440 0 * 0.1+-}+mul_add_optimise :: Ugen -> Ugen+mul_add_optimise u = if is_add_operator u then mul_add_optimise_direct u else u++{- | Sum3 re-writer, applicable only directly at add operator Ugen.+ This only considers nodes that have no bracketing messages.+-}+sum3_optimise_direct :: Ugen -> Ugen+sum3_optimise_direct u =+ case assert_is_add_operator "SUM3" u of+ Primitive_U (Primitive r _ [Primitive_U (Primitive _ "BinaryOpUGen" [i, j] [_] (Special 0) NoId ([], [])), k] [_] _ NoId ([], [])) ->+ Primitive_U (Primitive r "Sum3" [i, j, k] [r] (Special 0) NoId ([], []))+ Primitive_U (Primitive r _ [k, Primitive_U (Primitive _ "BinaryOpUGen" [i, j] [_] (Special 0) NoId ([], []))] [_] _ NoId ([], [])) ->+ Primitive_U (Primitive r "Sum3" [i, j, k] [r] (Special 0) NoId ([], []))+ _ -> u++-- | /Sum3/ optimiser, applicable at any /u/ (ie. checks if /u/ is an ADD operator).+sum3_optimise :: Ugen -> Ugen+sum3_optimise u = if is_add_operator u then sum3_optimise_direct u else u++-- | 'sum3_optimise' of 'mul_add_optimise'.+add_optimise :: Ugen -> Ugen+add_optimise = sum3_optimise . mul_add_optimise++-- | Unit generators are numbers.+instance Num Ugen where+ negate = mkUnaryOperator OpNeg negate+ (+) =+ fmap add_optimise+ . mkBinaryOperator_optimise_constants OpAdd (+) (`elem` [Left 0, Right 0])+ (-) = mkBinaryOperator_optimise_constants OpSub (-) (Right 0 ==)+ (*) = mkBinaryOperator_optimise_constants OpMul (*) (`elem` [Left 1, Right 1])+ abs = mkUnaryOperator OpAbs abs+ signum = mkUnaryOperator OpSign signum+ fromInteger = Constant_U . flip Constant ([], []) . fromInteger++-- | Unit generators are fractional.+instance Fractional Ugen where+ recip = mkUnaryOperator OpRecip recip+ (/) = mkBinaryOperator_optimise_constants OpFdiv (/) (Right 1 ==)+ fromRational = Constant_U . flip Constant ([], []) . fromRational++-- | Unit generators are floating point.+instance Floating Ugen where+ pi = Constant_U (Constant pi ([], []))+ exp = mkUnaryOperator OpExp exp+ log = mkUnaryOperator OpLog log+ sqrt = mkUnaryOperator OpSqrt sqrt+ (**) = mkBinaryOperator_optimise_constants OpPow (**) (Right 1 ==)+ logBase a b = log b / log a+ sin = mkUnaryOperator OpSin sin+ cos = mkUnaryOperator OpCos cos+ tan = mkUnaryOperator OpTan tan+ asin = mkUnaryOperator OpArcSin asin+ acos = mkUnaryOperator OpArcCos acos+ atan = mkUnaryOperator OpArcTan atan+ sinh = mkUnaryOperator OpSinh sinh+ cosh = mkUnaryOperator OpCosh cosh+ tanh = mkUnaryOperator OpTanh tanh+ asinh x = log (sqrt (x * x + 1) + x)+ acosh x = log (sqrt (x * x - 1) + x)+ atanh x = (log (1 + x) - log (1 - x)) / 2++-- | Unit generators are real.+instance Real Ugen where+ toRational (Constant_U (Constant n ([], []))) = toRational n+ toRational _ = error "Ugen.toRational: only un-bracketed constants considered"++-- | Unit generators are integral.+instance Integral Ugen where+ quot = mkBinaryOperator OpIdiv (error "Ugen.quot")+ rem = mkBinaryOperator OpMod (error "Ugen.rem")+ quotRem a b = (quot a b, rem a b)+ div = mkBinaryOperator OpIdiv (error "Ugen.div")+ mod = mkBinaryOperator OpMod (error "Ugen.mod")+ toInteger (Constant_U (Constant n ([], []))) = floor n+ toInteger _ = error "Ugen.toInteger: only un-bracketed constants considered"++instance RealFrac Ugen where+ properFraction = error "Ugen.properFraction, see properFractionE"+ round = error "Ugen.round, see roundE"+ ceiling = error "Ugen.ceiling, see ceilingE"+ floor = error "Ugen.floor, see floorE"++{- | Unit generators are orderable (when 'Constants').++>>> constant 2 > constant 1+True+-}+instance Ord Ugen where+ (Constant_U a) < (Constant_U b) = a < b+ _ < _ = error "Ugen.<, see <*"+ (Constant_U a) <= (Constant_U b) = a <= b+ _ <= _ = error "Ugen.<= at, see <=*"+ (Constant_U a) > (Constant_U b) = a > b+ _ > _ = error "Ugen.>, see >*"+ (Constant_U a) >= (Constant_U b) = a >= b+ _ >= _ = error "Ugen.>=, see >=*"+ min = mkBinaryOperator OpMin min+ max = mkBinaryOperator OpMax max++-- | Unit generators are enumerable.+instance Enum Ugen where+ succ u = u + 1+ pred u = u - 1+ toEnum n = Constant_U (Constant (fromIntegral n) ([], []))+ fromEnum (Constant_U (Constant n ([], []))) = truncate n+ fromEnum _ = error "Ugen.fromEnum: non-constant"+ enumFrom = iterate (+ 1)+ enumFromThen n m = iterate (+ (m - n)) n+ enumFromTo n m = takeWhile (<= m + 1 / 2) (enumFrom n)+ enumFromThenTo n n' m =+ let p = if n' >= n then (>=) else (<=)+ in takeWhile (p (m + (n' - n) / 2)) (enumFromThen n n')++{- | Unit generators are stochastic.+Only un-bracketed constant values are considered.+-}+instance Random.Random Ugen where+ randomR (Constant_U (Constant l ([], [])), Constant_U (Constant r ([], []))) g =+ let (n, g') = Random.randomR (l, r) g+ in (Constant_U (Constant n ([], [])), g')+ randomR _ _ = error "Ugen.randomR: non constant (l,r)"+ random = Random.randomR (-1.0, 1.0)++-- * Bitwise++-- | 'Operator.OpBitAnd'+bitAnd :: Ugen -> Ugen -> Ugen+bitAnd = mkBinaryOperator OpBitAnd undefined++-- | 'Operator.OpBitOr'+bitOr :: Ugen -> Ugen -> Ugen+bitOr = mkBinaryOperator OpBitOr undefined++-- | 'OpBitXor'+bitXOr :: Ugen -> Ugen -> Ugen+bitXOr = mkBinaryOperator OpBitXor undefined++-- | 'OpBitNot'+bitNot :: Ugen -> Ugen+bitNot = mkUnaryOperator OpBitNot undefined++-- | 'OpShiftLeft'+shiftLeft :: Ugen -> Ugen -> Ugen+shiftLeft = mkBinaryOperator OpShiftLeft undefined++-- | 'OpShiftRight'+shiftRight :: Ugen -> Ugen -> Ugen+shiftRight = mkBinaryOperator OpShiftRight undefined++-- | 'OpUnsignedShift'+unsignedShift :: Ugen -> Ugen -> Ugen+unsignedShift = mkBinaryOperator OpUnsignedShift undefined++-- | Ugens are bit patterns.+instance Bits Ugen where+ (.&.) = bitAnd+ (.|.) = bitOr+ xor = bitXOr+ complement = bitNot+ shiftL p q = shiftLeft p (constant q)+ shiftR p q = shiftRight p (constant q)+ rotate = error "Ugen.rotate"+ bitSize = error "Ugen.bitSize"+ bit = error "Ugen.bit"+ testBit = error "Ugen.testBit"+ popCount = error "Ugen.popCount" -- hugs...+ bitSizeMaybe = error "Ugen.bitSizeMaybe" -- hugs...+ isSigned _ = True++{-+import qualified GHC.Exts as Exts {- base -}++instance Exts.IsList Ugen where+ type Item Ugen = Ugen+ fromList = mce+ toList = mceChannels+-}
+ Sound/Sc3/Ugen/Util.hs view
@@ -0,0 +1,341 @@+-- | Utility function over Ugen data structure.+module Sound.Sc3.Ugen.Util where++import qualified Data.Char {- base -}+import Data.List {- base -}+import Data.Maybe {- base -}++import qualified Data.List.Split as Split {- split -}++import qualified Sound.Sc3.Common.Base as Base {- hsc3 -}+import qualified Sound.Sc3.Common.Envelope as Envelope {- hsc3 -}+import qualified Sound.Sc3.Common.Mce as Mce {- hsc3 -}+import qualified Sound.Sc3.Common.Rate as Rate {- hsc3 -}+import qualified Sound.Sc3.Common.Uid as Uid {- hsc3 -}++import Sound.Sc3.Ugen.Brackets {- hsc3 -}+import Sound.Sc3.Ugen.Control {- hsc3 -}+import Sound.Sc3.Ugen.Label {- hsc3 -}+import Sound.Sc3.Ugen.Mrg {- hsc3 -}+import Sound.Sc3.Ugen.Primitive {- hsc3 -}+import Sound.Sc3.Ugen.Proxy {- hsc3 -}+import Sound.Sc3.Ugen.Ugen {- hsc3 -}++-- | 'Uid' of 'resolveID'.+toUid :: Uid.ID a => a -> UgenId+toUid = Uid . Uid.resolveID++-- * Ugen graph functions++-- | Depth first traversal of graph at `u', stopping at `halt_f', else applying `map_f' to each node.+ugenTraverse :: (Ugen -> Bool) -> (Ugen -> Ugen) -> Ugen -> Ugen+ugenTraverse halt_f map_f u =+ if halt_f u+ then u+ else+ let recur = ugenTraverse halt_f map_f+ in case u of+ Primitive_U p ->+ let i = ugenInputs p+ in map_f (Primitive_U (p {ugenInputs = map recur i}))+ Proxy_U (Proxy p ix) ->+ let i = ugenInputs p+ in map_f (Proxy_U (Proxy (p {ugenInputs = map recur i}) ix))+ Mce_U m -> map_f (mce (map recur (mceProxies m)))+ Mrg_U (Mrg l r) -> map_f (Mrg_U (Mrg (recur l) (recur r)))+ _ -> map_f u++{- | Right fold of Ugen graph.++> import qualified Sound.Sc3.Ugen.Pp as Pp+> let pp = Pp.ugen_concise_pp+> map pp (ugenFoldr (:) [] (sinOsc ar 440 0 * 0.1))+["*","SinOsc","440","0","0.1"]++> map pp (ugenFoldr (:) [] (pan2 (sinOsc ar 440 0) 0.25 0.1))+["[Pan2@0,Pan2@1]","Pan2@0","SinOsc","440","0","0.25","0.1","Pan2@1","SinOsc","440","0","0.25","0.1"]+-}+ugenFoldr :: (Ugen -> a -> a) -> a -> Ugen -> a+ugenFoldr f st u =+ let recur = flip (ugenFoldr f)+ in case u of+ Primitive_U p -> f u (foldr recur st (ugenInputs p))+ Proxy_U (Proxy p _) -> f u (foldr recur st (ugenInputs p)) -- ...+ Mce_U m -> f u (foldr recur st (mceProxies m))+ Mrg_U (Mrg l r) -> f u (f l (f r st))+ _ -> f u st++-- | Fold over Ugen and collect all bracketing messages from all Primitive nodes.+ugenCollectBrackets :: Ugen -> Brackets+ugenCollectBrackets =+ concatBrackets+ . map ugenBrackets+ . nub+ . ugenFoldr (:) []++-- | Are there any brackets at Ugen.+ugenHasAnyBrackets :: Ugen -> Bool+ugenHasAnyBrackets = (/= ([], [])) . ugenCollectBrackets++-- * Unit generator node constructors++-- | Control input node constructor.+control_f64 :: Rate.Rate -> Maybe Int -> String -> Sample -> Ugen+control_f64 r ix nm d = Control_U (Control r ix nm d False Nothing emptyBrackets)++{- | Control input node constructor.++Note that if the name begins with a t_ prefix the control is /not/+converted to a triggered control. Please see 'trigControl'.+-}+control :: Rate.Rate -> String -> Double -> Ugen+control r = control_f64 r Nothing++-- | Variant of 'control' with meta data.+control_m :: Rate.Rate -> String -> Double -> Control_Meta_T3 Double -> Ugen+control_m rt nm df meta =+ let m = control_meta_t3 id meta+ in Control_U (Control rt Nothing nm df False (Just m) emptyBrackets)++-- | Generate group of two controls. Names are generated according to 'control_group_suffixes'+control_pair :: Control_Group -> Rate.Rate -> String -> (Double, Double) -> Control_Meta_T3 Double -> (Ugen, Ugen)+control_pair grp rt nm (df1, df2) meta =+ let m = (control_meta_t3 id meta) {controlGroup = Just grp}+ in case control_group_suffixes grp of+ [lhs, rhs] ->+ ( Control_U (Control rt Nothing (nm ++ lhs) df1 False (Just m) emptyBrackets)+ , Control_U (Control rt Nothing (nm ++ rhs) df2 False (Just m) emptyBrackets)+ )+ _ -> error "control_pair"++-- | Generate range controls. Names are generated according to 'control_group_suffixes'+control_rng :: Rate.Rate -> String -> (Double, Double) -> Control_Meta_T3 Double -> (Ugen, Ugen)+control_rng = control_pair Control_Range++-- | Triggered (kr) control input node constructor.+trigControl_f64 :: Maybe Int -> String -> Sample -> Ugen+trigControl_f64 ix nm d = Control_U (Control Rate.ControlRate ix nm d True Nothing emptyBrackets)++-- | Triggered (kr) control input node constructor.+trigControl :: String -> Double -> Ugen+trigControl = trigControl_f64 Nothing++-- | Set indices at a list of controls.+control_set :: [Ugen] -> [Ugen]+control_set =+ let f ix u = case u of+ Control_U c -> Control_U (c {controlIndex = Just ix})+ _ -> error "control_set: non control input?"+ in zipWith f [0 ..]++-- * Multiple channel expansion++mce1 :: Ugen -> Ugen+mce1 = mce . return++-- | Multiple channel expansion for two inputs.+mce2 :: Ugen -> Ugen -> Ugen+mce2 x y = mce [x, y]++-- | Extract two channels from possible Mce, if there is only one channel it is duplicated.+mce2c :: Ugen -> (Ugen, Ugen)+mce2c u =+ case mceChannels u of+ [] -> error "mce2c"+ [p] -> (p, p)+ p : q : _ -> (p, q)++-- | Variant of 'mce2c' that requires input to have two channels.+unmce2 :: Ugen -> (Ugen, Ugen)+unmce2 = Base.t2_from_list . mceChannels++-- | Multiple channel expansion for two inputs.+mce3 :: Ugen -> Ugen -> Ugen -> Ugen+mce3 x y z = mce [x, y, z]++-- | Variant of 'mce2c' that requires input to have two channels.+unmce3 :: Ugen -> (Ugen, Ugen, Ugen)+unmce3 = Base.t3_from_list . mceChannels++-- | Apply a function to each channel at a unit generator.+mceMap :: (Ugen -> Ugen) -> Ugen -> Ugen+mceMap f u = mce (map f (mceChannels u))++-- | Map with element index.+map_ix :: ((Int, a) -> b) -> [a] -> [b]+map_ix f = zipWith (curry f) [0 ..]++-- | Variant of 'mceMap' with element index.+mce_map_ix :: ((Int, Ugen) -> Ugen) -> Ugen -> Ugen+mce_map_ix f u = mce (map_ix f (mceChannels u))++-- | Apply Ugen list operation on Mce contents.+mceEdit :: ([Ugen] -> [Ugen]) -> Ugen -> Ugen+mceEdit f u =+ case u of+ Mce_U m -> mce (f (mceProxies m))+ _ -> error "mceEdit: non Mce value"++-- | Reverse order of channels at Mce.+mceReverse :: Ugen -> Ugen+mceReverse = mceEdit reverse++-- | Obtain indexed channel at Mce.+mceChannel :: Int -> Ugen -> Ugen+mceChannel n u =+ case u of+ Mce_U m -> mceProxies m !! n+ _ -> if n == 0 then u else error "mceChannel: non Mce value, non ZERO index"++{- | Obtain indexed channel at Mce, indices wrap around.++> map (\ix -> pp (mceChannelWrap ix (mce [1,2,3,4,5]))) [0 .. 9]+["1","2","3","4","5","1","2","3","4","5"]+-}+mceChannelWrap :: Int -> Ugen -> Ugen+mceChannelWrap n u =+ case u of+ Mce_U m -> mceProxies m !! (n `mod` Mce.mce_length m)+ _ -> u++-- | Transpose rows and columns, ie. {{a,b},{c,d}} to {{a,c},{b,d}}.+mceTranspose :: Ugen -> Ugen+mceTranspose = mce . map mce . transpose . map mceChannels . mceChannels++{- | Rotate mce /k/ places to the right, ie. {a,b,c,d} to {d,a,b,c}++>>> mceRotate 1 (mce [1,2,3,4]) == mce [4,1,2,3]+True+-}+mceRotate :: Int -> Ugen -> Ugen+mceRotate k =+ let rotateRight n p = let (b, a) = splitAt (length p - n) p in a ++ b+ in mce . rotateRight k . mceChannels++{- | 'concat' at mce channels of each input, ie. {{a,b},{c,d}} to {a,b,c,d}.++>>> mceConcat (map mce [[1,2],[3,4]]) == mce [1..4]+True+-}+mceConcat :: [Ugen] -> Ugen+mceConcat = mce . concatMap mceChannels++{- | Collect subarrays of mce.++>>> mceClump 2 (mce [1,2,3,4]) == mce2 (mce2 1 2) (mce2 3 4)+True+-}+mceClump :: Int -> Ugen -> Ugen+mceClump k = mce . map mce . Split.chunksOf k . mceChannels++-- | Foldl1 at channels of mce.+mceReduce :: (Ugen -> Ugen -> Ugen) -> Ugen -> Ugen+mceReduce f = foldl1 f . mceChannels++-- | mceReduce of *.+mceProduct :: Ugen -> Ugen+mceProduct = mceReduce (*)++-- * Transform++-- | Given /unmce/ function make halt mce transform.+halt_mce_transform_f :: (a -> [a]) -> [a] -> [a]+halt_mce_transform_f f l =+ let (l', e) = fromMaybe (error "halt_mce_transform: null?") (Base.sep_last l)+ in l' ++ f e++{- | The halt Mce transform, ie. lift channels of last input into list.+This is not used by hsc3, but it is used by hsc3-forth and stsc3.++>>> halt_mce_transform [1,2,mce2 3 4] == [1,2,3,4]+True+-}+halt_mce_transform :: [Ugen] -> [Ugen]+halt_mce_transform = halt_mce_transform_f mceChannels++-- | If the root node of a Ugen graph is /mce/, transform to /mrg/.+prepare_root :: Ugen -> Ugen+prepare_root u =+ case u of+ Mce_U m -> mrg (mceProxies m)+ Mrg_U m -> mrg2 (prepare_root (mrgLeft m)) (prepare_root (mrgRight m))+ _ -> u++-- * Multiple root graphs++-- | Multiple root graph node constructor (left input is output)+mrg2 :: Ugen -> Ugen -> Ugen+mrg2 u = Mrg_U . Mrg u++-- * Labels++-- | Lift a 'String' to a Ugen label (ie. for 'poll').+label :: String -> Ugen+label = Label_U . Label++{- | Unpack a label to a length prefixed list of 'Constant's. There+is a special case for mce nodes, but it requires labels to be equal+length. Properly, 'poll' would not unpack the label, it would be+done by the synthdef builder.++> unpackLabel False (label "/tmp")+-}+unpackLabel :: Bool -> Ugen -> [Ugen]+unpackLabel length_prefix u =+ case u of+ Label_U (Label s) ->+ let q = fromEnum '?'+ f c = if Data.Char.isAscii c then fromEnum c else q+ s' = map (fromIntegral . f) s+ in if length_prefix then fromIntegral (length s) : s' else s'+ Mce_U m ->+ let x = map (unpackLabel length_prefix) (mceProxies m)+ in if Base.equal_length_p x+ then map mce (transpose x)+ else error (show ("unpackLabel: mce length /=", x))+ _ -> error (show ("unpackLabel: non-label", u))++-- * Envelope++-- | 'mce' of 'Envelope.envelope_sc3_array'.+envelope_to_ugen :: Envelope.Envelope Ugen -> Ugen+envelope_to_ugen =+ let err = error "envGen: bad Envelope"+ in mce . fromMaybe err . Envelope.envelope_sc3_array++-- | 'mce' of 'Envelope.envelope_sc3_ienvgen_array'.+envelope_to_ienvgen_ugen :: Envelope.Envelope Ugen -> Ugen+envelope_to_ienvgen_ugen =+ let err = error "envGen: bad Envelope"+ in mce . fromMaybe err . Envelope.envelope_sc3_ienvgen_array++-- * Rate Flow++-- | Traverse graph rewriting audio rate nodes as control rate.+rewriteUgenRates :: (Rate.Rate -> Bool) -> Rate.Rate -> Ugen -> Ugen+rewriteUgenRates sel_f set_rt =+ let f u = case u of+ Primitive_U (Primitive rt nm i o s z b) -> Primitive_U (Primitive (if sel_f rt then set_rt else rt) nm i o s z b)+ _ -> u+ in ugenTraverse (const False) f -- requires endRewrite node (see rsc3-arf)++-- | Traverse graph rewriting audio rate nodes as control rate.+rewriteToControlRate :: Ugen -> Ugen+rewriteToControlRate = rewriteUgenRates (== Rate.AudioRate) Rate.ControlRate++-- | Traverse graph rewriting all nodes as demand rate.+rewriteToDemandRate :: Ugen -> Ugen+rewriteToDemandRate = rewriteUgenRates (const True) Rate.DemandRate++-- | Traverse graph rewriting audio and control nodes as initialisation rate.+rewriteToInitialisationRate :: Ugen -> Ugen+rewriteToInitialisationRate = rewriteUgenRates (`elem` [Rate.ControlRate, Rate.AudioRate]) Rate.InitialisationRate++-- | Select rewriting function given 'Rate.Rate'.+rewriteToRate :: Rate.Rate -> Ugen -> Ugen+rewriteToRate rt =+ case rt of+ Rate.ControlRate -> rewriteToControlRate+ Rate.DemandRate -> rewriteToDemandRate+ Rate.InitialisationRate -> rewriteToInitialisationRate+ Rate.AudioRate -> error "rewriteToRate: AudioRate?"
emacs/hsc3.el view
@@ -1,274 +1,511 @@-;; hsc3.el - (c) rohan drape, 2006-2008+;;; hsc3.el --- Haskell SuperCollider -;; This mode is implemented as a derivation of `haskell' mode,-;; indentation and font locking is courtesy that mode. The-;; inter-process communication is courtesy `comint'. The symbol at-;; point acquisition is courtesy `thingatpt'. The directory search-;; facilities are courtesy `find-lisp'.+;;; Commentary: -(require 'scheme)+; Indentation and font locking is courtesy `haskell' mode (debian=haskell-mode).+; Inter-process communication is courtesy `comint'.+; Symbol at point acquisition is courtesy `thingatpt'.+; Directory search facilities are courtesy `find-lisp'.++(require 'haskell) (require 'comint) (require 'thingatpt) (require 'find-lisp) -(defvar hsc3-buffer- "*hsc3*"- "*The name of the hsc3 process buffer (default=*hsc3*).")+;;; Code: -(defvar hsc3-interpreter- "ghci"- "*The haskell interpter to use (default=ghci).")+(defcustom hsc3-buffer "*hsc3*"+ "The name of the hsc3 haskell process buffer."+ :type 'string) -(defvar hsc3-interpreter-arguments- (list)- "*Arguments to the haskell interpreter (default=none).")+(defcustom hsc3-interpreter (list "ghci")+ "The name of the haskell interpreter (default=\"ghci\")."+ :type '(repeat string)) -(defvar hsc3-run-control- "~/.hsc3.hs"- "*Run control file (default=~/.hsc3.hs)")+(defvar hsc3-directory nil+ "The hsc3 directory (default=nil).") -(defvar hsc3-modules- (list "import Control.Concurrent"- "import Control.Monad"- "import Data.List"- "import Sound.OpenSoundControl"- "import Sound.SC3"- "import qualified Sound.SC3.UGen.Base as B"- "import qualified Sound.SC3.UGen.Monadic as M"- "import qualified Sound.SC3.UGen.Unsafe as U"- "import System.Random")- "*List of modules (possibly qualified) to bring into interpreter context.")+(defvar sc3-help-directory nil+ "The directory containing the Sc3 RTF help files (default=nil). -(defvar hsc3-help-directory- nil- "*The directory containing the help files (default=nil).")+These can be fetched from the SuperCollider archives by typing: -(defvar hsc3-literate-p- t- "*Flag to indicate if we are in literate mode (default=t).")+git checkout 2495f4f61c0955001169d28142543aabbe1bedcb build/old_rtf_help.tar.gz") -(make-variable-buffer-local 'hsc3-literate-p)+(defcustom hsc3-auto-import-modules nil+ "Flag to decide if the hsc3 standard module set is imported on startup (default=nil)."+ :type 'boolean) -(defun hsc3-unlit (s)- "Remove bird literate marks"- (replace-regexp-in-string "^> " "" s))+(defun hsc3-chunk-string (n s)+ "Split the string S into chunks of N characters."+ (let* ((l (length s))+ (m (min l n))+ (c (substring s 0 m)))+ (if (<= l n)+ (list c)+ (cons c (hsc3-chunk-string n (substring s n)))))) -(defun hsc3-intersperse (e l)- (if (null l)- '()- (cons e (cons (car l) (hsc3-intersperse e (cdr l))))))+(defun hsc3-send-line (s)+ "Send the string S, with newline appended, to haskell."+ (if (comint-check-proc hsc3-buffer)+ (let ((cs (hsc3-chunk-string 64 (concat s "\n"))))+ (mapcar+ (lambda (c) (comint-send-string hsc3-buffer c))+ cs))+ (error "No hsc3 process?"))) -(defun hsc3-write-default-run-control ()- "Write default run control file if no file exists."- (if (not (file-exists-p hsc3-run-control))- (with-temp-file- hsc3-run-control- (mapc - (lambda (s)- (insert (concat s "\n")))- hsc3-modules))))+(defun hsc3-send-layout-block (s)+ "Send the string S to haskell using ghci layout block notation."+ (hsc3-send-line (mapconcat 'identity (list ":{" s ":}") "\n"))) +(defun hsc3-send-text (str)+ "If the string STR spans multiple lines `hsc3-send-layout-block' else `hsc3-send-line'."+ (if (string-match "\n" str)+ (hsc3-send-layout-block str)+ (hsc3-send-line str)))++(defun hsc3-send-text-fn (fn str)+ "Send string STR with haskell function FN applied using the $ operator.+If STR has a newline the layout is adjusted accordingly."+ (hsc3-send-text+ (if (string-match "\n" str)+ (concat fn " $\n" str)+ (concat fn " $ " str))))++(defun hsc3-send-quit ()+ "Send :quit instruction to haskell."+ (interactive)+ (hsc3-send-line ":quit"))++(defun hsc3-uncomment (s)+ "Remove initial comment and Bird-literate markers from the string S if present."+ (replace-regexp-in-string "^[- ]*[> ]*" "" s))++(defun hsc3-find-files (dir rgx)+ "Find files at DIR matching RGX."+ (mapc (lambda (filename)+ (find-file-other-window filename))+ (find-lisp-find-files dir rgx)))++(defun hsc3-help ()+ "Lookup up the name at point in the hsc3 help files."+ (interactive)+ (let ((rgx (concat "^" (thing-at-point 'symbol) "\\.help\\.l?hs$")))+ (hsc3-find-files (concat hsc3-directory "Help/") rgx)))++(defun hsc3-sc3-help ()+ "Lookup up the name at point in the Sc3 (RTF) help files."+ (interactive)+ (let ((rgx (concat "^" (thing-at-point 'symbol) "\\\(.help\\\)?.rtf$")))+ (hsc3-find-files sc3-help-directory rgx)))++(defun hsc3-sc3-help-scdoc ()+ "Lookup up the Ugen name at point in the Sc3 (SCDOC) help files."+ (interactive)+ (hsc3-send-line+ (format+ "Sound.Sc3.Common.Help.sc3_scdoc_help_open False (Sound.Sc3.Common.Help.sc3_scdoc_help_path (Sound.Sc3.Ugen.Db.ugen_sc3_name \"%s\"))"+ (thing-at-point 'symbol))))++(defun hsc3-ugen-summary ()+ "Lookup up the Ugen at point in hsc3-db."+ (interactive)+ (hsc3-send-line+ (format "Sound.Sc3.Ugen.Db.Pp.ugen_summary_wr \"%s\"" (thing-at-point 'symbol))))++(defun hsc3-ugen-default-param ()+ "Insert the default Ugen parameters (arguments) for the Ugen before <point>."+ (interactive)+ (let ((p (format "hsc3-help ugen exemplar hs %s" (thing-at-point 'symbol))))+ (insert " ")+ (insert (hsc3-remove-trailing-newline (shell-command-to-string p)))))++(defun hsc3-ugen-control-param ()+ "Insert control Ugen parameters (arguments) for the Ugen before <point>."+ (interactive)+ (let ((p (format "hsc3-help ugen exemplar hs/control %s" (thing-at-point 'symbol))))+ (insert (hsc3-remove-trailing-newline (shell-command-to-string p)))))++(defun hsc3-ugen-control-param-let ()+ "Insert control Ugen parameters (arguments) for the Ugen before <point>."+ (interactive)+ (let ((p (format "hsc3-help ugen exemplar hs/control/let %s" (thing-at-point 'symbol))))+ (insert (hsc3-remove-trailing-newline (shell-command-to-string p)))))++(defun hsc3-remove-trailing-newline (str)+ "Delete trailing newlines from STR."+ (replace-regexp-in-string "\n\\'" "" str))++(defun hsc3-cd ()+ "Change directory at ghci to current value of 'default-directory'."+ (interactive)+ (hsc3-send-line (format ":cd %s" default-directory)))++(defun hsc3-load-current-file ()+ "Send :load and the current buffer file name to haskell."+ (interactive)+ (save-buffer)+ (hsc3-see-haskell)+ (hsc3-send-line (format ":load \"%s\"" buffer-file-name)))++(defun hsc3-current-line ()+ "Get current line."+ (buffer-substring-no-properties+ (line-beginning-position)+ (line-end-position)))++(defun hsc3-send-current-line ()+ "Send the current line to haskell."+ (interactive)+ (hsc3-send-line (hsc3-uncomment (hsc3-current-line))))++(defun hsc3-send-main ()+ "Send main to haskell."+ (interactive)+ (hsc3-send-line "main"))++(defun hsc3-set-region-to-paragraph ()+ "Set the mark at the start and point at the end of the current paragraph."+ (interactive)+ (backward-paragraph)+ (push-mark nil t t)+ (forward-paragraph))++(defun hsc3-region-string ()+ "Get current region as string."+ (buffer-substring-no-properties (region-beginning) (region-end)))++(defun hsc3-send-region ()+ "Send region text to interpreter."+ (interactive)+ (hsc3-send-text (hsc3-region-string)))++(defun hsc3-send-region-fn (fn)+ "Send region text with haskell function FN to be applied."+ (hsc3-send-text-fn fn (hsc3-region-string)))++(defun hsc3-play-region-at (k)+ "Play region at scsynth. The (one-indexed) prefix agument K indicates which server to send to."+ (interactive "p")+ (hsc3-send-region-fn+ (format+ "Sound.Sc3.auditionAt (\"%s\",%d + %d) Sound.Sc3.def_play_opt"+ (hsc3-server-host) (hsc3-server-port) k)))++(defun hsc3-play-region ()+ "Play region at scsynth."+ (interactive)+ (hsc3-send-region-fn "Sound.Sc3.audition"))++(defun hsc3-play ()+ "Play at scsynth."+ (interactive)+ (hsc3-set-region-to-paragraph)+ (hsc3-play-region))++(defun hsc3-play-region-stateful ()+ "Play region at scsynth using stateful interface."+ (interactive)+ (hsc3-send-region-fn "Sound.Sc3.scSynthPlay scSynth"))++(defcustom hsc3-draw-command "draw"+ "*The un-qualified name of the draw function to use at `hsc3-draw-region'."+ :type 'string)++(defun hsc3-draw-region ()+ "Draw region Ugen graph."+ (interactive)+ (hsc3-send-region-fn (format "Sound.Sc3.Ugen.Dot.%s $ wrapOut Nothing " hsc3-draw-command)))++(defun hsc3-draw ()+ "Draw Ugen graph."+ (interactive)+ (hsc3-set-region-to-paragraph)+ (hsc3-draw-region))++(defun hsc3-dump-ugens-region ()+ "Print region Ugen graph."+ (interactive)+ (hsc3-send-region-fn "Sound.Sc3.ugen_dump_ugens $ wrapOut Nothing"))++(defun hsc3-ui-region ()+ "UI for region Ugen graph."+ (interactive)+ (let ((str (hsc3-region-string)))+ (hsc3-send-region-fn "Sound.Sc3.UI.SCLang.Control.ugen_ui_run \"ui\" 1")))++(defun hsc3-ui-comment ()+ "UI for description in comment line."+ (interactive)+ (hsc3-send-line+ (format+ "Sound.Sc3.UI.SCLang.Control.control_text_ui_run \"ui\" 1 \"%s\""+ (hsc3-current-line))))++(defun hsc3-pp-html-region ()+ "HTML pretty-printer and viewer for region Ugen graph."+ (interactive)+ (let ((str (hsc3-region-string)))+ (hsc3-send-region-fn "Sound.Sc3.UI.HTML.ugen_graph_pp_html_wv")))++(defun hsc3-pp-forth ()+ "Forth PP."+ (interactive)+ (hsc3-send-region-fn "Sound.Sc3.Ugen.Db.Pp.ugen_graph_forth_pp (False,False)"))++(defun hsc3-pp-smalltalk ()+ "Pretty print Ugen as Smalltalk."+ (interactive)+ (hsc3-send-region-fn "Sound.Sc3.Ugen.Db.Pp.Graph.ugen_graph_smalltalk_pp"))++(defun hsc3-id-rewrite-region ()+ "Run hsc3-id-rewrite on region."+ (interactive)+ (shell-command-on-region (region-beginning) (region-end) "hsc3-rw id-rewrite" nil t))++(defun hsc3-id-rewrite-buffer ()+ "Run hsc3-id-rewrite on buffer."+ (interactive)+ (shell-command-on-region (point-min) (point-max) "hsc3-rw id-rewrite" nil t))++(defun hsc3-uparam-rewrite ()+ "Rewrite uparam notation inplace."+ (interactive)+ (shell-command-on-region (region-beginning) (region-end) "hsc3-rw uparam expand" nil t))++(defun hsc3-server-protocol ()+ "The protocol that scsynth is listening at."+ (or (getenv "ScProtocol") "Udp"))++(defun hsc3-server-host ()+ "The host that scsynth is listening at."+ (or (getenv "ScHostname") "127.0.0.1"))++(defun hsc3-server-port ()+ "The port that scsynth is listening at."+ (read (or (getenv "ScPort") "57110")))++(defun hsc3-with-sc3 (txt)+ "Sound.Sc3.withSc3 at `hsc3-server-host' and `hsc3-server-port' of the string TXT."+ (hsc3-send-line+ (format "Sound.Sc3.withSc3At (%s,\"%s\",%d) %s" (hsc3-server-protocol) (hsc3-server-host) (hsc3-server-port) txt)))++(defun hsc3-reset-scsynth ()+ "Send Sc3 reset instruction to haskell."+ (interactive)+ (hsc3-with-sc3 "Sound.Sc3.reset"))++;;(hsc3-send-line "Sound.Sc3.scsynthReset scsynth")+ (defun hsc3-start-haskell ()- "Start haskell."+ "Start the hsc3 haskell process.++If `hsc3-interpreter' is not already a subprocess it is+started and a new window is created to display the results of+evaluating hsc3 expressions. Input and output is via `hsc3-buffer'." (interactive) (if (comint-check-proc hsc3-buffer)- (error "An hsc3 process is already running")+ (hsc3-see-haskell) (apply 'make-comint "hsc3"- hsc3-interpreter+ (car hsc3-interpreter) nil- hsc3-interpreter-arguments)- (hsc3-see-output))- (hsc3-write-default-run-control)- (hsc3-send-string (concat ":l " hsc3-run-control))- (hsc3-send-string ":set prompt \"hsc3> \""))+ (cdr hsc3-interpreter))+ (hsc3-set-prompt)+ (if hsc3-auto-import-modules+ (hsc3-import-standard-modules))+ (hsc3-see-haskell))) -(defun hsc3-see-output ()- "Show haskell output."+(defun hsc3-interrupt-haskell ()+ "Interupt haskell." (interactive)- (when (comint-check-proc hsc3-buffer)- (delete-other-windows)- (split-window-vertically)- (with-current-buffer hsc3-buffer- (let ((window (display-buffer (current-buffer))))- (goto-char (point-max))- (save-selected-window- (set-window-point window (point-max)))))))+ (interrupt-process hsc3-buffer comint-ptyp)) -(defun hsc3-quit-haskell ()- "Quit haskell."+(defun hsc3-stop ()+ "Interrupt haskell & reset scsynth." (interactive)- (kill-buffer hsc3-buffer)- (delete-other-windows))+ (progn+ (hsc3-interrupt-haskell)+ (sleep-for 0.15)+ (hsc3-reset-scsynth))) -(defun hsc3-help ()- "Lookup up the name at point in the Help files."+(defun hsc3-server-status ()+ "Send serverStatus request to haskell." (interactive)- (mapc (lambda (filename)- (find-file-other-window filename))- (find-lisp-find-files hsc3-help-directory- (concat "^"- (thing-at-point 'symbol)- "\\.help\\.lhs"))))+ (hsc3-with-sc3 "Sound.Sc3.serverStatus >>= mapM putStrLn")) -(defun chunk-string (n s)- "Split a string into chunks of 'n' characters."- (let* ((l (length s))- (m (min l n))- (c (substring s 0 m)))- (if (<= l n)- (list c)- (cons c (chunk-string n (substring s n))))))+(defun hsc3-quit-scsynth ()+ "Quit."+ (interactive)+ (hsc3-with-sc3 "(Sound.Osc.sendMessage Sound.Sc3.quit)")) -(defun hsc3-send-string (s)- (if (comint-check-proc hsc3-buffer)- (let ((cs (chunk-string 64 (concat s "\n"))))- (mapcar (lambda (c) (comint-send-string hsc3-buffer c)) cs))- (error "no hsc3 process running?")))+(defcustom hsc3-seq-degree 2+ "Number of scsynth processes to address at -seq operations (default=2)."+ :type 'integer) -(defun hsc3-transform-and-store (f s)- "Transform example text into compilable form."- (with-temp-file f- (mapc (lambda (module)- (insert (concat module "\n")))- hsc3-modules)- (insert "main = do\n")- (insert (if hsc3-literate-p (hsc3-unlit s) s))))+(defun hsc3-server-status-seq ()+ "Send serverStatus request to haskell."+ (interactive)+ (hsc3-send-line+ (format+ "Sound.Sc3.withSc3AtSeq (\"%s\",%d) %d Sound.Sc3.serverStatus >>= mapM putStrLn . concat"+ (hsc3-server-host) (hsc3-server-port) hsc3-seq-degree))) -(defun hsc3-run-line ()- "Send the current line to the interpreter."+(defun hsc3-play-region-seq ()+ "Sound.Sc3.auditionAtSeq of `hsc3-seq-degree'." (interactive)- (let* ((s (buffer-substring (line-beginning-position)- (line-end-position)))- (s* (if hsc3-literate-p- (hsc3-unlit s)- s)))- (hsc3-send-string s*)))+ (hsc3-send-region-fn+ (format+ "Sound.Sc3.auditionAtSeq (\"%s\",%d) def_play_opt %d"+ (hsc3-server-host) (hsc3-server-port) hsc3-seq-degree))) -(defun hsc3-run-multiple-lines ()- "Send the current region to the interpreter as a single line."+(defun hsc3-reset-scsynth-seq ()+ "Send Sc3 reset instruction to haskell." (interactive)- (let* ((s (buffer-substring-no-properties (region-beginning)- (region-end)))- (s* (if hsc3-literate-p- (hsc3-unlit s)- s)))- (hsc3-send-string (replace-regexp-in-string "\n" " " s*))))+ (hsc3-send-line+ (format+ "Sound.Sc3.withSc3AtSeq_ (\"%s\",%d) %d Sound.Sc3.reset"+ (hsc3-server-host) (hsc3-server-port) hsc3-seq-degree))) -(defun hsc3-run-region ()- "Place the region in a do block and compile."+(defun hsc3-dmenu-ugen-core ()+ "Run dmenu to select a core Sc3 Ugen." (interactive)- (hsc3-transform-and-store- "/tmp/hsc3.hs"- (buffer-substring-no-properties (region-beginning) (region-end)))- (hsc3-send-string ":load \"/tmp/hsc3.hs\"")- (hsc3-send-string "main"))+ (insert (shell-command-to-string "hsc3-db dmenu ugen core"))) -(defun hsc3-load-buffer ()- "Load the current buffer."+(defun hsc3-dmenu-ugen-ext ()+ "Run dmenu to select an external Sc3 Ugen." (interactive)- (save-buffer)- (hsc3-send-string (format ":load \"%s\"" buffer-file-name)))+ (insert (shell-command-to-string "hsc3-db dmenu ugen external"))) -(defun hsc3-run-main ()- "Run current main."+(defun hsc3-dmenu-ugen-all ()+ "Run dmenu to select an Sc3 Ugen." (interactive)- (hsc3-send-string "main"))+ (insert (shell-command-to-string "hsc3-db dmenu ugen all"))) -(defun hsc3-interrupt-haskell ()+(defun hsc3-xmenu-ugen-core ()+ "Run xmenu to select a core Sc3 Ugen." (interactive)- (if (comint-check-proc hsc3-buffer)- (with-current-buffer hsc3-buffer- (interrupt-process (get-buffer-process (current-buffer))))- (error "no hsc3 process running?")))+ (insert (shell-command-to-string "hsc3-db xmenu core"))) -(defun hsc3-reset-scsynth ()- "Reset"+(defun hsc3-xmenu-ugen-ext ()+ "Run xmenu to select an external Sc3 Ugen." (interactive)- (hsc3-send-string "withSC3 reset"))+ (insert (shell-command-to-string "hsc3-db xmenu external"))) -(defun hsc3-status-scsynth ()- "Status"+(defun hsc3-xmenu-ugen-all ()+ "Run xmenu to select an Sc3 Ugen." (interactive)- (hsc3-send-string "withSC3 serverStatus >>= mapM putStrLn"))+ (insert+ (shell-command-to-string+ "cat ~/sw/hsc3-db/lib/xmenu/ugen-core-tree.text \+ ~/sw/hsc3-db/lib/xmenu/nil.text \+ ~/sw/hsc3-db/lib/xmenu/ugen-ext-tree.text | xmenu"))) -(defun hsc3-quit-scsynth ()- "Quit"+(defun hsc3-load-file (fn)+ "Load file FN as string."+ (with-temp-buffer+ (insert-file-contents fn)+ (buffer-substring-no-properties+ (point-min)+ (point-max))))++(defun hsc3-unload-all-modules ()+ "Unload all modules and delete all bindings at ghci.++ :load without any arguments unloads all the currently loaded modules and bindings" (interactive)- (hsc3-send-string "withSC3 (\fd -> send fd quit)"))+ (hsc3-send-line ":load")) +(defun hsc3-import-standard-modules ()+ "Send standard set of hsc3 and related module imports to haskell."+ (interactive)+ (mapc+ 'hsc3-send-line+ (split-string (hsc3-load-file (concat hsc3-directory "lib/hsc3-std-imports.hs")) "\n")))++(defun hsc3-init-scsynth ()+ "Initialise the scsynth interpreter variable."+ (interactive)+ (hsc3-send-line "scSynth <- Sound.Sc3.Server.ScSynth.newScSynth"))++(defun hsc3-set-prompt ()+ "Set ghci prompt to hsc3> and the continuation prompt to nil."+ (interactive)+ (hsc3-send-line ":set prompt \"hsc3> \"")+ (hsc3-send-line ":set prompt-cont \"\""))++(defun hsc3-see-haskell ()+ "Show haskell output."+ (interactive)+ (if (not (comint-check-proc hsc3-buffer))+ (hsc3-start-haskell)+ (delete-other-windows)+ (split-window-vertically)+ (with-current-buffer hsc3-buffer+ (let ((window (display-buffer (current-buffer))))+ (goto-char (point-max))+ (save-selected-window+ (set-window-point window (point-max)))))))+ (defvar hsc3-mode-map nil "Haskell SuperCollider keymap.") (defun hsc3-mode-keybindings (map)- "Haskell SuperCollider keybindings."- (define-key map [?\C-c ?\C-s] 'hsc3-start-haskell)- (define-key map [?\C-c ?\C-g] 'hsc3-see-output)- (define-key map [?\C-c ?\C-x] 'hsc3-quit-haskell)- (define-key map [?\C-c ?\C-k] 'hsc3-reset-scsynth)- (define-key map [?\C-c ?\C-w] 'hsc3-status-scsynth)- (define-key map [?\C-c ?\C-c] 'hsc3-run-line)- (define-key map [?\C-c ?\C-e] 'hsc3-run-multiple-lines)- (define-key map [?\C-c ?\C-r] 'hsc3-run-region)- (define-key map [?\C-c ?\C-l] 'hsc3-load-buffer)- (define-key map [?\C-c ?\C-i] 'hsc3-interrupt-haskell)- (define-key map [?\C-c ?\C-m] 'hsc3-run-main)- (define-key map [?\C-c ?\C-o] 'hsc3-quit-scsynth)- (define-key map [?\C-c ?\C-h] 'hsc3-help))--(defun turn-on-hsc3-keybindings ()- "Haskell SuperCollider keybindings in the local map."- (local-set-key [?\C-c ?\C-s] 'hsc3-start-haskell)- (local-set-key [?\C-c ?\C-g] 'hsc3-see-output)- (local-set-key [?\C-c ?\C-x] 'hsc3-quit-haskell)- (local-set-key [?\C-c ?\C-k] 'hsc3-reset-scsynth)- (local-set-key [?\C-c ?\C-w] 'hsc3-status-scsynth)- (local-set-key [?\C-c ?\C-c] 'hsc3-run-line)- (local-set-key [?\C-c ?\C-e] 'hsc3-run-multiple-lines)- (local-set-key [?\C-c ?\C-r] 'hsc3-run-region)- (local-set-key [?\C-c ?\C-l] 'hsc3-load-buffer)- (local-set-key [?\C-c ?\C-i] 'hsc3-interrupt-haskell)- (local-set-key [?\C-c ?\C-m] 'hsc3-run-main)- (local-set-key [?\C-c ?\C-o] 'hsc3-quit-scsynth)- (local-set-key [?\C-c ?\C-h] 'hsc3-help))+ "Add Haskell SuperCollider keybindings to MAP."+ (define-key map (kbd "C-c <") 'hsc3-load-current-file)+ (define-key map (kbd "C-c >") 'hsc3-see-haskell)+ (define-key map (kbd "C-c C-c") 'hsc3-send-current-line)+ (define-key map (kbd "C-c C-h") 'hsc3-help)+ (define-key map (kbd "C-c C-r") 'hsc3-send-region)+ (define-key map (kbd "C-c C-a") 'hsc3-play)+ (define-key map (kbd "C-c C-S-a") 'hsc3-play-region-seq)+ (define-key map (kbd "C-c C-g") 'hsc3-draw)+ (define-key map (kbd "C-c C-d") 'hsc3-dump-ugens-region)+ (define-key map (kbd "C-c C-v") 'hsc3-ui-region)+ (define-key map (kbd "C-c C-f") 'hsc3-ui-comment)+ (define-key map (kbd "C-c C-j") 'hsc3-sc3-help)+ (define-key map (kbd "C-c C-i") 'hsc3-interrupt-haskell)+ (define-key map (kbd "C-c C-k") 'hsc3-reset-scsynth)+ (define-key map (kbd "C-c C-S-k") 'hsc3-reset-scsynth-seq)+ (define-key map (kbd "C-c C-m") 'hsc3-send-main)+ (define-key map (kbd "C-c C-p") 'hsc3-server-status)+ (define-key map (kbd "C-c C-S-p") 'hsc3-server-status-seq)+ (define-key map (kbd "C-c C-q") 'hsc3-send-quit)+ (define-key map (kbd "C-c C-.") 'hsc3-stop)+ (define-key map (kbd "C-c C-s") 'hsc3-dmenu-ugen-all)+ (define-key map (kbd "C-c C-S-s") 'hsc3-xmenu-ugen-all)+ (define-key map (kbd "C-c C-u") 'hsc3-ugen-summary)) (defun hsc3-mode-menu (map)- "Haskell SuperCollider menu."- (define-key map [menu-bar hsc3]- (cons "Haskell-SuperCollider" (make-sparse-keymap "Haskell-SuperCollider")))- (define-key map [menu-bar hsc3 help]- (cons "Help" (make-sparse-keymap "Help")))- (define-key map [menu-bar hsc3 help hsc3]- '("Haskell SuperCollider help" . hsc3-help))- (define-key map [menu-bar hsc3 expression]- (cons "Expression" (make-sparse-keymap "Expression")))- (define-key map [menu-bar hsc3 expression load-buffer]- '("Load buffer" . hsc3-load-buffer))- (define-key map [menu-bar hsc3 expression run-main]- '("Run main" . hsc3-run-main))- (define-key map [menu-bar hsc3 expression run-region]- '("Run region" . hsc3-run-region))- (define-key map [menu-bar hsc3 expression run-multiple-lines]- '("Run multiple lines" . hsc3-run-multiple-lines))- (define-key map [menu-bar hsc3 expression run-line]- '("Run line" . hsc3-run-line))- (define-key map [menu-bar hsc3 scsynth]- (cons "SCSynth" (make-sparse-keymap "SCSynth")))- (define-key map [menu-bar hsc3 scsynth quit]- '("Quit scsynth" . hsc3-quit-scsynth))- (define-key map [menu-bar hsc3 scsynth status]- '("Display status" . hsc3-status-scsynth))- (define-key map [menu-bar hsc3 scsynth reset]- '("Reset scsynth" . hsc3-reset-scsynth))- (define-key map [menu-bar hsc3 haskell]- (cons "Haskell" (make-sparse-keymap "Haskell")))- (define-key map [menu-bar hsc3 haskell quit-haskell]- '("Quit haskell" . hsc3-quit-haskell))- (define-key map [menu-bar hsc3 haskell see-output]- '("See output" . hsc3-see-output))- (define-key map [menu-bar hsc3 haskell start-haskell]- '("Start haskell" . hsc3-start-haskell)))+ "Add Haskell SuperCollider Menu to MAP."+ (define-key map [menu-bar hsc3] (cons "Haskell-SuperCollider" (make-sparse-keymap "Haskell-SuperCollider")))+ (define-key map [menu-bar hsc3 help] (cons "Help" (make-sparse-keymap "Help")))+ (define-key map [menu-bar hsc3 help hsc3] '("HSc3 Help" . hsc3-help))+ (define-key map [menu-bar hsc3 help ugen] '("Ugen Summary" . hsc3-ugen-summary))+ (define-key map [menu-bar hsc3 help sc3-ugen] '("Sc3 Help" . hsc3-sc3-ugen-help))+ (define-key map [menu-bar hsc3 expression] (cons "Expression" (make-sparse-keymap "Expression")))+ (define-key map [menu-bar hsc3 expression stop] '("Stop (interrupt and reset)" . hsc3-stop))+ (define-key map [menu-bar hsc3 expression change-directory] '("Change directory" . hsc3-cd))+ (define-key map [menu-bar hsc3 expression import-standard-modules] '("Import standard modules" . hsc3-import-standard-modules))+ (define-key map [menu-bar hsc3 expression server-status] '("Print server status" . hsc3-server-status))+ (define-key map [menu-bar hsc3 expression send-main] '("Send main" . hsc3-send-main))+ (define-key map [menu-bar hsc3 expression send-region] '("Send region" . hsc3-send-region))+ (define-key map [menu-bar hsc3 expression send-current-line] '("Send current line" . hsc3-send-current-line))+ (define-key map [menu-bar hsc3 expression id-rewrite-region] '("ID-rewrite region" . hsc3-id-rewrite-region))+ (define-key map [menu-bar hsc3 expression load-current-file] '("Load current file" . hsc3-load-current-file))+ (define-key map [menu-bar hsc3 expression dmenu-ugen] '("Ugen dmenu" . hsc3-dmenu-ugen-all))+ (define-key map [menu-bar hsc3 expression xmenu-ugen] '("Ugen xmenu" . hsc3-xmenu-ugen-all))+ (define-key map [menu-bar hsc3 expression draw-region] '("Draw region" . hsc3-draw-region))+ (define-key map [menu-bar hsc3 expression play-region] '("Play region" . hsc3-play-region))+ (define-key map [menu-bar hsc3 scsynth] (cons "ScSynth" (make-sparse-keymap "ScSynth")))+ (define-key map [menu-bar hsc3 scsynth quit] '("Quit scsynth" . hsc3-quit-scsynth))+ (define-key map [menu-bar hsc3 scsynth status] '("Display status" . hsc3-status-scsynth))+ (define-key map [menu-bar hsc3 scsynth reset] '("Reset scsynth" . hsc3-reset-scsynth))+ (define-key map [menu-bar hsc3 haskell] (cons "Haskell" (make-sparse-keymap "Haskell")))+ (define-key map [menu-bar hsc3 haskell quit-haskell] '("Quit haskell" . hsc3-quit-haskell))+ (define-key map [menu-bar hsc3 haskell interrupt-haskell] '("Interrupt haskell" . hsc3-interrupt-haskell))+ (define-key map [menu-bar hsc3 haskell see-haskell] '("See haskell" . hsc3-see-haskell))) (if hsc3-mode-map ()@@ -278,24 +515,14 @@ (setq hsc3-mode-map map))) (define-derived-mode- literate-hsc3-mode hsc3-mode- "Literate Haskell SuperCollider"- "Major mode for interacting with an inferior haskell process."- (setq hsc3-literate-p t)- (setq haskell-literate 'bird)- (turn-on-font-lock))--(add-to-list 'auto-mode-alist '("\\.lhs$" . literate-hsc3-mode))--(define-derived-mode- hsc3-mode haskell-mode "Haskell SuperCollider"- "Major mode for interacting with an inferior haskell process."- (setq hsc3-literate-p nil)+ "Major mode for interacting with an inferior hsc3 process." (turn-on-font-lock)) (add-to-list 'auto-mode-alist '("\\.hs$" . hsc3-mode)) (provide 'hsc3)++;;; hsc3.el ends here
hsc3.cabal view
@@ -1,103 +1,145 @@+cabal-version: 2.4 Name: hsc3-Version: 0.8+Version: 0.21 Synopsis: Haskell SuperCollider-Description: hsc3 provides Sound.SC3, a haskell module that - facilitates using haskell as a client to the - SuperCollider synthesis server. -License: GPL+Description: Library for communicating with the SuperCollider synthesiser+License: GPL-3.0-only Category: Sound-Copyright: (c) Rohan Drape and others, 2006-2010+Copyright: (c) Rohan Drape and others, 2005-2024 Author: Rohan Drape-Maintainer: rd@slavepianos.org+Maintainer: rd@rohandrape.net Stability: Experimental-Homepage: http://slavepianos.org/rd/?t=hsc3-Tested-With: GHC == 6.10.3+Homepage: http://rohandrape.net/t/hsc3+Tested-With: GHC == 9.10.1 Build-Type: Simple-Cabal-Version: >= 1.6 -Data-files: README+Data-files: README.md emacs/hsc3.el- Help/hsc3.help.lhs- Help/tutorial.lhs- Help/Server/*.help.lhs- Help/UGen/Analysis/*.help.lhs- Help/UGen/Buffer/*.help.lhs- Help/UGen/Chaos/*.help.lhs- Help/UGen/Control/*.help.lhs- Help/UGen/Demand/*.help.lhs- Help/UGen/DiskIO/*.help.lhs- Help/UGen/Envelope/*.help.lhs- Help/UGen/External/*.help.lhs- Help/UGen/FFT/*.help.lhs- Help/UGen/Filter/*.help.lhs- Help/UGen/Granular/*.help.lhs- Help/UGen/Information/*.help.lhs- Help/UGen/IO/*.help.lhs- Help/UGen/MachineListening/*.help.lhs- Help/UGen/Math/*.help.lhs- Help/UGen/Noise/*.help.lhs- Help/UGen/Oscillator/*.help.lhs- Help/UGen/Panner/*.help.lhs- Help/UGen/Trigger/*.help.lhs+ Help/**/*.hs+ lib/*.hs Library- Build-Depends: base == 4.*,+ Build-Depends: array,+ base >= 4.7 && < 5, binary, bytestring, containers,- hosc == 0.8,+ data-binary-ieee754,+ data-ordlist,+ directory,+ filepath,+ hosc == 0.21.*,+ mtl,+ murmur-hash, network, process, random,- split- GHC-Options: -Wall -fwarn-tabs- Exposed-modules: Sound.SC3- Sound.SC3.ID- Sound.SC3.Monadic- Sound.SC3.Server- Sound.SC3.Server.Command- Sound.SC3.Server.Command.Completion- Sound.SC3.Server.NRT- Sound.SC3.Server.Play- Sound.SC3.Server.Status- Sound.SC3.Server.Synthdef- Sound.SC3.UGen- Sound.SC3.UGen.Analysis- Sound.SC3.UGen.Buffer- Sound.SC3.UGen.Chaos- Sound.SC3.UGen.Composite- Sound.SC3.UGen.Composite.Monadic- Sound.SC3.UGen.Demand- Sound.SC3.UGen.Demand.ID- Sound.SC3.UGen.Demand.Monadic- Sound.SC3.UGen.DiskIO- Sound.SC3.UGen.Enum- Sound.SC3.UGen.Envelope- Sound.SC3.UGen.Envelope.Construct- Sound.SC3.UGen.External- Sound.SC3.UGen.External.ATS- Sound.SC3.UGen.External.LPC- Sound.SC3.UGen.FFT- Sound.SC3.UGen.FFT.ID- Sound.SC3.UGen.FFT.Monadic- Sound.SC3.UGen.Filter- Sound.SC3.UGen.Granular- Sound.SC3.UGen.IO- Sound.SC3.UGen.Information- Sound.SC3.UGen.MachineListening- Sound.SC3.UGen.Math- Sound.SC3.UGen.Noise.ID- Sound.SC3.UGen.Noise.Monadic- Sound.SC3.UGen.Operator- Sound.SC3.UGen.Oscillator- Sound.SC3.UGen.Panner- Sound.SC3.UGen.Rate- Sound.SC3.UGen.UGen- Sound.SC3.UGen.UGen.Lift- Sound.SC3.UGen.UId- Other-modules: Sound.SC3.Server.Utilities- Sound.SC3.UGen.Utilities+ safe,+ split >= 0.2,+ transformers,+ vector+ Default-Language:Haskell2010+ GHC-Options: -Wall -Wno-x-partial -Wno-incomplete-uni-patterns+ Exposed-modules: Sound.Sc3+ Sound.Sc3.Common+ Sound.Sc3.Common.Base+ Sound.Sc3.Common.Base.System+ Sound.Sc3.Common.Buffer+ Sound.Sc3.Common.Buffer.Array+ Sound.Sc3.Common.Buffer.Gen+ Sound.Sc3.Common.Buffer.Vector+ Sound.Sc3.Common.Context+ Sound.Sc3.Common.Enum+ Sound.Sc3.Common.Envelope+ Sound.Sc3.Common.Help+ Sound.Sc3.Common.Help.Sc2+ Sound.Sc3.Common.Math+ Sound.Sc3.Common.Math.Filter+ Sound.Sc3.Common.Math.Filter.Beq+ Sound.Sc3.Common.Math.Interpolate+ Sound.Sc3.Common.Math.Noise+ Sound.Sc3.Common.Math.Operator+ Sound.Sc3.Common.Math.Warp+ Sound.Sc3.Common.Math.Window+ Sound.Sc3.Common.Mce+ Sound.Sc3.Common.Monad+ Sound.Sc3.Common.Monad.Operators+ Sound.Sc3.Common.Rate+ Sound.Sc3.Common.Random+ Sound.Sc3.Common.SoundFile+ Sound.Sc3.Common.Uid+ Sound.Sc3.Common.Unsafe+ Sound.Sc3.Fd+ Sound.Sc3.Server+ Sound.Sc3.Server.Command+ Sound.Sc3.Server.Command.Completion+ Sound.Sc3.Server.Command.Enum+ Sound.Sc3.Server.Command.Generic+ Sound.Sc3.Server.Command.Plain+ Sound.Sc3.Server.Command.Plain.Completion+ Sound.Sc3.Server.Enum+ Sound.Sc3.Server.Graphdef+ Sound.Sc3.Server.Graphdef.Binary+ Sound.Sc3.Server.Graphdef.Graph+ Sound.Sc3.Server.Graphdef.Io+ Sound.Sc3.Server.Graphdef.Read+ Sound.Sc3.Server.Graphdef.Text+ Sound.Sc3.Server.Fd+ Sound.Sc3.Server.Monad+ Sound.Sc3.Server.Nrt+ Sound.Sc3.Server.Nrt.Edit+ Sound.Sc3.Server.Nrt.Render+ Sound.Sc3.Server.Nrt.Stat+ Sound.Sc3.Server.Nrt.Ugen+ Sound.Sc3.Server.Options+ Sound.Sc3.Server.Param+ Sound.Sc3.Server.Recorder+ Sound.Sc3.Server.Scsynth+ Sound.Sc3.Server.Status+ Sound.Sc3.Server.Synthdef+ Sound.Sc3.Server.Transport.Fd+ Sound.Sc3.Server.Transport.Monad+ Sound.Sc3.Ugen+ Sound.Sc3.Ugen.Analysis+ Sound.Sc3.Ugen.Bindings+ Sound.Sc3.Ugen.Bindings.Composite+ Sound.Sc3.Ugen.Bindings.Composite.External+ Sound.Sc3.Ugen.Bindings.Db+ Sound.Sc3.Ugen.Bindings.Db.External+ Sound.Sc3.Ugen.Bindings.Hw+ Sound.Sc3.Ugen.Bindings.Hw.Construct+ Sound.Sc3.Ugen.Bindings.Hw.External+ Sound.Sc3.Ugen.Bindings.Hw.External.F0+ Sound.Sc3.Ugen.Bindings.Hw.External.Sc3_Plugins+ Sound.Sc3.Ugen.Bindings.Hw.External.Wavelets+ Sound.Sc3.Ugen.Bindings.Hw.External.Zita+ Sound.Sc3.Ugen.Bracketed+ Sound.Sc3.Ugen.Brackets+ Sound.Sc3.Ugen.Constant+ Sound.Sc3.Ugen.Control+ Sound.Sc3.Ugen.Enum+ Sound.Sc3.Ugen.Envelope+ Sound.Sc3.Ugen.Event+ Sound.Sc3.Ugen.Graph+ Sound.Sc3.Ugen.Graph.Reconstruct+ Sound.Sc3.Ugen.Graph.Transform+ Sound.Sc3.Ugen.Help.Graph+ Sound.Sc3.Ugen.Hs+ Sound.Sc3.Ugen.Label+ Sound.Sc3.Ugen.Math+ Sound.Sc3.Ugen.Math.Composite+ Sound.Sc3.Ugen.Mce+ Sound.Sc3.Ugen.Mrg+ Sound.Sc3.Ugen.Name+ Sound.Sc3.Ugen.Optimise+ Sound.Sc3.Ugen.Plain+ Sound.Sc3.Ugen.Pp+ Sound.Sc3.Ugen.Primitive+ Sound.Sc3.Ugen.Proxy+ Sound.Sc3.Ugen.Types+ Sound.Sc3.Ugen.Ugen+ Sound.Sc3.Ugen.Util Source-Repository head- Type: darcs- Location: http://slavepianos.org/~rd/sw/hsc3/+ Type: git+ Location: https://gitlab.com/rd--/hsc3
+ lib/hsc3-min-imports.hs view
@@ -0,0 +1,6 @@+import Prelude {- base -}+import Control.Monad {- base -}+import Data.Bits {- base -}+import Data.Function {- base -}+import Data.List {- base -}+import Sound.Sc3 {- hsc3 -}
+ lib/hsc3-std-extensions.hs view
@@ -0,0 +1,2 @@+{-# Language OverloadedLists #-}+{-# Language FlexibleContexts #-}
+ lib/hsc3-std-imports.hs view
@@ -0,0 +1,21 @@+import Prelude {- base -}+import Control.Monad {- base -}+import Data.Bits {- base -}+import Data.Function {- base -}+import Data.List {- base -}+import System.Random {- random -}+import Sound.Osc {- hosc -}+import Sound.Sc3 {- hsc3 -}+import Sound.Sc3.Common.Base {- hsc3 -}+import qualified Sound.Sc3.Common.Buffer.Gen as Gen {- hsc3 -}+import qualified Sound.Sc3.Common.Math.Filter.Beq {- hsc3 -}+import qualified Sound.Sc3.Ugen.Bindings.Db.External as X {- hsc3 -}+import qualified Sound.Sc3.Ugen.Bindings.Composite.External as X {- hsc3 -}+import qualified Sound.Sc3.Ugen.Bindings.Hw.External.Sc3_Plugins as X {- hsc3 -}+import qualified Sound.Sc3.Ugen.Bindings.Hw.External.Zita as X {- hsc3 -}+import qualified Sound.Sc3.Ugen.Protect as Protect {- hsc3-rw -}+import qualified Sound.Sc3.Ui.Html as Ui {- hsc3-ui -}+import qualified Sound.Sc3.Ui.Plot as Ui {- hsc3-ui -}+import qualified Sound.Sc3.Ui.Qarma as Ui {- hsc3-ui -}+import qualified Sound.Sc3.Ui.Sclang as Ui {- hsc3-ui -}+import qualified Sound.Sc3.Ui.Sclang.Control as Ui {- hsc3-ui -}