Trying to create a new loop syntax

48 views
Skip to first unread message

Eric Clack

unread,
Jan 13, 2019, 9:32:52 AM1/13/19
to Overtone
Hi all, 
I'm trying to create a simple loop syntax for Overtone so that I don't need to use all of the `at` functions to schedule beats. But also to help me learn more about Clojure, Overtone and SupperCollider. 

You can see how far I've got here: https://github.com/ericclack/overtone-loops

Because I'm new to much of this I'd appreciate any feedback or suggestions. 

My current challenge is to think through how to do fractional beats, two alternative syntaxes are:

;;              beats  instr 1       2       3         4
(defloop kicks
(4 1/2) kick [0.7  0  0.2  0  0.7  0.6  0.2 0 ])

Here (4 1/2) means 4 beats in a bar and amp vales are half beats.

Alternatively:

;;                      1   2    3        4
(defloop kicks 4 kick [ 0.7 0.2 (0.7 0.6) 0.2 ])

Here the (0.7 0.6) means play two kicks within beat 3 (as half beats).

Does that make sense? Which would you prefer to use?

You can see the full examples on GitHub branches:

Cheers, 
-Eric.

joa...@verona.se

unread,
Jan 13, 2019, 11:10:26 AM1/13/19
to 'Eric Clack' via Overtone
"'Eric Clack' via Overtone" <over...@googlegroups.com> writes:

> Hi all,
> I'm trying to create a simple loop syntax for Overtone so that I don't need to use all of the `at` functions to schedule beats. But also to help me learn more about Clojure,
> Overtone and SupperCollider.
>
> You can see how far I've got here: https://github.com/ericclack/overtone-loops
>
> Because I'm new to much of this I'd appreciate any feedback or suggestions.
>
> My current challenge is to think through how to do fractional beats, two alternative syntaxes are:
>
> ;; beats instr 1 2 3 4
> (defloop kicks (4 1/2) kick [0.7 0 0.2 0 0.7 0.6 0.2 0 ])
>
> Here (4 1/2) means 4 beats in a bar and amp vales are half beats.
>
> Alternatively:
>
> ;; 1 2 3 4
> (defloop kicks 4 kick [ 0.7 0.2 (0.7 0.6) 0.2 ])
>
> Here the (0.7 0.6) means play two kicks within beat 3 (as half beats).
>
> Does that make sense? Which would you prefer to use?

I think it will be interesting to see where your approach leads.

In my sequencer, each voice can have its own tempo.
The :il means interleave, or how many beats are intersperced between the
events. But the setting in my case is for all events in the
sub-sequence, not like you do it, so again, it will be nice to see how
your approach pans out!

For instance:

(seq/set-metro :bpm 200)

(seq/set-beat {
:B '[x - ]
:F '[x - - -]
:H '[c o c o]
:BL '[:g2 :g2 :d2 :g2 :a2 :g2 :d2 :b2 :a#2 :a#2 :a#2 :a#2 :a#2 :a#2 :a#2 :a#2]
{:voice :B :id 3} '[o - ]
{:voice :B :il 5 :id 0} '[c o ]
{:voice :B :il 3 :id 1} '[c o ]

})

These are the voices, but they arent important for this discussion.

(seq/set-drums {
:B (fn [x]
(cond
(= 'c x)(electro-kick)
(= 'o x) (dance-kick)
:else (do (electro-kick) (dance-kick)))
)
:H (fn [x] (cond
(= 'c x)(electro-hat)
(= 'o x)(open-hat :amp 1 :t 0.1 :low 10000 :hi 2000 )
:else (open-hat)))
:BL (fn [x] (tsts (* 1 (midi->hz(note x))) ))
:C (fn [x] (electro-clap))
:F (fn [x] (seq/play-once (choose [{:H '[c c c o]}
{:H '[c - c -]}
{:H '[c c c c]}
])))
--
Joakim Verona
joa...@verona.se

Eric Clack

unread,
Jan 16, 2019, 11:15:53 AM1/16/19
to Overtone
This is interesting, I can see how you set up the beats and channels for each voice. How do you actually schedule your beats? I assume that's in your seq package?

I also found this for Haskel, which has beats and sub-beats using sub-lists,

-Eric.

joa...@verona.se

unread,
Jan 16, 2019, 12:28:23 PM1/16/19
to 'Eric Clack' via Overtone
"'Eric Clack' via Overtone" <over...@googlegroups.com> writes:

> This is interesting, I can see how you set up the beats and channels for each voice. How do you actually schedule your beats? I assume that's in your seq package?

https://gitlab.com/jave/overtone-sylt/blob/master/sylt-docker/sylt/src/insane_noises/seq.clj

Looking at the code it seems rather messy, I guess. It's fun to play
with it though.

I guess seq and overtone_loops have some similarities, and maybe its
possible to find something common between them, that can become a shared
dependency. I dont mind throwing away code of mine that is better
maintained elsewhere, for instance.

>
> I also found this for Haskel, which has beats and sub-beats using sub-lists,
> https://tidalcycles.org/index.php/Tutorial

Thanks!
--
Joakim Verona
joa...@verona.se
Reply all
Reply to author
Forward
0 new messages