Plz Help

76 views
Skip to first unread message

Chester

unread,
Sep 5, 2018, 8:14:03 AM9/5/18
to DroidScript
Hello,

"NoBeep" option in SpeechRec Makes The TTS Sound Low
How Can I Make The Volume Higer Or Alternate NoBeep Methods

(SetVolume Doesnt Work With "NoBeep" :( )

BareK

unread,
Sep 5, 2018, 8:27:09 AM9/5/18
to DroidScript
Can you post some code please?
To be sure you correctly identified the problem.
Message has been deleted

Chester

unread,
Sep 5, 2018, 9:03:09 AM9/5/18
to DroidScript
engine.js
window.require=function(path){
 return eval("(function(){"+app.ReadFile(path).replace(/\n|\s\s|\t/gm,'')+";return this;})();");
}
window.AI=function(){
 app.SetVolume("music",0);
 app.SetVolume("system",1);
 this.speechRec=app.CreateSpeechRec("Parxtial");
 this.speechRec.SetOnError(function(){
  if(!AI.speechRec.IsListening()) AI.listen();
 });
 this.speechRec.SetOnResult(AI.speechCallback);
 this.listen=function(callback){
  if(callback) AI.speechCallback=callback;
  AI.speechRec.Recognize("BN");
 }
 this.speak=function(speech,callback){
  if(callback==undefined) callback=AI.listen;
  app.TextToSpeech(speech,1,1,callback,"system","bn_BD");
 }
}

speech_callback.js
var $time=require("lib/plugins/time.js");
AI.speechCallback=function(speech){
var speech=speech.toString().toLowerCase();
var match=function(voice){return speech.indexOf(voice)>-1;}
var matchAny=function(voices){let exist=false;for(voice in voices){if(speech.indexOf(voice)>-1) exist=true;};return exist;}
var matchAll=function(voices){let exist=true;voices.forEach(voice=>{if(!speech.indexOf(voice)>-1) exist=false;});return exist;}
console.log(speech);
switch(true){
 case match("hello"):
  AI.speak("hello");
  break;
 //Time
 case (matchAny(["kotha","koita","kot","koi ta"]) && matchAny(["baje","baji"])):
  AI.speak($time.getTime());
  break;
 case (match("aj") && matchAny(["bar","baat","baar"])):
  AI.speak($time.getDay());
  break;
 case (match("kon") && matchAny(["mass","mash"])):
  AI.speak($time.getMonth());
  break;
 case (match("aj") && match("tarik")):
  AI.speak($time.getDate());
  break;
 
 default:
  AI.listen();
  break;
}}
 
main code: 
var AI=new AI();
AI.speak("hello");

The Low Sound Problem Occurs When I Use "NoBeep" Option 

Chester

unread,
Sep 5, 2018, 9:21:11 AM9/5/18
to DroidScript
Can I Change The Stream Of SpeechRec ?

BareK

unread,
Sep 5, 2018, 12:26:44 PM9/5/18
to DroidScript
Your code is a bit complex to make it work easily (e.g. missing timing.js). 
You should provide a more simple one with only the minimal elements to reproduce your problem.
This is the most effective way to tackle it down (even for you) :)

But for what I've tested the 'NoBeep' option has no effect on the volume of TSS on my device.
Maybe it's something device-related?
Try putting the TTS on the 'music' stream, maybe it'll solve your issue.

But to answer your question, I don't think that you can change the stream of SpeechRec (and I don't think there is anything like a 'stream' notion as it only records everything from the mic).
Reply all
Reply to author
Forward
0 new messages