speaker.playNote
The instrument name corresponds to those provided by Note Blocks. It may be one of the following strings: base, basedrum, bell, chime, flute, guitar, hat, snare orxylophone.
speaker.playNote Function | |
---|---|
Syntax speaker.playNote(
| |
Returns | boolean success |
API | speaker |
Source | CC:Tweaked (source) |
Play a note with the given volume and pitch.
Volume may be any number between 0 and 3 inclusive. 1 is the default, with 3 being the volume of a normal note block. Like note blocks, a higher volume does not imply a louder sound, merely that it can be heard further away.
The pitch may be a number between 0 and 24 inclusive, defaulting to 1. This represents the number of times one has right-clicked a noteblock. 0 representing F♯ and 24 representing F♯ 2 octaves higher.
This will return true if the note could be played or false if too many notes have been played in a single tick.
|
|||
Play a note. | |||
Code | <nowiki>
local speaker = peripheral.find("speaker")
speaker.playNote("guitar")
</nowiki>
|