Skip to main content

A python wrapper for sinsy

Project description

Pysinsy

PyPI Python package License

A python wrapper for https://github.com/r9y9/sinsy.

Please notice that the package is in an alpha state. APIs will subject to change.

Notice

The package is built with the modified version of sinsy. The modified version provides the same functionality with some improvements (e.g., cmake support) but is technically different from the one from HTS working group.

Build requirements

The python package relies on cython to make python bindings for sinsy. You must need the following tools to build and install pysinsy:

  • C/C++ compilers (to build C/C++ extentions)
  • cython

Supported platforms

  • Linux
  • Mac OSX
  • Windows (MSVC)

Installation

pip install pysinsy

Development

To build the package locally, you will need to make sure to clone sinsy.

git submodule update --recursive --init

and then run

pip install -e .

Quick demo

import pysinsy

sinsy = pysinsy.Sinsy()

# Set language to Japanese
assert sinsy.setLanguages("j", pysinsy.get_default_dic_dir())
assert sinsy.loadScoreFromMusicXML("./tests/song070_f00001_063.xml")

print("Mono labels:")
is_mono = True
labels = sinsy.createLabelData(is_mono, 1, 1).getData()
for l in labels[:5]:
    print(l)

print("\nFull-context labels:")
is_mono = False
labels = sinsy.createLabelData(is_mono, 1, 1).getData()
for l in labels[:5]:
    print(l)

sinsy.clearScore()

Output:

Mono labels:
0 10909090 sil
10909090 21818181 sil
21818181 32727272 sil
32727272 43636363 pau
43636363 47727272 g

Full-context labels:
0 10909090 s@xx^xx-sil+sil=sil_xx%xx^00_00~00-1!1[xx$xx]xx/A:xx-xx-xx@xx~xx/B:1_1_1@xx|xx/C:2+1+1@JPN&0/D:xx!xx#xx$xx%xx|xx&xx;xx-xx/E:xx]xx^0=2/4~110!1@109#48+xx]1$1|0[10&0]48=0^100~xx#xx_xx;xx$xx&xx%xx[xx|0]0-n^xx+xx~xx=xx@xx$xx!xx%xx#xx|xx|xx-xx&xx&xx+xx[xx;xx]xx;xx~xx~xx^xx^xx@xx[xx#xx=xx!xx~xx+xx!xx^xx/F:A4#9#0-2/4$110$1+40%18;xx/G:xx_xx/H:xx_xx/I:12_12/J:2~2@3
10909090 21818181 s@xx^sil-sil+sil=pau_xx%00^00_00~00-1!1[xx$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]xx/A:xx-xx-xx@xx~xx/B:2_1_1@JPN|0/C:1+1+1@JPN&0/D:xx!xx#xx$xx%xx|xx&xx;xx-xx/E:A4]9^0=2/4~110!1@40#18+xx]1$4|0[10&0]48=0^100~1#12_0;38$0&168%0[100|0]0-n^xx+xx~xx=xx@xx$xx!2%xx#5|xx|24-xx&xx&xx+xx[xx;xx]xx;xx~xx~xx^xx^xx@xx[xx#xx=xx!xx~xx+p0!xx^xx/F:A4#9#0-2/4$110$1+13%6;xx/G:xx_xx/H:12_12/I:11_11/J:2~2@3

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pysinsy-0.0.2.tar.gz (1.4 MB view details)

Uploaded Source

File details

Details for the file pysinsy-0.0.2.tar.gz.

File metadata

  • Download URL: pysinsy-0.0.2.tar.gz
  • Upload date:
  • Size: 1.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.8.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12

File hashes

Hashes for pysinsy-0.0.2.tar.gz
Algorithm Hash digest
SHA256 95127e744d2ce2341f5917e5e1f7fc7799210dedfe0d36d1b4d00d0686988dda
MD5 d5445eb86caeae3a58a9f6de71690968
BLAKE2b-256 f544dcef821ae7b34dc3968814d6a9fa27c948e710fe8b50e18c85d33fe0cb43

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page