Unexpected integer literal

I get the following errors in a define I thought would be relatively simple… what am I doing wrong please?

 workspace_zero:109: syntax error, unexpected integer literal, expecting literal content or terminator or tSTRING_DBEG or tSTRING_DVAR
  define :911 do |speed|
          ^~~
workspace_zero:110: syntax error, unexpected string literal, expecting `do' or '{' or '('
    sample "C:/911/911.wav", start: 0, fi...
           ^
workspace_zero:110: syntax error, unexpected ',', expecting end-of-input
    sample "C:/911/911.wav", start: 0, finish: 0.375, rat...

Code is as follows:

  define :911 do |speed|
    sample "C:/911/911.wav", start: 0, finish: 0.375, rate: speed
    sleep 0.1
  end
  
  define :whats_your do |speed=1|
    
    sample "C:/911/911.wav", start: 0.375, finish: 0.640, rate: speed
    sleep 0.1
  end
  
  define :emergency do |speed=1, len=2|
    sample "C:/911/911.wav", start: 0.640, finish: 1, rate: speed, beat_stretch: len
    sleep 0.1
  end

Thanks,

Eli…

EDIT: Oh… seems you cant have numbers in define titles? so :911 bad, :nineoneone good … ?

Correct, but there’s a little more to it. Symbols (such as :911) cannot start with numbers - and the usual way of creating functions with define is by naming it with a symbol :slightly_smiling_face:

1 Like

same error with
live_loop :911 do

Always the little things that catch you out…

Still, now it works, I can simply do

nineoneone 1
sleep 1
nineoneone 0.75
sleep 1
nineoneone 0.5

And get that nice slow-down effect…

911 … 9 1 1… 9999 1111 1111

Bit difficult to visualise as text maybe, but
you know what I mean. :slight_smile:

Eli…

1 Like

Yes indeed, it’s the same problem :slightly_smiling_face: