Fixed some broken scripts
This commit is contained in:
parent
61b7b33a84
commit
6efc2a41eb
@ -51,8 +51,8 @@ def butter_bandpass_filter(data, lowcut, highcut, fs, order=5):
|
||||
# tone synthesis
|
||||
def note(freq, cycles, amp=32767.0, rate=44100):
|
||||
len = cycles * (1.0/rate)
|
||||
t = np.linspace(0, len, len * rate)
|
||||
if freq is 0:
|
||||
t = np.linspace(0, len, int(len * rate))
|
||||
if freq == 0:
|
||||
data = np.zeros(int(len * rate))
|
||||
else:
|
||||
data = np.sin(2 * np.pi * freq * t) * amp
|
||||
@ -244,7 +244,7 @@ def analyze(file_name):
|
||||
ax_S.axis('off')
|
||||
|
||||
fig.set_tight_layout(True)
|
||||
fig.show()
|
||||
plt.show()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@ -41,8 +41,8 @@ def voss(nrows, ncols=16):
|
||||
|
||||
# tone synthesis
|
||||
def note(freq, len, amp=1, rate=RATE):
|
||||
t = np.linspace(0, len, len * rate)
|
||||
if freq is 0:
|
||||
t = np.linspace(0, len, int(len * rate))
|
||||
if freq == 0:
|
||||
data = np.zeros(int(len * rate))
|
||||
else:
|
||||
data = np.sin(2*np.pi*freq*t)*amp
|
||||
@ -79,6 +79,6 @@ ax_corr.set_title('Cross-correlated with Reference')
|
||||
ax_orig.margins(0, 0.1)
|
||||
|
||||
fig.set_tight_layout(True)
|
||||
fig.show()
|
||||
plt.show()
|
||||
|
||||
write('test.wav', 44100, sig_noise)
|
||||
|
||||
@ -12,8 +12,8 @@ RATE = 44100
|
||||
# tone synthesis
|
||||
def tone(freq, cycles, amp=1, rate=RATE):
|
||||
len = cycles * (1.0/rate)
|
||||
t = np.linspace(0, len, len * rate)
|
||||
if freq is 0:
|
||||
t = np.linspace(0, len, int(len * rate))
|
||||
if freq == 0:
|
||||
data = np.zeros(int(len * rate))
|
||||
else:
|
||||
data = np.sin(2 * np.pi * freq * t) * amp
|
||||
@ -37,11 +37,11 @@ for carrier in [312, 473, 716, 1084, 1479]:
|
||||
ax.semilogy(freqs, response, label='tone = {}'.format(carrier))
|
||||
ax.set_title('Matched filter response')
|
||||
|
||||
# ax.axvline(626.67, ls=':') # Guardband markers
|
||||
# ax.axvline(695.01, ls=':')
|
||||
ax.axvline(626.67, ls=':') # Guardband markers
|
||||
ax.axvline(695.01, ls=':')
|
||||
|
||||
ax.legend(loc='best')
|
||||
ax.margins(0, 0.1)
|
||||
|
||||
fig.set_tight_layout(True)
|
||||
fig.show()
|
||||
plt.show()
|
||||
|
||||
@ -69,8 +69,8 @@ def butter_bandpass_filter(data, lowcut, highcut, fs, order=5):
|
||||
# tone synthesis
|
||||
def note(freq, cycles, amp=32767.0, rate=44100):
|
||||
len = cycles * (1.0/rate)
|
||||
t = np.linspace(0, len, len * rate)
|
||||
if freq is 0:
|
||||
t = np.linspace(0, len, int(len * rate))
|
||||
if freq == 0:
|
||||
data = np.zeros(int(len * rate))
|
||||
else:
|
||||
data = np.sin(2 * np.pi * freq * t) * amp
|
||||
|
||||
Loading…
Reference in New Issue
Block a user