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
I’m thinking the other way around, modify mozzi to use pin 11! I’ll have to look at it the next time I have a chance
When I saw this question, I thought "that should be easy", because the I noticed that the MOZZI-Grains-modules define the PINs which are used in the code: [...] // --- GRAINS CV ins, outs and Pots, using 'Arduino-PINS' according to: https://wiki.aemodular.com/pmwiki.php/AeManual/GRAINS --- #define CV_POT_IN1 A2 #define CV_POT_IN2 A1 #define CV_POT3 A0 #define CV_IN3 A3 #define CV_AUDIO_IN A4 #define CV_AUDIO_OUT 9 #define CV_GATE_OUT 8 [...]
So we just have to change this to 11??? No! Unfortunately, CV_AUDIO_OUT is not used. As admin already described in his earlier post above, PIN 9 is used somewhere deep in the MOZZI library.
The Master sheet is what basically get's copied into the GrainsSpellOrSpeak.ino file. Export it as a tab delineated document and paste the result into the code. The TI99C and TI99H get copied into Vocab_US_TI99.c and Vocab_US_TI99.h respectively. The TI99C needs to be exported as a comma separated value document and the TI99H can be a space or tab delineated document. From there it is easy to paste into the correct source.
This vocabulary is too large for the Grains. Regardless, it is near impossible to control with such a large library. So I'm going to use this as a starting point and delete the words/phrases that I do not want to use. I'm not sure how to implement this into the github or even if it is a good idea to do so since it will not compile correctly due to it's size.