|
Hey there
I've been studying wavelets recently, a powerful tool for data compression,
signal processing, denoising and multi-scale analysis. One interesting
application of wavelets (more precisely a generalisation of wavelet methods,
called wave packets) is the synthesis of "tonebursts", as it has been
sugested by M.V. Wickerhauser (check
http://www.amara.com/IEEEwave/IW_musicaltones.html). Without going into much
detail, what he does is to apply the anti-convolution of the inverse wavelet
transform, to a signal composed of a single 1 and the rest filled with 0s.
The result is a toneburst, with various shapes, depending on the filters
used, as well as their sequence (the specific packet).
Following Wickerhauser's method, I've been developing a series of
instruments to take advantage of wave packet power. The following is a
sized-down version of that not-yet-fully-debugged program, that just
synthesizes a toneburst into a function table, and then lets you use it as
any other table, for instance to be read by an oscilator.
I used a signal table of length 512 (must be a power of 2) and
anti-convolved a wavelet of size 8. These dimensions can be changed, but may
require tuning of the program. I sugest you experiment with the various
filters, as well as the sequence by which they are applied, which is
determined by a table of consecutive 0's and 1's (zero means apply the
filter, 1 means apply the mirror filter).
The current settings correspond to the simplest filter, named DAUB4, the
shortest of a class of FIR filters discovered by Daubechies, which generates
a familiar shape (you'll see it in many wavelet papers), of some
fancy-looking saw wave. As you use other filters (with bigger sizes), and
change the order by which the filter and corresponding mirror filter are
applied, the shapes increase in complexity. This generates all sorts of
tonbebursts, and its worth to inspect them at close range, since the shapes
are often interesting.
This is just one of the applications. In the full version I also follow
another approach, of compressing a given sound file, for subsequent
resynthesis using fewer data.
If you want to know more about wavelets, Amara's site above is a good
introduction.
Btw, the ksmps=490 is used in the full program, which also applies the wave
packet transform to a signal read from a sound file, using tablewa (it is
the closest integer to 512, the table size). In this case you may change it
So here's the orchestra (dont forget to correct all wrapped around lines):
sr = 44100
kr = 90
ksmps = 490
;=-=-=-=-=-=-=-=-=-=-=- F I L T E R S -=-=-=-=-=-=-=-=-=-=-=-=-=;
;standard 4
ifn ftgen 1, 0, 4, -2, 0.4829629131445341, 0.8365163037378079,
0.2241438680420134, -0.1294095225512604
;standard 10
ifn ftgen 2, 0, 16, -2, 0.160102397974, 0.603829269797, 0.724308528438,
0.138428145901, -0.242294887066, -0.032244869585, 0.077571493840,
-0.006241490213, -0.012580751999, 0.003335725285
;standard 12
ifn ftgen 3, 0, 16, -2, 0.111540743350, 0.494623890398, 0.751133908021,
0.315250351709, -0.226264693965, -0.129766867567, 0.097501605587,
0.027522865530, -0.031582039318, 0.000553842201, 0.004777257511,
-0.001077301085
;coifman 12
ifn ftgen 4, 0, 16, -2, 1.15875967387, -.02932013798, -.04763959031,
..273021046535, .574682393857, .294867193696, -.0540856070917,
-.0420264804608, .0167444101633, .00396788361296,-.00128920335614,
-.000509505399
;coifman 6
ifn ftgen 5, 0, 8, -2, (sqrt(15)-3.0)/32.0, (1.0-sqrt(15))/32.0,
(3.0-sqrt(15))/16.0, (sqrt(15)+3.0)/16.0, (sqrt(15)+13.0)/32.0,
(9.0-sqrt(15))/32.0
;mirror filter
ifn ftgen 6, 0, 16, -7, 0, 16, 0
;size table
ifn ftgen 7, 0, 8, -2, 4, 10, 12, 12, 6
gifilt = 0
gimirr = 0
gifsz = 0
zakinit 1, 1500
;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=;
instr 1
;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=;
; MirrorFilter
;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=;
ifilter = p4
imirror = 6
isztab = 7
ifiltsz table ifilter-1, isztab
indx = 0
loop:
ifil table ifiltsz-indx-1, ifilter
itablew (frac((indx+1)/2)==0 ? +1:-1)*ifil, indx, imirror
indx = indx+1
if (indxiwavlen) igoto main
ii = 0
loop1:
ziw (ii==i1pos ? 1:0), iovec+ii
ii = ii+1
if (ii=imin) igoto next2
imin = isig
next2: itablew isig, indx, ivector
indx = indx+1
if (indx |