Thread dead error message

I get the following message when running my code on Raspberry PI. It worked on MacOs though.

Code:
use_osc “localhost”,4560 #address where osc messages will be sent

#test live_loop to send osc messages
#live_loop :test do
#  osc "/trigger/prophet",(ring 1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0).tick
#  sleep 1
#end

use_debug true
use_osc_logging false


live_loop :playsample do
  use_real_time #gives faster realtime response
  a = sync "/osc*/trigger/prophet"
  
  case a[0]
  when 1.0
    sample /home/pi/samples/bird1.wav
  when 2.0
    sample /home/pi/samples/bird1.wav
  when 3.0
    sample /home/pi/samples/bird1.wav
  when 4.0
    sample /home/pi/samples/bird4.wav
  when 5.0
    sample /home/pi/samples/bird5.wav
  when 6.0
    sample /home/pi/samples/bird6.wav
  when 7.0
    sample /home/pi/samples/bird7.wav
  else
    puts "error"
  end
end

ERROR:

Runtime Error: [buffer 0, line 781] - SyntaxError
Thread death!
 workspace_zero:19: unknown regexp option - p
workspace_zero:21: unknown regexp option - p
workspace_zero:23: unknown regexp option - p
workspace_zero:25: unknown regexp option - p
workspace_zero:27: unknown regexp option - p
workspace_zero:29: unknown regexp option - p
workspace_zero:31: unknown regexp option - p
/opt/sonic-pi/app/server/ruby/lib/sonicpi/runtime.rb:781:in `eval'
/opt/sonic-pi/app/server/ruby/lib/sonicpi/runtime.rb:781:in `block (2 levels) in __spider_eval'
/opt/sonic-pi/app/server/ruby/lib/sonicpi/runtime.rb:1042:in `block (2 levels) in __in_thread'

Hi @dewildequinten,

One thing is obvious which will need some revision: SP will not be able to resolve you sample references. I am quite sure that this is what SP tries to tell: sample tries to read your unquoted path string as a regex but fails to resolve that for obvious reasons.

There are multiple ways to do it, so here is one possible and easy solution:

path = "/home/pi/samples/"

case a[0]
  when 1.0
    sample path, "bird1"
    # and so on ...

Hi I indeed got rid of the error message. Despite the path being correct and there being file in there I can’t seem to get the files to play. It says no match founding, skipping

You can add " at the beginning and at the end to get a string.

You can drop the file with your mouse from your folder to spi buffer

You have to restart sonic pi if you have changed the bird1.wav name.

I found the error! my wav files were corrupt…