ribbon controller

Hi hope someone can help, I intend to build some of the excellent Tom Scarff midi to ribbon controllers, when I looked at the sletch for the arduino it seems to be only covering a range of 15 notes but on the site it states that the scale can be changed to 24 or 36 notes - can anyone tell me which parameter in the sketch I need to change to obtain either a 24 or 36 note scale?
/**********************************************************

  • NAME: Ribbon/Softpot Controller forSound Generation via MIDI
  • WRITTEN BY: TOM SCARFF
  • DATE: 20/2/2009
  • FILE SAVED AS: midi_ribbon_controller.pde
  • FOR: Miduino ATmega168
  • CLOCK: 16.00 MHz CRYSTAL
  • PROGRAMME FUNCTION: Trigger a MIDI Sound,
  • depending on ribbon/softPot voltage level when pushed,
  • and generate Pitch Bend while Note is ON.

**************************************************************************/

// analog Thresholds for softPot sensing
#define softPotThreshold_ON 100
#define softPotThreshold_OFF 10
#define startNote 60
#define Bounce_Period 15
#define Pitch_Bend_Sensitivity 2
#define Program 50

int softPotPin = 0; // softPot connected to analog pin 0
int LedPin = 13; // LED connected to digital pin 13
byte softPotState=0;
byte x;
byte MIDIchannel;
byte velocity=127;
byte note_onoff;
int bend;
int val_noteOn;
int val_now=0x7f;
int val;

void setup() // run once, when the sketch previouss
{
pinMode(4, INPUT); // Set Inputs for 4 way DIP Switch
pinMode(5, INPUT);
pinMode(6, INPUT);
pinMode(7, INPUT);
digitalWrite(4, HIGH); // Set inputs Pull-up resistors High
digitalWrite(5, HIGH);
digitalWrite(6, HIGH);
digitalWrite(7, HIGH);

Serial.begin(31250);
pinMode(LedPin, OUTPUT); // sets the digital pin as output

for (x=1; x<=4; x++){
digitalWrite( LedPin, HIGH );
delay(300);
digitalWrite( LedPin, LOW );
delay(300);
}

midiSend( 0xC0 | MIDIchannel, Program );
}

void loop() // run over and over again
{
// Read 4-way DIP switch
MIDIchannel=digitalRead(4) + (digitalRead(5)<<1) + (digitalRead(6)<<2) + (digitalRead(7)<<3);

val = analogRead(softPotPin); // read voltage on analog pin 0

if( val >= softPotThreshold_ON && softPotState==0) {

note_onoff=val/64 + startNote; // 0 to 15 + 60
noteOn(MIDIchannel, note_onoff, velocity);
softPotState=0xff;

pitch_bend_test();

}

if( val <= softPotThreshold_OFF && softPotState>0 ) {
noteOff(MIDIchannel, note_onoff, velocity);
softPotState=0;
}

delay(Bounce_Period);
}

//++++++++++++++++++++++Functions++++++++++++++++++++++++++++++++++++++++

// Send a MIDI note-on message.
void noteOn(byte channel, byte note, byte velocity) {
midiMsg( (0x90 | channel), note, velocity);
}

// Send a MIDI note-off message.
void noteOff(byte channel, byte note, byte velocity) {
midiMsg( (0x80 | channel), note, velocity);
}

// Send a MIDI Pitch bend message.
void pitch_bend(byte channel, byte LSB, byte MSB) {
midiMsg( (0xE0 | channel), LSB, MSB); // set LSB = 0
}

// Send a two byte midi message
void midiSend(byte status, byte data ) {
Serial.print(status, BYTE);
Serial.print(data, BYTE);
}

// Send a general MIDI message
void midiMsg(byte cmd, byte data1, byte data2) {
digitalWrite(LedPin,HIGH); // indicate we're sending MIDI data
Serial.print(cmd, BYTE);
Serial.print(data1, BYTE);
Serial.print(data2, BYTE);
digitalWrite(LedPin,LOW);
}
//------------------------------------------------------------------

void pitch_bend_test(){

val_noteOn = analogRead(softPotPin)/Pitch_Bend_Sensitivity; // read voltage on analog pin 0 range 0 to 1023

while(val >= softPotThreshold_ON){
val_now = analogRead(softPotPin)/Pitch_Bend_Sensitivity; // read voltage on analog pin 0 range 0 to 1023

if(val_now > val_noteOn){
bend = (val_now - val_noteOn) + 64;
bend = bend & 0x007F;
pitch_bend(MIDIchannel,0x00, bend);
}

if(val_now < val_noteOn){
bend = 64 - (val_noteOn - val_now);
bend = bend & 0x007F;
pitch_bend(MIDIchannel,0x00, bend);
}

delay(Bounce_Period);
val = analogRead(softPotPin); // read voltage on analog pin 0
}

}

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

I will publish photos of the controller as soon as I have made them but need to sort this problem out first as I intend to build several of them for an electronic music performance.

Many thanks

Archie

note_onoff=val/64 + startNote; // 0 to 15 + 60

Change the 64 to a lower number to get more notes.

val has a range of 0 to 1023 so the divide by 64 will split the range into 16 notes. If you use a divide by 32 you will get 32 notes. However, the notes will be more closly packed on the sliding scale and could produce some jitter.