@ai-rpg-engine/soundpack-core
v2.0.7
Published
Sound pack manifest schema and content-addressable audio registry for AI RPG Engine
Maintainers
Readme
@ai-rpg-engine/soundpack-core
用于AI RPG Engine的、基于内容寻址的音效注册表和打包规范。
它是Immersion Runtime的一部分,用于管理带有标签和可查询功能的音频资源集合。
安装
npm install @ai-rpg-engine/soundpack-core功能
音效包是可加载的音频条目集合(音效、环境循环、音乐、语音),包含丰富的元数据,方便查找。该注册表支持基于标签的查询、强度过滤和情绪匹配。
自带一个核心音效包,与voice-soundboard程序化效果相关联。
用法
import { SoundRegistry, CORE_SOUND_PACK } from '@ai-rpg-engine/soundpack-core';
const registry = new SoundRegistry();
registry.load(CORE_SOUND_PACK);
// Query by domain
const ambient = registry.query({ domain: 'ambient' });
// Query by tags + mood
const tenseSfx = registry.query({ tags: ['alert'], mood: ['dread'] });
// Get specific entry
const entry = registry.get('ui_success');
console.log(entry?.voiceSoundboardEffect); // "chime_success"核心音效包
13个条目,与voice-soundboard程序化效果相关联:
| ID | 效果 | 领域 | 标签 |
|----|--------|--------|------|
| ui_notification | chime_notification | sfx | ui, 提示 |
| ui_success | chime_success | sfx | ui, 积极 |
| ui_error | chime_error | sfx | ui, 消极 |
| ui_click | click | sfx | ui, 输入 |
| ui_pop | pop | sfx | ui, 光 |
| ui_whoosh | whoosh | sfx | ui, 转换 |
| alert_warning | warning | sfx | 提示, 注意 |
| alert_critical | critical | sfx | 提示, 危险 |
| alert_info | info | sfx | 提示, 信息 |
| ambient_rain | rain | 环境 | 天气, 平静 |
| ambient_white_noise | white_noise | 环境 | 背景 |
| ambient_drone | drone | 环境 | 黑暗, 紧张 |
自定义音效包
通过提供SoundPackManifest文件,您可以创建自己的音效包:
import type { SoundPackManifest } from '@ai-rpg-engine/soundpack-core';
const myPack: SoundPackManifest = {
name: 'medieval-tavern',
version: '1.0.0',
description: 'Tavern ambience and interaction sounds',
author: 'your-name',
entries: [
{
id: 'tavern_chatter',
tags: ['ambient', 'social'],
domain: 'ambient',
intensity: 'low',
mood: ['calm', 'social'],
durationClass: 'long-loop',
cooldownMs: 0,
variants: ['tavern_chatter_01.wav'],
source: 'file',
},
],
};
registry.load(myPack);AI RPG Engine的一部分
此软件包是AI RPG Engine单仓库的一部分。请参阅根目录的README文件以获取完整的架构信息。
许可证
MIT
