Shriek
由 Volcano Bay Studios 维护的 VoiceLib 版本
一个可以将语音转换为文本的库,能够监听你的麦克风并理解你所说的内容!借助 Vosk 的强大功能,你可以对着麦克风说话并获得输出结果,甚至支持多种语言!
实现方式
repositories {
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
}
}
dependencies {
modImplementation "maven.modrinth:shriek:1.1.01+fabric"
}
使用方法
ShriekApi 是 API 的类。 以下是你将使用的方法:
import com.pryzmm.client.event.EventHandler;
EventHandler.setModel();
// 这将设置语言模型,定义在 https://alphacephei.com/vosk/models
// 语言模型的大小各不相同;默认的是 vosk-model-small-en-us-0.15,压缩后约为 40 MB,而其他如 vosk-model-ru-0.10 则约为 2.5 GB 压缩后
// 更改模型将重新启动下载,或调用 EventHandler.getOrCreatePath();
ShriekApi.registerServerPlayerSpeechListener(Consumer<ServerPlayerTalkEvent> consumer) // 此方法注册一个 ServerPLayerTalkEvent 的 Consumer。每当有玩家发言时, // 就会触发此事件。ServerPlayerTalkEvent 提供了玩家对象以及他们所说的字符串内容。
ShriekApi.registerClientSpeechListener(Consumer<ClientTalkEvent> consumer) // 此方法注册一个 ClientTalkEvent 的 Consumer。此方法仅在客户端触发。 // 当用户发言时,便会触发此事件。
ShriekApi.setPrintToChat(boolean printToChat) // 此设置仅适用于客户端。它用于设置是否将 // 客户端发言事件打印到聊天栏。(默认为 False)
ShriekApi.setPrintToConsole(boolean printToConsole) // 与 printToChat 类似,但针对控制台输出。(默认为 False)
# 示例
以下代码实现了:如果服务器上的任何玩家说出 "ouch",该玩家就会被点燃
```java
ShriekApi.registerServerPlayerSpeechListener((serverPlayerTalkEvent -> {
if (serverPlayerTalkEvent.getText().contains("ouch"))
serverPlayerTalkEvent.getPlayer().igniteForSeconds(2);
}));
你也可以在 GitHub 上的 ShriekExample 中查看此示例
安全性
关于此模组,有几点需要注意:
- 该模组在首次启动时会自动从互联网下载 Vosk 模型。默认模型压缩后约为 40MB,在设置模型的过程中可能会使游戏短暂卡顿数秒。
- 默认情况下,该模组会持续录制并将所有文本数据发送至服务器。这意味着如果服务器端安装了相关模组并配置了监听功能,他们就能听到你的对话内容。请对此保持警惕。
- 按住“静音键”可关闭麦克风。
- 其他模组具备开启或关闭录制的功能。
Shriek
A maintained version of VoiceLib by Volcano Bay Studios
A speech to text library that can listen to your microphone and understand what you're saying! Using the power of Vosk, you can speak into your microphone and get an output, and even use multiple languages!
Implementation
repositories {
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
}
}
dependencies {
modImplementation "maven.modrinth:shriek:1.1.01+fabric"
}
Usage
ShriekApi is the class for the API. The following are the methods you will be using
import com.pryzmm.client.event.EventHandler;
EventHandler.setModel();
// This will set the language model, defined in https://alphacephei.com/vosk/models
// Language models vary in size; the default is vosk-model-small-en-us-0.15, which is ~40 MB compressed, while others like vosk-model-ru-0.10 are ~2.5GB compressed
// Changing models will restart a restart to download, or a call from EventHandler.getOrCreatePath();
ShriekApi.registerServerPlayerSpeechListener(Consumer<ServerPlayerTalkEvent> consumer)
// This method registers a ServerPLayerTalkEvent Consumer. Whenever a player speaks,
// This event will be fired. The ServerPlayerTalkEvent provides the player, and a string of what they said.
ShriekApi.registerClientSpeechListener(Consumer<ClientTalkEvent> consumer)
// This method registers a ClientTalkEvent Consumer. This method is only fired on the client.
// Whenever the user speaks, this will be fired.
ShriekApi.setPrintToChat(boolean printToChat)
// This is only on the client. This sets whether or not to
// print client speak events to chat. (Default False)
ShriekApi.setPrintToConsole(boolean printToConsole)
// Same as printToChat but for the console instead. (Default False)
Example
This method makes it so if any player on the server says "ouch" they light on fire
ShriekApi.registerServerPlayerSpeechListener((serverPlayerTalkEvent -> {
if (serverPlayerTalkEvent.getText().contains("ouch"))
serverPlayerTalkEvent.getPlayer().igniteForSeconds(2);
}));
You can also see this in ShriekExample through GitHub
Security
There are a few things to note with this mod:
- The mod automatically downloads a vosk model from the internet on the first launch. The default model is ~40MB compressed and may freeze your game for a couple seconds while setting up the model.
- This mod by default, constantly records and sends all text data to the server. This means if a server modification has set up their mod to, they can listen into your conversation. Please be weary of this.
- The push to mute key will turn OFF your microphone whilst held
- Other mods have the ability to toggle recording on/off
下载 Shriek
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Shriek
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Shriek
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Shriek
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Shriek
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Shriek
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Shriek
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Shriek
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Shriek
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Shriek
修复了一个严重的日志记录问题
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
一个用于收集生物掉落物的多区块模组。
模组
显示你正在注视的方块的信息。(适用于 Minecraft 1.16+ 的 Hwyla/Waila 分支)
模组
使用 JavaScript 编辑配方、添加自定义物品、编写世界事件!
模组
查看物品与配方
模组
适用于 MC 1.18+ 的 Effekseer 加载器
模组
那是什么?一个 Waila/Hwyla 的分支。

评论 0
登录后参与评分
还没有评论,来抢沙发吧