@audiotool/nexus - v0.0.17
    Preparing search index...

    Type Alias PresetsAPI

    A wrapper for the presets API that's more convenient to use than the raw presets API.

    To get a preset id, right-click the preset in the preset browser in the DAW and select "Copy Preset ID":

    const gakkiPreset = await client.presets.get("presets/e7cbee0e-1499-4356-a3e5-f788e58ef910")
    await nexus.modify((t) => {
    t.createDeviceFromPreset(gakkiPreset)
    })
    const frenchHorn = await client.presets.getInstrument("french-horn")
    const jazzKit = await client.presets.getDrums(32)

    gmInstruments and gmDrums expose the full GM catalog synchronously, so pickers can render without a network round-trip:

    for (const instrument of client.presets.gmInstruments) {
    renderRow(instrument.displayName, instrument.category, instrument.tags)
    }
    // when the user picks one:
    const preset = await client.presets.getInstrument(pickedInstrument)

    See API for more information.

    type PresetsAPI = {
        get: (nameOrId: string) => Promise<NexusPreset>;
        getDrums: (
            drum: GmDrumSlug | GmDrumProgram | GmDrum,
        ) => Promise<NexusPreset<"gakki">>;
        getInstrument: (
            instrument: GmInstrumentSlug | GmInstrumentProgram | GmInstrument,
        ) => Promise<NexusPreset<"gakki">>;
        gmDrums: readonly GmDrum[];
        gmInstruments: readonly GmInstrument[];
        search: <T extends DevicePresetEntityType>(
            deviceType: T,
            textSearch?: string,
        ) => Promise<NexusPreset<T>[]>;
    }
    Index

    Properties

    get: (nameOrId: string) => Promise<NexusPreset>

    Retrieves a specific preset by its name or id. Pass in a uuid or presets/{uuid}.

    Type declaration

      • (nameOrId: string): Promise<NexusPreset>
      • Parameters

        • nameOrId: string

          The identifier of the preset, either an uuid or presets/{uuid}

        Returns Promise<NexusPreset>

        Promise resolving to the requested preset

    getDrums: (
        drum: GmDrumSlug | GmDrumProgram | GmDrum,
    ) => Promise<NexusPreset<"gakki">>

    Look up one of the 8 General MIDI drum kits on the gakki sampler.

    GM reserves channel 10 for percussion. Unlike melodic instruments, drum kits are identified by a sparse program number: 0, 8, 16, 24, 25, 32, 40, 48 (Standard, Room, Power, Electronic, Analog, Jazz, Brush, Orchestra respectively). Other numbers don't exist on the gakki sampler.

    Accepts a slug, a program number, or one of the GmDrum catalog entries exposed via PresetsAPI.gmDrums.

    const jazzKit = await client.presets.getDrums("jazz-kit")
    const sameKit = await client.presets.getDrums(32)
    getInstrument: (
        instrument: GmInstrumentSlug | GmInstrumentProgram | GmInstrument,
    ) => Promise<NexusPreset<"gakki">>

    Look up one of the 128 General MIDI melodic instrument presets on the gakki sampler. The GM program number is 0-indexed per the MIDI 1.0 spec (hardware commonly displays these as 1-128). Slugs mirror the DAW's preset display names.

    Accepts a slug, a program number, or one of the GmInstrument catalog entries exposed via PresetsAPI.gmInstruments -- the latter is handy when building a preset picker from the metadata array.

    const frenchHorn = await client.presets.getInstrument("french-horn")
    const sameThing = await client.presets.getInstrument(60)
    const fromMeta = await client.presets.getInstrument(
    client.presets.gmInstruments[60],
    )
    gmDrums: readonly GmDrum[]

    Static catalog of all 8 General MIDI drum kits, sorted by GM program number. Available synchronously without a network round-trip.

    gmInstruments: readonly GmInstrument[]

    Static catalog of all 128 General MIDI melodic presets (display name, category, tags, description, preset id) sorted by GM program number. Available synchronously without a network round-trip -- intended for populating preset pickers and search UIs.

    search: <T extends DevicePresetEntityType>(
        deviceType: T,
        textSearch?: string,
    ) => Promise<NexusPreset<T>[]>

    Search presets by device type, optionally filtering by a free-text query.

    Type declaration

      • <T extends DevicePresetEntityType>(
            deviceType: T,
            textSearch?: string,
        ): Promise<NexusPreset<T>[]>
      • Type Parameters

        Parameters

        • deviceType: T

          The entity type of the device for which to search presets

        • OptionaltextSearch: string

          Optional text to filter presets by name or description

        Returns Promise<NexusPreset<T>[]>

        Promise resolving to an array of matching presets