External samples - best practice Qs

Hello, I’m playing with found sound/external samples in SP, and wondering about best practice - help appreciated!

  • what level dB is recommended? Or can you suggest a LUFS to shoot for? I’m trying different levels within SP but it’s hit and miss - would be good to know what others do. Also I’ve been using amp: to correct, but from reading other info, it looks like that’s likely to distort above 1, and it’s best to calibrate the level of the clip to start with?

  • defining/calling samples: is it best to declare them at the top of the code? Or within the relevant live loop?

  • making sample chords/polyphony: what’s a good way to homogenise long sample strings for easier use? eg this seems unwieldy - it works fine, but I’m not sure how to bracket it into a single chord to make it easier live:

live_loop :samplename do
sample "C:xxxxxxxxxxxxxxx/xxxxxxxx/xxxxx", pitch: +3
sample "C:xxxxxxxxxxxxxxx/xxxxxxxx/xxxxx", pitch: +7
sample "C:xxxxxxxxxxxxxxx/xxxxxxxx/xxxxx", pitch: +10
sleep 1
end

NB these are shorty little samples! I made a version of in dulce jubilo with recorder sample before Christmas, was v fun to do. Now tackling pan lids in the kitchen :smiley:

PS found a great tip - thanks @Eli : samples can be dragged directly into the SP interface - gamechanger!

When using a sample pack, I usually save the folder path to a variable:

sam = "path/to/folder"

sample sam, "filter"

for the chords:

c = (chord :c, :major)
for n in c
  sample "your/sample", rpitch: n, amp: 0.3  #amp needs to be tweaked
end
1 Like

Thank you David for helping an early-stage coder! Will check out your channel.

The sample plays fine with :rpitch as a number.
If I use for n in c as below, I get just a tiny blip sound.
Have tried different sustain/release and sleep lengths.
Have also tried

  • ‘gong’ as a filter
  • adding index number
    Both of these work, only not with for n in c
    Any thoughts, anyone?
live_loop :chordplayer do
  sam = "/Users/my/Desktop/samples/","gong" #, 3
  c = (chord :b, :minor7)
  for n in c
    sample sam, rpitch: n #sustain: 0.1, release: 0.2
    sleep 0.5
  end
end

Sorry, I thought :c resolved to 0, but it behaves like :c4, which is midi note 60.
So the sample would play five octaves too high.
It should look like this:

c = (chord :c0, :major)

Edit:
I just tried this, and found out that :c0 is actually midi note 12.
You can use

(chord 0, :major)

2nd Edit:
@samaaron How do we write these notes?
note_info(0) returns <SonicPi::Note :C-1>, but :C-1 returns 59, which is what I’d expect.

Thanks - I’ve got some live_loops working with samples now.

I used :pitch to get different notes, managed to get some polyphony using :echo, phase:

with_fx :echo, phase: 2 do
  live_loop :recordertune do
    sam = "/Users/jules/Desktop/samples/", "recorder"
    sample sam, pitch:[0, -4, +3, +7, +10, +12].tick
    sleep 1
  end
end

The filter function is great! Thanks for tip. V handy to be able to add index number and change it.

Someone might find useful: the “recorder” string filter and various others kept giving ‘no match’ until I changed the clips from .mp3 to .wav. .flac works too. I had to reboot SP too at this point.

This is unfortunately one of the non-obvious aspects of the syntax. :c-1 is actually read by the computer as :c - 1 which is substituted for note(:c4) - 1 which in turn 60 - 1 which is why you’re seeing 59.

If you want to refer to the :C an octave lower than 0 then you need to use a string rather than a symbol: "C-1". A symbol can only contain letters and number, whereas a string can contain any symbol such as the -.

puts note(:c-1)  #=> 59
puts note("c-1") #=> 0
1 Like

Thank you for this info, Sam.

1 Like