声音#
介绍#
VEX AIR 无人机控制器允许用户播放内置音效、自定义音频文件和音符。它还包含用于停止声音和检测音频是否正在播放的控制功能。
以下是所有可用块的列表:
声音 - 播放和停止声音
播放声音 — 播放预定义列表中的内置声音。
播放声音文件 — 播放用户上传的声音。
播放音符 — 播放具有指定音高、八度和持续时间的音符。
停止声音 — 停止任何当前播放的声音。
sound active — Checks if a sound is currently playing.
声音#
播放声音#
The play sound stack block plays one of the controller’s built-in sounds.
播放声音 [前进 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. |
声音名称 |
播放声音 |
|---|---|
成功 |
|
故障 |
|
感应 |
|
检测到 |
|
障碍 |
|
循环 |
|
完成 |
|
暂停 |
|
简历 |
|
发送 |
|
接收 |
例子
当开始
[Play the looping sound.]
播放声音 [循环 v] ▶
播放声音文件#
The play sound file stack plays a custom sound loaded by the user.
播放声音文件 [SOUND1 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. |
例子
当开始
[Upload a sound file in VEXcode.]
[Play the custom sound.]
播放声音文件 [SOUND1 v] ▶
播放注释#
The play note stack block plays a specific note for a specific duration.
播放音符 [低 v] [C v] [note_eight 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. |
例子
当开始
[Play a short tune.]
播放音符 [低 v] [C v] [note_quarter v] ▶
播放音符 [低 v] [D v] [note_quarter v] ▶
播放音符 [低 v] [E v] [note_sixteenth v] ▶
停止声音#
The stop sound stack block stops a sound that is currently playing.
停止声音
参数 |
描述 |
|---|---|
该块没有参数。 |
例子
当开始
[Upload a sound 10 seconds or greater in VEXcode.]
[Stop the sound while it is playing.]
播放声音文件 [1 v] ◀ 并且不等待
等待 [6] 秒
停止声音
sound active#
The sound active Boolean block reports if there is any sound currently playing.
True — There is a sound playing.
False — There is no sound playing.
<声音活跃吗?>
参数 |
描述 |
|---|---|
该块没有参数。 |
例子
当开始
[Display when the sound is playing.]
播放声音 [循环 v] ◀ 并且不等待
等到 <声音活跃吗?>
在控制台上打印 [I hear the sound!]▶