def setUp(self): self.instrument = instruments['clarinet'] left = WoodwindFingering( instrument=self.instrument, hand='left', keys={ 'thumb': None, 'index': None, 'middle': None, 'ring': None, 'pinky': None } ) right = WoodwindFingering( instrument=self.instrument, hand='right', keys={ 'index': None, 'middle': None, 'ring': None, 'pinky': None } ) self.wfc = WoodwindFingeringCombination( instrument=self.instrument, left=left, right=right, predicted_pitches=PitchSet( ['bf,', 'aqs', "fs'", "g'", 'bqf', "g'"], item_class=NamedPitch, ) )
def test_equal(self): left = WoodwindFingering( instrument=self.instrument, hand='left', keys={ 'thumb': None, 'index': None, 'middle': None, 'ring': None, 'pinky': None } ) right = WoodwindFingering( instrument=self.instrument, hand='right', keys={ 'index': None, 'middle': None, 'ring': None, 'pinky': None } ) other = WoodwindFingeringCombination( instrument=self.instrument, left=left, right=right, predicted_pitches=None ) self.assertEqual(self.wfc, other)
def setUp(self): self.fingering = WoodwindFingering(instrument=instruments['clarinet'], hand="left", keys={ 'thumb': 'thumb', 'index': 'down', 'middle': 'down', 'ring': 'down', 'pinky': None, }) self.fingering_same = WoodwindFingering( instrument=instruments['clarinet'], hand="left", keys={ 'thumb': 'thumb', 'index': 'down', 'middle': 'down', 'ring': 'down', 'pinky': None, }) self.fingering_different = WoodwindFingering( instrument=instruments['clarinet'], hand="right", keys={ 'index': 'down', 'middle': 'down', 'ring': 'down', 'pinky': 'e', })
def open(instrument): """Creates a fingering combination with all open keys. Returns a `WoodwindFingeringCombination`. """ wfg = WoodwindFingeringCombination( instrument=instrument, left=WoodwindFingering.open(instrument=instrument, hand='left'), right=WoodwindFingering.open(instrument=instrument, hand='right')) return wfg
def open(instrument): """Creates a fingering combination with all open keys. Returns a `WoodwindFingeringCombination`. """ wfg = WoodwindFingeringCombination( instrument=instrument, left=WoodwindFingering.open(instrument=instrument, hand='left'), right=WoodwindFingering.open(instrument=instrument, hand='right') ) return wfg
def setUp(self): self.fingering = WoodwindFingering( instrument=instruments['clarinet'], hand="left", keys={ 'thumb': 'thumb', 'index': 'down', 'middle': 'down', 'ring': 'down', 'pinky': None, } ) self.fingering_same = WoodwindFingering( instrument=instruments['clarinet'], hand="left", keys={ 'thumb': 'thumb', 'index': 'down', 'middle': 'down', 'ring': 'down', 'pinky': None, } ) self.fingering_different = WoodwindFingering( instrument=instruments['clarinet'], hand="right", keys={ 'index': 'down', 'middle': 'down', 'ring': 'down', 'pinky': 'e', } )
def test_from_json(self): json_list = [ "clarinet", "left", { 'thumb': 'thumb', 'index': 'down', 'middle': 'down', 'ring': 'down', 'pinky': None, } ] other = WoodwindFingering.from_json(json_list) self.assertEqual(self.fingering.instrument, other.instrument) self.assertEqual(self.fingering.hand, other.hand) self.assertEqual(self.fingering.keys, other.keys)
# -*- coding: utf-8 -*- from surge.tools.actions.WoodwindFingering import WoodwindFingering from surge.tools.actions.WoodwindFingeringCombination import \ WoodwindFingeringCombination import abjad instrument = abjad.instrumenttools.BassClarinet() right = [ WoodwindFingering(instrument=instrument, hand='right', keys={ 'index': 'down', 'middle': 'down', 'ring': 'down', 'pinky': 'ees' }), WoodwindFingering(instrument=instrument, hand='right', keys={ 'index': None, 'middle': 'down', 'ring': 'down', 'pinky': 'ees' }) ] fingerings = [right] * 7
# -*- coding: utf-8 -*- from surge.tools.actions.WoodwindFingering import WoodwindFingering from surge.materials.instruments import instruments instrument = instruments['alto saxophone'] hand = 'left' fingerings = [ None, None, None, [ WoodwindFingering( instrument=instrument, hand=hand, keys={ 'thumb': None, 'index': 'down', 'middle': 'down', 'ring': 'down', 'pinky': 'gis ', }, ), WoodwindFingering( instrument=instrument, hand=hand, keys={ 'thumb': None, 'index': ['down', 'd'], 'middle': 'down', 'ring': 'down', 'pinky': 'gis ', },
from surge.tools.actions.WoodwindFingering import WoodwindFingering from surge.materials.instruments import instruments instrument = instruments['oboe'] hand = 'right' fingerings = [ None, None, None, [ WoodwindFingering( instrument=instrument, hand=hand, keys={ 'index': 'down', 'middle': 'down', 'ring': 'down', 'pinky': None, }, ), WoodwindFingering( instrument=instrument, hand=hand, keys={ 'index': None, 'middle': None, 'ring': None, 'pinky': None, }, ), ]
def test_open(self): open_fingering = WoodwindFingering.open( instruments['clarinet'], 'left' ) self.assertIsInstance(open_fingering, WoodwindFingering)
class TestWoodwindFingering(unittest.TestCase): def setUp(self): self.fingering = WoodwindFingering( instrument=instruments['clarinet'], hand="left", keys={ 'thumb': 'thumb', 'index': 'down', 'middle': 'down', 'ring': 'down', 'pinky': None, } ) self.fingering_same = WoodwindFingering( instrument=instruments['clarinet'], hand="left", keys={ 'thumb': 'thumb', 'index': 'down', 'middle': 'down', 'ring': 'down', 'pinky': None, } ) self.fingering_different = WoodwindFingering( instrument=instruments['clarinet'], hand="right", keys={ 'index': 'down', 'middle': 'down', 'ring': 'down', 'pinky': 'e', } ) def test_equal(self): self.assertEqual(self.fingering, self.fingering_same) def test_not_equal(self): self.assertNotEqual(self.fingering, self.fingering_different) def test___repr__(self): self.assertEqual( str(self.fingering), "('thumb',) ('down',) ('down',) ('down',) None" ) def test_as_binary_list(self): self.assertEqual( self.fingering.as_binary_list(), [1, 1, 1, 1, 0] ) def test_to_json(self): self.assertEqual( self.fingering.to_json(), [self.fingering.instrument.instrument_name.lower(), self.fingering.hand, self.fingering.keys] ) def test_from_json(self): json_list = [ "clarinet", "left", { 'thumb': 'thumb', 'index': 'down', 'middle': 'down', 'ring': 'down', 'pinky': None, } ] other = WoodwindFingering.from_json(json_list) self.assertEqual(self.fingering.instrument, other.instrument) self.assertEqual(self.fingering.hand, other.hand) self.assertEqual(self.fingering.keys, other.keys) def test_open(self): open_fingering = WoodwindFingering.open( instruments['clarinet'], 'left' ) self.assertIsInstance(open_fingering, WoodwindFingering)
# -*- coding: utf-8 -*- from surge.tools.actions.WoodwindFingering import WoodwindFingering from surge.tools.actions.WoodwindFingeringCombination import \ WoodwindFingeringCombination import abjad instrument = abjad.instrumenttools.BassClarinet() left = [ WoodwindFingering(instrument=instrument, hand='left', keys={ 'thumb': 'down', 'index': 'down', 'middle': 'down', 'ring': 'down', 'pinky': None }), WoodwindFingering(instrument=instrument, hand='left', keys={ 'thumb': 'down', 'index': None, 'middle': 'down', 'ring': 'down', 'pinky': None }) ] fingerings = [left] * 7
def test_open(self): open_fingering = WoodwindFingering.open(instruments['clarinet'], 'left') self.assertIsInstance(open_fingering, WoodwindFingering)
class TestWoodwindFingering(unittest.TestCase): def setUp(self): self.fingering = WoodwindFingering(instrument=instruments['clarinet'], hand="left", keys={ 'thumb': 'thumb', 'index': 'down', 'middle': 'down', 'ring': 'down', 'pinky': None, }) self.fingering_same = WoodwindFingering( instrument=instruments['clarinet'], hand="left", keys={ 'thumb': 'thumb', 'index': 'down', 'middle': 'down', 'ring': 'down', 'pinky': None, }) self.fingering_different = WoodwindFingering( instrument=instruments['clarinet'], hand="right", keys={ 'index': 'down', 'middle': 'down', 'ring': 'down', 'pinky': 'e', }) def test_equal(self): self.assertEqual(self.fingering, self.fingering_same) def test_not_equal(self): self.assertNotEqual(self.fingering, self.fingering_different) def test___repr__(self): self.assertEqual(str(self.fingering), "('thumb',) ('down',) ('down',) ('down',) None") def test_as_binary_list(self): self.assertEqual(self.fingering.as_binary_list(), [1, 1, 1, 1, 0]) def test_to_json(self): self.assertEqual(self.fingering.to_json(), [ self.fingering.instrument.instrument_name.lower(), self.fingering.hand, self.fingering.keys ]) def test_from_json(self): json_list = [ "clarinet", "left", { 'thumb': 'thumb', 'index': 'down', 'middle': 'down', 'ring': 'down', 'pinky': None, } ] other = WoodwindFingering.from_json(json_list) self.assertEqual(self.fingering.instrument, other.instrument) self.assertEqual(self.fingering.hand, other.hand) self.assertEqual(self.fingering.keys, other.keys) def test_open(self): open_fingering = WoodwindFingering.open(instruments['clarinet'], 'left') self.assertIsInstance(open_fingering, WoodwindFingering)