teslasynth 0.4.3__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.
- teslasynth-0.4.3/.envrc +1 -0
- teslasynth-0.4.3/CMakeLists.txt +56 -0
- teslasynth-0.4.3/PKG-INFO +12 -0
- teslasynth-0.4.3/flake.lock +125 -0
- teslasynth-0.4.3/flake.nix +67 -0
- teslasynth-0.4.3/pyproject.toml +62 -0
- teslasynth-0.4.3/src/bindings.cpp +485 -0
- teslasynth-0.4.3/teslasynth/__init__.py +52 -0
- teslasynth-0.4.3/teslasynth/__main__.py +314 -0
- teslasynth-0.4.3/teslasynth/_types.py +95 -0
- teslasynth-0.4.3/teslasynth/config.py +171 -0
- teslasynth-0.4.3/teslasynth/midi.py +194 -0
- teslasynth-0.4.3/teslasynth/plot.py +538 -0
- teslasynth-0.4.3/teslasynth/render.py +191 -0
- teslasynth-0.4.3/teslasynth/wav.py +74 -0
- teslasynth-0.4.3/tests/__init__.py +0 -0
- teslasynth-0.4.3/tests/conftest.py +79 -0
- teslasynth-0.4.3/tests/test_bindings.py +522 -0
- teslasynth-0.4.3/tests/test_config.py +131 -0
- teslasynth-0.4.3/tests/test_midi.py +134 -0
- teslasynth-0.4.3/tests/test_plot_helpers.py +102 -0
- teslasynth-0.4.3/tests/test_recording.py +59 -0
- teslasynth-0.4.3/uv.lock +4400 -0
teslasynth-0.4.3/.envrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
use flake
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.15)
|
|
2
|
+
project(teslasynth)
|
|
3
|
+
|
|
4
|
+
find_package(Python 3.8 COMPONENTS Interpreter Development.Module REQUIRED)
|
|
5
|
+
|
|
6
|
+
find_package(Git QUIET)
|
|
7
|
+
if(Git_FOUND)
|
|
8
|
+
execute_process(
|
|
9
|
+
COMMAND ${GIT_EXECUTABLE} describe --tags --always --dirty
|
|
10
|
+
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
11
|
+
OUTPUT_VARIABLE TESLASYNTH_VERSION
|
|
12
|
+
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
13
|
+
ERROR_QUIET
|
|
14
|
+
)
|
|
15
|
+
endif()
|
|
16
|
+
if(NOT TESLASYNTH_VERSION OR TESLASYNTH_VERSION STREQUAL "")
|
|
17
|
+
set(TESLASYNTH_VERSION "unknown")
|
|
18
|
+
endif()
|
|
19
|
+
|
|
20
|
+
# Ask the active Python where nanobind installed its cmake files.
|
|
21
|
+
# This works regardless of whether nanobind is in a venv, nix store, or site-packages.
|
|
22
|
+
execute_process(
|
|
23
|
+
COMMAND "${Python_EXECUTABLE}" -m nanobind --cmake_dir
|
|
24
|
+
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
25
|
+
OUTPUT_VARIABLE NB_CMAKE_DIR
|
|
26
|
+
)
|
|
27
|
+
find_package(nanobind CONFIG REQUIRED HINTS ${NB_CMAKE_DIR})
|
|
28
|
+
|
|
29
|
+
set(LIB_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../lib")
|
|
30
|
+
|
|
31
|
+
nanobind_add_module(
|
|
32
|
+
_teslasynth
|
|
33
|
+
src/bindings.cpp
|
|
34
|
+
${LIB_DIR}/synthesizer/curve.cpp
|
|
35
|
+
${LIB_DIR}/synthesizer/lfo.cpp
|
|
36
|
+
${LIB_DIR}/synthesizer/voice_event.cpp
|
|
37
|
+
${LIB_DIR}/synthesizer/voices/note.cpp
|
|
38
|
+
${LIB_DIR}/synthesizer/voices/hit.cpp
|
|
39
|
+
${LIB_DIR}/teslasynth/config_parser.cpp
|
|
40
|
+
${LIB_DIR}/teslasynth/config_patch_update.cpp
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
target_include_directories(_teslasynth PRIVATE
|
|
44
|
+
${LIB_DIR}
|
|
45
|
+
${LIB_DIR}/synthesizer
|
|
46
|
+
${LIB_DIR}/teslasynth
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
target_compile_features(_teslasynth PRIVATE cxx_std_20)
|
|
50
|
+
target_compile_definitions(_teslasynth PRIVATE
|
|
51
|
+
TESLASYNTH_VERSION="${TESLASYNTH_VERSION}"
|
|
52
|
+
TESLASYNTH_BUILD_DATE=__DATE__
|
|
53
|
+
TESLASYNTH_BUILD_TIME=__TIME__
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
install(TARGETS _teslasynth LIBRARY DESTINATION teslasynth)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: teslasynth
|
|
3
|
+
Version: 0.4.3
|
|
4
|
+
Summary: Python bindings and analysis tools for the teslasynth firmware
|
|
5
|
+
Requires-Python: >=3.8
|
|
6
|
+
Requires-Dist: numpy>=1.21
|
|
7
|
+
Requires-Dist: mido>=1.3
|
|
8
|
+
Provides-Extra: plot
|
|
9
|
+
Requires-Dist: plotly>=5.0; extra == "plot"
|
|
10
|
+
Provides-Extra: wav
|
|
11
|
+
Requires-Dist: scipy>=1.7; extra == "wav"
|
|
12
|
+
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
{
|
|
2
|
+
"nodes": {
|
|
3
|
+
"flake-utils": {
|
|
4
|
+
"inputs": {
|
|
5
|
+
"systems": "systems"
|
|
6
|
+
},
|
|
7
|
+
"locked": {
|
|
8
|
+
"lastModified": 1731533236,
|
|
9
|
+
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
|
10
|
+
"owner": "numtide",
|
|
11
|
+
"repo": "flake-utils",
|
|
12
|
+
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
|
13
|
+
"type": "github"
|
|
14
|
+
},
|
|
15
|
+
"original": {
|
|
16
|
+
"owner": "numtide",
|
|
17
|
+
"repo": "flake-utils",
|
|
18
|
+
"type": "github"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"nixpkgs": {
|
|
22
|
+
"locked": {
|
|
23
|
+
"lastModified": 1776169885,
|
|
24
|
+
"narHash": "sha256-l/iNYDZ4bGOAFQY2q8y5OAfBBtrDAaPuRQqWaFHVRXM=",
|
|
25
|
+
"owner": "NixOS",
|
|
26
|
+
"repo": "nixpkgs",
|
|
27
|
+
"rev": "4bd9165a9165d7b5e33ae57f3eecbcb28fb231c9",
|
|
28
|
+
"type": "github"
|
|
29
|
+
},
|
|
30
|
+
"original": {
|
|
31
|
+
"owner": "NixOS",
|
|
32
|
+
"ref": "nixos-unstable",
|
|
33
|
+
"repo": "nixpkgs",
|
|
34
|
+
"type": "github"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"pyproject-nix": {
|
|
38
|
+
"inputs": {
|
|
39
|
+
"nixpkgs": [
|
|
40
|
+
"nixpkgs"
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
"locked": {
|
|
44
|
+
"lastModified": 1776317425,
|
|
45
|
+
"narHash": "sha256-5iPq7MxKwAhKu76uGkRo/7RWfu9GCtsMdeacetTFINI=",
|
|
46
|
+
"owner": "pyproject-nix",
|
|
47
|
+
"repo": "pyproject.nix",
|
|
48
|
+
"rev": "1b0021e93fa281f694510321514731086dbedd13",
|
|
49
|
+
"type": "github"
|
|
50
|
+
},
|
|
51
|
+
"original": {
|
|
52
|
+
"owner": "pyproject-nix",
|
|
53
|
+
"repo": "pyproject.nix",
|
|
54
|
+
"type": "github"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"pyproject-nix_2": {
|
|
58
|
+
"inputs": {
|
|
59
|
+
"nixpkgs": [
|
|
60
|
+
"uv2nix",
|
|
61
|
+
"nixpkgs"
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
"locked": {
|
|
65
|
+
"lastModified": 1776317425,
|
|
66
|
+
"narHash": "sha256-5iPq7MxKwAhKu76uGkRo/7RWfu9GCtsMdeacetTFINI=",
|
|
67
|
+
"owner": "pyproject-nix",
|
|
68
|
+
"repo": "pyproject.nix",
|
|
69
|
+
"rev": "1b0021e93fa281f694510321514731086dbedd13",
|
|
70
|
+
"type": "github"
|
|
71
|
+
},
|
|
72
|
+
"original": {
|
|
73
|
+
"owner": "pyproject-nix",
|
|
74
|
+
"repo": "pyproject.nix",
|
|
75
|
+
"type": "github"
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"root": {
|
|
79
|
+
"inputs": {
|
|
80
|
+
"flake-utils": "flake-utils",
|
|
81
|
+
"nixpkgs": "nixpkgs",
|
|
82
|
+
"pyproject-nix": "pyproject-nix",
|
|
83
|
+
"uv2nix": "uv2nix"
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"systems": {
|
|
87
|
+
"locked": {
|
|
88
|
+
"lastModified": 1681028828,
|
|
89
|
+
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
|
90
|
+
"owner": "nix-systems",
|
|
91
|
+
"repo": "default",
|
|
92
|
+
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
|
93
|
+
"type": "github"
|
|
94
|
+
},
|
|
95
|
+
"original": {
|
|
96
|
+
"owner": "nix-systems",
|
|
97
|
+
"repo": "default",
|
|
98
|
+
"type": "github"
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
"uv2nix": {
|
|
102
|
+
"inputs": {
|
|
103
|
+
"nixpkgs": [
|
|
104
|
+
"nixpkgs"
|
|
105
|
+
],
|
|
106
|
+
"pyproject-nix": "pyproject-nix_2"
|
|
107
|
+
},
|
|
108
|
+
"locked": {
|
|
109
|
+
"lastModified": 1776317509,
|
|
110
|
+
"narHash": "sha256-nSriomT9IJvyVY/mzyFz4Un6DHSjCfrVitcIfV+VHnY=",
|
|
111
|
+
"owner": "pyproject-nix",
|
|
112
|
+
"repo": "uv2nix",
|
|
113
|
+
"rev": "56cfeb9813150e1f900f13e4d6fe46e2845f82d5",
|
|
114
|
+
"type": "github"
|
|
115
|
+
},
|
|
116
|
+
"original": {
|
|
117
|
+
"owner": "pyproject-nix",
|
|
118
|
+
"repo": "uv2nix",
|
|
119
|
+
"type": "github"
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
"root": "root",
|
|
124
|
+
"version": 7
|
|
125
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
description = "teslasynth Python package dev environment";
|
|
3
|
+
|
|
4
|
+
inputs = {
|
|
5
|
+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
6
|
+
flake-utils.url = "github:numtide/flake-utils";
|
|
7
|
+
uv2nix = {
|
|
8
|
+
url = "github:pyproject-nix/uv2nix";
|
|
9
|
+
inputs.nixpkgs.follows = "nixpkgs";
|
|
10
|
+
};
|
|
11
|
+
pyproject-nix = {
|
|
12
|
+
url = "github:pyproject-nix/pyproject.nix";
|
|
13
|
+
inputs.nixpkgs.follows = "nixpkgs";
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
outputs =
|
|
18
|
+
{
|
|
19
|
+
nixpkgs,
|
|
20
|
+
flake-utils,
|
|
21
|
+
...
|
|
22
|
+
}:
|
|
23
|
+
flake-utils.lib.eachDefaultSystem (
|
|
24
|
+
system:
|
|
25
|
+
let
|
|
26
|
+
pkgs = nixpkgs.legacyPackages.${system};
|
|
27
|
+
python = pkgs.python3;
|
|
28
|
+
in
|
|
29
|
+
{
|
|
30
|
+
devShells.default = pkgs.mkShell {
|
|
31
|
+
packages = [
|
|
32
|
+
# uv manages the .venv and Python deps
|
|
33
|
+
pkgs.uv
|
|
34
|
+
|
|
35
|
+
# Native build tools for the C++ extension
|
|
36
|
+
pkgs.cmake
|
|
37
|
+
pkgs.ninja
|
|
38
|
+
pkgs.gcc
|
|
39
|
+
|
|
40
|
+
# Python interpreter (uv will use this via UV_PYTHON)
|
|
41
|
+
python
|
|
42
|
+
|
|
43
|
+
# Build backend + nanobind must be importable during the C++ build.
|
|
44
|
+
# With --no-build-isolation, uv skips the isolated build env and
|
|
45
|
+
# uses whatever is already in the shell instead.
|
|
46
|
+
python.pkgs.scikit-build-core
|
|
47
|
+
python.pkgs.nanobind
|
|
48
|
+
python.pkgs.setuptools-scm
|
|
49
|
+
];
|
|
50
|
+
|
|
51
|
+
env = {
|
|
52
|
+
# Tell uv which Python to use so the .venv matches the nix one.
|
|
53
|
+
UV_PYTHON = python.interpreter;
|
|
54
|
+
UV_NO_BUILD_ISOLATION = "1";
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
shellHook = ''
|
|
58
|
+
echo "teslasynth dev environment"
|
|
59
|
+
uv sync --group dev
|
|
60
|
+
. .venv/bin/activate
|
|
61
|
+
export PATH="${pkgs.ruff}/bin:$PATH"
|
|
62
|
+
'';
|
|
63
|
+
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["scikit-build-core>=0.9", "nanobind>=2.0", "setuptools_scm>=8"]
|
|
3
|
+
build-backend = "scikit_build_core.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "teslasynth"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "Python bindings and analysis tools for the teslasynth firmware"
|
|
9
|
+
requires-python = ">=3.8"
|
|
10
|
+
dependencies = [
|
|
11
|
+
"numpy>=1.21",
|
|
12
|
+
"mido>=1.3",
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
[project.optional-dependencies]
|
|
16
|
+
plot = ["plotly>=5.0"]
|
|
17
|
+
wav = ["scipy>=1.7"]
|
|
18
|
+
|
|
19
|
+
[dependency-groups]
|
|
20
|
+
dev = ["plotly>=5.0", "scipy>=1.7", "jupyter", "pytest>=8.0"]
|
|
21
|
+
|
|
22
|
+
[project.scripts]
|
|
23
|
+
teslasynth = "teslasynth.__main__:main"
|
|
24
|
+
|
|
25
|
+
[tool.scikit-build]
|
|
26
|
+
cmake.build-type = "Release"
|
|
27
|
+
wheel.packages = ["teslasynth"]
|
|
28
|
+
metadata.version.provider = "scikit_build_core.metadata.setuptools_scm"
|
|
29
|
+
|
|
30
|
+
[tool.setuptools_scm]
|
|
31
|
+
root = ".."
|
|
32
|
+
fallback_version = "0.0.0.dev0"
|
|
33
|
+
|
|
34
|
+
[tool.uv.extra-build-dependencies]
|
|
35
|
+
teslasynth = ["setuptools_scm>=8"]
|
|
36
|
+
|
|
37
|
+
[tool.pytest.ini_options]
|
|
38
|
+
testpaths = ["tests"]
|
|
39
|
+
|
|
40
|
+
# ── cibuildwheel ──────────────────────────────────────────────────────────────
|
|
41
|
+
# Run from repo root with: cibuildwheel --package-dir python
|
|
42
|
+
# The full checkout is available so CMakeLists.txt can reach ../lib naturally.
|
|
43
|
+
[tool.cibuildwheel]
|
|
44
|
+
build = ["cp39-*", "cp310-*", "cp311-*", "cp312-*", "cp313-*"]
|
|
45
|
+
# 32-bit and musl targets are not worth the effort for this library
|
|
46
|
+
skip = ["*-win32", "*-manylinux_i686", "*-musllinux*"]
|
|
47
|
+
# After installing the wheel, run the test suite
|
|
48
|
+
test-requires = ["pytest>=8.0", "mido>=1.3"]
|
|
49
|
+
test-command = "pytest {package}/tests -v --tb=short"
|
|
50
|
+
|
|
51
|
+
[tool.cibuildwheel.linux]
|
|
52
|
+
archs = ["x86_64", "aarch64"]
|
|
53
|
+
# manylinux_2_28 ships GCC 11 → full C++17 support required by nanobind
|
|
54
|
+
manylinux-x86_64-image = "manylinux_2_28"
|
|
55
|
+
manylinux-aarch64-image = "manylinux_2_28"
|
|
56
|
+
|
|
57
|
+
[tool.cibuildwheel.macos]
|
|
58
|
+
archs = ["x86_64", "arm64"]
|
|
59
|
+
environment = {MACOSX_DEPLOYMENT_TARGET = "10.13"}
|
|
60
|
+
|
|
61
|
+
[tool.cibuildwheel.windows]
|
|
62
|
+
archs = ["AMD64"]
|