From the help for Tune Smithy
Skip navigation Overview Seeds etc User guide Main Window Musical note intervals Scales Midi in Analyse sound
Hide Contents

MFX Plug In

Intro - Using FTS in Sonar - Pitch bend settings -Setting your scale up in FTS -Timings for the plug in -Plug in options, Multi-channel retuning options - Plug in source code


You can use FTS as an MFX plug in for Cakewalk or Sonar. You can also use it with Cubase SX - see Tips and tricks: using Cakewalk Midi plug ins with Cubase SX (on-line web page)

You can install / uninstall the MFX plug in from FTS | In | Options | More Options . Alternatively, choose to install it when you install FTS.

You need to start Fractal Tune Smithy first to use the plug in. The plug in will start FTS for you if you haven't got it running already.

Then FTS will retune your midi stream in the same way that it retunes notes received via its In menu. However, instead of playing them itself, FTS returns them to the plug in. All this happens in the background. The only indication of anything happening in FTS is that the Time so far shown in the main window will get updated each time you relay some notes via FTS in this way. You can also see details of the most recent note relayed from In | Options | Note Played more Details .

This means you can play a fractal tune in FTS at the same time that you use FTS as an MFX plug in.

The plug in itself is a tiny dll in your Fractal Tune Smithy folder called fts_mfx.dll. Technically, all it does is to receive the stream of data from the host, send it to FTS via shared memory, receive it back again, and send it on to the host - and deal with the check boxes of course. All the main work is done in FTS itself.

Installing the plug in means to register it so that it shows up in drop lists of MFX plug ins. The dll itself gets copied into your FTS folder anyway - it's tiny.

The plug in uses its installed folder as the place to search for Fractal Tune Smithy if it needs to start it up, and it is also the place where it finds its help when you click on the help button. So, it is best left in its original location.

This plug in was written by request for musicians who use FTS with Cakewalk etc. So - some find it useful and helpful. But it isn't tested and debugged in the way that the main program is, and the user interface is rather minimal.

If there are easy to make changes, or not too tricky bugs to fix then I will do what I can. For more elusive things then I am just not familiar enough with the environment to work on it. The main thing there so far is that a few users report that this MFX plug in introduces latency - a lot like a sizeable fraction of a second - on their system. I have no idea what the cause is as I couldn't duplicate it here, and others are able to use it with no noticeable latency at all.

However - if you want to modify the plug in yourself, the source code is available. See Plug in source code


Using FTS in Sonar to retune a track or the input from the midi keyboard

Open a midi file with the track to be retuned from Sonar | File | Open . Sonar will make a project for it.

To apply the FTS mfx effect, go to the FX section for the track, and right click and choose FTS as the MFX effect.

In FTS, if you are new to the program, go to View | Midi Relaying , and click Standard Settings . Then choose the scale you want to use. For more about how they work, see Scales and Arpeggios s .

Click the play button and you will now hear the track retuned in FTS. (Be careful not to select FTS twice in this field, or it will get retuned a second time.)

If you set everything up like this, you will also find you can play to the synth from your music keyboard. If you get two notes played whenever you press the key - one from FTS and one from your soundcard or synth, then try setting the track Velocity to -127 in Sonar.

If you want to play on a dxi synth, insert the dxi synth you want to retune from Insert | Dxi Synth . As described in the help for Sonar, select All Synth Outputs , and you probably want to open the property page and rack page.

Now open one of the midi channels, and in the Out section choose your Dxi synth. Play the midi clip and it will be played on the synth.


Pitch bend settings for the synth

FTS retunes the notes using the Pitch bend messages - just like using the pitch bend wheel on your keyboard, except that it just sends a single "instant" pitch bend message each time.

For this to work, your dxi synth has to be able to respond to pitch bends.

First, be sure that the pitch bend range is set to 2 semitiones - this is the Midi standard setting, but you may find it gets preset to 0. You can use the resets check box in the MFX plug in to get FTS to set the pitch bend range for your synth - but you may need to do it by hand.

You can use the Test Pitch Bend Range button to check you have it set up correctly.

Then, some of these synths are kind of slow to respond to "instant" pitch bends, perhaps because they are programmed in expectation of a continuous change of pitch. The ones that work best with this technique are the ones that respond instantly to a pitch bend change.

Then, many synths are mono-timbral. This means that they make no distinctions between midi channels when it comes to playing the notes. For instance, if you play note 60 on channel 1 on such a synth, and then again in channel 2, then switch it off on channel 1, probably both notes get switched off.

With such synths, since the pitch bend gets set for the channel as a whole in midi, then you can only have one pitch bend in play at a time.

For such synths, you need to go to:

FTS | Out | Options | Midi Output Channels - set that to a single channel.

You will still be able to play parallel octaves and other twelve equal intervals in that channel. However chords that use other types of interval can't be played on these synths, because they require several simultaneous pitch bends.

If you prefer the music to be completely monophonic in that track, then set the Max Polyphony (in same window) to 1 as well.

If your synth supports Legato Monophonic you may want to investigate those options in FTS too.

More detail about why one needs simultaneous pitch bends to play microtonal chords

Suppose one wants to listen to the neutral third for instance - mid way between the minor and major thirds at 450 cents (or 11/8 if it is the ratio version one is interested in). Then one would play the C on channel 1 say, and then an E on channel 2, but make the channel 2 50 cents flat to get the desired pitch.

However monotimbral synths can't do this. As you add in the second note of the chord, you will hear the first note also gets pitch bent. So with this example tuning, if you play C and then add in an E to make your chord, you will hear C at 0 cents, followed by C bent down to -50 cents in unison with E at the desired pitch of 450 cents. Alternativly the C may just get switched off at that point.


Setting up your scale in FTS - quick summary

The notes get tuned to the current scale and arpeggio in FTS. Scales can be entered in cents, ratios or other notations. For a quick start on this see How do I make my own scales?. Two things to look out for especially there - be sure to include the 2/1 if it is an octave repeating scale, and be sure to add the word cents if your values are in cents, or use one of the shortcut methods in FTS for entering values in cents as described in that link.

Here are a few common types of scale that one may want to tune:

If you want to retune to a twelve note scale, enter your scale in the scale box in FTS, and choose diatonic as the arpeggio - the other notes get played as accidentals of the arpeggio.

If you want to play some other mode of the twelve note scale, say an Indian Raga, on the white notes, just choose it as the Arpeggio, and keep the original twelve note scale.

To play a scale which isn't a subset of any twelve note scale from white notes, just enter the scale and use Follow Scale as the arpeggio. It doesn't matter how many or few notes your scale has - if it is a six note scale for instance then the octave repeats will occur every six white notes on your keyboard (c, b, a', g'', ...). Or repeat one of the notes of the scale if you want the octaves to repeat every seven white keys on the keyboard

See How do I set things up to play in a particular scale from Midi In?


If you want FTS to stay in front of Sonar while you work with it, e.g. to enter a new scale and arpeggio, choose FTS | Help | Always on top . which will put all the FTS windows on top of everything else - and unselect it when you want it to go back into the background again.


Timings for the MFX plug in

Note that when you use the plug in to retune a midi file, the MFX standard works with a buffer which gets filled with notes in advance of being played, so changes in the scale or arpeggio in FTS may not affect what you hear instantly. You may need to wait for the next buffer to be sent to the plug in before you hear the tuning change.

The data is communicated from the plug in to FTS and back again directly using shared memory - so for all practical purposes this part of the process happens instantaneously - about as fast as it would be if one embedded FTS into Sonar directly. When relaying from Midi In in the plug in, the retuning should change instantaneously as the plug in gets sent the data immediately as it gets received, instead of in advance.


Plug in options

Midi Relay - select this to relay notes received from the midi in of the host app (ie. Sonar or whatever).

Mute - nothing relayed, switches off the sound

Bypass - all events are relayed exactly as they were received - bypasses this plug in.

Notes , Controllers , Patches , Pitch Bends - select which of these you want FTS to process. If you select Pitch Bends, this means that you can apply an extra pitch bend on top of the one FTS makes in order to retune to the current arpeggio / scale - effect is like using the pitch bend wheel from Midi In. If you unselect it, any pitch bends already in the event stream get ignored.

Note that if you unselect Controllers , you may find you still get some controllers in the output from FTS, - ones added by FTS. For instance you may get an All Sound off controller before pitch bends. To customise this see Out | Options | More Options - choose what you want FTS to send, and select Skip all controller messages from this if you want to have no added controllers in the output from FTS.

The reason why the standard setting for FTS is to send an all sound off before any new pitch bends it applies is to cope with any lingering resonances from earlier notes in the channel. This is done because with "instant pitch bends" sometimes you can get artefacts from the pitch bent resonances of earlier played notes that have stopped playing, but still continue to resonate.

Skip all controllers - whether in input stream or added by FTS - this can be used to remove those controllers just mentioned from the plug in instead of from within FTS. Also will remove controllers from the midi stream received by the plug in

Raw data - a MFX plug in may receive raw data - i..e. just the midi messages in their original format rather than in separate categories of note ons, note offs etc. Select this and they get sent on to FTS for processing. Which ones get sent on will depend on the other options you have selected. If you select Notes , and also Raw data , then both note ons and note offs in the raw data get sent on. Any events in the raw data not listed get ignored (at present anyway - let me know of any special requirements here.).

Do resets - this resets the pitch bend range, and other things, which you can configure from FTS | Out | Options | Resets .

If you change the selection for the Out field of the track, you may sometimes need to send the resets again yourself - do this by selecting Do resets again now (or on next note) - it will show as selected, and then get unselected again as soon as the resets get applied.

Log everything sent / received - this logs all the events to Fractal Tune Smithy\messages\mfx_log.txt . To erase the log and start again, unselect and then re-select this option - and it will start again from scratch, so the old version will get erased when you next play some notes.

Show Log... click this to see the log.

Verbose log - shows a few more details of some things in the log.

Skip all controllers - whether in input stream or added by FTS - FTS sends All Sound offs before a pitch bend - to stop any lingering resonances there may be from earlier notes that have been switched off already. If these all sound offs get relayed to the plug in they may switch off other notes if the order of events gets changed. This lets you skip them in the plug in without needing to change the FTS settings, so you can continue to use them in FTS.


Multi-channel retuning options

The standard settings for the plug in are fine for a midi clip with only one channel in use.

However, if your midi clip uses several channels then you may have some configuring to do.

You may find that the plug in is required to process the events one channel at a time, for instance, it may receive all the events for channel one before it receives any of the events for channel two.

In this situation, the plug in as presently programmed can't allocate the pitch bends for all the channels correctly, as it does each batch independently.

So when you retune a multi-channel clip,look at the plug in where it says " So far, one channel processed at a time (do a log to find details) ". If this changes to read " Events are being sent several channels at a time (do a log to find details) " then it may be okay, but it would be best to do a log to check whether all the notes for all the channels are received by FTS in one go, or if they are sent in some other fashion. You want them all to be received in one go.

If the events are all received in one go then that's fine, and there is nothing more to do to configure the plug in to retune your midi clip. Otherwise you need to investigate other options

You have several options to try out.

Relay notes on the channel received This is suitable if you want each channel to have monophonic lines, or to have notes in parallel octaves or other twelve equal intervals. You can only have one pitch bend at a time in a channel.Of course if you are retuning into a subset of twelve equal then you can have unlimited polyphony still.

Choose a single midi channel to relay, skip all notes from other channels - Only retunes the notes from that one channel,and the rest get ignored. You can retune the notes from this one channel with all the freedom you usually have with FTS - you can play up to 16 scale degrees simultaneously (plus any number of octaves of any of the scale degrees).

Another possible approach here is to leave both these check boxes unselected, and in FTS go to Out | Options | Out Channs . Then you will be able to choose exactly which channels to use for each miid in channel. The idea is to make sure that none of the midi in channels get relayed to the same midi out channel. By way of example, if the midi clip you are retuning has four channels in it, you could relay the first channel to channels 1 to 4, the second to 5 to 8, and so on.

Finally, if you can use the Midi Tuning Standard single note retuning or tuning bank sysexes to retune the notes, then you don't need to do anything, as then there is no need to apply extra pitch bends or remap the notes to new channels. To use this approach, in FTS you need to select Out | use MTS Tuning Programs . Choose the type of MTS tuning program you want to use from Out | Tuning progs Options No channel changes are needed, and the notes just get sent on in the original channels, with the addition of whatever sysexes are needed to retune them.


Plug in source code

This plug in is written in C++ which isn't my usual programming language (I use low level windows C). So - I would like to make the source code available for anyone who would like to tweak it or re-write it for their own needs.

Here it is: FTS MFX

It also has project files for Visual C++ 6.0, which may be useful for anyone else using it.

To build it, you will also need to download the Cakewalk SDK from:

and set your include path in your compiler so that it can find MidiFilter.h and the other headers, usually to:

C:\Program Files\DXi2 SDK\HostApp\include

or similar.

The MFX plug in basically starts up FTS invisibly, and then interacts with Tune Smithy while it runs using messages, and shared memory. You will see how it works in the source code - and that part of the plug in is straightforward enough I am happy to explain this process in more detail to anyone who is interested, and to add new features to the interaction on the Tune Smithy side.

I'm sure a lot more can be done in the MFX plug in to make it more user friendly or to work better. It is written in a very "C" programmer's style, so it is possible a C++ developer may want to start from scratch again, and just add in the memory mapping and windows messaging to a new plug in, taking any other ideas you like from this one. Most of the actual C++ code in this plug in is wizard generated..

Most of the code I wrote myself happens in :


(file FTS_MFX.cpp)

plus some gui handling in FTS_MFXPropPage.cpp

It is rather non C++ in its philosophy - the bit I did myself that is - as I bypass a lot of the C++ handling and use a global structure PROPERTIES prop declared in externs.h. That's part of the low level C coding philosophy I use in my own programs, which is very non C++ and non object orientated. To explain the background - in my programs, everything that persists in the user interface is declared as a global, so that the program has a similar view on the variables and structures to the user (I get around the usual problem of variable clashes by having long very descriptive variable names). However, I expect it is fairly easy to modify to a more normal C++ approach, for those thoroughly familiar with C++.

If you do a good mod of the plug in, then let me know and I will included it in the installer. If you do something that involves a fair amount of work, and want to charge for it - then you can sell it separately and I will link to your product on the web site and here.

You may want to let me know in advance if you plan to do a lot of work on it, in case in the interim I hear from anyone else who has similar plans - to avoid duplicated effort.

BTW the same technique could be used to develop other plug ins along the same line. I am often asked for a VST plug in. It is too much for me to take on at present, but if any of you are knowledgeable in this area and would like to write one then I am happy to include it in the installer as well - or link to your product if you want to charge for it.