update 40

This commit is contained in:
Connor Olding 2018-02-21 04:04:24 -08:00
parent c2a3c65687
commit d903249930
2 changed files with 36 additions and 17 deletions

View file

@ -4,31 +4,51 @@ it's a bunch of half-baked python code that's kinda handy.
don't expect commits, docs, or comments to be any verbose.
feel free to modify and adapt the [autoupdate](autoupdate)
shell script for your own repos like this!
## the stuff
* a basic BS.1770-3 normalization implementation
— [bs.py](/lib/bs.py)
* biquad butterworth/chebyshev filters [(via DSPFilters)][dspf]
* biquad butterworth/chebyshev filters
[(via DSPFilters)][dspf]
— [nsf.py](/lib/nsf.py)
* bilinear transformation: s-plane to z-plane
* modified bilinear transformation: s-plane to z-plane
— [planes.py](/lib/planes.py)
* various functions for biquad filters
— [bq.py](/lib/bq.py) [\_\_init\_\_.py](/lib/__init__.py)
— [bq.py](/lib/bq.py)
* some functions for state-variable filters [(via Raph Levien)][svf]
* some functions for state-variable filters
[(via Raph Levien)][svf]
— [svf.py](/lib/svf.py)
* sine sweeps, and the Optimized Aoshima's Time-Stretched Pulse [(via here)][sweeps]
* sine sweeps, and the Optimized Aoshima's Time-Stretched Pulse
[(via here)][sweeps]
— [sweeps.py](/lib/sweeps.py)
* a lot of stuff for magnitude plotting like tilting and smoothing
— [fft.py](/lib/fft.py) [smoothfft.py](/lib/smoothfft.py) [\_\_init\_\_.py](/lib/__init__.py)
* basic [cepstrum][cep] utilities like minimum-phase reconstruction
[(via Julius Smith)][jos3]
— [cepstrum.py](/lib/cepstrum.py)
* rough experiments with psychoacoustic equalization ("neon pink" and other crap)
— [data.py](/lib/data.py) [\_\_init\_\_.py](/lib/__init__.py)
* utilities for magnitude plotting, including tilting and smoothing
— [fft.py](/lib/fft.py) [smoothfft.py](/lib/smoothfft.py) [mag.py](/lib/mag.py)
* a couple hard-coded polyphase halfband IIRs for nonlinear-phase resampling
or approximating hilbert transforms
(read more: [Olli Niemitalo][olli])
— [piir.py](/lib/piir.py)
* a dozen windowing functions and utility functions for constructing them
— [windowing.py](/lib/windowing.py)
* ad-hoc experiments with psychoacoustic equalization
("neon pink" and other crap before i realized
"grey noise" was the term i was looking for)
— [data.py](/lib/data.py)
* miscellaneous matplotlib stuff
— [plot.py](/lib/plot.py)
@ -36,9 +56,12 @@ don't expect commits, docs, or comments to be any verbose.
* miscellaneous utility functions
— [util.py](/lib/util.py) [wav.py](/lib/wav.py)
[dspf]: https://github.com/vinniefalco/DSPFilters/
[dspf]: //github.com/vinniefalco/DSPFilters/
[svf]: http://nbviewer.jupyter.org/github/google/music-synthesizer-for-android/blob/master/lab/Second%20order%20sections%20in%20matrix%20form.ipynb
[sweeps]: http://www.sound.sie.dendai.ac.jp/dsp/e-21.html
[svf]: http://nbviewer.ipython.org/urls/music-synthesizer-for-android.googlecode.com/git/lab/Second%20order%20sections%20in%20matrix%20form.ipynb
[cep]: //en.wikipedia.org/wiki/Cepstrum
[jos3]: //ccrma.stanford.edu/~jos/fp/
[olli]: http://yehar.com/blog/?p=368
all wrapped up in a inconveniently named "lib" module!

View file

@ -42,15 +42,11 @@ def fold(r):
return rw
def minphase(s, pad=True, os=False):
def minphase(s, pad=True):
# via https://ccrma.stanford.edu/~jos/fp/Matlab_listing_mps_m.html
# TODO: actual oversampling
# TODO: oversampling
if pad:
s = pad2(s)
if os:
s = np.r_[s, np.zeros(len(s))]
cepstrum = np.fft.ifft(np.log(clipdb(np.fft.fft(s), -100)))
signal = np.real(np.fft.ifft(np.exp(np.fft.fft(fold(cepstrum)))))
if os:
signal = signal[:len(signal)//2]
return signal