hinase-toki 14.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. hinase_toki-14.2.2/.github/dependabot.yml +10 -0
  2. hinase_toki-14.2.2/.github/workflows/release.yml +55 -0
  3. hinase_toki-14.2.2/.github/workflows/test.yml +60 -0
  4. hinase_toki-14.2.2/.github/workflows/voice.yml +42 -0
  5. hinase_toki-14.2.2/.gitignore +15 -0
  6. hinase_toki-14.2.2/CHANGELOG.md +43 -0
  7. hinase_toki-14.2.2/LICENSE +21 -0
  8. hinase_toki-14.2.2/PKG-INFO +132 -0
  9. hinase_toki-14.2.2/README.md +66 -0
  10. hinase_toki-14.2.2/docs/baseline.md +9 -0
  11. hinase_toki-14.2.2/examples/curves.py +9 -0
  12. hinase_toki-14.2.2/examples/notes.py +17 -0
  13. hinase_toki-14.2.2/examples/plan.py +13 -0
  14. hinase_toki-14.2.2/examples/retake.py +9 -0
  15. hinase_toki-14.2.2/examples/score.txt +15 -0
  16. hinase_toki-14.2.2/examples/sing.py +11 -0
  17. hinase_toki-14.2.2/examples/song/lyrics.txt +2 -0
  18. hinase_toki-14.2.2/examples/song/score.txt +27 -0
  19. hinase_toki-14.2.2/examples/song/song.mid +0 -0
  20. hinase_toki-14.2.2/examples/song/song.yaml +9 -0
  21. hinase_toki-14.2.2/examples/ustx.py +8 -0
  22. hinase_toki-14.2.2/pyproject.toml +115 -0
  23. hinase_toki-14.2.2/src/hinase_toki/__init__.py +89 -0
  24. hinase_toki-14.2.2/src/hinase_toki/_audio.py +159 -0
  25. hinase_toki-14.2.2/src/hinase_toki/_curves.py +313 -0
  26. hinase_toki-14.2.2/src/hinase_toki/_lanes.py +70 -0
  27. hinase_toki-14.2.2/src/hinase_toki/_pitch.py +229 -0
  28. hinase_toki-14.2.2/src/hinase_toki/_project.py +101 -0
  29. hinase_toki-14.2.2/src/hinase_toki/_render.py +135 -0
  30. hinase_toki-14.2.2/src/hinase_toki/_repredict.py +72 -0
  31. hinase_toki-14.2.2/src/hinase_toki/_score.py +189 -0
  32. hinase_toki-14.2.2/src/hinase_toki/_score_io.py +77 -0
  33. hinase_toki-14.2.2/src/hinase_toki/_session.py +90 -0
  34. hinase_toki-14.2.2/src/hinase_toki/_text.py +181 -0
  35. hinase_toki-14.2.2/src/hinase_toki/_types.py +66 -0
  36. hinase_toki-14.2.2/src/hinase_toki/_ustx.py +212 -0
  37. hinase_toki-14.2.2/src/hinase_toki/_version.py +24 -0
  38. hinase_toki-14.2.2/src/hinase_toki/_voice.py +368 -0
  39. hinase_toki-14.2.2/src/hinase_toki/cli.py +220 -0
  40. hinase_toki-14.2.2/src/hinase_toki/data/dictionary-ja.txt +268 -0
  41. hinase_toki-14.2.2/src/hinase_toki/errors.py +45 -0
  42. hinase_toki-14.2.2/src/hinase_toki/export.py +85 -0
  43. hinase_toki-14.2.2/src/hinase_toki/hub.py +78 -0
  44. hinase_toki-14.2.2/src/hinase_toki/options.py +87 -0
  45. hinase_toki-14.2.2/src/hinase_toki/plan.py +268 -0
  46. hinase_toki-14.2.2/src/hinase_toki/py.typed +0 -0
  47. hinase_toki-14.2.2/src/hinase_toki/rules.py +134 -0
  48. hinase_toki-14.2.2/src/hinase_toki/score.py +350 -0
  49. hinase_toki-14.2.2/src/hinase_toki/song/__init__.py +13 -0
  50. hinase_toki-14.2.2/src/hinase_toki/song/_align.py +340 -0
  51. hinase_toki-14.2.2/src/hinase_toki/song/_band_flourish.py +213 -0
  52. hinase_toki-14.2.2/src/hinase_toki/song/_band_layers.py +185 -0
  53. hinase_toki-14.2.2/src/hinase_toki/song/_band_reading.py +163 -0
  54. hinase_toki-14.2.2/src/hinase_toki/song/_en.py +104 -0
  55. hinase_toki-14.2.2/src/hinase_toki/song/_fingerprint.py +14 -0
  56. hinase_toki-14.2.2/src/hinase_toki/song/_ja.py +201 -0
  57. hinase_toki-14.2.2/src/hinase_toki/song/_ko.py +118 -0
  58. hinase_toki-14.2.2/src/hinase_toki/song/_lang.py +161 -0
  59. hinase_toki-14.2.2/src/hinase_toki/song/_midi.py +150 -0
  60. hinase_toki-14.2.2/src/hinase_toki/song/_midi_lines.py +153 -0
  61. hinase_toki-14.2.2/src/hinase_toki/song/_paths.py +50 -0
  62. hinase_toki-14.2.2/src/hinase_toki/song/_run_finish.py +130 -0
  63. hinase_toki-14.2.2/src/hinase_toki/song/_run_prepare.py +69 -0
  64. hinase_toki-14.2.2/src/hinase_toki/song/_run_report.py +177 -0
  65. hinase_toki-14.2.2/src/hinase_toki/song/_run_steps.py +125 -0
  66. hinase_toki-14.2.2/src/hinase_toki/song/_runner_mix.py +153 -0
  67. hinase_toki-14.2.2/src/hinase_toki/song/_runner_prepare.py +181 -0
  68. hinase_toki-14.2.2/src/hinase_toki/song/_vocal_chain.py +134 -0
  69. hinase_toki-14.2.2/src/hinase_toki/song/arrange.py +84 -0
  70. hinase_toki-14.2.2/src/hinase_toki/song/assemble.py +297 -0
  71. hinase_toki-14.2.2/src/hinase_toki/song/auto_melody.py +133 -0
  72. hinase_toki-14.2.2/src/hinase_toki/song/backing_mix.py +380 -0
  73. hinase_toki-14.2.2/src/hinase_toki/song/band.py +269 -0
  74. hinase_toki-14.2.2/src/hinase_toki/song/band_mix.py +290 -0
  75. hinase_toki-14.2.2/src/hinase_toki/song/compare.py +158 -0
  76. hinase_toki-14.2.2/src/hinase_toki/song/corrector.py +400 -0
  77. hinase_toki-14.2.2/src/hinase_toki/song/harmony.py +70 -0
  78. hinase_toki-14.2.2/src/hinase_toki/song/harmony_part.py +71 -0
  79. hinase_toki-14.2.2/src/hinase_toki/song/hooks.py +14 -0
  80. hinase_toki-14.2.2/src/hinase_toki/song/judge.py +337 -0
  81. hinase_toki-14.2.2/src/hinase_toki/song/listen.py +185 -0
  82. hinase_toki-14.2.2/src/hinase_toki/song/master.py +126 -0
  83. hinase_toki-14.2.2/src/hinase_toki/song/measure.py +134 -0
  84. hinase_toki-14.2.2/src/hinase_toki/song/midi_cover.py +267 -0
  85. hinase_toki-14.2.2/src/hinase_toki/song/mix.py +186 -0
  86. hinase_toki-14.2.2/src/hinase_toki/song/natural.py +139 -0
  87. hinase_toki-14.2.2/src/hinase_toki/song/parts.py +215 -0
  88. hinase_toki-14.2.2/src/hinase_toki/song/piano_band.py +357 -0
  89. hinase_toki-14.2.2/src/hinase_toki/song/post.py +248 -0
  90. hinase_toki-14.2.2/src/hinase_toki/song/reference.py +197 -0
  91. hinase_toki-14.2.2/src/hinase_toki/song/run.py +390 -0
  92. hinase_toki-14.2.2/src/hinase_toki/song/runner.py +327 -0
  93. hinase_toki-14.2.2/src/hinase_toki/song/score.py +169 -0
  94. hinase_toki-14.2.2/src/hinase_toki/song/score_check.py +71 -0
  95. hinase_toki-14.2.2/src/hinase_toki/song/score_rules.py +23 -0
  96. hinase_toki-14.2.2/src/hinase_toki/song/search.py +246 -0
  97. hinase_toki-14.2.2/src/hinase_toki/song/sing_exact.py +302 -0
  98. hinase_toki-14.2.2/src/hinase_toki/song/spec.py +331 -0
  99. hinase_toki-14.2.2/src/hinase_toki/song/state.py +33 -0
  100. hinase_toki-14.2.2/src/hinase_toki/song/style.py +210 -0
  101. hinase_toki-14.2.2/src/hinase_toki/song/takes.py +164 -0
  102. hinase_toki-14.2.2/src/hinase_toki/song/tidy.py +122 -0
  103. hinase_toki-14.2.2/src/hinase_toki/song/ust_score.py +365 -0
  104. hinase_toki-14.2.2/src/hinase_toki/voice.py +321 -0
  105. hinase_toki-14.2.2/tests/_en.py +11 -0
  106. hinase_toki-14.2.2/tests/conftest.py +24 -0
  107. hinase_toki-14.2.2/tests/fakes.py +77 -0
  108. hinase_toki-14.2.2/tests/golden/a.sha256 +1 -0
  109. hinase_toki-14.2.2/tests/golden/a.txt +15 -0
  110. hinase_toki-14.2.2/tests/golden/b.sha256 +1 -0
  111. hinase_toki-14.2.2/tests/golden/b.txt +19 -0
  112. hinase_toki-14.2.2/tests/golden/c.sha256 +1 -0
  113. hinase_toki-14.2.2/tests/golden/c.txt +9 -0
  114. hinase_toki-14.2.2/tests/golden/toki.json +26 -0
  115. hinase_toki-14.2.2/tests/song/song_fakes.py +79 -0
  116. hinase_toki-14.2.2/tests/song/test_band.py +97 -0
  117. hinase_toki-14.2.2/tests/song/test_band_mix.py +231 -0
  118. hinase_toki-14.2.2/tests/song/test_corrector.py +163 -0
  119. hinase_toki-14.2.2/tests/song/test_cover.py +1071 -0
  120. hinase_toki-14.2.2/tests/song/test_cover_post.py +242 -0
  121. hinase_toki-14.2.2/tests/song/test_mix.py +200 -0
  122. hinase_toki-14.2.2/tests/song/test_parts.py +128 -0
  123. hinase_toki-14.2.2/tests/song/test_recipe.py +132 -0
  124. hinase_toki-14.2.2/tests/song/test_reference.py +113 -0
  125. hinase_toki-14.2.2/tests/song/test_review_fixes.py +247 -0
  126. hinase_toki-14.2.2/tests/song/test_runner.py +219 -0
  127. hinase_toki-14.2.2/tests/song/test_score.py +88 -0
  128. hinase_toki-14.2.2/tests/song/test_search.py +191 -0
  129. hinase_toki-14.2.2/tests/song/test_style.py +77 -0
  130. hinase_toki-14.2.2/tests/song/test_tempo.py +82 -0
  131. hinase_toki-14.2.2/tests/song/test_tools.py +192 -0
  132. hinase_toki-14.2.2/tests/test_api.py +151 -0
  133. hinase_toki-14.2.2/tests/test_cli.py +54 -0
  134. hinase_toki-14.2.2/tests/test_editing.py +100 -0
  135. hinase_toki-14.2.2/tests/test_engine.py +663 -0
  136. hinase_toki-14.2.2/tests/test_files.py +62 -0
  137. hinase_toki-14.2.2/tests/test_golden.py +39 -0
  138. hinase_toki-14.2.2/tests/test_hub.py +23 -0
  139. hinase_toki-14.2.2/tests/test_infra.py +106 -0
  140. hinase_toki-14.2.2/tests/test_meta.py +22 -0
  141. hinase_toki-14.2.2/tests/test_plan.py +62 -0
  142. hinase_toki-14.2.2/tests/test_rules.py +79 -0
  143. hinase_toki-14.2.2/tests/test_seeds.py +61 -0
  144. hinase_toki-14.2.2/tools/bench.py +56 -0
  145. hinase_toki-14.2.2/tools/forbidden.py +60 -0
  146. hinase_toki-14.2.2/tools/make_example_song.py +113 -0
  147. hinase_toki-14.2.2/tools/make_golden.py +46 -0
@@ -0,0 +1,10 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: github-actions
4
+ directory: /
5
+ schedule:
6
+ interval: monthly
7
+ - package-ecosystem: pip
8
+ directory: /
9
+ schedule:
10
+ interval: monthly
@@ -0,0 +1,55 @@
1
+ name: release
2
+ on:
3
+ push:
4
+ tags: ["v*"]
5
+ jobs:
6
+ test:
7
+ uses: ./.github/workflows/test.yml
8
+ build:
9
+ needs: test
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v5
13
+ with:
14
+ fetch-depth: 0
15
+ - uses: actions/setup-python@v6
16
+ with:
17
+ python-version: "3.12"
18
+ - run: pip install build
19
+ - run: python -m build
20
+ - uses: actions/upload-artifact@v5
21
+ with:
22
+ name: dist
23
+ path: dist/
24
+ api:
25
+ needs: test
26
+ runs-on: ubuntu-latest
27
+ steps:
28
+ - uses: actions/checkout@v5
29
+ with:
30
+ fetch-depth: 0
31
+ - uses: actions/setup-python@v6
32
+ with:
33
+ python-version: "3.12"
34
+ - run: pip install griffe
35
+ - name: No unannounced break of the public API since the last release
36
+ run: |
37
+ prev=$(git describe --tags --abbrev=0 "${GITHUB_REF_NAME}^" 2>/dev/null || true)
38
+ if [ -n "$prev" ]; then griffe check hinase_toki -s src -a "$prev"; else echo "first release"; fi
39
+ publish:
40
+ needs: [build, api]
41
+ runs-on: ubuntu-latest
42
+ environment: pypi
43
+ permissions:
44
+ id-token: write
45
+ attestations: write
46
+ contents: read
47
+ steps:
48
+ - uses: actions/download-artifact@v5
49
+ with:
50
+ name: dist
51
+ path: dist/
52
+ - uses: actions/attest-build-provenance@v1
53
+ with:
54
+ subject-path: dist/*
55
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,60 @@
1
+ name: test
2
+ on:
3
+ push:
4
+ branches: [main]
5
+ pull_request:
6
+ workflow_call:
7
+ jobs:
8
+ lint:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v5
12
+ - uses: actions/setup-python@v6
13
+ with:
14
+ python-version: "3.12"
15
+ cache: pip
16
+ - run: pip install -e ".[dev]"
17
+ - run: ruff check .
18
+ - run: ruff format --check .
19
+ - run: mypy
20
+ - run: python tools/forbidden.py .
21
+ test:
22
+ runs-on: ${{ matrix.os }}
23
+ strategy:
24
+ fail-fast: false
25
+ matrix:
26
+ os: [ubuntu-latest, macos-latest, windows-latest]
27
+ # pull requests: one Python per OS plus the oldest; main and releases: the full grid
28
+ python: ${{ fromJSON(github.event_name == 'pull_request' && '["3.12"]' || '["3.10", "3.11", "3.12", "3.13"]') }}
29
+ include:
30
+ - os: ubuntu-latest
31
+ python: "3.10"
32
+ steps:
33
+ - uses: actions/checkout@v5
34
+ with:
35
+ fetch-depth: 0
36
+ - uses: actions/setup-python@v6
37
+ with:
38
+ python-version: ${{ matrix.python }}
39
+ cache: pip
40
+ - run: pip install -e ".[dev,ja]"
41
+ - run: pytest --cov=hinase_toki --cov-report=term-missing
42
+ install:
43
+ runs-on: ubuntu-latest
44
+ steps:
45
+ - uses: actions/checkout@v5
46
+ with:
47
+ fetch-depth: 0
48
+ - uses: actions/setup-python@v6
49
+ with:
50
+ python-version: "3.12"
51
+ - name: Base install pulls no scipy or torch
52
+ run: |
53
+ python -m venv /tmp/v && /tmp/v/bin/pip install .
54
+ /tmp/v/bin/toki --help
55
+ ! /tmp/v/bin/pip list | grep -iE "^(scipy|torch) "
56
+ - name: The [song] extra pulls no torch or whisper
57
+ run: |
58
+ python -m venv /tmp/s && /tmp/s/bin/pip install ".[song]"
59
+ /tmp/s/bin/toki song explain > /dev/null
60
+ ! /tmp/s/bin/pip list | grep -iE "^(torch|faster-whisper|openai-whisper) "
@@ -0,0 +1,42 @@
1
+ name: voice
2
+ # Sings with the real voice from Hugging Face (cached): the examples, and a song through song making.
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ workflow_dispatch:
8
+ jobs:
9
+ sing:
10
+ runs-on: ubuntu-latest
11
+ env:
12
+ TOKI_HOME: ${{ github.workspace }}/.toki
13
+ steps:
14
+ - uses: actions/checkout@v5
15
+ with:
16
+ fetch-depth: 0
17
+ - uses: actions/setup-python@v6
18
+ with:
19
+ python-version: "3.12"
20
+ - uses: actions/cache@v4
21
+ with:
22
+ path: .toki
23
+ key: toki-voice-${{ hashFiles('src/hinase_toki/hub.py') }}
24
+ - run: pip install ".[song]"
25
+ - name: Download the voice
26
+ run: toki download latest
27
+ - name: Examples
28
+ working-directory: ${{ runner.temp }}
29
+ run: |
30
+ for e in sing notes curves plan retake ustx; do
31
+ (cd "$GITHUB_WORKSPACE" && python examples/$e.py) || exit 1
32
+ done
33
+ ls -la "$GITHUB_WORKSPACE"/*.wav
34
+ - name: CLI
35
+ run: |
36
+ toki sing examples/score.txt -o cli.wav --json
37
+ toki render song.ustx -o render.wav
38
+ - name: Song making (an original song, no extras)
39
+ run: |
40
+ cp -r examples/song /tmp/song
41
+ toki song /tmp/song/song.yaml --no-listen
42
+ ls /tmp/song/*_mix_*.wav
@@ -0,0 +1,15 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.egg-info/
4
+ dist/
5
+ build/
6
+ .coverage
7
+ .mypy_cache/
8
+ .ruff_cache/
9
+ .pytest_cache/
10
+ src/hinase_toki/_version.py
11
+ *.wav
12
+ !tests/data/*.wav
13
+ tests/golden/*.npy
14
+ .DS_Store
15
+ .hypothesis/
@@ -0,0 +1,43 @@
1
+ # Changelog
2
+
3
+ All notable changes are listed here ([Keep a Changelog](https://keepachangelog.com/en/1.1.0/), [SemVer](https://semver.org/)).
4
+
5
+ ## [Unreleased]
6
+
7
+ ## [14.2.2] - 2026-12-03
8
+
9
+ First release on PyPI (the v14.2.1 tag stopped at the API check and was never published).
10
+
11
+ ### Fixed
12
+ - `hinase_toki.song.band_mix.CHORD_SHAPES` is importable again (moved when the file was split).
13
+ - Song making without ffmpeg: the mix stays a WAV (with a warning) instead of failing at the MP3; WAV bands read
14
+ without ffmpeg.
15
+ - Windows: text files read and written as UTF-8; cached arrays closed before they are replaced.
16
+ - `song.yaml`: `listen: {enabled: ...}` and `harmony: {enabled: ...}` (YAML read a bare `on:` key as `true`); `on`
17
+ is still accepted.
18
+
19
+ ### Changed
20
+ - `hinase_toki.song` is type-checked; files over 400 lines split (no change in sound).
21
+
22
+ ## [14.2] - 2026-12-03
23
+
24
+ First release; the voice is Toki 1.4 (HinaseToki/toki-1.4).
25
+
26
+ ### Changed
27
+ - Sound: with exports whose graphs take their noise as an input (toki.json `noise_inputs`, HF tag `v14.0-n1`), a
28
+ phrase's noise comes from (seed, phrase, graph), so a take no longer depends on what was sung before it in the
29
+ process. The same seed sings differently from before. `hinase_toki.export` rewrites an export.
30
+
31
+ ### Added
32
+ - Files: tempo maps (`Score(tempo=[(beat, bpm), ...])`, `tempo: 140 at 32` in .txt), `.toki.yaml` projects
33
+ (lossless), OpenUtau `.ustx` read/write (PITD/DYN/BREC/VOIC/GENC/VELC curves), `Score.from_midi(..., lyrics=)`,
34
+ `toki render project.ustx|.toki.yaml`.
35
+ - Editing: note `phonemes` and `ph_len`, `vel`, `expr`, `vib_rate`, `vib_delay`, `vib_in`, `vib_out`, `port`; `Curve`
36
+ lanes over the song (`Score.curves`: pitch, dynamics, breathiness, voicing, gender, velocity, expr), applied after
37
+ the engine's shaping; `Score.phrase_seeds`; `Voice.info.controls` lists what a voice takes.
38
+ - Step by step: `Voice.plan` -> edit `Plan` / `PhrasePlan` (durations, pitch, curves) -> `Voice.replan` (keep pitch or
39
+ durations; masked re-prediction around kept frames) -> `Voice.render`; `Voice.acoustic`, `Voice.vocode`;
40
+ `Voice.retake(song, phrase=... | at=(a, b))` keeps every other sample and the song's level.
41
+ - `hinase_toki.load`, `Voice.sing`, `Score`, `Note`, `SingOptions`, `Song`: sing a score with a local export folder or a voice from Hugging Face.
42
+ - `toki sing`, `toki voices`, `toki download`.
43
+ - `hinase_toki.song`: song making (harmony, band, mix, master, the whole cover pipeline, `song.yaml`), `toki song`, `toki score`; the note-scoring aligner runs in numpy (weights: HinaseToki/toki-aligner).
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Hinase Toki Project
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,132 @@
1
+ Metadata-Version: 2.5
2
+ Name: hinase-toki
3
+ Version: 14.2.2
4
+ Summary: Hinase Toki: a Japanese singing voice (DiffSinger ONNX) as a Python library and CLI
5
+ Project-URL: Source, https://github.com/HinaseToki/hinase-toki
6
+ Project-URL: Issues, https://github.com/HinaseToki/hinase-toki/issues
7
+ Project-URL: Changelog, https://github.com/HinaseToki/hinase-toki/blob/main/CHANGELOG.md
8
+ Project-URL: Voice, https://huggingface.co/HinaseToki/toki-1.4
9
+ Author: Hinase Toki Project
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: diffsinger,onnx,singing-voice-synthesis,vocal
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: End Users/Desktop
16
+ Classifier: Natural Language :: Japanese
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Topic :: Multimedia :: Sound/Audio :: Sound Synthesis
24
+ Classifier: Typing :: Typed
25
+ Requires-Python: >=3.10
26
+ Requires-Dist: huggingface-hub>=0.23
27
+ Requires-Dist: mido>=1.3
28
+ Requires-Dist: numpy>=1.24
29
+ Requires-Dist: onnxruntime<2,>=1.17
30
+ Requires-Dist: pyyaml>=6
31
+ Provides-Extra: all
32
+ Requires-Dist: demucs>=4.0; extra == 'all'
33
+ Requires-Dist: faster-whisper>=1.0; extra == 'all'
34
+ Requires-Dist: pykakasi>=2.2; extra == 'all'
35
+ Requires-Dist: s3prl>=0.4; extra == 'all'
36
+ Requires-Dist: scipy>=1.10; extra == 'all'
37
+ Requires-Dist: torch>=2.1; extra == 'all'
38
+ Provides-Extra: dev
39
+ Requires-Dist: hypothesis>=6.100; extra == 'dev'
40
+ Requires-Dist: mypy>=1.11; extra == 'dev'
41
+ Requires-Dist: onnx>=1.15; extra == 'dev'
42
+ Requires-Dist: pykakasi>=2.2; extra == 'dev'
43
+ Requires-Dist: pytest-cov>=5; extra == 'dev'
44
+ Requires-Dist: pytest>=8; extra == 'dev'
45
+ Requires-Dist: ruff>=0.6; extra == 'dev'
46
+ Requires-Dist: scipy-stubs; extra == 'dev'
47
+ Requires-Dist: scipy>=1.10; extra == 'dev'
48
+ Requires-Dist: types-pyyaml; extra == 'dev'
49
+ Provides-Extra: export
50
+ Requires-Dist: onnx>=1.15; extra == 'export'
51
+ Provides-Extra: ja
52
+ Requires-Dist: pykakasi>=2.2; extra == 'ja'
53
+ Provides-Extra: judge
54
+ Requires-Dist: s3prl>=0.4; extra == 'judge'
55
+ Requires-Dist: scipy>=1.10; extra == 'judge'
56
+ Requires-Dist: torch>=2.1; extra == 'judge'
57
+ Provides-Extra: listen
58
+ Requires-Dist: faster-whisper>=1.0; extra == 'listen'
59
+ Requires-Dist: scipy>=1.10; extra == 'listen'
60
+ Provides-Extra: separate
61
+ Requires-Dist: demucs>=4.0; extra == 'separate'
62
+ Requires-Dist: scipy>=1.10; extra == 'separate'
63
+ Provides-Extra: song
64
+ Requires-Dist: scipy>=1.10; extra == 'song'
65
+ Description-Content-Type: text/markdown
66
+
67
+ # hinase-toki
68
+
69
+ Hinase Toki, a Japanese singing voice (DiffSinger, ONNX), as a Python library and a `toki` command.
70
+
71
+ ```bash
72
+ pip install hinase-toki # Python 3.10+; or the wheel of a GitHub release
73
+ ```
74
+
75
+ The voice: [HinaseToki/toki-1.4](https://huggingface.co/HinaseToki/toki-1.4) (also an OpenUtau voicebank).
76
+
77
+ ```python
78
+ import hinase_toki as toki
79
+
80
+ voice = toki.load("toki-1.4") # downloads the voice once (~490 MB)
81
+ score = toki.Score([toki.Note("か", "A4", 1), toki.Note("ぜ", "C5", 1, vib=0.3), toki.Note.rest(1)], tempo=120)
82
+ voice.sing(score).save("vocal.wav")
83
+ ```
84
+
85
+ ```bash
86
+ toki sing score.txt -o vocal.wav --tempo 120
87
+ ```
88
+
89
+ Score file: one note per line, `lyric NOTE beats [key=value ...]`, rests `- 0 beats`, optional `tempo: 120`.
90
+ Lyrics are hiragana, katakana or Korean spelling of Japanese.
91
+
92
+ ## Editing
93
+
94
+ ```python
95
+ n = toki.Note("ら", "C5", 2, vib=0.3, vib_rate=5.5, port=0.08, expr=1.2) # note expressions
96
+ toki.Note("x", "A4", 1, phonemes=["k", "a"], ph_len=[0.06, None]) # phonemes and their lengths
97
+ score.curves["pitch"] = toki.Curve([(12.0, 0), (12.4, 80), (12.8, 0)], unit="cents") # lanes over the song
98
+ score.phrase_seeds = {3: 9}
99
+
100
+ plan = voice.plan(score) # phoneme lengths, pitch, voice curves per phrase (numpy, editable)
101
+ plan.phrases[3].pitch[120:160] += 0.5
102
+ plan = voice.replan(plan, keep="pitch", seed=7)
103
+ song = voice.render(plan)
104
+ song = voice.retake(song, phrase=3, seed=11) # or at=(32.0, 34.5): only that stretch predicted again
105
+ ```
106
+
107
+ Lanes: pitch, dynamics, breathiness, voicing, gender, velocity, expr (`voice.info.controls` lists what a voice takes).
108
+
109
+ ## Files
110
+
111
+ `Score.load` / `save`: `.txt`, `.toki.yaml` (a whole project), `.ustx` (OpenUtau), `.mid` with `lyrics=`.
112
+ `toki render song.ustx -o vocal.wav` sings an OpenUtau project with the recommended settings.
113
+ Tempo maps: `Score(notes, tempo=[(0, 120), (32, 140)])`.
114
+
115
+ ## Song making
116
+
117
+ ```bash
118
+ pip install "hinase-toki[song]"
119
+ toki song examples/song/song.yaml # harmony, a band from the MIDI, takes chosen, mixed and mastered
120
+ toki song explain # every song.yaml setting and its default
121
+ ```
122
+
123
+ Extras: `[listen]` (Whisper hears the takes), `[judge]` (SingMOS naturalness), `[separate]` (Demucs), `[all]`.
124
+ A soundfont band needs FluidSynth and a `.sf2`; reading other audio and MP3 output need ffmpeg.
125
+
126
+ ## Examples
127
+
128
+ `examples/`: `sing.py`, `notes.py`, `curves.py`, `plan.py`, `retake.py`, `ustx.py`, and `song/` (song making).
129
+
130
+ ## License
131
+
132
+ Code: MIT. The voice model: CC BY-NC-SA 4.0 (non-commercial, credit "Hinase Toki").
@@ -0,0 +1,66 @@
1
+ # hinase-toki
2
+
3
+ Hinase Toki, a Japanese singing voice (DiffSinger, ONNX), as a Python library and a `toki` command.
4
+
5
+ ```bash
6
+ pip install hinase-toki # Python 3.10+; or the wheel of a GitHub release
7
+ ```
8
+
9
+ The voice: [HinaseToki/toki-1.4](https://huggingface.co/HinaseToki/toki-1.4) (also an OpenUtau voicebank).
10
+
11
+ ```python
12
+ import hinase_toki as toki
13
+
14
+ voice = toki.load("toki-1.4") # downloads the voice once (~490 MB)
15
+ score = toki.Score([toki.Note("か", "A4", 1), toki.Note("ぜ", "C5", 1, vib=0.3), toki.Note.rest(1)], tempo=120)
16
+ voice.sing(score).save("vocal.wav")
17
+ ```
18
+
19
+ ```bash
20
+ toki sing score.txt -o vocal.wav --tempo 120
21
+ ```
22
+
23
+ Score file: one note per line, `lyric NOTE beats [key=value ...]`, rests `- 0 beats`, optional `tempo: 120`.
24
+ Lyrics are hiragana, katakana or Korean spelling of Japanese.
25
+
26
+ ## Editing
27
+
28
+ ```python
29
+ n = toki.Note("ら", "C5", 2, vib=0.3, vib_rate=5.5, port=0.08, expr=1.2) # note expressions
30
+ toki.Note("x", "A4", 1, phonemes=["k", "a"], ph_len=[0.06, None]) # phonemes and their lengths
31
+ score.curves["pitch"] = toki.Curve([(12.0, 0), (12.4, 80), (12.8, 0)], unit="cents") # lanes over the song
32
+ score.phrase_seeds = {3: 9}
33
+
34
+ plan = voice.plan(score) # phoneme lengths, pitch, voice curves per phrase (numpy, editable)
35
+ plan.phrases[3].pitch[120:160] += 0.5
36
+ plan = voice.replan(plan, keep="pitch", seed=7)
37
+ song = voice.render(plan)
38
+ song = voice.retake(song, phrase=3, seed=11) # or at=(32.0, 34.5): only that stretch predicted again
39
+ ```
40
+
41
+ Lanes: pitch, dynamics, breathiness, voicing, gender, velocity, expr (`voice.info.controls` lists what a voice takes).
42
+
43
+ ## Files
44
+
45
+ `Score.load` / `save`: `.txt`, `.toki.yaml` (a whole project), `.ustx` (OpenUtau), `.mid` with `lyrics=`.
46
+ `toki render song.ustx -o vocal.wav` sings an OpenUtau project with the recommended settings.
47
+ Tempo maps: `Score(notes, tempo=[(0, 120), (32, 140)])`.
48
+
49
+ ## Song making
50
+
51
+ ```bash
52
+ pip install "hinase-toki[song]"
53
+ toki song examples/song/song.yaml # harmony, a band from the MIDI, takes chosen, mixed and mastered
54
+ toki song explain # every song.yaml setting and its default
55
+ ```
56
+
57
+ Extras: `[listen]` (Whisper hears the takes), `[judge]` (SingMOS naturalness), `[separate]` (Demucs), `[all]`.
58
+ A soundfont band needs FluidSynth and a `.sf2`; reading other audio and MP3 output need ffmpeg.
59
+
60
+ ## Examples
61
+
62
+ `examples/`: `sing.py`, `notes.py`, `curves.py`, `plan.py`, `retake.py`, `ustx.py`, and `song/` (song making).
63
+
64
+ ## License
65
+
66
+ Code: MIT. The voice model: CC BY-NC-SA 4.0 (non-commercial, credit "Hinase Toki").
@@ -0,0 +1,9 @@
1
+ # Speed baseline
2
+
3
+ `python tools/bench.py <export>`: score `tests/golden/a.txt` three times (24.9 s of singing), toki-1.4 (jamerge2d), steps 40 / vsteps 20, CPU.
4
+
5
+ | date | machine | python | RTF | first call | peak RSS |
6
+ |---|---|---|---|---|---|
7
+ | 2026-12-03 | Apple M-series, macOS (arm64) | 3.14 | 0.79 | 2.5 s | 829 MB |
8
+
9
+ RTF = time to sing ÷ length sung (below 1 is faster than real time). Target: at most 1.0 on an M-series Mac CPU.
@@ -0,0 +1,9 @@
1
+ """Curves over the song: a pitch bend, more breath at the end, a brighter voice throughout."""
2
+
3
+ import hinase_toki as toki
4
+
5
+ score = toki.Score.load("examples/score.txt")
6
+ score.curves["pitch"] = toki.Curve([(2.0, 0), (2.3, 60), (2.6, 0)], unit="cents")
7
+ score.curves["breathiness"] = toki.Curve([(6.0, 0), (9.0, 6)], unit="dB")
8
+ score.curves["gender"] = toki.Curve([(0.0, 0.15)], mode="replace")
9
+ toki.load("toki-1.4").sing(score).save("curves.wav")
@@ -0,0 +1,17 @@
1
+ """A score written in code, with per-note expression and a phoneme spelled out."""
2
+
3
+ import hinase_toki as toki
4
+
5
+ score = toki.Score(
6
+ [
7
+ toki.Note("そ", "C5", 1, scoop=0.5),
8
+ toki.Note("ら", "B4", 0.5, port=0.06),
9
+ toki.Note("に", "A4", 2.5, vib=0.3, vib_rate=5.5, vib_delay=0.4),
10
+ toki.Note.rest(1),
11
+ toki.Note("ひ", "E4", 0.5, br=3), # breathier
12
+ toki.Note("x", "G4", 0.5, phonemes=["k", "a"], ph_len=[0.08, None]), # sung "ka", a long k
13
+ toki.Note("り", "A4", 3, flat=1, dyn=-2),
14
+ ],
15
+ tempo=110,
16
+ )
17
+ toki.load("toki-1.4").sing(score, rules=False).save("notes.wav")
@@ -0,0 +1,13 @@
1
+ """Step by step: look at what the model predicted, change it, sing it."""
2
+
3
+ import hinase_toki as toki
4
+
5
+ voice = toki.load("toki-1.4")
6
+ plan = voice.plan(toki.Score.load("examples/score.txt"))
7
+ for p in plan:
8
+ print(p.index, f"{p.start:.2f}s", " ".join(p.phonemes[1:-1]))
9
+ first = plan.phrases[0]
10
+ first.pitch[60:120] += 0.5 # half a semitone up for a while
11
+ first.durations[2] += 6 # a longer third phoneme (the curves follow)
12
+ plan = voice.replan(plan, keep="pitch", seed=7)
13
+ voice.render(plan).save("plan.wav")
@@ -0,0 +1,9 @@
1
+ """Sing again only what you do not like: one phrase, or a stretch of seconds."""
2
+
3
+ import hinase_toki as toki
4
+
5
+ voice = toki.load("toki-1.4")
6
+ song = voice.sing(toki.Score.load("examples/score.txt"), seed=1)
7
+ song = voice.retake(song, phrase=1, seed=5) # the second phrase with another take
8
+ song = voice.retake(song, at=(1.0, 1.6), seed=9) # only these 0.6 s predicted again
9
+ song.save("retake.wav")
@@ -0,0 +1,15 @@
1
+ tempo: 110
2
+ - 0 1
3
+ あ A4 1
4
+ お G4 0.5
5
+ い A4 0.5
6
+ そ C5 1
7
+ ら B4 0.5
8
+ に A4 2.5
9
+ - 0 1
10
+ ひ E4 0.5
11
+ か G4 0.5
12
+ り A4 1
13
+ が C5 0.5
14
+ ふ B4 0.5
15
+ る A4 3
@@ -0,0 +1,11 @@
1
+ """Sing a score file: python examples/sing.py [score.txt] [out.wav]"""
2
+
3
+ import sys
4
+ from pathlib import Path
5
+
6
+ import hinase_toki as toki
7
+
8
+ here = Path(__file__).parent
9
+ score = toki.Score.load(sys.argv[1] if len(sys.argv) > 1 else here / "score.txt")
10
+ voice = toki.load("toki-1.4")
11
+ print(voice.sing(score).save(sys.argv[2] if len(sys.argv) > 2 else "vocal.wav"))
@@ -0,0 +1,2 @@
1
+ あおいそらに ひかりがふる
2
+ てをのばせば とどくよう
@@ -0,0 +1,27 @@
1
+ tempo: 112
2
+ あ A4 1
3
+ お G4 0.5
4
+ い A4 0.5
5
+ そ C5 1
6
+ ら B4 0.5
7
+ に A4 1.5
8
+ - 0 3
9
+ ひ E4 0.5
10
+ か G4 0.5
11
+ り A4 1
12
+ が C5 0.5
13
+ ふ B4 0.5
14
+ る A4 3
15
+ - 0 2
16
+ て C5 1
17
+ を D5 0.5
18
+ の E5 0.5
19
+ ば D5 1
20
+ せ C5 1
21
+ ば B4 1
22
+ - 0 3
23
+ と A4 0.5
24
+ ど B4 0.5
25
+ く C5 1
26
+ よ B4 1
27
+ う A4 4
@@ -0,0 +1,9 @@
1
+ # an original song: `toki song examples/song/song.yaml` sings it with harmony, a MIDI band and a mix
2
+ name: example
3
+ score: score.txt
4
+ tempo: 112
5
+ midi: song.mid
6
+ melody_track: 1
7
+ lyrics: lyrics.txt
8
+ band: {source: synth}
9
+ takes: {seeds: [1, 2], again: [], retake: {rounds: 0}}
@@ -0,0 +1,8 @@
1
+ """OpenUtau round trip: write a .ustx to edit in OpenUtau, read it back and sing it with the library."""
2
+
3
+ import hinase_toki as toki
4
+
5
+ score = toki.Score.load("examples/score.txt")
6
+ score.save("song.ustx") # open in OpenUtau, edit, save
7
+ again = toki.Score.load("song.ustx")
8
+ toki.load("toki-1.4").sing(again).save("ustx.wav") # or: toki render song.ustx -o ustx.wav