sointu/examples/code/Python
Alexander Kraus 94589eb2eb
feat(examples): add example playing sointu tracks from Python (#108)
* Added Python code example.
* Added pyinstaller build.
* Clarified debugging steps in README.md.
* Added linux implementation.
* Cosmetics.
* Updated README with correct steps.
2023-10-11 09:37:00 +03:00
..
sointu_python feat(examples): add example playing sointu tracks from Python (#108) 2023-10-11 09:37:00 +03:00
.gitignore feat(examples): add example playing sointu tracks from Python (#108) 2023-10-11 09:37:00 +03:00
build.py feat(examples): add example playing sointu tracks from Python (#108) 2023-10-11 09:37:00 +03:00
poetry.lock feat(examples): add example playing sointu tracks from Python (#108) 2023-10-11 09:37:00 +03:00
pyproject.toml feat(examples): add example playing sointu tracks from Python (#108) 2023-10-11 09:37:00 +03:00
README.md feat(examples): add example playing sointu tracks from Python (#108) 2023-10-11 09:37:00 +03:00
sointu.c feat(examples): add example playing sointu tracks from Python (#108) 2023-10-11 09:37:00 +03:00

Embed Sointu in Python

This is an example for embedding Sointu into Python code.

Configure the track

Edit the track variable in build.py according to your needs.

Build

  • Install Python 3.11 and poetry.
  • Download nasm and golang; place both of them in your system PATH.
  • Enable cgo by downloading a gcc and placing it into your system PATH.
  • Get the dependencies with poetry install.
  • Run the player using poetry run python -m sointu_python.
  • Pack everything into an executable using poetry run pyinstaller sointu_python/sointu_python.spec. The executable will be built in the dist subfolder.

Rebuild after changes

  • Rebuild the example track bindings with poetry build.
  • Update the bindings module with poetry install.
  • Proceed iteration.