All Projects → muaz-khan → Translator

muaz-khan / Translator

Translator.js is a JavaScript library built top on Google Speech-Recognition & Translation API to transcript and translate voice and text. It supports many locales and brings globalization in WebRTC! https://www.webrtc-experiment.com/Translator/

Projects that are alternatives of or similar to Translator

WebRTC-Python-Open-Source-Application-for-1-to-1-video-chat
This Sample Python Application demonstrates the use of EnableX Platform Server APIs and JavaScript Toolkit to develop basic one to one video chat application. It allows developers to ramp up on app development by hosting on their own devices.
Stars: ✭ 12 (-88.35%)
Mutual labels:  webrtc, webrtc-demos
Learning Webrtc
Codes and notes while learning webrtc
Stars: ✭ 98 (-4.85%)
Mutual labels:  webrtc, webrtc-demos
foxrtc
media sdk based on webrtc
Stars: ✭ 36 (-65.05%)
Mutual labels:  webrtc, webrtc-demos
Cuckoo
🎥 Cuckoo - A free anonymous video-calling web application built with WebRTC and React that provides peer-to-peer video and audio communication in a web browser with no plugins or extensions required.
Stars: ✭ 195 (+89.32%)
Mutual labels:  webrtc, webrtc-demos
Webrtc android
webrtc VideoCall VideoConference 视频通话 视频会议
Stars: ✭ 764 (+641.75%)
Mutual labels:  webrtc, webrtc-demos
Mediastreamrecorder
Cross browser audio/video/screen recording. It supports Chrome, Firefox, Opera and Microsoft Edge. It even works on Android browsers. It follows latest MediaRecorder API standards and provides similar APIs.
Stars: ✭ 2,381 (+2211.65%)
Mutual labels:  webrtc, webrtc-demos
webrtc-hotwire-rails
A video chat app demonstration using Hotwire and Ruby on Rails
Stars: ✭ 38 (-63.11%)
Mutual labels:  webrtc, webrtc-demos
Samples
WebRTC Web demos and samples
Stars: ✭ 11,318 (+10888.35%)
Mutual labels:  webrtc, webrtc-demos
Webrtc
A reference gradle project that let you explore WebRTC Android in Android Studio.
Stars: ✭ 562 (+445.63%)
Mutual labels:  webrtc, webrtc-demos
Detectrtc
DetectRTC is a tiny JavaScript library that can be used to detect WebRTC features e.g. system having speakers, microphone or webcam, screen capturing is supported, number of audio/video devices etc. https://www.webrtc-experiment.com/DetectRTC/
Stars: ✭ 509 (+394.17%)
Mutual labels:  webrtc, webrtc-demos
Rtcmulticonnection
RTCMultiConnection is a WebRTC JavaScript library for peer-to-peer applications (screen sharing, audio/video conferencing, file sharing, media streaming etc.)
Stars: ✭ 2,187 (+2023.3%)
Mutual labels:  webrtc, webrtc-demos
Analysisavp
音视频学习,相关文件格式/协议分析。h264 nalu aac adts flv
Stars: ✭ 38 (-63.11%)
Mutual labels:  webrtc, webrtc-demos
React Webrtc
Video chat using webRTC and react
Stars: ✭ 168 (+63.11%)
Mutual labels:  webrtc, webrtc-demos
Webrtcchat
🔏 Pure Browser To Browser Chat (STUN & ICE Servers optional)
Stars: ✭ 230 (+123.3%)
Mutual labels:  webrtc, webrtc-demos
Workerman Webrtc
php webrtc demo based on workerman
Stars: ✭ 161 (+56.31%)
Mutual labels:  webrtc, webrtc-demos
singo
Simple WebRTC Signaling Server written in Go
Stars: ✭ 57 (-44.66%)
Mutual labels:  webrtc, webrtc-demos
Webrtc Experiment
WebRTC, WebRTC and WebRTC. Everything here is all about WebRTC!!
Stars: ✭ 10,335 (+9933.98%)
Mutual labels:  webrtc, webrtc-demos
Webrtc Data Channel Demo
WebRTC Data Channel demo
Stars: ✭ 116 (+12.62%)
Mutual labels:  webrtc, webrtc-demos
Starrtc Web Demo
一对一voip视频聊天,直播连麦,多人视频会议,在线会议web演示:
Stars: ✭ 281 (+172.82%)
Mutual labels:  webrtc, webrtc-demos
Webrtc Text Chat Tutorial
WebRTC Chat Tutorial for Scaledrone Realtime Messaging Service
Stars: ✭ 24 (-76.7%)
Mutual labels:  webrtc, webrtc-demos

Translator.js | WebRTC Voice & Text Translator

Demo: https://www.webrtc-experiment.com/Translator/

Translator.js is a JavaScript library built top on Google Speech-Recognition & Translation API to transcript and translate voice and text. It supports many locales and brings globalization in WebRTC!

How to use?

<script src="https://cdn.webrtc-experiment.com/Translator.js"> </script>

Facing issues using in your own domain?

API Reference

var translator = new Translator();

getListOfLanguages

Get list of all supported languages:

translator.getListOfLanguages(function(languages) {
    languages.forEach(function(language) {
        console.log(language.name, langauge.language);
    });
});

You can pass your API_Key as well:

var config = {
    api_key: 'AIzaSyCUmCjvKRb-kOYrnoL2xaXb8I-_JJeKpf0',
};

translator.getListOfLanguages(function(languages) {
    languages.forEach(function(language) {
        console.log(language.name, langauge.language);
    });
}, config);

translateLanguage

Pass English language text, and convert into Arabic or into any other supported language.

This method simply converts text from one language into another.

var config = {
    from: 'language-of-the-text',
    to: 'convert-into',
    api_key: 'AIzaSyCUmCjvKRb-kOYrnoL2xaXb8I-_JJeKpf0', // use your own key
    callback: function (translatedText) {
        console.log('translated text', translatedText);
        
        // here you can use "speakTextUsingRobot"
        // see below sections
    }
};

translator.translateLanguage(textToConvert, config);

translateLanguage method takes two arguments:

  1. Text to convert
  2. Source and Target Languages; also callback method

Second argument is an object.

What you can do is either display translated text in chat-box; or use speakTextUsingRobot or speakTextUsingGoogleSpeaker methods to play voice.

voiceToText

This method allows you convert voice into text; whatever you speak is recognized using Google Speech-Recognition API; and converted into text using same API:

var convertMyVoiceIntoEnglish = 'en-US'; // select any language
translator.voiceToText(function (text) {
    console.log('Your voice as text!', text);
    
    // here you can use "translateLanguage" method
    // translator.translateLanguage
    // see more info in above section
}, convertMyVoiceIntoEnglish);

voiceToText method takes two arguments:

  1. Callback; used to return recognized text
  2. Language; used to suggest Speech-Recognition API to easily recognize speaker's language

If language is not passed; then en-US will be used as default language.

You can use socket.io, websockets or any other signaling gateway like WebRTC data channels to exchange/share transcripted text with other users.

speakTextUsingRobot

Use a javascript file to speak the text.

This method uses meSpeak.js library to play text using a robot voice. Behind the scene; text is buffered and converted into WAV file; which is played using invisible <audio> element.

var config = {
    workerPath: '//cdn.webrtc-experiment.com/Robot-Speaker.js',
    callback: function (WAV_File) {},
    amplitude: 100,
    wordgap: 0,
    pitch: 50,
    speed: 175,
    onSpeakingEnd: function() {},
    onWorkerFileDownloadStart: function() {},
    onWorkerFileDownloadEnd: function() {}
};

translator.speakTextUsingRobot(textToPlay, config);

speakTextUsingRobot method accepts two arguments; first one is mandatory and last one is optional:

  1. Text to Speak i.e. convert text into voice file (WAV)
  2. Options like worker-file path etc.

Default worker file's path is https://www.webrtc-experiment.com/Robot-Speaker.js. It is strongly recommended to download and link it from your own domain.

If you want to play WAV file yourself or you want to POST/store WAV file; then you can use callback parameter to override default behaviour:

translator.speakTextUsingRobot(textToPlay, {
    callback: function (WAV_File) {
        HTTP_POST_using_FormData( WAV_File );
    }
});

onSpeakingEnd is useful in text-chat apps; where you can disable text box until text is translated and spoken; then you can enable it again.

speakTextUsingGoogleSpeaker

Use Google Servers (Translation API) to speak the text.

This method uses Google Non-Official Translation API to convert text into mp3 sound. API Key used is taken from someone on the web; and there is no guarantee of its availability; that's why it is strongly suggested to buy your own KEY and pass using api_key parameter:

translator.speakTextUsingGoogleSpeaker({
    textToSpeak: 'text-to-convert',
    targetLanguage: 'your-language',

    // Google Translation service's API Key
    api_key: 'Your-Private-API-Key'
});

Both textToSpeak and targetLanguage are mandatory. Only api_key is optional.

Use Cases

  1. You can use it in any WebRTC application to support globalization!
  2. You can use WebRTC data channels to share transcripted text among users
  3. You can mute original voice; and play translated one. Though, voice and video will NOT be sync

It is really useful in text-chat apps!

Demo

Languages Supported

102+ languages are supported. Please check above demo link for the list.

License

Translator.js is released under MIT licence . Copyright (c) Muaz Khan.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].