Skip to content

Instantly share code, notes, and snippets.

@sizrar
Created May 3, 2021 01:25
Show Gist options
  • Select an option

  • Save sizrar/1815495093759170501728c7f7ebef16 to your computer and use it in GitHub Desktop.

Select an option

Save sizrar/1815495093759170501728c7f7ebef16 to your computer and use it in GitHub Desktop.

Revisions

  1. sizrar created this gist May 3, 2021.
    125 changes: 125 additions & 0 deletions Happy.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,125 @@
    use_bpm 80

    define :bassRiff1 do
    in_thread do
    use_synth :fm
    play :e4,release: 3
    sleep 1.8
    play :e3,release: 3
    sleep 2.2
    play :e3,release: 0.4
    sleep 0.5
    play :g3,release: 0.3
    sleep 0.5
    play :a3,release: 0.3
    sleep 0.5
    play :g3,release: 0.3
    sleep 0.25
    play :b3,release: 0.6
    sleep 0.5
    play :b3,release: 0.6
    sleep 0.5
    play :g3,release: 0.8
    sleep 0.25
    play :a3
    sleep 0.5
    play :g3
    sleep 0.5
    end
    end

    define :main_bass do
    in_thread do
    use_synth :fm
    3.times do
    play choose([:c3,:c2])
    sleep 0.5
    end
    sleep 0.3
    4.times do
    play choose([:b3,:b2,:fs3])
    sleep 0.49
    end
    sleep 0.25
    3.times do
    play choose([:b3,:b2])
    sleep 0.5
    end
    sleep 0.3
    4.times do
    play choose([:e3,:e2,:e3])
    sleep 0.49
    end
    end

    end
    define :intro do
    in_thread do
    play chord(:E4,:minor7),release: 2
    sleep 1.8
    play chord(:E3,:minor),release: 2
    sleep 2.2
    play chord(:E4,:major),release: 2
    end
    end


    define :grid1 do
    in_thread do
    play chord(:C4,:major),release: 2
    sleep 1.8
    play chord(:B3,:minor),release: 2
    sleep 2.2
    play chord(:B3,:minor7),release: 2
    sleep 1.8
    play chord(:E4,:major),release: 2
    sleep 2
    end
    end


    define :hihat do
    in_thread do
    32.times do
    sample :drum_cymbal_closed, amp: rrand(0.7,0.95)
    sleep 0.25
    end
    end
    end

    define :beat1 do | alt |
    8.times do
    alt = !alt
    sample :drum_heavy_kick
    sleep 0.5
    if alt
    sample :drum_snare_soft
    sleep 0.25
    sample :drum_snare_soft
    else
    sample :drum_snare_hard
    sleep 0.25
    end
    sleep 0.25
    end
    end

    live_loop :happy do
    4.times do
    cue :tick
    bassRiff1
    beat
    hihat
    intro
    beat1 true
    end

    8.times do
    cue :tick
    beat
    hihat
    main_bass
    grid1
    beat1 false
    end
    end