Skip to content

Commit 511c702

Browse files
authored
Merge pull request #2876 from owenniblock/feat/add-with-swing-examples
adds examples to with_swing and corrects existing examples
2 parents f1557a1 + 2304ac1 commit 511c702

File tree

1 file changed

+23
-6
lines changed
  • app/server/ruby/lib/sonicpi/lang

1 file changed

+23
-6
lines changed

app/server/ruby/lib/sonicpi/lang/core.rb

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ def with_swing(*args, &blk)
407407
examples: ["
408408
live_loop :foo do
409409
with_swing 0.1 do
410-
sample :elec_beep # plays the :elec_beep sample late except for every 4th time
410+
sample :elec_beep # plays the :elec_beep sample late except on the 1st beat of every 4
411411
end
412412
sleep 0.25
413413
end
@@ -416,15 +416,15 @@ def with_swing(*args, &blk)
416416
live_loop :foo do
417417
with_swing -0.1 do
418418
sample :elec_beep # plays the :elec_beep sample slightly early
419-
end # except for every 4th time
419+
end # on the 1st beat of every 4
420420
sleep 0.25
421421
end
422422
",
423423
"
424424
live_loop :foo do
425425
with_swing -0.1, pulse: 8 do
426426
sample :elec_beep # plays the :elec_beep sample slightly early
427-
end # except for every 8th time
427+
end # on the 1st beat of every 8
428428
sleep 0.25
429429
end
430430
",
@@ -434,11 +434,11 @@ def with_swing(*args, &blk)
434434
live_loop :foo do
435435
with_swing 0.14, tick: :a do
436436
sample :elec_beep # plays the :elec_beep sample slightly late
437-
end # except for every 4th time
437+
end # on the 1st beat of every 4
438438
439439
with_swing -0.1, tick: :b do
440440
sample :elec_beep, rate: 2 # plays the :elec_beep sample at double rate
441-
end # slightly early except for every 4th time
441+
end # slightly early except on the 1st beat of every 4
442442
sleep 0.25
443443
end",
444444
"
@@ -455,7 +455,24 @@ def with_swing(*args, &blk)
455455
# another live loop (sync will match the timing and clock of
456456
# the sending live loop)
457457
end
458-
" ]
458+
",
459+
"
460+
live_loop :foo do
461+
with_swing 0.1, offset: 2 do
462+
sample :elec_beep # plays the :elec_beep sample slightly late
463+
end # on the the 3rd beat of every 4
464+
sleep 0.25
465+
end
466+
",
467+
"
468+
live_loop :foo do
469+
with_swing 0.1, pulse: 2, offset: 1 do
470+
sample :elec_beep # plays the :elec_beep sample slightly late
471+
end # on the 2nd beat of every 2
472+
sleep 0.25
473+
end
474+
"
475+
]
459476

460477

461478

0 commit comments

Comments
 (0)