# Hexadecimal/binary rhythmic scheme

## Note that

### “spread” example 3 in documentation

```
live_loop :euclid_beat do
sample :elec_bong, amp: 1.5 if (spread 3, 8).tick
sample :perc_snap, amp: 0.8 if (spread 7, 11).look
sample :bd_haus, amp: 2 if (spread 1, 4).look
sleep 0.125
end
```

## Binary rhythmic scheme

```
# Binary rhythmic scheme
def schr(num)
num.split(//).collect { |n| n == "1" }
end
live_loop :euclid_beat do
sample :elec_bong, amp: 1.5 if schr('10010010').ring.tick
sample :perc_snap, amp: 0.8 if schr('10101101101').ring.look
sample :bd_haus, amp: 2 if schr('1000').ring.look
sleep 0.125
end
```

## Hexadecimal/binary rhythmic scheme

More efficient but less flexible because I made the choice to keep 4 bits for 1 hexadecimal.

0=0000, 1=0001, 2=0010, 3=0011

4=0100, 5=0101, 6=0110, 7=0111

8=1000, 9=1001, a=1010, b=1011

c=1100, d=1101, e=1110, f=1111

```
# Binary rhythmic scheme
def schr(num)
num.split(//).collect { |n| n == "1" }
end
# hexadecimal/binary rhythmic scheme
# 0=0000, 1=0001, 2=0010, 3=0011
# 4=0100, 5=0101, 6=0110, 7=0111
# 8=1000, 9=1001, a=1010, b=1011
# c=1100, d=1101, e=1110, f=1111
def schr2(num)
num.hex.to_s(2).rjust(num.size*4, '0').split(//).collect { |n| n == "1" }
end
live_loop :euclid_beat do
sample :elec_bong, amp: 1.5 if schr2('92').ring.tick
sample :perc_snap, amp: 0.8 if schr('10101101101').ring.look # 11 bits, not possible in hex because I made the choice to keep 4 bits for 1 hexadecimal
sample :bd_haus, amp: 2 if schr2('8').ring.look
sleep 0.125
end
```