Borut Flis
Borut Flis

Reputation: 16375

Javascript library to generate typical sounds

I am interested in playing sounds of digits and letters in javascript.

I know how to play audio files in javascript, however I would like to know if any of you know any library or something with which you can just generate sounds that you want. I only need to be able to play individual letter and digits.

I realise that I could make files for every digit and letter and than play them when I desire, however I would like to know if a more elegant solutions exists.

Upvotes: 0

Views: 325

Answers (1)

MBer
MBer

Reputation: 2524

any library or something with which you can just generate sounds

Sure: the standard AudioContext and Tone.js can generate at a low level. However,

I only need to be able to play individual letter and digits.

That raises the same issues as with full words: What voice speaks these? Using what language/dialect? There are synthesis tools that offer a selection of voices and can generate/play a soundfile from an arbitrary string, like the mostly-supported SpeechSynthesis API. The voices vary though, and "elegant" can mean many things - a call to a synthesis library may look elegant to the programmer, yet produce an uglier sound. For such a limited set of numbers/digits, you may find prepared sound files more natural:

Upvotes: 1

Related Questions