Help for Tune Smithy

# FAQ - Composition Retuning

(Difference between revisions)
 Revision as of 16:32, 10 November 2008 (view source) (→First method - Scordatura scores - easiest approach for keyboard players)← Older edit Revision as of 12:39, 19 November 2008 (view source) (→First method - Scordatura scores - easiest approach for keyboard players)Newer edit → Line 27: Line 27: So the score still shows the same notes as before C, Eb etc. But you can use them to play something completely different, e.g. the C could play a 1/1, the D a 3/1 and the E a 5/1. Or you could set them up to play gamelan pitches, or the seven equal systems of Thailand and part of Africa - or whatever. What the notes actually play is up to your imagination or whatever your requirements are for the piece. So the score still shows the same notes as before C, Eb etc. But you can use them to play something completely different, e.g. the C could play a 1/1, the D a 3/1 and the E a 5/1. Or you could set them up to play gamelan pitches, or the seven equal systems of Thailand and part of Africa - or whatever. What the notes actually play is up to your imagination or whatever your requirements are for the piece. + + ===Your score is a playing score for a suitably tuned keyboard=== Keyboard players can read such a score immediately with no training at all on a suitably tuned keyboard. Their keyboard training and hand eye coordination takes care of everything. They may get a surprise at some of the notes they hear as they play. Also, the score they have to play may look very strange indeed, but once they are over that, if they just play keyboard keys corresponding to the notated notes, then they will play the intended pitches. Keyboard players can read such a score immediately with no training at all on a suitably tuned keyboard. Their keyboard training and hand eye coordination takes care of everything. They may get a surprise at some of the notes they hear as they play. Also, the score they have to play may look very strange indeed, but once they are over that, if they just play keyboard keys corresponding to the notated notes, then they will play the intended pitches.

## Contents

For tips for particular soft synths see FAQ - Soft synths

## How do I use FTS with my music notation software or sequencer?

### Intro

#### retune with FTS

The idea is to route the notes from your compostion software or sequencer through a software virtual midi cable or a physical midi cable to FTS. Then you can use FTS to retune the music to your desired tuning.

#### Edit the original unretuned score

You work with the original unretuned score in your composition software. With this method you don't work directly with the retuned score. Instead edit the original and use FTS always to do the retuning.

This means that you can use all the score editing capabilities of your composition software as usual, but all the notes are retuned through FTS so that you hear the result in the new tuning. This lets you compose directly in the tuning.

In effect you are using FTS as a kind of a retuning playback sound module.

#### Two main ways to do it

There are two ways to do this. One approach requires no new symbols or notations at all. You just use your existing composition software as it is, out of the box, but retune the notes in unusual ways. The other approach is to add new accidentals to the software using various midi tricks.

### First method - Scordatura scores - easiest approach for keyboard players

With this approach you continue to use a completely normal looking twelve tone type score - no special symbols or accidentals or anything. You don't need any special microtonal features in the composition software at all. But now it is possible to retune any of the notes on the score to any arbitrary pitch - and so you can reinterpret the standard notation as you like and use it to play music in other tuning systems.

So the score still shows the same notes as before C, Eb etc. But you can use them to play something completely different, e.g. the C could play a 1/1, the D a 3/1 and the E a 5/1. Or you could set them up to play gamelan pitches, or the seven equal systems of Thailand and part of Africa - or whatever. What the notes actually play is up to your imagination or whatever your requirements are for the piece.

### Your score is a playing score for a suitably tuned keyboard

Keyboard players can read such a score immediately with no training at all on a suitably tuned keyboard. Their keyboard training and hand eye coordination takes care of everything. They may get a surprise at some of the notes they hear as they play. Also, the score they have to play may look very strange indeed, but once they are over that, if they just play keyboard keys corresponding to the notated notes, then they will play the intended pitches.

The resulting score could also be played by a harpist, zither player, xylophonist etc - and of course the score can be played directly from your software, retuned by FTS.

The later examples in How use FTS to compose microtonally should give an idea of how this all works.

This approach is great for keyboard players and other players of fixed pitch type instruments - but not so easy to use for other instrumentalists, or singers or the like.

### Adapting the scordatura method for instrumentalists

Most of these keyboard type scordatura scores aren't easy to read at all if you need to work out what fingerings to use for the notes on a wind or string instrument say - or need to know the exact pitch to sing or play before you make the note. However, with care, you may be able to use some of these keyboard scordatura type scores with other instrumentalists too.

#### Repeating at octaves to make the scordatura score more friendly for instrumentalists

The main thing that will help instrumentalists to read your score may be to do it so that though the notes are strangely tuned, the system repeats at the conventional octave of the score. So for instance do it so that every C on the score notates one of the pitches of your tuning system (though in different octaves), every C# notates another pitch and so on. Then the instrumentalist has only a few pitches on the score to learn, and can play all the rest by octave shifts above or below the ones they have learnt.

Of course your tuning may have more, or less, than twelve notes to an octave. For the smaller scales, you can repeat notes if necessary to fit it in, so e.g. an unsually tuned pentatonic scale could be notated using only the white keys of the score, and since that still gives too many notes to an octave, two of them can be repeated. I include one scordatura type instrumentalist's score in the midi examples section - [midi_relaying.htm#rs_oct_pad_ex my recorder trio for the hexany tuning].

For the larger scales with more than twelve notes, you can spread the notes over two or more octaves of the score - and still achieve octave repetition - except that two or more octaves of the score correspond to one playing octave. So for instance you could spread a thirty one tone system over two octaves of the score.

#### Removing accidentals to make a scordatura score more friendly for instrumentalists

The accidentals in this sort of score might confuse an instrumentalist as the accidentals, like the white notes, can be retuned to any arbitrary pitch. The C# for instance needn't be a semitone above the C and may be nowhere near the actual concert pitch C.

So one way to simplify the score to make it easier for an instrumentalist to learn is to avoid use of the "black notes" altogether. Use just the "white notes". Then leave the clef sign out of your score altogether, or design a new clef. By removing these familiar signs, it looks like a new microtonal notation which happens to still have five lines.

Then decide for yourself how many lines of the score correspond to an octave and set up the retuning in FTS accordingly. It is still technically the same thing, a scordatura keyboard type score - but by removing the clef sign, avoiding use of confusing accidentals, and perhaps adding a new sign, it looks like something new, and this may make it more friendly for instrumentalists.

All these type of score are easy to set up with the Tune Smithy retuning. The challenge is for the instrumentalist to learn the pitches. It may help if they have audio clips to listen to, or reference retuned instruments to play them on.

### Second method - Scores with fine shades of accidentals

#### Notate the exact pitch to play

This is another approach. This time the score notates the exact pitch to play. So the notes on the score are interpreted normally, a C is still a C and a C# is a C# of some description - and special symbols for the accidentals are used to specify the pitch more exactly than usual. This is harder for a keyboard player to read but may be easier for an instrumentalist.

One common approach is to notate the music notated using ordinary twelve equal notes, with special accidentals by way of an indication of how much to sharpen or flatten each note. So for instance you would notate an E 5/4 above C at 1/1 as E flattened by 14 cents.

#### Use of twelve equal as the reference pitch for the score

This works because conventionally trained instrumentalists are used to pitching the notes to twelve equal. Also, most of the instruments they use are designed to achieve twelve equal pitches. So for instance a wind player might play the 5/4 type E by fingering a normal twelve equal E and then shade it just a bit flat to get the 5/4. Or perhaps play an Eb 6/5 above C at 1/1 by making the normal Eb just a bit sharp until they hit the sweet spot where it is in tune. Or play a 7/6 similarly by tuning the Eb a bit flat.

#### Use of other twelve tone tunings as the reference pitch for the score

NOTE though twelve equal is a common starting point here, the same idea can also be used with other tunings as the starting point. The score can be set up with any tuning you like for the naturals, though in this context, normally you will choose one that is close to the twelve equal pitches.

The pythagorean scale is a particularly good starting point for just intonation music. Or use any tuning that is more or less twelve tone. The players need to adjust to this reference tuning system before they play. E.g. a wind player may prepare their instrument for the tuning by closing / opening the holes a little before they play or indeed use a specially constructed instrument. Other players may learn how to play the reference tuning first.

#### The challenge for the software

The challenge then is - can we use our composition software to notate - and also play - fine shades of accidentals such as 14 cents flat or whatever. It can be done - with a bit of ingenuity.

#### Playing fine shades of accidentals using conventional composition software

Indeed, we can do this in FTS. You can make a score that can actually play arbitrary accidentals, using conventional notation software again, with a bit of extra work to set it all up.

First you set up a suitable scale in FTS. This should have the reference pitches which will be the "naturals" of the score - and also all the accidentals you need, all in one master scale.

Then set the arpeggio to play just the naturals of your tuning. Normally you will set the arpeggio to play just the white keys C, D, E, F etc. All the methods permit at least two distinct scale pitches for every note of the score and some permit you to have many fine distinctions. You could also make an arpeggio with a mixture of black and white notes, with the black keys also as reference pitches.

Then you need to add suitable notations to the score. The thing then is - how to tie the two together? How can you set everything up so that a particular notation on your score will change the pitch in FTS, so that you hear correctly pitched accidentals for each note?

Anyone familiar with midi will realise at this point that the only way to do this is to send some midi event to FTS. That's the only means of communication from the software to FTS. At least, it is the only option, if you are using conventional midi software and can't collaborate with the programmer of the composition software to devise other ways of communicating between the two programs.

We could use MTS sysexes - they are ideally suited for this purpose - but unfortunately they are seldom supported by composition software. So in practice they aren't easy to use.

There is no other midi event we can send that is already builit into notation software as standard. So, we have to invent new ways of interpreting the standard midi events that you can send using standard midi composition software as microtonal accidentals.

#### How to do it in FTS

FTS has a wide range of options here. You can find them in the Accidentals symbols and special opts window (Ctrl + 61)

##### Volumes as accidentals

One simple approach is to use volumes as accidentals - play all the notes at half the usual volume in the notation software and get FTS to double the volume before it plays the note.

Then any note above say 64 midi volume is interpreted as an alternative accidental, and as its volume it uses double the offset of the volume from 64. E.g. a volume of 70 means to play the alternative accidental very quietly with a volume of 12 i.e. 2*(70-64). A volume of 127 will play the alternative accidental at maximum volume (well 126 instead of 127, but it is close enough).

An example may help make the technique clear. Suppose you want to distinguish D# from Eb. To get the D# with volume 80, you might just play an Eb/D# at half that volume, 40. If you want the Eb at the same volume, play your Eb/D# at half volume again - but with a volume boosts of 64 to give a total volume of 104. FTS will then retune your note to an Eb at volume 80. This may seem a bit complicated - but if your notation software has the flexibility to let you enter in volumes for individual notes, it shouldn't be hard to get used to the system.

As your scale you would use a scale in FTS that runs

... D D# Eb E

and as the arpeggio in FTS, choose the pitches you want to use for C D E ... from the same scale.

The other methods all follow similar principles, but differ in the midi events you use in the score to communicate the choice of accidental to FTS.

##### Unused midi instruments as accidentals

Another method is to use some of the rarely unused midi instruments to indicate accidentals. Most scores won't need the helicopter or bird tweet or sea shore for instance, so those could be inserted into the score as accidentals immediately before the note you want to change. This particular one works best with monophonic lines - it would be ideal for orchestral scores. If used with chords, you have to ensure somehow that the notes of the chord are sent in the right sequence so that each accidental is sent immediately before the note it applies to (e.g. always slightly arpeggiate the chord, as imperceptibly as possible if it is meant to be crisp).

You could make a graphic for the accidental and associate that graphic with a midi event to change to the corresponding instrument. Then just insert that graphic and instrument before every note that needs to be changed. By using several instruments in this way you can distinguish fine shades of accidental in the score, for instance to get three sizes of sharp and three sizes of flat you need six unused instruments. Then make sure you set up FTS to interpret them appropriately.

With chords, you need some way to put the accidental before just one note of the chord. E.g. to play C E G with the E slightly flat, you need the notes to be sent to FTS in this order : C, instrument corresponding to 14 cents flat, E, G. But your software may re-order the events as instrument change, C, E, G in which case the C would be flat instead of the intended E.

You can deal with these sorts of issues by staggering the notes to get a broken chord - or by saving to midi and editing the order of the events in the midi file.

The advantage is that it is so flexible as you can have any number of shades of accidental.

This method works, eccentric as it seems. The score will look fine, and sound as intended when played in FTS - but what is actually happening behind the scenes is eccentric.

Since the results can't currently be achieved at all in most notation software then this may well be an attractive first step forward for some composers.

See [midi_in.htm#patches_as_accid Patches as accidentals] and [midi_in.htm#Playing_accidentals Playing fine shades of accidentals from the music keyboard]

##### Adapting scores with special accidentals for keyboard players

A keyboardist may also be able to use a score with accidentals if they have a specially designed keyboard, maybe with split keys - and spend some time learning the accidentals for it.

Also maybe they could learn to use the volumes as accidentals - play a note a little over half its normal volume to get the sharp played very quietly.

I've tried it myself and find it tricky to use, especially if you want to play your sharp ppp. It feels odd to play a note that feels loud to the touch, to achieve a quiet sound. Also you need very fine control at that volume level. If you make the note just a fraction quieter than you intended, it changes your quiet ppp sharp into a sudden loud fff flat which is rather disconcerting. But that is probably just a reflection of my own lack of training.

I expect a professional trained keyboard player would probably find their way around the volumes as accidentals system easily enough. Maybe amateurs too can learn how to do it with enough time to learn how to use the technique in the tricky case of ppp passages using the sharps.

Some of the other options in the window are particularly meant for use by keyboard players. A keyboard player may find it easier to use the sustain pedal or sostenuto etc pedals as accidental shifting keys. Those options work best for solo lines, or in polyphony in which all the notes to play either sharps or flats. They are tricky to use if you want to have a sharp and a flat played simultaneously (the only way around is to play one note fractionally before the other with a bit of nifty footwork on the pedal between notes - or a very quick adjustment of the controller between the notes of a chord).

These options again could also be useful for notation software as well - anything the keyboard player could send as a midi event you can also notate on the score.

#### Sagittal notation

In the introduction I assumed that the accidentals were shifts in pitch away from twelve equal. But as you can see the way it is implemented in FTS will let you use any pitches you like as the accidentals. The shift is just a fixed number of scale degrees, not a particular interval - so depends on what you have set up as the "master tuning" in FTS for the complete scale including all the accidentals.

The other general system one can use with accidentals uses a number of fixed size accidentals. Then you start from the nearest Pythagorean twelve tone note as a basis. This scale is very close to twelve equal, but can be more suitable as a basis for getting to just intonation notes, as exactly the same size accidental is needed to get from E (pyth) to the 5/4 major third or (in the opposite direction) from Eb (pyth) to the 6/5 minor third, and so on. So if you want to show just intonation ratios using the twelve tone system with accidentals, it may be best to notate them in pythagorean. You need fewer accidentals, yet you can notate the pitches exactly rather than approximately. This is the approach used in the just intonation version of Sagittal (the new general purpose notation system for this kind of thing). It is soon to be supported in FTS hopefully.

This doesn't mean your player has to be able to find those base pitches or pitch the notes relative to them to that extreme level of precision - but for just intonation music for instance, they won't get that far wrong if they treat the accidentals as pitch shifts from twelve equal instead as a first approximation, then can find the sweet spot by ear around that pitch. As a composer of just intonation music, one will feel happier with this system perhaps, because one knows that the score notates the pitches exactly, so anyone well up on the notation who reads it immediately knows that you meant a 6/5 here, a 7/4 there, and a 13/8 somewhere else, and so on.

##### Ideas for the future to use with Sagittal

Sagittal type accidentals can be supported in existing notation software again using the same patches or volumes as accidentals idea - but it would be far easier to do with fixed sizes of accidental rather than to try to work with a huge scale that already has all the combinations accidentals in it that you might ever need.

When support for Sagittal gets added, I plan to add optional fixed size accidentals for patches (rather than the present ones which are numbers of scale degree steps) and a distinction between temporary and key signature accidentals, also a way of setting which note the accidental applies to by using an extra controller before the patch. All that should make it possible to write Sagittal scores directly in any conventional notation software and immediately hear them suitably tuned when played in FTS. It would be a matter of making a suitable midi events + graphics symbol for each accidental you need - and to save the need to edit the symbol for each note name one might do it for each twelve tone degree (so twelve copies of each symbol you use). Also a suitable Sagittal preset to set up FTS with the appropriate accidental sizes for each one. After that it would just be a matter of copy and paste to add the Sagittal symbols to the score.

If you have any comments or suggestions for the future, or ideas or want to give feedback about your findings about using any of these new tools in FTS do contact me Robert Walker support@robertinventor.com

### Future directions

It is possible to achieve either type of score separately using this retuning methods and your conventional composition software. However, if you use these techniques, there is no routine way to convert the two types of score - keyboard scordatura scores for keyboardists - and ones with fine shades of accidentals for instrumentalists - into each other.

This is a must have feature for anyone who wishes to write a proper microtonal notation program. As of writing, I don't know of any such program - plenty that have some support for microtonal accidentals in twelve equal, but none that allow easy conversion from the scordatura type layout convenient to a keyboardist to the accidentals type layout suitable for a string player, wind player or voice say.

One should certainly have both as the scordature score is by far the easiest way to play microtonal music for a keyboardist with a conventional keyboard. Mainly because you don't need to learn new fingerings or systems of notations to use it. It is also quite refreshing for a keyboardist, when you get unfamiliar sounding chords from the familiar fingering patterns. But alas at present it means you have to make two separate scores if you need to support both systems.

Also I don't know of any notation software that will let you show a score with a layout of any number of notes to the stave, e.g. sixteen notes to a stave or whatever. You can experiment with such layouts in the Tune window in FTS, but it is for display only. It is not editable after you have played your notes, and it is very rudimentary too with notes positioned spatially according to the timing, and with no notation differences between the notes of different sizes, just the spacing to show the length of the note to play..

I have plenty of ideas for such a program and would love to write one but it involves a _lot_ of work. That rudimentary window took far more work than you might think to get it done - you are talking there about some months of work at least over the years, possibly more. Though I may learnt some new coding techniques since then, and got a bit faster at coding some things, I hardly dare to think how long it would take to get anywhere near a reasonably functional editable notation software that would please microtonalists.

For instance to write a microtonal version of something like NWC - you would need a team of maybe a dozen programmers like me for a few years to get it done. Programmers who are particularly skilled in that particular area, maybe could do it much more quickly. There must be many programmers around who have long term experience of writing notation software already, or who may have tools and techniques to hand that will make it far easier for them to do this.

Though often asked to add this as a feature to FTS, and though I have plans to tentatively add a very rudimentary piano roll type score maybe some day - I rather hope someone else will write it first :-).

## How can I set up FTS to compose music for the Lambdoma

These instructions use the scordatura keyboard type approach.

Here are very quick instructions:

Go to the Lambdoma task in FTS. Make sure it is all set up properly for the Lambdoma (i.e. standard settings if necessary, or start it from the Tasks folder).

Switch off the drone.

Select a virtual cable from the In menu, e.g. Midi Yoke or Maple Sound. Use the same virtual cable for output in your composition software.

In the In As menu - sechoose how you want to interpret the staff notes. The option to play Lambdoma notes from consecutive white keys may be the easiest. Then every four lines of the score will correspond to one row of the Lambdoma.

For a more detailed step through, see Tutorials: How to set FTS up to compose music for the Lambdoma

## How do I retune a piece in FTS that needs more than 16 Midi channels?

If you have several midi out devices to use in the Out menu, or soft synths, then you can play your piece on several devices simultaneously, as a way to get around the restriction.

If you can't do that, then another approach is to make separate audio renderings of each part, then merge them together using an audio mixing tool.

If you want to make a midi recording, then you are stuck with the restriction to sixteen channels, as a midi file normally only records the midi events, not the midi device to play the notes on.

### How to do it

Select Out | Play on several devices at once

Choose which parts to play on which port from Out | File Associations - Options (Ctrl + 43).

So for example if part 1 is the microtonally demanding one, e.g. a highly polyphonic instrument, choose to play it on a separate output device, on all sixteen channels.

The help for File Associations - Options (Ctrl + 43) explains more.

### More than sixteen instruments - Out devices for In Devices

A large orchestral score may already have more than sixteen instruments in it, in which case it isn't enough to just use more Out devices to retune it. Your notation software may have an option to send different parts to different out devices to get over this limitation.

In that case you may be interested to use the new Set Out devices for In Devices (Ctrl + 192) which lets you set a separate Out device for each In device - then use multiple virtual midi cables to connect the notation software to FTS.

Rick McGowan has written an introductory tutorial explaining his system and findings for working in this way with GPO (the Garritan Personal Orchestra) and Finale. You should read that if you want to use GPO as there are various eccentricities of it that you need to work with and he has explored them and presents his findings about how to use the various particular instruments in the orchestra. It is also a good general introduction to using FTS for large scale orchestral work. He has kindly given his permission to include it in this help. It is here:FTS-How-To

The Out for In devices option needs a new section in this help - it is one of the new features that will get explained later after the release as I haven't the time to explain everything without delaying the release further for some months. Meanwhile if you have particular questions about it, then contact Robert Walker - support@robertinventor.com

## How can I write my own retuning midi software?

I'm very happy to help anyone else who wants to write microtonal retuning software. It often turns out to be harder than one thinks. I've had a lot of help from composers, users of my programs and other software developers myself.

If you want a quick start you can just use my PlayMidiLib library. Or you may find the hints here useful when planning the architecture of your software. I had to rewrite the pitch bend retuning in FTS several times and if I were to start from scratch again I'd plan it very differently. So maybe some of the tips here may help you avoid some of the blind alleys that I ran into when writing the code for FTS.

### Play Midi Lib - quick start

I assume you want to use the pitch bend retuning method. I've written a small introductory pitch bend retuning library in C. It is mainly for demo purposes, but will give an idea. It doesn't handle controllers. Also I should say it was written some time ago - some time when I have the time I'd like to update it and improve it.

However, if you are a complete newbie to midi programming, it might help get you started quickly with your first midi retuning app. If an old hand, maybe there will be a few things there you can use.

Here it is: Play Midi Lib

### Pitch bend retuning basics

These are things that are good to think about at the outset before you design the architecture of the software. If your retuning requirements are undemanding you may be able to use the #Simple approach

### Pitch bend sensitivity

It is nearly always 2 semitones but you can't rely on that 100%. Another range one can encounter is 1 semitone, and QuickTime makes a big thing of using two octaves as the pitch bend range. So, one should set the pitch bend sensitivity for each channel when you open Midi Out or at the start of the midi file.

Some synths ignore the pitch bend sensitivity message, then the user has to set it at the synth themselves. Sometimes the synth may seem to be locked into 12-et but actually has a setting that lets the user make it pitch bend sensitive. There's not much one can do about that, and no way to tell programmatically what pitch bend range is in use, if any, except to mention it in the help and be aware of it for user support.

Some users may want to set the pitch bend sensitivity to match the standard setting for their synth. One might also want to vary the pitch bend range for a particular piece. Some may want to put it right down to half a semitone for maximum accuracy - or make it as big as one or two octaves to permit long glitch free pitch glides.

So, it's also good to have an option to let the user set the pitch bend range themselves. If you do hard code it it is worth bearing in mind that one might want the user to change it in the future.

#### Keep track of pitch bends and channels

Make sure each note is played in a channel that has already been assigned the correct pitch bend already, and has the correct values for the pan and other controllers, or find a channel that is free for the new pitch bend.

So you need some way to keep track of which pitch bends have already been sent on each channel, so that you can reuse them (otherwise you soon run into problems in any moderately complicated music). Also, obviously keep track of which channels have notes in play so that you only apply a new pitch bend if there are no notes currently playing.

#### Keep track of controllers

Then if you process controllers, you need some way to keep track of those. E.g. if notes need to be panned to different stereo pan positions, then they need separate channels even if they require the same pitch bend.

So keep track of which controllers have been received for any of the In channels (or the midi file channels if retuning a midi file) - and keep track of which controllers have been sent on any Out channel. That way you will know if the channel is a suitable one to send a new note on or whether you need to change channel, and whether you need to send a new controller message for the channel or it has already been sent.

#### Midi note remapping

The simplest way to retune is to retune each midi note to the same midi out note, with just a pitch bend added. This will do fine for e.g. twelve tone tunings. But more often you may want to do more than that, e.g. you may want to play a single octave from several midi in octaves or whatever.

So - in that case you need to remap the midi note numbers and keep track of the midi map for every note played. One approach is to maintain a structure for each note played with information about which channel it was played on, which pitch bend was applied and so on. Then look it up whenever a note is switched off to find out which note to switch off in which channel.

To take a simple example - if you retune 60, 61 and 62 to successive degrees of say 72-et, they may all be played as midi note 60 with different pitch bends and sent on different channels. When the note is switched off, you need to know which channel it was sent on originally and which midi note number was sent in order to switch it off.

Bear in mind also that the user may want to apply a pitch bend as well to the retuned note. So you need to take account of that as well - add the pitch bend to the existing bend in the appropriate channel.

### Gotchas

#### Leave a gap after a note off before the next pitch bend if possible

It is good to leave as long as possible before applying the pitch bend as some notes may resonate for quite a while after the midi note off is received. E.g. for midi Orchestral Harps frequently, you switch off the note via midi, and the note may continue to resonate for as much as several seconds.

It is good to have an option to do an all sound off before the pitch bend, even if there are no notes currently sounding in the channel, to cut off any pitch bend resonances just in case - a suddenly cut off quiet resonance is usually less noticeable than a suddenly pitch bent resonance sounding at a 12-et interval with the new note. But this should be user configurable in case the user doesn't want to have an all sound off.

#### Apply the pitch bend as far in advance as you can

It is also good to apply the pitch bend as far in advance as you can, so before any notes are sounded at all, prime all the channels with suitable pitch bends - then with luck you may not need to apply any more pitch bends at all.

Some synths have pitch bend glitches if you apply a pitch bend immediately before the note to be played, though many are okay. It sounds like an extremely fast portamento slide of about 10 ms from the nearest twelve equal note - but it isn't the portamento controller that's doing this. It is also far faster than normal portamento slides, just slow enough so that you can hear the glitch, and hear that it is a sliding pitch, but over almost as soon as you hear it. A sort of portamento grace note perhaps might be the best way to describe it.

I've never quite figured out why they do that. My best guess so far is that perhaps it might be something to do with an expectation that the user would always start at a 12-et note and do a pitch slide from there. Interested to hear from anyone who knows more about this.

Many synths are okay. But even if it works okay on everything you try, you can be pretty sure that at least some of your users are likely to have synths or soundcards that play these instant pitch bends in a glitchy fashion.

Send the pitch bends well in advance and the music will sound fine for everyone. Though if the music is particularly demanding and in real time, there may be no way around it and you may need to do an instant pitch bend. An alternative is to add a short delay of a few microseconds after the pitch bend, which if it removes the pitch glitch and is only used rarely in a piece, it may be more acceptable than the glitch (so long as it is an option and configurable by the user).

### Simple approach

If your tuning is an octave tuning, has less than sixteen pitch bends and you pan everything to one stereo pan position with no special controller requirements, it is even easier. Just use a separate channel for each degree of the scale, and send an appropriate pitch bend message for each channel as soon as you open the midi Out for the device. Then you don't need to worry about the complexities involved in the channel remapping.

If it is a twelve tone tuning with all the notes within a quarter tone of the corresponding 12-et note, you don't even need to do any midi note remapping. Just send the pitch bends, e.g. pitch bend for degree 0 on channel 0, for degree 1 on channel 1 and so on - then from then on just send each note to the appropriate channel and it will be retuned as desired. So then you don't need to do the midi note number remapping either.

### Channel sharing on modern soundcards

Modern soundcards often let you play several instruments on the same channel simultaneously which is a great saving in numbers of channels.

#### Details

On these synths, the patch change message only affects notes played after the message is received. Notes already in play are unaffected. So e.g. in channel 1, you send these messages in the order shown:

Patch change violin channel 1 Note on 60 channel 1 Patch change viola channel 1 Note on 56 channel 1

Now you have notes 60 on violin and 56 on viola played simultaneously on channel 1.

This works on nearly all modern soundcard synths.

#### When both instruments play the same note number

You can even have two instruments playing the same note simultaneously in the same channel on some synths, though this is rarer.

Patch change violin channel 1 Note on 60 channel 1 Patch change flute channel 1 Note on 60 channel 1 Now both instruments are playing note 60 on channel 1

But you have to be careful there. If both notes have the same duration it is fine, but if one of them is switched off before the other, there is no way via midi to say which of the two should be switched off. Normally either one is switched off at random, or both are switched off when the first midi note off is received.

This situation is normally best avoided, make sure that if both instruments play the same note, they play it on different channels. But it can be a useful feature to include to permit this, with suitable warnings to the user that it is for occasional use only, as it can sometimes lead to a big saving in channels.

### Conclusion

Those are the main gotchas to look out for, I've found. This should be enough to get you well on your way towards programming a microtonal retuning application using the pitch bends method.

There are many other issues and other midi events to take account of if you get into more advanced midi programming. Examples include: legato retuning, midi sync and timing events, letting the user vary the pitch bend range, assigning out devices for in devices, and adding support for retuning sysexes. It may be worthwhile to consider how you might program some of those in the future when you design the architecture of your program, but you can get by fine without them initially.

If you have any questions do ask, I'm very happy to help anyone who wants to write microtonal retuning software in any way I can.

If you have any other tips or suggestions you are welcome to edit this FAQ