音效#

简介#

VEX AIM 编程机器人的声音功能允许用户播放内置声音、自定义音频文件和音符。它还包含用于停止声音和检测当前是否正在播放音频的控制功能。

以下是所有模块的列表:

播放音效#

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.

播放用户声音 1 指令块。#
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.

示例

启动时,播放用户音效1。#
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.

音符

定义音高:

  • C
  • C#
  • D
  • D#
  • E
  • F
  • F#
  • G
  • G#
  • A
  • A#
  • B
  • rest

音符长度

设置音符时值:

  • 全音符 — 全音符
  • 二分音符 — 二分音符
  • 四分音符 — 四分音符
  • 八分音符 — 八分音符
  • 十六分音符 — 十六分音符

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.

示例

播放声音文件 1,不要等待。等待 2 秒。如果声音仍然有效,则停止声音。#
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

参数

描述

该指令块没有参数。

示例

播放声音文件 1,不要等待。等待 2 秒。如果声音仍然有效,则停止声音。#
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?>

参数

描述

该指令块没有参数。

示例

播放声音文件 1,不要等待。等待 2 秒。如果声音仍然有效,则停止声音。#
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
结束