脑#
初始化大脑类#
Brain 是使用以下构造函数创建的:
The brain
constructor uses no parameters.
// Create a new object "Brain" with the brain class.
brain Brain;
This Brain
object will be used in all subsequent examples throughout this API documentation when referring to brain class methods and attributes.
大脑类有六个预定义属性:
类方法#
除了属性之外,Brain 类还提供了几种可以直接使用的方法。
播放声音()#
The playSound(sound)
method plays a sound on the Brain.
参数 |
描述 |
---|---|
声音 |
有效的 soundType。 |
**返回:**无。
// Play a sound of type TADA.
Brain.playSound(tada);
播放注释()#
该方法可以通过以下方式调用:
The playNote(octave, note)
method plays a note in the given octave on the Brain.
参数 |
描述 |
---|---|
八度 |
要使用的八度。 |
笔记 |
要播放的音符。 |
// Play a note on the Brain.
Brain.playNote(1, 4);
The playNote(octave, note, duration)
method plays a note in the given octave on the Brain and waits for the given time before returning.
参数 |
描述 |
---|---|
八度 |
要使用的八度。 |
笔记 |
要播放的音符。 |
期间 |
播放音符的持续时间(以毫秒为单位)。 |
// Play a note on the Brain.
Brain.playNote(1, 4, 200);
声音关闭()#
The Brain.soundOff()
method stops any sound that is playing.
**返回:**无。