# Rebuild: SoundMorph TimeFlux

Since my modules have been ported to the NeverEngine Labs there will be a little change in direction of my blog. Because the modules are not for free anymore I can’t share them here and I can’t do any tutorials on them. If you’re interested in that you might want to sign up for the upcoming Spectral Lab.

So I decided to do something different here and this will be a series called **Rebuild** where I deconstruct and rebuild commercial plugins in Kyma. Since Kyma is such a flexible programming environment you shouldn’t spend money on plugins, instead you should build them yourself. While this takes a little time to do it leaves you with the opportunity to modify and recombine them to your needs.

The first part will be a plugin you maybe already heard of: SoundMorph TimeFlux (if you haven’t click the link to check out the product page).

First of all we’ll deconstruct it to see what’s happening here. Despite the very nice GUI it’s actually nothing special compared to what we already have in Kyma, we just need to translate it to the Kyma Language:

- 4 Source Files (2 for morphing, 2 for stretching): We can use Kyma’s Spectral Analysis to get the files for morphing and we’ll use Samples for the Stretchers
- 2D Fader controlling time and pitch: Shouldn’t be a problem to map that
- Morph Fader: Again no problem to map that
- 2 Stretchers: Sample with Rate control
- 2D Fader to interpolate Presets: That’s the tricky part actually, because we need to be able to store and recall values while the Sound is running
- Filters for Morph and the Stretchers
- Volume & Pan Options

Ok, so let’s start with the Morph A & B. All we need is open the Morph prototype and we get a SumOfSines (SOS) module already setup to morph between Carla’s voice and a cat screaming.

To get the PitchShifting we just put the following expression into the Frequency0 and Frequency1 parameters of the SOS: “default * (!PitchShift twoExp)” and change the range of the resulting PitchShift fader in the VCS to -1,1. This will give us a 1 Octave up/down PitchShifting effect.

Now for the time control: Just check the CtrlTime box and play the Sound again. Voilà an Index fader appears to control the time. Your SOS parameters should be set like this now:

Now open up the VCS and set up the faders PitchShift and Index to be aggregate by selecting both (make sure the Index fader is to the left of the PitchShift) and then choosing “Make aggregate” from the Widget Type dropdown menu in the VCS Editor. To match the TimeFlux look we also change the Morph fader to a horizontal fader. You should end up with something like this:

Now let’s go ahead with the interpolating Presets. There’s a nice module called PresetSpace which does exactly that. But that doesn’t allow us to modify the presets while the Sound is running, we would have to stop the Sound, play the Sound left of the PresetSpace, modify the Presets and then play the PresetSpace again. Of course it works this way but it’s not really handy, so I figured out another way:

We’ll start with 2 Constants (1 for !x, 1 for !y) feeding a Mixer set to 0:

Then we edit the corresponding VCS to get an aggregate 2D Pan Pot. This will use x for the magnitude and y for the angle. Move the dot and you’ll get the concept of this:

Now we need to use x and y to look up stored values and interpolate between them. You can use the InputOutputCharacteristic to do that. Starting with the y values we build the following:

The InValues are the angles (y-values) where we want to look up the stored OutValues and interpolate between them. So the InValues divide our range of values (0,1) by 8, or actually 9 but 0 and 1 correspond to the same angle position (left). The OutValues are created by an array containing 8 Store buttons which in this case sample & hold the current PitchShift value. In order to see the PitchShift value changing while we’re moving y we need a TriggeredSoundToGlobalController as well:

By using the hasChangedInLast expression we make sure that we can move !PitchShift (make sure AllowLiveOverride is checked) but it will follow the stored values when moving !y.

So far so good, but we only have 1-dimensional control by now, the x values are not used yet. In the end we need to interpolate between 4 values: 2 values if our magnitude x is 1 (which we have working already) but another 2 values if we move the point to the inner of the circle. Those other 2 points are on the opposite side of our current position. That’s a little difficult to explain so I drew this little graph:

Looking at this picture it should be more clear: When moving to the inner of the circle we need to interpolate between the interpolated opposite side of the circle. The interpolated opposite side will be generated in the same way but we use !y + 0.5 mod: 1 as the input. Then we’ll use an Interpolate module to interpolate between the outputs of the InputOutputCharacteristics. The interpolation of that is controlled by x * 0.5 + 0.5. This way if the magnitude is 0 (central point) the interpolation will be 0.5 so we’re exactly in the midpoint of the 2 InputOutputCharacteristics. If we move our point beyond that we changed the direction and therefore the opposite direction as well.

The signal flow now looks like this:

Now we need a way to recall the stored Presets in the VCS as well. It’s easy to do that using another 2 TriggeredSoundToGlobalControllers for x and y and the following expressions:

When hitting one of the Recall buttons the corresponding y value is triggered using this boolean chain. For the x values part just use a 1 in the Value field with the very same triggers.

Now we need to copy this for each parameter (except the x and y part) to get our interpolated Presets. Also we haven’t added the Stretchers yet, but those are just Samples with a !Speed parameter to control the Frequency. The overall Sound looks like this:

And after editing the VCS a little you end up with the final result:

I’ve added Volume Potentiometers and On/Off buttons already. The panning and the filters are trivial to do so I leave that to you. There are lots of possibilities to modify this, you can add more Presets of course and you can insert anything that Kyma offers you to process the outputs of the Morph and the Stretchers. Here’s an example of some GranularReverb fed by extracted Formants (using ExtractFormants of the SPC SR Volume One) for the Morph and some Stereo Delays on the Stretchers (all using samples from the Kyma Samples folder):

Enjoy!

## Leave a Reply

Want to join the discussion?Feel free to contribute!