Add a phase-aligned formant generator and a gaussiam bell curve wavetable#218
Add a phase-aligned formant generator and a gaussiam bell curve wavetable#218chilichesdog wants to merge 1 commit into
Conversation
|
Thinking about this a bit, we need to make some changes to make this merge-able:
for both the gaussian window and the sine window, you can get the value from the window using the win_env function, which handles the lookup for you. |
|
One more thing. The cos waves should definitely use Osc instead of implementing their own lookup. To make this work, just give the Osc.next function a freq of 0 and a phase_offset value of your cosN_phase plus 0.25 (to make it a cos). This will make this much more maintainable. |
| for chan in range(Self.num_chans): | ||
| cos1[chan] = self.cos1.next( | ||
| freq=0, phase_offset=cos1_phase[chan] + 0.25 | ||
| )[chan] | ||
|
|
||
| cos2[chan] = self.cos2.next( | ||
| freq=0, phase_offset=cos2_phase[chan] + 0.25 | ||
| )[chan] | ||
|
|
||
| sin[chan] = self.sin.at_phase[ | ||
| window_type=WindowType.sine, interp=Self.interp | ||
| ](self.world, phasor[chan], self.sin_last_phase[chan]) | ||
|
|
||
| gaussian_phase[chan] = ( | ||
| sin[chan] * ((bandwidth[chan] / fund[chan]) * 0.25) | ||
| ) + 0.5 | ||
|
|
||
| gaussian[chan] = self.gaussian.at_phase[ | ||
| window_type=WindowType.gaussian, interp=Self.interp | ||
| ](self.world, gaussian_phase[chan], self.gauss_last_phase[chan]) | ||
|
|
||
| mod[chan] = ((cos2[chan] - cos1[chan]) * b[chan]) + cos1[chan] | ||
| out[chan] = mod[chan] * gaussian[chan] | ||
| self.gauss_last_phase[chan] = gaussian_phase[chan] | ||
| self.sin_last_phase[chan] = phasor[chan] | ||
| self.cos1_last_phase[chan] = cos1_phase[chan] |
There was a problem hiding this comment.
This is all looking really nice. Great work.
I've been looking at this code block for a while. I'm pretty sure this can be done without the for chan in that starts at line 93. The multichannel processing should be able to happen in parallel as a Self.num_chans SIMD vector.
Give that a shot. I know the SIMD stuff can be unfamiliar (it certainly was to me at first), so let me know if you want a more thorough explanation.
Once that is done, I feel like this is good for me to pull locally and take a listen, a which point, I think it'll be good to merge!
No description provided.