def setUp(self):

        instrument = Guitar()

        fret_placement = FretPlacement(instrument=instrument,
                                       string=0,
                                       fret=0,
                                       harmonic=False)

        fret_placement_same = FretPlacement(instrument=instrument,
                                            string=0,
                                            fret=0,
                                            harmonic=False)

        fret_placement_different = FretPlacement(instrument=instrument,
                                                 string=0,
                                                 fret=0,
                                                 harmonic=True)

        self.combo = FretCombination(instrument=instrument,
                                     fret_placements=[fret_placement],
                                     number_of_strings=6)

        self.combo_same = FretCombination(
            instrument=instrument,
            fret_placements=[fret_placement_same],
            number_of_strings=6)

        self.combo_different = FretCombination(
            instrument=instrument,
            fret_placements=[fret_placement_different],
            number_of_strings=6)
Exemplo n.º 2
0
def make_harmonics(inst):
    fcs = []
    for i in range(1, 7):
        for j in [3, 4, 5, 7, 12]:
            fps = [FretPlacement(inst, i, j, True)]
            fcs.append(FretCombination(inst, fps))
    return fcs
 def test_init(self):
     fret_placement = FretPlacement(instrument=Guitar(),
                                    string=0,
                                    fret=0,
                                    harmonic=False)
     combo = FretCombination(instrument=Guitar(),
                             fret_placements=[fret_placement],
                             number_of_strings=6)
     self.assertIsInstance(combo, FretCombination)
    def from_lists(instrument, strings, frets, harmonic):
        """Instantiates a fret combination from lists of strings, frets and harmonics.

        Returns a `FretCombination`.
        """
        assert(len(strings) == len(frets))
        fret_placements = []
        for fret, string in zip(frets, strings):
            fret_placements.append(
                FretPlacement(
                    instrument=instrument,
                    fret=fret,
                    string=string,
                    harmonic=harmonic
                )
            )
        return FretCombination(
            instrument=instrument,
            fret_placements=fret_placements,
        )
    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
        )
Exemplo n.º 6
0
# -*- coding: utf-8 -*-
from surge.materials.instruments import instruments
from surge.tools.actions.FretCombination import FretCombination
from surge.tools.actions.FretPlacement import FretPlacement
guitar = instruments['guitar 1']

fret_combinations = [
    FretCombination(instrument=guitar,
                    fret_placements=[
                        FretPlacement(string=s, fret=6, harmonic=True)
                        for s in range(1, 7)
                    ])
]

for i in range(1, 20):
    fret_combination = FretCombination(instrument=guitar,
                                       fret_placements=[
                                           FretPlacement(string=s,
                                                         fret=i,
                                                         harmonic=True)
                                           for s in range(1, 7)
                                       ])
    fret_combinations.append(fret_combination)
from surge.tools.actions.FretCombination import FretCombination
from surge.tools.actions.FretPlacement import FretPlacement
from surge.materials.instruments import instruments
from surge.materials.segment_i.make_harmonics import make_harmonics

guitar = instruments['guitar 1']

# 0-29
fret_combinations = make_harmonics(guitar)

# 30
fret_combinations.append(
    FretCombination(instrument=guitar,
                    fret_placements=[
                        FretPlacement(
                            instrument=guitar,
                            string=4,
                            fret=0,
                            harmonic=False,
                        ),
                    ]))

# 31
fret_combinations.append(
    FretCombination.from_lists(
        instrument=guitar,
        strings=[2, 3, 4, 5],
        frets=[7, 5, 5, 5],
        harmonic=True,
    ))