BlocklyProp icon indicating copy to clipboard operation
BlocklyProp copied to clipboard

Block updates for text2speech on Activity Board

Open AndyLindsay opened this issue 6 years ago • 6 comments

There's a forum discussion about no sound from Activity Board on VEHO speaker even though earbuds work fine.

A speaker that mixes the signals or shorts two leads together for stereo to mono will cause reflected signals to cancel each other out. To keep both earbuds and VEHO options, I would recommend defaulting the text2speech initialize block to 27, 27 with the ability to change it to any pair of pins or single I/O pin. If you prefer to set up the block so that it has mono and stereo options, consider using the the terms mono and reflected instead.

I removed some caveats from the talk_run function so that -1, 27, 27, 27, and 27, -1 all produce the same result. A second pin is only added and configured when you do something like 26, 27.

One last update, there is now a talk_setVolume feature that goes from 0 to 7.

// ------ Libraries and Definitions ------
#include "simpletools.h"
#include "text2speech.h"

// ------ Global Variables and Objects ------
talk * spkr; // Talk process ID/data pointer

// ------ Main Program ------
int main() 
{

  // Speaker behavior will vary depending on speaker type and connections
  // On Activity Board
  //spkr = talk_run(26,27);                    // Left and -right
  //spkr = talk_run(26,26);                    // Left only
  spkr = talk_run(27, 27); // Right only
  //spkr = talk_run(-1,27);                    // Right only
  //spkr = talk_run(26,-1);                    // Left only
  //spkr = talk_run(27,-1);                    // Right only
  //spkr = talk_run(-1,26);                    // left only

  // Try volume values from 0...7
  talk_setVolume(spkr, 6);

  talk_say(spkr, "heloa"); // Say hello
  pause(1000);
  talk_say(spkr, "goodbae"); // Say goodbye
}

AndyLindsay avatar Sep 24 '18 18:09 AndyLindsay