pink-trombone
v1.0.2
Published
A headless programmable polyphonic version of Neil Thapen's Pink Trombone
Maintainers
Readme
pink-trombone
Headless polyphonic port of Neil Thapen's Pink Trombone.
Motivation
This is not the first JavaScript refactoring of Pink Trombone: some examples include Zakaton's Pink-Trombone, Christian d'Heureuse's pink-trombone-mod and Sean LeBlanc's pink-trombone.
My main aim for this one has been to create a library with a nice API with normalized parameters so that it is easy to incorporate to other projects, and to be able to generate multiple trombones for polyphony.
I needed that for another project of mine, Hiruaho, a web experiment where your eyes turn into singing mouths!
Installation
npm i pink-tromboneGetting started
import { PinkTrombone } from 'pink-trombone';
document.addEventListener("pointerdown", () => {
const audioContext = new window.AudioContext();
const trombone = new PinkTrombone(audioContext);
trombone.isVoiced = true;
}, { once: true })API
[!TIP] Check out the live demo to get a feeling for all the methods, plus a visual explanation!
Class PinkTrombone
Constructors
new PinkTrombone(audioContext);Accessors
- isVoiced: boolean
- Whether the vocal cords are vibrating.
- tenseness: number
- Kind of the opposite of 'breathiness'.
- Usual values: around
0.6. 0is very breathy.1is sharp and robotic.
- frequency: number
- Frequency in Hertz.
- Usual values: between
90and330.
- pitch: number
- Pitch in MIDI. Equivalent to
frequency. - Usual values: between
41(F2) and64(E4).
- Pitch in MIDI. Equivalent to
- vibrato
- Regular variation in pitch.
- amount: number
- Usual values: between
0and0.005. 0is none.1is "full" range.
- Usual values: between
- frequency: number
- How fast the vibrato happens, in Hertz.
- Usual values: around
6.
- nasality
- How nasal it sounds.
- Usual values: between
0and1.
- vowel
- These have to do with how the position of the tongue shapes vowels.
- frontness: number
- How close from the teeth is the part of the tongue that is raised.
- Usual values: from
0to1.
- openness: number
- How far the tongue is from the roof of the mouth.
- Usual values: from
0to1.
Methods
constrictions- Take a look at the API for constrictions below.
add: add and return a new constriction.remove: remove a constriction.
dispose: disconnect the trombone from audio processing and free resources up.
Class Constriction
Constrictions are used to interrupt the flow of air and thus produce consonants.
Constructor
To generate a constriction, call constrictions.add() on a PinkTrombone instance.
Accessors
- location: number
- Where in the tract the constriction is located.
0is the back of the tract.1is the lips.
- strength: number
- How close to completely blocking the air the constriction is.
0is not interfering at all.1is completely blocking.
