mesibo / messenger-app-backend

Backend code for Messenger app
Other
86 stars 39 forks source link

add speech <=> text conversion before broadcasting #2

Open issam1975 opened 5 years ago

issam1975 commented 5 years ago

Hi, i want to use mesibo as a backend for a voice and text messaging application (flutter) .

this is intended to be used by deaf and or dumb people

so i want to use speech recognition services like google one to make speech to text and text to speech coversion before delivering the messages .

any advices or recommendation on how this can be done is more then welcome .

thanks a lot .

mesibo commented 5 years ago

This is indeed an interesting requirement and certainly doable. However if you share more information how do you plan to use it, we will have better suggestions.

issam1975 commented 5 years ago

it's very simple

let's say that 2 people are chatting on the mobile application (1-1 to simply)

one of them can speak and hear correctly , the other one not

so the first one speak regularly with his voice and the second one recieve the message as text via speech recognition .

on the other side if the second person cannot speak as well he/she just type a text message and the first one recieve it as a voice via tts recognition .

also ideally i want to use your own servers and plateform for scalability reason not my own server .

hope it make sense .

thanks a lot .

itsmebirdie commented 4 years ago

Yeah @issam1975 You are right!

That is a great idea to make a speech recognition and text to speech implementation
Dear Mesibo Team, You should do this, because the above features would be a great achievement, You can use bootstrap.js and Node.js for implementing the speech recognition and text to speech!
Well Good luck!

Your Friendly Web Dev
Maanas Nair

itsmebirdie commented 4 years ago

Just got Something!

Use This Example for Text to Speech:

index.html

<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/materialize/0.95.1/css/materialize.min.css">

<div class="container">
  <div class="row">
    <nav>
      <div class="nav-wrapper">
        <div class="col s12">
          <a href="#" class="brand-logo">Text to speech example</a>
        </div>
      </div>
    </nav>
  </div>
  <form class="col s8 offset-s2">
    <div class="row">
      <label>Choose voice</label>
      <select id="voices"></select>
    </div>
    <div class="row">
      <div class="col s6">
        <label>Rate</label>
        <p class="range-field">
          <input type="range" id="rate" min="1" max="100" value="10" />
        </p>
      </div>
      <div class="col s6">
        <label>Pitch</label>
        <p class="range-field">
          <input type="range" id="pitch" min="0" max="2" value="1" />
        </p>
      </div>
      <div class="col s12">
        <p>N.B. Rate and Pitch only work with native voice.</p>
      </div>
    </div>
    <div class="row">
      <div class="input-field col s12">
        <textarea id="message" class="materialize-textarea"></textarea>
        <label>Write message</label>
      </div>
    </div>
    <a href="#" id="speak" class="waves-effect waves-light btn">Speak</a>
  </form>  
</div>

<div id="modal1" class="modal">
  <h4>Speech Synthesis not supported</h4>
  <p>Your browser does not support speech synthesis.</p>
  <p>We recommend you use Google Chrome.</p>
  <div class="action-bar">
    <a href="#" class="waves-effect waves-green btn-flat modal-action modal-close">Close</a>
  </div>
</div>

<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/materialize/0.95.1/js/materialize.min.js"></script>

index.js

$(function(){
  if ('speechSynthesis' in window) {
    speechSynthesis.onvoiceschanged = function() {
      var $voicelist = $('#voices');

      if($voicelist.find('option').length == 0) {
        speechSynthesis.getVoices().forEach(function(voice, index) {
          var $option = $('<option>')
          .val(index)
          .html(voice.name + (voice.default ? ' (default)' :''));

          $voicelist.append($option);
        });

        $voicelist.material_select();
      }
    }

    $('#speak').click(function(){
      var text = $('#message').val();
      var msg = new SpeechSynthesisUtterance();
      var voices = window.speechSynthesis.getVoices();
      msg.voice = voices[$('#voices').val()];
      msg.rate = $('#rate').val() / 10;
      msg.pitch = $('#pitch').val();
      msg.text = text;

      msg.onend = function(e) {
        console.log('Finished in ' + event.elapsedTime + ' seconds.');
      };

      speechSynthesis.speak(msg);
    })
  } else {
    $('#modal1').openModal();
  }
});