コガネブログ

平日更新を目標に Unity や C#、Visual Studio、ReSharper などのゲーム開発アレコレを書いていきます

【Unity】AudioClip の無音区間を削除できるエディタ拡張

リポジトリ

準備

本パッケージを使用するためには Python のインストールと
以下の Python パッケージのインストールが必要です

pip install librosa
pip install soundfile

使用例

using Kogane;
using UnityEditor;

public static class Example
{
    [MenuItem( "Tools/Hoge" )]
    private static void Hoge()
    {
        TrimAudioClipSilence.Trim
        (
            sourcePath: "Assets/source.ogg",
            destinationPath: "Assets/destination.ogg",
            topDb: 30
        );

        AssetDatabase.Refresh();
    }
}

Before

ScreenShot00004

After

ScreenShot00005