Sonic Pi Monthly Challenge #1

Hello Sonic Pi’ers, hope you are well :blush:

I thought it might be fun to run a little monthly project where we can all create new music based on a theme or idea and then share it in the forum - Whether it is a live performance (video), track or just the code, all formats are welcome.

If this turns out to be a popular idea, then we could take turns in thinking up the next theme.

To kick it off, I was thinking this month’s theme could be “One Random Sample” - What can you do with just one sample?

Instructions:

  1. Choose a random sample that you like from Freesound here: Freesound - "Sound 14 - writing with wacom stylus.wav" by jotica012

  2. Make some music, only using the sample that you have chosen in step 1. Any style, any length.

  3. Post it in this topic - Youtube/soundcloud/bandcamp, whatever your preferred platform is. Just make sure that you tell us about the sample you used and include a link to the original one, if you can.

The deadline for this one is 31st October.

Submissions :point_down:

Code and links to audio for this challenge are here

Happy coding!

:computer:

10 Likes

That’s a great idea.

I am not sure if I will find the time but otherwise: one month should be enough. I will try come up with something.

Thanks @binarysweets for the initiative!

This is a really cool idea.
I saw an Andrew Huang video where he and some other musicians did a similar challenge. I’ll give it a shot. :stuck_out_tongue:

should we all choose the same sample like in Andrew’s video?

For the purposes of this first go, let’s all choose whatever sample we want and, depending on how we like it, for November (or whenever the next one is) we can up the difficulty and choose the same sample. :slight_smile:

1 Like

I got a sample from someone making a pancake :rofl:

3 Likes

rofl, that’s something I’d have never expected to be a sample

I got a drone sound which I could see working. At least if I could use some drums…and maybe a synth… or two…oh well, I suppose that’s the challenge! :stuck_out_tongue:

2 Likes

I think I will use this one:

Oh, sorry no. It should be chosen randomly so I have just picked this one:

My one came out as this:

:cowboy_hat_face:

Mine will be

Wow… such interesting and versatile sounds.

And I thought I was doing well to get a grasshopper from SP’s very
own loopamen…

use_bpm 90

live_loop :wibble do
  with_fx :whammy do
    if rand(1) > 0.1 then
      sample :loop_amen, rate: 0.55, start: 0.5, finish: 0.6, pitch: 24
      sleep (sample_duration :loop_amen)
      
    else
      sleep (sample_duration :loop_amen, rate: 0.75, start: 0.5, finish: 0.6)+1.0
    end
  end
end


live_loop :wubble do
  with_fx :whammy do
    if rand(1) > 0.5
      sample :loop_amen, start: 0.375, finish: 0.425
      sleep (sample_duration :loop_amen, rate: 0.75, start: 0.375, finish: 0.425)+0.5
      
    else
      sleep (sample_duration :loop_amen, rate: 0.75, start: 0.5, finish: 0.6)+1.0
    end
  end
end

Maybe I’ll have to rethink my game.

Eli…

2 Likes

Yeah, well, @Eli I think you are bending the rules… :wink:

some results can be not for all ages :slight_smile: be careful. Yes even with sounds.
By the way, nobody can check if you only play once the random choice.
Can we use synths and internal samples or the rule is one sample only ?
cheers

Well, the challenge was to use just one random sample but you could keep searching for a new random sample until you found one that you were more comfortable using. imo it would be better to push yourself out of your comfort zone though.

@Eli, I agree with Martin. You can re-use your code though, just replace the amen sample with the one you get from Freesound. :+1:

I actually did search 2 times. Then I was satisfied with the random choice (I did avoid getting a sample from an instrument. Too boring…).

I like this idea !
And then make this.
Maybe It’s boring for you but I’m happy to do it :grinning:

use_bpm 120

# sample file
# https://freesound.org/people/zimbot/sounds/122984/?random_browsing=true
freesound = "C:/wavs/samples/freesound/122984__zimbot__portalmalfunction-medium.wav"

live_loop :bass_loop do
  
  use_synth :fm
  use_synth_defaults sustain: 0.125
  
  4.times do
play_pattern_timed [:C3 ,:Eb3,:E3 ,:G3 ,:A3,:Bb3],[1 ,0.125, 0.775 ,1 ,0.125, 0.775]
  end
  2.times do
play_pattern_timed [:F3 ,:A3,:Bb3 ,:Eb4 ,:G4,:Ab4],[1 ,0.125, 0.775 ,1 ,0.125, 0.775]
  end
  play_pattern_timed [:F3 ,:Ab3 ,:B3 ,:D4 ,:E3 ,:G3 ,:Bb3 ,:Db4],[1]
  
end

# change rate from 1 to 12 . It's funny and fun !!
live_loop :audio_loop do
  
  sample freesound ,rate: 6 ,amp:0.5
  sleep 5
  sample freesound ,rate: 1 ,amp:0.5
  sleep 3
  
end

Ok, I made this kind of tribal loop

# Copyleft - Jérôme Prudent
# https://in-thread.sonic-pi.net/t/sonic-pi-monthly-challenge-1/4442
# Sonic Pi monthly challenge : "Make any piece of sound from a single sample"
# The sample for this piece is downloadable at https://freesound.org/people/Kyster/sounds/140615/

sample_path = "/home/jerome/p/songs/Library/Sound FX & Scratches/bottle-cork-in-and-out-2012-1-4.wav"
sample_d = sample_duration(sample_path)
puts "sample duration #{sample_d}"

define :sample_slicer do |start_end|
  start_end.collect { |x| (sample_d - x) / sample_d }
end

percu = sample_slicer([3.49, 3.23])
puts "percu : #{percu}"

t1 = 1.0
t2 = t1 / 2
t4 = t2/ 2
t8 = t4/ 2

b = bass = 0.5
m = medium = 0.75
h = high = 1
r = repos = 0
rs = [
  #0
  (ring b, b, m, m,  b, b, h, h, b, b, m, m, b, b, h, h),
  (ring b, r, m, m,  r, r, h, r),
  (ring b, r, m, m,  r, b, h, r,  b, r, r, m,  b, b, m, r),
  (ring b, m, m, r,  b, r, h, h,  b, h, r, h,  b, r, h, h),
  #4
  (ring h, r, r, h,  h, r, m, m),
  (ring b, r, r, b,  b, r, m, m),
  (ring h, r, r, h,  h, r, b, r,  h, r, m, m,  h, r, b, r),
  (ring b, b, m, m,  b, b, h, h,  b, b, m, m,  b, b, h, h),
  #8
  (ring b, r, m, m,  b, h, h, r,  b, r, m, m,  b, h, h, r),
  (ring m, m, r, h,  m, m, h, r,  m, m, h, r,  m, m, h, r),
  
]

set :timbre, rs.first
set :rythm, (ring t8)
set :chord, (chord knit(0, 20, 3, 1).choose, knit(:m7, 3, :dim7, 2, :dom7, 1).tick(:x))

live_loop :ticks do |cpt|
  use_bpm 100
  sleep t8+0.001
  set :guiro, false
  if (factor?(cpt, 10 * 16))
    x = rs.tick(:rs)
    puts "Change rythm #{x}"
    set :timbre, x
    set :rythm, (ring t8)
  end
  if (factor?(cpt, 16))
    ch = (chord knit(0, 9, 3, 1).choose, knit(:m7, 3, :dim7, 2, :dom7, 1).tick(:x))
    puts "Change chord #{x}"
    set :chord, ch
  end
  if (factor?(cpt, [4,8].choose*16 + 8))
    set :guiro, true
  end
  
  cpt += 1
end

#you can change the pattern easily

with_fx :lpf do
  with_fx :distortion do
    live_loop :percu do
      sync :ticks
      timbre = get :timbre
      t =  timbre.tick(:timbre)
      cutoff = 90
      if (factor?(look(:timbre), 4))
        puts look(:timbre)
        cutoff = 120
      end
      p = false
      if (t != repos)
        p = sample sample_path, amp: 1, start: percu[0], finish: percu[1],
          rate: t, cutoff: cutoff
      end
      rythm = get :rythm
      r = rythm.tick(:rythm)
      
      sleep r
    end
  end
end

live_loop :fast_tictictic do
  sync :ticks
  speed = knit(0, 2, 1, 2, 2, 1).choose
  probability = (knit true, 2, false, 1)
  with_fx :hpf do
    t = (sync :current_rythm) - 0.001
    speed.times do
      sample sample_path, amp: 1, start: percu[0], finish: percu[1], rate: 8
      sleep t / speed
    end
  end
end

with_fx :reverb do
  live_loop :melody do
    sync :ticks
    if ((ring true, true, false, false).tick(:p))
      ch = get :chord
      a, b, c = ch
      if(one_in(3))
        puts "reverse"
        ch = ch.reverse
      end
      
      n = t8 / (ring 2, 1, 1, 1, 1, 1, 1, 1, 1).tick(:n)
      sample sample_path, amp: 1, start: percu[0], finish: percu[1], rate: 2, rpitch: a
      sleep n
      sample sample_path, amp: 1, start: percu[0], finish: percu[1], rate: 2, rpitch: b
      sleep n
      sample sample_path, amp: 1, start: percu[0], finish: percu[1], rate: 2, rpitch: c
      sleep n
    end
  end
end

guiro1 = sample_slicer([3.783, 3.497])
puts "guiro1 : #{guiro1}"

guiro2 = sample_slicer([sample_d, 4.016])
puts "guiro2 : #{guiro2}"

scratch = sample_slicer([0.834, 0.3])
puts "scratch : #{scratch}"

live_loop :guiro2 do
  s, e = [guiro1, guiro2, scratch].tick(:g)
  if(sync :guiro)
    with_fx :ping_pong do
      with_fx :hpf do
        s = sample sample_path, amp: 1, start: s, finish: e, rate: 0.5
      end
    end
  end
end

thanks to this monthly challenge, we clearly see post into this forum mp3 format file would be appreciated no ?

@bitkids you bypassed the “only using the sample” rule :slight_smile:

1 Like

@jrm
Oh, I got it. thank you!
Only one sample not using synth. :laughing: I will try again .