オーディオ
オーディオトラックは背景音楽、効果音、環境音を提供します。AIディレクティブ、ルール、または自動プレイリストでトリガーできます。
AudioTrackスキーマ
json
{
"id": "bgm-tavern",
"name": "Tavern Theme",
"type": "bgm",
"url": "@asset:uuid-here",
"loop": true,
"volume": 0.4,
"fadeIn": 2,
"fadeOut": 1.5,
"maxDuration": null
}| フィールド | タイプ | 説明 |
|---|---|---|
id | string | 一意のkebab-case ID |
name | string | 表示名 |
type | "bgm" | "sfx" | "ambient" | トラックのタイプ |
url | string | オーディオソース。@asset:{id} または直接URL |
loop | boolean | ループするか(典型: BGM/ambientはtrue、SFXはfalse) |
volume | number | 0.0〜1.0 |
fadeIn | number | null | フェードイン時間(秒) |
fadeOut | number | null | フェードアウト時間(秒) |
maxDuration | number | null | N秒後に自動停止 |
AIオーディオディレクティブ
AIは角括弧ディレクティブでオーディオをトリガーします。
[audio: bgm-tavern play]
[audio: sfx-sword play]
[audio: bgm-tavern stop]
[audio: bgm-battle crossfade 2.5]
[audio: ambient-rain volume 0.3]
[audio: sfx-magic play chain:bgm-ambient]| アクション | 説明 |
|---|---|
play | トラックの再生を開始 |
stop | トラックを停止 |
crossfade <seconds> | 現在のBGMからこのトラックへクロスフェード |
volume <0-1> | トラックの音量を変更 |
play chain:<trackId> | このトラックを再生し、次を自動再生 |
BGMプレイリスト
BGMトラックのシーケンスを自動再生:
json
{
"bgmPlaylist": {
"tracks": ["bgm-explore-1", "bgm-explore-2", "bgm-explore-3"],
"playMode": "shuffle",
"gapSeconds": 0,
"autoPlay": true,
"waitForFirstMessage": true
}
}| フィールド | タイプ | 説明 |
|---|---|---|
tracks | string[] | サイクルするトラックIDの配列 |
playMode | "loop" | "shuffle" | "sequential" | 再生順モード |
gapSeconds | number | トラック間の無音(デフォルト: 0、最大: 30) |
autoPlay | boolean | 自動的に再生開始(デフォルト: true) |
waitForFirstMessage | boolean | プレイヤーが最初のメッセージを送るまで開始しない |
条件付きBGM
条件が満たされたときに特定のトラックを再生。変数チェック、キーワードマッチング、ターン数、セッション開始トリガーをサポート。
json
{
"conditionalBGM": [
{
"id": "combat-music",
"name": "Combat Music",
"targetTrackId": "bgm-battle",
"triggerType": "variable",
"conditions": [
{ "variableId": "in-combat", "operator": "eq", "value": true }
],
"conditionLogic": "all",
"priority": 10,
"fadeInDuration": 1,
"fadeOutDuration": 2,
"stopPreviousBGM": true,
"fallback": "default"
}
]
}| フィールド | タイプ | 説明 |
|---|---|---|
id | string | 一意の識別子 |
name | string | 表示名 |
targetTrackId | string | トリガー時に再生するトラック |
triggerType | "variable" | "ai-keyword" | "keyword" | "turn-count" | "session-start" | 条件付きBGMをトリガーするもの |
conditions | Condition[] | チェックする変数条件 |
conditionLogic | "all" | "any" | 複数条件の結合方法(デフォルト: "all") |
keywords | string[] | マッチするキーワード(keyword / ai-keyword トリガー用) |
matchWholeWords | boolean | 単語全体のみマッチ(キーワードトリガー用) |
atTurn | number | 特定のターンで発火(turn-count トリガー用) |
everyNTurns | number | Nターンごとに発火(turn-count トリガー用) |
priority | number | 複数トリガーが一致したとき、優先度が高い方が勝つ |
fadeInDuration | number | フェードイン時間(秒) |
fadeOutDuration | number | フェードアウト時間(秒) |
stopPreviousBGM | boolean | 現在再生中のBGMを先に停止 |
fallback | "default" | "previous" | トラックIDの文字列 | 条件がfalseになったときに再生するもの |
条件演算子はショートフォームを使います: eq、neq、gt、lt、gte、lte、contains。
条件がtrueになるとトラックが開始します。falseになると停止し(設定されていればフェードアウト付き)、fallback 設定に従ってフォールバックします。
