Last active
August 29, 2015 14:23
-
-
Save craftyjon/2aa9d05ee55ed2f0edaa to your computer and use it in GitHub Desktop.
linear to log test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import numpy as np | |
import matplotlib.pyplot as plt | |
a = np.arange(0, 1024) | |
lin_fft = 1.0 + np.sin(a) | |
frequencies = (a / 1024.0) * 22050 | |
#plt.plot(frequencies, lin_fft) | |
#plt.show() | |
min_freq_i_care_about = 500 | |
max_freq_i_care_about = 5000 | |
my_freqs = np.logspace(math.log10(min_freq_i_care_about), math.log10(max_freq_i_care_about), num=256) | |
print my_freqs | |
my_fft = [np.interp(freq, frequencies, lin_fft) for freq in my_freqs] | |
plt.plot(my_freqs, my_fft) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment