Sonic-pi: importing samples

Created on 29 Jun 2014  Â·  15Comments  Â·  Source: sonic-pi-net/sonic-pi

Is it possible that additional samples can be added to the existing Sonic Pi structure, I have tried this in a small way by placing them in the samples directory in etc, whilst this is effective it does not get listed in the help tabs, so constant vigilance is required when referencing sample names used.

If there is a means to import samples not directly supported by Sonic pi could someone please enlighten me as to how? I do think I would like or prefer to be able to reference these samples from a different directory than the ones Sonic Pi uses both to keep separate and so I manage into categories and not have to maintain an open file manager that lists only the sample file names.

Most helpful comment

Nope, no need to restart the app. Just put reboot in a buffer and hit the run button - it will restart the audio server and also refresh all the caches :-)

Sam

On 9 Nov 2016, at 20:21, srdjan-m [email protected] wrote:

I am experimenting with spoken words as samples. I edit sentences in an external audio editing program and save the changes into the samples folder. Usually, it takes a lot of editing and jumping betwen Sonic Pi and audio editor. Restarting of Sonic Pi slows down the process significantly...But it's not the end of the world :-)

"Issuing a call to rebot" means to quit and to start the program again. Right?

Thanks for this great app.

—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub, or mute the thread.

All 15 comments

Hi there @soslug,

Sonic Pi already supports all this and more - it's just not yet fully documented (which will be completed before the final release).

To use other samples not included by default, the easiest thing to do is to use the full path:

sample "/home/pi/my-samples/bang.wav"

If you have a lot of samples in a specific directory you can use use_sample_pack and then reference the wav/aif files using keywords (omitting the extension):

use_sample_pack "/home/pi/my-samples"
sample :bang 
sample :kazhing 

Of course, you can use with_sample_pack to encapsulate this behaviour in a specific lexical block:

with_sample_pack "/home/pi/my-samples" do
  sample :bang 
  sample :kazhing
end 

sample :drum_heavy_kick # back to built in samples

There are other cool related things which will be part of RC12 and the final release which will be documented in that release. These will allow you create prefixes for sample directories allowing you to reference and play samples from multiple source directories.

Thats how you do it thanks Sam i'll play some more, thanks

could with_sample_pack also support URL's e.g.

with_sample_pack http://my.server.com/path/to/my/sample/pack

this would make it possible to share pi files with custom packs.

On a Windows system, you have to use ' instead of "
Like 'C:\Users\bla\samples\'
otherwise there will be errrors

When I do this on my mac I get "no match found, skipping"
Using -
use_sample_pack "/Documents/SoundLibrary"
sample :Double_Octive_Cinema

but no matter which version I use I get the same message.

Is the path "/Documents..." Or "~/Documents..."

"/Documents...

OK, yes, this is definitely a bug in Sonic Pi.

However, there's now a much nicer API for working with samples. Check out section 3.7 of the tutorial:

d = "/Documents/SoundLibrary"
sample d, :Double_Octive_Cinema

For future record use_sample_pack has been officially deprecated in v2.11: c2cae0d

Thank you so much that worked! Can you also use custom samples as custom synths?

I've noticed that Sonic Pi must be restarted in order to refresh updated samples in the samples_dir folder. Is it possible to refresh the samples on Run instead of app startup only?
Thanks
(OSX version)

Hi there,

Sonic Pi caches the result of searching a directory for samples in order to not have to check the file system on every sample trigger. This is an optimisation that I’m currently happy with. However, I’m also interested to find out more about your use case that involves updating the samples in a given directory. Do you do this often? Could you explain what you’re doing and what the technique offers musically?

Right now, you should be able to get away with issuing a call to reboot - that should clear the cache.

Sam

On 8 Nov 2016, at 18:21, srdjan-m [email protected] wrote:

I've noticed that Sonic Pi must be restarted in order to refresh updated samples in the samples_dir folder. Is it possible to refresh the samples on Run instead of app startup only?
Thanks
(OSX version)

—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub, or mute the thread.

I am experimenting with spoken words as samples. I edit sentences in an external audio editing program and save the changes into the samples folder. Usually, it takes a lot of editing and jumping betwen Sonic Pi and audio editor. Restarting of Sonic Pi slows down the process significantly...But it's not the end of the world :-)

"Issuing a call to rebot" means to quit and to start the program again. Right?

Thanks for this great app.

Nope, no need to restart the app. Just put reboot in a buffer and hit the run button - it will restart the audio server and also refresh all the caches :-)

Sam

On 9 Nov 2016, at 20:21, srdjan-m [email protected] wrote:

I am experimenting with spoken words as samples. I edit sentences in an external audio editing program and save the changes into the samples folder. Usually, it takes a lot of editing and jumping betwen Sonic Pi and audio editor. Restarting of Sonic Pi slows down the process significantly...But it's not the end of the world :-)

"Issuing a call to rebot" means to quit and to start the program again. Right?

Thanks for this great app.

—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub, or mute the thread.

Yes!
It works...
:-)
Thank you

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MoiRouhs picture MoiRouhs  Â·  3Comments

sbeaumont picture sbeaumont  Â·  3Comments

emlyn picture emlyn  Â·  7Comments

josephwilk picture josephwilk  Â·  3Comments

AlexandreRangel picture AlexandreRangel  Â·  7Comments