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)
    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
        )
Exemplo n.º 3
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)
Exemplo n.º 4
0
def make_glissandi(finger_heights, durations, denominators):
    """Creates enveleopes (offset, height) from a list of finger heights and durations.

    Returns a list.
    """

    assert (len(finger_heights) == len(durations))

    x_0 = 0.0
    y_0 = finger_heights[0][0]
    paths = []

    for i in range(len(finger_heights)):
        # make path for each stage
        curves = []
        offset = 0
        denominator = denominators[i]
        for j in range(len(finger_heights[i]) - 1):
            # offsets from durations
            d_0 = durations[i][j][0]
            d_1 = durations[i][j][1]
            x_0 = offset
            x_1 = x_0 + d_0 / denominator
            x_2 = x_1 + d_1 / denominator
            offset = x_2

            # heights
            y_0 = finger_heights[i][j]
            y_1 = finger_heights[i][j + 1]
            y_2 = y_1

            # create curves
            curve_0 = BezierCurve((x_0, y_0), (x_1, y_1))
            curve_1 = BezierCurve((x_1, y_1), (x_2, y_2))
            curves.append(curve_0)
            curves.append(curve_1)
        path = Path(*curves)
        paths.append(path)

    return paths
Exemplo n.º 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)
Exemplo n.º 6
0
def zig_zag_by_counts(low, high, offsets, measure_indices, measures_per_stage,
                      stage_durations, stage_index):
    """Creates an envelope that alternates between a low and high value."""
    curves = []
    offsets = offsets[stage_index]
    offsets.append(stage_durations[stage_index])
    measure_indices = measure_indices[stage_index]
    measure_indices.append(measures_per_stage[stage_index])

    measure_index_pairs = zip(measure_indices[:-1], measure_indices[1:])

    for i, (measure_start, measure_end) in enumerate(measure_index_pairs):
        x0 = offsets[measure_start]
        x1 = offsets[measure_end]

        if i % 2 == 0:
            y0 = low
            y1 = high
        else:
            y0 = high
            y1 = low
        curves.append(BezierCurve((x0, y0), (x1, y1)))
    return Path(*curves)
Exemplo n.º 7
0
# -*- coding: utf-8 -*-
from surge.materials.segment_ii.durations import stage_durations
from surge.tools.bezzie.BezierCurve import BezierCurve
from surge.tools.bezzie.Path import Path
from surge.tools.bezzie.RandomInterpolater import RandomInterpolater
from surge.tools.bezzie.SineInterpolater import SineInterpolater
import abjad

sine_interpolater = SineInterpolater(freq=90, amp=2)
random_interpolater = RandomInterpolater(seed=hash('violin'))

height = (Path(BezierCurve((0, 0.85), (stage_durations[0], 1))),
          Path(BezierCurve((0, 1), (stage_durations[1], 0.85))),
          Path(BezierCurve((0, 0.85), (stage_durations[2], 1))), None,
          Path(BezierCurve((0, 0.85), (stage_durations[4], 1))),
          Path(BezierCurve((0, 0.85), (stage_durations[5], 1))), None)

height[0].set_interpolater(sine_interpolater)
height[1].set_interpolater(sine_interpolater)
height[2].set_interpolater(random_interpolater)
height[4].set_interpolater(random_interpolater)
height[5].set_interpolater(random_interpolater)
Exemplo n.º 8
0
# -*- coding: utf-8 -*-
from surge.materials.segment_ii.durations import stage_durations
from surge.tools.bezzie.BezierCurve import BezierCurve
from surge.tools.bezzie.RandomInterpolater import RandomInterpolater
from surge.tools.bezzie.Path import Path
import abjad

random_interpolater = RandomInterpolater(seed=hash('guitar 1'))

force = [
    None,
    None,
    None,
    Path(BezierCurve((0, 0), (stage_durations[3], 0.34))),
    Path(BezierCurve((0, 0.34), (stage_durations[4], 0.67))),
    Path(BezierCurve((0, 0.67), (stage_durations[5], 1))),
    Path(
        BezierCurve((0, 1), (stage_durations[6] / 3, 0.67)),
        BezierCurve((stage_durations[6] / 3, 0.67),
                    (stage_durations[6] * 2 / 3, 0.34)),
        BezierCurve((stage_durations[6] * 2 / 3, 0.34),
                    (stage_durations[6], 0))),
]

force[3].set_interpolater(random_interpolater)
force[4].set_interpolater(random_interpolater)
force[5].set_interpolater(random_interpolater)
force[6].set_interpolater(random_interpolater)
Exemplo n.º 9
0
# -*- coding: utf-8 -*-
from surge.materials.segment_ii.durations import stage_durations
from surge.tools.bezzie.BezierCurve import BezierCurve
from surge.tools.bezzie.RandomInterpolater import RandomInterpolater
from surge.tools.bezzie.Path import Path
import abjad

random_interpolater = RandomInterpolater(seed=hash('oboe'))

air_pressure = [
    None, None,
    Path(BezierCurve((0, 0), (stage_durations[2], 0.5))),
    Path(BezierCurve((0, 0.25), (stage_durations[3], 0.75))),
    Path(BezierCurve((0, 0.5), (stage_durations[4], 1))),
    Path(BezierCurve((0, 0.25), (stage_durations[5], 0.75))), None
]

air_pressure[2].set_interpolater(random_interpolater)
air_pressure[3].set_interpolater(random_interpolater)
air_pressure[4].set_interpolater(random_interpolater)
air_pressure[5].set_interpolater(random_interpolater)
Exemplo n.º 10
0
        Fraction(1, 7)
    ],
]

height = make_glissandi(
    harmonics,
    durations,
    denominators
)

# stage 3

height.append(
    Path(
        BezierCurve(
            (0, Fraction(1, 7)),
            (stage_durations[2], Fraction(5, 13))
        )
    )
)
height[2].set_interpolater(random_interpolater)

# stage 4

height.append(None)

# stage 5

height.append(
    Path(
        BezierCurve((0, Fraction(1, 7)), (stage_durations[4], Fraction(5, 13)))
    )
Exemplo n.º 11
0
# -*- coding: utf-8 -*-
from surge.materials.segment_ii.durations import stage_durations
from surge.tools.bezzie.BezierCurve import BezierCurve
from surge.tools.bezzie.Path import Path
from surge.tools.bezzie.SineInterpolater import SineInterpolater
import abjad


pressure = (
    Path(BezierCurve((0, 0.1), (stage_durations[0], 0.9))),
    Path(BezierCurve((0, 0.9), (stage_durations[1], 0.1))),
    Path(BezierCurve((0, 0.1), (stage_durations[2], 0.9))),
    None,
    Path(BezierCurve((0, 0.1), (stage_durations[4], 0.9))),
    Path(BezierCurve((0, 0.1), (stage_durations[4], 0.9))),
    None
)
sine_interpolater = SineInterpolater(freq=100, amp=2)
pressure[0].set_interpolater(sine_interpolater)
pressure[1].set_interpolater(sine_interpolater)
pressure[2].set_interpolater(sine_interpolater)
pressure[4].set_interpolater(sine_interpolater)
pressure[5].set_interpolater(sine_interpolater)
Exemplo n.º 12
0
# -*- coding: utf-8 -*-
from surge.materials.segment_ii.durations import stage_durations
from surge.tools.bezzie.BezierCurve import BezierCurve
from surge.tools.bezzie.RandomInterpolater import RandomInterpolater
from surge.tools.bezzie.Path import Path
import abjad

random_interpolater = RandomInterpolater(seed=hash('teniralc'))

lip_pressure = [
    None,
    None,
    Path(BezierCurve((0, 0), (stage_durations[2], 1))),
    Path(BezierCurve((0, 0), (stage_durations[3], 1))),
    Path(BezierCurve((0, 0), (stage_durations[4], 1))),
    Path(BezierCurve((0, 0), (stage_durations[5], 1))),
    None
]

lip_pressure[2].set_interpolater(random_interpolater)
lip_pressure[3].set_interpolater(random_interpolater)
lip_pressure[4].set_interpolater(random_interpolater)
lip_pressure[5].set_interpolater(random_interpolater)
Exemplo n.º 13
0
 def setUp(self):
     self.b = BezierCurve((0, 0), (50, 100), (100, 0))
Exemplo n.º 14
0
# -*- coding: utf-8 -*-
from surge.materials.segment_ii.durations import stage_durations
from surge.tools.bezzie.BezierCurve import BezierCurve
from surge.tools.bezzie.Path import Path
from surge.tools.bezzie.SineInterpolater import SineInterpolater
import abjad

pressure = (Path(BezierCurve((0, 0.1), (stage_durations[0], 0.9))),
            Path(BezierCurve((0, 0.9), (stage_durations[1], 0.1))),
            Path(BezierCurve((0, 0.1), (stage_durations[2], 0.9))), None,
            Path(BezierCurve((0, 0.1), (stage_durations[4], 0.9))),
            Path(BezierCurve((0, 0.1), (stage_durations[5], 0.9))), None)

sine_interpolater = SineInterpolater(freq=110, amp=2)

pressure[0].set_interpolater(sine_interpolater)
pressure[1].set_interpolater(sine_interpolater)
pressure[2].set_interpolater(sine_interpolater)
pressure[4].set_interpolater(sine_interpolater)
pressure[5].set_interpolater(sine_interpolater)
Exemplo n.º 15
0
# -*- coding: utf-8 -*-
from surge.materials.segment_ii.durations import stage_durations
from surge.tools.bezzie.BezierCurve import BezierCurve
from surge.tools.bezzie.RandomInterpolater import RandomInterpolater
from surge.tools.bezzie.Path import Path
import abjad

random_interpolater = RandomInterpolater(seed=hash('1 ratiug'))

position = [
    None, None, None,
    Path(BezierCurve((0, 0.), (stage_durations[3], 0.5))),
    Path(BezierCurve((0, 0.25), (stage_durations[4], 0.75))),
    Path(BezierCurve((0, 0.5), (stage_durations[5], 1.))),
    Path(BezierCurve((0, 0.), (stage_durations[6], 0.5)))
]

position[3].set_interpolater(random_interpolater)
position[4].set_interpolater(random_interpolater)
position[5].set_interpolater(random_interpolater)
position[6].set_interpolater(random_interpolater)
Exemplo n.º 16
0
from surge.materials.segment_i.time_signatures import time_signatures


offsets_1 = time_signatures_to_offsets(time_signatures[0])
offsets_2 = time_signatures_to_offsets(time_signatures[1])
offsets_3 = time_signatures_to_offsets(time_signatures[2])
offsets_5 = time_signatures_to_offsets(time_signatures[4])
total_duration_1 = float(sum_time_signatures(time_signatures[0]))
total_duration_2 = float(sum_time_signatures(time_signatures[1]))
total_duration_3 = float(sum_time_signatures(time_signatures[2]))
total_duration_5 = float(sum_time_signatures(time_signatures[4]))

path_stage_1 = Path(
    # 1-1
    BezierCurve(
        (offsets_1[0], 1),
        (offsets_1[16], 0)
    ),
    # 1-2
    BezierCurve(
        (offsets_1[16], 0),
        (total_duration_1, 1)
    ),
)

path_stage_2 = Path(
    # 2-1
    BezierCurve(
        (offsets_2[0], 1),
        (offsets_2[13], 0)
    ),
    # 2-2
Exemplo n.º 17
0
        Fraction(4, 11),
        Fraction(2, 3),
        Fraction(1, 2),
        Fraction(8, 11),
        Fraction(1, 7),
        Fraction(9, 13),
        Fraction(1, 2)
    ],
]

height = make_glissandi(finger_heights, durations, denominators)

# stage 3

height.append(
    Path(BezierCurve((0, Fraction(1, 2)),
                     (stage_durations[2], Fraction(2, 7)))))

# stage 4

height.append(None)

# stage 5

height.append(
    Path(BezierCurve((0, Fraction(1, 2)),
                     (stage_durations[4], Fraction(2, 7)))))

# stage 6

height.append(
    Path(BezierCurve((0, Fraction(1, 2)),
Exemplo n.º 18
0
# -*- coding: utf-8 -*-
from surge.materials.segment_ii.durations import stage_durations
from surge.tools.bezzie.BezierCurve import BezierCurve
from surge.tools.bezzie.Path import Path
import abjad

pressure = [
    Path(BezierCurve((0, 1), (stage_durations[0], 1))),
    Path(BezierCurve((0, 1), (stage_durations[1], 1))),
    Path(BezierCurve((0, 1), (stage_durations[2], 1))), None,
    Path(BezierCurve((0, 1), (stage_durations[4], 1))),
    Path(BezierCurve((0, 1), (stage_durations[5], 1))), None
]
Exemplo n.º 19
0
 def setUp(self):
     b0 = BezierCurve((0, 0), (50, 100), (100, 0))
     b1 = BezierCurve((100, 0), (150, -100), (200, 0))
     self.p = Path(b0, b1)