0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

MLX-Audio を使った MLX版 OuteTTS で音声合成を試す

Last updated at Posted at 2025-05-20

はじめに

Hugging Face の mlx-community のモデルを見ていて、そこに出てきた「OuteTTS」の MLX版を試してみた話です。

image.png

とりあえず適当に 640MB くらいのサイズの量子化版を使ってみました(自分のマシンスペック的には量子化されてないものでも大丈夫ではありますが)。

●mlx-community/OuteTTS-1.0-0.6B-8bit at main
 https://huggingface.co/mlx-community/OuteTTS-1.0-0.6B-8bit/tree/main

image.png

実際に試してみる

さっそく試していきます。

試す環境

MLX版 OuteTTS を試す環境は、過去に MLX版のモデルを使ったローカルLLM を試してきた環境です。

  • PC
    • M4 の Mac mini(メモリ 24GB、うち 16GB をローカルLLM用で利用可能)
  • モデル
    • OuteTTS-1.0-0.6B-8bit
  • 実行環境
    • Python の仮想環境で MLX-Audio を利用

上で書いている「MLX-Audio」は、以下になります。

●Blaizzy/mlx-audio: A text-to-speech (TTS), speech-to-text (STT) and speech-to-speech (STS) library built on Apple's MLX framework, providing efficient speech analysis on Apple Silicon.
 https://github.com/Blaizzy/mlx-audio

image.png

環境の準備

当初、Python の 3.13.x を使っていたら、依存関係のところでエラーがでました(※ misaki関連の conflict のエラー)。
その後、Python のバージョンを 3.12.x にすることで、上記の問題が解決しました。

以下を進めます。

image.png

仮想環境での下準備

まずは仮想環境を用意して、アクティベートしました。

python -m venv myenv
source myenv/bin/activate

そして、仮想環境内で MLX-Audio をインストールしました。

pip install mlx-audio

音声合成を実行

それでは、音声合成を実行します。

以下のページに書かれたコマンドを見てみます。

●mlx-community/OuteTTS-1.0-0.6B-8bit · Hugging Face
 https://huggingface.co/mlx-community/OuteTTS-1.0-0.6B-8bit

image.png

以下のような構成です。

python -m mlx_audio.tts.generate --model mlx-community/OuteTTS-1.0-0.6B-8bit --text "Describe this image."

これを元に、日本語の音声合成を実行するコマンドを試してみました。

python -m mlx_audio.tts.generate --model mlx-community/OuteTTS-1.0-0.6B-8bit --text "音声合成のテスト"

初回はモデルのダウンロードが始まります。

その後、以下の「default_speaker.json 」に関するエラーが出てしまいました...

image.png

エラーの対処

エラーが関係しそうなところを見てみます。

以下、ローカルと GitHub のリポジトリの構成の比較です。

myenv/lib/python3.12/site-packages/mlx_audio/tts/models/outetts

image.png

image.png

エラーメッセージに出てきている default_speaker.json がローカル(仮想環境内の所定のフォルダ)にはありません。手動で、以下のファイルを、ローカルの所定の場所に置いてみます。

image.png

再度コマンドを実行

再度、コマンドを実行してみます。

image.png

audio_000.wav というファイルが生成されました。それを再生すると、少し不自然な感じもありますが、日本語の音声が再生されました。

オプションを見てみる

MLX-Audio のオプションの情報を少し見てみました。

image.png

言語指定

上記では、言語を自動判別するようになっていたようですが、以下で日本語を指定できるようです。
※ 最後に「 --lang_code ja 」を追加しました

python -m mlx_audio.tts.generate --model mlx-community/OuteTTS-1.0-0.6B-8bit --text "音声合成のテスト" --lang_code ja

以下を見ると、先ほどは「 Language: a 」になっていた部分が「 Language: ja 」になっています。

image.png

なお生成された音声の読み上げは、先ほどと変わりなかったです。

音声出力

それと以下のようにすると、音声ファイルが生成されつつ、その再生も行われました。
※ 最後に「 --play 」を追加しました

python -m mlx_audio.tts.generate --model mlx-community/OuteTTS-1.0-0.6B-8bit --text "音声合成のテスト" --lang_code ja --play

image.png

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?