Skip to content

Instantly share code, notes, and snippets.

@craftyjon
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save craftyjon/2aa9d05ee55ed2f0edaa to your computer and use it in GitHub Desktop.
Save craftyjon/2aa9d05ee55ed2f0edaa to your computer and use it in GitHub Desktop.
linear to log test
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