Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ It allows you to:
>
> Looking for a bare JS version that works without WebAudioAPI? Try [spessasynth_core](https://github.com/spessasus/spessasynth_core)!

### v4.3.0 The General Update is here!

Featuring robust MIDI analysis and editing, broadened MIDI exclusive support,
and reworked, more powerful API!

### [Project site (consider giving it a star!)](https://github.com/spessasus/spessasynth_lib)

### Made with spessasynth_lib
Expand Down
7 changes: 6 additions & 1 deletion docs/getting-started/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,14 @@ So:
## Installation

```shell
npm install --save spessasynth_lib
npm install --save spessasynth_core spessasynth_lib
```

!!! Warning

Consider installing `spessasynth_core` as shown above,
as it provides essential types for many of the API functions.

## Minimal setup

The minimal working setup requires [`WorkletSynthesizer` class](../synthesizer/basic-synthesizer.md) and [adding the worklet module](../synthesizer/importing-the-worklet.md).
Expand Down
5 changes: 3 additions & 2 deletions docs/sequencer/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ The data of the current sequence.
A [`BasicMIDI`](https://spessasus.github.io/spessasynth_core/midi/) (the song data).
Undefined if the data is currently loading or if no song is playing.

Note that the `embeddedSoundBank` property and `events` in the tracks are both empty for performance reasons.
The `embeddedSoundBank` and `timeline` properties
and `events` in the tracks are all empty to avoid copying the entire file between threads.

!!! Tip

Expand Down Expand Up @@ -85,7 +86,7 @@ The current tempo of the sequence, in BPM.

Length of the current track in seconds.

### songsAmount
### songCount

The number of songs in the playlist.

Expand Down
184 changes: 23 additions & 161 deletions docs/synthesizer/basic-synthesizer.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Below is the `SynthConfig` configuration object that can be passed to both synth
Indicates if the [one output mode](#one-output-mode) should be enabled.
A boolean.

### enableEventSystem
### eventsEnabled

If the event system should be enabled. This can only be set once.

Expand Down Expand Up @@ -51,7 +51,7 @@ An example function that creates the standard worklet node looks like this:

The synthesizer internally sends commands to the `SynthesizerCore` where all the processing happens. (This can be a worklet or a worker depending on your synthesizer of choice.)
Keep that in mind as not all methods will immediately report values!
(E.g. `noteOn` won't instantly increase the voice count in `channelProperties`)
(E.g. `noteOn` won't instantly increase the voice count in `midiChannels`)

## Properties

Expand All @@ -71,9 +71,11 @@ The synthesizer's [event handler](synth-event-handler.md).

The synthesizer's `BaseAudioContext` instance.

### channelProperties
### midiChannels

The current [channel properties](https://spessasus.github.io/spessasynth_core/spessa-synth-processor/event-types/#tchannelpropertychange) of all channels, an array.
The synthesizer's (virtual) [MIDI channels](midi-channel.md).

An array of [`LibMIDIChannel`](midi-channel.md)

### presetList

Expand All @@ -94,11 +96,11 @@ A promise that gets resolved when the synthesizer gets fully initialized.

Remember to wait for this promise before playing anything or rendering audio!

### channelsAmount
### channelCount

The current amount of MIDI channels the synthesizer has.

### voicesAmount
### voiceCount

The current amount of voices (notes) being synthesized. A real-time value.

Expand Down Expand Up @@ -140,30 +142,12 @@ synth.setLogLevel(enableInfo, enableWarning, enableGroup);
synth.setLogLevel(true, true, true);
```

### getMasterParameter

Gets a [master parameter](https://spessasus.github.io/spessasynth_core/spessa-synth-processor/master-parameter/).

```js
synth.getMasterParameter(type);
```

- type - the type to get.
### setSystemParameter

The returned value depends on the type.
**Example:**
Sets a [Global System Parameter](https://spessasus.github.io/spessasynth_core/spessa-synth-processor/global-parameters#system) to a given value.

```js
// Get the current MIDI system
console.log(synth.getMasterParameter("midiSystem"));
```

### setMasterParameter

Sets a [master parameter](https://spessasus.github.io/spessasynth_core/spessa-synth-processor/master-parameter/) to a given value.

```js
synth.setMasterParameter(type, value);
synth.setSystemParameter(type, value);
```

- type - the type to set.
Expand All @@ -173,7 +157,7 @@ synth.setMasterParameter(type, value);

```js
// Set the master gain to 200%
synth.setMasterParameter("masterGain", 2);
synth.setSystemParameter("gain", 2);
```

### getSnapshot
Expand All @@ -186,14 +170,9 @@ The returned value is a `SynthesizerSnapshot` instance - the snapshot of the syn

This method is *asynchronous.*

!!! Warning

The `LibSynthesizerSnapshot` interface is now identical to `SynthesizerSnapshot`
from `spessasynth_core`, and therefore deprecated!

### addNewChannel

Add a new MIDI channel. Invokes a `newChannel` event.
Adds a new channel to the synthesizer.

### connectChannel

Expand Down Expand Up @@ -349,18 +328,13 @@ synth.stopAll((force = false));
Set a given MIDI controller to a given value.

```js
synth.controllerChange(
channel,
controllerNumber,
controllerValue,
eventOptions
);
synth.controllerChange(channel, controller, controllerValue, eventOptions);
```

- channel - the MIDI channel to use. It usually ranges from 0 to 15, but it depends on the channel count.
- controllerNumber - the MIDI CC number of the controller to change.
- controller - the MIDI CC number of the controller to change.
Refer
to [this table](https://spessasus.github.io/spessasynth_core/extra/midi-implementation/#supported-system-exclusives#default-supported-controllers) for the list of controllers
to [this table](https://spessasus.github.io/spessasynth_core/extra/midi-implementation#default-supported-controllers) for the list of controllers
supported by default.
- controllerValue - the value to set the given controller to. Ranges from 0 to 127.
- eventOptions - refer to [event options](#event-options). It can be undefined.
Expand All @@ -376,20 +350,20 @@ synth.controllerChange(2, 10, 127);

Note that theoretically all controllers are supported as it depends on the sound bank's modulators.

### resetControllers
### reset

Reset all controllers to their default values. (for every channel)
Fully resets the synthesizer.

### lockController

Cause the given midi channel to ignore controller messages for the given controller number.

```js
synth.lockController(channel, controllerNumber, isLocked);
synth.lockController(channel, controller, isLocked);
```

- channel - the channel to lock. It usually ranges from 0 to 15, but it depends on the channel count.
- controllerNumber - the MIDI CC to lock. Ranges from 0 to 146. See the tip below to see why.
- controller - the MIDI CC to lock. Ranges from 0 to 127.
- isLocked - boolean, if true then locked, if false then unlocked.

**Example:**
Expand All @@ -400,11 +374,6 @@ synth.controllerChange(0, 65, 0); // portamento on/off set to off
synth.lockController(0, 65, true); // lock portamento on/off
```

!!! Tip

To lock other modulator sources add 128 to the Source Enumerator [(Soundfont 2.04 Specification section 8.2.1)](https://www.synthfont.com/sfspec24.pdf#%5B%7B%22num%22%3A317%2C%22gen%22%3A0%7D%2C%7B%22name%22%3A%22XYZ%22%7D%2C0%2C532%2Cnull%5D)
For example to lock pitch wheel, use `synth.lockController(channel, 142, true)`. (128 + 14 = 142)

### channelPressure

Apply pressure to the given channel. It usually controls the vibrato amount.
Expand Down Expand Up @@ -508,51 +477,6 @@ synth.programChange(channel, programNumber, eventOptions);
synth.programChange(0, 16);
```

### transposeChannel

Transposes the channel by given number of semitones. Floating point values can be used for microtonal tuning.

```js
synth.transposeChannel(channel, semitones, (force = false));
```

- channel - the MIDI channel to change. It usually ranges from 0 to 15, but it depends on the channel count.
- semitones - number - the number of semitones to transpose the channel by.
It can be positive or negative or zero.
Zero resets the pitch.
- force - defaults to false, if true transposes the channel even if it's a drum channel.

**Example:**

```js
// transpose channel 1 up by 125 cents
synth.transposeChannel(0, 1.25);
```

### muteChannel

Mute or unmute a given channel.

```js
synth.muteChannel(channel, isMuted);
```

- channel - number - the MIDI channel to change. It usually ranges from 0 to 15, but it depends on the channel count.
- isMuted - boolean - if the channel should be muted.

**Example:**

```js
// set solo on channel 4
for (const i = 0; i < synth.channelsAmount; i++) {
if (i === 3) {
synth.muteChannel(i, false);
} else {
synth.muteChannel(i, true);
}
}
```

### systemExclusive

Handle a MIDI System Exclusive message.
Expand All @@ -569,7 +493,9 @@ synth.systemExclusive(data, (channelOffset = 0), eventOptions);

!!! Tip

Refer to [MIDI Implementation](https://spessasus.github.io/spessasynth_core/extra/midi-implementation/#supported-system-exclusives) for the list of supported System Exclusives.
Refer to the
[MIDI Implementation](../extra/midi-implementation.md#system-exclusives)
for the list of supported System Exclusives.

**Example:**

Expand Down Expand Up @@ -613,76 +539,12 @@ synth.tuneKeys(81, [
]);
```

### setDrums

Toggles drums on a given channel.

```js
synth.setDrums(channel, isDrum);
```

- channel - the channel number.
- isDrum - if the channel should be drums.

**Example:**

```js
// set channel 11 to drums
synth.setDrums(10, true);
```

### reverbateEverythingBecauseWhyNot

Yes please!

Cranks the reverb up to the max and returns a string that says: `That's the spirit!`

## Deprecated methods and parameters

!!! Warning

These are deprecated and may be removed without further notice!

### setVibrato

Sets custom vibrato for the channel. _Deprecated, does nothing!_

```js
synth.setVibrato(channel, value);
```

- channel - the MIDI channel to use. It usually ranges from 0 to 15, but it depends on the channel count.
- value - the vibrato value. Three properties:
- delay - in seconds.
- depth - in cents.
- rate - in Hertz.

**Example:**

```js
synth.setVibrato(0, {
rate: 7.6,
depth: 19.7,
delay: 1.5
});
```

### disableGSNRParams

Deprecated, please use master parameters.
Disables GS NRPN (Non-Registered Parameter Number) messages from being recognized.
Currently, the custom vibrato and Time-Variant Filter.

### reverbProcessor

Will be undefined!
If the reverb processor was enabled in the configuration, it will be here, otherwise undefined.

### chorusProcessor

Will be undefined!
If the chorus processor was enabled in the configuration, it will be here, otherwise undefined.

## One output mode

This is a special synth mode, which causes the synth to have one output instead of 18, but 32 channels.
Expand Down
2 changes: 1 addition & 1 deletion docs/synthesizer/key-modifier-manager.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Synthesizer Key Modifier Manager
# Synthesizer Key Modifier Manager

This powerful tool allows modifying each key on each channel to your needs.

Expand Down
Loading