Пример #1
0
def make_handlers(instrument, materials):
    """Creates guitar handlers from materials packages."""
    stages = tuple(range(7))

    # music makers
    picking_music_maker = MusicMaker(
        stages=stages,
        instrument=instrument,
        name='Picking',
        time_signatures=time_signatures,
        rhythm_makers=materials.picking.rhythm_makers)

    fretting_music_maker = MusicMaker(
        stages=stages,
        instrument=instrument,
        name='Fretting',
        time_signatures=time_signatures,
        rhythm_makers=materials.fretting.rhythm_makers)

    # music handlers
    picking_music_handler = PickingHandler(
        music_maker=picking_music_maker,
        position_envelopes=materials.picking.envelopes.position,
        force_envelopes=materials.picking.envelopes.force,
        string_index_patterns=materials.picking.patterns.string_index,
        tremolo_patterns=materials.picking.patterns.tremolo,
    )

    fretting_music_handler = GuitarFrettingHandler(
        music_maker=fretting_music_maker,
        fret_combinations=materials.fretting.fret_combinations,
        fret_combination_patterns=materials.fretting.patterns.fret_combination,
    )

    return [picking_music_handler, fretting_music_handler]
Пример #2
0
def make_handlers(instrument, materials):
    """Creates guitar handlers from materials packages."""
    stages = tuple(range(5))
    # music handlers
    embouchure_music_maker = MusicMaker(
        stages=stages,
        instrument=instrument,
        name='Embouchure',
        time_signatures=time_signatures,
        rhythm_makers=materials.embouchure.rhythm_makers)

    lh_music_maker = MusicMaker(
        stages=stages,
        instrument=instrument,
        name='Left Hand Fingering',
        time_signatures=time_signatures,
        rhythm_makers=materials.left_hand.rhythm_makers)

    rh_music_maker = MusicMaker(
        stages=stages,
        instrument=instrument,
        name='Right Hand Fingering',
        time_signatures=time_signatures,
        rhythm_makers=materials.right_hand.rhythm_makers)

    # music handlers

    embouchure_music_handler = EmbouchureHandler(
        music_maker=embouchure_music_maker,
        air_pressure_envelope_patterns=materials.embouchure.patterns.
        air_pressure,
        air_pressure_envelopes=materials.embouchure.envelopes.air_pressure,
        air_pressure_envelopes_release=materials.embouchure.envelopes.
        air_pressure_release,
        lip_pressure_envelope_patterns=materials.embouchure.patterns.
        lip_pressure,
        lip_pressure_envelopes=materials.embouchure.envelopes.lip_pressure,
    )

    lh_fingering_music_handler = WoodwindFingeringHandler(
        music_maker=lh_music_maker,
        fingering_patterns=materials.right_hand.patterns.fingering,
        fingerings=materials.left_hand.fingerings,
        hand='left')

    rh_fingering_music_handler = WoodwindFingeringHandler(
        music_maker=rh_music_maker,
        fingering_patterns=materials.right_hand.patterns.fingering,
        fingerings=materials.right_hand.fingerings,
        hand='right')

    return [
        embouchure_music_handler, lh_fingering_music_handler,
        rh_fingering_music_handler
    ]
    def setUp(self):
        time_signatures = [[abjad.TimeSignature((4, 4))]]
        air_pressure_envelopes = [Path(BezierCurve((0, 0), (1, 1)))]
        lip_pressure_envelopes = [Path(BezierCurve((0, 1), (1, 0)))]
        wah_envelopes = [Path(BezierCurve((0, 1), (1, 0)))]
        consonant_patterns = [['t', None]]
        vowel_patterns = [['e', 'u']]
        fluttertongue_patterns = [[True, False]]
        direction_patterns = [['in', 'out']]
        staccato_patterns = [[True, False]]
        vibrato_patterns = [[False, True]]

        music_maker = MusicMaker(
            instrument=abjad.instrumenttools.Oboe(),
            name='Name',
            rhythm_makers=[abjad.rhythmmakertools.NoteRhythmMaker()],
            stages=[0],
            time_signatures=time_signatures
        )

        self.handler = TromboneEmbouchureHandler(
            music_maker=music_maker,
            air_pressure_envelopes=air_pressure_envelopes,
            lip_pressure_envelopes=lip_pressure_envelopes,
            wah_envelopes=wah_envelopes,
            consonant_patterns=consonant_patterns,
            vowel_patterns=vowel_patterns,
            fluttertongue_patterns=fluttertongue_patterns,
            direction_patterns=direction_patterns,
            staccato_patterns=staccato_patterns,
            vibrato_patterns=vibrato_patterns
        )
    def setUp(self):
        time_signatures = [[abjad.TimeSignature((4, 4))]]
        picking_force_envelopes = [Path(BezierCurve((0, 0), (1, 1)))]
        picking_position_envelopes = [Path(BezierCurve((0, 1), (1, 0)))]
        harp_harmonic_patterns = [[True, False]]
        finger_index_patterns = [['t', 'i', 'm', 'r', 'p']]
        scrape_patterns = [[True, False]]
        snap_patterns = [[False, True]]
        string_index_patterns = [['I', 'II', 'III', 'IV', 'V', 'VI']]
        tremolo_patterns = [[False, True]]

        music_maker = MusicMaker(
            instrument=abjad.instrumenttools.Oboe(),
            name='Name',
            rhythm_makers=[abjad.rhythmmakertools.NoteRhythmMaker()],
            stages=[0],
            time_signatures=time_signatures)

        self.handler = PickingHandler(
            music_maker=music_maker,
            force_envelopes=picking_force_envelopes,
            position_envelopes=picking_position_envelopes,
            harp_harmonic_patterns=harp_harmonic_patterns,
            finger_index_patterns=finger_index_patterns,
            scrape_patterns=scrape_patterns,
            snap_patterns=snap_patterns,
            string_index_patterns=string_index_patterns,
            tremolo_patterns=tremolo_patterns)
Пример #5
0
 def setUp(self):
     time_signatures = [[abjad.TimeSignature((4, 4))]]
     slide_position_envelopes = [Path(BezierCurve((0, 0), (1, 1)))]
     vibrato_patterns = [(False, True)]
     music_maker = MusicMaker(
         instrument=abjad.instrumenttools.Oboe(),
         name='Name',
         rhythm_makers=[abjad.rhythmmakertools.NoteRhythmMaker()],
         stages=[0],
         time_signatures=time_signatures
     )
     self.handler = SlidePositionHandler(music_maker=music_maker,
                                         position_envelopes=slide_position_envelopes,
                                         vibrato_patterns=vibrato_patterns)
Пример #6
0
def make_string_handlers(instrument, materials):
    """Creates bowed string instrument handlers from materials packages."""
    stages = tuple(range(5))

    # music makers
    bowing_music_maker = MusicMaker(
        stages=stages,
        instrument=instrument,
        name='Bowing',
        time_signatures=time_signatures,
        rhythm_makers=materials.bowing.rhythm_makers)

    fingering_music_maker = MusicMaker(
        stages=stages,
        instrument=instrument,
        name='Fingering',
        time_signatures=time_signatures,
        rhythm_makers=materials.fingering.rhythm_makers)

    # music handlers
    bowing_music_handler = BowingHandler(
        music_maker=bowing_music_maker,
        height_envelope_patterns=materials.bowing.patterns.height,
        height_envelopes=materials.bowing.envelopes.height,
        pressure_envelope_patterns=materials.bowing.patterns.pressure,
        pressure_envelopes=materials.bowing.envelopes.pressure,
        string_index_patterns=materials.bowing.patterns.string_index)

    fingering_music_handler = StringFingeringHandler(
        music_maker=fingering_music_maker,
        height_envelope_patterns=materials.fingering.patterns.height,
        height_envelopes=materials.fingering.envelopes.height,
        pressure_envelope_patterns=materials.fingering.patterns.pressure,
        pressure_envelopes=materials.fingering.envelopes.pressure,
    )

    return [bowing_music_handler, fingering_music_handler]
Пример #7
0
    def setUp(self):
        stages = (0, )
        instrument = abjad.instrumenttools.Contrabass()
        rhythm_makers = [abjad.rhythmmakertools.NoteRhythmMaker()]
        time_signatures = [[
            abjad.TimeSignature((4, 4)),
            abjad.TimeSignature((4, 4))
        ]]
        music_maker = MusicMaker(stages=stages,
                                 instrument=instrument,
                                 name='test',
                                 rhythm_makers=rhythm_makers,
                                 time_signatures=time_signatures)

        self.handler = EnvelopeHandler(music_maker)
Пример #8
0
 def setUp(self):
     time_signatures = (
         [
             abjad.TimeSignature((4, 4)),
             abjad.TimeSignature((2, 4)),
             abjad.TimeSignature((3, 4))
         ],
     )
     self.music_maker = MusicMaker(
         instrument=abjad.instrumenttools.Oboe(),
         name='Name',
         rhythm_makers=None,
         stages=[0],
         time_signatures=time_signatures
     )
     self.test_voice = Voice("s1 s2 s2.")
Пример #9
0
 def setUp(self):
     time_signatures = (
         [
             abjad.TimeSignature((4, 4)),
             abjad.TimeSignature((4, 4)),
             abjad.TimeSignature((4, 4))
         ],
     )
     rhythm_maker = NoteRhythmMaker()
     self.music_maker = MusicMaker(
         instrument=abjad.instrumenttools.Oboe(),
         name='Name',
         rhythm_makers=[rhythm_maker],
         stages=[0],
         time_signatures=time_signatures
     )
     self.test_voice = abjad.Voice("c'1 c'1 c'1")
Пример #10
0
 def setUp(self):
     time_signatures = [[abjad.TimeSignature((4, 4))]]
     height_envelopes = [Path(BezierCurve((0, 0), (1, 1)))]
     pressure_envelopes = [Path(BezierCurve((0, 1), (1, 0)))]
     tremolo_patterns = [(False, True)]
     vibrato_patterns = [(True, False)]
     music_maker = MusicMaker(
         instrument=abjad.instrumenttools.Oboe(),
         name='Name',
         rhythm_makers=[abjad.rhythmmakertools.NoteRhythmMaker()],
         stages=[0],
         time_signatures=time_signatures)
     self.handler = StringFingeringHandler(
         music_maker=music_maker,
         height_envelopes=height_envelopes,
         pressure_envelopes=pressure_envelopes,
         tremolo_patterns=tremolo_patterns,
         vibrato_patterns=vibrato_patterns)
    def setUp(self):
        stages = (0,)
        instrument = guitar
        rhythm_makers = [abjad.rhythmmakertools.NoteRhythmMaker()]
        time_signatures = [
            [abjad.TimeSignature((4, 4)), abjad.TimeSignature((4, 4))]
        ]
        music_maker = MusicMaker(
            stages=stages,
            instrument=instrument,
            name='test',
            rhythm_makers=rhythm_makers,
            time_signatures=time_signatures)

        fret_combinations = [
            FretCombination(
                instrument=guitar,
                fret_placements=[
                    FretPlacement(string=1, fret=0, harmonic=False),
                    FretPlacement(string=2, fret=0, harmonic=False),
                    FretPlacement(string=3, fret=0, harmonic=False),
                    FretPlacement(string=4, fret=0, harmonic=False),
                    FretPlacement(string=5, fret=0, harmonic=False),
                    FretPlacement(string=6, fret=0, harmonic=False),
                ]
            ),
            FretCombination(
                instrument=guitar,
                fret_placements=[
                    FretPlacement(string=1, fret=12, harmonic=True),
                    FretPlacement(string=2, fret=12, harmonic=True),
                    FretPlacement(string=3, fret=12, harmonic=True),
                    FretPlacement(string=4, fret=12, harmonic=True),
                    FretPlacement(string=5, fret=12, harmonic=True),
                    FretPlacement(string=6, fret=12, harmonic=True),
                ]
            )
        ]
        fret_combination_patterns = [[0, 1]]
        self.handler = GuitarFrettingHandler(
            music_maker,
            fret_combinations,
            fret_combination_patterns
        )
Пример #12
0
    def setUp(self):
        time_signatures = (
            [
                abjad.TimeSignature((4, 4)),
            ],
        )
        rhythm = abjad.Voice("c'4 c'4 c'4 c'4")
        self.music_maker = MusicMaker(
            instrument=abjad.instrumenttools.Oboe(),
            name='Name',
            rhythms=[rhythm],
            stages=[0],
            time_signatures=time_signatures
        )
        self.testVoice = rhythm

        def test__call__(self):
            voice = self.music_maker(0)
            self.assertEqual(str(voice), str(self.testVoice))

        def test_attach_instrument(self):
            voice = self.music_maker(0)
            result = abjad.inspect(voice).has_indicator(abjad.instrumenttools.Oboe)
            self.assertTrue(result)