def test_feature_stft(audio, SR, HOP_LENGTH, n_fft): ext = pumpp.feature.STFT(name='stft', sr=SR, hop_length=HOP_LENGTH, n_fft=n_fft) output = ext.transform(**audio) assert set(output.keys()) == set(ext.fields.keys()) for key in ext.fields: assert shape_match(output[key].shape[1:], ext.fields[key].shape) assert type_match(output[key].dtype, ext.fields[key].dtype)
def test_feature_mel(audio, SR, HOP_LENGTH, n_fft, n_mels): ext = pumpp.feature.Mel(name='mel', sr=SR, hop_length=HOP_LENGTH, n_fft=n_fft, n_mels=n_mels) output = ext.transform(**audio) # Check the fields assert set(output.keys()) == set(ext.fields.keys()) for key in ext.fields: assert shape_match(output[key].shape[1:], ext.fields[key].shape) assert type_match(output[key].dtype, ext.fields[key].dtype)
def test_feature_cqtphasediff(audio, SR, HOP_LENGTH, over_sample, n_octaves): ext = pumpp.feature.CQTPhaseDiff(name='cqt', sr=SR, hop_length=HOP_LENGTH, n_octaves=n_octaves, over_sample=over_sample) output = ext.transform(**audio) assert set(output.keys()) == set(ext.fields.keys()) for key in ext.fields: assert shape_match(output[key].shape[1:], ext.fields[key].shape) assert type_match(output[key].dtype, ext.fields[key].dtype)
def test_feature_time(audio, SR, HOP_LENGTH, conv, dtype): ext = pumpp.feature.TimePosition(name='time', sr=SR, hop_length=HOP_LENGTH, conv=conv, dtype=dtype) output = ext.transform(**audio) # Check the fields assert set(output.keys()) == set(ext.fields.keys()) for key in ext.fields: assert shape_match(output[key].shape[1:], ext.fields[key].shape) assert type_match(output[key].dtype, ext.fields[key].dtype)
def test_feature_tempogram(audio, SR, HOP_LENGTH, WIN_LENGTH, conv, dtype): ext = pumpp.feature.Tempogram(name='rhythm', sr=SR, hop_length=HOP_LENGTH, win_length=WIN_LENGTH, conv=conv, dtype=dtype) output = ext.transform(**audio) assert set(output.keys()) == set(ext.fields.keys()) for key in ext.fields: assert shape_match(output[key].shape[1:], ext.fields[key].shape) assert type_match(output[key].dtype, ext.fields[key].dtype)
def test_feature_stft_mag(audio, SR, HOP_LENGTH, n_fft, conv, log, dtype): ext = pumpp.feature.STFTMag(name='stft', sr=SR, hop_length=HOP_LENGTH, n_fft=n_fft, conv=conv, log=log, dtype=dtype) output = ext.transform(**audio) # Check the fields assert set(output.keys()) == set(ext.fields.keys()) for key in ext.fields: assert shape_match(output[key].shape[1:], ext.fields[key].shape) assert type_match(output[key].dtype, ext.fields[key].dtype)
def test_feature_hcqtmag(audio, SR, HOP_LENGTH, over_sample, n_octaves, hconv, log, harmonics, dtype): ext = pumpp.feature.HCQTMag(name='hcqt', sr=SR, hop_length=HOP_LENGTH, n_octaves=n_octaves, over_sample=over_sample, conv=hconv, log=log, harmonics=harmonics, dtype=dtype) output = ext.transform(**audio) assert set(output.keys()) == set(ext.fields.keys()) for key in ext.fields: assert shape_match(output[key].shape[1:], ext.fields[key].shape) assert type_match(output[key].dtype, ext.fields[key].dtype)