### Initialize and Play Synth Demo Source: https://www.charlie-roberts.com/gibberish/index.html Configures the worklet path and initializes the audio engine to run a synth, filter, reverb, and sequencer setup. ```javascript Gibberish.workletPath = './scripts/gibberish_worklet.js' Gibberish.init().then( ()=> { Gibberish.export( window ) beat = 22050 verb = Freeverb({ roomSize:.875, damping:.5 }).connect() bass = Synth({ Q:.85 }) .connect( verb ) .connect() bass.cutoff = Add( .45, Sine({ frequency:.125, gain:.4 }) ) bassSeq = Sequencer({ target:bass, key:'note', values:[55,110,165,220,273,330,385,440], timings:[beat / 4] }).start() kik = Kick().connect() kikseq = Sequencer.make( [.5], [beat], kik, 'trigger' ).start() }) ``` -------------------------------- ### AD Envelope Example Source: https://www.charlie-roberts.com/gibberish/docs/index.html The AD envelope provides exponential attack and decay stages. Trigger it to start the envelope and connect its output to modulate another unit. ```javascript a = Sine() b = AD() c = Mul( a,b ) Gibberish.output.inputs.push( c ) b.trigger() ``` -------------------------------- ### Filter12SVF Setup Source: https://www.charlie-roberts.com/gibberish/docs/index.html Implement a 12dB/octave resonant state-variable filter. The 'mode' property accepts numerical values, and the cutoff frequency can be dynamically controlled. ```javascript syn = Gibberish.instruments.Synth({ attack:44, decay:44100 * 4 }) filter = Gibberish.filters.Filter12SVF({ input:syn, mode:1, cutoff: Add( 550, Sine({ frequency:2, gain:330 }) ), Q: 10, }).connect() syn.note( 220 ) ``` -------------------------------- ### Generated Output Callback for SSD Source: https://www.charlie-roberts.com/gibberish/docs/index.html Represents the internal callback structure generated by the Gibberish engine for the provided SSD feedback example. ```javascript var v_34 = ssd_out_33( memory ) var v_36 = v_34 * 100 var v_37 = 440 + v_36 var v_38 = sine_38( v_37, 1, memory ) var v_20 = bus2_20( 0, v_38, memory ) var v_35 = ssd_in_33( v_38, memory ) return v_20 ``` -------------------------------- ### Filter12Biquad Setup Source: https://www.charlie-roberts.com/gibberish/docs/index.html Configure a 12dB/octave resonant biquad filter. Set the mode to 'LP' (lowpass), 'HP' (hipass), or 'BP' (bandpass) during initialization. The cutoff frequency can be modulated. ```javascript syn = Gibberish.instruments.Synth({ attack:44, decay:44100 * 4 }) filter = Gibberish.filters.Filter12Biquad({ input:syn, mode:'LP', cutoff: Add( 550, Sine({ frequency:2, gain:330 }) ), Q: 20, }).connect() syn.note( 220 ) ``` -------------------------------- ### Trigger a Note with Kick Instrument Source: https://www.charlie-roberts.com/gibberish/docs/index.html Use the `trigger` method to play a note at the last used frequency with a specified loudness. This example uses a Gibberish.Sequencer to trigger the kick at different loudness values over time. ```javascript kick = Gibberish.Kick({ frequency: 80 }).connect() Gibberish.Sequencer({ target:kick, key:'trigger', values:[ .1,.2,.3,.5], timings:[11025] }).start() ``` -------------------------------- ### Vibrato Effect Setup Source: https://www.charlie-roberts.com/gibberish/docs/index.html Use the Vibrato effect to modulate the pitch of an input signal over time. Connect a synth or other audio source to its input. ```javascript syn = Gibberish.instruments.Synth({ attack:44, decay:44100 * 10 }) vibrato = Gibberish.effects.Vibrato({ input:syn, frequency: 2, amount: .5, }).connect() syn.note( 330 ) ``` -------------------------------- ### Trigger a Chord with PolySynth Instrument Source: https://www.charlie-roberts.com/gibberish/docs/index.html Trigger a chord on a polyphonic instrument with a specified loudness. This example also demonstrates using a Gibberish.Sequencer to trigger the instrument with varying loudness values. ```javascript syn = Gibberish.PolySynth({ attack:44, decay:22050 }).connect() syn.chord([ 330,440,550 ]) Gibberish.Sequencer({ target:syn, key:'trigger', values:[ .1,.2,.3,.5], timings:[11025] }).start() ``` -------------------------------- ### Initialize and Sequence a Synth Source: https://www.charlie-roberts.com/gibberish/docs/index.html Creates a new Synth instance with specific filter and envelope settings, then sequences a note. ```javascript // run all at once syn = Gibberish.instruments.Synth({ waveform: 'saw', // or saw, sine, pwm etc. filterType: 3, // 303-style 'virtual analog' diode filter filterMult: 1760, Q: 9, attack:44, decay:11025, gain:.1 }).connect() Gibberish.Sequencer({ target:synth, key:'note', values:[ 110 ], timings:[ 22050 ] }).start() ``` -------------------------------- ### Constructor: Gibberish.instruments.Synth Source: https://www.charlie-roberts.com/gibberish/docs/index.html Initializes a new Synth instrument instance. ```APIDOC ## Constructor: Gibberish.instruments.Synth ### Description Creates a new Synth instance with configurable waveform, filter, and envelope parameters. ### Request Body - **waveform** (string) - Optional - Waveform type: 'sine', 'saw', 'square', 'pwm'. Default: 'sine'. - **filterType** (int) - Optional - Filter model: 0 (none), 1 (4-pole), 2 (Moog-style), 3 (303-style). Default: 1. - **filterMult** (float) - Optional - Modulation applied to cutoff frequency. Default: 440. - **Q** (float) - Optional - Filter resonance. Default: 8. - **attack** (int) - Optional - Attack duration in samples. Default: 44. - **decay** (int) - Optional - Decay duration in samples. Default: 22050. - **gain** (float) - Optional - Output gain scalar. Default: 1. ### Request Example { "waveform": "saw", "filterType": 3, "filterMult": 1760, "Q": 9, "attack": 44, "decay": 11025, "gain": 0.1 } ``` -------------------------------- ### Initialize Synth and Sequencer Source: https://www.charlie-roberts.com/gibberish/docs/index.html Creates a synthesizer instance and a sequencer to modulate its note property over time. ```javascript syn = Gibberish.instruments.Synth({ attack:44, decay:22050, antialias:true }).connect() seq = Gibberish.Sequencer({ target: syn, key: 'note', values: [440,880,1760], timings: [11025, 22050 ], }).start() ``` -------------------------------- ### Connect Unit Generators Source: https://www.charlie-roberts.com/gibberish/docs/index.html Demonstrates how to connect synthesizers to the master bus, custom buses, and effects using the ugen.connect method. ```javascript syn = Gibberish.Synth() syn.connect() // default connection to master bus syn2 = Gibberish.Synth() bus = Gibberish.Bus2() // stereo bus bus.connect() // connect to master bus syn2.connect( bus ) // connect to bus syn3 = Gibberish.Synth() syn3.connect( bus, .5 ) // scale output to bus // By default, effects accept a single input. However, we can easily // connect multiple instruments to an effect using a bus as that input. reverb = Gibberish.Freeverb({ input:Bus() }).connect() syn.connect( reverb.input, .25 ) syn2.connect( reverb.input, .25 ) syn3.connect( reverb.input, .25 ) ``` -------------------------------- ### Create a Feedback Loop with SSD Source: https://www.charlie-roberts.com/gibberish/docs/index.html Demonstrates using the SSD ugen to create a feedback loop by modulating a Sine oscillator's frequency with its own delayed output. ```javascript ssd = SSD() sin = Sine({ frequency: Add( 440, Mul( ssd.out, 100 ) ) }).connect() // sample our sine oscillator ssd.listen( sin ) ``` -------------------------------- ### Implement Envelope Following with Follow Source: https://www.charlie-roberts.com/gibberish/docs/index.html Tracks the output of a Karplus ugen to modulate the frequency of a Sine oscillator. ```javascript trackedUgen = Karplus({ gain:2 }).connect() Sequencer({ target:d, key:'note', values:[440,880], timings:[22050] }).start() tracker = Follow({ input: trackedUgen }) // modulate sine frequency based on tracked Karplus plucking Sine({ frequency:Add( 880, Mul( tracker,220 ) ) }).connect() ``` -------------------------------- ### Initialize and play PolyKarplus Source: https://www.charlie-roberts.com/gibberish/docs/index.html Instantiate a PolyKarplus instrument with a defined voice limit and trigger a chord. ```javascript a = PolyKarplus({ maxVoices:3 }).connect() a.chord([ 330,440,550 ]) ``` -------------------------------- ### FM Instrument Initialization Source: https://www.charlie-roberts.com/gibberish/docs/index.html Documentation for the FM instrument class and its configurable properties. ```APIDOC ## FM Instrument ### Description The `FM` unit generator provides two-operator FM synthesis with a choice of waveforms for both carrier and modulator, as well as a filter with selectable models. ### Properties - **cmRatio** (float) - Default: 2. Controls the relationship between carrier and modulator frequency. - **index** (float) - Default: 5. Controls the modulation index. - **feedback** (float) - Default: 0. Scales the amount of self-modulation for the modulator. - **antialias** (boolean) - Default: false. Enables higher quality anti-aliasing oscillators. - **panVoices** (boolean) - Default: false. Enables stereo panning. - **pan** (float) - Range: 0-1, Default: .5. Stereo position if panVoices is true. - **attack** (int) - Default: 44. Length of attack in samples. - **decay** (int) - Default: 22050. Length of decay in samples. - **sustain** (int) - Default: 44100. Length of sustain in samples. - **sustainLevel** (float) - Default: .6. Gain stage of sustain. - **release** (int) - Default: 22050. Length of release in samples. - **useADSR** (bool) - Default: false. Toggles between AD and ADSR envelopes. - **triggerRelease** (bool) - Default: false. If true, sustain lasts until release() is called. - **gain** (float) - Default: 1. Output gain scalar. - **carrierWaveform** (string) - Default: 'sine'. Options: 'sine', 'saw', 'square', 'pwm'. - **modulatorWaveform** (string) - Default: 'sine'. Options: 'sine', 'saw', 'square', 'pwm'. ### Request Example fm = Gibberish.instruments.FM({ modulatorWaveform:'square' }).connect() ``` -------------------------------- ### Instantiate and Play PolySynth Source: https://www.charlie-roberts.com/gibberish/docs/index.html Creates a PolySynth with a maximum of 3 voices and plays a chord. ```javascript a = PolySynth({ maxVoices:3 }).connect() a.chord([ 330,440,550 ]) ``` -------------------------------- ### Initialize Filter24Classic Source: https://www.charlie-roberts.com/gibberish/docs/index.html Sets up a Filter24Classic with a dynamic cutoff frequency controlled by a sine wave. Ensure Gibberish is imported and initialized before use. ```javascript syn = Gibberish.instruments.Synth({ attack:44, decay:44100 * 4 }) filter = Gibberish.filters.Filter24Classic({ input:syn, cutoff: Add( .2, Sine({ frequency:2, gain:.15 }) ), Q: 3.5, }).connect() syn.note( 220 ) ``` -------------------------------- ### Instantiate and Play PolyMono Chord Source: https://www.charlie-roberts.com/gibberish/docs/index.html Instantiate a PolyMono synth with a specified number of voices and play a chord. The PolyMono acts as a bus for its child voices. ```javascript a = PolyMono({ maxVoices:3 }).connect() a.chord([ 330,440,550 ]) ``` -------------------------------- ### Configure and sequence Monosynth Source: https://www.charlie-roberts.com/gibberish/docs/index.html Set up a three-oscillator Monosynth with specific filter settings and use a sequencer to trigger notes. ```javascript // run all at once mono = Gibberish.instruments.Monosynth({ waveform: 'saw', // or saw, sine, pwm etc. filterType: 2, // 4-pole "virtual analog" ladder filter filterMult: 1760, Q: 18, gain:.1 }).connect() Gibberish.Sequencer({ target:mono, key:'note', values:[ 110 ], timings:[ 44100 ] }).start() ``` -------------------------------- ### Initialize Filter24TB303 Source: https://www.charlie-roberts.com/gibberish/docs/index.html Instantiates a Filter24TB303, simulating the Roland TB-303 filter. The cutoff frequency is modulated by a sine wave. High Q values can lead to instability. ```javascript syn = Gibberish.instruments.Synth({ attack:44, decay:44100 * 4 }) filter = Gibberish.filters.Filter24TB303({ input:syn, cutoff: Gibberish.binops.Add( 440, Gibberish.oscillators.Sine({ frequency:2, gain:330 }) ), Q: 9.5, }).connect() syn.note( 220 ) ``` -------------------------------- ### Instrument Note and Trigger Methods Source: https://www.charlie-roberts.com/gibberish/docs/index.html Details on how to play notes with specific frequencies or trigger sounds with loudness for basic instruments. ```APIDOC ## instrument.note( frequency ) ### Description The `note` method assigns a new frequency to the instrument and re-triggers the instrument’s envelope. For some percussion instruments that use fixed frequencies (Cowbell, Snare, and Hat) this method will trigger the instrument’s envelope but the argument frequency will have no effect. ### Method POST ### Endpoint /instrument/note ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **frequency** (number) - Required - The frequency for the new note to be played. ### Request Example ```json { "frequency": 330 } ``` ### Response #### Success Response (200) - **status** (string) - Indicates success. #### Response Example ```json { "status": "Note played successfully" } ``` ## instrument.trigger( loudness ) ### Description Trigger a note at the last used frequency with the provided `loudness` as a scalar. ### Method POST ### Endpoint /instrument/trigger ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **loudness** (number) - Required - A scalar applied to the gain envelope of the new note. ### Request Example ```json { "loudness": 0.5 } ``` ### Response #### Success Response (200) - **status** (string) - Indicates success. #### Response Example ```json { "status": "Triggered successfully" } ``` ``` -------------------------------- ### SSD (Single-Sample Delay) Source: https://www.charlie-roberts.com/gibberish/docs/index.html The SSD ugen allows for feedback loops within the audio graph by reporting the sample recorded from the previous cycle. ```APIDOC ## SSD ### Description The single-sample delay is a special ugen that can be used to create feedback loops within the audio graph. It records a single sample of a ugen and reports it in the next cycle. ### Properties - **ssd.listen** (ugen) - Set the ugen to listen to. - **ssd.out** (ugen) - Read-only. The output of the single-sample delay. - **ssd.isStereo** (boolean) - Default: false. Determines if the SSD listens to a stereo or mono ugen. Can only be set on initialization. ``` -------------------------------- ### Initialize and Connect a Delay Effect Source: https://www.charlie-roberts.com/gibberish/docs/index.html Creates a delay effect instance connected to a synthesizer instrument. ```javascript syn = Gibberish.instruments.Synth({ attack:44 }) delay = Gibberish.effects.Delay({ input:synth, delayTime: 5512, feedback: .9 }).connect() syn.note( 220 ) ``` -------------------------------- ### Initialize and Sequence FM Instrument Source: https://www.charlie-roberts.com/gibberish/docs/index.html Creates an FM instrument instance and uses sequencers to dynamically modulate the carrier-to-modulator ratio, modulation index, and note frequency. ```javascript // run all at once fm = Gibberish.instruments.FM({ modulatorWaveform:'square', // or saw, sine etc. }).connect() Gibberish.Sequencer({ target:fm, key:'cmRatio', values:[ function() { return .15 + Math.random() * 10 } ], timings:[22050] }).start() Gibberish.Sequencer({ target:fm, key:'index', values:[ function() { return .5 + Math.random() * 20 } ], timings:[22050] }).start() Gibberish.Sequencer({ target:fm, key:'note', values:[ 440 ], timings:[ 44100 ] }).start() ``` -------------------------------- ### Bus and Bus2 Source: https://www.charlie-roberts.com/gibberish/docs/index.html Signal routing utilities for summing audio inputs. ```APIDOC ## Bus / Bus2 ### Description Bus instances sum mono inputs. Bus2 instances sum stereo and mono inputs into a single stereo signal. ### Methods - **disconnecUgen(ugen)** - Disconnects a specific ugen from the bus. ``` -------------------------------- ### Gibberish Core Methods Source: https://www.charlie-roberts.com/gibberish/docs/index.html Methods for managing the Gibberish audio session, including initialization, clearing, and exporting. ```APIDOC ## gibberish.clear ### Description Disconnects all ugens from the master bus and stops all sequencers from running. ## gibberish.init ### Description Creates an AudioContext and ScriptProcessor Node to start a Gibberish session. ### Parameters #### Request Body - **memorySize** (int) - Optional - Default: 44100. Determines the size of the memory block for all ugens. ## gibberish.print ### Description Prints the current master audio callback to the console. ## gibberish.export ### Description Exports the Gibberish namespace to a target object. ### Parameters #### Request Body - **target** (object) - Required - The object to export the Gibberish namespace to. - **shouldExportGenish** (boolean) - Optional - Default: false. Determines whether genish unit generators are also exported. ``` -------------------------------- ### Initialize PolyFM Instrument Source: https://www.charlie-roberts.com/gibberish/playground/index.html Initializes a PolyFM instrument with specific parameters for gain, carrier/modulator ratio, modulation index, waveforms, envelope settings, and feedback. Connects the instrument to the audio output. ```javascript bigfm = PolyFM({ gain:.15, cmRatio:1.01, index:1.2, carrierWaveform:'triangle', modulatorWaveform:'square', attack:44100 * 32, decay:44100 * 32, feedback:.1, }).connect() ``` -------------------------------- ### Instantiate and Play PolyFM Chord Source: https://www.charlie-roberts.com/gibberish/docs/index.html Instantiates a PolyFM synth with a maximum of 3 voices and plays a chord. The PolyFM object shares properties with FM objects, applying changes to all child voices. ```javascript a = PolyFM({ maxVoices:3 }).connect() a.chord([ 330,440,550 ]) ``` -------------------------------- ### Initialize Audio Effects Source: https://www.charlie-roberts.com/gibberish/playground/index.html Initializes a Freeverb effect with specified room size and damping, and a Chorus effect. The Freeverb is connected to the Chorus, and the Chorus is connected to the audio output. ```javascript verb = Freeverb({ roomSize:.95, damping:.15 }).connect() chorus = Chorus().connect( verb ) ``` -------------------------------- ### ugen Prototype Methods Source: https://www.charlie-roberts.com/gibberish/docs/index.html Methods for managing unit generators (ugens) including connection, disconnection, and memory management. ```APIDOC ## ugen.print ### Description Writes a unit generator's callback function to the console. ## ugen.free ### Description Frees the memory associated with a unit generator. ## ugen.connect ### Description Connects a unit generator to another ugen or the master bus. ### Parameters #### Request Body - **ugen** (object) - Optional - The destination unit generator. Defaults to master output bus. - **level** (float) - Optional - Default: 1. A scalar applied to the signal. ## ugen.disconnect ### Description Disconnects the unit generator from a specific destination or all destinations. ### Parameters #### Request Body - **ugen** (object) - Optional - The destination to disconnect from. If omitted, disconnects from all. ``` -------------------------------- ### Initialize and Connect a Freeverb Effect Source: https://www.charlie-roberts.com/gibberish/docs/index.html Applies a Schroeder-Moorer reverberation effect to a synthesizer instrument. ```javascript syn = Gibberish.instruments.Synth({ attack:44 }) verb = Gibberish.effects.Freeverb({ input:synth, roomSize:.95 }).connect() syn.note( 220 ) ``` -------------------------------- ### Load and Play Sampler Audio Source: https://www.charlie-roberts.com/gibberish/docs/index.html Load an audio file into a Sampler instrument and play it. The `onload` function is used to trigger playback after the audio file is ready. Samples can be played forwards or in reverse at variable speeds. ```javascript rhodes = Gibberish.instruments.Sampler({ filename:'http://127.0.0.1:25000/playground/resources/audiofiles/rhodes.wav' }).connect() rhodes.onload = function() { rhodes.note( -4 ) // play sample in reverse at 4x speed. } ``` -------------------------------- ### Initialize and Connect Plate Reverb Source: https://www.charlie-roberts.com/gibberish/docs/index.html Initializes a Plate reverb effect with a specified decay and connects it to the audio output. Use this to add reverberation to a synth. ```javascript syn = Gibberish.instruments.Synth({ attack:44 }) plate = Gibberish.effects.Plate({ input:synth, decay:.95 }).connect() syn.note( 220 ) ``` -------------------------------- ### Play and Modify Conga Instrument Source: https://www.charlie-roberts.com/gibberish/docs/index.html Initialize a Conga instrument, connect it, play a note, adjust its decay, and play another note. The `decay` property controls the length of the note's sound. ```javascript // run line by line conga = Gibberish.Conga().connect() conga.note( 440 ) conga.decay( .25 ) conga.note( 440 ) ``` -------------------------------- ### Initialize and Connect a Distortion Effect Source: https://www.charlie-roberts.com/gibberish/docs/index.html Applies non-linear hyperbolic tangent distortion to a Karplus instrument. ```javascript syn = Gibberish.instruments.Karplus({ attack:44 }) dist = Gibberish.effects.Distortion({ input:syn, pregain:100, postgain:.25, }).connect() syn.note( 440 ) ``` -------------------------------- ### Polyphonic Instrument Methods Source: https://www.charlie-roberts.com/gibberish/docs/index.html Methods for polyphonic instruments, allowing for playing chords, individual notes, and triggering sounds with loudness. ```APIDOC ## polyinstrument.chord( frequencies ) ### Description The `chord` method selects voices from the polyphonic instrument, assigns them new frequencies, and triggers their envelopes. The number of notes concurrently playable is determined by the instrument’s `maxVoices` property. Using the `chord` method with three frequencies is functionally identical to calling `note` three times simultaneously. ### Method POST ### Endpoint /polyinstrument/chord ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **frequencies** (array of numbers) - Required - The frequencies of the chord to be played. ### Request Example ```json { "frequencies": [330, 440, 550] } ``` ### Response #### Success Response (200) - **status** (string) - Indicates success. #### Response Example ```json { "status": "Chord played successfully" } ``` ## polyinstrument.note( frequency ) ### Description The `note` method selects a child voice from the polyphonic instrument, assigns it a new frequency, and triggers the instrument’s envelope. The number of notes concurrently playable is determined by the instruments `maxVoices` property. ### Method POST ### Endpoint /polyinstrument/note ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **frequency** (number) - Required - The frequency for the new note to be played. ### Request Example ```json { "frequency": 330 } ``` ### Response #### Success Response (200) - **status** (string) - Indicates success. #### Response Example ```json { "status": "Note played successfully" } ``` ## polyinstrument.trigger( loudness ) ### Description Trigger a note or chord at the last used frequency(ies) with the provided `loudness` as a scalar. ### Method POST ### Endpoint /polyinstrument/trigger ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **loudness** (number) - Required - A scalar applied to the gain envelope of the new note. ### Request Example ```json { "loudness": 0.5 } ``` ### Response #### Success Response (200) - **status** (string) - Indicates success. #### Response Example ```json { "status": "Triggered successfully" } ``` ``` -------------------------------- ### Initialize and Connect RingModulator Source: https://www.charlie-roberts.com/gibberish/docs/index.html Initializes a RingMod effect with specified frequency, gain, and mix, then connects it. This effect creates robotic or sci-fi sounds by multiplying the input with a sine wave. ```javascript syn = Gibberish.instruments.Synth({ attack:44 }) ringmod = Gibberish.effects.RingMod({ input:syn, frequency: 223, gain: .5, mix: .75 }).connect() syn.note( 466 ) ``` -------------------------------- ### Initialize and Connect Tremolo Effect Source: https://www.charlie-roberts.com/gibberish/docs/index.html Initializes a Tremolo effect with a specified frequency, amount, and shape, then connects it. This effect modulates the amplitude of the input signal over time. ```javascript syn = Gibberish.instruments.Synth({ attack:44, decay:44100 * 10 }) tremolo = Gibberish.effects.Tremolo({ input:syn, frequency: 8, amount:1, shape:'square', }).connect() syn.note( 330 ) ``` -------------------------------- ### Instantiate and Trigger Snare Source: https://www.charlie-roberts.com/gibberish/docs/index.html Instantiate a Snare instrument, connect it, and trigger it with specified decay and tuning. The snare emulates the Roland TR-808 sound. ```javascript // run line by line snare = Gibberish.instruments.Snare().connect() snare.trigger( .5 ) snare.decay( .25 ) snare.tune = -.25 snare.trigger( .5 ) ``` -------------------------------- ### Scheduler Source: https://www.charlie-roberts.com/gibberish/docs/index.html Singleton object handling events from Sequencer objects via a priority queue. ```APIDOC ## Scheduler ### Methods - **scheduler.add(time, func, priority)** - **time** (int) - Required. Offset in samples. - **func** (function) - Required. Function to execute. - **priority** (int) - Optional. Default: 0. - **scheduler.clear()** - Removes all items from the queue. - **scheduler.tick()** - Called once per sample to check events. ### Properties - **phase** (int) - Internal phase incremented per sample. - **queue** (object) - The priority queue. ``` -------------------------------- ### Initialize Filter24Moog Source: https://www.charlie-roberts.com/gibberish/docs/index.html Creates a Filter24Moog instance with a cutoff frequency modulated by a sine wave. This filter is a lowpass type. ```javascript syn = Gibberish.instruments.Synth({ attack:44, decay:44100 * 4 }) filter = Gibberish.filters.Filter24Moog({ input:syn, cutoff: Gibberish.binops.Add( 440, Gibberish.oscillators.Sine({ frequency:2, gain:330 }) ), Q: 18.5, }).connect() syn.note( 220 ) ``` -------------------------------- ### Initialize and Connect a Flanger Effect Source: https://www.charlie-roberts.com/gibberish/docs/index.html Creates a modulated delay line effect for a synthesizer instrument. ```javascript syn = Gibberish.instruments.Synth({ attack:44 }) delay = Gibberish.effects.Flanger({ input:synth, delayTime: 5512, feedback: .9 }).connect() syn.note( 220 ) ``` -------------------------------- ### Conga Instrument Properties Source: https://www.charlie-roberts.com/gibberish/docs/index.html Configuration properties for the Conga instrument. ```APIDOC ## Conga Instrument ### Description The `Conga` unit generator emulates the conga sound found on the Roland TR-808 drum machine. It consists of an impulse feeding a resonant filter scaled by an exponential decay. ### Properties #### conga.decay - **Type**: float - **Range**: 0-1 - **Default**: .85 - **Description**: This value controls the decay length of each note. #### conga.gain - **Type**: float - **Default**: .25 - **Description**: This value controls the loudness of each note. ``` -------------------------------- ### Control Kick drum parameters Source: https://www.charlie-roberts.com/gibberish/docs/index.html Emulate an 808-style kick drum by adjusting decay and triggering notes. ```javascript // run line by line kick = Gibberish.instruments.Conga().connect() kick.note( 90 ) kick.decay( .25 ) kick.note( 90 ) ``` -------------------------------- ### Arithmetic Operations Source: https://www.charlie-roberts.com/gibberish/docs/index.html Provides documentation for basic arithmetic operations available in Gibberish, including absolute value, addition, subtraction, multiplication, and division. ```APIDOC ## Arithmetic ### Abs **a** _ugen_ or _number_ Ugen or number. Outputs the absolute value of input `a`. ### Add **args** _ugens_ or _numbers_ Add two ugens (or numbers) together and output the results. ``` mono = Gibberish.Monosynth({ filterType:2 }).connect() // modulate filter cutoff frequency between 220-660 Hz mono.cutoff = Gibberish.Add( 440, Gibberish.Sine({ frequency:.25, gain:220 }) ) mono.note( 440 ) ``` ### Sub **a,b** _ugens_ or _numbers_ Subtract the output of unit generator `b` (or number `b`) from `a` and output the result. ``` mono = Gibberish.Monosynth({ filterType:2 }).connect() // modulate filter cutoff frequency between 220-660 Hz mono.cutoff = Gibberish.Sub( 440, Gibberish.Sine({ frequency:.5, gain:220 }) ) mono.note( 440 ) ``` ### Mul **a,b** _ugen_ or _number_ Multiples the output of `a` and `b` and returns the results. ``` syn1 = Gibberish.Synth() syn2 = Gibberish.Synth() mul = Gibberish.Mul( syn1, syn2 ) // binops don't have a `connect()` method, so we manually push // to the inputs of the master output. Gibberish.output.inputs.push( mul ) syn1.note(240) syn2.note(775) ``` ### Div **a,b** _ugen_ or _number_ Divides the output of `a` by `b` and returns the results. ``` -------------------------------- ### Sampler Instrument Source: https://www.charlie-roberts.com/gibberish/docs/index.html Instrument for loading and playing external audio files with variable playback control. ```APIDOC ## Sampler ### Properties - **filename** (string) - Required - URL to audio file. - **loops** (boolean) - Optional - Default false. Repeat playback. - **gain** (float) - Optional - Default .25. Loudness. - **start** (int) - Optional - Default 0. Start offset. - **end** (int) - Optional - Default sample.length. End offset. ### Request Example ```javascript rhodes = Gibberish.instruments.Sampler({ filename:'http://127.0.0.1:25000/playground/resources/audiofiles/rhodes.wav' }).connect() ``` ``` -------------------------------- ### Synth Properties Source: https://www.charlie-roberts.com/gibberish/docs/index.html Configuration properties for controlling the Synth instrument behavior. ```APIDOC ## Synth Properties ### Parameters - **antialias** (boolean) - Optional - Enable high-quality anti-aliasing. Default: false. - **sustain** (int) - Optional - Sustain duration in samples. Default: 44100. - **sustainLevel** (float) - Optional - Gain stage of sustain portion. Default: 0.6. - **release** (int) - Optional - Release duration in samples. Default: 22050. - **useADSR** (bool) - Optional - Toggle between AD and ADSR envelope. Default: false. - **triggerRelease** (bool) - Optional - If true, sustain continues until release() is called. Default: false. - **panVoices** (boolean) - Optional - Enable stereo panning. Default: false. - **pan** (float) - Optional - Stereo position (0-1). Default: 0.5. - **filterMode** (int) - Optional - Filter mode: 0 (low pass), 1 (high pass), 2 (bandpass), 3 (notch). Default: 0. - **cutoff** (float) - Optional - Filter cutoff frequency. Default: 440. ``` -------------------------------- ### Karplus Source: https://www.charlie-roberts.com/gibberish/docs/index.html The Karplus unit generator uses the Karplus-Strong physical model to create a plucked string sound. ```APIDOC ## Karplus ### Description The `Karplus` unit generator uses the Karplus-Strong physical model to create a plucked string sound. ### Properties #### karplus.decay _float_ default: .5 This value controls the decay length of each note, measured in seconds. #### karplus.damping _float_ range: 0-1, default: .2. The amount of damping on the string. #### karplus.gain _float_ range:0-1, default:1. The loudness of notes #### karplus.glide _int_ range:1-?, default:1. A portamento affect applied to frequency. Increasing this will cause notes to slide into each other, as opposed to using discrete frequencies. #### karplus.panVoices _boolean_ default: false. If true, the synth will expose a pan property for stereo panning; otherwise, the synth is mono. #### karplus.pan _float_ range: 0-1, default: .5. If the `panVoices` property of the synth is `true`, this property will determine the position of the synth in the stereo spectrum. `0` = left, `.5` = center, `1` = right. ### Request Example ```javascript // run line by line pluck = Gibberish.Karplus().connect() pluck.note( 440 ) pluck.decay = 4 // seconds pluck.note( 440 ) ``` ``` -------------------------------- ### Apply BufferShuffler Effect Source: https://www.charlie-roberts.com/gibberish/docs/index.html Uses a sequencer to trigger notes on a Synth while applying a BufferShuffler for granular effects. ```javascript syn = Gibberish.instruments.Synth({ attack:44, decay:1152 }).connect() seq = Sequencer.make( [220,330,440,550], [5512], syn, 'note' ).start() shuffle = Gibberish.fx.Shuffler({ input:syn, rate:22050, reverseChance:.5, mix:1 }).connect() ``` -------------------------------- ### Sequencer Source: https://www.charlie-roberts.com/gibberish/docs/index.html Sequences calls to methods, property changes, and anonymous functions. ```APIDOC ## Sequencer ### Methods - **sequencer.start(delay)** - **delay** (float) - Optional. Default: 0. Delay in samples. - **sequencer.stop()** - Stops the sequencer. ### Properties - **key** (string) - Property or method name on target to control. - **priority** (int) - Default: 0. Execution order for same-sample events. - **target** (object) - The object to be controlled. ``` -------------------------------- ### Connect Instrument to Effects Source: https://www.charlie-roberts.com/gibberish/playground/index.html Connects the initialized PolyFM instrument to the audio effects chain (Chorus and Freeverb). ```javascript bigfm.connect( chorus ) ``` -------------------------------- ### Analysis: Follow Source: https://www.charlie-roberts.com/gibberish/docs/index.html An envelope follower component used to track the amplitude of a unit generator. ```APIDOC ## Follow ### Description A prototype for an envelope follower that tracks the output of a ugen. ### Properties - **follow.input** (ugen) - Required - The unit generator that will be tracked. - **follow.bufferSize** (number) - Optional - Default: 8192. The length of the buffer over which averaging occurs. Set on initialization only. ### Request Example ```javascript tracker = Follow({ input: trackedUgen }); ``` ``` -------------------------------- ### Play a Chord Source: https://www.charlie-roberts.com/gibberish/playground/index.html Plays a chord with the specified frequencies using the connected PolyFM instrument and audio effects. ```javascript bigfm.chord( [110,220,330,440] ) ``` -------------------------------- ### Play a Chord with PolyFM Instrument Source: https://www.charlie-roberts.com/gibberish/docs/index.html The `chord` method plays multiple frequencies simultaneously on a polyphonic instrument. The number of concurrent notes is limited by the instrument's `maxVoices` property. ```javascript fm = Gibberish.PolyFM({ maxVoices:3, decay: 88200 * 2 }).connect() fm.chord([ 330,440,550 ]) ``` -------------------------------- ### Play Multiple Notes with PolyFM Instrument Source: https://www.charlie-roberts.com/gibberish/docs/index.html Use the `note` method to play individual notes on a polyphonic instrument. Each call to `note` will trigger a new voice up to the `maxVoices` limit. ```javascript fm = Gibberish.PolyFM({ maxVoices:3, decay: 88200 * 2 }).connect() fm.note( 330 ) fm.note( 440 ) fm.note( 550 ) ``` -------------------------------- ### Play a Note with FM Instrument Source: https://www.charlie-roberts.com/gibberish/docs/index.html Use the `note` method to assign a frequency to an FM instrument and re-trigger its envelope. For fixed-frequency percussion, the frequency argument has no effect. ```javascript fm = Gibberish.FM().connect() fm.note( 330 ) ``` -------------------------------- ### Freeverb Effect Properties Source: https://www.charlie-roberts.com/gibberish/docs/index.html Configuration properties for the Freeverb reverberation algorithm. ```APIDOC ## Freeverb Properties ### Parameters - **freeverb.roomSize** (float) - 0-1, default: .84. Controls overall reverberation time via comb filter feedback. - **freeverb.damping** (float) - 0-1, default: .5. Attenuates high-frequency signals. - **freeverb.dry** (float) - 0-1, default: .5. Amount of non-reverberated signal. - **freeverb.wet1** (float) - 0-1, default: 1. Reverberated signal for left output. - **freeverb.wet2** (float) - 0-1, default: 0. Reverberated signal for right output. - **freeverb.drywet** (float) - 0-1, default: .5. Controls balance between wet and dry signals. ``` -------------------------------- ### Oscillators Source: https://www.charlie-roberts.com/gibberish/docs/index.html Documentation for various oscillator types including Noise, PWM, Saw, ReverseSaw, and Sine. ```APIDOC ## Noise ### Properties - **noise.color** (string) - Default: 'white'. Determines type (white, brown, pink). Set on initialization. - **noise.gain** (number/ugen) - Default: 1. Adjusts output range. ## PWM ### Properties - **pwm.frequency** (number/ugen) - Default: 440. Frequency in Hz. - **pwm.gain** (number/ugen) - Default: 1. Adjusts output range. - **pwm.antialias** (boolean) - Default: false. If true, uses band-limited algorithm. Set on initialization. - **pwm.pulsewidth** (float) - Default: .35. Modulates harmonic content. ## Saw / ReverseSaw ### Properties - **saw.frequency** (number/ugen) - Default: 440. Frequency in Hz. - **saw.gain** (number/ugen) - Default: 1. Adjusts output range. - **saw.antialias** (boolean) - Default: false. If true, uses band-limited algorithm. Set on initialization. ## Sine ### Properties - **sine.frequency** (number/ugen) - Default: 440. Frequency in Hz. ``` -------------------------------- ### Plate Effect API Source: https://www.charlie-roberts.com/gibberish/docs/index.html Documentation for the Plate reverberation effect based on the Dattorro model. ```APIDOC ## Plate Effect ### Description Based on the Dattorro model of plate reverberation, providing control over decay, damping, and diffusion. ### Parameters - **plate.input** (ugen) - The unit generator feeding the effect. - **plate.decay** (float) - 0-1, default: .5. Overall reverberation time. - **plate.damping** (float) - 0-1, default: .5. High-frequency attenuation. - **plate.predelay** (float) - 0-100, default: 10. Time between input and processed output. - **plate.indiffusion1** (float) - 0-1, default: .75. Feedback for first two all-pass filters. - **plate.indiffusion2** (float) - 0-1, default: .625. Feedback for last two all-pass filters. - **plate.decaydiffusion1** (float) - 0-1, default: .7. Diffusion timing in tank emulation. - **plate.decaydiffusion2** (float) - 0-1, default: .5. Diffusion timing in tank emulation. ``` -------------------------------- ### Apply Chorus and Reverb Effects Source: https://www.charlie-roberts.com/gibberish/docs/index.html Chains a PolySynth through a Chorus effect and a Freeverb effect, controlled by a sequencer. ```javascript syn = PolySynth({ waveform:'square', attack:44100 / 2, decay:88200 * 1.5, antialias:true, gain:.25 }) chorus = Chorus({ input: syn, slowGain:2 }).connect() verb = Freeverb({ input: chorus, roomSize: .9, damping:.5 }).connect() baseChord = [55,110,220,330,440,520] seq = Sequencer.make( [ baseChord, baseChord.map( v=> v * 1.2 ), baseChord.map( v=> v * .8 ), baseChord.map( v=> v * .95 ) ], [88200 * 2], syn, 'chord' ).start() kick = Kick().connect() kickseq = Sequencer.make( [110], [22050], kick, 'note' ).start() ``` -------------------------------- ### Hat Source: https://www.charlie-roberts.com/gibberish/docs/index.html The Hat unit generator emulates the hihat sound of the Roland TR-808. It uses six tuned square waves feeding bandpass and highpass filters. ```APIDOC ## Hat ### Description The `Hat` unit generator emulates the hihat sound found on the Roland TR-808 drum machine. It consists of six tuned square waves feeding bandpass and highpass filters scaled by an exponential decay. ### Properties #### hat.decay _float_ range: 0-1, default: .5 This value controls the decay length of each note. 0 represents a decay of 0 samples (and thus no sound, don’t do this) while a value of 1 represents two seconds. #### hat.gain _float_ default: .25 This value controls the loudness of each note. #### hat.tune _float_ range:0-1, default: .5. This value controls both the frequencies of the squarewave oscillators used in the synth and the cutoff frequencies of its filters. ### Request Example ```javascript // run line by line hat = Gibberish.Hat().connect() hat.trigger( .5 ) hat.decay = .25 hat.trigger( .5 ) hat.tune = .75 hat.trigger( .5 ) hat.decay = .8 hat.tune = .25 hat.trigger( .5 ) ``` ``` -------------------------------- ### Cowbell Instrument Properties Source: https://www.charlie-roberts.com/gibberish/docs/index.html Configuration properties for the Cowbell instrument. ```APIDOC ## Cowbell Instrument ### Description The `Cowbell` unit generator emulates the cowbell sound found on the Roland TR-808 drum machine. It consists of an two tuned square waves feeding a resonant bandpass filter scaled by an exponential decay. ### Properties #### cowbell.decay - **Type**: float - **Range**: 0-1 - **Default**: .5 - **Description**: This value controls the decay length of each note. 0 represents a decay of 0 samples (and thus no sound, don’t do this) while a value of 1 represents two seconds. #### cowbell.gain - **Type**: float - **Default**: .25 - **Description**: This value controls the loudness of each note. ```