Help...Thread death? (SOLVED - incorrect audio file encoding)

what does the warning at the bottom mean?

Two suggestions:
First, try to learn how to post complete code here in the forum (not screenshots).
Second, try playing your hi hats resource file in a separate tab, just once. If that works, do more complicated stuff

1 Like

EDIT: that stacktrace was pointing to a Sonic Pi file

Thread death happens when an error occurs within a thread (be it enclosed in a live_loop or in_thread) that causes the thread to fail. We can see from your error message that some type of Exception was thrown. Furthermore, if we look at the stack trace (the text below the error message), it looks like the error occurred somewhere in the vicinity of line 67.

As @Nechoj suggested, it’d help if you posted at least the code in the block starting from line 67. You can do that by posting your code with enclosing backticks like so:

```
[your code]
```

E.g.

puts "Hello world"

Learning to read the stack trace will help you fix things on your own once you advance beyond the tutorial.

#Written by Sam Humphreys

#Setting BPM to 70
use_bpm 70

#Make variables for the drums
clap = "/Users/samhumphreys/Library/Mobile Documents/com~apple~CloudDocs/Logic Pro X/Music Plug-Ins/Cymatics/Cymatics - Drill Essential Drum Kit/Drum One Shots/Claps/Cymatics - Wake Clap.wav"
hi_hats = "/Users/samhumphreys/Library/Mobile Documents/com~apple~CloudDocs/Logic Pro X/Hi hat loop for Sonic Pi.wav"

live_loop :habanera do
  use_synth :fm
  use_transpose -12
  play (ring :d, :r, :r, :a, :f5, :r, :a, :r).tick
  sleep 0.25
end

with_fx :reverb do
  live_loop :space_light do
    with_fx :slicer, phase: 0.25 do
      synth :blade, note: :d, release: 8, cutoff: 100, amp: 2
    end
    sleep 8
  end
end

sleep 17

in_thread do
  loop do
    sample clap
    sleep 2
  end
end

sleep 17

loop do
  sample hi_hats
  sleep 8
end

I think the problem has to do with your custom samples. Try using a Sonic Pi sample to confirm this. Then make sure your path and the file are all in order.

1 Like

The code works without errors, if we replace the clap and hi_hats resource by an internal sample. So the problem seems to be your path to the local files, or the local files themselves. As said above, try to play those files only once:

hi_hats = "/Users/samhumphreys/Library/Mobile Documents/com~apple~CloudDocs/Logic Pro X/Hi hat loop for Sonic Pi.wav"
sample hi_hats
1 Like

this didn’t work unfortunately :frowning:

Now you know where the problem is …

2 Likes

so the file is somehow broken, or the path is wrong?

Exactly :slightly_smiling_face:

I fixed it by changing the wave file to an aiff file, and moving it from my iCloud drive

2 Likes

Excellent! If you could ascertain which was the fix (.aiff, moving it from iCloud, or both), then it could be useful knowledge to share here (if someone hasn’t posted about it before).

2 Likes

it’ll be moving it from my iCloud Drive, because the other audio file I have is a wave file.

1 Like

Maybe you can edit the topic of this thread to let people know what problem has been solved? Something like 'Cannot play sample files directly from iCloud …`or something. The current topic ‘Thread death’ doesn’t tell much.

1 Like

@Future - It would be handy for reference to know what the rest of that error message said originally if you can post that too - not the full stack trace, just the error message (the screen shot only shows part of it) :slightly_smiling_face:

2 Likes

it’s a bit weird. i would bet for a path issue maybe the spaces into the path no ?

1 Like

its happening again with my baseline. I made an 8 bar bass line using Logic Pro, and bounced it out. It is now an aiff file, not in my iCloud Drive, and its saying the same error.

hey you know what ? we really need you to copy / paste the code you are using to help you and to fix if needed conclude there is a bug. Without Your code, we are wasting time, you and us :slight_smile:
so pleaaaaaasssse your code @future ?

1 Like
# Written by Sam Humphreys

# Setting BPM to 70
use_bpm 70

# Make variables for the drums

# The clap is a single one-shot hit, that I repeat every two seconds on line 41
clap = "/Users/samhumphreys/Library/Mobile Documents/com~apple~CloudDocs/Logic Pro X/Music Plug-Ins/Cymatics/Cymatics - Drill Essential Drum Kit/Drum One Shots/Claps/Cymatics - Wake Clap.wav"

# The hi hats is a loop that I created on Logic Pro, and then bounced out as a .aif file.
# I made the loop on Logic because I thought it would be too hard to make a good
# sounding hi hat loop on Sonic Pi because of my experience with it (absolutely zero).
hi_hats = "/Users/samhumphreys/Library/Mobile Documents/com~apple~CloudDocs/2020/2021/Te Kura/Music/Sonic Pi/Hi hat loop for Sonic Pi.aif"

# The 808 is another loop I made on Logic, for the same reason as the hi hat loop. The 808s are
# way to complicated to make in Sonic Pi for someone with my knowledge of Ruby and Sonic Pi.
bass  = "/Users/samhumphreys/Library/Mobile Documents/com~apple~CloudDocs/2020/2021/Te Kura/Music/Sonic Pi/808 loop for Sonic Pi.aif"

live_loop :habanera do
  use_synth :fm
  use_transpose -12
  play (ring :d, :r, :r, :a, :f5, :r, :a, :r).tick
  sleep 0.25
end

with_fx :reverb do
  live_loop :space_light do
    with_fx :slicer, phase: 0.25 do
      synth :blade, note: :d, release: 8, cutoff: 100, amp: 2
    end
    sleep 8
  end
end

sleep 17

in_thread do
  loop do
    sample clap
    sleep 2
  end
end

in_thread do
  loop do
    sample bass
    sleep 8
  end
end

sleep 15

loop do
  sample hi_hats
  sleep 16
end

ya sure sorry

Thanks !
So put your sample into a folder where there is no space into the path

1 Like