Version 1.1 adds the ability to independently control the volume and duration of each stage of the ADSR envelope. Even though the tone produced remains a simple sine wave, with no undertones, overtones, or other elaboration, this provides quite a bit of range to the sound.

As before, start with http://itunes.apple.com/us/app/ratiokey/id387640139?mt=8, and then follow the link labeled "View In iTunes" to go to the app's page on the App Store.

## Friday, October 01, 2010

## Saturday, September 25, 2010

### Thanks for the very helpful reviews!

After three weeks of silence, there are now two, very helpful reviews of RatioKey on the App Store.

My thanks to the authors, especially with regard to the suggestion to use a Diamond Marimba interface (see also tonality diamond). I wish I'd known about that six months ago!

I can't talk about plans for future versions, if any, but such suggestions are sure to find their way onto my todo list, or, if they're already there, increase their priority. I have a lot of ideas for RatioKey or related applications, which are waiting on time, focus, and clarity (a clear notion of the larger context, which is largely about data formats). Given clarity, I can find focus and make time. Of course, anything I come up with must pass muster with Apple's reviewers, so I can't promise anything until it's actually available for download.

Let me say that I welcome competition. I'd hate to think that the potential of the iPad (and touchscreen devices in general) to help liberate us all from the equal tempered scale depended on the spare-time application of my own modest programming skills. RatioKey as it currently exists is, as much as anything, a vector for getting the idea of specifying ratios by adjusting their prime power components out into the noosphere. I hope to see and hear that come back in the form of new apps written by others.

Meanwhile, I'll be struggling with that clarity issue and whittling away at my todo list.

Please note that there's a lag between the completion of a new version and its availability on the App Store, even assuming that it's approved promptly, once reviewed, so if a new version were to appear within the next few days, it wouldn't reflect what's been discussed here. That will have to wait for later.

My thanks to the authors, especially with regard to the suggestion to use a Diamond Marimba interface (see also tonality diamond). I wish I'd known about that six months ago!

I can't talk about plans for future versions, if any, but such suggestions are sure to find their way onto my todo list, or, if they're already there, increase their priority. I have a lot of ideas for RatioKey or related applications, which are waiting on time, focus, and clarity (a clear notion of the larger context, which is largely about data formats). Given clarity, I can find focus and make time. Of course, anything I come up with must pass muster with Apple's reviewers, so I can't promise anything until it's actually available for download.

Let me say that I welcome competition. I'd hate to think that the potential of the iPad (and touchscreen devices in general) to help liberate us all from the equal tempered scale depended on the spare-time application of my own modest programming skills. RatioKey as it currently exists is, as much as anything, a vector for getting the idea of specifying ratios by adjusting their prime power components out into the noosphere. I hope to see and hear that come back in the form of new apps written by others.

Meanwhile, I'll be struggling with that clarity issue and whittling away at my todo list.

Please note that there's a lag between the completion of a new version and its availability on the App Store, even assuming that it's approved promptly, once reviewed, so if a new version were to appear within the next few days, it wouldn't reflect what's been discussed here. That will have to wait for later.

## Monday, September 06, 2010

### how RatioKey works

This is reposted (with edits) from the Tuning mailing list...

The code is divided into the user interface and an audio engine. They communicate via C structures that are passed back and forth between them, with the main item of interest in these structures being a pitch. That pitch could be expressed in cycles per second (Hz), but I have instead chosen to express it in terms of a proportional unit, which plugs directly into the sound generation code without conversion. That proportional unit needs some explanation.

To avoid having to calculate sine values while the audio hardware waits for input, I have set up a table of precalculated sines, which holds values for one complete cycle (2pi radians). The size of this table is one of the components of the proportional unit mentioned above. The other is the sample rate, which is 44100 samples per second, the same as a CD.

((table indices)/cycle) / (samples/second) ~ (table indices)/sample

and that's the proportional unit, (table indices)/sample. Given this quantity, the audio engine progresses from one sample to the next by adding this value to the previous value (resetting whenever it reaches the size of the table) and then uses the result it to look up the sine, which is what's passed to the hardware.

The user interface is composed of buttons, labeled with ratios, and associated with these values that are proportional to pitch. If the "1/1" frequency is changed, then all of the others are also changed.

The selection of ratios is a bit complicated. I begin with a permutation of every combination of powers of 2, 3, 5, 7, and 11, permitting the powers of 2 to vary from 1/32 to 32, the powers of 3 from 1/27 to 27, the powers of 5 from 1/25 to 25, the powers of 7 from 1/7 to 7, and the powers of 11 from 1/11 to 11. Fractional powers, like 1/32 and 1/25, appear as integers in the denominator of a ratio. The numerator and denominator are the products of their prime power components.

I then discard all combinations resulting in a ratio with a value greater than 2 or smaller than 1/2. Further I discard any combinations where either the numerator or the denominator is larger than 32.

There is a third test which may seem a bit arbitrary, but which I decided to use to make sure that I was winnowing out the more complicated ratios. For this test, each prime number is multiplied by the absolute value of its power (1/32 and 32 both yield 5, 5 times 2 is 10), and then these products are added together. If the sum of these is greater than 21, I also discard that ratio.

What's left after passing through these tests is what you find on the keyboard, arranged in ascending order from bottom to top, 105 distinct tones over two octaves.

Setting "1/1" is also a bit complicated. I use an arbitrary base frequency (which defaults to 11 Hz) and a picker to select powers of 2, 3, 5, 7, and 11, with the same limits as before, to produce a ratio which is resolved into a single quotient, which is then multiplied by the base frequency to produce the "1/1" frequency. This allows transposition by simply fiddling the prime powers to generate a different quotient.

The interface arrangement is far from ideal. It has no structure other than higher tones being placed closer to the top, and it's difficult to play. I've put a great deal of thought into how to fix this, and have some ideas that I hope to put into practice, but for the moment it is what it is, and, having published the app in this form, the current keyboard will have to remain as an option in any future version. My apologies to any who see gaping holes in my reasoning.

The code is divided into the user interface and an audio engine. They communicate via C structures that are passed back and forth between them, with the main item of interest in these structures being a pitch. That pitch could be expressed in cycles per second (Hz), but I have instead chosen to express it in terms of a proportional unit, which plugs directly into the sound generation code without conversion. That proportional unit needs some explanation.

To avoid having to calculate sine values while the audio hardware waits for input, I have set up a table of precalculated sines, which holds values for one complete cycle (2pi radians). The size of this table is one of the components of the proportional unit mentioned above. The other is the sample rate, which is 44100 samples per second, the same as a CD.

((table indices)/cycle) / (samples/second) ~ (table indices)/sample

and that's the proportional unit, (table indices)/sample. Given this quantity, the audio engine progresses from one sample to the next by adding this value to the previous value (resetting whenever it reaches the size of the table) and then uses the result it to look up the sine, which is what's passed to the hardware.

The user interface is composed of buttons, labeled with ratios, and associated with these values that are proportional to pitch. If the "1/1" frequency is changed, then all of the others are also changed.

The selection of ratios is a bit complicated. I begin with a permutation of every combination of powers of 2, 3, 5, 7, and 11, permitting the powers of 2 to vary from 1/32 to 32, the powers of 3 from 1/27 to 27, the powers of 5 from 1/25 to 25, the powers of 7 from 1/7 to 7, and the powers of 11 from 1/11 to 11. Fractional powers, like 1/32 and 1/25, appear as integers in the denominator of a ratio. The numerator and denominator are the products of their prime power components.

I then discard all combinations resulting in a ratio with a value greater than 2 or smaller than 1/2. Further I discard any combinations where either the numerator or the denominator is larger than 32.

There is a third test which may seem a bit arbitrary, but which I decided to use to make sure that I was winnowing out the more complicated ratios. For this test, each prime number is multiplied by the absolute value of its power (1/32 and 32 both yield 5, 5 times 2 is 10), and then these products are added together. If the sum of these is greater than 21, I also discard that ratio.

What's left after passing through these tests is what you find on the keyboard, arranged in ascending order from bottom to top, 105 distinct tones over two octaves.

Setting "1/1" is also a bit complicated. I use an arbitrary base frequency (which defaults to 11 Hz) and a picker to select powers of 2, 3, 5, 7, and 11, with the same limits as before, to produce a ratio which is resolved into a single quotient, which is then multiplied by the base frequency to produce the "1/1" frequency. This allows transposition by simply fiddling the prime powers to generate a different quotient.

The interface arrangement is far from ideal. It has no structure other than higher tones being placed closer to the top, and it's difficult to play. I've put a great deal of thought into how to fix this, and have some ideas that I hope to put into practice, but for the moment it is what it is, and, having published the app in this form, the current keyboard will have to remain as an option in any future version. My apologies to any who see gaping holes in my reasoning.

## Sunday, August 29, 2010

### out of the tunnel, into the light!

I can quit hinting obliquely about what I've been up to. What started out years ago as a web app, then became a Mac app, then slipped to the back burner until the iPhone came out, is finally available, as a free iPad app.

It's called RatioKey, and it's free!

You can see a page about it on Apple's website by following this link...

http://itunes.apple.com/us/app/ratiokey/id387640139?mt=8

Click on the "View in iTunes" link to open iTunes directly to it. (The iTunes application is necessary to download the app and install it on an iPad.)

RatioKey opens to a very different kind of musical keyboard, one that offers 105 distinct tones over a two-octave range.

Each tone is defined by a relatively simple integer ratio. The integers comprising those ratios are themselves defined in terms of the powers of the first five prime numbers (2, 3, 5, 7, & 11).

This becomes clearer if you spend a little time playing with the picker on the Options screen, which alters the

frequency of the center "1/1" key, and with it the two-octave range.

If you have an iPad, be sure to check it out!

PS... If you're wondering what this all has to do with music, I will doubtless do my best to explain, but really I'm an obsessed amateur, not an expert, and must defer to David Doty and recommend his publication, The Just Intonation Primer.

PPS... Feel free to enter any questions as a comment, to this or any subsequent post.

It's called RatioKey, and it's free!

You can see a page about it on Apple's website by following this link...

http://itunes.apple.com/us/app/ratiokey/id387640139?mt=8

Click on the "View in iTunes" link to open iTunes directly to it. (The iTunes application is necessary to download the app and install it on an iPad.)

RatioKey opens to a very different kind of musical keyboard, one that offers 105 distinct tones over a two-octave range.

Each tone is defined by a relatively simple integer ratio. The integers comprising those ratios are themselves defined in terms of the powers of the first five prime numbers (2, 3, 5, 7, & 11).

This becomes clearer if you spend a little time playing with the picker on the Options screen, which alters the

frequency of the center "1/1" key, and with it the two-octave range.

If you have an iPad, be sure to check it out!

PS... If you're wondering what this all has to do with music, I will doubtless do my best to explain, but really I'm an obsessed amateur, not an expert, and must defer to David Doty and recommend his publication, The Just Intonation Primer.

PPS... Feel free to enter any questions as a comment, to this or any subsequent post.

## Monday, August 16, 2010

### touchscreens enabling innovation in musical instrumentation

If you haven't had a look in the Music section of the iTunes App Store recently, do. Mixed in with a multitude of other types of apps are quite a few that are essentially new instruments, some quite unlike any physical instrument in existence.

In my humble opinion, this is a good thing! I've been collecting instrument apps ever since the App Store opened, and very much enjoying going through them. (It also turns out to be a good way to introduce others to the iPad!)

In my humble opinion, this is a good thing! I've been collecting instrument apps ever since the App Store opened, and very much enjoying going through them. (It also turns out to be a good way to introduce others to the iPad!)

Subscribe to:
Posts (Atom)