Class: Fet::Generator::Listening

Inherits:
Object
  • Object
show all
Defined in:
lib/fet/generator/listening.rb

Overview

Class that generates MIDI files for the listening exercises

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(exercises:, tempo:, degrees:, all_single_degree:) ⇒ Listening

The reason number of exercises is required is because the actual number generated is quite large For three degrees, it’s something like 88C3, but a bit smaller because one you choose 1, you actually exclude some of the 88 other than just itself (i.e. if you chose the b2 degree, you exclude the rest of the b2 degrees too) 2 degrees => 21592 (left it for a while and it seemed to stop at this value) - comparable to 64C2 * 12 = 24192 3 degrees => 252398 (before I stopped it, there was more being generated)



12
13
14
15
16
17
18
# File 'lib/fet/generator/listening.rb', line 12

def initialize(exercises:, tempo:, degrees:, all_single_degree:)
  self.number_of_exercises = exercises
  self.all_single_degree = all_single_degree
  self.tempo = tempo
  self.number_of_degrees = degrees
  self.note_range = Fet::REDUCED_BY_OCTAVE_PIANO_RANGE
end

Class Method Details

.directory_prefixObject

NOTE: this is explicitly changed in tests, so no need to check for coverage :nocov:



22
23
24
# File 'lib/fet/generator/listening.rb', line 22

def self.directory_prefix
  return ""
end

Instance Method Details

#generateObject

:nocov:



27
28
29
# File 'lib/fet/generator/listening.rb', line 27

def generate
  all_single_degree ? generate_all_single_degree_exercises : generate_number_of_exercises
end