Popular Posts

Friday, May 27, 2011

Pythagoras MIDI

The new instrument is undergoing some pretty big changes. I am still working with Wizdom on this (the guys are busy, so I am trying to get a lot of progress made until we meet again), and it will come out with a different name (because Pythagoras is taken). But I stumbled upon some code that completely demystified MIDI over WIFI and decided to give it a try. Within a few hours, I had something that sucked, but kind of worked.

Pythagoras won't really ever be a "MIDI controller", and still has a MIDI-Guitar mentality. The real sound engine is the audio engine, and it's finger and frequency oriented. What I mean by this is that there are no note up/down or note name/numbers. You can have multiple instances of the same note being played, and bend them all in different directions. It's fretless to the core. Here is a recent sound check (just before I got per-string legato and mono mode working in MIDI). It puts GarageBand's BigElectricLead patch in left channel versus the native sound on the right. The timing being a little off is due to WIFI latency/jitter versus my sound latency/jitter. Some of the note drops on the MIDI side are the issue I mention in detail at the bottom.


MIDI on the other hand forces you to sucessfully model an instrument as a box of buttons and sliders. It sounds possible to do correctly until you start looking at the zeroes and ones of the MIDI protocol and see its true limits. Specifically, you can model it as 16 independent boxes of buttons with their own pitch wheel. This *sounds* like enough to make microtonality and polyphony work well together, but the devil is in the details. The per channel pitch wheel defaults to only a lame whole tone bend width. You can set it higher, like an octave, but it's a very non-portable thing to do. If I am stuck at whole tone bends, then the note must retrigger if I exceed it. Because I don't have an actual pitch wheel, when I am at the top of my whole tone then an accidental note re-trigger is only one pixel away (because you bend with finger position of the note, not with a separate wheel that has a top and bottom).

The other issue is that even if I write all of my MIDI messages completely correctly spread out across 16 channels, some DAWs will gleefully mess up all my work and mash all the channels back down into one channel at playback (My GarageBand OSX!). When that happens, you have to write different MIDI (omni-mode MIDI versus single channel) out to the stream to account for overlapping instances of the same note so that notes don't stutter and cut each other short. (This isn't supposed to happen, but what your MIDI stream says to do, and what the brain does are always going to be two different things. :-( This is less true as you get more expensive gear, but people will give me a 1 star "worst instrument ever" if it doesn't work with some MIDI brain that doesn't do it right. A lot of people won't understand why MIDI does keyboard just fine, and this layout doesn't quite fit the mold.)

#90 means note on channel 0
#91 means note on channel 1
# second number in row means note number
# third number in row means volume
90 32 55
91 32 46
90 32 00
...

This is two fingers going down on the same note, something that's impossible on a piano, because they are mechanical keys. So one finger comes up, and if they are truly on different channels this sounds right. If GarageBand forgets that 91 means that that's a different copy of the same note, it will just turn that whole note off and I get silence when there should still be a note playing. I know the workaround and will write it in, but what you see is correct MIDI, and I have to write it wrong to make some cheaper brain happy while possibly getting a wrong result on higher end hardware. If both of these notes go down and are slightly bent in different directions, then they are *not* the same note and I can't use tricks to count how many times down and up and compensate.

Since MIDI is all about making keyboard controller (boxes of buttons and pitch wheels) manufacturers happy, they think of microtonality as tuning tables, and think that this problem is basically solved. (The microtonal google groups insist that MIDI is just fine with microtonality because of *.tun files, etc). But fretless instruments have no tuning tables. Each channel (ie: finger) is one long volume and expression changing bend. I only need an octave bend in practice, but fretless instruments by their nature can bend from the lowest to the highest frequency with no problems.

The thing about this instrument that feels so different is that even with the frets on, its fretless nature is always apparent. You can refret between 12, 24, 53, or 665 notes per octave and blur the lines between what is and is not a fretted instrument, especially when you set the snap speed (speed to drift to the closest fret) very low.

So, MIDI is in Pythagoras. I am actually *excited* about it because I can double the internal voice, which does expressiveness pretty well, with MIDI voices that do other things in a world class way. The main trick will be keeping complexity away.

I do NOT want to attract a lot of very high maintenance users that won't ever be able to agree on any simple controller configuration as an acceptable one. I am going to shoot for something that is expressive and simple. I know that MIDI kind of opens the gates of hell for a million new controls to play with.

Friday, May 13, 2011

Tablature For My Instruments

I don't make these instruments just to put yet another iPad instrument into the store. I am taking the high risk approach and trying to build up a community. Communities need a common language. So here's some tablature.

The new instru
ment is at least as playable as guitar. It is special in that it uses automatic octave switching. But that makes fingerings different. If you have Pythagoras octave rounding turned on, these are the basic rudiments. The fingering is indicated by {L,R} for which hand, with fingers {1,2,3,4} being first finger to pinky. finger 0 would be thumb, but I am not using it here.

There are no frets, so the notation is relative to whatever center you like. That's why negative numbers show up in a few places. This notation doesn't handle microtonality yet, but I I think that will work out well when I get it figured out. There are also a variable number of strings, so this notation just shows the number that are in use. With octave rounding, there isn't a lot of reason to go beyo
nd 4, with 3 being enough for describing common things.

Play these with smooth rhythm. And where the double bars are, repeat as often as you are in audible range, then go on to the next bar.

I haven't figured out how to notate legato techniques made possible by the polyphony slider. When you stack up multiple notes in mono mode, pulling your finger up will play a note as if you hit it. It's better than a string because you can do these legato techniques up or down, and not just up the string as a real string instrument.

Here is another example that starts to make the point of why I need to think about a custom notation. When you notate by 12ET frets, it becomes ambiguous if you really meant to specify nearby locations that don't really land exactly on the fret. In 53ET, the fourths that the strings are tuned to are Just fourths. The seconds that you play are Just seconds. (Well, both are approximations, but very much closer than 12ET is). So, if we define 9 of these steps to be a Just whole tone, then 6 whole tones is 9*6 = 54. We overshoot the octave by 1 fret. When playing Pythagoras, you can see the whole tones very clearly in the layout. So we index first digit by whole tone, and second digit by the small fret in the whole tone. The beauty of this is that it looks kind of like the base 10 number. It's close to it. If you mentally "double the numbers" and think of 05 as "1/2" and 1 as "2", and 15 as "
3, then this 53ET notation is exact, yet it is easily rounded to the 24ET and 12ET locations. So, you can use one notation that's unambiguous (rounding is unambiguous, guessing with hints on what you really meant by starting at 12ET and saying stuff like "a little more than slightly sharp", etc.... that's ambiguous). Anyways, this is my 53ET notation, and I find it more useful than writing out guitar tablature with marks to qualify exactly how sharp/flat, etc. I need to write some code to generate prettier tablature.

But at the moment, I am crazy wrapped up in MIDI. Part of the MIDI task was to get the internals right so that I can record a transcript of the original gestures, to emit some of this 53ET tablature. But I really get it from the response that having a good MIDI implementation is required to get anybody to pay attention long enough to what Pythagoras can do that MIDI instruments don't do well. More on the MIDI stuff later... It's getting there!


Saturday, April 2, 2011

53tet, Makam, and Pythagorean Tunings


The use of 53 frets per octave in Pythagoras' primary microtonal mode was a bit of an accident. I set out to tune strictly to the harmonic series and avoid any equal tunings, but got pushed into it. If all you do is line up your strings to just fourths (ie: 4/3 ratio rather than 2^(5/12) standard tuning), then that tiny little offset sets off a chain of consequences. I just drew lines straight up and down for 4/3 coming out of each octave, and the Just 4th offset caused the 53 frets per octave to appear. A Pythagorean tuning is by definition, merely a walk around the circle of Just Fifths. You can stop at 12 and pick those as piano notes, and just realize that when you try to modulate, the primary keys will sound excellent, but some keys will sound bad because the piano pitches are fixed but not equally distributed. You can go around the circle in both directions to get distinct sharps and flats for the different situations and add 5 more sharps to get a 17 note piano with duplicate (but slightly differently tuned) sharps and flats. You could go around the circle of fifths a little more to pick 22 notes and get a set of notes that is roughly the Indian Sruti scale.

The point is that this is something being dictated by Physics rather than musical numerology. Pitches are important in this case, so notes should have something to do with the spectrum itself. My hope is to get people out of the habit of thinking of tuning and pitch as something that you hire some piano tuner guy to think about (or just let a computer dictate it all for you). This is because it isn't really the exact pitches that are important in microtonality, but the very distinct Timbre that gets created by perfect ratios in chords and sympathetics, especially ones that sound new because they can not exist in the 12 tone system.

But only a few days ago I really understood what this meant. Besides saying that if you tune your strings using the harmonics, then if you had a 53 fret per octave guitar you would be basically perfectly in tune after that procedure. Not perfectly in tune in the sense as being in tune with an electronic piano, but with the harmonic series which the piano tuning tries to approximate (somewhat badly); octaves, fifths, fourths and major thirds specifically are very much in tune.

But the other thing that it meant is that this system which matches so nicely with the spectrum is very much like the Turkish Makam system. A Just "Whole Tone" is the pitch you get by going up two Just Fifths and back down one Just Octave. You can very nearly use an equal division system to deal with it, but it isn't as simple as a whole number of Just Whole Tones in an octave. This is what that "Wolf Interval" story you hear about tuning is all about.

In chromatic scales, a whole tone is two chromatic "frets". A Just Whole Tone is slightly larger. 6 chromatic whole tones make exactly 1 octave. These chromatic whole tones are "unphysical" in that their sound physics justification is very rough. The spectrum kind of roughly breaks up into 12 equal-ish parts when you take all combinations of fifths and octaves, but it is really rough. It doesn't line up all that well.

The real Just Whole Tone if it were split into 9 equal parts would have about 6 of these whole tones in an octave. Except six Whole Tones overshoot the octave by an about that is very nearly equal one of these 9 equal parts.

Six whole tones:

6 * 9 = 54

That's 54 "frets". There are 53 frets per octave. So we fretted the fret just above the octave on that sixth Just Whole Tone. When playing Pythagoras, seeing the simultaneous overlay of the 12tone system over the 53tone system will really reset what you know about music theory. So it's a walk around the Just circle of fifths plus one more step. Now the Wolf Interval story is just common sense.

Just as a side note to give you numerological nightmares. The next closest approximation to Just 5ths requires a much larger, but very curious number. After 665 steps of a Just 5th, the difference with octave is totally imperceptible on its own, let alone when the error is spread across 665 frets. So if you go one fret beyond that, you are at 666 Just Fifths. But you don't need to go there, because the approximation is so close that there is no practical reason to keep going. The extremely tiny interval that makes up this fret step is called "The Satanic Comma" for obvious reasons.

Every few days I pick it up to play, I get a new insight that I didn't have before I started.

To me, learning is whole point of playing music. It's why I would prefer to write an instrument than to just be a consumer of it. It's why I roll my eyes at the sort of musicianship that has no patience for doing anything from first principles. It's why I enthusiastically learned theory when I played guitar, and am enthusiastically trying to come up with something new with respect to pitch now that people are starting to play fretlessly on touch computers.

See the similarity to this article http://en.wikipedia.org/wiki/Makam. When I saw the image, which I posted at the top, I didn't have to read any more (as it's mostly ethno-musicology stuff and jargon that doesn't interest me). The day before, I had decided that my instrument had a natural coordinate system of ( (9/8)^x, (4/3)^floor(y) ), where 9/8 was chosen because it was the closest line in terms of the distance of the interval from the circle of fifths. When I saw this Makam article, I finally went to make Pythagoras widen so that I could hit every interval exactly, which I needed to run on the phone. Compare it to the picture of Pythagoras, which emerged as a happy accident of my attempt at drawing the full 3-limit on the screen.

Wednesday, March 23, 2011

Pythagoras first real Microtonality - 53tet


The main motivation for creating Pythagoras was to demonstrate something wonderful about the use of touch screens as instruments. Believe it or not, the iPad is capable of being a highly playable instrument that will do things that are typically impossible. You just can't do microtonality correctly the way it is currently practiced. A bunch of re-tuning tables for a MIDI controller with 12 keys per octave is a joke as a microtonal instrument. If you want to do microtonality, it also needs a very smooth transition in and out of 12tet to be useful in the real world. That's where the Mugician / Pythagoras / Linnstrument / ExpressionPad / TapSynth / SynthX layout comes in.

When I made the decision to tune to Just 4th intervals rather than the typical piano tuning, the main motivation was to avoid the annoying finger adjustments required to hit proper power chords in fretless mode.


In fact, in fretted mode it wasn't completely possible to hit those intervals at all. Like a guitar, if you tune to harmonics, you will find that the octaves don't match when you get done tuning. This is because the 4th interval (and its inverse, the 5th) of the piano is an approximation to the harmonic series rather than using the actual thing.

The most important interval is the octave. You just take a frequency and multiply it by some whole power of 2 to get a new frequency. As long as these numbers are whole, everything you get back will have an octave relationship from it. The second most important interval is the fifth which is (3/2) to some integer power. Notice that if you ignore octaves, then you can throw away powers of 2, and just call it some integer power of 3. So this is a curious number system where all of the numbers are of the form 2^n*3^m.

If you think about it, you can extend this to all of the prime numbers. But the Pythagorean tuning system creates all notes in the scale from just 4ths. So, ignoring octaves, it's simply generates the scale all "reasonably small" powers of 3 brought into the current octave. Unfortunately, there isn't some number that hits the octave exactly at some point - because 2,3,5,... are PRIME factors - the problem is not perfectly fixable. At the 12th fifth away its kind of close, which is why the 12 tone system was invented. (And 12 has interesting numerological and symmetry properties as well, if you want to ignore the actual frequencies it implies). But at the 53rd fifth away from the root it's very close.

It's so close that the screenshot you see... isn't 53tet. It's the actual harmonic series of just fourths up to the 53rd power. It's the same as 53tet to the pixel, except being slightly off right after the last harmonic, which is basically harmonically useless with respect to the root note anyway. I colored the lines so that the bluer it is, the closer it is to the center (ie: the lower the absolute value of the integer power of 3 in its factorization). The more green the tint the more fourths it has, and the more red the tint the more fifths it has.

How does it sound? It sounds incredible. When chords are standing waves due to perfect ratios, they have a real "face" to them and resonate like one voice. In this intonation, the order of the usefulness of intervals is in the order of the number of fourths or fifths to reach the note (the absolute value of that power of 3). The usefulness of the intervals is even in a different order from 12tet. In 12tet it goes: octave,fifth,majThird,minThird,second,dim5. In Pythagorean it goes: octave,fifth,second,majThird,... It quite obviously is ordered by the absolute value of that power of 3 exponent.

If you start from a base pitch and just start traveling up and down by Just 5ths, you get phenomena in this order: octaves, fifths chords (power chords), pentatonics, scales. However, because the fifths don't exactly match to an octave something interesting happens.

+/- 1 5th gives power chord of 3 notes. +/- 2 5th gives pentatonic of 5 notes. +/- 3 5th gives 7 notes - all white keys with Pythagorean intonation. going up and down give more sharps and flats. So +/- more notes and you have a total of 12 notes, even if they are tweaked a little different from the 12 tone system. But if you go up 5 in one direction for sharps and down 5 in the other direction for flats, these sharps and flats are *not* repeats of the same set of notes, but they are close to each other.

7 + 5 = 12. 12 + 5 = 17.

These are the 17 note scales related to pure tunings, not some 17tet craziness. In this 17 note scale, the sharps and flats are pretty close to each other. You can see this in the Pythagoras screenshot in the area where the black notes reside. In these cases, the yellow marker for the 12tet fret is about centered on both sides by two bluish lines. The one with the reddish tint is created by walking fifths and the one with the greenish tint by fourths (or maybe it's backwards... but you get the idea).

So you easily notice when playing fretless that if you play almost a quartertone away to make the pattern even that there is some number of frets that almost lines up, and it's 53. So after walking the circle of fifths for 31 octaves it is very close to fitting. So what this means is that you can tune a guitar to Just 4ths as long as you use 53 frets per octave. What will be available will be all the notes that involve fifths and octaves as overtones. Some of the notes just happen to be close to other perfect intervals, which you can see by inspecting the angled lines to see if they hit any of the vertical lines. Since it has a pretty close major third, then that means that 53tet is a good approximation for Just intonation as well.

The math behind all this is really besides the point. The point is to match up with the harmonic series, not to have some funny number of frets that hasn't been tried yet. The most I will say is that there is a prime factorization like... 2^m * 3^n * 5^p ... (oct,fth,majthrd,...). Pythagorean tuning treats the ones involving 2,3 as the only useful ones for creating all the harmonics. This is good in that all of the pitches sound like they are in a common family as well.

Anyways, this intonation allows the exact kinds of scales that Mugician and Pythagoras were created to play. I have to make an admission that the pure fretlessness, though nice to be able to do, introduced as much slop as magic. You can do quartertones, and hit those crazy resonances that 12tet squeezes out of everything. But you also just make a lot of sloppy bends to only hit them in passing. 53tet is an answer for Just intonation, middle eastern scales (which officially uses 24tet ... but it's more complicated than that, and in a lot of ways is trying to be Pythagorean). What is also really good from a practical perspective is that it provides *just enough* correction to hit the notes that the inaccuracy in the touches is preventing and getting you to the subpixel value that's the intent.

I might add in 24tet just to have it, but 53tet sounds better if you don't absolutely need 24tet for your quartertone scales.

Monday, March 14, 2011

Goofing off far below audible pitch range

If you go down enough octaves, tempo is tied to the drone note. Different chords have different rhythms. What you hear are not pure notes because I have the distortion and some harmonics turned up so that it's audible. But this is part of the point I would like to make about thinking in terms of notes as being simplistic. When you play fretless, there are no special notes anywhere. There are only special ratios of one pitch relative to another. They make interesting rhythmic patterns that you can hear below the audible tones:

http://www.youtube.com/watch?v=5_ygrh4cTbU&feature=channel_video_title

Imagine your BPM being midi note -24 or whatever it maps to... something absurdly low. Then the drone note is some octave up. double time is an octave. triplets are a fifth in some octave, etc.... it could be interesting to connect the two by having a sound with some absurdly low octaves in it.

Wednesday, March 9, 2011

Pythagoras Octave Rounding.

I got simple octave rounding working in Pythagoras last night. Between this being still unfretted and me being sloppy, the playing is a little out of tune. But considering the speed and octave range, it isn't awfully out of tune.

http://www.youtube.com/watch?v=o965af7w6_o

Maybe the microtonal slider will snap to 12tet at lowest setting, to the harmonic series approximation to 53tet somewhere in the middle (for very tight chords with respect to the drone), and fully fretless all the way over to the right.

With octave rounding, you don't need a lot of octave range to really run up and down the board...just room to reposition from the left or the right. It's not quite what I want, but it's a start.

Wednesday, March 2, 2011

hwado's Musician vs my Mugician


"WTF is this?" - A quote from somebody that helped work on Mugician with me, after seeing this image on his iPad.

I made Mugician open source a few weeks ago. I got asked by a lot of people to add features that I didn't want, so I figured that making the project open source was a reasonable thing to do. So I put it here.

https://github.com/rfielding/Mugician


In the README file that shows up on this page, it merely states some simple conditions in the license. They are all aimed at just making sure that I don't end up getting emails about the Malware version of Mugician, or confusing my users.

If you buy "Musician" just note that it's a blind re-compile of the Mugician project in its latest state, with a few bug fixes that are not yet in the official Mugician, and a stupid splash screen banner added.

I really dislike this sort of developer, and these guys were the only thing that gave me pause to making Mugician open source. But whatever, some developer that wants to really add something, like make an ergonomically workable iPhone Mugician or add MIDI support... be my guest. Just credit the project, and I will endorse your work enthusiastically, and ask you to submit your changes into a branch. If I trust you enough, I will write an exception to the request to submit changes into a branch that I can compile too.

Pythagoras won't be open source because of this sort of thing though. It would be a better candidate because the source is smaller and cleaner, and there is a good possibility of the whole sound engine being in libpd. I might have to share it on a peer-to-peer basis with specific collaborators just to shut out the compiletards that just take people's stuff and try to re-brand it as their own.

If you don't understand why that irritates me about a free app, keep in mind that I am not the only person that sunk time into Mugician's design. Jordan Rudess is an example of somebody who spent time on it. Hiding "Musician"'s origins as "Mugician" hides the credit that Jordan Rudess deserves. In this case, calling it "Musician" is clearly an attempt to confuse my users as well. I just did a gig with Mugician the other night, and I am sure that people will be sending email to HWADO thinking that it's me, and that I don't respond to emails.

It hides the credit to all of my many testers, and people who got up on stage and risked their gig with my instrument.

I hope that Apple tires of these sorts of developers and starts revoking their certificates en-masse. There is always talk about it, and at some point Apple will have to step in and do it. hwado's business will be gone overnight when it does. Apple even noted quite explicitly in the developers agreement that they don't need more fart apps, so they don't just blindly allow junk because it's not violating an explicit rule. Musician is a good app because it's Mugician, but it's definitely an underhanded way to avoid the obligation to contribute something or to write your own code.

Note that I wrote the license myself in plain english, and I did not pick some legally binding GPL. The reality is that the legal mumbo-jumbo is unreadable because it's not really in English, and it only works in the case of enforcing it against a large company - but that would still require lawyers to challenge it anyway. So I am relying on people to simply point out what these people are doing in the app comments.

Maybe "Musician" will be a runaway hit for some strange reason. I guess that's ok as long as everybody follows links back to Mugician to see who actually did the work on it, because it still validates what I am trying to do. My main concern is that I never want to have to deal with a malware version of my app floating around, especially one that *does* credit Mugician.