Playfield

interface Playfield extends Instrument { uuid: string label: string enabled: boolean minimized: boolean audioUnit: InstrumentAudioUnit icon: string key: 'Playfield' slots: readonly PlayfieldSlot[] remove(): void slot(note: number): Nullable<PlayfieldSlot> addSample(sample: Sample, props?: Partial<Omit<PlayfieldSlot, 'uuid' | 'remove' | 'audioEffects' | 'addAudioEffect' | 'playfield' | 'sample' | 'midiEffects' | 'addMIDIEffect'>>): PlayfieldSlot }

Drum machine playing one sample per note

Hierarchy


Properties

uuid: string

readonly

Inherited from uuid

Unique id

label: string

Inherited from label

Custom label

enabled: boolean

Inherited from enabled

Enable or bypass the device

minimized: boolean

Inherited from minimized

Collapse the device editor in the studio

audioUnit: InstrumentAudioUnit

readonly

Inherited from audioUnit

The audio unit this instrument belongs to

icon: string

Inherited from icon

Icon name (see IconSymbol)

key: 'Playfield'

readonly

Overrides key

Always "Playfield"

slots: readonly PlayfieldSlot[]

readonly

All slots ordered by note

Methods

remove(): void

Inherited from remove

Removes the whole audio unit. Use InstrumentAudioUnit.setInstrument to swap the instrument. An instrument inside an InstrumentCompositeLayer removes that layer instead

Returns

  • void

slot(note: number): Nullable<PlayfieldSlot>

Slot at the given note (null = empty)

Parameters

  • note (number)

Returns

addSample( sample: Sample, props?: Partial<Omit<PlayfieldSlot, 'uuid' | 'remove' | 'audioEffects' | 'addAudioEffect' | 'playfield' | 'sample' | 'midiEffects' | 'addMIDIEffect'>>, ): PlayfieldSlot

Assign a sample to a note. Replaces an existing slot at that note.

Parameters

  • sample (Sample) — The sample to play
  • props (Partial<Omit<PlayfieldSlot, "uuid" | "remove" | "audioEffects" | "addAudioEffect" | "playfield" | "sample" | "midiEffects" | "addMIDIEffect">>, optional) — Slot settings (note defaults to the next free note starting at 60)

Returns

Example

CODE
const samples = await openDAW.listSamples()
const drums = project.addInstrumentUnit("Playfield", {label: "Drums"})
drums.instrument.addSample(samples[0], {note: 36})