November 2016
Beginner to intermediate
941 pages
21h 55m
English
Now that we know how to generate audio, let's use this principle to synthesize some music. You can check out this link, http://www.phy.mtu.edu/~suits/notefreqs.html. This link lists various notes, such as A, G, D, and so on, along with their corresponding frequencies. We will use this to generate some simple music.
import json import numpy as np from scipy.io.wavfile import write import matplotlib.pyplot as plt
# Synthesize tone def synthesizer(freq, duration, amp=1.0, sampling_freq=44100):
# Build the time axis t = np.linspace(0, duration, duration * sampling_freq) ...