bass
lead
2 loops, 0 filters (2 workers, 1 AudioWorklet) tick: 0.000, time: 0.000 (120 bpm)
Feedback FM
A simple example of frequency modulation synthesis with feedback.
Log in to post a comment.
ollerich
· 2023/10/14
Neat trick to make FM more powerful with very little effort.
reinder
· 2022/11/21
Super cool, and it is nice to see the effect of different feedback values using a probe.
feedback
1.30
decay
0.05
input.feedback = 1.3; // min=0, max=4, step=0.001input.decay = 0.05; // min=0.0001, max=0.1 ,step=0.0001// Feedback frequency modulation happens when the oscillator modulates itself.// This can lead to very interesting phenomena!// If there is no feedback, the signal is a sine wave.// As long as the feedback value is less than 1, everything is fine.// When it increases beyond that, weird behaviors start to emerge,// including chaotic behavior (which we hear as noise).const feedbackFM = synth.def( class {constructor(options) {this.v = 0; // Last value of the synththis.phase = 0;}process(note,env,tick,options) {this.phase += ditty.dt * midi_to_hz(note);// The next value depends on the last valuethis.v = Math.sin(2*Math.PI*this.phase + input.feedback * this.v) * env.value;if(options.probe && tick < 0.5) {debug.probe("feedbackFM", this.v, 1, 5/midi_to_hz(note));}return this.v * 0.2;}}, {attack:0.0001, decay:() => input.decay, probe:false});// A simple bass + lead patternditty.bpm = 120;const nn = [c3,f2,ab2,g2];loop( (i) => {feedbackFM.play(nn.ring(Math.floor(i/16)));sleep(0.25);}, {name:"bass"});const nn2 = [0,c4,eb4,0,c4,f4,0,c4];loop( (i) => {if(nn2.ring(i)) {feedbackFM.play(nn2.ring(i), {decay:() => 3*input.decay, probe:true});}sleep(0.5);}, {name:"lead"});
684 chars