From eb14fc6ca53ae93d287076d7c8932bf4fa1fc7e7 Mon Sep 17 00:00:00 2001 From: Raphael Forment Date: Fri, 19 Jan 2024 03:12:47 +0100 Subject: [PATCH] start splitting the documentation to include a new article about pitch --- index.html | 1 + src/Documentation.ts | 18 ++++++------ .../learning/audio_engine/pitch.ts | 28 +++++++++++++++++++ 3 files changed, 39 insertions(+), 8 deletions(-) create mode 100644 src/documentation/learning/audio_engine/pitch.ts diff --git a/index.html b/index.html index ec2af08..621127d 100644 --- a/index.html +++ b/index.html @@ -201,6 +201,7 @@

Playing a sound

Amplitude

+

Pitch

Sampler

Synths

Filters

diff --git a/src/Documentation.ts b/src/Documentation.ts index 8c83cec..f2ff8e1 100644 --- a/src/Documentation.ts +++ b/src/Documentation.ts @@ -3,6 +3,7 @@ import { type Editor } from "./main"; import { introduction } from "./documentation/basics/welcome"; import { loading_samples } from "./documentation/learning/samples/loading_samples"; import { amplitude } from "./documentation/learning/audio_engine/amplitude"; +import { pitch } from "./documentation/learning/audio_engine/pitch"; import { effects } from "./documentation/learning/audio_engine/effects"; import { sampler } from "./documentation/learning/audio_engine/sampler"; import { sample_banks } from "./documentation/learning/samples/sample_banks"; @@ -152,6 +153,7 @@ export const documentation_factory = (application: Editor) => { generators: generators(application), shortcuts: shortcuts(application), amplitude: amplitude(application), + pitch: pitch(application), effects: effects(application), sampler: sampler(application), mouse: mouse(application), @@ -218,28 +220,28 @@ export const updateDocumentationContent = (app: Editor, bindings: any) => { moreStyling: true, backslashEscapesHTMLTags: true, extensions: [showdownHighlight({ - pre: true, + pre: true, auto_detection: false }), ...bindings], }); - - if(Object.keys(app.docs).length === 0) { + + if (Object.keys(app.docs).length === 0) { app.docs = documentation_factory(app); } - function _update_and_assign(callback: Function) { + function _update_and_assign(callback: Function) { const converted_markdown = converter.makeHtml( app.docs[app.currentDocumentationPane], ); - callback(converted_markdown) + callback(converted_markdown) } - _update_and_assign((e: string)=> { + _update_and_assign((e: string) => { let display_content = e === undefined ? loading_message : e; - document.getElementById("documentation-content")!.innerHTML = display_content; + document.getElementById("documentation-content")!.innerHTML = display_content; }) if (document.getElementById("documentation-content")!.innerHTML.replace(/"/g, "'") == loading_message.replace(/"/g, "'")) { setTimeout(() => { updateDocumentationContent(app, bindings); }, 100); } -} \ No newline at end of file +} diff --git a/src/documentation/learning/audio_engine/pitch.ts b/src/documentation/learning/audio_engine/pitch.ts new file mode 100644 index 0000000..881acbb --- /dev/null +++ b/src/documentation/learning/audio_engine/pitch.ts @@ -0,0 +1,28 @@ +import { type Editor } from "../../../main"; +import { makeExampleFactory } from "../../../Documentation"; + +export const pitch = (application: Editor): string => { + // @ts-ignore + const makeExample = makeExampleFactory(application); + return `# Pitch + + +## Pitch envelope + +Similar to the amplitude envelope, you can use an envelope to shape the pitch +of your sounds (can be samples or synthesizers). This is super useful to create +new timbres out of existing sounds. + +| Method | Alias | Description | +|---------|-------|-----------------------------------------------| +| pattack | patt | Attack time | +| pdecay | pdec | Decay time | +| psustain | psus | Sustain value | +| prelease | prel | Release time | +| penv | | Pitch envelope strength (positive or negative) | +| panchor | | Envelope anchor range (0 - 1) | + +Resume writing the pitch documentation here. + +`; +};