[Solved] - SonicPi refuses to play sample named il-macquillage-lady.wav as a function parameter v3.2.2

I was playing around with https://aimxhaisse.com/aerodynamic-en.html when I stumbled upon the following really strange issue:

param = "il-macquillage-lady.wav"
param1 = "il-macquillage-lade.wav"

define :play_sample do |what|
  puts what
  sample what, beat_stretch: 16, start: 0, finish: 1
end

play_sample(param1)
sleep 10
play_sample(param)

This code will play a file named "il-macquillage-lade.wav" but will not play "il-macquillage-lady.wav" but throw the following error:

Runtime Error: [buffer 1, line 5] - RuntimeError
Thread death!
Unknown sample description: nil
expected a string containing a path

However the puts statement does its work:

=> Starting run 66
=> Redefining fn :play_sample
{run: 66, time: 0.0}
 ├─ "il-macquillage-lade.wav"
 └─ sample "~",
             "il-macquillage-lade.wav", {beat_stretch: 16, start: 0, finish: 1, rate: 0.4881}

{run: 66, time: 10.0}
 └─ "il-macquillage-lady.wav"
 
=> Completed run 66
=> All runs completed
=> Pausing SuperCollider Audio Server

Of course both files exist, sample param will play "il-macquillage-lady.wav".
This doesn’t seem to occur with other file names as far as I tried.
Also the content of "il-macquillage-lady.wav" doesn’t matter I also tried renaming another .wav and same behaviour, so this is not related to the file itself.

I’m totally baffled and hope someone can reproduce or even track down this.

Hi

Do you have renamed your external file ?
You need to reboot sonic pi.
May it helps

I just rebooted SonicPi, now it works.
But why is that? That it can’t find files added after program start, but only sometimes?
Thanks however.

There is a cache system there’s a sampleasure free instruction to clear this cache. Have a look at help

1 Like

btw is there any possibility to mark a topic as solved?

It is to do with SP caching folder of samples when it reads them. If you change a file it may not notice.
You can use the command
sample_free_all
before using a changed or added sample name, but you may have to put a sleep after it to allow it to clear the cache and reread. If you dont’ it may not respond in time.

1 Like

Yep edit the subject of your topic via the pencil :blush: