# Code Share | 1979 Beat

**URL:** <https://in-thread.sonic-pi.net/t/code-share-1979-beat/6208>\
**Category:** Creations & Ideas\
**Created:** [December 10, 2021, 8:00pm UTC](https://in-thread.sonic-pi.net/t/code-share-1979-beat/6208 "2021-12-10T20:00:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![lowtidefy](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/lowtidefy/32/2159_2.png) [@lowtidefy](https://in-thread.sonic-pi.net/u/lowtidefy)\
**Post date:** [December 10, 2021, 8:00pm UTC](https://in-thread.sonic-pi.net/t/code-share-1979-beat/6208/1 "2021-12-10T20:00:51Z")

</div>

Hi There everyone! Wanted to share something for anyone like me, I sometimes program drums so I can practice my guitar. Wanted to share with you a beat I made of one of my favorite songs of all time 1979 using the tutorial of [Mister Bomb](https://www.youtube.com/watch?v=RaJZho7p2Y4)

```ruby
use_bpm 127

beatscore = [1,0,2,0,1,1,2,1,0,1,2,0,1,1,2,0]

live_loop :kicks do
  with_fx :reverb, room: 0.3 do
    16.times do |i|
      puts i, beatscore[i]
      use_sample_defaults amp: rrand(0.95, 0.85)
      sample :drum_bass_soft if beatscore[i] == 1
      sample :drum_snare_soft if beatscore[i] == 2
      sleep 0.5
    end
  end
end

hhscore = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]

live_loop :hh do
  16.times do |i|
    puts i, hhscore[i]
    with_sample_defaults amp: rrand(0.65, 0.35) do
      sample :drum_cymbal_closed if hhscore[i] == 1
      sleep 0.5
    end
  end
end

```

Enjoy!

extra: the bass (the sound can be better)

```ruby
bass = [1,1,1,1,1,1,1,2,0,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4]

live_loop :bass do
  32.times do |i|
    puts i, bass[i]
    with_fx :distortion do
      use_synth :bass_foundation
      with_synth_defaults amp: 1, attack: 0.125 do
        play :eb2 if bass[i] == 1
        play :e2, slide: 3, sustain: 2 if bass[i] == 2
        play :b1 if bass[i] == 3
        play :a1 if bass[i] == 4
        sleep 0.5
      end
    end
  end
end

```

---

<div class="post-metadata">

**Author:** ![nlb](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/nlb/32/997_2.png) [@nlb](https://in-thread.sonic-pi.net/u/nlb)\
**Post date:** [December 12, 2021, 6:55pm UTC](https://in-thread.sonic-pi.net/t/code-share-1979-beat/6208/2 "2021-12-12T18:55:45Z")

</div>

hi @lowtidefy

Well done. Let me introduce case

```ruby
case a
when 1
  puts "It's 1"
when 3
  puts "It's 3"
when 4
  puts "It's 4"
else
  puts "It's something else"
end

# different type of case
case
when a > 100
  puts "It's greater than 100"
when a == 50
  puts "It's 50"
else
  puts "It's something else"
end

```

maybe you will find usefull to know you can use this solution.  
Cheers and happy coding !

---

<div class="post-metadata">

**Author:** ![lowtidefy](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/lowtidefy/32/2159_2.png) [@lowtidefy](https://in-thread.sonic-pi.net/u/lowtidefy)\
**Post date:** [December 13, 2021, 12:55am UTC](https://in-thread.sonic-pi.net/t/code-share-1979-beat/6208/3 "2021-12-13T00:55:41Z")

</div>

Awesome! Checking it out and let me see if i can make some sense of it!

---

<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:** [December 13, 2021, 3:05pm UTC](https://in-thread.sonic-pi.net/t/code-share-1979-beat/6208/4 "2021-12-13T15:05:18Z")

</div>

Hi there,

As far as I know there is no synth called :bass\_foundation ,  
good substitues might be :FM or :TRI.

You may have to shift notes up an octave if you use :FM,  
otherwise they will be too deep…

Regards,

Eli…

```ruby
live_loop :bass do
  32.times do |i|
    puts i, bass[i]
    with_fx :distortion do
      use_synth :tri
      with_synth_defaults amp: 1, attack: 0.125 do
        play :eb2 if bass[i] == 1
        play :e2, slide: 3, sustain: 2 if bass[i] == 2
        play :b1 if bass[i] == 3
        play :a1 if bass[i] == 4
        sleep 0.5
      end
    end
  end
end

```

---

<div class="post-metadata">

**Author:** ![lowtidefy](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/lowtidefy/32/2159_2.png) [@lowtidefy](https://in-thread.sonic-pi.net/u/lowtidefy)\
**Post date:** [December 13, 2021, 3:21pm UTC](https://in-thread.sonic-pi.net/t/code-share-1979-beat/6208/5 "2021-12-13T15:21:44Z")

</div>

Thank you for your suggestion,

I have attached a screenshot of the synth, I have the new Sonic Pi 4.0.0 Beta version (as a patreon) so I was not aware that it might be missing in the non beta

 ![Screen Shot 2021-12-13 at 11.16.26](https://europe1.discourse-cdn.com/flex017/uploads/sonic_pi/original/2X/c/c978af6bdcd97b865a1052db6fb5a10068fcdea1.png)

Happy Coding!

---

<div class="post-metadata">

**Author:** ![lowtidefy](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/lowtidefy/32/2159_2.png) [@lowtidefy](https://in-thread.sonic-pi.net/u/lowtidefy)\
**Post date:** [December 13, 2021, 3:27pm UTC](https://in-thread.sonic-pi.net/t/code-share-1979-beat/6208/6 "2021-12-13T15:27:58Z")

</div>

Tried the code! Liked the :fm but had to tweek indeed to an octave higher…
