def test_allpass_comb_reverb(lead): allpass = digital_filters.CombAllPassReverb(np.linspace(0.9, 0.95, 10), np.linspace(500, 3000, 10)) fx = allpass.apply(lead) wet = signalproc.mix_at(lead, fx, 0) play_array(fx, norm=1) pass
def test_iir_filter(lead): iir = digital_filters.IirFilter([-0.8], [8000], [0.8], [8000]) fx = iir.apply(lead) wet = signalproc.mix_at(lead, -fx, 0) play_array(fx, norm=1) pass
def test_reverb_filter(lead): df = digital_filters.FirFilter(np.linspace(0.1, 0.0, 256), np.arange(256) * 512) dry = lead fx = df.apply(lead) # wet = fx - dry play_array(fx)
def test_fir_filter(lead): df = digital_filters.FirFilter([0.2], [4096 * 2]) dry = lead fx = df.apply(lead) # wet = fx - dry play_array(fx) pass
def test_bl_square(): sampling_info = SamplingInfo(44100) x = np.arange(0, 1., 1 / 44100.) * 1440 * 2 * np.pi pos = signalproc.blit(sampling_info, x, 1440, 0, -1) neg = signalproc.blit(sampling_info, x, 1440, np.pi, -1) y = np.cumsum(pos - neg) # y = pos plt.plot(x, y) plt.show() play_array(y) pass
def main(length, note_duration): """Main function Args: length (float): length in seconds note_duration (float): duration of a single notes in seconds Returns: int: program exit-code """ sampling_info = SamplingInfo(88200) score_tracks, audio_tracks, mix = generate_dataset(n_measures=16, tempo=Tempo(100), scale=GenericScale('E', [0, 2, 3, 5, 7, 8, 10]), sampling_info=sampling_info) play_array(mix, sampling_info.sample_rate) return 0
import importlib importlib.reload(regen_models) model = regen_models.FftBranches(n_samples, learning_rate=1e-4).build_model() model.summary() #%% model.fit(x, y, epochs=15, verbose=1) #%% start_sec, end_sec = 20, 60 pred = model_predict(model, input_track[start_sec*sr:end_sec*sr], fragment_length) play_array(input_track[start_sec*sr:end_sec*sr]) play_array(pred) #%% x_pred = input_track[start_sec*sr:end_sec*sr] x_pred = x_pred[:(len(x_pred) // fragment_length) * fragment_length] x_pred = x_pred.reshape(-1, fragment_length) y_pred = model.predict(x_pred) play_array(y_pred)
def test_player(sine_wave): play_array(sine_wave)