Sonic Pi Monthly Challenge #1

Hi @jrm,

sounds interesting though I can not enjoy the complete code. I get a

Runtime Error: [buffer 3, line 121] - NoMethodError
Thread death +--> :live_loop_melody
 undefined method `to_f' for (ring <SonicPi::Chord :Eb :m7 [3, 6, 10,13]):SonicPi::Core::RingVector
Did you mean?  to_s
               to_a

[...]

Not sure where this comes from. I am running SP 3.2.0 on Linux. Any idea?

for me another error on spi 3.2.2 on ubuntu 18.04. Seems to be a error due to the code this time @jrm
i do not use your sample but one from my own library

r: [buffer 7, line 143] - RuntimeError
Thread death +--> :live_loop_guiro2
 Value of opt :finish must be a value between 0 and 1 inclusively, got -1.2905239197630656.

Hello I’m running 3.2.2, line 121 is a sleep, and line below is a sample command. I’ve no idea why it’s not running on your machine.
I’ll record a destructive output (MP3) and post it tomorrow.

1 Like

Hi @nlb, probably that’s because you don’t use my sample. start and finish values are functions of the sample length.

Works for me on 3.2.2 (Win 10)
Nice use of the sample.

We can use this to share the code and audio from each challenge:

1 Like

Here’s an offering using a randomly chosen sample from freesound.org
I looked at the onsets within the long sample and from them generated playable “synths”. I used 12 of the onset voices to play four part rounds of frere jaques, and concluded with the 13th onset playing a stonking loud low version of Frere Jaques. I added fx wobble to the rounds and gverb to the single version, with some overall roll of of high frequencies with fx lpf.
Hear it on Sound Cloud. Description has link to the code.

2 Likes

@jrm and @robin.newman I’ve added your code to the github repo:

@jrm, Are you able to upload an audio file somewhere please, so I can add it to the audio README.md in the ‘Audio’ folder?

Here is my submission :point_down:
https://soundcloud.com/binarysweets/toad-mode-sonic-pi-monthly-challenge-1

Using this random sample: puti32.aiff

I made two versions - One using live loops to get a jam going and to play about with the sample. I then created a structured version to record and mix down.

Code is in the monthly challenge repo here

2 Likes

It’s great idea! :guitar:

Here is mine. The sample I got was the interior of a bus https://freesound.org/people/florianreichelt/sounds/456833/ which I thought might be rich pickings but turned out to be mostly white noise. So I looked at it in Audacity and tried to pick out the little bits where there was something to latch on to.

I ended up with what it felt like to be snoozing on a bus, both lulled and woken by repetitive and chaotic noises. Horrible really.

Still, it was a good exercise in exploring more of the filters. A lot of band pass filtering to get something like a note, and the vowel filter which has a similar effect.

The script: https://gist.github.com/soxsa/91e1274f5efed68a6fb46f496ac8f7d3

4 Likes

loving this challenge …

I was having a play today & think I’ve discovered something strange about FX :eq… it seems to swamp everything… I’ve even put it at 0.01 & wrapped it in an FX :level at amp: 0.01 and it just swamps anything else out… (other live loops etc).

[edit] - just discovered (should have looked first) that high / low / mid are levels… not frequencies… doh.

use_bpm 80
use_debug false
use_cue_logging false
samp = :loop_garzul

# [1,cc,129].sort[1] is a neat way of finding out a min, val, max number
t = 0
sli = 32


define :ss do | sl |
  return {num_slices: sli, slice: sl}
end

live_loop :bd do
  with_fx :band_eq, db: 2, freq: 60 do
    sample samp, ss(0)
  end
  
  sleep 1
end

live_loop :sn do
  sleep 0.5
  sample samp, ss(2)
  sleep 1.5
end

live_loop :ht do
  sleep 1.5
  sample samp, ss([1, 3].sample)
  sleep 2.5
end

live_loop :tune do
  t - tick
    with_fx :eq, high: 0.4, high_note: [:e, :f, :g].sample, low: 0.3, low_note: [:d, :gs, :a].sample, mix: 0.2, amp:0.8 do
      sample samp, ss(1), rate: [0.4, 0.8, 1.2, 1.1, 1, 0.2, 0.5, 0.6, 1, 1, 1, 1].ring[t], amp: 0.2
    end
    sleep [0.25, 0.25, 0.5, 0.25, 0.25, 1, 0.25, 0.25, 0.5, 0.125, 0.125].ring[t] + 1
  end

Hi @philAwesomeTech, the challenge is to use a random sample from Freesound (link at the top of the thread)

Just 2 weeks left for this challenge.
Got some good submissions in already :+1:

2 Likes

My submission is here (feel free to import it to your soundcloud, I can send you a mp3 if you wish):

Based on this sample from Katy T:

3 Likes

Youtube is fine. I’ve embedded your video at the top and added it to the audio links file in the repo. Can you share your code as well please, so I can also add that to the repo? Thanks :slight_smile:

SonicPi Monthly Challenge, very nice. I’m looking forward to the next one!
Here is my code.

##| https://freesound.org/people/SeryLis/sounds/276576/
soundfile1 = "/Users/mathrax/Desktop/samples/276576__serylis__guitar-party-122-bpm.wav"

##| https://freesound.org/people/showster1232000/sounds/38773/
soundfile2 = "/Users/mathrax/Desktop/samples/38773__showster1232000__loop11.wav"

##| https://freesound.org/people/KevinBrown/sounds/507193/
soundfile3 = "/Users/mathrax/Desktop/samples/507193__kevinbrown__live-love-piano-sample-loop.wav"


use_bpm 60

live_loop :sound1 do
  sample soundfile1 ,  beat_stretch: 16, amp: 0.8
  sleep 16
end

live_loop :sound2 do
  sample soundfile2 ,  beat_stretch: 16, amp: 0.6
  sleep 16
end

live_loop :sound3 do
  sample soundfile3 ,  beat_stretch: 8, amp: 4
  sleep 8
end

live_loop :drumloop do
  2.times do
    sample :loop_amen, beat_stretch: 4, start: 0, finish: 0.125, amp: 1
    sleep 0.5
    sample :loop_amen, beat_stretch: 4, start: 0, finish: 0.125, amp: 0.25
    sleep 0.5
    sample :loop_amen, beat_stretch: 4, start: 0.5, finish: 0.75, amp: 0.25
    sleep 1
    sample :loop_amen, beat_stretch: 4, start: 0, finish: 0.25, amp: 0.5
    sleep 0.5
    sample :loop_amen, beat_stretch: 4, start: 0.5, finish: 0.75, amp: 0.25
    sleep 1
    sample :loop_amen, beat_stretch: 4, start: 0, finish: 0.125, amp: 0.125
    sleep 0.5
  end
  4.times do
    sleep 1
  end
end
1 Like

Hi! I tried my first challenge as below :blush:

##| https://freesound.org/people/Uknow%20Dude/sounds/102889/
freesound = "/Users/Downloads/102889__uknow-dude__fx-glitch-5.wav"
##| https://freesound.org/people/klankbeeld/sounds/236695/
freesound2 = "/Users/Downloads/236695__klankbeeld__ogg-versus-wav-48khz-sample.wav"

use_bpm 120

puts sample_duration(freesound)

live_loop :audioloop do
  sample freesound2, beat_stretch: 80, start: 0.2, finish: 0, amp: 0.8
  sleep 16
  sample freesound2, beat_stretch: 80, start: 0, finish: 0.2, amp: 0.8
  sleep 16
  sample freesound2, beat_stretch: 80, start: 0, finish: 0.2, amp: 0.8
  sleep 8
  sample freesound2, beat_stretch: 80, start: 0, finish: 0.2, amp: 0.8
  sleep 8
  sample freesound2, beat_stretch: 80, start: 0, finish: 0.2, amp: 0.8
  sleep 32
end

live_loop :drums do
  2.times do
    sample freesound, beat_stretch: 40, start: 0.6, finish: 0.61
    sleep 1
    sample freesound, beat_stretch: 20, start: 0.62, finish: 0.63
    sleep 0.5
    sample freesound, beat_stretch: 20, start: 0.65, finish: 0.66
    sleep 0.5
  end
  sample freesound, beat_stretch: 80, start: 0.6, finish: 0.61
  sleep 1
  sample freesound, beat_stretch: 80, start: 0.62, finish: 0.63
  sleep 0.5
  sample freesound, beat_stretch: 80, start: 0.65, finish: 0.66
  sleep 0.5
  sample freesound, beat_stretch: 80, start: 0.66, finish: 0.67
  sleep 1
  4.times do
    sample [freesound, freesound2].choose, beat_stretch: 20, start: 0.67, finish: 0.7
    sleep 0.25
  end
end

live_loop :hihat do
  sleep 8
  3.times do
    sample [freesound, freesound2].choose, beat_stretch: 40, start: 0.2, finish: 0.25, amp: 1.2
    sleep 2
  end
  sleep 18
end
1 Like

Here is the code:

use_random_seed 202010190001001
# Sonic Pi Monthly Challenge 1
# https://in-thread.sonic-pi.net/t/sonic-pi-monthly-challenge-1/4442
# featuring voice sample from 'Katy T' (aka Katy Theodossiou)
# https://freesound.org/people/digifishmusic/sounds/84243/
# Original file name:
# 84243__digifishmusic__oooooo-accapela-katytheodossiou.wav
# Work name:
# accapela-katytheodossiou.wav

set_mixer_control! hpf: 35
set_mixer_control! amp: 0.99

duree_intro = 7
duree_outro = 6

duree_totale = 140
print "durée totale: ", duree_totale / 60, " mn et", duree_totale % 60, " s"

bibsmp = "G:/media/perso/enkid0/_SonicPi_monthly/001"

smp_Katy = "accapela-katytheodossiou.wav"
duree_voix =  sample_duration bibsmp, smp_Katy
print duree_voix

continuer = true

in_thread do
  while continuer == true
    sleep 1
    if beat > duree_totale
      continuer = false
      print "fin du morceau !"
    end
  end
end

with_fx :compressor, mix: 1 do
  
  
  in_thread do
    with_fx :hpf, cutoff: 0, cutoff_slide: 7, mix: 0.7 do |hpf|
      with_fx :lpf, cutoff: 130, cutoff_slide: 6, mix: 0.7 do |lpf|
        with_fx :whammy, mix: 0.16 do
          with_fx :panslicer, wave: 1, mix: 0.12 do
            print "zero"
            
            sample bibsmp, smp_Katy,
              sample_duration: duree_totale,
              rate: duree_voix/duree_totale,
              amp: 0.41
            
            sleep duree_intro
            
            in_thread do
              while continuer == true
                sleep 7
                control hpf, cutoff: rrand_i(0, 88)
              end
            end
            
            while continuer == true
              sleep 10
              control lpf, cutoff: rrand_i(98, 130)
            end
            
          end
        end
      end
    end
  end
  
  in_thread do
    with_fx :hpf, cutoff: 0, cutoff_slide: 7, mix: 0.7 do |hpf|
      with_fx :lpf, cutoff: 130, cutoff_slide: 6, mix: 0.7 do |lpf|
        with_fx :whammy, mix: 0.13 do
          with_fx :panslicer, wave: 1, mix: 0.12 do
            print "minus zero"
            
            sample bibsmp, smp_Katy,
              sample_duration: duree_totale,
              rate: -duree_voix/duree_totale,
              amp: 0.36
            
            sleep duree_intro
            
            in_thread do
              while continuer == true
                sleep 6
                control hpf, cutoff: rrand_i(0, 88)
              end
            end
            
            while continuer == true
              sleep 9
              control lpf, cutoff: rrand_i(98, 130)
            end
            
          end
        end
      end
    end
  end
  
  in_thread do
    sleep duree_intro
    while continuer == true
      print "un"
      with_fx :reverb, room: 0.45, mix: 0.45 do
        sample bibsmp, smp_Katy,
          beat_stretch: rrand(3, 7),
          start: rrand(0.2, 0.49),
          finish: rrand(0.51, 0.8),
          attack: 0.2,
          release: 0.2,
          amp: rrand(0.54, 0.96)
        sleep 7 + rrand_i(0, 4)
      end
    end
  end
  
  in_thread do
    sleep duree_intro * 3
    while continuer == true
      print "deux"
      with_fx :reverb, room: 0.32, mix: 0.51 do
        with_fx :echo, mix: 0.3 do
          sample bibsmp, smp_Katy,
            rate: [-3, -2, 4, 6].choose,
            attack: 1.2,
            release: 1.2,
            start: rrand(0.05, 0.3),
            finish: rrand(0.7, 0.95),
            amp: rrand(0.5, 0.98)
          sleep 9 + rrand_i(0, 4.5)
        end
      end
    end
  end
  
  in_thread do
    sleep duree_intro * 2
    while continuer == true
      print "trois"
      with_fx :echo, decay: 0.2, phase: 0.15, mix: 0.25 do
        with_fx :wobble, mix: 0.04 do
          with_fx :panslicer, mix: 0.1 do
            sample bibsmp, smp_Katy,
              beat_stretch: rrand(11, 18),
              start: rrand(0, 0.49),
              finish: rrand(0.51, 1),
              attack: 2,
              release: 2,
              amp: rrand(0.5, 0.95)
            sleep 11 + rrand_i(0, 5)
          end
        end
      end
    end
  end
  
  in_thread do
    sleep duree_intro * 3
    while continuer == true
      print "quatre"
      with_fx :echo, decay: 0.3, phase: 0.17, mix: 0.3 do
        with_fx :ping_pong, mix: 0.2 do
          with_fx :flanger, mix: 0.2 do
            sample bibsmp, smp_Katy,
              beat_stretch: rrand(13, 25),
              start: rrand(0, 0.49),
              finish: rrand(0.51, 1),
              attack: 3,
              release: 3,
              amp: rrand(0.5, 0.95)
            sleep 13 + rrand_i(0, 5.5)
          end
        end
      end
    end
  end
  
  in_thread do
    sleep duree_intro * 1.5
    while continuer == true
      print "cinq"
      with_fx :echo, decay: 0.3, phase: 0.17, mix: 0.2 do
        with_fx :distortion, mix: 0.14 do
          with_fx :bitcrusher, mix: 0.13 do
            sample bibsmp, smp_Katy,
              beat_stretch: rrand(16, 28),
              start: rrand(0, 0.49),
              finish: rrand(0.51, 1),
              attack: 4,
              release: 4,
              amp: rrand(0.1, 0.25)
            sleep 17 + rrand_i(0, 6.5)
          end
        end
      end
    end
  end
  
  in_thread do
    sleep duree_intro * 1.2
    while continuer == true
      print "six"
      with_fx :echo, decay: 0.11, phase: 0.14, mix: 0.3 do
        with_fx :ixi_techno, mix: 0.14 do
          with_fx :tremolo, mix: 0.13 do
            sample bibsmp, smp_Katy,
              beat_stretch: rrand(19, 31),
              start: rrand(0, 0.49),
              finish: rrand(0.51, 1),
              attack: 4,
              release: 4,
              rate: -1,
              amp: rrand(0.2, 0.35)
            sleep 14 + rrand_i(0, 3.5)
          end
        end
      end
    end
  end
  
end

The youtube version has been normalised through Audacity, though (and necessarily compressed by YouTube).

1 Like

Thanks to everyone who participated in this challenge - We had some very creative submissions :slight_smile:
I’ll post up details for challenge #2 tomorrow.