Saturday, March 21, 2009

Nanoloop Tuned to 18-TET! (Hacked ROM)

18-TET = 18 divisions of the octave instead of 12 (which is standard for western tuning). Special, special thanks to Abrasive for his help and his idea with this - all of the credit goes to him of course. On left, the original ROM with its frequency lookup table intact, and on the right the edited ROM with the 18-TET lookup table.

As far as I can tell, the lookup table starts at 0x730a and is 144 bytes long.

So normally, each different pitch is a semitone apart from the next pitch in Nanoloop, right? So 12 notes make up an octave.

By editing the frequency table, we can change the space between notes - so we can edit the tuning.

Instead of there being 12 pitches per octave, there are now 18 in the above example (ie. each step of pitch in Nanoloop is now only 2/3s of a semitone instead of a full semitone). It doesn't have to be 18, but thats just what I wanted to experiment with.

You could easily change the tuning to just intonation, 1/4 tone steps, ragas or middle eastern scales, or many other flavours of microtonality.

To generate my table, I used a spreadsheet. I'm sure that Abrasive has some super-smart way of doing it, but hey this is just how I did this. Not sure how correct it is, but yeah - if you want the spreadsheet, you can get it here: http://milkcrate.com.au/_other/downloads/spreadsheets/nanoloop_tuning.xls

One column had the MIDI notes from 0 to 127. The next column had the resulting frequency, based on the MIDI note. The formula I used was: Frequency = 440 * 2 ^ ((Note - 49) / 12)

The next column then had the appropriate data value to send to the Game Boy's audio register, based on the frequency of the note. The formula I used was: Data = (- 131072 / Frequency) + 2048

The next column had the data value as a hex number.

The next column had the resultant frequency, based on the audio register - this column shows you how the tuning compares to the actual frequency. The formula I used was: Frequency = 131072 / (2048 - Data)

The final four columns represented the (potentially) 16-bit data word.
For nibble 3 (the most significant one) I used the formula: dec2hex of: (Data / 4096) % 16.
For nibble 2: dec2hex of: (Data / 256) % 16.
For nibble 1: dec2hex of: (Data / 16) % 16.
For nibble 0: dec2hex of: (Data % 16

These four nibble columns are then copied and pasted into the ROM at the correct point. By changing the MIDI notes to fractions of whole numbers, different tuning can be obtained. Remember that each percentage point of a MIDI number is equal to a cent in musical interval terms.

In the spreadsheet, Nanoloop only uses the data in rows 27 - 90 it seems. This data area is marked in blue.



4 comments:

Anonymous said...

Nice. I hacked the frequency table for LSDj, but that time for a justly intonated 12 tone scale. I look how it gives each scale it's own character. After doing that I've started to like F better than C when I need a major scale, even when working with the ET-12 scale.

10k said...

Amazing.
Amazing.
Amazing.

Sebastian Tomczak said...

@ Nitro: Good point about just intonation - and that certainly is an interesting feature that you now prefer F for major keys even for 12-TET

online shopping said...

To my mind everybody have to glance at it.