Module: Mass

Defined in:
lib/mass.rb,
lib/mass/note.rb,
lib/mass/pitch.rb,
lib/mass/pattern.rb,
lib/mass/version.rb,
lib/mass/pitch/not_found.rb

Overview

:nodoc:

Defined Under Namespace

Classes: Note, Pattern, Pitch

Constant Summary collapse

VERSION =

Version number

'0.0.1'

Class Method Summary collapse

Class Method Details

.bpm(new_bpm) ⇒ Object

Change BPM of the track.

Examples:

require 'mass'
include Mass

bpm 128


26
27
28
# File 'lib/mass.rb', line 26

def bpm(new_bpm)
  @current_bpm = new_bpm
end

.current_bpmInteger

The current BPM of this track. Defaults to 100.



14
15
16
# File 'lib/mass.rb', line 14

def current_bpm
  @current_bpm ||= 100
end

.pattern(**params, &block) ⇒ Object

Create a pattern in Mass.

Examples:

require 'mass'
include Mass

pattern name: 'verse', bars: 1 do
  note 8, pitch: 'C4'
  note 8, pitch: 'C3'
  note 8, pitch: 'A3'
  note 8, pitch: 'B4'
  note 8, pitch: 'C4'
  note 8, pitch: 'Gb2'
  note 8, pitch: 'C4'
  rest 8
end


47
48
49
# File 'lib/mass.rb', line 47

def pattern(**params, &block)
  Pattern.create(**params, &block)
end