Skip to content

docs: usage.mdを完成させる - #1032

Merged
qryxip merged 5 commits into
VOICEVOX:mainfrom
qryxip:pr/docs-finish-usage-md
Mar 8, 2025
Merged

qryxip merged 5 commits into
VOICEVOX:mainfrom
qryxip:pr/docs-finish-usage-md

Conversation

@qryxip

@qryxip qryxip commented Mar 7, 2025

Copy link
Copy Markdown
Member

内容

関連 Issue

Refs: #1017

その他

@qryxip
qryxip requested a review from Hiroshiba March 7, 2025 19:54
Comment thread docs/guide/user/usage.md
Comment on lines +251 to +261
### APIドキュメント

[API ドキュメント](https://voicevox.github.io/voicevox_core/apis/)をご覧ください。

### サンプル実行

現在このリポジトリでは次のサンプルが提供されています。実行方法についてはそれぞれのディレクトリ内にある README を参照してください

- [Python(pip)](../../../example/python)
- [C++(UNIX CMake)](../../../example/cpp/unix)
- [C++(Windows Visual Studio)](../../../example/cpp/windows)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

READMEのコピペ (ただし相対パスだけは修正)ですが、他に上手い紹介のしかたが思い浮かばなかったので。

@Hiroshiba Hiroshiba left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!!

このusage.md、ドキュメントの目的と紹介することが分かりにくくなってて説明があっちゃこっちゃ行ってそうに感じました!

たぶん目的を「実際のソースコードの例をPythonで紹介します」として、「別の言語でも同じようなAPIがあります、そちらはexampleを参考にしてください」と案内すれば色々わかりやすくできそう!
「C APIだったら~」とか「Rustの場合は~」とかをなくせるはず。

Comment thread docs/guide/user/usage.md Resolved
Comment thread docs/guide/user/usage.md Resolved
Comment thread docs/guide/user/usage.md
Comment on lines +216 to +220
```python
# 保存したユーザー辞書をロード
user_dict = UserDict()
user_dict.load("./user_dict.json")
```

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

余談ですが、ここ書くときUserDict.load("…")とやってしまって「?」ってなってました。なんでこういう形になってるんだっけと思って調べたらこれが出てきました。
#538 (comment)

うーん。再考するとしたら私のようにUserDict.loadってやっちゃう人がどれだけいるか次第ですかね?まあREPLじゃなくてコードエディタでコード書いてるなら型が明らかだし、それほど問題ではないかもという気もしますが。

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

問題がちょっとわかってないです!
static methodなloadでインスタンスが返ってくると想像した、みたいな?
だとしたらsynthesizerとかとシグネチャ揃ってるのがとりあえず重要かなーと

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static methodなloadでインスタンスが返ってくると想像した、みたいな?

ですね。よく考えたら一般的にはそうでは?という気がしてきています。

だとしたらsynthesizerとかとシグネチャ揃ってるのがとりあえず重要かなーと

例えばVVMはVoiceModelFile::openなので、既存のに合わせるならUserDict::loadかなとは思いました。

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

まぁとりあえずissue化とかですかねぇ。

少なくともloadせず使いたい場合もあるかも・・・?
だいぶ無理やりな例ですが、辞書ファイルを作るのが目的な場合とか。

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

あ、純粋なコンストラクタについては空の辞書を作る役割に留めておいた方がよいと思ってます。次の二つが同居するような形です。

user_dict1 = UserDict()
user_dict2 = UserDict.load("./user_dict.json")

既存の別のユーザー辞書.load("…")がやりたい場合は

user_dict.import_dict(UserDict.load("…"))

のような形でよいかなと。

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

なるほどです
ちょっとあと30分で考えきるのは無理なので、とりあえずissue化して0.16リリースまでにどうするか考えますか~

@qryxip

qryxip commented Mar 8, 2025 •

Copy link
Copy Markdown
Member Author

08b8959 (#1032)
9905855 (#1032)

重要なことを忘れていました。これが無いと動作すらできない。というわけでこれの再レビューをお願いできたらと思います。

@qryxip
qryxip requested a review from Hiroshiba March 8, 2025 04:49
Comment thread docs/guide/user/usage.md Resolved
@qryxip
qryxip force-pushed the pr/docs-finish-usage-md branch from 08b8959 to 9905855 Compare March 8, 2025 05:37
Comment thread docs/guide/user/usage.md
f.write(wav)
```

同じ音声モデルのインスタンスで同時に音声合成はできません(Mutex になっています)。

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(ただのコメントです)

この辺りの細かい仕様を使い方に書くとたぶんメンテしきれない(いつの間にかドキュメントが嘘になっていく)気もしますねぇ。
難しい。

Comment thread docs/guide/user/usage.md Resolved
@qryxip
qryxip requested a review from Hiroshiba March 8, 2025 08:53

@Hiroshiba Hiroshiba left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!!

@qryxip
qryxip merged commit 108d569 into VOICEVOX:main Mar 8, 2025
@qryxip
qryxip deleted the pr/docs-finish-usage-md branch March 8, 2025 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants