Esempio n. 1
0
    def __test(pattern):
        ann = Annotation(namespace='pattern_jku')

        ann.append(time=0, duration=1.0, value=pattern)
        ann.append(time=1.0, duration=1.0, value=pattern)

        ann.validate()
Esempio n. 2
0
File: test_ns.py Progetto: nwh/jams
def test_ns_chord_roman_missing(key):
    data = dict(tonic='E', chord='iv64')
    del data[key]

    ann = Annotation(namespace='chord_roman')
    ann.append(time=0, duration=1.0, value=data)
    ann.validate()
Esempio n. 3
0
    def __test(pattern):
        ann = Annotation(namespace='pattern_jku')

        ann.append(time=0, duration=1.0, value=pattern)
        ann.append(time=1.0, duration=1.0, value=pattern)

        ann.validate()
Esempio n. 4
0
    def __test(pitch):
        ann = Annotation(namespace='pitch_class')

        ann.append(time=0, duration=1.0, value=pitch)
        ann.append(time=1.0, duration=1.0, value=pitch)

        ann.validate()
Esempio n. 5
0
File: test_ns.py Progetto: nwh/jams
def test_ns_tempo_valid():

    ann = Annotation(namespace='tempo')

    ann.append(time=0, duration=0, value=1, confidence=0.85)

    ann.validate()
Esempio n. 6
0
File: test_ns.py Progetto: nwh/jams
def test_ns_contour_invalid():

    srand()

    ann = Annotation(namespace='pitch_contour')

    seq_len = 21
    times = np.arange(seq_len)
    durations = np.zeros(seq_len)
    values = np.linspace(0, 22050, seq_len)  # includes 0 (odd symmetric)
    ids = np.arange(len(values)) // 4
    voicing = np.random.randn(len(ids)) * 2

    confidences = np.linspace(0, 1., seq_len)
    confidences[seq_len // 2] = None  # throw in a None confidence value

    for (t, d, v, c, i, b) in zip(times, durations, values, confidences, ids,
                                  voicing):
        ann.append(time=t,
                   duration=d,
                   value={
                       'pitch': v,
                       'id': i,
                       'voiced': b
                   },
                   confidence=c)

    ann.validate()
Esempio n. 7
0
    def __test(pitch):
        ann = Annotation(namespace='pitch_class')

        ann.append(time=0, duration=1.0, value=pitch)
        ann.append(time=1.0, duration=1.0, value=pitch)

        ann.validate()
Esempio n. 8
0
File: test_ns.py Progetto: nwh/jams
def test_ns_mood_thayer_valid():

    ann = Annotation(namespace='mood_thayer')

    ann.append(time=0, duration=1.0, value=[0.3, 2.0])

    ann.validate()
Esempio n. 9
0
File: test_ns.py Progetto: nwh/jams
def test_ns_beat_position_missing(key):

    data = dict(position=1, measure=1, num_beats=3, beat_units=4)
    del data[key]
    ann = Annotation(namespace='beat_position')
    ann.append(time=0, duration=1.0, value=data)
    ann.validate()
Esempio n. 10
0
def test_ns_tempo_valid():

    ann = Annotation(namespace='tempo')

    ann.append(time=0, duration=0, value=1, confidence=0.85)

    ann.validate()
Esempio n. 11
0
File: test_ns.py Progetto: nwh/jams
def test_ns_pitch_class_invalid(key, value):

    data = dict(tonic='E', pitch=7)
    data[key] = value
    ann = Annotation(namespace='pitch_class')
    ann.append(time=0, duration=1.0, value=data)
    ann.validate()
Esempio n. 12
0
File: test_ns.py Progetto: nwh/jams
def test_ns_tag_cal10k(tag):

    ann = Annotation(namespace='tag_cal10k')

    ann.append(time=0, duration=1, value=tag)

    ann.validate()
Esempio n. 13
0
File: test_ns.py Progetto: nwh/jams
def test_ns_tag_msd_tagtraum_cd1(tag, confidence):

    ann = Annotation(namespace='tag_msd_tagtraum_cd1')

    ann.append(time=0, duration=1, value=tag, confidence=confidence)

    ann.validate()
Esempio n. 14
0
def test_ns_mood_thayer_valid():

    ann = Annotation(namespace='mood_thayer')

    ann.append(time=0, duration=1.0, value=[0.3, 2.0])

    ann.validate()
Esempio n. 15
0
File: test_ns.py Progetto: nwh/jams
def test_ns_time_valid():

    ann = Annotation(namespace='onset')

    for time in np.arange(5.0, 10.0):
        ann.append(time=time, duration=0.0, value=None, confidence=None)

    ann.validate()
Esempio n. 16
0
def test_ns_beat_invalid():

    ann = Annotation(namespace='beat')

    for time in np.arange(5.0):
        ann.append(time=time, duration=0.0, value='foo', confidence=None)

    ann.validate()
Esempio n. 17
0
File: test_ns.py Progetto: nwh/jams
def test_ns_chord_roman_invalid(key, value):

    data = dict(tonic='E', chord='iv64')
    data[key] = value

    ann = Annotation(namespace='chord_roman')
    ann.append(time=0, duration=1.0, value=data)
    ann.validate()
Esempio n. 18
0
def test_ns_time_valid():

    ann = Annotation(namespace='onset')

    for time in np.arange(5.0, 10.0):
        ann.append(time=time, duration=0.0, value=None, confidence=None)

    ann.validate()
Esempio n. 19
0
File: test_ns.py Progetto: nwh/jams
def test_ns_beat_invalid():

    ann = Annotation(namespace='beat')

    for time in np.arange(5.0):
        ann.append(time=time, duration=0.0, value='foo', confidence=None)

    ann.validate()
Esempio n. 20
0
File: test_ns.py Progetto: nwh/jams
def test_ns_time_invalid(time, duration):

    ann = Annotation(namespace='onset')

    # Bypass the safety checks in append
    ann.data.add(
        Observation(time=time, duration=duration, value=None, confidence=None))

    ann.validate()
Esempio n. 21
0
File: test_ns.py Progetto: nwh/jams
def test_ns_beat_position_valid():

    ann = Annotation(namespace='beat_position')

    ann.append(time=0,
               duration=1.0,
               value=dict(position=1, measure=1, num_beats=3, beat_units=4))

    ann.validate()
Esempio n. 22
0
def test_ns_beat_position_valid():

    ann = Annotation(namespace='beat_position')

    ann.append(time=0, duration=1.0, value=dict(position=1,
                                                measure=1,
                                                num_beats=3,
                                                beat_units=4))

    ann.validate()
Esempio n. 23
0
    def __test(data):
        ann = Annotation(namespace='onset')

        # Bypass the safety chceks in add_observation
        ann.data.loc[0] = {'time': pd.to_timedelta(data['time'], unit='s'),
                           'duration': pd.to_timedelta(data['duration'],
                                                       unit='s'),
                           'value': None,
                           'confdence': None}

        ann.validate()
Esempio n. 24
0
File: test_ns.py Progetto: nwh/jams
def test_ns_pattern_invalid_bounded(key, value):
    data = dict(midi_pitch=3,
                morph_pitch=5,
                staff=1,
                pattern_id=1,
                occurrence_id=1)
    data[key] = value

    ann = Annotation(namespace='pattern_jku')
    ann.append(time=0, duration=1.0, value=data)
    ann.validate()
Esempio n. 25
0
def test_ns_beat_valid():

    # A valid example
    ann = Annotation(namespace='beat')

    for time in np.arange(5.0):
        ann.append(time=time, duration=0.0, value=1, confidence=None)

    for time in np.arange(5.0, 10.0):
        ann.append(time=time, duration=0.0, value=None, confidence=None)

    ann.validate()
Esempio n. 26
0
    def __test(data):
        ann = Annotation(namespace='onset')

        # Bypass the safety chceks in add_observation
        ann.data.loc[0] = {
            'time': pd.to_timedelta(data['time'], unit='s'),
            'duration': pd.to_timedelta(data['duration'], unit='s'),
            'value': None,
            'confdence': None
        }

        ann.validate()
Esempio n. 27
0
File: test_ns.py Progetto: nwh/jams
def test_ns_beat_valid():

    # A valid example
    ann = Annotation(namespace='beat')

    for time in np.arange(5.0):
        ann.append(time=time, duration=0.0, value=1, confidence=None)

    for time in np.arange(5.0, 10.0):
        ann.append(time=time, duration=0.0, value=None, confidence=None)

    ann.validate()
Esempio n. 28
0
def test_ns_pitch_midi_valid():

    ann = Annotation(namespace='pitch_midi')

    seq_len = 21  # should be odd
    times = np.arange(seq_len)
    durations = np.zeros(seq_len)
    values = np.linspace(-108., 108, seq_len)  # includes 0 (odd symmetric)
    confidences = np.linspace(0, 1., seq_len)
    confidences[seq_len//2] = None  # throw in a None confidence value

    for (t, d, v, c) in zip(times, durations, values, confidences):
        ann.append(time=t, duration=d, value=v, confidence=c)

    ann.validate()
Esempio n. 29
0
File: test_ns.py Progetto: nwh/jams
def test_ns_pitch_midi_valid():

    ann = Annotation(namespace='pitch_midi')

    seq_len = 21
    times = np.arange(seq_len)
    durations = np.zeros(seq_len)
    values = np.linspace(-108., 108, seq_len)  # includes 0 (odd symmetric)
    confidences = np.linspace(0, 1., seq_len)
    confidences[seq_len // 2] = None  # throw in a None confidence value

    for (t, d, v, c) in zip(times, durations, values, confidences):
        ann.append(time=t, duration=d, value=v, confidence=c)

    ann.validate()
Esempio n. 30
0
def test_ns_scaper_source_file(source_file):

    ann = Annotation(namespace='scaper')

    value = {
        "source_time": 0.0,
        "event_duration": 0.5310546236891855,
        "event_time": 5.6543442662431795,
        "time_stretch": 0.8455598669219283,
        "pitch_shift": -1.2204911976305648,
        "snr": 7.790682558359417,
        "label": "gun_shot",
        "role": "foreground",
        "source_file": source_file
    }

    ann.append(time=0, duration=1, value=value)
    ann.validate()
Esempio n. 31
0
def test_ns_scaper_snr(snr):

    ann = Annotation(namespace='scaper')

    value = {
        "source_time": 0.0,
        "event_duration": 0.5310546236891855,
        "event_time": 5.6543442662431795,
        "time_stretch": 0.8455598669219283,
        "pitch_shift": -1.2204911976305648,
        "snr": snr,
        "label": 'gun_shot',
        "role": "foreground",
        "source_file": "/audio/foreground/gun_shot/135544-6-17-0.wav"
    }

    ann.append(time=0, duration=1, value=value)
    ann.validate()
Esempio n. 32
0
File: test_ns.py Progetto: nwh/jams
def test_segment_tag_open(segment):

    ann = Annotation(namespace='segment_open')
    ann.append(time=0, duration=1, value=segment)
    ann.validate()
Esempio n. 33
0
    def __test(data):
        ann = Annotation(namespace='onset')
        ann.append(**data)

        ann.validate()
Esempio n. 34
0
 def __test(value):
     ann = Annotation(namespace='mood_thayer')
     ann.append(time=0, duration=1.0, value=value)
     ann.validate()
Esempio n. 35
0
    def __test(lyric):
        ann = Annotation(namespace='lyrics')

        ann.append(time=0, duration=1, value=lyric)

        ann.validate()
Esempio n. 36
0
    def __test(value, confidence):
        ann = Annotation(namespace='tempo')

        ann.append(time=0, duration=0, value=value, confidence=confidence)

        ann.validate()
Esempio n. 37
0
    def __test(label):
        ann = Annotation(namespace='segment_salami_function')

        ann.append(time=0, duration=1, value=label)

        ann.validate()
Esempio n. 38
0
 def __test(value):
     ann = Annotation(namespace='pitch_midi')
     ann.append(time=0, duration=0, value=value, confidence=0.5)
     ann.validate()
Esempio n. 39
0
    def __test(keymode):
        ann = Annotation(namespace='key_mode')

        ann.append(time=0, duration=0, value=keymode, confidence=None)

        ann.validate()
Esempio n. 40
0
    def __test(chord):
        ann = Annotation(namespace='chord_roman')

        ann.append(time=0, duration=1.0, value=chord)

        ann.validate()
Esempio n. 41
0
    def __test(tag):
        ann = Annotation(namespace='tag_gtzan')

        ann.append(time=0, duration=1, value=tag)

        ann.validate()
Esempio n. 42
0
    def __test(tag, confidence=None):
        ann = Annotation(namespace='tag_msd_tagtraum_cd2')

        ann.append(time=0, duration=1, value=tag, confidence=confidence)

        ann.validate()
Esempio n. 43
0
    def __test(tag):
        ann = Annotation(namespace='tag_medleydb_instruments')

        ann.append(time=0, duration=1, value=tag)

        ann.validate()
Esempio n. 44
0
File: test_ns.py Progetto: nwh/jams
def test_ns_segment_tut(label):

    ann = Annotation(namespace='segment_tut')
    ann.append(time=0, duration=1, value=label)
    ann.validate()
Esempio n. 45
0
File: test_ns.py Progetto: nwh/jams
def test_ns_vector(label):

    ann = Annotation(namespace='vector')
    ann.append(time=0, duration=1, value=label)
    ann.validate()
Esempio n. 46
0
File: test_ns.py Progetto: nwh/jams
def test_ns_multi_segment_bad():
    ann = Annotation(namespace='multi_segment')
    ann.append(time=0, duration=1, value='a string')
    ann.validate()
Esempio n. 47
0
File: test_ns.py Progetto: nwh/jams
def test_ns_blob(label):
    ann = Annotation(namespace='blob')
    ann.append(time=0, duration=1, value=label)
    ann.validate()
Esempio n. 48
0
 def __test(value):
     ann = Annotation(namespace='beat_position')
     ann.append(time=0, duration=1.0, value=value)
     ann.validate()
Esempio n. 49
0
File: test_ns.py Progetto: nwh/jams
def test_ns_multi_segment(label, level):

    ann = Annotation(namespace='multi_segment')
    ann.append(time=0, duration=1, value=dict(label=label, level=level))
    ann.validate()
Esempio n. 50
0
File: test_ns.py Progetto: nwh/jams
def test_ns_tag_audioset_instruments(tag):

    ann = Annotation(namespace='tag_audioset_instruments')
    ann.append(time=0, duration=1, value=tag)
    ann.validate()
Esempio n. 51
0
File: test_ns.py Progetto: nwh/jams
def test_ns_lyrics_bow(label):

    ann = Annotation(namespace='lyrics_bow')
    ann.append(time=0, duration=1, value=label)
    ann.validate()
Esempio n. 52
0
    def __test(label):
        ann = Annotation(namespace='vector')

        ann.append(time=0, duration=1, value=label)

        ann.validate()
Esempio n. 53
0
File: test_ns.py Progetto: nwh/jams
def test_ns_tag_fma_subgenre(tag):

    ann = Annotation(namespace='tag_fma_subgenre')
    ann.append(time=0, duration=1, value=tag)
    ann.validate()
Esempio n. 54
0
    def __test(value):
        ann = Annotation(namespace='multi_segment')

        ann.append(time=0, duration=1, value=value)

        ann.validate()