Live coding is not working

Live coding doesn’t work for me in any way. nothing happens when i change numbers, values, etc.
i even used the code example from the tutorial but nothing happens when i change anything while the code runs.
Does anyone know what might be the cause?

From the tutorials:

define :my_sound do
  play 50
  sleep 1

in_thread(name: :looper) do
  loop do

Do you run the code again after you change it? You need to press Run (or Cmd/Ctrl + R) for the new code to take effect.

Note that instead of a function plus a named thread, you can just use a live_loop which does the same thing in less code.

1 Like

(Psst… I think you mean ‘instead of a loop plus a named thread’?) :slight_smile:
… Oh, and that’s Cmd/Alt + R :wink: (depending on platform of course)

1 Like

Well, a named thread, a loop and a function. The thread won’t be redefined on the next run, so the function is necessary so that the code can be changed in the still running thread.

And oops, thanks for the correction, I’ve only used the Mac version recently and forgot the modifier on other platforms.

1 Like

Hello Squarewave. In order to make a changeable loop, you need to use a live loop instead of a single loop. The single loop runs forever and never changes. You can read about them in section 9.2 in the built-in tutorial. Live loops are pretty much the foundation of live coding, since they get redefined whenever you hit play.