Chip
A sound chip: a fixed set of channels that sound in one audio context and are mixed into its output, behind a master volume.
Import
import { Chip } from '@halleyfante/chiptune';Two notes at once
Constructor
new Chip({ context: BaseAudioContext, channels: readonly Channel<unknown>[] })| Option | Description |
|---|---|
context | The audio context the chip sounds in. A browser only lets one make sound when it is created or resumed during a click or a key press. |
channels | The sound generators of the chip, which stay the same for as long as it exists. |
Properties
| Name | Type | Description |
|---|---|---|
context | BaseAudioContext | |
size | number | How many channels the chip has. |
volume | number | From 0, silent, to 1, where a single channel at full volume already reaches full scale. |
Methods
| Method | Description |
|---|---|
hush(): void | Ends at once every note that is sounding or was handed to the chip to sound later. |
play(options: ChipPlayOptions): void | Sounds a note on one of the channels. |