Commit d480fe36 authored by Robozman's avatar Robozman

Added square wave....

parent e82d12db
......@@ -2,6 +2,7 @@ import time
import matplotlib.pyplot as plt
import numpy as np
import scipy.io.wavfile as wavfile
from scipy import signal
import sounddevice
import time
import math
......@@ -15,9 +16,13 @@ f = 1440.0 # sine frequency, Hz, may be float
# generate samples, note conversion to float32 array
samples = np.zeros( 10 * fs)
#for i in range(0, 10):
# curr_freq = 440 + (i * 1000)
# samples[(i * fs):((i + 1) * fs)] = np.sin(2*np.pi*np.arange(fs*duration)*curr_freq/fs).astype(np.float32)
for i in range(0, 10):
curr_freq = 440 + (i * 1000)
samples[(i * fs):((i + 1) * fs)] = np.sin(2*np.pi*np.arange(fs*duration)*curr_freq/fs).astype(np.float32)
samples[(i * fs):((i + 1) * fs)] = signal.square(2*np.pi*np.arange(fs*duration)*curr_freq/fs).astype(np.float32)
plt.ion()
fig = plt.figure()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment