But I can see that the gist of it is that pin 9 is accessed by timer1 which is a 16bit timer and pin 11 is accessed by timer2 which is only an 8bit timer. I assume that Tim Barrass chose pin 9 to achieve better sound quality due to a higher timer resolution.
Here is an excerpt from the webpage above that supports this claim:
--- There is fixed relation between the timers and the PWM capable outputs. When you look in the data sheet or the pinout of the processor these PWM capable pins have names like OCRxA, OCRxB or OCRxC (where x means the timer number 0..5). The PWM functionality is often shared with other pin functionality. The Arduino has 3Timers and 6 PWM output pins. The relation between timers and PWM outputs is: Pins 5 and 6: controlled by timer0 (8bit) Pins 9 and 10: controlled by timer1 (16bit) Pins 11 and 3: controlled by timer2 (8bit)
Timer0: Timer0 is a 8bit timer. In the Arduino world timer0 is been used for the timer functions, like delay() 645, millis() 1.4k and micros() 651. If you change timer0 registers, this may influence the Arduino timer function. So you should know what you are doing.
Timer1: Timer1 is a 16bit timer. In the Arduino world the Servo library 1.0k uses timer1 on Arduino Uno (timer5 on Arduino Mega).
Timer2: Timer2 is a 8bit timer like timer0. In the Arduino work the tone() 847 function uses timer2. ---
Thanks for doing the heavy lifting here admin Our interpretations are the same. Doesn’t look possible. Or if it were it could only be 8bit seems hardware is the best solution! Now... I need to look into hardware hacking my grains 😆
I'm also planning to mod my old Grains to have Mozzi-mode.
I recall conversations with Tim a few years ago about changing the output pin and it was pretty clear he was not keen on doing it (needed to use the LittleBits arduino module with Mozzi) and that such changes would be a huge headache. I assume Carsten's sleuthing results above are probably the reason.
I wanted to play with the speak and spell firmware and make it say "A E Modular Are." I found two obstacles: (1) there are a lot of words so easily tuning it was tricky and that (2) the chaos/randomness made it even harder. So I took a peek at the code, removed the extraneous words and deleted the chaos variable from being added into the final selection.
I am not a coder by any stretch of the imagination. But I want to show that if I can do it, then hopefully anyone else could!
This is how I edited it:
Line 62, changed the number of words from 323 to 4.
Line 420, changed the range that it used to look for the values from 0 to 3. 0 through 3 is selected because that gives us four options (0, 1, 2, and 3) for each of the words. The code then reads as: say_word = map( analogRead(A2), 0, 1023, 0, 3 );
Repeated the above for lines 422 and 424.
In lines 422 and 424, I deleted the "+chaos" to delete the influence of chaos. I probably could delete the If on 421 and then delete 423 and 424, but I am not a coder.
Deleted all of the extra words other than spt_A, spt_ARE, spt_E, and spt_Module (I put this step last as it then doesn't change all of the line numbers)
Here's the final code:
"Spell or Speak" an alternative Firmware for the AE Modular GRAINS module by tangible waves