Class: Fet::Generator::SingleNoteListening
- Inherits:
-
Object
- Object
- Fet::Generator::SingleNoteListening
- Defined in:
- lib/fet/generator/single_note_listening.rb
Overview
Class that generates MIDI files for the single note listening exercises
Class Method Summary collapse
-
.directory_prefix ⇒ Object
NOTE: this is explicitly changed in tests, so no need to check for coverage :nocov:.
Instance Method Summary collapse
-
#generate ⇒ Object
:nocov:.
-
#initialize(tempo:) ⇒ SingleNoteListening
constructor
A new instance of SingleNoteListening.
Constructor Details
#initialize(tempo:) ⇒ SingleNoteListening
Returns a new instance of SingleNoteListening.
7 8 9 10 11 12 |
# File 'lib/fet/generator/single_note_listening.rb', line 7 def initialize(tempo:) self.tempo = tempo self.note = Fet::Note.new("C") self.octave_value = 4 self.midi_value = MidiNote.from_note(note.full_note, octave_value).midi_value end |
Class Method Details
.directory_prefix ⇒ Object
NOTE: this is explicitly changed in tests, so no need to check for coverage :nocov:
16 17 18 |
# File 'lib/fet/generator/single_note_listening.rb', line 16 def self.directory_prefix return "" end |
Instance Method Details
#generate ⇒ Object
:nocov:
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/fet/generator/single_note_listening.rb', line 21 def generate MusicTheory::MAJOR_KEYS.each do |root_note_name| root_midi_value = MAJOR_ROOT_MIDI_VALUES[root_note_name] create_midi_file("major", root_note_name, root_midi_value) end MusicTheory::MINOR_KEYS.each do |root_note_name| root_midi_value = MINOR_ROOT_MIDI_VALUES[root_note_name] create_midi_file("minor", root_note_name, root_midi_value) end end |