アドオン詳細解説 - サウンド

アップロード:2023/01/01 最終更新:2023/01/01

目次 (折りたたみ可)

機能

サウンドに関するファイルは2種類あり、 用意されている音源のデータをマイクラのサウンドエフェクト(効果音)として定義するものと、 それらのサウンドをどんな時に鳴らすのか、サウンドイベントとして紐づけたりするものがあります。

ファイルの場所

リソース
  ┣ manifest.json
  ┣ pack_icon.png
  ┣ sounds.json
  ┗ sounds
    ┣ sound_definitions.json
    ┗ music_definitions.json

sound_definitions.json

.ogg(または.fsb)ファイル音源をサウンドとして定義するファイルです。

基本構造

{ "format_version": "1.14.0", "sound_definitions": { // SEの定義 } }

定義部分

{ "format_version": "1.14.0", "sound_definitions": { // 音源が1つの場合 "(サウンドID)": { "category": "(カテゴリ)", "sounds": [ "(音源のファイルパス)" ] }, // 音源が複数の場合 "(サウンドID)": { "category": "(カテゴリ)", "sounds": [ "(音源のファイルパス1)", "(音源のファイルパス2)", "(音源のファイルパス3)" ] }, // 音源ごとに詳細設定する例 "(サウンドID)": { "category": "(カテゴリ)", "sounds": [ "(音源のファイルパス1)", { "name": "(音源のファイルパス)", // 詳細設定 }, "(音源のファイルパス3)" ] } } }
{ "format_version": "1.14.0", "sound_definitions": { // 音源が1つの場合 ~#B(f00)"(サウンドID)": { "category": "(カテゴリ)", "sounds": [ "(音源のファイルパス)" ] },B#~ // 音源が複数の場合 ~#B(f00)"(サウンドID)": { "category": "(カテゴリ)", "sounds": [ "(音源のファイルパス1)", "(音源のファイルパス2)", "(音源のファイルパス3)" ] },B#~ // 音源ごとに詳細設定する例 ~#B(f00)"(サウンドID)": { "category": "(カテゴリ)", "sounds": [ "(音源のファイルパス1)", ~#B(00f){ "name": "(音源のファイルパス)", // 詳細設定 },B#~ "(音源のファイルパス3)" ] }B#~ } }

ファイルパスは拡張子なしです。カテゴリは以下から選んで指定します。

備考
"block"(ブロック)
"bottle"(瓶)
"bucket"(バケツ)
"hostile"(敵対)
"music"(BGM)
"neutral"(非敵対)
"player"(プレイヤー)
"record"(レコード)
"ui"音源・プレイヤー間の距離を無視する(音量が一定)
"wather"(天気)

"category"と並べて "min_distance""max_distance"が指定できます。 それぞれ「音量が下がり始める距離」と「サウンドが聞こえなくなる距離」の値(小数)です。

詳細設定

name [Str]

音源のファイルパス。拡張子なし。

weight [Int]

この音源が選ばれる確率の比。1つのサウンドに複数の音源を指定する場合に使う。
30と70だったら30%と70%、1と2と2だったら20%と40%と40%。

stream [Bool]

同時に再生される数を制限するかどうか。 trueにすれば軽量化になる。

volume [Float]

サウンドの音量。0.0~1.0で指定。

load_on_low_memory [Bool]

パフォーマンスの低下中でも強制的にサウンドをロードするかどうか。 軽量化するならこの項目は書かない。

pitch [Float]

サウンドのピッチ。

is3D [Bool]

このサウンドを立体音響にしたくないとき、このプロパティを書いて値をfalseにする。

interruptible [Bool]

デフォルトはtrue

sounds.json

このファイルは、定義したSEをサウンドイベントに紐づける役割を担います。

しかし、カスタムできるのはエンティティの部分のみなので、それ以外については説明しません。

基本構造

{ "entity_sounds": { "entities": { // エンティティのサウンド } } }

詳細な構造

{ "block_sounds": { // ブロックのサウンド }, "entity_sounds": { "defaults": { // デフォルト }, "entities": { // エンティティのサウンド } }, "individual_event_sounds": { // 個々のイベントに関するサウンド }, "interactive_sounds": { // interactive sounds } }
{ ~#B(f00)"block_sounds": { // ブロックのサウンド },B#~ ~#B(f00)"entity_sounds": { "defaults": { // デフォルト }, "entities": { // エンティティのサウンド } },B#~ ~#B(f00)"individual_event_sounds": { // 個々のイベントに関するサウンド },B#~ ~#B(f00)"interactive_sounds": { // interactive sounds }B#~ }

具体的な書き方

{ "entity_sounds": { "entities": { "ex:my_entity": { "events": { "ambient": "mob.skeleton.say", "hurt": { "sound": "mob.skeleton.hurt", "volume": 0.7 }, "death": "mob.skeleton.death", "step": { "sound": "mob.skeleton.step", "volume": 1, "pitch": 1 } // その他サウンドイベント }, "volume": 1, "pitch": [ 0.8, 1.2 ] } } } }
{ "entity_sounds": { "entities": { ~#B(f00)"ex:my_entity": { "events": { "ambient": "mob.skeleton.say", "hurt": { "sound": "mob.skeleton.hurt", "volume": 0.7 }, "death": "mob.skeleton.death", "step": { "sound": "mob.skeleton.step", "volume": 1, "pitch": 1 } // その他サウンドイベント }, "volume": 1, "pitch": [ 0.8, 1.2 ] }B#~ } } }

エンティティのIDが名前のプロパティを"entities"内に作り、 その中の"events"内でサウンドイベントとサウンドを紐づけます。

サウンドイベントの中でもだいたいどのモブにもあって、最低限と言えるものが以下です。

サウンドイベント概要
"ambient"鳴き声などの、待機時の音
"hurt"ダメージを受けたときの音または声
"death"デスしたときの音または声
"step"足音

サウンドイベントは以下のように指定します。

"events": { // シンプルに指定 "ambient": "(サウンドID)", // 詳細に指定 "hurt": { "sound": "(サウンドID)", "volume": 1.0 "pitch": [ 0.5, 1.0 ] // 範囲指定の例 } // ...その他サウンドイベント }
"events": { // シンプルに指定 "ambient": "(サウンドID)", // 詳細に指定 ~#B(00f)"hurt": { "sound": "(サウンドID)", "volume": 1.0 "pitch": [ 0.5, 1.0 ] // 範囲指定の例 }B#~ // ...その他サウンドイベント }

詳細に設定する場合、"pitch"でピッチ、"volume"で音量を小数で指定できます。また、それらは[ 0.5, 1.0 ]のように範囲指定することでその間のランダムなピッチ/音量になります。

ピッチと音量は、"events"オブジェクトと並列させてすべてのサウンドイベントに対して設定することができます。

"ex:my_entity": { "events": { // サウンドイベント }, "volume": 1.0, "pitch": [ 0.8, 1.2 ] }
~#B(f00)"ex:my_entity": { "events": { // サウンドイベント }, "volume": 1.0, "pitch": [ 0.8, 1.2 ] }B#~

music_definition.json

カスタマイズできません。

{ "(MusicID)": { "event_name": "(サウンドID)", "max_delay": 20, "min_delay": 10 } }

max_delay, min_delay

"max_delay"は最大遅延、"min_delay"は最小遅延。