Skip to main content

Documentation

Burmese Voice latest API can be installed via the script tag.

<script src="https://www.unpkg.com/burmese-voice"></script>

BurmeseVoice constructor

BurmeseVoice(URL:string)

returns a BurmeseVoice Object

URL is the url of model directory. URL must be exact URL, (not relative URL).

For example, if http://localhost:8000/models/ is the location of model directory, it must be set as arugment as complete URL.

allow protocol - https, http, file

const URL = "http://localhost:8000/models/";
const burmeseVoice = new BurmeseVoice(URL);

load()

returns a Promise

Load the model files, metadata and weights into the bowser.

await burmeseVoice.load();

listen(callback:function)

calls the browser microphone speaker, and listen the audio, and give result scores into the callback function.

burmeseVoice.listen((result)=>{
console.log(result);
const voice = burmeseVoice.getBestResult(result.scores);
console.log(voice);
});

stopListening()

stop the listen function activity

burmeseVoice.stopListening();

getBestResult(scores:Array)

get best Result from scores in listen callback function with {label, index} object

burmeseVoice.listen((result)=>{
console.log(result);
const voice = burmeseVoice.getBestResult(result.scores);
console.log(voice);
});

getLabels()

get labels available in the Burmese Voice AI.

console.log(burmeseVoice.getLabels());