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
- See:
Hierarchy
Properties
uuid: string
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
Inherited from audioUnit
The audio unit this instrument belongs to
icon: string
Inherited from icon
Icon name (see IconSymbol)
key: 'Playfield'
Overrides key
Always "Playfield"
slots: readonly PlayfieldSlot[]
All slots ordered by note
- See:
pads: readonly PlayfieldPad[]
Pads playing an instrument, ordered by note (pads playing a sample are slots)
- See:
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 playprops(Partial<Omit<PlayfieldSlot, "uuid" | "remove" | "audioEffects" | "addAudioEffect" | "playfield" | "sample" | "midiEffects" | "addMIDIEffect">>, optional) — Slot settings (notedefaults to the next free note starting at 60)
Returns
Example
const samples = await openDAW.listSamples()
const drums = project.addInstrumentUnit("Playfield", {label: "Drums"})
drums.instrument.addSample(samples[0], {note: 36})- See:
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
Kextends"Vaporisateur" | "Sampler" | "Soundfont" | "MIDIOutput" | "Neon" | "Tubular" | "Surgeon" | "OpenDrumKick" | "OpenDrumSnare" | "OpenDrumClap" | "OpenDrumTom" | "OpenDrumRim" | "OpenDrumHat" | "OpenDrumShaker" | "OpenDrumCymbal" | "OpenDrumBell" | "OpenDrumPerc" | "Cubed" | "Guitar" | "Apparat"
Parameters
key(K) — Instrument type, see PadInstrumentsprops(DeepPartial<PadInstruments[K]>, optional) — Instrument settingspad(Partial<Pick<PlayfieldPad, "pan" | "note" | "gain" | "mute" | "solo" | "key" | "minimized" | "exclude">>, optional) — Pad settings (notedefaults to the next free note starting at 60)
Returns
Example
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})