音效#
简介#
VEX AIM 编程机器人的声音功能允许用户播放内置声音、自定义音频文件和音符。它还包含用于停止声音和检测当前是否正在播放音频的控制功能。
以下是所有模块的列表:
播放声音 — 播放预定义列表中的内置声音。
播放声音文件 — 播放用户上传的声音。
播放音符 — 播放具有指定音高、八度和持续时间的音符。
停止声音 — 停止当前正在播放的声音。
sound active — Checks if a sound is currently playing.
播放音效#
The play sound stack block plays one of the robot’s built-in sounds.
play sound [act happy v] ▶
参数 |
描述 |
|---|---|
音效 |
下方显示的内置音效之一。 |
and don’t wait |
Select the arrow ( ▶ ) to expand the block to say and don’t wait, so the next block in the stack will run right away. |
音效名称 |
播放音效 |
|---|---|
表现开心 |
|
表现悲伤 |
|
表现傻 |
|
表现生气 |
|
表现兴奋 |
|
前进 |
|
后退 |
|
右转 |
|
左转 |
|
撞毁 |
|
刹车 |
|
捡起 |
|
传感 |
|
检测到 |
|
障碍 |
|
闪耀 |
|
闪烁 |
|
啁啾 |
|
循环 |
|
完成 |
|
发送 |
|
接受 |
|
暂停 |
|
继续 |
|
嗒哒 |
|
失败 |
|
门铃 |
|
哈 |
|
精彩 |
|
欢呼 |
示例
when started
[Play the act happy sound.]
play sound [act happy v] ▶
播放音效文件#
The play sound file stack block plays a custom sound loaded by the user.
play sound file [1 v] ▶
参数 |
描述 |
|---|---|
音效槽位编号 |
要使用的自定义声音,编号为 1 到 10。该编号与 AIM 控制面板中显示的数字相对应。 |
and don’t wait |
Select the arrow ( ▶ ) to expand the block to say and don’t wait, so the next block in the stack will run right away. |
示例
when started
[Upload a sound file in VEXcode.]
[Play the custom sound.]
play sound file [1 v] ▶
播放音符#
播放音符指令块以指定的时长播放一个特定的音符。
play note [low v] [C v] [note_eight v] ▶
参数 |
描述 |
|---|---|
八度 |
The octave of the note: low or high. |
音符 |
定义音高:
|
音符长度 |
设置音符时值:
|
and don’t wait |
Select the arrow ( ▶ ) to expand the block to say and don’t wait, so the next block in the stack will run right away. |
示例
when started
[Play a short tune.]
play note [low v] [C v] [note_half v] ▶
play note [low v] [D v] [note_quarter v] ▶
play note [low v] [E v] [note_sixteenth v] ▶
停止音效#
The stop sound stack block stops a sound that is currently playing.
stop sound
参数 |
描述 |
|---|---|
该指令块没有参数。 |
示例
when started
[Stop sound if it is still playing after 2 seconds]
play sound file [1 v] ◀ and don't wait
wait (2) seconds
if <sound active?> then
stop sound
结束
sound active#
The sound active Boolean block reports whether any sound is currently playing.
True — There is a sound playing.
False — There is no sound playing.
<sound active?>
参数 |
描述 |
|---|---|
该指令块没有参数。 |
示例
when started
[Stop sound if it is still playing after 2 seconds]
play sound file [1 v] ◀ and don't wait
wait (2) seconds
if <sound active?> then
stop sound
结束