Exemplo 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()
Exemplo n.º 2
0
Arquivo: test_ns.py Projeto: 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()
Exemplo 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()
Exemplo 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()
Exemplo n.º 5
0
Arquivo: test_ns.py Projeto: nwh/jams
def test_ns_tempo_valid():

    ann = Annotation(namespace='tempo')

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

    ann.validate()
Exemplo n.º 6
0
Arquivo: test_ns.py Projeto: 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()
Exemplo 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()
Exemplo n.º 8
0
Arquivo: test_ns.py Projeto: 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()
Exemplo n.º 9
0
Arquivo: test_ns.py Projeto: 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()
Exemplo 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()
Exemplo n.º 11
0
Arquivo: test_ns.py Projeto: 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()
Exemplo n.º 12
0
Arquivo: test_ns.py Projeto: nwh/jams
def test_ns_tag_cal10k(tag):

    ann = Annotation(namespace='tag_cal10k')

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

    ann.validate()
Exemplo n.º 13
0
Arquivo: test_ns.py Projeto: 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()
Exemplo 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()
Exemplo n.º 15
0
Arquivo: test_ns.py Projeto: 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()
Exemplo 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()
Exemplo n.º 17
0
Arquivo: test_ns.py Projeto: 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()
Exemplo 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()
Exemplo n.º 19
0
Arquivo: test_ns.py Projeto: 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()
Exemplo n.º 20
0
Arquivo: test_ns.py Projeto: 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()
Exemplo n.º 21
0
Arquivo: test_ns.py Projeto: 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()
Exemplo 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()
Exemplo 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()
Exemplo n.º 24
0
Arquivo: test_ns.py Projeto: 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()
Exemplo 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()
Exemplo 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()
Exemplo n.º 27
0
Arquivo: test_ns.py Projeto: 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()
Exemplo 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()
Exemplo n.º 29
0
Arquivo: test_ns.py Projeto: 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()
Exemplo 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()
Exemplo 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()
Exemplo n.º 32
0
Arquivo: test_ns.py Projeto: nwh/jams
def test_segment_tag_open(segment):

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

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

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

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

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

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

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

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

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

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

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

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

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

        ann.validate()
Exemplo 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()
Exemplo n.º 43
0
    def __test(tag):
        ann = Annotation(namespace='tag_medleydb_instruments')

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

        ann.validate()
Exemplo n.º 44
0
Arquivo: test_ns.py Projeto: nwh/jams
def test_ns_segment_tut(label):

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

    ann = Annotation(namespace='vector')
    ann.append(time=0, duration=1, value=label)
    ann.validate()
Exemplo n.º 46
0
Arquivo: test_ns.py Projeto: nwh/jams
def test_ns_multi_segment_bad():
    ann = Annotation(namespace='multi_segment')
    ann.append(time=0, duration=1, value='a string')
    ann.validate()
Exemplo n.º 47
0
Arquivo: test_ns.py Projeto: nwh/jams
def test_ns_blob(label):
    ann = Annotation(namespace='blob')
    ann.append(time=0, duration=1, value=label)
    ann.validate()
Exemplo n.º 48
0
 def __test(value):
     ann = Annotation(namespace='beat_position')
     ann.append(time=0, duration=1.0, value=value)
     ann.validate()
Exemplo n.º 49
0
Arquivo: test_ns.py Projeto: 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()
Exemplo n.º 50
0
Arquivo: test_ns.py Projeto: 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()
Exemplo n.º 51
0
Arquivo: test_ns.py Projeto: nwh/jams
def test_ns_lyrics_bow(label):

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

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

        ann.validate()
Exemplo n.º 53
0
Arquivo: test_ns.py Projeto: 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()
Exemplo n.º 54
0
    def __test(value):
        ann = Annotation(namespace='multi_segment')

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

        ann.validate()