Showing posts with label interpolation. Show all posts
Showing posts with label interpolation. Show all posts

Tuesday, 25 February 2020

256 oscillators (I mis-counted) plus Detune control...in a Max For Live plug-in.

My excuse is that I was distracted. On Twitter I under-stated the number of oscillators in my INSTframeOSCmr Max For Live plug-in for Ableton Live 10. There are actually 256: 64 per frame, but there are two parallel pairs of frames, and if you select the 'Stereo' button, then there are two separate oscillator banks per channel, so what you hear is 256 oscillators in total.


But whilst I was looking at the design, I saw a better way of doing the stereo routing, and so I added that. I also figured out a way to solve one of the biggest problems that I had with the user interface - drawing lines in the Frequency grid. The result is INSTframeOSCmr02, as usual a free upgrade from maxforlive.com.

I also realised that the frequency grids aren't easy to understand, so here's a guide to using them, plus details of the new 'Detune' control.

First we need to see how the frequency grid and the spectrum plots align...

Spectrum plots and frequency grids


1. Single low frequency

Here's a spectrum of the basic frequency grid setting - a horizontal line. This gives a single frequency at the output. (Note that the 'Detune' rotary control is set to zero.)



One way to think of how this is working is to just take the frequency grid and rotate it clock-wise - that horizontal row of orange blocks turns into a vertical line, which is the single frequency shown in the spectrum (Okay, so spectrum analysis always turns frequencies into these weird spikes that are narrow at the top and wider at the bottom, but that is just the way that the maths works). Now that the frequency grid is rotated, low frequencies are on the left, and high frequencies are on the right - just as in the spectrum:



2. Single high frequency

If we re-draw the orange blocks at the top of the frequency grid, then we get a single frequency 'spike' at a high frequency in the spectrum:


And if we rotate the frequency grid, then you can probably see how the two line up...:



3. Two frequencies: Low and High

If we draw low and high frequency horizontal lines in the frequency grid, then we get two lines in the spectrum. (Notice that the oscillator index doesn't matter to the spectrum - you can try it yourself by drawing the two horizontal lines with different positions, and the spectrum will stay the same):


And the rotated frequency grid now looks like this (the blue cursor just happens to be where the two orange lines change frequency - this isn't significant!):



4. Three frequencies

So what about three frequencies? Well, we just draw three horizontal lines in the frequency grid:


And the rotated version looks like:


At which point you may notice that the spacing of the three frequencies in the frequency grid and the spectrum are different! This is because the frequency grid horizontal axis is 'linear', where the frequency goes up in equal steps, whilst the spectrum's horizontal axis is 'logarithmic' where the frequency goes up in steps that keep doubling. This is exactly the same way that notes double in frequency when you transpose them by an octave. So a C2 at 110 Hz, becomes C3 at 220 Hz, and a C4 is 440 Hz, whilst a C5 is 880 Hz. So the spectrum's 'logarithmic' horizontal axis is a good way of showing musical intervals: a C2, C3, C4 and C5 would all have the same horizontal spacing. Unfortunately, the Max 'multi slider' object that I'm using for the frequency grid does not have a logarithmic axis option.


5. Detune

You can see how the logarithmic horizontal axis works by adding 'Detune' to the 'Two frequency' example. Notice how the low frequency (the right-hand orange horizontal set of blocks in the frequency grid) gives a wide band of frequencies in the spectrum, but the high frequency (the left-hand orange horizontal set of blocks in the frequency grid) gives a much narrower band of frequencies. The detune values that are applied are the same in both cases - the frequencies that are added or subtracted are the same, but the way that the spectrum shows the resulting band of frequencies is different. Actually, to sound correct musically, then the detune values should be larger for higher frequencies, but that's not how I programmed it...


Okay, that completes the tutorial on the alignment between the frequency grids and the spectrum plots.

How to use the frequency grid...

1. Single frequency

Now that you have a better idea of what is happening on the frequency grid and the spectrum, let's look at that single frequency example again. When you look at the frequency grid and spectrum now, then you should see that the horizontal orange set of blocks in the frequency grid corresponds to the single 'spike' in the spectrum plot:



2. Rising ramp

And next, the plot that seems to confuse people. A rising ramp on the frequency grid... Remember that the horizontal axis is the oscillator index, so what the rising orange line means is that the frequency goes up as the oscillator index goes up - each oscillator will produce a different frequency. So this will produce a block of frequencies:




3. Chords

Next, some horizontal lines drawn by dragging the mouse horizontal across the grid. This gives four different frequencies (a chord!), because all of the oscillators along the horizontal axis are set to the same vertical frequency:




4. Wobbly lines give bands of frequencies

And now to that problem I mentioned. If you aren't good at drawing horizontal lines with the mouse, then you actually don't get single frequencies, but you get broader 'bands' of frequencies. if you look, you can see that the lines are not horizontal, they are 'wobbly' in the vertical direction, and this produces the bands of frequencies in the output:



5. Detune...

Now for Detune. Here's that first 'single frequency' setup, but with the 'Detune' rotary control turned up past half-way, it is as if that horizontal line was very wobbly up and down vertically. So now you don't need to try to wobble the lines, you just turn up the 'Detune' rotary control. What you get is bands of frequencies instead of single ones:



6. Detuned chords

Finally, a nice neat horizontal 'chord' grid, but with quite a lot of 'Detune' - so you get several bands of frequencies all mushed together (The screenshot doesn't capture the dynamism of the spectrum that you get here - it is going up and down all over the place!):


The Detune rotary control saves you the hassle of trying to draw wobbly horizontal lines - and most importantly: you can quickly adjust the control, instead of having to redraw wobbly horizontal lines with more or less wobble.

Detune?

The 'Detune' rotary control applies little frequency offsets to the oscillators. It does this with different values for each grid - each grid has a captured list of random values that it uses to apply the detuning to the oscillators. Which brings me to this post's 'Max' content, and it concerns the 'vexpr' object.

Vexpr works on lists. Give it a list like (1,2,3,4) and it will process the 1, then the 2, then the 3, and finally the 4. So one object in Max allows you to change four values at once. So in INSTframeOSCmr I use it to process the frequency grid, which is a list. I'm going to use a single diagram with numbered 'points of interest':



1. This is a 'bang' event that indicates that a frame has been activated, and that the oscillators should load new values for their frequency and amplitude.

2. The frequency grid outputs a list of 64 frequency values.

3. This message box contains a list of 64 different randomly-generated 'Detune' values.

4. The 'Detune' rotary control controls how much detune is going to be applied to the frequency grid output values (which is a list of 64 frequency values).

5. This is the first of two 'Vexpr' objects. This one has 'Scalar Mode 1' set, and so it multiplies every value in the list of detune values by the single value from the Detune control. In this case, the Detune is set to zero, so the output of this Vexer object will be a list of 64 zeroes.

6. This is the other 'Vexpr' object. This one does not have Scalar Mode 1 set, and so it works on two lists. It adds the list of frequency values from the frequency grid (2) with the list of Detune values, so if you imagine that the 'Detune' rotary control was set to something other than zero, then the list of detune values would be 64 different randomly-generated values, and they would be added, one by one, to the 64 frequency values from the frequency grid output. If lists were not used here, then there would need to be a lot of * and + objects in this Max For Live Patch! (As a quick aside, what would happen if this '+' object was a '*' (multiply) object instead? Would this affect how the detune is applied to the frequency values?)

7. I have cheated here by pasting in a message box containing the 64 frequency values that would have been output if the Detune control was higher than zero!

8. The 'detuned' list of frequency values eventually gets to the 'ioscbank~' object, which contains the 64 oscillators for this frame.

Note that the two different versions of Vexpr do very different things.

  • The Scale Mode 1 version takes a list and processes every item in the list with a single value (from the Detune rotary control in this example).
  • The other version (without the Scale Mode 1) takes two lists, and processes every item in one list with the same item in the other list. 

Getting INSTframeOSCmr

You can get the updated version of  INSTframeOSCmr here:

     https://maxforlive.com/library/device/6012/instframeoscmr

Here are the instructions for what to do with the .amxd file that you download from MaxforLive.com:

     https://synthesizerwriter.blogspot.co.uk/2017/12/where-do-i-put-downloaded-amxd.html

(In Live 10, you can also just double-click on the .amxd file, but this puts the device in the same folder as all of the factory devices...)

Oh, yes, and sometimes last-minute fixes do get added, which is why sometimes a blog post is behind the version number of MaxForLive.com...

Modular Equivalents

In terms of basic modular equivalents, then INSTframeOSCmr would require two LFOs, and 256 VCOs, a lot of stored parameters (blocks of 16?) to do the frame loads, a mixer and a Ring Modulator, giving a total of well over 260 ME, which is the biggest count so far, I think. You might want to use some specialist additive oscillators instead of brute-force VCOs!

If you find my writing helpful, informative or entertaining, then please consider visiting this link:




Friday, 21 February 2020

128 oscillators in a Max For Live plug-in...

Every so often, I produce a sound generator. When I was a kid it was neon relaxation oscillators or cascaded unijunction oscillators, but these days they tend to be implemented in Max For Live. Since BankOSC, I've been exploring some ideas to see if I could come up with another simple but powerful user interface to Max's 'ioscbank~' object, and I'm going to share the result with you now.

INSTframeOSCmr


INSTframeOSCmr builds on INSTbankOSC, but quadruples the number of oscillators, has two independent sound generating channels, and as with many of my generators, there is is a ring modulator in the output stage. There are now 64 oscillators in the oscillator banks, and a simpler user interface -BankOSC was cool, but it wasn't straight-forward. FrameOSC has two channels (A and B), each of which contains two 'Frames'. The frames contain frequency and amplitude lists for the 64 oscillators, and you can control the rate at which the frames are loaded into the oscillator banks - as well as how long it takes for the oscillators to adapt to the new parameter lists. But unlike BankOSC, where the frequency lists were fixed to MIDI notes, the frequency range in FrameOSC can be varied - so you can have each of the pairs of 64 oscillators playing frequencies over a range of a few hertz, to a few thousand hertz, and you can tune all the oscillators with an offset rotary control. This means that you can make a lot of very rich, thick, swarmy textural sounds which can nicely cover the spectrum from ethereal to scary.

Oh, and the oscillators are in stereo, so there's actually 256 oscillators in total...

The two numbers in orange between the frequency and amplitude grids are NOT related to the horizontal indexing of the 64 oscillators - this space was just a convenient place to put the 'Span' limits of the vertical frequency axis (anywhere else gets in the way of other UI elements). The left number is the lowest frequency set by the frequency grid and the 'Span' rotary control. The right hand number is the highest frequency set by the frequency grid and the 'Span' vertical control. It all makes sense once you are used to the way the grids and the span control work!

When you first see FrameOSC, you will notice the two pairs of frames: channels A and B. Each pair of fames has an underlying left-to-right scrolling cursor that shows the position of the LFO as it scans across the frames. The rate of the LFO is controlled by the 'Rate' rotary control, and the border of the left frame of the A pair will light up in white as the cursor scans across from left to right. When it gets to the right hand edge of the left frame, then the right frame will get a white border and the cursor will then scan across that. When the cursor reaches the right hand edge then it jumps back to the left and repeats. So, at a glance, you can see which frame is current active, which one will be active next, and how long it is going to be before the cursor reaches the edge and triggers the change. Remember that the cursor scanning across from left to right is just a metaphor for the LFO timing - it does not mean that the oscillators at that position are affected by the cursor.


When the border jumps from one frame to another, the frequency and amplitude parameter lists are loaded into the oscillators. The 'Smooth' rotary control sets how long it takes for the parameter changes to happen. The range is from more or less immediately, through to multiple tens of seconds. If you set the LFO rate to be fast, and have a long smooth time, then you won't hear much happening, because the oscillators can't track the changes, but if you reduce the smooth time, then you will gradually hear the changes happening with more and more effect, until at very short smooth times, the oscillators will change from one set of parameters to another very quickly. Fo slower LFO rates, then the smooth control has much the same effect - if it is set too long then the changes occur very slowly (or maybe never reach the limits, whilst faster smooth times will give more abrupt changes.

The frames contain editable lists of frequency and amplitude for the 64 oscillators - you just click and drag in the rectangles. For the Frequency list, vertical is frequency, which for the amplitude grid, vertical is amplitude. Left to Right is the 64 oscillators. There are two rotary controls in each frame: 'Span' adjusts the frequency span of the frequency list, whilst 'Tune' adjusts the pitch up and down - just an offset control, really. At the far right hand side, there are volume controls for the A an B pairs of frames, plus a third volume control for the ring modulator (RM).


To encourage experimentation, and to avoid too much of a 'preset' mind-set, I have deliberately not included memories in INSTframeOCmr - think of it as being like a modular synthesizer that forces you to unlearn any reliance you may have developed for the instant recall of sounds. I await the first modded versions with memories added!

Notes

If you don't have any parameters set in the frequency and amplitude grids, then you aren't going to get very interesting output sounds. Zero Hertz at zero amplitude is not very useful. 

The LFO isn't quite what you might expect - it actually runs 16 times faster than the actual rate of crossing the frames, but this is so that it can drive the cursor. There is also a large amount of latency in the way it responds to slow rate settings - you may find that it appears to have stopped. You can press the 'Reset' button to reset the LFO cycle if this happens.

Ring modulators accentuate the difference between two sounds, so if you set very similar sounds in the A and B pairs of frames, then the RM output may not be interesting.

Remember that left to right is selecting oscillators in the grids, whilst vertical is frequency or amplitude. These are not waveforms or spectra.

If you like a set of parameters, use the 'Save' icon in the top right hand corner of the device in Ableton Live to save it as a 'preset', so that you can get it back later on!

INSTframeOSCmr does not respond to MIDI notes. It produces an output all the time, and this is not pitchable or triggerable using a keyboard. The frequencies are not on a scale, or a temperament - they are just raw frequencies.

Adding echo, delay or reverb after INSTframeOSCmr will thicken the output even more.

Remember that the cursor scanning across from left to right is just a metaphor for the LFO timing - it does not mean that the oscillators at that position are affected by the cursor. I'm repeating this because this was the second thing that people said in the beta testing.

Yes, you can make it sound like Louis and Bebe Barron's soundtrack to the movie: 'Forbidden Planet'.  (This is the first thing that people said in the beta testing.) But you can do lots more than that. (Oh, and the reason is sounds like 'Forbidden Planet' is because recording lots of manually tuned oscillators tends to produce a distinctive sound...) And yes, that is a young Frank Drebin played by Leslie Neilsen, or is it the other way round, or something else entirely?

As always, INSTframeOSCmr is free!

Updated version


Version 0.2 is now available. I have added extra guides to how the frequency grids work, plus the new 'Detune' rotary control, and a 'Max For Live' 'What is happening inside the patch' detail for the 'Vexpr' object in a new blog post.

Getting INSTframeOSCmr

You can get INSTframeOSCmr here:

     https://maxforlive.com/library/device/6012/instframeoscmr

Here are the instructions for what to do with the .amxd file that you download from MaxforLive.com:

     https://synthesizerwriter.blogspot.co.uk/2017/12/where-do-i-put-downloaded-amxd.html

(In Live 10, you can also just double-click on the .amxd file, but this puts the device in the same folder as all of the factory devices...)

Oh, yes, and sometimes last-minute fixes do get added, which is why sometimes a blog post is behind the version number of MaxForLive.com...

Modular Equivalents

In terms of basic modular equivalents, then INSTframeOSCmr would require two LFOs, and 256 VCOs, a lot of stored parameters (blocks of 16?) to do the frame loads, a mixer and a Ring Modulator, giving a total of well over 260 ME, which is the biggest count so far, I think. You might want to use some specialist additive oscillators instead of brute-force VCOs!

If you find my writing helpful, informative or entertaining, then please consider visiting this link: