class Alda::Rest

A rest event. An Alda::EventContainer containing an Alda::Rest can be created using event list sugar. See Alda::EventList#method_missing.

When using event list sugar, its duration can be specified just like that of Alda::Note.

Alda::Score.new do
  piano_ c8 r4 c8 r4 c4
end

Attributes

duration[RW]

The string representing a duration.

Public Class Methods

new(duration) → Alda::Rest click to toggle source

Creates an Alda::Rest.

Underlines “_” in duration will be converted to tildes “~”.

# File lib/alda-rb/event.rb, line 465
def initialize duration
  @duration = duration.to_s.tr ?_, ?~
end

Public Instance Methods

to_alda_code() click to toggle source
# File lib/alda-rb/event.rb, line 469
def to_alda_code
  ?r + @duration
end