Skip to content

Commit 21fcf2a

Browse files
committed
Core - new fn octs - a ring of successive octaves
1 parent 0d6d828 commit 21fcf2a

File tree

1 file changed

+20
-0
lines changed
  • app/server/sonicpi/lib/sonicpi/lang

1 file changed

+20
-0
lines changed

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,26 @@ def line(start, finish, *args)
585585

586586

587587

588+
def octs(start, num_octs=1)
589+
a = []
590+
num_octs.times do |i|
591+
a << (note(start) + (12 * i))
592+
end
593+
a.ring
594+
end
595+
doc name: :octs,
596+
introduced: Version.new(2,8,0),
597+
summary: "Create a ring of octaves",
598+
args: [[:start, :note], [:num_octaves, :pos_int]],
599+
returns: :ring,
600+
opts: nil,
601+
accepts_block: false,
602+
doc: "Create a ring of successive octaves starting at `start` for `num_octaves`. ",
603+
examples: [
604+
"(octs 60, 2) #=> (ring 60, 72)",
605+
"(octs :e3, 3) #=> (ring 52, 64, 76)"
606+
]
607+
588608
def vector(*args)
589609
SonicPi::Core::SPVector.new(args)
590610
end

0 commit comments

Comments
 (0)