September 2014
Intermediate to advanced
512 pages
12h 39m
English
In this recipe, we will create a small electronic piano in the notebook. We will synthesize sinusoidal sounds with NumPy instead of using recorded tones.
In [1]: import numpy as np
import matplotlib.pyplot as plt
from IPython.display import (Audio, display,
clear_output)
from IPython.html import widgets
from functools import partial
%matplotlib inlineIn [2]: rate = 16000.
duration = 0.5
t = np.linspace(0., duration, rate * duration)Audio class:In [3]: def synth(f): x = np.sin(f * ...
Read now
Unlock full access