Playfield

interface Playfield extends Instrument { uuid: string label: string enabled: boolean minimized: boolean audioUnit: InstrumentAudioUnit icon: string key: 'Playfield' slots: readonly PlayfieldSlot[] pads: readonly PlayfieldPad[] remove(): void slot(note: number): Nullable<PlayfieldSlot> addSample(sample: Sample, props?: Partial<Omit<PlayfieldSlot, 'uuid' | 'remove' | 'audioEffects' | 'addAudioEffect' | 'playfield' | 'sample' | 'midiEffects' | 'addMIDIEffect'>>): PlayfieldSlot addPad<K extends 'Vaporisateur' | 'Sampler' | 'Soundfont' | 'MIDIOutput' | 'Neon' | 'Tubular' | 'Surgeon' | 'OpenDrumKick' | 'OpenDrumSnare' | 'OpenDrumClap' | 'OpenDrumTom' | 'OpenDrumRim' | 'OpenDrumHat' | 'OpenDrumShaker' | 'OpenDrumCymbal' | 'OpenDrumBell' | 'OpenDrumPerc' | 'Cubed' | 'Guitar' | 'Apparat'>(key: K, props?: DeepPartial<PadInstruments[K]>, pad?: Partial<Pick<PlayfieldPad, 'pan' | 'note' | 'gain' | 'mute' | 'solo' | 'key' | 'minimized' | 'exclude'>>): PlayfieldPad & { instrument: PadInstruments[K] } }

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

pads: readonly PlayfieldPad[]

readonly

Pads playing an instrument, ordered by note (pads playing a sample are slots)

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})

addPad< K extends 'Vaporisateur' | 'Sampler' | 'Soundfont' | 'MIDIOutput' | 'Neon' | 'Tubular' | 'Surgeon' | 'OpenDrumKick' | 'OpenDrumSnare' | 'OpenDrumClap' | 'OpenDrumTom' | 'OpenDrumRim' | 'OpenDrumHat' | 'OpenDrumShaker' | 'OpenDrumCymbal' | 'OpenDrumBell' | 'OpenDrumPerc' | 'Cubed' | 'Guitar' | 'Apparat', >( key: K, props?: DeepPartial<PadInstruments[K]>, pad?: Partial<Pick<PlayfieldPad, 'pan' | 'note' | 'gain' | 'mute' | 'solo' | 'key' | 'minimized' | 'exclude'>>, ): PlayfieldPad & { instrument: PadInstruments[K] }

Put an instrument on a note. Replaces an existing pad or slot at that note.

Type Parameters

Parameters

  • key (K) — Instrument type, see PadInstruments
  • props (DeepPartial<PadInstruments[K]>, optional) — Instrument settings
  • pad (Partial<Pick<PlayfieldPad, "pan" | "note" | "gain" | "mute" | "solo" | "key" | "minimized" | "exclude">>, optional) — Pad settings (note defaults to the next free note starting at 60)

Returns

Example

CODE
const drums = project.addInstrumentUnit("Playfield", {label: "Drums"}).instrument
drums.addPad("OpenDrumKick", {decay: 0.7}, {note: 36})
drums.addPad("OpenDrumHat", {decay: 0.13}, {note: 42, exclude: true})