Class: Musicality::LilypondSettings

Inherits:
Object
  • Object
show all
Includes:
Packable
Defined in:
lib/musicality/printing/lilypond/lilypond_settings.rb

Constant Summary collapse

ACOUSTIC_GRAND_PIANO =
LilypondSettings.treble_bass("Acoustic Grand Piano")
BRIGHT_ACOUSTIC_PIANO =
LilypondSettings.treble_bass("Bright Acoustic Piano")
ELECTRIC_GRAND_PIANO =
LilypondSettings.treble_bass("Electric Grand Piano")
HONKY_TONK_PIANO =
LilypondSettings.treble_bass("Honky Tonk Piano")
ELECTRIC_PIANO =
LilypondSettings.treble_bass("Electric Piano")
HARPSICHORD =
LilypondSettings.treble_bass("Harpsichord")
CLAVINET =
LilypondSettings.treble_bass("Clavinet")
CELESTA =
LilypondSettings.treble_bass("Celesta", transpose_interval: -12)
GLOCKENSPIEL =
LilypondSettings.treble_bass("Glockenspiel", transpose_interval: -24)
MUSIC_BOX =
LilypondSettings.treble_bass("Music Box")
VIBRAPHONE =
LilypondSettings.treble_bass("Virbaphone")
MARIMBA =
LilypondSettings.treble_bass("Marimba")
XYLOPHONE =
LilypondSettings.treble_bass("Xylophone", transpose_interval: -12)
TUBULAR_BELLS =
LilypondSettings.treble_bass("Tubular Bells")
DULCIMER =
LilypondSettings.treble("Dulcimer")
DRAWBAR_ORGAN =
LilypondSettings.treble_bass("Drawbar Organ")
PERCUSSIVE_ORGAN =
LilypondSettings.treble_bass("Percussive Organ")
ROCK_ORGAN =
LilypondSettings.treble_bass("Rock Organ")
CHURCH_ORGAN =
LilypondSettings.treble_bass("Church Organ")
REED_ORGAN =
LilypondSettings.treble_bass("Reed Organ")
ACCORDIAN =
LilypondSettings.treble_bass("Accordion")
HARMONICA =
LilypondSettings.treble("Harmonica")
TANGO_ACCORDIAN =
LilypondSettings.treble_bass("Tango Accordion")
ACOUSTIC_GUITAR =
LilypondSettings.guitar('Acoustic Guitar')
ELECTRIC_GUITAR =
LilypondSettings.guitar('Electric Guitar')
OVERDRIVEN_GUITAR =
LilypondSettings.guitar('Overdriven Guitar')
DISTORTION_GUITAR =
LilypondSettings.guitar('Distortion Guitar')
GUITAR_HARMONICS =
LilypondSettings.guitar('Guitar Harmonics')
ACOUSTIC_BASS =
LilypondSettings.bass_guitar('Acoustic Bass')
ELECTRIC_BASS =
LilypondSettings.bass_guitar('Electric Bass')
FRETLESS_BASS =
LilypondSettings.bass_guitar('Fretless Bass')
SLAP_BASS =
LilypondSettings.bass_guitar('Slap Bass')
SYNTH_BASS =
LilypondSettings.bass_guitar('Synth Bass')
VIOLIN =
LilypondSettings.treble('Violin')
VIOLA =
LilypondSettings.new('Viola', clefs: [Clef::TREBLE, Clef::ALTO])
CELLO =
LilypondSettings.new('Cello', clefs: [Clef::BASS, Clef::TENOR])
CONTRABASS =
LilypondSettings.bass('Contrabass', transpose_interval: 12)
TREMOLO_STRINGS =
LilypondSettings.treble_bass('Tremolo Strings')
PIZZICATO_STRINGS =
LilypondSettings.treble_bass('Pizzicato Strings')
ORCHESTRAL_HARP =
LilypondSettings.treble_bass('Orchestral Harp')
TIMPANI =
LilypondSettings.bass('Timpani')
STRING_ENSEMBLE =
LilypondSettings.treble_bass('String Ensemble')
TRUMPET =
LilypondSettings.treble('Trumpet', transpose_interval: 2)
TROMBONE =
LilypondSettings.new('Trombone', clefs: [Clef::BASS, Clef::TENOR])
TUBA =
LilypondSettings.bass('Tuba')
FRENCH_HORN =
LilypondSettings.bass('French Horn')
SOPRANO_SAX =
LilypondSettings.treble('Soprano Sax', transpose_interval: 2)
ALTO_SAX =
LilypondSettings.treble('Alto Sax', transpose_interval: 9)
TENOR_SAX =
LilypondSettings.treble('Tenor Sax', transpose_interval: 14)
BARITONE_SAX =
LilypondSettings.treble('Baritone Sax', transpose_interval: 21)
OBOE =
LilypondSettings.treble('Oboe')
ENGLISH_HORN =
LilypondSettings.treble('English Horn', transpose_interval: 7)
BASSOON =
LilypondSettings.bass('Bassoon')
CLARINET =
LilypondSettings.treble('Clarinet', transpose_interval: 2)
PICCOLO =
LilypondSettings.treble('Piccolo', transpose_interval: -12)

Constants included from Packable

Packable::PACKED_CLASS_KEY

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Packable

#class_str, included, #init_params, #pack, pack_val, recover_class, unpack_val

Constructor Details

#initialize(instrument_name, clefs: [Clef::TREBLE, Clef::BASS], transpose_interval: 0) ⇒ LilypondSettings

Returns a new instance of LilypondSettings.

Raises:

  • (ArgumentError)


8
9
10
11
12
13
# File 'lib/musicality/printing/lilypond/lilypond_settings.rb', line 8

def initialize instrument_name, clefs: [Clef::TREBLE, Clef::BASS], transpose_interval: 0
  raise ArgumentError unless (clefs & CLEFS) == clefs
  @instrument_name = instrument_name
  @clefs = clefs
  @transpose_interval = transpose_interval
end

Instance Attribute Details

#clefsObject (readonly)

Returns the value of attribute clefs.



6
7
8
# File 'lib/musicality/printing/lilypond/lilypond_settings.rb', line 6

def clefs
  @clefs
end

#instrument_nameObject (readonly)

Returns the value of attribute instrument_name.



6
7
8
# File 'lib/musicality/printing/lilypond/lilypond_settings.rb', line 6

def instrument_name
  @instrument_name
end

#transpose_intervalObject (readonly)

Returns the value of attribute transpose_interval.



6
7
8
# File 'lib/musicality/printing/lilypond/lilypond_settings.rb', line 6

def transpose_interval
  @transpose_interval
end

Class Method Details

.bass(instrument_name, transpose_interval: 0) ⇒ Object



23
24
25
# File 'lib/musicality/printing/lilypond/lilypond_settings.rb', line 23

def self.bass(instrument_name, transpose_interval: 0)
  new(instrument_name, clefs: [Clef::BASS], transpose_interval: transpose_interval)
end

.bass_guitar(instrument_name) ⇒ Object



31
32
33
# File 'lib/musicality/printing/lilypond/lilypond_settings.rb', line 31

def self.bass_guitar(instrument_name)
  new(instrument_name, clefs: [Clef::BASS], transpose_interval: 12)
end

.guitar(instrument_name) ⇒ Object



27
28
29
# File 'lib/musicality/printing/lilypond/lilypond_settings.rb', line 27

def self.guitar(instrument_name)
  new(instrument_name, clefs: [Clef::TENOR], transpose_interval: 12)
end

.treble(instrument_name, transpose_interval: 0) ⇒ Object



19
20
21
# File 'lib/musicality/printing/lilypond/lilypond_settings.rb', line 19

def self.treble(instrument_name, transpose_interval: 0)
  new(instrument_name, clefs: [Clef::TREBLE], transpose_interval: transpose_interval)
end

.treble_bass(instrument_name, transpose_interval: 0) ⇒ Object



15
16
17
# File 'lib/musicality/printing/lilypond/lilypond_settings.rb', line 15

def self.treble_bass(instrument_name, transpose_interval: 0)
  new(instrument_name, clefs: [Clef::TREBLE, Clef::BASS], transpose_interval: transpose_interval)
end