Using 31 bandpass filters to generate different waveshapes

Discuss how to use FL Studio

Return to “FL Studio Users Forum (Looptalk)”

Forum rules
Please read them here.
[You can only see part of this thread as you are not logged in to the forums]
Dave 201
Thu Nov 25, 2021 10:51 am

x

Using 31 bandpass filters to generate different waveshapes

I used 31 bandpass filters in patcher to generate different waveshapes. An overview of that patch is shown in the image below. All bandpass filters sit at different frequencies, which are by default always a multiple of a fundamental frequency (e.g., 2 times, 3 times, ..., 30 times the fundamental). The fundamental can be set using the surfaces.
Patch_principle_overview.PNG
I will now explain how to use that patch, then show a couple of details, share some thoughts, and provide a download at the end. I also created both an effect and an instrument patch, but I will primarily focus on the effect because the instrument is mostly the same.

And of course, with a patch like this, CPU usage will be quite high - up to 40 % on my laptop (HP EliteBook).


HOW TO USE

Firstly, to generate a waveshape, the sound passing through the filter must contain all frequencies. I used sytrus to generate such, which results in the following pulse-like shape:
Sytrus_pulse_for_filter.PNG
Pulse_for_filter.wav

As you can hear, the sound has a long release. This is necessary because, otherwise, the filter generates a click at the end. I also found that the volume of higher harmonics must decrease to generate a waveshape using filters (at least with the way I did it).

Now for the actual patch - there are two surfaces in the patch, one called “Mixer” and one “Macros”. The macros are the following:
Macros_overview.PNG
The Shape knob determines how the volumes of the overtones are distributed, which, by default, is set to generate a saw wave. The next example contains the sound of a saw wave with 30 overtones generated using sytrus, followed by the previously shown pulse passed through the filter:
Saw_vs_filtered_pulse.wav

You can hear the previously mentioned long release in the filtered sound. Here is a demonstration of what it would sound like if there was no release – there will be an audible click at the end:
Filtered_pulse_no_release.wav

Turning the shape knob to 33% (the lower large marking), the resulting waveshape will be a square. Here is the same comparison as before but with square waves:
Square_vs_filtered_pulse.wav


Of course, the filter isn’t limited to the pulse I’ve shown. For example, you could use it to filter brown noise as well:
Filtered_brown_noise.wav

And doing a frequency sweep with brown noise for the fun of it:
Filtered_brown_noise_frequency_sweep.wav


I will now use brown noise to go through every knob and give an example for each. The fundamental volume and frequency remains unchanged by all knobs in the macros surface. I will get to how to change its volume, but the fundamental frequency can be changed using the keyboard. For the following examples, it’s set to C2:
Turning the pitch knob will change the pitch of all overtones:
Filtered_brown_noise_pitch_knob.wav

The frequency knob changes the frequency of all overtones by the same amount:
Filtered_brown_noise_frequency_knob.wav

The detune knob changes the behaviour of the overtones when the fundamental pitch changes. In this example, the detune knob is turned up fully, and the fundamental pitch changes by one octave:
Filtered_brown_noise_detune_knob.wav

As you might have spotted in the first image of this post, every overtone has a gate as well. This is what the xy controller is for. Here are two examples, the first raises the threshold (y-axis) with the release (x-axis) set to half, and the second one with the release set to full.
Filtered_brown_noise_threshold_half_release.wav
Filtered_brown_noise_threshold_full_release.wav

The bandwidth knob increases the bandwidth of every band, starting with the higher overtones and later opening up lower overtones (including the fundamental at the end):
Filtered_brown_noise_bandwidth_knob.wav

And finally, the shape knob, which I mentioned earlier:
Filtered_brown_noise_shape_knob.wav

With the last example, you can also hear awkward variations in volume. This happens because the “Gain compensate” feature is not implemented perfectly here. This feature is controlled using the smaller knob to the right of the shape knob. There is also a second one for the bandwidth control. The “Gain compensate” feature attempts to adjust the output signal when, for example, increasing the volume of every band, or increasing the bandwidth of every filter and letting more of the original signal through. The gain compensate knob adjusts the amount of compensation that will be applied.

The mixer surface as seen below is then for manipulating every harmonic individually, providing the same features that the macros control.
Mixer_overview.PNG
From here, it is also possible to adjust the volume of the fundamental, or to change its frequency to any arbitrary value using the slider at the bottom. I won’t explain everything in detail here, it’s just all harmonics listed in a row, along with their controls.

As mentioned, there is also an instrument version of this patch, which can be seen below. This patch has the surfaces as the effect patch.
Instrument_patch_overview.PNG
Here, SimSynth (which I use for the brown noise) is layered with sytrus (which generates the pulse I’ve shown earlier) to generate the following sound:
Brown_noise_pulse_layered.wav



HOW IT WORKS

Now I will go into more detail on how this patch works below the surface, feel free to skip this part if you don’t like technical stuff.

The following image gives an unobstructed view of the patch.
Patch_overview.PNG

Let’s start with the shape knob. I used Fruity X Y Z controllers to create mappings for every overtone’s volume. The image below shows the mapping of the first three overtones, where you can see 4 points at different positions. The vertical position of these points is the volume and horizontal for the knob’s position. Points 1 follow the Fourier series for a saw wave, points 2 the one for a square wave, and points 3 and 4 are just for selecting all even and odd overtones, respectively.
Volume_mapping.PNG

The bandwidth knob works in a similar way as the shape knob. The mappings are a little simpler, and I think the image below gets the idea across well enough without requiring further explanation.
Bandwidth_mapping.PNG

To control the pitch of every overtone, however, I used fruity formula controller. I thought this was necessary, as the pitch knob’s position needs to be mapped in a specific way to the frequency knob of the fruity eq 2. To be more precise, the mapping generally needs to follow a Log10(x)/3 curve (x being the pitch knob’s position). The actual formula I use is the following:
Pitch_formula.PNG
The result of this formula will later be added to the frequency of the fundamental, so I only need to calculate the relative distance of each overtone to the fundamental here. Going through the formula from left to right, the first term within the Log10 is a 1. This is necessary because a logarithm of 1 is zero, which just means that the frequency of the overtone in question equals the frequency of the fundamental if you turn the pitch knob down to zero.
The next term is 100*(b-0.5), where b is the position of the frequency knob from the “Macros” surface. This expression is zero by default.
The last expression actually depends on the overtone. The general version would be 20*n*a, where n is the number of the overtone in question, and a is the position of the pitch knob from the “Macros” surface. For example, the first overtone would result in 20*1*a, the second overtone in 20*2*a, the third in 20*3*a, and so on. The pitch knob is set to 0.05 (=1/20) by default.
Then you just divide the whole Log10 business by three and that’s basically it.

The output of this formula is then passed onto the pitch knobs in the “Mixer” surface, which go on to the patcher instances named (for example) OT 1-10, where it passes through the formula below before controlling the frequency of the bandpass filter.
Pitch_formula_including_detune.PNG
Here, in the first term a*(c-0.5), a is the frequency of the fundamental, and c is the output from the detune knob(s). The last term is just b, which is the output from the previous logarithmic formula. You can see here how detune works – it changes how the fundamental is added to the overtones, which means it no longer scales 1 to 1 with the fundamental frequency.

Alright, I think that covers everything worth explaining. Feel free to ask if you want to know anything else about the patch.


FINAL THOUGHTS

Now for some final thoughts on why I did this and some features I would have wanted while creating it:
First, the reason I almost immediately jumped to filtering brown noise is that I wanted to use the gates to randomly turn on/ off different overtones. Together with the bandwidth letting through random frequencies spread around their centre frequency, this creates a sound that is, “on average”, a saw wave (or whatever the shape knob is set to). The following example uses brown noise layered with the pulse I’ve shown initially to demonstrate the idea:
Brown_noise_pulse_layered_threshold_half_release.wav

To have a sound consisting of such structured randomness was the goal behind creating this patch.

A feature I would have wanted was something like a spreadsheet controller – like fruity formula controller, but allowing multiple outputs, formulas, and to use results from one formula in other formulas. I imagine something like excel, which also includes features for easily copying formulas to other cells. I suppose something like a script controller would work too, where you could define variables as inputs or outputs as needed. The main point being here that I don’t want to copy-paste fruity formula controller or x y z mapper 30 times just to map one input to multiple outputs, so a way to easily create many outputs based on one input would have been nice.

Then, of course, as far as I know there is no easy way to make the instrument version of this patch polyphonic. It would be useful to be able to split a midi signal into multiple voices without having to use something like note-colours – just an easy way of knowing which notes are played at any given time would be enough.

Anyways, thanks for reading! Here is the download for the effect and instrument patch:
Nois_filter_module.fst
Nois4_1.fst
You do not have the required permissions to view the files attached to this post.









Return to “FL Studio Users Forum (Looptalk)”