|
Post by slowscape on Jul 26, 2020 21:53:24 GMT
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
|
|
|
Post by admin on Jul 26, 2020 22:22:50 GMT
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 That would be great, good luck!
|
|
|
Post by admin on Jul 27, 2020 9:59:10 GMT
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 Hi slowscape, I've done some digging and googleing and found one possible reason why Mozzi uses pin 9 instead of pin 11 and that may have to do with the timer interrupts that are responsible for that pin. This website explains it in way too much detail for the uninitiated (that's me): www.robotshop.com/community/forum/t/arduino-101-timers-and-interrupts/13072But 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. ---
|
|
|
Post by slowscape on Jul 29, 2020 16:26:03 GMT
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 😆
|
|
|
Post by rodney on Aug 6, 2020 5:16:44 GMT
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. 
|
|
|
Post by cpruby on Nov 17, 2020 2:37:54 GMT
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
https://www.tangiblewaves.com/store/p86/GRAINS.html
The synthetic words, as used with a famous toy from the late 70th, can be triggered via Gate-impulses and selcted via CV or a pot on the GRAINS
To set up the environment needed to install this firmware,
please refer to the AeManual for GRAINS on the AE Modular Wiki:
http://wiki.aemodular.com/pmwiki.php/AeManual/GRAINS
Demotrack available here: https://soundcloud.com/taitekatto/grains-spell-or-speak
This program relies on the Talkie Library by Peter Knight as modified by Jean-Luc Deladrière with "Talko Counter for Grains",
which is also included in the folder of this firmware.
The orinal "TALKO COUNTER" also including talkie.cpp and talkie.h of this version of the Talkie Library can be found here:
https://www.ginkosynthese.com/grains-codes
The phonems used with this firmware as provided via "Vocab_US_TI99.c" and others can be found with the talkie-library for Arduino here:
https://www.arduinolibraries.info/libraries/talkie
Note: if you want to adjust the way Pitch and Speed of the talking-voice can be modified please have a look at "talkie.cpp"
in the current folder and look for the values mapped via "analogRead(0)" and "analogRead(1)".
Usage of this Firmware with GRAINS:
===================================
IN1 / Pot1: Select word from available phonems (via CV or pot)
IN2 / Pot2: Change the Pitch of the currently selected word (via CV or pot)
IN3: GATE to trigger the currently selected word
Pot3: Change the Speed of the currently selected word (via pot)
A: If analog input is used more or less random values can be applied to modify the current word-selection
OUT: Audio out of spoken words or letters
D: Quantized value (HIGH or LOW) of the input given via analog input, this may be used as GATE/trigger for other AE Modular modules
Caution! Use at your own risk (according to GNU General Public License v2 '12. No Warrenty')
--------------------------------------------------------------------------------------------
This program in combination with the hardware it is applied to can produce harsh and loud frequencies that may be of harm to speakers or your ears!
Permanent hearing loss may result from exposure to sound at high volumes. Use as low a volume as possible.
'Spell or Speak' an experimental Firmware for the AE Modular GRAINS module by tangible waves
Copyright (C) 2020 Mathias Brüssel
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License v2 as published by
the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <Arduino.h>
#include "Talkie.h"
#include "Vocab_US_TI99.h" // Texas Instruments phonems, similar to those used with the famous "Speak&Spell" and other devices
Talkie voice; // Prepare speach - Use PIN 11 only, because this is connected as audio out with tangible waves GRAINS module
static uint8_t* words[4] = // List of words to be select from via GRAINS CV ins and/or pots
{
spt_A,
spt_ARE,
spt_E,
spt_MODULE,
};
void setup()
{
// Serial.begin(115200); // Only needed if you want to use Serial.print() to put out values to the Arduino IDE's Serial Window
}
void loop()
{
static bool last_trigger = true;
bool new_trigger = false;
int say_word = 0;
int last_read = 0;
int chaos = 0;
if(last_trigger) // If word was triggered already look for low gate
{
if( analogRead(A3) < 512 ) // CV-in 3 of GRAINS-module "LOW"?
last_trigger = new_trigger = false; // No new gate, remember condition
}
else // If no word is currently triggered we can look for new trigger
{
if( analogRead(A3) >= 512 ) // CV-in 3 of GRAINS-module "HIGH"?
last_trigger = new_trigger = true; // We have a gate now, remember the condition
}
chaos = analogRead(A4); // Analogue input, can also be used as CV-in with this Firmware of GRAINS
if( chaos > 4 ) // Value should be >= 5 if input is connected
chaos = map( chaos, 0, 1023, 1, 160 ); // This is a more or less random value we get via audio or CV input to be added or substracted to the index of the selected word lateron
// --- Note: IN2/Pot2:Pitch and Pot3:Speed are adjusted in talkie.cpp via "map(analogRead(...))" as modified by Jean-Luc Deladrière for "Talko Counter for Grains" ---
if( new_trigger ) // Speak now!
{
say_word = map( analogRead(A2), 0, 1023, 0, 3 ); // CV IN 1 / Pot 1 - used to select words
if( say_word > 161 )
voice.say(words[constrain(say_word,0,3)]); // Random-factor read from analog input higher than middle of available words, substract
else
voice.say(words[constrain(say_word,0,3)]); // Random-factor read from analog input lowe than middle of available words, add
}
chaos > 80 ? digitalWrite(8, HIGH) : digitalWrite(8, LOW); // Set digital out to low or high, depending on level of analogue input
}
|
|
|
Post by funbun on Jan 18, 2021 16:58:21 GMT
Yeah, a pair of GRAINS modules will help flesh out my oscillator corps. May even get three.
|
|