Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : Did you know S.A.M.? (text to speech)
Page 5 of 8 | |||||
Author | Message | ||||
CircuitGizmos Guru Joined: 08/09/2011 Location: United StatesPosts: 1421 |
I'd like to see that. Or should I say that I'd like to hear that? Nice! Micromites and Maximites! - Beginning Maximite |
||||
Frank N. Furter Guru Joined: 28/05/2012 Location: GermanyPosts: 815 |
For all those who want to try it out: 2018-10-19_171944_SAM_TTS_TESTMX170.zip You can flash this file for example with PicKit3 in a 28 pin MX170. Tx_µC is on pin 11 and Rx_µC is on pin 12 (equivalent to our Micromite), but with 9600,8,N,1 with a normal terminal (no VT100). The loudspeaker is connectet to pin 7 (better with a 10..100µF in series). When you send something via the terminal, SAM speaks after a RETURN. Frank |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8598 |
Have you got an MMX or a Armmite H7 you can compare it to? It isn't great on any platform. Are you using a low pass filter on the output like the design in the MM+ manual? I'm away from home so can't do any real testing for the next week or so. Should be easy enough, just use a specific character to indicate that the next sequence is a command rather than text. e.g. $Mnnn, $Tnnn This is trivial, revised main.c code below: /******************************************************************************* * Includes and Defines ******************************************************************************/ #include "PIC32MX270_STD.h" #include "delay.h" #include "uart1.h" #include <string.h> #include <stdlib.h> #include <stdio.h> #include "sam.h" #include "reciter.h" #include "tts.h" #define BUSY LATBbits.LATB8 //Change to whatever pin you want /******************************************************************************* * Function Name: void initMain(void) * * Specification: initializes main * *******************************************************************************/ void initMain(void) { // unlock PPS systemReg_Unlock(); CFGCONbits.IOLOCK = 0; TRISBbits.TRISB8 = 0; // set PINB8 as output, Change to whatever pin you want BUSY = 1; //set Busy while we get started RPB3Rbits.RPB3R = 0x0005; //RB3->OC1 RPB4Rbits.RPB4R = 0x0001; //RB4->UART1 TX U1RXR = 0b0010; //RA4->UART1 RX // lock PPS CFGCONbits.IOLOCK = 1; systemReg_Lock(); } int main() { char input[512]; int j; uc_init(); initMain(); // initialize UART UART1_Initialize(); delay_ms(300); // initialize the TTS module initTTS(); while(1) { // configure printf to use UART1 __XC_UART = 1; // begin speaking printf(">"); BUSY = 0; //ready to receive input j=0; // The next statement which should read the incoming serial input never returns while((input[j++]=UART1_Read())!=13); BUSY = 1; //Busy input[j++]=10; input[j]=0; printf(input); // speak text speakText(input); // end speaking } } |
||||
Frank N. Furter Guru Joined: 28/05/2012 Location: GermanyPosts: 815 |
Hi, Peter, no, I have all parts for an MMX here, but annoyingly no system executable. I didn't put a filter in between - the BBC:Microbit sounds very good even without it! Thank you for your efforts |
||||
Frank N. Furter Guru Joined: 28/05/2012 Location: GermanyPosts: 815 |
Okay, now I have a BUSY pin. I put "BUSY = 1; //Busy" just before "speakText(input);" - Now I know exactly when SAM is still busy talking. (Peter, you still have the wrong value for U1RXR in your code...) SAM sounds very much better with this changes in Delay.h: #define us_SCALE (GetSystemClock()/1500000) //2000000) Now SAM has about the same speech speed as the original online Version.#define ms_SCALE (GetSystemClock()/1500) //2000) Peter, can you help me to read the variables for PITCH, SPEED, MOUTH and THROAT and transfer them to Sam.h? Unfortunately my skills are not enough! Frank |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8598 |
Here is a version that I think is much better, should run on any variant of MX150/170 2018-10-19_214652_23_TTS.X.production.zip This has the following changes/features: 40MHz clock for better compatibility with MX150 Improved sound quality by synchronising PWM changes with the PWM output Echos characters as you type them Set speed, pitch, mouth and throat using the commands $Pnnn $Snnn $Mnnn $Tnnn Read current values of speed, pitch, mouth and throat using the commands ?P ?S ?M ?T No I haven't - 0b0010 = 2 Complete MPLabX project 2018-10-19_215022_23_TTS.X.zip |
||||
Frank N. Furter Guru Joined: 28/05/2012 Location: GermanyPosts: 815 |
AMAZING!!! THAT'S IT!!! WE HAVE A TTS CHIP!!! The sound is incredible! - no filter, only a active loudspeaker! I'm very impressed! (I overlooked the "b" in your code...) ...setting and reading values doesn't work for me: I send: $S100 for speed 100 ,get back "00" and SAM says zero, zero... When I send ?S he says s... |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8598 |
You need CR after each command - no spaces, no LF Here is a version that filters out invalid characters to make it a bit more robust. Invalid commands are just ignored. Hex file: 2018-10-19_224759_23_TTS.X.production.zip Pinout for 44-pin MM is: console as per MM2 audio output - pin 24 busy output (active high) - pin 44 Full project: 2018-10-19_225256_23_TTS.X.zip |
||||
Frank N. Furter Guru Joined: 28/05/2012 Location: GermanyPosts: 815 |
SAM and question mark This SAM code based on a code from ToughDev which based on the original reengineered code from Sebastian Macke (simulationcorner.net). The original code understands question marks and raises the voice at the end of the sentence - the code of ToughDev has an error in ReciterTabs.h and therefore ignores the question mark. I found this bug a few years ago when I was experimenting with the PIC24 code: In line 210 in ReciterTabs.h "174" must be replaced with "191", then the tone boost works for a question mark! (that had cost a lot of effort at that time to find this error...) Frank |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8598 |
V1.1 with added question mark 2018-10-19_230918_23_TTS.X.production.zip |
||||
Frank N. Furter Guru Joined: 28/05/2012 Location: GermanyPosts: 815 |
Hmmm, I can read the values with ?P or ?S, but when I try to write $P100, SAM always says zero, zero... I don't know if Br@y++ sends an LF, but the reading is OK now... |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8598 |
What about if you try $P78 What do you get? All my testing is with teraterm which works perfectly |
||||
Frank N. Furter Guru Joined: 28/05/2012 Location: GermanyPosts: 815 |
SAM says "eight"... I don't know what's wrong... Is it possible that Br@y++ sends to fast? I type the text in one line and press send. Where ist the "7"? |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8598 |
Sounds like your terminal emulator is dropping characters or the internal clock on your MX170 is way off, I assume you get ? "Speed 8" Try this version and play with different values to see if it is always the 7th character that is dropped. Is the speed changing as per the instruction? 2018-10-20_000259_23_TTS.X.production.zip |
||||
Frank N. Furter Guru Joined: 28/05/2012 Location: GermanyPosts: 815 |
No change! Unfortunately it is not possible to set different speeds with Br@y++. With Terraterm it also works with me. I think the characters get lost while the "$" is being responded to. Probably it would be better to react to CR/LF and evaluate it afterwards... I don't think the sign will get lost - if I transfer a sentence to speak it works too. It is possible that there are problems if the conversion is to happen later over a µC... |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8598 |
Just tried it with realterm which does batch send and it works. Also works with MMEdit in ASCII terminal mode so I don't think the error is in the TTS code; get a decent terminal emulator . The processing time for $ is trivial compared to the millisecond it takes to send a character at 9600 baud so there is no point in changing the way it works. Is your terminal set up for 8N1? "Final" project source 2018-10-20_032928_23_TTS.X.zip |
||||
CircuitGizmos Guru Joined: 08/09/2011 Location: United StatesPosts: 1421 |
'170 works for me, '150 does not. Micromites and Maximites! - Beginning Maximite |
||||
CircuitGizmos Guru Joined: 08/09/2011 Location: United StatesPosts: 1421 |
There must be a limit to the input buffer size? If I send: [code] Bacon ipsum dolor amet picanha tail beef ribs capicola. Leberkas tail prosciutto flank pig frankfurter. Pastrami jerky beef ribs pig. Pastrami andouille sirloin ground round spare ribs ribeye buffalo beef. Andouille buffalo brisket flank. [/code] I get about as far as frankfurter. Also: Fs and Ss don't sound good. 2018-10-20_101915_TTS.zip But I love hearing that SAM again! Excellent work so far! Micromites and Maximites! - Beginning Maximite |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8598 |
Please try this version, specifically compiled for MX150 but still works on MX470 2018-10-20_181116_23_TTS.X.production.zip |
||||
Frank N. Furter Guru Joined: 28/05/2012 Location: GermanyPosts: 815 |
Hi Peter, I think you are right with my terminal program - I tried HTerm and everything runs as desired! It seems that Br@ay++ uses the "$" for some internal settings and does not send... Have you made any changes to the project? Frank |
||||
Page 5 of 8 |
Print this page |