音效#
简介#
The VEX AIM Coding Robot’s sounds allow users to play built-in sounds, custom audio files, and musical notes. It also includes controls for stopping sounds and detecting if audio is currently playing.
Below is a list of all blocks:
play sound — Plays a built-in sound from a predefined list.
play sound file — Plays a user-uploaded sound.
play note — Plays a musical note with a specified pitch, octave, and duration.
stop sound — Stops any currently playing sound.
sound active? — Checks if a sound is currently playing.
播放音效#
播放音效指令块用于播放机器人的一个内置音效。
播放声音 [表现开心 v] ▶
参数 |
描述 |
|---|---|
音效 |
下方显示的内置音效之一。 |
展开箭头 |
By default, this is a waiting block, so the robot will finish playing the sound before running the next block. To make the robot start playing the sound and immediately run the next block right away, expand the block to say and don’t wait. |
音效名称 |
播放音效 |
|---|---|
表现开心 |
|
表现悲伤 |
|
表现傻 |
|
表现生气 |
|
表现兴奋 |
|
前进 |
|
后退 |
|
右转 |
|
左转 |
|
撞毁 |
|
刹车 |
|
捡起 |
|
传感 |
|
检测到 |
|
障碍 |
|
闪耀 |
|
闪烁 |
|
啁啾 |
|
循环 |
|
完成 |
|
发送 |
|
接受 |
|
暂停 |
|
继续 |
|
嗒哒 |
|
失败 |
|
门铃 |
|
哈 |
|
精彩 |
|
欢呼 |
示例
当开始
[Play the act happy sound.]
播放声音 [表现开心 v] ▶
播放音效文件#
播放音效文件指令块用于播放用户加载的自定义声音文件。
播放声音文件 [1 v] ▶
参数 |
描述 |
|---|---|
音效槽位编号 |
要使用的自定义声音,编号为 1 到 10。该编号与 AIM 控制面板中显示的数字相对应。 |
展开箭头 |
By default, this is a waiting block, so the robot will finish playing the note before running the next block. To make the robot start playing the note and immediately run the next block right away, expand the block to say and don’t wait. |
示例
当开始
[Upload a sound file in VEXcode.]
[Play the custom sound.]
播放声音文件 [1 v] ▶
播放音符#
播放音符指令块以指定的时长播放一个特定的音符。
播放音符 [低 v] [C v] [note_eight v] ▶
参数 |
描述 |
|---|---|
八度 |
音符的八度:
|
音符 |
定义音高:
|
音符长度 |
Sets the length of the note:
|
展开箭头 |
展开该指令块,显示“说完继续”选项,使其变为非等待型指令块。默认情况下,此指令块为等待型指令块。 |
示例
当开始
[Play a short tune.]
播放音符 [低 v] [C v] [note_half v] ▶
播放音符 [低 v] [D v] [note_quarter v] ▶
播放音符 [低 v] [E v] [note_sixteenth v] ▶
停止音效#
停止音效指令块停止当前正在播放的音效。
停止声音
参数 |
描述 |
|---|---|
该指令块没有参数。 |
示例
当开始
[Stop sound if it is still playing after 2 seconds]
播放声音文件 [1 v] ◀ 并且不等待
等待 (2) 秒
如果 <声音活跃吗?> 那么
停止声音
结束
音效播放中?#
音效播放中 指令块返回一个布尔值,指示当前是否有任何音效正在播放。
True — There is a sound playing.
False — There is no sound playing.
<声音活跃吗?>
参数 |
描述 |
|---|---|
该指令块没有参数。 |
示例
当开始
[Stop sound if it is still playing after 2 seconds]
播放声音文件 [1 v] ◀ 并且不等待
等待 (2) 秒
如果 <声音活跃吗?> 那么
停止声音
结束