With [path_to_file] substituted for the actual filepath to the .wav file (which plays perfectly fine on my computer). However this does not produce any sound, although no errors are displayed. Additionally the code does not terminate, even though I would expect it to stop after the duration of the sample.
Thanks for responding! Strangely enough it’s working now after I copy pasted your code. The most likely explanation is probably that I was typing something wrong without realising. Not sure what that was about, but in any case I’m running v4.3.0 on Windows 10.
I had an issue where Sonic Pi would not play samples from a sample library. So giving the path to the directory and trying to play random ones using sample path_to_sample_folder, pick didn’t work. But after I played a sample from that same directory with sample path_to_sample_in_that_folder, which did work, the random sample bit started working. Was driving me nuts as it was working the day before and I wanted to get something done. Now that I see this thread I tried to reproduce it but it just works now.
Another trick you can try (if you haven’t already) is to open the finder window and drag the file right into the Sonic Pi IDE. This will automatically give you the file directory path with having to type anything which avoids making the mistakes of trying to type it out manually.