I had a bit of a lull! But I did reach an end-point to convolving
wavs. I'm going to post three non-portable ecl packages
warm
WAv transfoRM- exports using libsndfile
(warm:transform "song-in.wav" "song-out.wav"
(lambda (list) (mapcar (lambda (X) (* 0.5d0 x)) list))
(lambda (list) #'nreverse))
Strides through song-in in 4096 length chunks as lists of
double-floats writing to song-out. Where the two strings are paths of
wav to read and wav to write, and the two lambdas happen to the left
and right channels respectively. The wav is two channel, and pcm_f64le
as from
ffmpeg -i my-fave.mp3 -c:a pcm_f64le song-in.wav
I actually wrote warm for last week's show (those terrible
transforms), but I was unhappy with it, since I wanted it to just be
example/sf_process/ from libsndfile and it wound up a bit different
and made of spaghetti.
cold
exports using fftw
(cold:fftw-convolve)
Which r2c .. c2r transforms two length 4096 double arrays to convolve
them. Since those two arrays are statically allocated (what does
static mean), it has ugly accessor functions for filling them. tepid
is an example usage.
tepid
kloogetacular utility that does this, completely improperly:
song-out is totally useless, because it's not scaled down to proper
-1..1 f64le values. It would be too loud to play, by a lot. However as
a side effect it outputs the maximum of the matched filter response
**Patch: Now just transforms the left channel to a listenable frequency
** response (of the right channel). Awesome.
(convolution) for each chunk, suitably for gnuploting like
gnuplot -p -e "plot 'chunk-maxes.txt' with lines;
For which if my frequency math is actually right, the peaks are of
that frequency. Definitely different frequencies get different
responses.
I'll upload them before my show, which I will do completely live
today. I'm not a good enough DJ to be rocking person handcrafted mix
tapes (yet). I'll patch them a little to be saner.
I hope we can keep rolling with our incipient lisp group. I asked
ldbeth who has recently upgraded his phlog and listed it on
gopher.club to pick a next topic, which will be something
electronicsy.