From 0ef13a532f1127f6611af218f1a19fcfaf0f5780 Mon Sep 17 00:00:00 2001 From: efim Date: Thu, 1 Sep 2022 19:12:53 +0000 Subject: [PATCH] trying new synths from awesome list --- ...01-more-percussions-and-write-to-file.lisp | 47 +++++++++++++++ programming-music-journal.org | 59 +++++++++++++++++++ 2 files changed, 106 insertions(+) diff --git a/2022-09-01-more-percussions-and-write-to-file.lisp b/2022-09-01-more-percussions-and-write-to-file.lisp index 5da41fa..bb74941 100644 --- a/2022-09-01-more-percussions-and-write-to-file.lisp +++ b/2022-09-01-more-percussions-and-write-to-file.lisp @@ -315,3 +315,50 @@ mybuffer ;; then you can play what you recorded with a utility like mpv: ;; mpv /tmp/foo.aiff + +(in-package #:cl-collider) +;; https://github.com/SCLOrkHub/SCLOrkSynths +;; https://github.com/SCLOrkHub/SCLOrkSynths/blob/master/SynthDefs/bass/acidOto3091.scd + +(defsynth bdrum ((amp 0.5) (out 0) ) + (out.ar out (* amp (sin-osc.ar (line.ar 120 60 1) 0 (env-gen.ar (env (list 0 1 0) (list 0.005 0.5)) :act :free))))) +;; out = 0, gate = 1, freq = 440, amp = 0.1, pan = 0, att = 0.001, dec = 0.5, sus = 0.1, rel = 0.5, curve = -4, +;; // Other Controls +;; // width is 0 - 1 +;; // filterRange is in octaves +;; lagTime = 0.12, filterRange = 6, width = 0.51, rq = 0.3; +(defsynth acid0to3091 ((amp 0.5) (out 0) (gate 1) (freq 440) (pan 0) (att 0.001) (dec 0.5) (sus 0.1) (rel 0.5) (curve -4) (lagTime 0.12) (filterRange 6) (width 0.51) (rq 0.3)) + (let* ((freq (lag.kr freq lagTime)) + (ampEnv (env-gen.kr (adsr att dec sus rel amp 0) :gate gate)) + ;; (filterEnv (env-gen.kr (adsr att (* 2 dec) (/ sus 2) (* 2 rel) (expt 2 filterRange) (list (* -1 curve) curve curve curve ) 1) gate :act :free)) + ;; this is likely not correct way to set up cure of the form curve: [-1 * curve, curve, curve, curve], + ;; does that mean multichannel things? + ;; let's just set as single curve and check how it looks? + (filterEnv (env-gen.kr (adsr att (* 2 dec) (/ sus 2) (* 2 rel) (expt 2 filterRange) (* -1 curve) 1) :gate gate :act :free)) + ;; is LFPulse.ar(...).range(-1, 1) gets from _range ? + (sndStep1 (_range nil (lf-pulse.ar freq 0.0 width) -1 1)) + (sndStep2 (rlpf.ar sndStep1 (* freq filterEnv) rq)) + (sndStep3 (* sndStep2 ampEnv))) + (out.ar out (pan2.ar sndStep3 pan)))) +(synth :acid0to3091) +(stop) + +;; that a nice acid base, just not freeing the thing, so can't be used as is, sad. +;; let's try something else? + +;;; (and that one seems interesting for later : https://github.com/SCLOrkHub/SCLOrkSynths/blob/master/SynthDefs/bass/fmBass.scd ) +;; +;;; https://github.com/SCLOrkHub/SCLOrkSynths/blob/master/SynthDefs/bass/bassWarsaw.scd +(defsynth fmBass ((out 0) (freq 440) (gate 1) (amp 0.5) (pan 0) (att 0.01) (dec 0.3) (sus 0.4) (rel 0.1) (slideTime 0.17) (cutoff 1100) (width 0.15) (detune 1.005) (preamp 4)) + (let* ((env (env-gen.kr (adsr att dec sus rel) :gate gate :act :free)) + (freq (lag.kr freq slideTime)) + (sndStep1 (var-saw.ar freq 0 width preamp)) + (sndStep2 (distort sndStep1)) + (sndStep3 (* sndStep2 env)) + (sndStep4 (lpf.ar sndStep3 cutoff amp))) + (out.ar out (pan2.ar sndStep4 pan)))) +(synth :fmBass :freq 80) +(stop) + +;; overall this is not quite success, not quite a failure +;; I've practiced searching for tihngs I don't konw between the libraries diff --git a/programming-music-journal.org b/programming-music-journal.org index 9b13d50..0130c25 100644 --- a/programming-music-journal.org +++ b/programming-music-journal.org @@ -225,3 +225,62 @@ past sunday with your help I've figured out how to make percussion instruments f Today I tried to figure out more complicated beats, and how to join different lines with pauses Still lots to do, but will share what I've accomplished in hopes that it returns you a little bit of excitement your project brings +** reading more guids : here about pitch model, duration model +http://doc.sccode.org/Tutorials/Streams-Patterns-Events5.html +** some advice from a veteran: +https://nathan.ho.name/posts/supercollider-tips/ +** so, now I could try figuring out other instruments? +i already found link to examples: +[[*awesome list : https://github.com/madskjeldgaard/awesome-supercollider#synthdefs][awesome list : https://github.com/madskjeldgaard/awesome-supercollider#synthdefs]] + +https://github.com/SCLOrkHub/SCLOrkSynths/tree/master/SynthDefs/bass + +these are specifically for use with patterns, cool, but more things to learn before I can rewrite them in cl =0 +*** so, "go to definition" didn't work with #'ENV but worked with #'ENV-GEN and env was close +there I searched for "perc" to see +https://depts.washington.edu/dxscdoc/Help/Classes/Env.html +what is the analogue Env.perc +and that I guess is just #'PERC + +yay, I suppose +*** a question into the matrix channel: +I've tried to go and convert some of the synths found online into CL form +overall when I needed to figure out something I don't quite understand + +for example + +Env.adsr(...) +I went to SuperCollider documentation, saw that it's a constructor method for Env, went to definition of EnvDef and searched for adsr, and it's a convenient separate method +or + +LFPulse.ar(freq: freq, width: width).range(-1, 1); +went to #'LF-PULSE definition and searched for "range" found that it's a separate generic method that supposedly takes in lf-pusle object (I'm after basics, but at the beginning of figuring out CL) +With that - I think I missed something important, could you help me out? + +When translating https://github.com/SCLOrkHub/SCLOrkSynths/blob/master/SynthDefs/bass/acidOto3091.scd + +I totally didn't know what to do with + curve: [-1 * curve, curve, curve, curve], + +my guess is that it's connected to multi-level? That's when I think I was arrays used? + +What I got produced an interesting sound, but didn't stop + +(defsynth acid0to3091 ((amp 0.5) (out 0) (gate 1) (freq 440) (pan 0) (att 0.001) (dec 0.5) (sus 0.1) (rel 0.5) (curve -4) (lagTime 0.12) (filterRange 6) (width 0.51) (rq 0.3)) + (let* ((freq (lag.kr freq lagTime)) + (ampEnv (env-gen.kr (adsr att dec sus rel amp 0) :gate gate)) + ;; (filterEnv (env-gen.kr (adsr att (* 2 dec) (/ sus 2) (* 2 rel) (expt 2 filterRange) (list (* -1 curve) curve curve curve ) 1) gate :act :free)) + ;; this is likely not correct way to set up cure of the form curve: [-1 * curve, curve, curve, curve], + ;; does that mean multichannel things? + ;; let's just set as single curve and check how it looks? + (filterEnv (env-gen.kr (adsr att (* 2 dec) (/ sus 2) (* 2 rel) (expt 2 filterRange) (* -1 curve) 1) :gate gate :act :free)) + ;; is LFPulse.ar(...).range(-1, 1) gets from _range ? + (sndStep1 (_range nil (lf-pulse.ar freq 0.0 width) -1 1)) + (sndStep2 (rlpf.ar sndStep1 (* freq filterEnv) rq)) + (sndStep3 (* sndStep2 ampEnv))) + (out.ar out (pan2.ar sndStep3 pan)))) +(synth :acid0to3091) +(stop) +And I'm currently very far from being able to debug \ troubleshoot what's going on here, +I do have one #'ENV-GEN that has :act :free +but can't follow all the transformations, so have no idea what's going wrong