View on
GitHub

#About

Baragouin is a JavaScript library that will give a (unintelligible) voice to your virtual characters.

#Installation

Available as ES module on npm:

terminal

> npm install baragouin

js

import baragouin from "baragouin"

or as minified bundle on CDN:

html

<script src="https://umd.cdn.pika.dev/baragouin/">
<script>baragouin("now available as global")<script>

#Usage

js

baragouin(text, options)

baragouin("Hello World !", {
  voice: "sine",
  volume: 50,
  speed: 30,
  emotion: 40,
  pitch: 25,
  resonance: 10,

  onNote(text, time){
    // this is called at every syllab pronounced,
    // with the text read so far. Perfect time
    // to update the text of a message balloon
  },
  onEnd(text, time){
    // this is called once at the end of the speech
  }
})
Note that to be allowed to make sounds, user must interact with the page first (click on something)

#Options

#Voices

Okay, pretty cool so far, but what if you want to change how the voice sounds ? This is the voice parameter !

4 basic voices are included. They use the classic waveforms: sine, square, triangle and sawtooth.

Custom voices

Custom voices use custom wavetables defined in JSON files that you have to load. Just load the voices you need, these files can be heavy.

js

baragouin.loadVoice("Bass")