Virtual Electric Guitars and Effects Using Faust and Octave Julius Smith CCRMA, Stanford University LAC-2008 March 1, 2008 Julius Smith LAC-2008 – 1 / 66
Outline Overview and Demo • Extended Karplus Strong (EKS) Elements • Overdrive • Amplifier Feedback • Coupled Strings • Wah Pedal • Faust Libraries: • filter.lib ◦ effect.lib ◦ osc.lib ◦ Julius Smith LAC-2008 – 2 / 66
Why Resurrect These Old Algorithms Now? Outline (Extended Karplus Strong, Sullivan extensions, early waveguide) Why Now? Some patents have expired • EKS Intro Useful free methods are not in wide use • Pick Position Comb Reference implementations in a modern framework • Damping Filter Tuning Filter Dynamic Level Filter Overdrive, Feedback Speaker Bandpass Coupled Strings Wah Pedal Faust Libraries References Julius Smith LAC-2008 – 3 / 66
Why Resurrect These Old Algorithms Now? Outline (Extended Karplus Strong, Sullivan extensions, early waveguide) Why Now? Some patents have expired • EKS Intro Useful free methods are not in wide use • Pick Position Comb Reference implementations in a modern framework • Damping Filter Tuning Filter Dynamic Level Filter Overdrive, Feedback Speaker Bandpass Coupled Strings Wah Pedal Faust Libraries References Julius Smith LAC-2008 – 3 / 66
Why Resurrect These Old Algorithms Now? Outline (Extended Karplus Strong, Sullivan extensions, early waveguide) Why Now? Some patents have expired • EKS Intro Useful free methods are not in wide use • Pick Position Comb Reference implementations in a modern framework • Damping Filter Tuning Filter Dynamic Level Filter Overdrive, Feedback Speaker Bandpass Coupled Strings Wah Pedal Faust Libraries References Julius Smith LAC-2008 – 3 / 66
Outline Why Now? EKS Intro Pick Position Comb Damping Filter Tuning Filter Dynamic Level Filter Overdrive, Feedback Speaker Bandpass Extended Karplus-Strong (EKS) Coupled Strings Wah Pedal Algorithm Faust Libraries References Julius Smith LAC-2008 – 4 / 66
Karplus-Strong (KS) Algorithm (1983) Outline Digital Filter Interpretation: Why Now? EKS Intro • Karplus Strong • EKS Algorithms + + y ( n ) y ( n- N ) Output N samples delay Pick Position Comb Damping Filter 1/2 Tuning Filter Dynamic Level Filter 1/2 - z 1 Overdrive, Feedback Speaker Bandpass Coupled Strings Wah Pedal Faust Libraries Discovered as “self-modifying wavetable synthesis” • References Wavetable is preferably initialized with random numbers • Patents now expired • Julius Smith LAC-2008 – 5 / 66
Karplus-Strong (KS) Algorithm (1983) Outline Digital Filter Interpretation: Why Now? EKS Intro • Karplus Strong • EKS Algorithms + + y ( n ) y ( n- N ) Output N samples delay Pick Position Comb Damping Filter 1/2 Tuning Filter Dynamic Level Filter 1/2 - z 1 Overdrive, Feedback Speaker Bandpass Coupled Strings Wah Pedal Faust Libraries Discovered as “self-modifying wavetable synthesis” • References Wavetable is preferably initialized with random numbers • Patents now expired • Julius Smith LAC-2008 – 5 / 66
Karplus-Strong (KS) Algorithm (1983) Outline Digital Filter Interpretation: Why Now? EKS Intro • Karplus Strong • EKS Algorithms + + y ( n ) y ( n- N ) Output N samples delay Pick Position Comb Damping Filter 1/2 Tuning Filter Dynamic Level Filter 1/2 - z 1 Overdrive, Feedback Speaker Bandpass Coupled Strings Wah Pedal Faust Libraries Discovered as “self-modifying wavetable synthesis” • References Wavetable is preferably initialized with random numbers • Patents now expired • Julius Smith LAC-2008 – 5 / 66
EKS Algorithms Outline z − N H p ( z ) H β ( z ) H L ( z ) Why Now? EKS Intro • Karplus Strong H ρ ( z ) H s ( z ) H d ( z ) • EKS Algorithms Pick Position Comb N = pitch period ( 2 × string length) in samples Damping Filter 1 − p Tuning Filter H p ( z ) = 1 − p z − 1 = pick-direction lowpass filter Dynamic Level Filter 1 − z − βN = pick-position comb filter , β ∈ (0 , 1) Overdrive, Feedback H β ( z ) = Speaker Bandpass H d ( z ) = string-damping filter (one/two poles/zeros typical) Coupled Strings Wah Pedal H s ( z ) = string-stiffness allpass filter (several poles and zeros) Faust Libraries ρ ( N ) − z − 1 References H ρ ( z ) = 1 − ρ ( N ) z − 1 = first-order string-tuning allpass filter 1 − R L H L ( z ) = 1 − R L z − 1 = dynamic-level lowpass filter Julius Smith LAC-2008 – 6 / 66
Outline Why Now? EKS Intro Pick Position Comb Damping Filter Tuning Filter Dynamic Level Filter Overdrive, Feedback Speaker Bandpass Coupled Strings Pick Position Comb Filter Wah Pedal Faust Libraries References Julius Smith LAC-2008 – 7 / 66
String Model Excited Externally at One Point Example Output + Outline f ( n ) Delay Delay Why Now? “Agraffe” “Bridge” Hammer Strike f(t) Filter Rigid Yielding EKS Intro Termination Termination Pick Position Comb - Delay Delay f ( n ) • Physical Excitation • Pick Position FFCF ( x = 0) ( x = striking position) ( x = L ) • Faust Code Damping Filter “Waveguide Formulation” Tuning Filter Dynamic Level Filter Overdrive, Feedback Speaker Bandpass Coupled Strings Wah Pedal Faust Libraries References Julius Smith LAC-2008 – 8 / 66
String Model Excited Externally at One Point Example Output + Outline f ( n ) Delay Delay Why Now? “Agraffe” “Bridge” Hammer Strike f(t) Filter Rigid Yielding EKS Intro Termination Termination Pick Position Comb - Delay Delay f ( n ) • Physical Excitation • Pick Position FFCF ( x = 0) ( x = striking position) ( x = L ) • Faust Code Damping Filter “Waveguide Formulation” Tuning Filter Dynamic Level Filter Equivalent System by Delay Consolidation: Overdrive, Feedback String Output Speaker Bandpass Coupled Strings Hammer Delay Delay Strike f(t) Wah Pedal Faust Libraries Filter References Julius Smith LAC-2008 – 8 / 66
String Model Excited Externally at One Point Example Output + Outline f ( n ) Delay Delay Why Now? “Agraffe” “Bridge” Hammer Strike f(t) Filter Rigid Yielding EKS Intro Termination Termination Pick Position Comb - Delay Delay f ( n ) • Physical Excitation • Pick Position FFCF ( x = 0) ( x = striking position) ( x = L ) • Faust Code Damping Filter “Waveguide Formulation” Tuning Filter Dynamic Level Filter Equivalent System by Delay Consolidation: Overdrive, Feedback String Output Speaker Bandpass Coupled Strings Hammer Delay Delay Strike f(t) Wah Pedal Faust Libraries Filter References Finally, we “pull out” the comb-filter component: Julius Smith LAC-2008 – 8 / 66
Pick-Position Comb Filter Outline Equivalent System: Comb Filter Factored Out Why Now? String Output EKS Intro Pick Position Comb g(t) Hammer • Physical Excitation Delay Strike f(t) • Pick Position FFCF • Faust Code Delay Filter Damping Filter Tuning Filter 1 + z − 2 M z − N H ( z ) = z − N 1 + z − 2 M � � Dynamic Level Filter 1 − z − (2 M +2 N ) = 1 − z − (2 M +2 N ) Overdrive, Feedback Speaker Bandpass Excitation Position controlled by left delay-line length • Coupled Strings Fundamental Frequency controlled by right delay-line length • Wah Pedal Derived originally (1982) by transfer-function factorization • Faust Libraries References Julius Smith LAC-2008 – 9 / 66
Pick-Position Comb Filter in Faust ������� Outline ����� Why Now? � EKS Intro Pick Position Comb • Physical Excitation • Pick Position FFCF beta = hslider("pick_position", • Faust Code 0.13, 0.02, 0.5, 0.01); Damping Filter Tuning Filter P = SR/freq; // fundamental period in samples Dynamic Level Filter Pmax = 4096; // maximum P (delay-line allocation) Overdrive, Feedback Speaker Bandpass ppdel = beta*P; // pick-position delay Coupled Strings Wah Pedal ffcombfilter(maxdel,del,g) = Faust Libraries _ <: delay(maxdel,del) : *(g) : + ; References pickposfilter = ffcombfilter(Pmax,ppdel,-1); Julius Smith LAC-2008 – 10 / 66
Outline Why Now? EKS Intro Pick Position Comb Damping Filter Tuning Filter Dynamic Level Filter Overdrive, Feedback Speaker Bandpass Coupled Strings EKS Damping Filter Wah Pedal Faust Libraries References Julius Smith LAC-2008 – 11 / 66
EKS Damping Filter Outline Original: Why Now? � 1 � EKS Intro H d ( z ) = (1 − S ) + Sz − 1 , S ∈ 2 , 1 Pick Position Comb Damping Filter • EKS Damping Filter Later: Symmetric FIR (delay always one sample): Tuning Filter H d ( z ) = h 1 + h 0 z − 1 + h 1 z − 2 = z − 1 � h 0 + h 1 ( z + z − 1 ) � . Dynamic Level Filter Overdrive, Feedback Speaker Bandpass Faust Implementation: Coupled Strings t60 = hslider("decaytime T60", 4, 0, 10, 0.01); Wah Pedal B = hslider("brightness", 0.5, 0, 1, 0.01); // 0-1 Faust Libraries References rho = pow(0.001,1.0/(freq*t60)); h0 = (1.0 + B)/2; h1 = (1.0 - B)/4; dampingfilter(x) = rho * (h0 * x’ + h1*(x+x’’)); Julius Smith LAC-2008 – 12 / 66
Outline Why Now? EKS Intro Pick Position Comb Damping Filter Tuning Filter Dynamic Level Filter Overdrive, Feedback Speaker Bandpass Coupled Strings EKS Tuning Filter Wah Pedal Faust Libraries References Julius Smith LAC-2008 – 13 / 66
Recommend
More recommend