During this kickoff weekend, I started from great work from chairman at github https://github.com/chairmank/eulerian-audio-magnification and check on the theory of it, plus add spectrograms for after and before the magnification.
Add google colab python 2.7 notebook.
Feel free to checkit out!
https://colab.research.google.com/drive/1pXwTn74pyo7VxgWxbv4-r3TsilSSaMrO
next steps will involve set everything up in the rpi, the main part of code published here follows. Laplacian pyramids rock :-)
this the first test results amplifying simple raw wav file with technique described
The main piece of code for that ;-)
window = 1024
step = window / 4
print "whitening spectrum"
whitened = sp / np.sqrt(power)
whitened = normalize_total_power(whitened, utils.total_power(sp))
print "unwhitening spectrum"
unwhitened = whitened * np.sqrt(power)
unwhitened = normalize_total_power(unwhitened, utils.total_power(sp))
print "resynthesizing from whitened-unwhitened spectrogram"
resynth = resynthesize(unwhitened)
wavfile.write("resynth.wav", int(2 * nyq), resynth)
print "constructing Laplacian pyramid"
pyr = stft_laplacian_pyramid(sp)
print "amplifying components of Laplacian pyramid"
passband = [0.5, 1.0]
fs = 44100 / step
gain = 10.0
amplified_pyr = amplify_pyramid(pyr, passband=passband, fs=fs, gain=gain)
print "resynthesizing spectrogram from amplified Laplacian pyramid"
pyramid_resynth = resynthesize(amplified_pyr.sum(axis=-1))
wavfile.write("resynth_pyramid.wav", int(2 * nyq), pyramid_resynth)
(nyq, signal2) = slurp_wav("resynth_pyramid.wav", start=0, end=44100*10)
plt.specgram(signal2, cmap='Spectral', Fs=framerate)
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.