Amp values .tick off from an array?

I’m trying to make some generative music that’ll only generate a new pattern every 8 bars. My solution was working until I tried to add the ability to generate whether a note played or not by using an array to give amp values.

For some reason, while the code didn’t totally cease to function when I added the amp array, it now only repeats the first 4 notes in the loop. Any idea what happened or how to fix it?

(also I’m guessing my solution is a bit clumsy with the 64.times do and all that but I wasn’t getting any kind of set/get system to work, so lemme know if you’ve solved this whole thing in a different way)

use_bpm 400

define :basslineMaker do
#note chooser
a = [24,26,28,29,31,33,35,
36,38,40,41,43,45,47,
48,50,52,53,55,57,59]
b=a.choose
c=a.choose
d=a.choose
e=a.choose
f=a.choose
g=a.choose
h=a.choose
i=a.choose
bassline=[b,c,d,e,f,g,h,i]

#note on or off
j=[1,1,1,0,0].choose
k=[1,1,1,0,0].choose
l=[1,1,1,0,0].choose
m=[1,1,1,0,0].choose
n=[1,1,1,0,0].choose
o=[1,1,1,0,0].choose
p=[1,1,1,0,0].choose
q=[1,1,1,0,0].choose
amperage=[j,k,l,m,n,o,p,q]

64.times do
x=bassline.tick
y=amperage.tick
use_synth :blade
play x, amp:y
use_synth :beep
play x, amp: y
sleep 1
end
end

live_loop :bassPlayer do
basslineMaker
end

Thanks! Thanks! Thanks!

1 Like

whoops, I just had to name my ticks, like so, replacing lines 33 and 34:

x=bassline.tick(:ticka)
y=amperage.tick(:tickb)

well I’m gonna leave this thread up just in case someone has a similar problem or if anyone reads this and has ideas for making my looping system more elegant or flexible.

1 Like

Hi Matey,

Forgive me, my coding is not the greatest, but… ?

Eli…

use_bpm 400

live_loop :blah do
  
  baseline = [24,26,28,29,31,33,35,
              36,38,40,41,43,45,47,
              48,50,52,53,55,57,59].pick(64)
  
  volume = [1,1,1,0,0].pick(64)
  
  64.times do
    use_synth :blade
    play baseline.tick, amp: volume.look
    use_synth :beep
    play baseline.look, amp: volume.look
    sleep 1
  end
end

If I was making a bassline for myself, I’d prefer
the :fm synth… far more funky! :slight_smile:

use_bpm 400

live_loop :blah do
  
  baseline = [24,26,28,29,31,33,35,
              36,38,40,41,43,45,47,
              48,50,52,53,55,57,59].pick(64)
  
  volume = [1,1,1,0,0].pick(64)
  
  64.times do
    use_synth :fm
    play baseline.tick, amp: volume.look
    sleep 1
  end
end

I didn’t know about .pick, which definitely might come in handy, but If you play my code, you’ll hear that it plays an 8 beat loop 8 times and then generates another 8 beat loop and plays that 8 times, and on and on, which is what I wanted. Yours doesn’t do that.

Thats okay… rewrite it to suit your own needs, it’s only an example.

Eli…