# Sonic Pi Monthly Challenge #4

**URL:** <https://in-thread.sonic-pi.net/t/sonic-pi-monthly-challenge-4/4897>\
**Category:** Creations & Ideas\
**Created:** [January 1, 2021, 12:24pm UTC](https://in-thread.sonic-pi.net/t/sonic-pi-monthly-challenge-4/4897 "2021-01-01T12:24:52Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![binarysweets](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/binarysweets/32/2683_2.png) [@binarysweets](https://in-thread.sonic-pi.net/u/binarysweets)\
**Post date:** [January 1, 2021, 12:24pm UTC](https://in-thread.sonic-pi.net/t/sonic-pi-monthly-challenge-4/4897/1 "2021-01-01T12:24:52Z")

</div>

Dear Sonic Pi’ers,

It is time for a new year, and a new challenge – #4.

This months challenge is: Text \> binary \> music.

Instructions:

1. Choose a word, name or short phrase of text and convert it into binary code by using this website:  
[Text to Binary Converter](https://www.rapidtables.com/convert/number/ascii-to-binary.html)

2. Take the converted binary code and use it to create a piece of music or live performance (using rings, bools, arrays, etc). Each loop should use a new word, name, phrase or part of the original converted binary code.  
You may use the built-in synths and samples or use external samples; it’s up to you.  
The length and genre is also up to you.

3. Post the code and audio links (Youtube/Soundcloud) into this topic.  
Tell us what text you started with for each loop, and a little about your creative process.

**The deadline for this challenge is 31st January.**

Code and audio links will get added to the [challenge repo](https://github.com/binarysweets/sonic-pi-monthly-challenge/)

https://w.soundcloud.com/player/?visual=false&url=https%3A%2F%2Fapi.soundcloud.com%2Fplaylists%2F1194571906&show_artwork=true

[![](https://img.youtube.com/vi/I0qjATZtWGc/maxresdefault.jpg "Giuliano in Binary") ](https://www.youtube.com/watch?v=I0qjATZtWGc)

Happy coding 💻

---

<div class="post-metadata">

**Author:** ![ethancrawford](https://avatars.discourse-cdn.com/v4/letter/e/a88e4f/32.png) [@ethancrawford](https://in-thread.sonic-pi.net/u/ethancrawford)\
**Post date:** [January 2, 2021, 1:44am UTC](https://in-thread.sonic-pi.net/t/sonic-pi-monthly-challenge-4/4897/2 "2021-01-02T01:44:47Z")

</div>

Looking forward to this!

[![](https://media.giphy.com/media/g0JP0HG6zF0o8/giphy.gif) ](https://media.giphy.com/media/g0JP0HG6zF0o8/giphy.gif)

---

<div class="post-metadata">

**Author:** ![hitsware](https://avatars.discourse-cdn.com/v4/letter/h/a9adbd/32.png) [@hitsware](https://in-thread.sonic-pi.net/u/hitsware)\
**Post date:** [January 7, 2021, 1:03am UTC](https://in-thread.sonic-pi.net/t/sonic-pi-monthly-challenge-4/4897/3 "2021-01-07T01:03:17Z")

</div>

```ruby
# phrase = " 633844564954959411211212"
# returns :
# 00110110 00110011 00110011 00111000
# 00110100 00110100 00110101 00110110
# 00110100 00111001 00110101 00110100
# 00111001 00110101 00111001 00110100
# 00110001 00110001 00110010 00110001
# 00110001 00110010 00110001 00110010

a=["00110110"," 00110011"," 00110011"," 00111000",
   "00110100"," 00110100"," 00110101"," 00110110"]
b=["00110100"," 00111001"," 00110101"," 00110100",
   "00111001"," 00110101"," 00111001"," 00110100"]
c=["00110001"," 00110001"," 00110010"," 00110001",
   "00110001"," 00110010"," 00110001"," 00110010"]

for x in 0..7
  ma=a[x].to_i(2)-48
  mb=b[x].to_i(2)-48
  mc=c[x].to_i(2)-48
  puts ma*mb*mc*11
  play hz_to_midi (ma*mb*mc*11)
  sleep 0.5
end
```

---

<div class="post-metadata">

**Author:** ![binarysweets](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/binarysweets/32/2683_2.png) [@binarysweets](https://in-thread.sonic-pi.net/u/binarysweets)\
**Post date:** [January 7, 2021, 8:09pm UTC](https://in-thread.sonic-pi.net/t/sonic-pi-monthly-challenge-4/4897/4 "2021-01-07T20:09:25Z")

</div>

I like how you did that.

---

<div class="post-metadata">

**Author:** ![hitsware](https://avatars.discourse-cdn.com/v4/letter/h/a9adbd/32.png) [@hitsware](https://in-thread.sonic-pi.net/u/hitsware)\
**Post date:** [January 8, 2021, 4:23pm UTC](https://in-thread.sonic-pi.net/t/sonic-pi-monthly-challenge-4/4897/5 "2021-01-08T16:23:09Z")

</div>

Thank You …  
By the seat of my pants …

---

<div class="post-metadata">

**Author:** ![binarysweets](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/binarysweets/32/2683_2.png) [@binarysweets](https://in-thread.sonic-pi.net/u/binarysweets)\
**Post date:** [January 8, 2021, 5:00pm UTC](https://in-thread.sonic-pi.net/t/sonic-pi-monthly-challenge-4/4897/6 "2021-01-08T17:00:09Z")

</div>

Here is my Covid-19 themed attempt for this challenge 😀  
The idea behind the lead is to sound like I’m playing around on a keyboard, not sure it works…

https://w.soundcloud.com/player/?visual=false&url=https%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F961888651&show_artwork=true&maxheight=166

```ruby
# Sonic Pi Challenge #4 - Text > Binary > Music
# Coded by Binarysweets, Jan 2021
# Sonic Pi v3.2.2 (Win10)

# Settings
use_bpm 150
use_tuning :meantone
use_random_seed 20210107
mode = :augmented
scl = scale(:a1, mode, num_octaves: 4)
swing = (ring 0.05,-0.05)

# Loops
live_loop :metronome do
  sleep 1
end

live_loop :lead, sync: :metronome do ; tick
  # COVID-19
  steps = [0,1,0,0,0,0,1,1, 0,1,0,0,1,1,1,1, 0,1,0,1,0,1,1,0, 0,1,0,0,1,0,0,1,
           0,1,0,0,0,1,0,0, 0,0,1,0,1,1,0,1, 0,0,1,1,0,0,0,1, 0,0,1,1,1,0,0,1].ring.reverse
  notes = [12,15,15,15, 12,15,15,15, 14,15,16,17, 18,19,20,21, 22,23,24,25,
           21,14,14,7, 9,10].ring.mirror
  
  with_fx :echo, mix: 0.1 do
    with_fx :bitcrusher, bits: 8, sample_rate: [10000,1000].choose do
      with_synth :tri do
        play scl[notes.tick(:n)],
          amp: 0.6,
          pan: [0.2,-0.2].choose,
          attack: 0,
          sustain: ((ring 0.125,0.25,0.5).repeat(8)+(ring 2)).tick(:s),
          decay: 0,
          release: 0.125 if steps.look > 0
      end
    end
  end
  
  sleep 0.25 + swing.look
end

live_loop :chords, sync: :metronome do ; tick
  # NHS
  steps = [0,1,0,0,1,1,1,0, 0,1,0,0,1,0,0,0, 0,1,0,1,0,0,1,1].ring.reverse
  notes = (ring 6,8,9).reflect.repeat(2)+(ring 10,10,9)
  
  with_fx :bitcrusher, bits: 8, sample_rate: [10000,1000].choose do
    with_synth :tri do
      play (chord scl[notes.tick(:n)], 'm+5'),
        amp: 0.7,
        pan: -0.2,
        attack: 0,
        sustain: steps.look,
        decay: 0,
        release: 3 if steps.look > 0
    end
  end
  
  sleep 2 + swing.look
end

live_loop :bass, sync: :metronome do ; tick
  # Mask
  steps = [0,1,0,0,1,1,0,1, 0,1,1,0,0,0,0,1,
           0,1,1,1,0,0,1,1, 0,1,1,0,1,0,1,1]
  notes = (ring 1,3,2,4)
  
  with_synth :tri do
    play scl[notes.tick(:n)],
      amp: 0.3,
      attack: 0,
      sustain: 2,
      release: 0 if steps.look > 0
  end
  
  sleep 2 + swing.look
end

live_loop :percussion, sync: :metronome do ; tick
  # Lockdown
  steps = [0,1,0,0,1,1,0,0, 0,1,1,0,1,1,1,1, 0,1,1,0,0,0,1,1, 0,1,1,0,1,0,1,1,
           0,1,1,0,0,1,0,0, 0,1,1,0,1,1,1,1, 0,1,1,1,0,1,1,1, 0,1,1,0,1,1,1,0]
  
  with_fx :hpf, cutoff: (line 90, 80, steps: 64).mirror.look do
    with_fx :ping_pong do
      with_synth :cnoise do
        play :c4,
          amp: 1,
          attack: 0,
          sustain: 0.125,
          decay: 0,
          release: 0 if steps.look > 0
      end
    end
  end
  sleep 0.5 + swing.look
end

live_loop :vaccine, sync: :metronome do ; tick
  stop
  # Vaccine
  steps = [0,1,0,1,0,1,1,0, 0,1,1,0,0,0,0,1, 0,1,1,0,0,0,1,1, 0,1,1,0,0,0,1,1,
           0,1,1,0,1,0,0,1, 0,1,1,0,1,1,1,0, 0,1,1,0,0,1,0,1].ring.reverse
  notes = (ring 12,13,14,15)
  
  with_fx :bitcrusher, bits: 8, sample_rate: (line 500, 100, steps: 128).look do
    with_synth :tri do
      play scl[notes.tick(:n)],
        amp: 0.5,
        pan: (ring -0.5,-0.4,-0.3,-0.2, 0.2,0.3,0.4,0.5).mirror.tick(:p),
        attack: 0,
        sustain: (ring 0.75,0.75,0.75,0.5).tick(:s),
        release: 0.125 if steps.look > 0
    end
  end
  
  sleep 0.25 + swing.look
end

live_loop :beats, sync: :metronome do ; tick
  sample :bd_ada, amp: 1.2
  
  sleep 1 + swing.look
end
```

---

<div class="post-metadata">

**Author:** ![robin.newman](https://avatars.discourse-cdn.com/v4/letter/r/76d3ee/32.png) [@robin.newman](https://in-thread.sonic-pi.net/u/robin.newman)\
**Post date:** [January 12, 2021, 4:20pm UTC](https://in-thread.sonic-pi.net/t/sonic-pi-monthly-challenge-4/4897/7 "2021-01-12T16:20:43Z")

</div>

Here is my entry for this challenge. I decided not to use the website to generate the bianry string, but to do that within sonic pi itself. It makes it easy to update and try other strings.  
I also liked the recent post by @theibbster for a [chord progression tool](https://in-thread.sonic-pi.net/t/chord-progression-tool/4947) which I developed and used in my code.  
EDIT just noticed a couple of glitches in the soundcloud file. I won’t update it, but if you play the SP code it should sound correct.

You can hear the result on soundcloud, with the code link below

https://w.soundcloud.com/player/?visual=false&url=https%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F964257646&show_artwork=true&maxheight=166

> <https://gist.github.com/rbnpi/0e742a8ff0f1de49dae87fe6a28de15e>

---

<div class="post-metadata">

**Author:** ![Automageddon](https://avatars.discourse-cdn.com/v4/letter/a/8e8cbc/32.png) [@Automageddon](https://in-thread.sonic-pi.net/u/Automageddon)\
**Post date:** [January 12, 2021, 8:15pm UTC](https://in-thread.sonic-pi.net/t/sonic-pi-monthly-challenge-4/4897/8 "2021-01-12T20:15:02Z")

</div>

Here’s my entry, which is also my first live coding. Still veeery rough around the edges and overly simple…

[![](https://img.youtube.com/vi/I0qjATZtWGc/maxresdefault.jpg "Giuliano in Binary") ](https://www.youtube.com/watch?v=I0qjATZtWGc)

Code below, I took my cat’s name which is conveniently 8 letters long, turned it into binary, wrote some functions and played them back live…

```ruby
# Word is Giuliano
# 01000111 01101001 01110101 01101100 01101001 01100001 01101110 01101111

use_bpm 139
use_debug false
#Metronome 16th
in_thread do
  live_loop :metronome do
    cue :tick
    sleep 0.25
  end
end

#Metronome 8th
in_thread do
  live_loop :metronomeSlow do
    cue :tickHalf
    sleep 0.50
  end
end

#Variables

loop1 = [0,1,0,0,0,1,1,1,0,1,1,0,1,0,0,1]
loop2 = [0,1,1,1,0,1,0,1,0,1,1,0,1,1,0,0]
loop3 = [0,1,1,0,1,0,0,1,0,1,1,0,0,0,0,1]
loop4 = [0,1,1,0,1,1,1,0,0,1,1,0,1,1,1,1]

#Kick heavy
define :kick do
  with_fx :distortion do
    sample :bd_mehackit, mix: 0.6, distort: 0.5, amp: 0.7
  end
end

#Kick light
define :kicklight do
  sample :bd_mehackit, amp: 0.3
end

#KickGroove half
define :kicks do |n|
  live_loop :kick do
    16.times do |i|
      sync :tickHalf if n == 1
      sync :tick if n == 2
      stop if n == 0
      kick if loop1[i] == 0
      kicklight if loop1[i]== 1
    end
  end
end

#GlitchSound
define :glitch do
  with_fx :reverb do
    sample :glitch_perc4, amp: 0.7, pan: rrand(-0.25, 0.25), start: rrand(0, 0.5), sustain: rrand(0.1, 0.4), room: 7, rate: [-2, 1, 3].choose
  end
end

#Glitch groove
define :glitches do |n|
  live_loop :chh do
    rrand_i(4, 16).times do |i|
      sync :tick if n == 1
      stop if n == 0
      glitch if loop2 [i] == 1
    end
  end
end

#Bass Sound
define :bass do
  with_fx :bitcrusher do
    sample :bass_hard_c, amp: 0.2, attack: 0.5, release: 0.5
  end
end

#Bass groove
define :bass1 do |n|
  live_loop :bassline1 do
    16.times do |i|
      sync :tick if n == 1
      stop if n == 0
      bass if loop3 [i] == 0 if one_in (2)
    end
  end
end

#Bass SoundShort
define :bassShort do
  sample :bass_hit_c, amp: 1, pitch: +3
end

#Bass groove
define :bass2 do |n|
  live_loop :bassline2 do
    16.times do |i|
      sync :tick if n == 1
      stop if n == 0
      bassShort if loop4 [i] == 1
    end
  end
end

#Lead sound
define :lead do
  with_fx :reverb do
    with_fx :wobble do
      sample :loop_electric, start: rrand(0.1, 0.6), pitch: [1, 3, 5, -3].choose, amp: 1, attack: 0.25, sustain: 0, release: 0.25
    end
  end
end

#Lead synth
define :leads do |n|
  live_loop :lead do
    16.times do |i|
      sync :tick if n ==1
      stop if n ==0
      lead if loop4 [i] == 0
    end
  end
end

#kicks 1== slow; 2== fast; 0== stop
#glitches 0= stop; 1 play
#bass1 0= stop; 1 play
#bass2 0= stop; 1 play
#leads 0= stop; 1 play
#
### set the 0 below to 1 to play that pattern
bass2 0
glitches 0
kicks 0
bass1 0
leads 0

```

---

<div class="post-metadata">

**Author:** ![binarysweets](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/binarysweets/32/2683_2.png) [@binarysweets](https://in-thread.sonic-pi.net/u/binarysweets)\
**Post date:** [January 14, 2021, 11:40am UTC](https://in-thread.sonic-pi.net/t/sonic-pi-monthly-challenge-4/4897/9 "2021-01-14T11:40:21Z")

</div>

Great for your first attempt 👍

---

<div class="post-metadata">

**Author:** ![binarysweets](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/binarysweets/32/2683_2.png) [@binarysweets](https://in-thread.sonic-pi.net/u/binarysweets)\
**Post date:** [January 17, 2021, 8:47pm UTC](https://in-thread.sonic-pi.net/t/sonic-pi-monthly-challenge-4/4897/10 "2021-01-17T20:47:36Z")

</div>

Just two weeks left for this one.  
Thank you to those who have submitted already 🙂

---

<div class="post-metadata">

**Author:** ![Monrhea](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/monrhea/32/1604_2.png) [@Monrhea](https://in-thread.sonic-pi.net/u/Monrhea)\
**Post date:** [January 18, 2021, 8:22pm UTC](https://in-thread.sonic-pi.net/t/sonic-pi-monthly-challenge-4/4897/11 "2021-01-18T20:22:47Z")

</div>

Hi, this is nice : ) simple but complex 😃

---

<div class="post-metadata">

**Author:** ![Automageddon](https://avatars.discourse-cdn.com/v4/letter/a/8e8cbc/32.png) [@Automageddon](https://in-thread.sonic-pi.net/u/Automageddon)\
**Post date:** [January 18, 2021, 11:05pm UTC](https://in-thread.sonic-pi.net/t/sonic-pi-monthly-challenge-4/4897/12 "2021-01-18T23:05:23Z")

</div>

Thanks!  
I would like to add a ‘master effect’ next, like a cutoff sweep for a transition, but I still haven’t looked into master effects…

---

<div class="post-metadata">

**Author:** ![stahnirockt](https://avatars.discourse-cdn.com/v4/letter/s/45deac/32.png) [@stahnirockt](https://in-thread.sonic-pi.net/u/stahnirockt)\
**Post date:** [January 19, 2021, 7:13pm UTC](https://in-thread.sonic-pi.net/t/sonic-pi-monthly-challenge-4/4897/13 "2021-01-19T19:13:27Z")

</div>

```ruby
# We love Sankt Pauli - we do!
# Sonic Pi Challange Number 4

live_loop :progressionLoop do
  tick(:proTick)
  $a_chord = ring(chord(:D, :maj), chord(:b, :min), chord(:G, :maj), chord(:A, :maj)).tick
  $bar = look(:proTick)
  puts $bar
  sleep 4
end

live_loop :beat_quater do
  tick(:beat_tick)
  #stop
  #we 01110111 01100101
  if $bar >= 4 and $bar <21
    sample :bd_haus if bools(0,1,1,1,0,1,1,1,0,1,1,0,0,1,0,1).reverse.look(:beat_tick)
  end
  #love 01101100 01101111 01110110 01100101
  if $bar >= 4 and $bar <31
    sample :drum_cymbal_closed if bools(0,1,1,0,1,1,0,0,0,1,1,0,1,1,1,1,0,1,1,1,0,1,1,0,0,1,1,0,0,1,0,1).look(:beat_tick)
  end
  if $bar >= 4 and $bar <21
    sample :bd_tek, pan: 0.25 if bools(0,1,0,0,0,0,1,1).reverse.look(:beat_tick)
  end
  #F 01000110 (0,1,0,0,0,1,1,0)
  #C 01000011 (0,1,0,0,0,0,1,1)
  #S 01010011 (0,1,0,1,0,0,1,1)
  #sample :drum_snare_soft if bools(0,1,0,1,0,0,1,1).look(:beat_tick)
  #P 01010000 (0,1,0,1,0,0,1,1)
  sleep 0.25
end

live_loop :beat_full do
  tick(:b_full)
  sample :bd_mehackit if bools(1,1,1,1,1,1,0,1).look(:b_full) if $bar >= 1 and $bar <33
  #Sankt 01010011 01100001 01101110 01101011 01110100
  with_fx :pan, pan: 0.5 do
    with_fx :slicer, phase: 0.75, pulse_width: 0.75 do
      with_fx :bitcrusher, bits: 32, sample_rate: 15000, cutoff: 100 do
        sample :elec_blip, rate: 0.125, amp: 10 if bools(0,1,0,1,0,0,1,1,0,1,1,0,0,0,0,1,0,1,1,0,1,1,1,0,0,1,1,0,1,0,1,1,0,1,1,1,0,1,0,0).look(:b_full) if $bar < 4 or ($bar >= 24 and $bar < 33)
      end
    end
  end
  #F 01000110 (0,1,0,0,0,1,1,0)
  #C 01000011 (0,1,0,0,0,0,1,1)
  #S 01010011 (0,1,0,1,0,0,1,1)
  sample :drum_snare_soft if bools(0,1,0,1,0,0,1,1).rotate(1).look(:b_full) if $bar >= 2 and $bar <33
  #P 01010000 (0,1,0,1,0,0,1,1)
  sleep 0.5
end

live_loop :beat_eights do
  #stop
  #Pauli 01010000 01100001 01110101 01101100 01101001
  if $bar >= 6 and $bar <25
    sample :drum_cymbal_closed if bools(0,1,0,1,0,0,0,0,0,1,1,0,0,0,0,1,0,1,1,1,0,1,0,1,0,1,1,0,1,1,0,0,0,1,1,0,1,0,0,1).tick(:b_eights)
  end
  sleep 0.125
end

live_loop :bass do
  with_random_seed 1910 do
    #we 01110111 01100101
    16.times do
      if bools(0,1,1,1,0,1,1,1,0,1,1,0,0,1,0,1).reverse.rotate(2).tick(:bs_tick)
        with_fx :reverb, room: 0.25, mix: 0.3 do
          synth :fm, note: $a_chord.choose+[-24,-24,-12,-24].choose, release: 0.2, amp: 3 if $bar >= 4 and $bar <25
        end
      end
      sleep 0.125
    end
  end
end

live_loop :melody do
  #stop
  if $bar >= 8 and $bar <21
    with_fx :ixi_techno, cutoff_max: 110, cutoff_min: 90, res: 0.7, phase: 0.75 do
      64.times do
        tick(:mel_tick)
        synth :pluck, release: 0.5, amp: 2, note: $a_chord[0] if bools(0,1,1,1,0,1,1,1,0,1,1,0,0,1,0,1).reverse.look(:mel_tick)
        synth :pluck, release: 0.5, amp: 2, note: $a_chord[1] if bools(0,1,1,0,1,1,0,0,0,1,1,0,1,1,1,1,0,1,1,1,0,1,1,0,0,1,1,0,0,1,0,1).rotate(1).look(:mel_tick)
        synth :pluck, release: 0.5, amp: 2, note: $a_chord[2] if bools(0,1,0,1,0,0,1,1,0,1,1,0,0,0,0,1,0,1,1,0,1,1,1,0,0,1,1,0,1,0,1,1,0,1,1,1,0,1,0,0).look(:mel_tick)
        #synth :pluck, release: 0.5, amp: 2, note: $a_chord[3] if bools(0,1,0,1,0,0,0,0,0,1,1,0,0,0,0,1,0,1,1,1,0,1,0,1,0,1,1,0,1,1,0,0,0,1,1,0,1,0,0,1).look(:mel_tick)
        sleep 0.25
      end
      8.times do
        with_fx :ping_pong, phase: 0.75 do
          synth :pluck, sustain: 1.5, amp: 4, note: $a_chord[0]
          synth :pluck, sustain: 1.5, amp: 4, note: $a_chord[1]
          synth :pluck, sustain: 1.5, amp: 4, note: $a_chord[2]
          synth :pluck, sustain: 1.5, amp: 4, note: $a_chord[3]
          sleep 1
        end
      end
      128.times do
        tick(:mel_tick)
        synth :pluck, release: 0.5, amp: 2, note: $a_chord[0] if bools(0,1,1,1,0,1,1,1,0,1,1,0,0,1,0,1).reverse.look(:mel_tick)
        synth :pluck, release: 0.5, amp: 2, note: $a_chord[1] if bools(0,1,1,0,1,1,0,0,0,1,1,0,1,1,1,1,0,1,1,1,0,1,1,0,0,1,1,0,0,1,0,1).rotate(1).look(:mel_tick)
        synth :pluck, release: 0.5, amp: 2, note: $a_chord[2] if bools(0,1,0,1,0,0,1,1,0,1,1,0,0,0,0,1,0,1,1,0,1,1,1,0,0,1,1,0,1,0,1,1,0,1,1,1,0,1,0,0).look(:mel_tick)
        synth :pluck, release: 0.5, amp: 2, note: $a_chord[3] if bools(0,1,0,1,0,0,0,0,0,1,1,0,0,0,0,1,0,1,1,1,0,1,0,1,0,1,1,0,1,1,0,0,0,1,1,0,1,0,0,1).look(:mel_tick)
        sleep 0.125
      end
      8.times do
        with_fx :ping_pong, phase: 0.75 do
          synth :pluck, sustain: 1.5, amp: 4, note: $a_chord[0]
          synth :pluck, sustain: 1.5, amp: 4, note: $a_chord[1]
          synth :pluck, sustain: 1.5, amp: 4, note: $a_chord[2]
          synth :pluck, sustain: 1.5, amp: 4, note: $a_chord[3]
          sleep 1
        end
      end
    end
  else
    sleep 1
  end
end

```

Here is my idea.  
And I know using global variables is not good, but if I use set and get its not in time. But this is a topic for another post.

---

<div class="post-metadata">

**Author:** ![Eli](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/eli/32/116_2.png) [@Eli](https://in-thread.sonic-pi.net/u/Eli)\
**Post date:** [January 19, 2021, 7:30pm UTC](https://in-thread.sonic-pi.net/t/sonic-pi-monthly-challenge-4/4897/14 "2021-01-19T19:30:43Z")

</div>

This is a very nice ‘framework’ for controlling active loops…  
I think I’m going to be using it (or similar) in some of my  
future twiddlings.

Eli…

---

<div class="post-metadata">

**Author:** ![bitkids](https://avatars.discourse-cdn.com/v4/letter/b/dbc845/32.png) [@bitkids](https://in-thread.sonic-pi.net/u/bitkids)\
**Post date:** [January 26, 2021, 10:08pm UTC](https://in-thread.sonic-pi.net/t/sonic-pi-monthly-challenge-4/4897/15 "2021-01-26T22:08:35Z")

</div>

Hi !  
I arranged it a little because Automageddon’s code and sound was great.  
Changed following point.

1. words
2. slow down bpm
3. add some phrases

played here  
[https://twitter.com/BitkidsS/status/1354074112369455104](https://twitter.com/BitkidsS/status/1354074112369455104)

# 

```
# Doggy naps
# 01000100 01101111 01100111 01100111 01111001 00100000 01101110 01100001 01110000 01110011

#Variables
loop1 = [0,1,0,0,0,1,0,0,0,1,1,0,1,1,1,1]
loop2 = [0,1,1,0,0,1,1,1,0,1,1,0,0,1,1,0]
loop3 = [0,1,1,1,1,0,0,1,0,0,1,0,0,0,0,0]
loop4 = [0,1,1,0,1,1,1,0,0,1,1,0,0,0,0,1]
loop5 = [0,1,1,1,0,0,0,0,0,1,1,1,0,0,1,1]

use_bpm 110
use_debug false

in_thread do
  live_loop :metronome do
    cue :tick
    sleep 1
  end
end

in_thread do
  live_loop :metronomeSlow do
    cue :tickHalf
    sleep 0.50
  end
end

#Kick heavy
define :kick do
  with_fx :distortion do
    sample :bd_mehackit, mix: 0.6, distort: 0.5, amp: 0.7
  end
end

#Kick light
define :kicklight do
  sample :bd_mehackit, amp: 0.3
end

#KickGroove half
define :kicks do |n|
  live_loop :kick do
    16.times do |i|
      sync :tickHalf if n == 1
      sync :tick if n == 2
      stop if n == 0
      kick if loop1[i] == 0
      kicklight if loop1[i]== 1
    end
  end
end

#GlitchSound
define :glitch do
  with_fx :reverb do
    sample :glitch_perc4, amp: 1.7, pan: rrand(-0.25, 0.25), start: rrand(0, 0.5), sustain: rrand(0.1, 0.4), room: 7, rate: [-2, 1, 3].choose
  end
end

#Glitch groove
define :glitches do |n|
  live_loop :chh do
    rrand_i(4, 16).times do |i|
      sync :tick if n == 1
      stop if n == 0
      glitch if loop2 [i] == 1
    end
  end
end

#Bass Sound
define :bass do
  with_fx :bitcrusher do
    use_synth:fm
    play_pattern_timed [:f2,:d2],[0.25] , amp: 2,release:0.5
    #sample :bass_hard_c, amp: 0.2, attack: 0.5, release: 0.5
  end
end

#Bass groove
define :bass1 do |n|
  live_loop :bassline1 do
    16.times do |i|
      sync :tick if n == 1
      stop if n == 0
      bass if loop3 [i] == 0 if one_in (2)
    end
  end
end

#Bass SoundShort
define :bassShort do
  sample :bass_hit_c, amp: 3, pitch: +3
end

#Bass groove
define :bass2 do |n|
  live_loop :bassline2 do
    16.times do |i|
      sync :tick if n == 1
      stop if n == 0
      bassShort if loop4 [i] == 1
    end
  end
end

#Lead sound
define :lead do
  with_fx :reverb do
    with_fx :wobble do
      sample :loop_electric, start: rrand(0.1, 0.6), pitch: [1, 3, 5, -3].choose, amp: 1, attack: 0.25, sustain: 0, release: 0.25
    end
  end
end

#Lead synth
define :leads do |n|
  live_loop :lead do
    16.times do |i|
      sync :tick if n ==1
      stop if n ==0
      lead if loop4 [i] == 0
    end
  end
end

###########################################

#synth chop
define :synthChop do
  with_transpose 0 do
    use_synth:tech_saws
    play_pattern_timed [:c3,:d4],[0.25] ,release:0.5 if one_in (2)
    play_pattern_timed [:c4,:d5,:r,:f5],[0.25] ,amp:0.5 ,release:0.5 if one_in (4)
  end
end

#Bass groove
define :synthchop do |n|
  live_loop :chops do
    16.times do |i|
      sync :tick if n == 1
      stop if n == 0
      synthChop if loop5 [i] == 1
    end
  end
end

amp_funky = 1
#amp_funky = 0
live_loop :funky do
  use_synth:piano
  use_synth_defaults release:0.025 ,amp: amp_funky
  with_transpose 0 do
    play_pattern_timed [:c3,:d4],[0.25] ,release:0.5
    play_pattern_timed [:c4,:d5,:r,:f5],[0.25] ,release:0.5 if one_in (4)
  end
  sleep 4
end

amp_funky2 = 1
#amp_funky2 = 0
live_loop :funky2 do
  #use_synth :tech_saws
  use_synth :piano
  use_synth_defaults release:0.025 ,amp: amp_funky2
  with_transpose 12 do
    play :c3
    sleep 4
    play_pattern_timed [:C3,:B2,:A2,:r],[1]
    play_pattern_timed [:r,:F2,:r],[0.25,0.75,3]
    play_pattern_timed [:C2,:r,:D2,:r],[0.25,0.5,1.25,2]
  end
end

amp_funky3 = 1
#amp_funky3 = 0
live_loop :funky3 do
  use_synth :piano
  use_synth_defaults release:0.025 ,amp: amp_funky3
  with_transpose 12 do
    play :c3
    sleep 4
    play_pattern_timed [:C3,:B2,:A2,:r],[1]
    play_pattern_timed [:r,:F2,:r],[0.25,0.75,3]
    play_pattern_timed [:C2,:r,:D2,:r],[0.25,0.5,1.25,2]
  end
end

# prophet
amp_sub_wave = 0.5
#amp_sub_wave = 0
live_loop :sub_wave do
  use_synth :tb303
  use_synth_defaults cuttoff: 70 ,lpf: 200 ,amp: amp_sub_wave ,release: 0.125
  with_fx :ixi_techno ,phase:0.25 do
    with_fx :distortion ,distort:0.5 do
      with_fx :pitch_shift, pitch_dis:0.01 do
        play_pattern_timed [:C3,:r,:D3,:r,:F3,:r,:r,:d3],[0.25]
        sleep 8
      end
    end
  end
end

# brass or synth ########################################################
amp_chord = 1.25
#amp_chord = 0
kick_cnt2 = 0
live_loop :synth_chord do
  use_synth :hoover
  use_synth_defaults cuttoff: 70 ,amp: amp_chord ,release: 0.5
  with_transpose 12 do
    with_fx :pitch_shift, pitch_dis:0.01 do
      with_fx :echo do
        sleep 1
        play_chord (ring :A3, :D4)
        sleep 0.75
        play_chord (ring :A3, :A4)
        sleep 1.5
        play_chord (ring :A3, :E4)
        sleep 0.75
        play_chord (ring :A3, :F4)
        sleep 1.5
        if (kick_cnt2%4 == 0) then
          play_chord (ring :A3, :G4)
        else
          play_chord (ring :A3, :E4)
        end
        sleep 2.5
      end
      kick_cnt2 += 1
    end
  end
end

#kicks 1== slow; 2== fast; 0== stop
#glitches 0= stop; 1 play
#bass1 0= stop; 1 play
#bass2 0= stop; 1 play
#leads 0= stop; 1 play
#
### set the 0 below to 1 to play that pattern
synthchop 1
bass2 1
glitches 1
kicks 1
bass1 1
leads 1
```

---

<div class="post-metadata">

**Author:** ![Automageddon](https://avatars.discourse-cdn.com/v4/letter/a/8e8cbc/32.png) [@Automageddon](https://in-thread.sonic-pi.net/u/Automageddon)\
**Post date:** [January 30, 2021, 5:03pm UTC](https://in-thread.sonic-pi.net/t/sonic-pi-monthly-challenge-4/4897/16 "2021-01-30T17:03:12Z")

</div>

Not happy that you took something with the name of my cat and turned it into a dog, but really glad my code was useful.

---

<div class="post-metadata">

**Author:** ![bitkids](https://avatars.discourse-cdn.com/v4/letter/b/dbc845/32.png) [@bitkids](https://in-thread.sonic-pi.net/u/bitkids)\
**Post date:** [January 31, 2021, 12:19pm UTC](https://in-thread.sonic-pi.net/t/sonic-pi-monthly-challenge-4/4897/17 "2021-01-31T12:19:04Z")

</div>

Sorry ,I didn’t notice that.

If you needed I can change the words and retake.

---

<div class="post-metadata">

**Author:** ![Automageddon](https://avatars.discourse-cdn.com/v4/letter/a/8e8cbc/32.png) [@Automageddon](https://in-thread.sonic-pi.net/u/Automageddon)\
**Post date:** [January 31, 2021, 12:30pm UTC](https://in-thread.sonic-pi.net/t/sonic-pi-monthly-challenge-4/4897/18 "2021-01-31T12:30:20Z")

</div>

No problem, I was only joking!!!

---

<div class="post-metadata">

**Author:** ![bitkids](https://avatars.discourse-cdn.com/v4/letter/b/dbc845/32.png) [@bitkids](https://in-thread.sonic-pi.net/u/bitkids)\
**Post date:** [January 31, 2021, 2:27pm UTC](https://in-thread.sonic-pi.net/t/sonic-pi-monthly-challenge-4/4897/19 "2021-01-31T14:27:59Z")

</div>

Haha. I thougt so 😆
