21st stuff, don't remember much
This commit is contained in:
parent
da7eaa45b5
commit
ba4ee2767d
|
@ -0,0 +1,171 @@
|
||||||
|
|
||||||
|
(in-package #:cl-collider)
|
||||||
|
|
||||||
|
(defsynth tone-pluck ((freq 440) (amp 0.2))
|
||||||
|
(out.ar 0 (* (saw.ar (let ((detune (* freq 0.01)))
|
||||||
|
(list (- freq detune) (+ freq detune))))
|
||||||
|
(env-gen.kr (perc 0.1 1.8)
|
||||||
|
:level-scale amp
|
||||||
|
:act :free))))
|
||||||
|
;; (synth :tone-pluck)
|
||||||
|
|
||||||
|
(defsynth kik ((freq 440) (out 0))
|
||||||
|
(let* ((env (env-gen.kr (env (list 0 1 0) (list 0.001 1)) :act :free))
|
||||||
|
(fenv (env-gen.kr (env (list 1 0) (list 0.25)) :level-scale freq))
|
||||||
|
(sig (sin-osc.ar fenv 0 0.2)))
|
||||||
|
(out.ar out (pan2.ar sig 0 env))))
|
||||||
|
;; (synth :kik)
|
||||||
|
|
||||||
|
|
||||||
|
(in-package #:cl-patterns)
|
||||||
|
|
||||||
|
(pb :what-predef-chord
|
||||||
|
:instrument :tone-pluck
|
||||||
|
:note (pseq (mapcar #'chord-notes (list (chord "Major Triad") (chord "Minor Triad") (chord "Minor 7th") (chord "Major 7th") (chord "Diminished Triad") (chord "Major Triad"))) 1)
|
||||||
|
:octave 4
|
||||||
|
:root 2
|
||||||
|
:dur (pseq '(2 2 4))
|
||||||
|
;; :play-quant 4
|
||||||
|
)
|
||||||
|
|
||||||
|
;; (play :what-predef-chord)
|
||||||
|
;; (end :what-predef-chord)
|
||||||
|
|
||||||
|
(pb :what-basic-percussion
|
||||||
|
:instrument :kik
|
||||||
|
:note 0
|
||||||
|
:dur (pseq '(1 1 1 1 1) 1) ; ok, too hard again, want to finish something and go on
|
||||||
|
:play-quant 4)
|
||||||
|
|
||||||
|
;; (play :what-basic-percussion)
|
||||||
|
;; (stop :what-basic-percussion)
|
||||||
|
|
||||||
|
;;; now, previous stuff copied off the
|
||||||
|
(pdef :maybe-parallel (ppar (list (pdef :what-basic-percussion) (pdef :what-predef-chord))))
|
||||||
|
|
||||||
|
(setq *maybe-parallel* (ppar (list (pdef :what-basic-percussion) (pdef :what-predef-chord))))
|
||||||
|
;; (play *maybe-parallel*)
|
||||||
|
|
||||||
|
;; (play :maybe-parallel)
|
||||||
|
;; (stop :maybe-parallel)
|
||||||
|
|
||||||
|
;; ok, that is a bit interesting? there's additional beep in the beginning
|
||||||
|
|
||||||
|
;; yay. so, it did parallel.
|
||||||
|
;; how do I add pauses then?
|
||||||
|
|
||||||
|
(pb :what-symbols-percussion
|
||||||
|
:instrument :kik
|
||||||
|
:note 0
|
||||||
|
:embed (pcycles "oo-o-o--oo--o--o")
|
||||||
|
:dur 1
|
||||||
|
:play-quant 4)
|
||||||
|
|
||||||
|
;; (play :what-symbols-percussion)
|
||||||
|
;; (stop :what-symbols-percussion)
|
||||||
|
|
||||||
|
(pdef :better-parallel (ppar (list (pdef :what-symbols-percussion) (pdef :what-predef-chord))))
|
||||||
|
;; (play :better-parallel)
|
||||||
|
;; (stop :better-parallel)
|
||||||
|
|
||||||
|
;; well, I still don't understand the metering
|
||||||
|
;; but good enough for now. let's go looking for the better definitions of percussions?
|
||||||
|
|
||||||
|
;;; let's start with trying to get synthdefs from super-collider guide?
|
||||||
|
;; https://supercollider.github.io/examples
|
||||||
|
;;
|
||||||
|
;;
|
||||||
|
;; {
|
||||||
|
;; var snare, bdrum, hihat;
|
||||||
|
;; var tempo = 4;
|
||||||
|
;; tempo = Impulse.ar(tempo); // for a drunk drummer replace Impulse with Dust !!!
|
||||||
|
;; snare = WhiteNoise.ar(Decay2.ar(PulseDivider.ar(tempo, 4, 2), 0.005, 0.5));
|
||||||
|
;; bdrum = SinOsc.ar(Line.ar(120,60, 1), 0, Decay2.ar(PulseDivider.ar(tempo, 4, 0), 0.005, 0.5));
|
||||||
|
;; hihat = HPF.ar(WhiteNoise.ar(1), 10000) * Decay2.ar(tempo, 0.005, 0.5);
|
||||||
|
;; Out.ar(0, (snare + bdrum + hihat) * 0.4 ! 2)
|
||||||
|
;; }.play
|
||||||
|
|
||||||
|
(in-package #:cl-collider)
|
||||||
|
|
||||||
|
(defsynth tempo ()
|
||||||
|
(out.ar 0 (impulse.ar 4)))
|
||||||
|
;; (synth :tempo)
|
||||||
|
;; (stop)
|
||||||
|
;;
|
||||||
|
;; but is that multiple repeating
|
||||||
|
|
||||||
|
;; (defsynth kik ((freq 440) (out 0))
|
||||||
|
;; (let* ((env (env-gen.kr (env (list 0 1 0) (list 0.001 1)) :act :free))
|
||||||
|
;; (fenv (env-gen.kr (env (list 1 0) (list 0.25)) :level-scale freq))
|
||||||
|
;; (sig (sin-osc.ar fenv 0 0.2)))
|
||||||
|
;; (out.ar out (pan2.ar sig 0 env))))
|
||||||
|
;; ;; (synth :kik)
|
||||||
|
;;
|
||||||
|
;; and how would I add :free / end to the synth thingy
|
||||||
|
;;
|
||||||
|
;; let's try snare
|
||||||
|
;; WhiteNoise.ar(Decay2.ar(PulseDivider.ar(tempo, 4, 2), 0.005, 0.5));
|
||||||
|
(defsynth snare ()
|
||||||
|
(out.ar 0 (decay2.ar (pulse-divider.ar 4 4 2) 0.005 0.5))
|
||||||
|
;; (white-noise.ar (decay2.ar (pulse-divider.ar 4 4 2) 0.005 0.5))
|
||||||
|
)
|
||||||
|
;; (synth :snare)
|
||||||
|
;; (stop)
|
||||||
|
|
||||||
|
;;; let's try to figure out white noise
|
||||||
|
(defsynth wh-no ()
|
||||||
|
;; (out.ar 0 (white-noise.ar 1 1))
|
||||||
|
(out.ar 0 (white-noise.ar))
|
||||||
|
)
|
||||||
|
;; (synth :wh-no)
|
||||||
|
;; (stop)
|
||||||
|
;;
|
||||||
|
;; so, pulse-divider is a way to emit frequencies?
|
||||||
|
;; https://doc.sccode.org/Classes/PulseDivider.html
|
||||||
|
;;
|
||||||
|
;; now to decay
|
||||||
|
;; https://doc.sccode.org/Classes/Decay2.html
|
||||||
|
;;
|
||||||
|
;; still snare doesn't seem to work, even though I kind of understand it
|
||||||
|
;; maybe if I add it to pattern as instrument?
|
||||||
|
|
||||||
|
(in-package #:cl-patterns)
|
||||||
|
(all-instruments)
|
||||||
|
(pb :what-test-percussion
|
||||||
|
:instrument :wh-no
|
||||||
|
:note 0
|
||||||
|
:dur (pseq '(1 1 1 1 1) 1) ; ok, too hard again, want to finish something and go on
|
||||||
|
:play-quant 4)
|
||||||
|
|
||||||
|
;; (play :what-test-percussion)
|
||||||
|
;; (stop :what-test-percussion)
|
||||||
|
|
||||||
|
|
||||||
|
;; // since attack and decay are a difference of two Decays,
|
||||||
|
;; // swapping the values, the envelope turns upside down:
|
||||||
|
;; plot({ Decay2.ar(Impulse.ar(1), 0.001, 0.01) })
|
||||||
|
;; plot({ Decay2.ar(Impulse.ar(1), 0.01, 0.001) })
|
||||||
|
|
||||||
|
;; // used as an envelope
|
||||||
|
;; { Decay2.ar(Impulse.ar(XLine.kr(1,50,20), 0.25), 0.01, 0.2, FSinOsc.ar(600)) }.play;
|
||||||
|
|
||||||
|
;; // compare the above with Decay used as the envelope
|
||||||
|
;; { Decay.ar(Impulse.ar(XLine.kr(1,50,20), 0.25), 0.2, FSinOsc.ar(600), 0) }.play;
|
||||||
|
|
||||||
|
(in-package #:cl-collider)
|
||||||
|
(defsynth decay2 ()
|
||||||
|
(out.ar 0 (decay2.ar (impulse.ar (x-line.kr 1 50 20) 0.2 (sin-osc.ar 600) 0)))
|
||||||
|
;; (out.ar 0 (decay2.ar (impulse.ar (x-line.kr 1 50 20) 0.2 (sin-osc.ar 600) 0)))
|
||||||
|
;; (white-noise.ar (decay2.ar (pulse-divider.ar 4 4 2) 0.005 0.5))
|
||||||
|
)
|
||||||
|
;; (synth :decay2)
|
||||||
|
;; (stop)
|
||||||
|
|
||||||
|
;; bdrum = SinOsc.ar(Line.ar(120,60, 1), 0, Decay2.ar(PulseDivider.ar(tempo, 4, 0), 0.005, 0.5));
|
||||||
|
;; well, let's try this one?
|
||||||
|
|
||||||
|
(defsynth maybe-bdrum ()
|
||||||
|
(out.ar 0 (sin-osc.ar (line.ar 120 60 1) 0 (decay2.ar (pulse-divider.ar 4 4 4) 0.005 0.5)))
|
||||||
|
)
|
||||||
|
;; (synth :maybe-bdrum)
|
||||||
|
;; (stop)
|
|
@ -120,3 +120,86 @@ whoh
|
||||||
1. joining patterns in parallel - percussion + rythm + solo
|
1. joining patterns in parallel - percussion + rythm + solo
|
||||||
2. having 3 beats in percussion but aligning to 4 beats
|
2. having 3 beats in percussion but aligning to 4 beats
|
||||||
3. getting cool instruments from existing repos for supercollider
|
3. getting cool instruments from existing repos for supercollider
|
||||||
|
* [2022-08-21 Sun]
|
||||||
|
** now, I got another response!
|
||||||
|
Yes unfortunately it's not always easy to directly translate synthdefs from SC into cl-collider. Some of the UGens are named differently (i.e. SinOsc in SC is sin-osc in cl-collider). The UGens are defined in cl-collider with defugen though, so you could do a grep or similar on the library to get a list of the defined ugens.
|
||||||
|
Regarding the "attributes" you mention, do you mean the arguments for each ugen? If so, are you using Emacs or another editor? I believe Emacs should show the function signature in the echo area at the bottom of the screen if you're in the right package (i.e. you need to have an in-package form in your file)
|
||||||
|
If you have a specific synthdef you're having trouble translating, feel free to link me to it and I'll see if I can translate it for you as an example
|
||||||
|
Oh I see you do have an in-package in the example you posted. It might not be showing the function signature since you're doing in-package cl-patterns but the cl-patterns package doesn't include the UGens. so you might have to make a new package that :uses cl-patterns and cl-collider, so it has all the ugens as well as all the patterns.
|
||||||
|
efim
|
||||||
|
Apart from guidance on how to better translate SC definition of sync into DEFSYNTH attributes to get other instruments
|
||||||
|
|
||||||
|
could you help me understand how to join patterns?
|
||||||
|
|
||||||
|
I created two
|
||||||
|
|
||||||
|
(pb :what-predef-chord
|
||||||
|
:instrument :tone-pluck
|
||||||
|
:note (pseq (mapcar #'chord-notes (list (chord "Major Triad") (chord "Minor Triad") (chord "Minor 7th") (chord "Major 7th") (chord "Diminished Triad") (chord "Major Triad"))) 1)
|
||||||
|
:octave 4
|
||||||
|
:root 2
|
||||||
|
:dur (pseq '(2 2 4))
|
||||||
|
;; :play-quant 4
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
(pb :what-basic-percussion
|
||||||
|
:instrument :kik
|
||||||
|
:note 0
|
||||||
|
:dur (pseq '(1) 1)
|
||||||
|
:play-quant 4)
|
||||||
|
and wanted to join them to play in parallel as a pattern
|
||||||
|
|
||||||
|
and I think I'm getting lost in understanding types, what is pattern, what isn't
|
||||||
|
|
||||||
|
because there's an example for PPAR:
|
||||||
|
|
||||||
|
(next-upto-n (ppar (list (pbind :dur (pn 1/2 4))
|
||||||
|
(pbind :dur (pn 2/3 4)))))
|
||||||
|
but doing
|
||||||
|
(next-upto-n (ppar (list :what-basic-percussion :what-predef-chord)))
|
||||||
|
|
||||||
|
doesn't yield sound events
|
||||||
|
|
||||||
|
so maybe I can't reference patterns by name they get in PB ?
|
||||||
|
|
||||||
|
would I need to use PBIND to define both of previous patterns,
|
||||||
|
set them to some variables,
|
||||||
|
and then they could be used as subpatterns?
|
||||||
|
|
||||||
|
For now I already got tired with how much there is to learn,
|
||||||
|
I've set up "live recording" from (next-upto-n (ppar (list :what-basic-percussion :what-predef-chord)))
|
||||||
|
|
||||||
|
and celebrate initial success, theres 9 second pause in the beginning, but that's my first composition with so much to learn
|
||||||
|
|
||||||
|
next-upto-n won't play any sounds on its own, it's just used to get the resulting event objects from the patterns. You'd still need to call play on whatever pattern you define. So something like this could work:
|
||||||
|
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
4
|
||||||
|
(pdef :foo (ppar (list (pdef :what-predef-chord)
|
||||||
|
(pdef :what-basic-percussion))))
|
||||||
|
|
||||||
|
(play (pdef :foo))
|
||||||
|
Oh, I see what you meant. Yeah, it looks like ppar doesn't accept just the pattern names, so you would have to do this instead:
|
||||||
|
|
||||||
|
1
|
||||||
|
(next-upto-n (ppar (list (pdef :what-basic-percussion) (pdef :what-predef-chord))))
|
||||||
|
It probably should accept the pattern names directly though, so I will see about fixing that soon.
|
||||||
|
When you define a pattern like (pb :foo ...) it's basically the same as doing (pdef :foo (pbind ...)). So if you define a pattern with pb you can refer back to it with pdef later on.
|
||||||
|
Today
|
||||||
|
modula
|
||||||
|
efim
|
||||||
|
foo.aiff (4.74 MB)
|
||||||
|
very nice! definite good first steps, glad to hear you're making progress :)
|
||||||
|
it does take some learning but hopefully it will make more sense as you gain familiarity with it
|
||||||
|
I'm trying to make cl-patterns as intuitive as possible, but there are definitely some rough edges i don't notice until they're pointed out.
|
||||||
|
Oh, also, if you want to record a pattern, you might be interested in the render function. Basically you can do something like (render (pdef :your-pattern) "/path/to/output.wav" :dur 4) and it will save 4 beats of :your-pattern to /path/to/output.wav.
|
||||||
|
I'm not sure if that's what you were using for that recording, but it may be more convenient if you were using something else.
|
||||||
|
** ok, so let's search github for synthdef ?
|
||||||
|
** now I want to do what?
|
||||||
|
1. try out parallel
|
||||||
|
2. try to get precussion
|
||||||
|
3. also let's try to get defpackage and stuff
|
||||||
|
** so, let's copy yesterdays instruments and patterns and try to join them in parallel
|
||||||
|
|
Loading…
Reference in New Issue