back to list

Re: Tune Smithy Retuning Midi Player - how it does midi retuning usi

🔗Robert Walker <yahoogroups@...>

9/22/2008 1:12:53 AM

Hi Jill,

That's all right, sorry about the confusing language, I was using it as a metaphor for the midi reverse engineering, which I now see was confusing. Anyway I've got no worries about anyone disassembling the program as it is encrypted and compressed to protect from crackers, as are all my programs nowadays (otherwise, as for any program nowadays, they always get cracked within a few days of public release on the download sites).

I know the first thing on that link is about the PlayMidiLib but if you scroll down a little most of that section is about various things FTS does for the pitch bend retuning. Many of them may not be at all obvious from the midi file. For instance you should send all the pitch bends straight away before you play any note, if at all possible. To start with one might just send a pitch bend immediately before the note (that's what I did originally with FTS) but some synths have pitch bend glitches if you do that. I've never quite figured out why they do that, but 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. At any rate if you do a pitch bend immediately before a note on, the note tends to do a quick portamento slide from the 12-et note to the desired pitch on some synths.

Forgot to say anything about the pitch bend sensitivity. Yes, you can't rely on it being 2 semitones though nearly always it is. Another range one can encounter is 1 semitone, and QuickTime makes a big thing of using two octaves as the pitch bend range. Some synths ignore the pitch bend sensitivity message, then the user has to set it at the synth themselves.

It's also good to have an option to let the user set the pitch bend range themselves - as one might 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. If you do hard code it it is worth bearing in mind that one might want the user to change it in the future.

There are various other things like that, where I had to rewrite the code several times. The idea of the hints is that it might help the reader to design the architecture in advance, so they avoid some of the rewriting and blind alleys that I followed.

Your ideas about ways of getting around the 16 channel limit of midi are the same things that I'd think of myself. You can also play different instruments simultaneously in the same channel on most soundcard synths, which is a great saving on channels. It is surprising how much one can do with that with just the 16 channels, especially if it is also an octave tuning so that you can use the same channel for all notes any number of octaves apart.

I also thought about a text format, the tricky thing there is to decide on a suitable notation. The SCALA one permits a very wide range of notations, and it would be a lot of programming to support them all. The sagittal notations are the nearest I've come across to a universal microtonal notation, and I'll be adding that in to FTS at some point (probably next beta / release stage now as FTS 3.0 had a number of post release bug fixes and issues, I think because I added so much new material and hadn't spent enough time on debugging it all - so I don't want to make it even more feature rich right now without another beta / release cycle).

Or one could use just cents and ratios with the Scala convention that a decimal point indicates a value in cents, and require user to put all values in cents. In FTS I also have a special n-et notation e.g. 3//19 for 3 steps of 19-et, looks like a ratio but with // instead of / which has the advantage it is very easy to enter by hand. So anyway the SCALA format is worth looking at, also the CSound notation - they have put some thought into n-et type microtonal notation, so could be of interest.

I was most interested in a text format as a way of sharing microtonal scores between different programs, or as a way to save a retuned score for future use or editing by the user - since you lose so much information in a midi file. E.g. you can't be sure if the user intended a ratio or an n-et value, or an extremely close cents value, even if you use a tuning table. I know though that some people like to compose in text, at any rate Gene Ward Smith used to use the SCALA .seq format in that way for his pieces.

If what you want to do is to be able to hear the music as you compose, then you just need to retune the output of your composition software and use it as a "scordatura" keyboard score - a score that a keyboard player could use to play your piece on a suitably tuned keyboard using the familiar 12-et hand / eye coordination, with no need to know anything at all about the microtonal system used. That's very easy, you can retune the score by routing it through a midi virtual cable like Midi Yoke or Maple sound etc then to FTS or SCALA to do the retuning.

But if you want to use microtonal notation in your score, that's much harder. I've got some options in FTS to do that, lets you use e.g. the volume, or midi patches or various other things to trigger pitch changing accidentals. So that could be used to make ones own custom accidentals in a visual score. But it is kind of ad hoc, most useful if one was to spend a lot of time composing in a single microtonal tuning as it would take a while to set it up. I never use it myself, as I just use the scordatura score type approach.

Yes a text based score sounds like the sort of objective one could make some headway with. I agree that a fully featured gui is just so much work one could hardly begin to contemplate it unless one was lucky enough to already have a lot of experience in writing a score based gui. If you come up with a good text format then I might be interested to support it in FTS, and make it so that e.g. the retuning midi player could play it. I thought about supporting the SCALA .seq format but it is just too complex with all the notations you'd need to be able to support. BTW microtonal ABC is another text based microtonal format, don't know much about it except that I've seen it mentioned here.

Yes, I used to post here frequently. But for some years now have dropped back to an interested onlooker, and occasionally drop in to see what is happening. I've not been doing much composing at all for a fair while, except writing lots of solo tunes for recorder, instead spent most of my time just coding. That's partly because I was working so hard on the programming, and partly I don't know, just some kind of phase or something - I just wanted to write solo tunes for recorder, not microtonal, mainly simple diatonic or pentatonic. Anyway, I have done most of the urgent stuff in FTS now and will probably go back to composing again soon.

I enjoyed your music, and thanks for sharing it. There are some microtonal tunings that are very easy to get started with. If one wants to explore the exotic then 7-et is a fun one I think. It could be an interesting thread to ask other composers here what tuning they think would be a good one for a newbie composer to use as an easy intro into microtonal composing. I think one might get a very wide range of answers.

Yes be sure to ask if you think I can help in any way. I've been helped so much by other developers myself. For that matter if you have any suggestions about ways I could do things better in FTS then I'd be very interested to hear too.

What's your own background in programming, and how do you come to be expert at midi events, out of interest?

Thanks,

Robert

[Non-text portions of this message have been removed]

🔗Jill Arroway <saffron@...>

9/22/2008 5:12:56 AM

--- In MakeMicroMusic@yahoogroups.com, "Robert Walker"
<yahoogroups@...> wrote:
>
> Hi Jill,
>
> To start with one might just send a pitch bend immediately before
the note (that's what I did originally with FTS) but some synths have
pitch bend glitches if you do that. I've never quite figured out why
they do that

You need to send the bytes Bn 41 00 for each channel.

Controller 0x41 is portamento on/off, and value 00 switches it off.

Mind you, I'm glad you told me, because I would have assumed it should
be off by default.

You can also set the portamento time (separate MSB and LSB
controllers) to zero if you want to be really sure. Portamento time is
the time it takes to do a glide.

> At any rate if you do a pitch bend immediately before a note on, the
note tends to do a quick portamento slide from the 12-et note to the
desired pitch on some synths.

My theory is that explicitly switching off portamento should fix that.
Of course, it remains to be seen if practice matches theory. But I
would rather put my pitch-bends immediately before a note, if I can
get away with it, because it's just so much more flexible.

> Forgot to say anything about the pitch bend sensitivity. Yes, you
can't rely on it being 2 semitones though nearly always it is.

Yep. Got that one now.

> Your ideas about ways of getting around the 16 channel limit of midi
are the same things that I'd think of myself. You can also play
different instruments simultaneously in the same channel on most
soundcard synths

You mean in different sections of the keyboard? Like, notes 00-3F
being one instrument and 40-7F being another? How does one set that up
in MIDI?

> I also thought about a text format, the tricky thing there is to
decide on a suitable notation.

I've been thinking about that one for a very long time. Many, many
years. Lots of ideas have come together. I think I know where I'm
going with this one.

> Yes a text based score sounds like the sort of objective one could
make some headway with. I agree that a fully featured gui is just so
much work one could hardly begin to contemplate it unless one was
lucky enough to already have a lot of experience in writing a score
based gui. If you come up with a good text format then I might be
interested to support it in FTS, and make it so that e.g. the retuning
midi player could play it. I thought about supporting the SCALA .seq
format but it is just too complex with all the notations you'd need to
be able to support. BTW microtonal ABC is another text based
microtonal format, don't know much about it except that I've seen it
mentioned here.

Like I said, I think I've got my head around this one. But let me
write it first.

The book "Beyond MIDI: The Handbook of Musical Codes" by Eleanor
Selfridge-Field (of which I own a copy) documents a gazillion
different musical codes, all of which achieve slightly different aims.
None of them are quite suitable for my purpose, but it's all good
education.

> I enjoyed your music, and thanks for sharing it.

Well, there's more, but it's off-topic. I think it is slightly not in
the spirit of things to share non-microtonal music on a microtonal
newsgroup! :-)

> What's your own background in programming, and how do you come to be
expert at midi events, out of interest?

Been a programmer for over 30 years (professionally for just under 30
years). Bought "The Complete MIDI 1.0 Detailed Specification"
somewhere round about the year 2000, because I was dissatisfied with
some of the limitations of Cakewalk and figured I could do better,
albeit in a non-GUI way. Of course it turned out to be not so simple
as I thought, and I've been slowly fermenting my ideas ever since.

Originally, I was interested in atonal (not microtonal) music, and
even /that/ posed a challenge for traditional notation. Then I
discovered microtonal, and the rest is history.

Jill

🔗Robert Walker <yahoogroups@...>

9/22/2008 7:12:08 AM

Hi Jill,

Sorry, I wasn't clear again. I just meant it sounds like portamento, but it's not. It is a very short glitch, of just a fraction of a second, maybe 10 ms or so, anyway much faster than your usual portamento slide.The standard setting is indeed for Portamento to be switched off. To make sure one can do a reset all controllers or explicitly switch it off as you suggest, but it won't fix this issue.

> But I would rather put my pitch-bends immediately before a note, if I can
get away with it, because it's just so much more flexible.

Yes that's why I did it like that originally. Now what I do is to set up all the pitch bends in advance for all the channels. If a note can be played on an existing channel I play it there. If not, look for a channel with the notes switched off longest ago, and do an all sound off and pitch bend, and I have an option to let the user set a delay after a pitch bend in that situation.

Perhaps 90% of the time (I don't mean that as an exact percentage of course) you'll get away with the pitch bend just before the note on. As I said, I don't know why it happens, you'd think they must have programmed for it explicitly as it would be far easier to just start the note at the desired pitch set for the current pitch bend in play. My only guesses are that maybe 1) it somehow helps with users who pitch bend notes very swiftly away from a 12-et note using the pitch bend , or 2) maybe there is something asynchronous in the way the receiving synth handles events, so that it processes all note ons first, then the pitch bends, even if the bends are received slightly before the note ons. But counting against 2) - it doesn't work to just send the pitch bend 1 ms in advance. You have to send it a little while in advance - the preset for FTS is 10 ms and it is hard to see why the processing in the receiving synth should be asynchronous to that extent, so maybe it is designed in.

If it is just for your own use and it works on all the synths you use, then that's fine. But if you want others to use it then you can guarantee that if enough people use it, some time down the line someone will complain about pitch glitches. It worked fine for me. But then users started sending in audio recordings of what FTS sounded like on their synths, with these clearly audible pitch glitches, and doing this fixed it.

> > Your ideas about ways of getting around the 16 channel limit of midi
are the same things that I'd think of myself. You can also play
different instruments simultaneously in the same channel on most
soundcard synths

> You mean in different sections of the keyboard? Like, notes 00-3F
being one instrument and 40-7F being another? How does one set that up
in MIDI?

Just send the patch change 0xC0 immediately before the note on. The thing is that in these soundcard, unlike the pitch bend message, the patch change message only affects notes played after the message is received. Notes already in play are unaffected. So e.g. in channel 0:

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

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

You can even have two instruments playing the same note simultaneously in the same channel on some synths. Depends on the synth. I have that as an option in FTS with a warning that it isn't suitable for midi clips for general use - but of course if it is supported, it is a great channel saver if your music has melody lines played simultaneously on several instruments at once.

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

One idea I had was to make the pitch bend message work similarly, so that pitch bends only affect notes not yet played - if a synth supported that then you could have multiple pitch bends in play in the same channel at the same time.

It actually works, too, I made CSound instruments that work like that for FTS and FTS can use that to play simultaneous pitch bends in the same channel via midi through CSoundAV - so it works - but of course result is that the notes in play no longer respond to the pitch bend wheel. But if your program supported that option, and you were interested to use it with CSound instruments, that is another way to reduce the number of channels you need considerably, and there are example CSound instruments included with FTS in the installer that support that feature (in its CSound Instruments folder).

> I've been thinking about that one for a very long time. Many, many
years. Lots of ideas have come together. I think I know where I'm
going with this one.

Okay, great, I look forward to finding out where it goes when it is done :-).

> Well, there's more, but it's off-topic. I think it is slightly not in
the spirit of things to share non-microtonal music on a microtonal
newsgroup! :-)

Yes look forward to the microtonal stuff. You can also try your twelve tone pieces in various tunings, things like using a tuning with e.g. different versions of the major / minor thirds e.g. septimal etc. or just intonation retuning. On the whole I prefer to compose directly in the tuning of interest, but can be fun. I did one piece for the hexany, which Gene suggested I try transforming through a whole long series of mathematical transformations, and that was great fun! Ended up with a piece of more than 30 minutes from a short seed phrase of a few seconds.

Robert

[Non-text portions of this message have been removed]

🔗Robert Walker <yahoogroups@...>

9/22/2008 7:59:43 AM

Hi Jill,

> You can even have two instruments playing the same note simultaneously in the
same channel on some synths.

> Patch change violin channel 0
Note on 60 channel 0
Patch change flute channel 0
Note on 60 channel 0
Now both instruments are playing note 60 on channel 0.

Of course you have to be very careful with this one even if the synth does support it. If you switch both notes off simultaneously it is fine. But if you have different durations for the two instruments then there is no way in midi to say which note should be switched off of the two. The synth will either switch both off at the first note off (which can also happen with some synths if you play both notes on the same instrument), or switch one of them off at random. I.e. only for occasional use and warn the user.

But the one about sharing different instruments in the same channel with different note numbers works fine for any synth that supports it which includes most soundcard synths, and no "gotchas" to look out for particularly apart from making sure that you avoid the situation of both instruments playing the same note.

So if the midi clip is one for users to play midi clips on their computer via the soundcard the chances are very high that it will work fine.

Robert

[Non-text portions of this message have been removed]