First time here? Check out the FAQ!
x

Anyone interested in seeing how to hand-roll an Interpolate Presets using Smalltalk and Capytalk?

+3 votes
342 views

This is from the script I made for the Vocal filter encapsulation from the NeverEngineLabs ZDF Filter pack ( https://www.cristianvogel.com/neverenginelabs/product/kyma-capsules-vol-2-zdf-filters

As I was encapsulating, InterpolatePresets was not an option, as it would also interpolate everything to the left of the Custom Class.

Thought some of you might be interested in seeing how I approached it ....

 

"**** NeverEngine Labs 2019    
**** Class: VocalFilter            
**** Author:    @cav @jr                    
**** Build: v1.0b1                    
**** Notes:        
    Decided to hand roll a 2D parameter interpolator using SmallTalk Dictionary
    to bypass encapsulation of InterpolateParameters which might cause problems
    inside a Class. Dont worry, I used SublimeText to code this which was quite quick
*****"

|        
def_a def_e def_i def_o def_u
interpPointsF1 interpPointsF2 interpPointsF3
interpPointsR1 interpPointsR2 interpPointsR3
interpPointsdB1 interpPointsdB2 interpPointsdB3
attenuation
|

attenuation := -6 db.

def_a := Dictionary new.
def_e := Dictionary new.
def_i := Dictionary new.
def_o := Dictionary new.
def_u := Dictionary new.

def_a
add: #f1 -> 650; add: #f2 -> 1080; add: #f3 ->2560;
add: #r1 -> 0.039773; add: #r2 -> 0.090909; add: #r3 ->0.11932;
add: #db1 -> 0; add: #db2 -> -6; add: #db3 -> -12.

def_e
add: #f1 -> 400; add: #f2 -> 1700; add: #f3 ->2600;
add: #r1 ->0.028409; add: #r2 -> 0.045455; add: #r3 ->0.022727;
add: #db1 -> 0; add: #db2 -> -14; add: #db3 ->-14.


def_i
add: #f1 -> 290; add: #f2 -> 1870; add: #f3 ->2800;
add: #r1 -> 0.011364; add: #r2 -> 0.0625; add: #r3 ->0.039773;
add: #db1 -> 0; add: #db2 -> -15; add: #db3 ->-12.8.

def_o
add: #f1 -> 400; add: #f2 -> 800; add: #f3 ->2600;
add: #r1 -> 0.039773; add: #r2 -> 0.0625; add: #r3 ->0.068182;
add: #db1 -> 0; add: #db2 -> -22.01; add: #db3 ->-12.8.

def_u
add: #f1 -> 350; add: #f2 -> 600; add: #f3 ->2700;
add: #r1 -> 0.017045; add: #r2 -> 0.0625; add: #r3 ->0.085227;
add: #db1 -> 0; add: #db2 -> -22.22; add: #db3 ->-18.2.


interpPointsF1 :=
Array
    with: (0@ (def_a at: #f1) )
    with: (1@ (def_e at: #f1) )
    with: (2@ (def_i at: #f1) )
    with: (3@ (def_o at: #f1) )
    with: (4@ (def_u at: #f1) )
.

interpPointsF2 :=
Array
    with: (0@ (def_a at: #f2) )
    with: (1@ (def_e at: #f2) )
    with: (2@ (def_i at: #f2) )
    with: (3@ (def_o at: #f2) )
    with: (4@ (def_u at: #f2) )
.

interpPointsF3 :=
Array
    with: (0@ (def_a at: #f3) )
    with: (1@ (def_e at: #f3) )
    with: (2@ (def_i at: #f3) )
    with: (3@ (def_o at: #f3) )
    with: (4@ (def_u at: #f3) )
.

interpPointsR1 :=
Array
    with: (0@ (def_a at: #r1) )
    with: (1@ (def_e at: #r1) )
    with: (2@ (def_i at: #r1) )
    with: (3@ (def_o at: #r1) )
    with: (4@ (def_u at: #r1) )
.

interpPointsR2 :=
Array
    with: (0@ (def_a at: #r2) )
    with: (1@ (def_e at: #r2) )
    with: (2@ (def_i at: #r2) )
    with: (3@ (def_o at: #r2) )
    with: (4@ (def_u at: #r2) )
.

interpPointsR3 :=
Array
    with: (0@ (def_a at: #r3) )
    with: (1@ (def_e at: #r3) )
    with: (2@ (def_i at: #r3) )
    with: (3@ (def_o at: #r3) )
    with: (4@ (def_u at: #r3) )
.

interpPointsdB1 :=
Array
    with: (0@ (def_a at: #db1) )
    with: (1@ (def_e at: #db1) )
    with: (2@ (def_i at: #db1) )
    with: (3@ (def_o at: #db1) )
    with: (4@ (def_u at: #db1) )
.

interpPointsdB2 :=
Array
    with: (0@ (def_a at: #db2) )
    with: (1@ (def_e at: #db2) )
    with: (2@ (def_i at: #db2) )
    with: (3@ (def_o at: #db2) )
    with: (4@ (def_u at: #db2) )
.

interpPointsdB3 :=
Array
    with: (0@ (def_a at: #db3) )
    with: (1@ (def_e at: #db3) )
    with: (2@ (def_i at: #db3) )
    with: (3@ (def_o at: #db3) )
    with: (4@ (def_u at: #db3) )
.

(inputs at: 1)
start: 0 s
cutoff1: ((?Vowel into: interpPointsF1) smoothFor: ((?smoothing vmax: 0.02) vmax: 0.02))
cutoff2: ((?Vowel into: interpPointsF2)  smoothFor: ((?smoothing vmax: 0.02) vmax: 0.02))
cutoff3: ((?Vowel into: interpPointsF3)  smoothFor: (?smoothing vmax: 0.02))

resonance1: ((?Vowel into: interpPointsR1)  smoothFor: (?smoothing vmax: 0.02))
resonance2: ((?Vowel into: interpPointsR2)  smoothFor: (?smoothing vmax: 0.02))
resonance3: ((?Vowel into: interpPointsR3)  smoothFor: (?smoothing vmax: 0.02))

level1: (((?Vowel into: interpPointsdB1) * attenuation)  smoothFor: (?smoothing vmax: 0.02))
level2: (((?Vowel into: interpPointsdB2) * attenuation)  smoothFor: (?smoothing vmax: 0.02))
level3: (((?Vowel into: interpPointsdB3) * attenuation) smoothFor: (?smoothing vmax: 0.02))



 

asked Jul 26, 2019 in Capytalk & Smalltalk by cristian-vogel (Master) (8,410 points)
Cool. That's a nice use of Dictionaries.

into: only works for static values which is fine for a vocal filter where you know all the filter values. It would be interesting to think how to do this for EventValues too.

Please log in or register to answer this question.

...