What is the meaning of "line x, y, steps:Z"

Hi, I am Agus and I am new to Sonic Pi.
Is there anybody here who can tell me the meaning of

  1. line x, y, steps: z
  2. (line 0.25, 1, steps: 100).reflect
  3. (line -0.85, 0.85, steps: 100).tick

Where can I get a documentation of this line command?

Thank you.

Hello @Aguscao :slightly_smiling_face: Welcome to in_thread!

Where can I get a documentation of this line command?

These and all of the other built in functions are described in a language reference (titled ‘Lang’) in the app itself, in the Help panel. You can find this in several ways:

  • through the top menu bar under View > Show Help
  • through the keyboard shortcut, Meta-I (Meta being Alt on Windows or Linux, Cmd on Mac)
  • toggling the button in Sonic Pi’s button toolbar below the main menu.
    (Furthermore, if you are typing/navigating around the text in the editor and the cursor is on one of the Sonic Pi function names, (or synths, fx etc) you can hit Control-I and it will show help about that particular keyword directly).

So, you could move your cursor over the line command and hit Control-I, and the documentation for it will be shown. Have a read of that - and if you still have further questions, I’m sure someone would be able to help explain it :slightly_smiling_face:

1 Like

Oh, OK, I’ve found it, thank you.
I am sure I have read this documentation several times, but never found this one.

Thanks again


live_loop :differenceBetweenRangeAndLine do
  withRange = (range 0, 10,  step: 1, inclusive: true).tick
  puts withRange
  # step : the value added each tick
  withLine = (line 0, 10,  steps: 3, inclusive: true).tick("line")
  # steps describes the number of step to reach the end value
  puts withLine
  sleep 1

no entry for reflect in the langage section ?.

an example to use reflect

live_loop :up_down_amp do
  use_synth :piano
  r3 =  (line 0, 1, steps: 20, inclusive: true).reflect
  foo =  r3.length-1
  with_fx :echo, mix: 0.15 do
    play (scale :c4, :ahirbhairav, num_octaves: 2).reflect.tick("n"), amp: r3[0..foo].tick, sustain: 0.2
    sleep 0.1

Thanks everyone, I have actually found the information I need in the help section of the program. Maybe I missed them somehow when I read it before, but now I have found it.

Thanks a lot.