Is this proper cue/sync structure?

Greetings, and thanks in advance for any advice you have!

While learning Sonic Pi, I’ve been asking friends to name songs that I could then try to imitate. One of them asked for “Seven Nation Army” by The White Stripes.

Here’s what I came up with (at the bottom of this post).

Question: Is this how you’d structure the cue/sync commands? Something feels a bit awkward about what I did, but I kind of think this is the best we can do. (I know Sonic Pi is built for live coding, not hard-coding songs, but still…)

Another side question: my bass doesn’t sound dampened like the bass in the song. If I play around enough, I should be able to mimic virtually any musical sound with Sonic Pi, right?

Okay, here’s my code:

================

## My rendition of White Stripes, Seven Nation Army

live_loop :bl, sync: :bassline do
  2.times do
    2.times do
      with_fx :reverb, room: 0.9, damp: 0.5 do
        sample :bass_thick_c, attack: 0.02, rpitch: 4.5, decay: rand(0.1..0.2), sustain: rand(0.25..0.35), pitch_dis: 0.01, release: 0.5
        sleep 0.75
        sample :bass_thick_c, rpitch: 4.5, sustain: 0.15
        sleep 0.25
        sample :bass_thick_c, rpitch: 7.5, sustain: 0.15
        sleep 0.33
        sample :bass_thick_c, rpitch: 4.5, sustain: 0.15
        sleep 0.33
        sample :bass_thick_c, rpitch: 2, sustain: 0.2
        sleep 0.33
        sample :bass_thick_c, attack: 0.02, rpitch: 0.5, decay: rand(0.1..0.2), sustain: rand(0.45..0.55), pitch_dis: 0.01, release: 0.3
        sleep 1
        sample :bass_thick_c, attack: 0.02, rpitch: -0.5, decay: rand(0.1..0.2), sustain: rand(0.45..0.55), release: 0.3
        sleep 1
      end
    end
    cue :bassdrum
  end
  cue :snare
end

live_loop :bd, sync: :bassdrum do
  loop do
    sample :drum_bass_hard, amp: rand(0.9..1.2)
    sleep 0.5
  end
end

in_thread do
  sync :snare
  loop do
    sleep 0.5
    sample :drum_snare_soft, amp: 1.5
    sleep 0.5
  end
end


in_thread do
  cue :bassline
end
1 Like

Perhaps I should put it this way instead: I’d love to see someone else’s attempt to encode a song (or even just the opening) in Sonic Pi. Above, I’m creating various instruments, defining them, and then firing them up with cue. I’m just wondering if this is standard practice.

I don’t think that there is a standard practice in sonic-pi especially since people come from numerous backgrounds(which is such a blessing).

In terms of cueing & structure, I tend to have a similar coding style at times in how you constructed the song.

Hi @DavidPerkins,

I have some examples online:

Hope that this is of some help.

1 Like

Many thanks for this reply. The more I’ve written, the more the sync/cue structure feels right, and it’s good to hear that it’s not off in left field (even though, like you said, there is no standard as of now). I like that you called it a “blessing”. I think I see why!

Awesome – I will take a look immediately!

I also call it a blessing cause I have been able to grasp musical concepts without having prior music knowledge as well as finding different ways to compose/code music/sounds.

That makes sense. And in your explorations of sound, have you found a way to make Sonic Pi produce the sound of a upright bass guitar being plucked? I have spent hours in futility! :slight_smile:

@Martin I love your simple mixer idea. You seem to be labeling it in a way that makes it sound like you’re a little embarrassed to have created it, but I think it’s marvelous.

Yeah, well… actually it is not a mixer but more a switch. I do not use it anymore because it does not fit into my attempts to tame the live coding beast.

I did check out nonmixer as a non-SP solution (for Linux). So if I needed a real mixer, I would probably use this one. But… it is a convenient and easy way to switch on/off different live_loops in one place.

Yes, more of a switch, but it seems like a great idea to me. Did you replace it with an even better idea?

Just an idea: You might use the :fm synth and use the attack_level option with rather high values… Not sure if it sounds like plucking but definitely adds punch to the bass.

That sounds quite like my upright electric bass, which is great progress – thank you! I’ll keep working to see if I can make it sound less synthed.

Good. Let us know about any progress!

And you can also tweak the sound via With_fx, changing the bpm with use_bpm or even using the pitch parameter