diff --git a/src/documentation/synths.ts b/src/documentation/synths.ts index 31e8d89..1e5fd00 100644 --- a/src/documentation/synths.ts +++ b/src/documentation/synths.ts @@ -71,6 +71,7 @@ The same basic waveforms can take additional methods to switch to a basic two op - fmi (_frequency modulation index_): a floating point value between 1 and n. - fmh (_frequency modulation harmonic ratio_): a floating point value between 1 and n. +- fmwave (_frequency modulation waveform_): a waveform name (_sine_, _triangle_, _sawtooth_ or _pulse_). ${makeExample( "80s nostalgia", @@ -119,9 +120,18 @@ There is also a more advanced set of parameters you can use to control the envel - fmsustain / fmsus: sustain time of the modulator envelope. - fmrelease / fmrel: release time of the modulator envelope. -${makeExample("FM Synthesis with envelope control", ``, true)} -${makeExample("A very long envelope on the modulator", ``, true)} -${makeExample("A very short envelope on the modulator", ``, true)} +${makeExample( + "FM Synthesis with envelope control", + ` + mod(.5) :: sound('sine') + .note([50,53,55,57].div(.5) - 12) + .fmi(0.5 + usine(.25) * 1.5) + .fmh([2,4].div(.125)) + .fmwave('triangle') + .fmsus(0).fmdec(0.2).out() + `, + true +)} ## ZzFX @@ -223,29 +233,22 @@ mod(2) :: sound('zzfx').zzfx([3.62,,452,.16,.1,.21,,2.5,,,403,.05,.29,,,,.17,.34 # Speech synthesis -Topos can also speak using the [Web Speech API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Speech_API). Speech synthesis can be used in two ways: +Topos can also speak using the [Web Speech API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Speech_API). There are two ways to use speech synthesis: -- speak(text: string, lang: string, voice: number, rate: number, pitch: number, volume: number): speak the given text. - -Or by using string and chaining: - -- "Hello".rate(1.5).pitch(0.5).speak(). - -Value ranges for the different parameters are: -- lang(string): language code, for example en for English, fr for French or with the country code for example British English en-GB. See supported values from the [list](https://cloud.google.com/speech-to-text/docs/speech-to-text-supported-languages). -- voice(number): voice index, for example 0 for the first voice, 1 for the second voice, etc. -- rate(number): speaking rate, from 0.0 to 10. -- pitch(number): speaking pitch, from 0.0 to 2. -- volume(number): speaking volume, from 0.0 to 1.0. - -Examples: +- speak(text: string, lang: string, voice: number, rate: number, pitch: number, volume: number) + - text: the text you would like to synthesize (_e.g_ "Wow, Topos can speak!"). + - lang: language code, for example en for English, fr for French or with the country code for example British English en-GB. See supported values from the [list](https://cloud.google.com/speech-to-text/docs/speech-to-text-supported-languages). + - voice: voice index, for example 0 for the first voice, 1 for the second voice, etc. + - rate(number): speaking rate, from 0.0 to 10. + - pitch(number): speaking pitch, from 0.0 to 2. + - volume(number): speaking volume, from 0.0 to 1.0. ${makeExample( "Hello world!", ` mod(4) :: speak("Hello world!") `, - false + true )} ${makeExample( @@ -256,12 +259,15 @@ mod(2) :: speak("Topos!","fr",irand(0,5)) false )} + +You can also use speech by chaining methods to a string: + ${makeExample( "Chaining string", ` onbeat(1,3) :: "Foobaba".voice(irand(0,10)).speak() `, - false + true )} ${makeExample( @@ -274,7 +280,7 @@ ${makeExample( mod(6) :: sentence.pitch(0).rate(0).voice([0,2].pick()).speak() `, - false + true )} ${makeExample(