High/Low Pass FilterΒΆ

[1]:
import nussl
import matplotlib.pyplot as plt
import time

start_time = time.time()

def visualize_and_embed(sources):
    plt.figure(figsize=(10, 6))
    plt.subplot(211)
    nussl.utils.visualize_sources_as_masks(sources,
        y_axis='mel', db_cutoff=-40, alpha_amount=2.0)
    plt.subplot(212)
    nussl.utils.visualize_sources_as_waveform(
        sources, show_legend=False)
    plt.show()
    nussl.play_utils.multitrack(sources)

musdb = nussl.datasets.MUSDB18(
    download=True, sample_rate=16000,
    strict_sample_rate = False
)
i = 39
item = musdb[i]
mix = item['mix']
[2]:
separator = nussl.separation.benchmark.HighLowPassFilter(
    mix, 100)
estimates = separator()
estimates = {
    'Low': estimates[0],
    'High': estimates[1]
}
visualize_and_embed(estimates)
../../_images/examples_benchmark_high_pass_filter_2_0.png
[3]:
separator = nussl.separation.benchmark.HighLowPassFilter(
    mix, 400)
estimates = separator()
estimates = {
    'Low': estimates[0],
    'High': estimates[1]
}
visualize_and_embed(estimates)
../../_images/examples_benchmark_high_pass_filter_3_0.png
[4]:
end_time = time.time()
time_taken = end_time - start_time
print(f'Time taken: {time_taken:.4f} seconds')
Time taken: 20.7096 seconds