S there a way to turn regular one note(external samples) to synths in sonic pi

Is there a way to turn regular one note(external samples) to synths in sonic pi, or at least, be able to change the notes and make a basic melody using this sample without having to change pitch using numerical values?i saw the bach example in the help section, is there a way to compose(or arrange) like that using an external one note sample?
please let me know, thanks.

Hi
it depends on whether you have a collection of samples across a range of pitches, or just one sample that you need to play at different rates/speed to repitch it.

You’ll find an example of a simple solution here:

In my example, I repitch a single sample, but it seems you do not want to do that. In that case, each pitched playback will need to be a different sample, as I think you are asking for.

PD-Pi

1 Like

thank you so much, brendanmac

Just to clarify - at the risk of condescending - your 2 main simple options are (in pseudo code):

sample nameOf1stSample
sleep n
sample nameOf2ndSample
sleep n
…

or

loop:
sample nameOfOneSample rate[1, 0.5, 0.75, 0.333].look

But your OP states that you don’t want to “change pitch using numerical values”, so option 2 is not the answer :wink: The only way to change the perceived pitch of a single digital sample is to change its playback rate. Or use granular playback, or some other form of modulation synthesis, which all involve numerical values.

HTH

PD-Pi

1 Like

its not really about the number though…

the problem im having is not being able to efficiently make compositions using samples(at least i dont know how to)

one of the examples in the sonic pi app shows a bach piece composed using beeps,

i was wondering if there is a way to compose with samples using play_pattern_timed [note, note, note], [rest time]?

I wanted to see if i could make movie compositions on sonic pi, although vst is not supported for high quality sounds.

I see. I had thought that you were hinting at some type of VST support or functionality, to compose/perform using a sampler, in the more familiar DAW model. So the answer to your central question is yes you can - kind of. But the composition and performance model is slightly different to the more common DAW model (add a midi track, drop a sampler on the track, play notes). In Sonic Pi - afaik - you can’t combine sample playback with the play_pattern_timed function, but you can do it yourself.

The play function is for triggering Sonic Pi’s internal synths, as is play_pattern_timed, but they both work in essentially the same way - a list of pitches and a companion list of sleep values. Therefore, to use the sample function in Sonic Pi would just mean that you would have ‘roll your own’ version of play_pattern_timed; there is currently no such function as sample_pattern_timed :wink: .

If you prefer to use an external DAW or synth, MIDI is very well implemented and supported in Sonic Pi, you can find lots of examples and tutorials on sending MIDI to another software/hardware synth in this forum, within the Sonic Pi tutorial (see 11.2), and on youtube.

I’m afraid I make almost no use of midi out functionality (currently) in Sonic Pi, so apologies if any of the foregoing contains minor errata.

Anyway, this is how I would compose a melody using a sample, solely within Sonic Pi:

define :sampla do |trsp|
  sample :guit_harmonics, onset: 6, rpitch: trsp
end

/'roll your own' play_pattern_timed/
8.times do
  tick
  sampla [0,-12].look
  sampla [0,2,4,5,7,9,11,12].look
  sleep [0.5, 1].look
end

PD-Pi

1 Like

thank you so much, PD-Pi, This is what i was looking for.

1 Like