声音#

介绍#

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

以下是所有可用块的列表:

声音 - 播放和停止声音

声音#

播放声音#

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.

播放用户声音 1 堆栈块#
播放声音文件 [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.

例子

启动时,播放用户声音1。#
当开始
[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] ▶

参数

描述

八度

音符的八度:

笔记

定义音高:

  • C
  • C#
  • D
  • D#
  • E
  • F
  • F#
  • 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 秒。如果声音仍然有效,则停止声音。#
当开始
[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.

停止声音动作块。#
停止声音

参数

描述

该块没有参数。

例子

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

声音活动布尔块。#
<声音活跃吗?>

参数

描述

该块没有参数。

例子

播放声音文件 1,不要等待。等待 2 秒。如果声音仍然有效,则停止声音。#
当开始
[Display when the sound is playing.]
播放声音 [循环 v] ◀ 并且不等待
等到 <声音活跃吗?>
在控制台上打印 [I hear the sound!]▶