- Notifications
You must be signed in to change notification settings - Fork4
sh1ma/voicevoxcore.go
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
voicevoxcore.go はvoicevox_coreを Go 言語で使えるラッパーです。FFI を用いて、voicevox_core の C API を呼んでいます。
go get https://github.com/sh1ma/voicevoxcore.go
以下は本ライブラリを使用して Text to Speech を行う例です。
//go:build ignorepackage mainimport ("fmt""os"voicevoxcorego"github.com/sh1ma/voicevoxcore.go")funcmain() {text:="ずんだもんなのだ"core:=voicevoxcorego.NewVoicevoxCore()initializeOptions:=voicevoxcorego.NewVoicevoxInitializeOptions(0,0,false,"./open_jtalk_dic_utf_8-1.11")core.Initialize(initializeOptions)core.LoadModel(3)ttsOptions:=voicevoxcorego.NewVoicevoxTtsOptions(false,true)result,err:=core.Tts(text,1,ttsOptions)iferr!=nil {fmt.Println(err)}f,_:=os.Create("out.wav")_,err=f.Write(result)iferr!=nil {fmt.Println(err)}}
本ライブラリを使用するには openJTalk の辞書ファイルと voicevox_core の動的ライブラリ、ヘッダファイル、そしてモデルファイルが必要になります。以下でそれらをダウンロードし、本ライブラリから使えるようにするための簡単なセットアップの手順を説明します。
voicevox_core の releasesから自分の OS、アーキテクチャに合ったダウンローダをダウンロードし、実行してください。実行するとカレントディレクトリにvoicevox_core_*
のディレクトリが配置されます。直下には以下のものが入っています
- openJTalk の辞書ファイルが入った
open_jtalk_dic_*/
ディレクトリ - voicevox_core の動的ライブラリ
- 拡張子は.dll, .dylib, .so のいずれかです
- 圧縮されたモデルファイルの入った
model/
ディレクトリ
voicevox_core
を任意のパスに移動(おすすめは~/.local
のなか)します
voicevox_core
内にある 2 つのファイルのシンボリックリンクを作ります。以下のようなコマンドを実行します。(プラットフォームによってコマンドが異なる場合があります)。動的ライブラリが.dylib
の場合を例に挙げます。
注意: ln に渡すパスは相対パスではなく絶対パスにしてください
# [VOICEVOX_CORE_DIR] を`voicevox_core`の絶対パスにします# 動的ライブラリのシンボリックリンクを`/usr/local/lib`に配置しますln -s [VOICEVOX_CORE_DIR]/libvoicevox_core.dylib /usr/local/lib# 動的ライブラリのシンボリックリンクを`/usr/local/include`に配置しますln -s [VOICEVOX_CORE_DIR]/voicevox_core.h /usr/local/include
以上の手順で本ライブラリが使えるようになっているはずです。
About
Voicevox Coreのラッパーライブラリ
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.