didgelab 3.0__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.
- didgelab-3.0/PKG-INFO +240 -0
- didgelab-3.0/README.md +222 -0
- didgelab-3.0/pyproject.toml +35 -0
- didgelab-3.0/setup.cfg +4 -0
- didgelab-3.0/setup.py +21 -0
- didgelab-3.0/src/didgelab/__init__.py +106 -0
- didgelab-3.0/src/didgelab/acoustical_simulation.py +388 -0
- didgelab-3.0/src/didgelab/analysis.py +314 -0
- didgelab-3.0/src/didgelab/app.py +184 -0
- didgelab-3.0/src/didgelab/conv.py +136 -0
- didgelab-3.0/src/didgelab/evo/__init__.py +39 -0
- didgelab-3.0/src/didgelab/evo/__main__.py +27 -0
- didgelab-3.0/src/didgelab/evo/callbacks.py +192 -0
- didgelab-3.0/src/didgelab/evo/evolution.py +213 -0
- didgelab-3.0/src/didgelab/evo/genome.py +140 -0
- didgelab-3.0/src/didgelab/evo/loss.py +25 -0
- didgelab-3.0/src/didgelab/evo/operators.py +158 -0
- didgelab-3.0/src/didgelab/evo/schedulers.py +152 -0
- didgelab-3.0/src/didgelab/evo/writer.py +192 -0
- didgelab-3.0/src/didgelab/fft.py +102 -0
- didgelab-3.0/src/didgelab/geo.py +224 -0
- didgelab-3.0/src/didgelab/loss/TairuaLoss.py +172 -0
- didgelab-3.0/src/didgelab/loss/__init__.py +0 -0
- didgelab-3.0/src/didgelab/shapes/KigaliShape.py +236 -0
- didgelab-3.0/src/didgelab/shapes/MbeyaShape.py +206 -0
- didgelab-3.0/src/didgelab/shapes/__init__.py +0 -0
- didgelab-3.0/src/didgelab/sim/__init__.py +0 -0
- didgelab-3.0/src/didgelab/sim/fem.py +82 -0
- didgelab-3.0/src/didgelab/sim/sim_interface.py +19 -0
- didgelab-3.0/src/didgelab/sim/tlm_cython.py +37 -0
- didgelab-3.0/src/didgelab/sim/tlm_cython_lib/__init__.py +0 -0
- didgelab-3.0/src/didgelab/sim/tlm_cython_lib/_cadsd.c +16616 -0
- didgelab-3.0/src/didgelab/sim/tlm_cython_lib/_cadsd.pyx +152 -0
- didgelab-3.0/src/didgelab/sim/tlm_cython_lib/cadsd.py +387 -0
- didgelab-3.0/src/didgelab/sim/tlm_cython_lib/pytorch/cadsd_pytorch.py +230 -0
- didgelab-3.0/src/didgelab/sim/tlm_cython_lib/pytorch/sgd_cadsd.py +137 -0
- didgelab-3.0/src/didgelab/sim/tlm_cython_lib/setup.py +8 -0
- didgelab-3.0/src/didgelab/sim/tlm_cython_lib/sim.py +246 -0
- didgelab-3.0/src/didgelab/sim/tlm_python.py +206 -0
- didgelab-3.0/src/didgelab/visualize.py +223 -0
- didgelab-3.0/src/didgelab.egg-info/PKG-INFO +240 -0
- didgelab-3.0/src/didgelab.egg-info/SOURCES.txt +51 -0
- didgelab-3.0/src/didgelab.egg-info/dependency_links.txt +1 -0
- didgelab-3.0/src/didgelab.egg-info/top_level.txt +3 -0
- didgelab-3.0/src/tests/__init__.py +1 -0
- didgelab-3.0/src/tests/test_KigaliShape.py +142 -0
- didgelab-3.0/src/tests/test_MbeyaShape.py +116 -0
- didgelab-3.0/src/tests/test_TairuaLoss.py +174 -0
- didgelab-3.0/src/tests/test_acoustical_simulation.py +142 -0
- didgelab-3.0/src/tests/test_conv.py +270 -0
- didgelab-3.0/src/tests/test_fft.py +155 -0
- didgelab-3.0/src/tests/test_geo.py +236 -0
- didgelab-3.0/src/tests/test_nuevolution.py +352 -0
didgelab-3.0/PKG-INFO
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: didgelab
|
|
3
|
+
Version: 3.0
|
|
4
|
+
Summary: Acoustical simulation and computer-aided design of didgeridoos
|
|
5
|
+
Author-email: Jan Nehring <jan.nehring@outlook.com>
|
|
6
|
+
License: CC BY-NC-SA 4.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/didgitaldoo/didge-lab
|
|
8
|
+
Project-URL: Issues, https://github.com/didgitaldoo/didge-lab/issues
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Requires-Python: >=3.8
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
|
|
19
|
+
# DidgeLab
|
|
20
|
+
|
|
21
|
+
## Table of contents
|
|
22
|
+
|
|
23
|
+
- [1. Introduction](#1-introduction)
|
|
24
|
+
- [2. Related works](#2-related-works)
|
|
25
|
+
- [3. What can it do?](#3-what-can-it-do)
|
|
26
|
+
- [4. Usage](#4-usage)
|
|
27
|
+
- [4.1 Installation](#41-installation)
|
|
28
|
+
- [4.2 Tests (pytest)](#42-tests-pytest)
|
|
29
|
+
- [4.3 Building the Python package](#43-building-the-python-package)
|
|
30
|
+
- [4.4 Documentation](#44-documentation)
|
|
31
|
+
- [4.5 Building a didgeridoo from a geometry](#45-building-a-didgeridoo-from-a-geometry)
|
|
32
|
+
- [5. Didgeridoo geometry library](#5-didgeridoo-geometry-library)
|
|
33
|
+
- [6. Get involved](#6-get-involved)
|
|
34
|
+
- [7. Licensing](#7-licensing)
|
|
35
|
+
- [8. Future works](#8-future-works)
|
|
36
|
+
- [Package layout (didge-lab-3)](#package-layout-didge-lab-3)
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## 1. Introduction
|
|
41
|
+
|
|
42
|
+
DidgeLab is a free toolkit to compute didgeridoo geometries. Traditionally, building a didgeridoo is a random process: builders know how geometry influences the sound, but the exact sonic properties can only be determined after the instrument is built. DidgeLab helps by first defining the desired sound and then computing a geometry that (in simulation) achieves it.
|
|
43
|
+
|
|
44
|
+
It provides:
|
|
45
|
+
|
|
46
|
+
1. **Acoustical simulation** — Compute resonant frequencies and impedance spectra for a given didgeridoo geometry. This is similar in spirit to Didgmo and DidjiImp.
|
|
47
|
+
2. **Computational evolution** — Search for bore shapes that meet target sonic properties (e.g. drone in D, toots in F, G, B). This is inspired by the work of Frank Geipel (Computer-Aided Didgeridoo Sound Design, CADSD).
|
|
48
|
+
|
|
49
|
+
So the first part takes a geometry and predicts its sound; the second takes a target sound and searches for a matching geometry. To the best of our knowledge, DidgeLab is the first open toolkit that implements this inverse design.
|
|
50
|
+
|
|
51
|
+
The software is a **Python toolkit** rather than a point-and-click app: you use it from scripts or Jupyter notebooks. There is no graphical user interface. The geometry library (see below) can still be used without running evolution or simulation.
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## 2. Related works
|
|
56
|
+
|
|
57
|
+
- **Frank Geipel** — Computer-Aided Didgeridoo Sound Design (CADSD). DidgeLab’s approach is based on our reading of his ideas and descriptions.
|
|
58
|
+
- **Dan Mapes-Riordan (1991)** — *Horn Modeling with Conical and Cylindrical Transmission Line Elements*. Foundation for the transmission-line acoustical model.
|
|
59
|
+
- **Andrea Ferroni (YouTube)** — Didgeridoo acoustics and playing; e.g. DIDGMO explanation, backpressure, cylindrical vs conical bore.
|
|
60
|
+
- **Didgmo / Didjimp** — Existing tools for didgeridoo sound design; used here as a reference (DidgeLab’s impedance spectra match when given the same geometry).
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## 3. What can it do?
|
|
65
|
+
|
|
66
|
+
- **Inverse design** — Define the sound you want (e.g. drone + toots) and evolve a bore shape that matches it in simulation.
|
|
67
|
+
- **Precise tuning** — Aim for a drone in D and toots in F, G, B (or other targets) and optimize geometry for those resonances.
|
|
68
|
+
- **Unusual shapes** — Explore “singing” didgeridoos with strong overtones, or shapes that are rare in nature (e.g. Long Multi Tooter–style).
|
|
69
|
+
- **Consistency with Didgmo/Didjimp** — For the same geometry, DidgeLab’s simulation agrees with these programs, which supports the model’s validity. Building and measuring real instruments remains the next step for full validation.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## 4. Usage
|
|
74
|
+
|
|
75
|
+
### 4.1 Installation
|
|
76
|
+
|
|
77
|
+
Tested on **Ubuntu Linux** and **macOS**. May work on Windows but has not been tested.
|
|
78
|
+
|
|
79
|
+
**Prerequisites**
|
|
80
|
+
|
|
81
|
+
- Python 3.8+ (Conda recommended)
|
|
82
|
+
- Optional: Cython and a C compiler for the fast simulation backend
|
|
83
|
+
|
|
84
|
+
**Steps**
|
|
85
|
+
|
|
86
|
+
1. Clone the repository and go to the project directory:
|
|
87
|
+
```bash
|
|
88
|
+
git clone https://github.com/jnehring/didge-lab/
|
|
89
|
+
cd didge-lab
|
|
90
|
+
```
|
|
91
|
+
(Or download and unzip the source.)
|
|
92
|
+
|
|
93
|
+
2. Create and activate a Conda environment:
|
|
94
|
+
```bash
|
|
95
|
+
conda create -n didgelab python=3.8
|
|
96
|
+
conda activate didgelab
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
3. Install the package (from the **repository root**; this builds the Cython extension and installs `didgelab`):
|
|
100
|
+
```bash
|
|
101
|
+
pip install -e .
|
|
102
|
+
```
|
|
103
|
+
Dependencies (NumPy, Cython, etc.) are installed as build/install dependencies. For a non-editable install: `pip install .`
|
|
104
|
+
|
|
105
|
+
4. Run a quick check (e.g. a script or notebook that runs a simulation and prints a small impedance table). If you see a frequency/impedance/note table, the installation is working.
|
|
106
|
+
|
|
107
|
+
### 4.2 Tests (pytest)
|
|
108
|
+
|
|
109
|
+
From the **repository root**:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
pytest
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Tests live in `src/tests/`. To run a subset:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
pytest src/tests/test_geo.py
|
|
119
|
+
pytest src/tests/test_KigaliShape.py -v
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Some tests mock the Cython simulation backend so they run without building it; others require the full install (including the compiled `_cadsd` extension). Use the same Python environment in which you installed `didgelab`.
|
|
123
|
+
|
|
124
|
+
### 4.3 Building the Python package
|
|
125
|
+
|
|
126
|
+
- **Editable install (recommended for development)**
|
|
127
|
+
From the repo root:
|
|
128
|
+
```bash
|
|
129
|
+
pip install -e .
|
|
130
|
+
```
|
|
131
|
+
Changes in `src/didgelab` are picked up without reinstalling.
|
|
132
|
+
|
|
133
|
+
- **Regular install**
|
|
134
|
+
```bash
|
|
135
|
+
pip install .
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
- **Rebuild after changing Cython code**
|
|
139
|
+
Reinstall so the extension is recompiled:
|
|
140
|
+
```bash
|
|
141
|
+
pip install -e . --no-build-isolation
|
|
142
|
+
```
|
|
143
|
+
Or `pip install -e . --force-reinstall` if needed. A C compiler and Cython are required; see Cython docs for your OS.
|
|
144
|
+
|
|
145
|
+
- **Source distribution and wheel**
|
|
146
|
+
```bash
|
|
147
|
+
pip install build
|
|
148
|
+
python -m build
|
|
149
|
+
```
|
|
150
|
+
Outputs go to `dist/` (e.g. `pip install dist/didgelab-*.whl`).
|
|
151
|
+
|
|
152
|
+
### 4.4 Documentation
|
|
153
|
+
|
|
154
|
+
- Tutorials in `examples/tutorials/` walk through acoustical simulation, shape parameters, and evolution.
|
|
155
|
+
- The `didgelab` package is documented with **module and function/class docstrings**; use `help()` in Python or read the source.
|
|
156
|
+
|
|
157
|
+
**API documentation (pdoc)**
|
|
158
|
+
Use [pdoc](https://pdoc.dev/) to generate API docs from docstrings. From the repo root, ensure the local package is used (e.g. after `pip install -e .` or with `PYTHONPATH=src`).
|
|
159
|
+
|
|
160
|
+
- **Development — live preview**
|
|
161
|
+
Serve docs locally and reload as you edit:
|
|
162
|
+
```bash
|
|
163
|
+
pip install pdoc
|
|
164
|
+
PYTHONPATH=src pdoc src/didgelab --http 8080
|
|
165
|
+
```
|
|
166
|
+
Open http://localhost:8080. Stop with Ctrl+C.
|
|
167
|
+
|
|
168
|
+
- **Render static HTML**
|
|
169
|
+
Write the API docs into a folder (e.g. for deployment or offline use):
|
|
170
|
+
```bash
|
|
171
|
+
pip install pdoc
|
|
172
|
+
PYTHONPATH=src pdoc src/didgelab -o docs/html
|
|
173
|
+
```
|
|
174
|
+
Then open `docs/html/index.html` in a browser or serve the `docs/html` directory with any static file server.
|
|
175
|
+
|
|
176
|
+
### 4.5 Building a didgeridoo from a geometry
|
|
177
|
+
|
|
178
|
+
DidgeLab only produces **bore geometry** (e.g. segment list or similar). Turning that into a physical instrument (e.g. 3D printing, traditional building) is outside this document. Frank Geipel’s site and other maker resources describe possible workflows.
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## 5. Didgeridoo geometry library
|
|
183
|
+
|
|
184
|
+
Geometries can be shared as a list of segments: each segment is **(distance from mouthpiece in mm, bore diameter in mm)**. Example (length 1200 mm, bell 60 mm):
|
|
185
|
+
|
|
186
|
+
```
|
|
187
|
+
0 32
|
|
188
|
+
1000 40
|
|
189
|
+
1200 60
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Geometries computed or collected with DidgeLab can be published in the geometry library (see the DidgeLab repo). They are free for non-commercial use; for commercial use, please contact the author.
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## 6. Get involved
|
|
197
|
+
|
|
198
|
+
The project is open source. Contributions, bug reports, and suggestions are welcome via GitHub issues. If your question or report might help others, please use the issue tracker rather than private messages.
|
|
199
|
+
|
|
200
|
+
If you compute interesting didgeridoo shapes with DidgeLab, consider sharing them in the geometry library.
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## 7. Licensing
|
|
205
|
+
|
|
206
|
+
DidgeLab is published under **Creative Commons BY-NC-SA 4.0**:
|
|
207
|
+
|
|
208
|
+
- **Share** — copy and redistribute in any medium or format
|
|
209
|
+
- **Adapt** — remix, transform, and build upon the material
|
|
210
|
+
|
|
211
|
+
Under these terms:
|
|
212
|
+
|
|
213
|
+
- **Attribution** — Give appropriate credit, link to the license, and indicate if changes were made.
|
|
214
|
+
- **NonCommercial** — You may not use the material for commercial purposes.
|
|
215
|
+
- **ShareAlike** — If you remix or build upon the material, you must distribute your contributions under the same license.
|
|
216
|
+
- **No additional restrictions** — Do not apply legal or technical measures that restrict others from doing what the license permits.
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## 8. Future works
|
|
221
|
+
|
|
222
|
+
- **Building didgeridoos** — Use the software to design and then build instruments; validate against measurements; explore “wet”/drop-octave and other special types.
|
|
223
|
+
- **Faster simulation** — Smarter frequency grids (e.g. log spacing, higher resolution only near peaks), skipping irrelevant bands, and better use of multi-core.
|
|
224
|
+
- **Gradient-based optimization** — Use automatic differentiation (e.g. PyTorch) for gradient descent instead of or in addition to evolution.
|
|
225
|
+
- **Graphical user interface** — A GUI could make the toolkit more accessible to non-programmers.
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## Package layout (didge-lab-3)
|
|
230
|
+
|
|
231
|
+
- **`didgelab`** — Main package:
|
|
232
|
+
- `acoustical_simulation` — Entry point for running simulation (Python or Cython backend).
|
|
233
|
+
- `geo` — Geometry class (segment list, load/save, scale, cones, volume, etc.).
|
|
234
|
+
- `conv` — Note/frequency conversion (note names, cents, wavelengths).
|
|
235
|
+
- `fft` — FFT and spectrum helpers (WAV, harmonics, fundamental, peaks).
|
|
236
|
+
- `visualize` — Plot bore profiles (2D cross-section).
|
|
237
|
+
- `app` — Global app, config, logging, publish/subscribe, services.
|
|
238
|
+
- `sim` — Simulation: `sim_interface`, `tlm_python`, `tlm_cython` (TLM = transmission line model).
|
|
239
|
+
- `evo` — Evolution: shapes, loss functions, mutators, evolution loop, checkpoint/loss logging.
|
|
240
|
+
- **Build** — From repo root: `pip install -e .` (see §4.1 and §4.3).
|
didgelab-3.0/README.md
ADDED
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
# DidgeLab
|
|
2
|
+
|
|
3
|
+
## Table of contents
|
|
4
|
+
|
|
5
|
+
- [1. Introduction](#1-introduction)
|
|
6
|
+
- [2. Related works](#2-related-works)
|
|
7
|
+
- [3. What can it do?](#3-what-can-it-do)
|
|
8
|
+
- [4. Usage](#4-usage)
|
|
9
|
+
- [4.1 Installation](#41-installation)
|
|
10
|
+
- [4.2 Tests (pytest)](#42-tests-pytest)
|
|
11
|
+
- [4.3 Building the Python package](#43-building-the-python-package)
|
|
12
|
+
- [4.4 Documentation](#44-documentation)
|
|
13
|
+
- [4.5 Building a didgeridoo from a geometry](#45-building-a-didgeridoo-from-a-geometry)
|
|
14
|
+
- [5. Didgeridoo geometry library](#5-didgeridoo-geometry-library)
|
|
15
|
+
- [6. Get involved](#6-get-involved)
|
|
16
|
+
- [7. Licensing](#7-licensing)
|
|
17
|
+
- [8. Future works](#8-future-works)
|
|
18
|
+
- [Package layout (didge-lab-3)](#package-layout-didge-lab-3)
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## 1. Introduction
|
|
23
|
+
|
|
24
|
+
DidgeLab is a free toolkit to compute didgeridoo geometries. Traditionally, building a didgeridoo is a random process: builders know how geometry influences the sound, but the exact sonic properties can only be determined after the instrument is built. DidgeLab helps by first defining the desired sound and then computing a geometry that (in simulation) achieves it.
|
|
25
|
+
|
|
26
|
+
It provides:
|
|
27
|
+
|
|
28
|
+
1. **Acoustical simulation** — Compute resonant frequencies and impedance spectra for a given didgeridoo geometry. This is similar in spirit to Didgmo and DidjiImp.
|
|
29
|
+
2. **Computational evolution** — Search for bore shapes that meet target sonic properties (e.g. drone in D, toots in F, G, B). This is inspired by the work of Frank Geipel (Computer-Aided Didgeridoo Sound Design, CADSD).
|
|
30
|
+
|
|
31
|
+
So the first part takes a geometry and predicts its sound; the second takes a target sound and searches for a matching geometry. To the best of our knowledge, DidgeLab is the first open toolkit that implements this inverse design.
|
|
32
|
+
|
|
33
|
+
The software is a **Python toolkit** rather than a point-and-click app: you use it from scripts or Jupyter notebooks. There is no graphical user interface. The geometry library (see below) can still be used without running evolution or simulation.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## 2. Related works
|
|
38
|
+
|
|
39
|
+
- **Frank Geipel** — Computer-Aided Didgeridoo Sound Design (CADSD). DidgeLab’s approach is based on our reading of his ideas and descriptions.
|
|
40
|
+
- **Dan Mapes-Riordan (1991)** — *Horn Modeling with Conical and Cylindrical Transmission Line Elements*. Foundation for the transmission-line acoustical model.
|
|
41
|
+
- **Andrea Ferroni (YouTube)** — Didgeridoo acoustics and playing; e.g. DIDGMO explanation, backpressure, cylindrical vs conical bore.
|
|
42
|
+
- **Didgmo / Didjimp** — Existing tools for didgeridoo sound design; used here as a reference (DidgeLab’s impedance spectra match when given the same geometry).
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## 3. What can it do?
|
|
47
|
+
|
|
48
|
+
- **Inverse design** — Define the sound you want (e.g. drone + toots) and evolve a bore shape that matches it in simulation.
|
|
49
|
+
- **Precise tuning** — Aim for a drone in D and toots in F, G, B (or other targets) and optimize geometry for those resonances.
|
|
50
|
+
- **Unusual shapes** — Explore “singing” didgeridoos with strong overtones, or shapes that are rare in nature (e.g. Long Multi Tooter–style).
|
|
51
|
+
- **Consistency with Didgmo/Didjimp** — For the same geometry, DidgeLab’s simulation agrees with these programs, which supports the model’s validity. Building and measuring real instruments remains the next step for full validation.
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## 4. Usage
|
|
56
|
+
|
|
57
|
+
### 4.1 Installation
|
|
58
|
+
|
|
59
|
+
Tested on **Ubuntu Linux** and **macOS**. May work on Windows but has not been tested.
|
|
60
|
+
|
|
61
|
+
**Prerequisites**
|
|
62
|
+
|
|
63
|
+
- Python 3.8+ (Conda recommended)
|
|
64
|
+
- Optional: Cython and a C compiler for the fast simulation backend
|
|
65
|
+
|
|
66
|
+
**Steps**
|
|
67
|
+
|
|
68
|
+
1. Clone the repository and go to the project directory:
|
|
69
|
+
```bash
|
|
70
|
+
git clone https://github.com/jnehring/didge-lab/
|
|
71
|
+
cd didge-lab
|
|
72
|
+
```
|
|
73
|
+
(Or download and unzip the source.)
|
|
74
|
+
|
|
75
|
+
2. Create and activate a Conda environment:
|
|
76
|
+
```bash
|
|
77
|
+
conda create -n didgelab python=3.8
|
|
78
|
+
conda activate didgelab
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
3. Install the package (from the **repository root**; this builds the Cython extension and installs `didgelab`):
|
|
82
|
+
```bash
|
|
83
|
+
pip install -e .
|
|
84
|
+
```
|
|
85
|
+
Dependencies (NumPy, Cython, etc.) are installed as build/install dependencies. For a non-editable install: `pip install .`
|
|
86
|
+
|
|
87
|
+
4. Run a quick check (e.g. a script or notebook that runs a simulation and prints a small impedance table). If you see a frequency/impedance/note table, the installation is working.
|
|
88
|
+
|
|
89
|
+
### 4.2 Tests (pytest)
|
|
90
|
+
|
|
91
|
+
From the **repository root**:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
pytest
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Tests live in `src/tests/`. To run a subset:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
pytest src/tests/test_geo.py
|
|
101
|
+
pytest src/tests/test_KigaliShape.py -v
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Some tests mock the Cython simulation backend so they run without building it; others require the full install (including the compiled `_cadsd` extension). Use the same Python environment in which you installed `didgelab`.
|
|
105
|
+
|
|
106
|
+
### 4.3 Building the Python package
|
|
107
|
+
|
|
108
|
+
- **Editable install (recommended for development)**
|
|
109
|
+
From the repo root:
|
|
110
|
+
```bash
|
|
111
|
+
pip install -e .
|
|
112
|
+
```
|
|
113
|
+
Changes in `src/didgelab` are picked up without reinstalling.
|
|
114
|
+
|
|
115
|
+
- **Regular install**
|
|
116
|
+
```bash
|
|
117
|
+
pip install .
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
- **Rebuild after changing Cython code**
|
|
121
|
+
Reinstall so the extension is recompiled:
|
|
122
|
+
```bash
|
|
123
|
+
pip install -e . --no-build-isolation
|
|
124
|
+
```
|
|
125
|
+
Or `pip install -e . --force-reinstall` if needed. A C compiler and Cython are required; see Cython docs for your OS.
|
|
126
|
+
|
|
127
|
+
- **Source distribution and wheel**
|
|
128
|
+
```bash
|
|
129
|
+
pip install build
|
|
130
|
+
python -m build
|
|
131
|
+
```
|
|
132
|
+
Outputs go to `dist/` (e.g. `pip install dist/didgelab-*.whl`).
|
|
133
|
+
|
|
134
|
+
### 4.4 Documentation
|
|
135
|
+
|
|
136
|
+
- Tutorials in `examples/tutorials/` walk through acoustical simulation, shape parameters, and evolution.
|
|
137
|
+
- The `didgelab` package is documented with **module and function/class docstrings**; use `help()` in Python or read the source.
|
|
138
|
+
|
|
139
|
+
**API documentation (pdoc)**
|
|
140
|
+
Use [pdoc](https://pdoc.dev/) to generate API docs from docstrings. From the repo root, ensure the local package is used (e.g. after `pip install -e .` or with `PYTHONPATH=src`).
|
|
141
|
+
|
|
142
|
+
- **Development — live preview**
|
|
143
|
+
Serve docs locally and reload as you edit:
|
|
144
|
+
```bash
|
|
145
|
+
pip install pdoc
|
|
146
|
+
PYTHONPATH=src pdoc src/didgelab --http 8080
|
|
147
|
+
```
|
|
148
|
+
Open http://localhost:8080. Stop with Ctrl+C.
|
|
149
|
+
|
|
150
|
+
- **Render static HTML**
|
|
151
|
+
Write the API docs into a folder (e.g. for deployment or offline use):
|
|
152
|
+
```bash
|
|
153
|
+
pip install pdoc
|
|
154
|
+
PYTHONPATH=src pdoc src/didgelab -o docs/html
|
|
155
|
+
```
|
|
156
|
+
Then open `docs/html/index.html` in a browser or serve the `docs/html` directory with any static file server.
|
|
157
|
+
|
|
158
|
+
### 4.5 Building a didgeridoo from a geometry
|
|
159
|
+
|
|
160
|
+
DidgeLab only produces **bore geometry** (e.g. segment list or similar). Turning that into a physical instrument (e.g. 3D printing, traditional building) is outside this document. Frank Geipel’s site and other maker resources describe possible workflows.
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## 5. Didgeridoo geometry library
|
|
165
|
+
|
|
166
|
+
Geometries can be shared as a list of segments: each segment is **(distance from mouthpiece in mm, bore diameter in mm)**. Example (length 1200 mm, bell 60 mm):
|
|
167
|
+
|
|
168
|
+
```
|
|
169
|
+
0 32
|
|
170
|
+
1000 40
|
|
171
|
+
1200 60
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Geometries computed or collected with DidgeLab can be published in the geometry library (see the DidgeLab repo). They are free for non-commercial use; for commercial use, please contact the author.
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## 6. Get involved
|
|
179
|
+
|
|
180
|
+
The project is open source. Contributions, bug reports, and suggestions are welcome via GitHub issues. If your question or report might help others, please use the issue tracker rather than private messages.
|
|
181
|
+
|
|
182
|
+
If you compute interesting didgeridoo shapes with DidgeLab, consider sharing them in the geometry library.
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## 7. Licensing
|
|
187
|
+
|
|
188
|
+
DidgeLab is published under **Creative Commons BY-NC-SA 4.0**:
|
|
189
|
+
|
|
190
|
+
- **Share** — copy and redistribute in any medium or format
|
|
191
|
+
- **Adapt** — remix, transform, and build upon the material
|
|
192
|
+
|
|
193
|
+
Under these terms:
|
|
194
|
+
|
|
195
|
+
- **Attribution** — Give appropriate credit, link to the license, and indicate if changes were made.
|
|
196
|
+
- **NonCommercial** — You may not use the material for commercial purposes.
|
|
197
|
+
- **ShareAlike** — If you remix or build upon the material, you must distribute your contributions under the same license.
|
|
198
|
+
- **No additional restrictions** — Do not apply legal or technical measures that restrict others from doing what the license permits.
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## 8. Future works
|
|
203
|
+
|
|
204
|
+
- **Building didgeridoos** — Use the software to design and then build instruments; validate against measurements; explore “wet”/drop-octave and other special types.
|
|
205
|
+
- **Faster simulation** — Smarter frequency grids (e.g. log spacing, higher resolution only near peaks), skipping irrelevant bands, and better use of multi-core.
|
|
206
|
+
- **Gradient-based optimization** — Use automatic differentiation (e.g. PyTorch) for gradient descent instead of or in addition to evolution.
|
|
207
|
+
- **Graphical user interface** — A GUI could make the toolkit more accessible to non-programmers.
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## Package layout (didge-lab-3)
|
|
212
|
+
|
|
213
|
+
- **`didgelab`** — Main package:
|
|
214
|
+
- `acoustical_simulation` — Entry point for running simulation (Python or Cython backend).
|
|
215
|
+
- `geo` — Geometry class (segment list, load/save, scale, cones, volume, etc.).
|
|
216
|
+
- `conv` — Note/frequency conversion (note names, cents, wavelengths).
|
|
217
|
+
- `fft` — FFT and spectrum helpers (WAV, harmonics, fundamental, peaks).
|
|
218
|
+
- `visualize` — Plot bore profiles (2D cross-section).
|
|
219
|
+
- `app` — Global app, config, logging, publish/subscribe, services.
|
|
220
|
+
- `sim` — Simulation: `sim_interface`, `tlm_python`, `tlm_cython` (TLM = transmission line model).
|
|
221
|
+
- `evo` — Evolution: shapes, loss functions, mutators, evolution loop, checkpoint/loss logging.
|
|
222
|
+
- **Build** — From repo root: `pip install -e .` (see §4.1 and §4.3).
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = [
|
|
3
|
+
"setuptools >= 61",
|
|
4
|
+
"wheel",
|
|
5
|
+
"Cython >= 3.1",
|
|
6
|
+
"numpy",
|
|
7
|
+
]
|
|
8
|
+
build-backend = "setuptools.build_meta"
|
|
9
|
+
|
|
10
|
+
[project]
|
|
11
|
+
name = "didgelab"
|
|
12
|
+
version = "3.0"
|
|
13
|
+
authors = [
|
|
14
|
+
{ name = "Jan Nehring", email = "jan.nehring@outlook.com" },
|
|
15
|
+
]
|
|
16
|
+
description = "Acoustical simulation and computer-aided design of didgeridoos"
|
|
17
|
+
readme = "README.md"
|
|
18
|
+
requires-python = ">=3.8"
|
|
19
|
+
classifiers = [
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3.8",
|
|
22
|
+
"Programming Language :: Python :: 3.9",
|
|
23
|
+
"Programming Language :: Python :: 3.10",
|
|
24
|
+
"Programming Language :: Python :: 3.11",
|
|
25
|
+
"Programming Language :: Python :: 3.12",
|
|
26
|
+
"Operating System :: OS Independent",
|
|
27
|
+
]
|
|
28
|
+
license = { text = "CC BY-NC-SA 4.0" }
|
|
29
|
+
|
|
30
|
+
[project.urls]
|
|
31
|
+
Homepage = "https://github.com/didgitaldoo/didge-lab"
|
|
32
|
+
Issues = "https://github.com/didgitaldoo/didge-lab/issues"
|
|
33
|
+
|
|
34
|
+
[tool.setuptools.packages.find]
|
|
35
|
+
where = ["src"]
|
didgelab-3.0/setup.cfg
ADDED
didgelab-3.0/setup.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Build the Cython extension with NumPy include dirs.
|
|
3
|
+
Package metadata and package layout come from pyproject.toml.
|
|
4
|
+
"""
|
|
5
|
+
from setuptools import setup, Extension
|
|
6
|
+
from Cython.Build import cythonize
|
|
7
|
+
import numpy as np
|
|
8
|
+
|
|
9
|
+
_cadsd_ext = Extension(
|
|
10
|
+
name="didgelab.sim.tlm_cython_lib._cadsd",
|
|
11
|
+
sources=["src/didgelab/sim/tlm_cython_lib/_cadsd.pyx"],
|
|
12
|
+
include_dirs=[np.get_include()],
|
|
13
|
+
define_macros=[("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")],
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
setup(
|
|
17
|
+
ext_modules=cythonize(
|
|
18
|
+
[_cadsd_ext],
|
|
19
|
+
compiler_directives={"language_level": "3"},
|
|
20
|
+
),
|
|
21
|
+
)
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"""
|
|
2
|
+
DidgeLab: acoustical simulation and computer-aided design of didgeridoos.
|
|
3
|
+
|
|
4
|
+
Import from the root for the main API, e.g.::
|
|
5
|
+
|
|
6
|
+
from didgelab import Nuevolution, Geo, GeoGenome, SimpleMutation
|
|
7
|
+
from didgelab import acoustical_simulation, vis_didge
|
|
8
|
+
|
|
9
|
+
Submodules (for more specific imports):
|
|
10
|
+
|
|
11
|
+
- **acoustical_simulation** – run TLM simulation, get_log_simulation_frequencies, get_notes
|
|
12
|
+
- **geo** – Geo (bore geometry)
|
|
13
|
+
- **conv** – note/frequency conversion (note_to_freq, cent_diff)
|
|
14
|
+
- **sim** – simulation backends (tlm_python, tlm_cython)
|
|
15
|
+
- **evo** – evolutionary shape search (Nuevolution, genomes, operators, loss)
|
|
16
|
+
- **shapes** – parametric shapes (e.g. KigaliShape.WebShape)
|
|
17
|
+
- **app** – application shell, config, logging
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
from .geo import Geo
|
|
21
|
+
from .acoustical_simulation import (
|
|
22
|
+
acoustical_simulation,
|
|
23
|
+
get_log_simulation_frequencies,
|
|
24
|
+
get_notes,
|
|
25
|
+
compute_ground_spektrum,
|
|
26
|
+
)
|
|
27
|
+
from .visualize import (
|
|
28
|
+
vis_didge,
|
|
29
|
+
plot_bore,
|
|
30
|
+
plot_impedance_spectrum,
|
|
31
|
+
plot_notes,
|
|
32
|
+
plot_geo_impedance_notes,
|
|
33
|
+
)
|
|
34
|
+
from .conv import (
|
|
35
|
+
note_to_freq,
|
|
36
|
+
freq_to_note,
|
|
37
|
+
note_name,
|
|
38
|
+
freq_to_note_and_cent,
|
|
39
|
+
freq_to_wavelength,
|
|
40
|
+
note_name_to_number,
|
|
41
|
+
cent_diff,
|
|
42
|
+
)
|
|
43
|
+
from .shapes.KigaliShape import KigaliShape
|
|
44
|
+
|
|
45
|
+
# Evolution: genomes, loss, operators, evolution runner, callbacks
|
|
46
|
+
from .evo import (
|
|
47
|
+
Genome,
|
|
48
|
+
GeoGenome,
|
|
49
|
+
GeoGenomeA,
|
|
50
|
+
LossFunction,
|
|
51
|
+
TestLossFunction,
|
|
52
|
+
MutationOperator,
|
|
53
|
+
CrossoverOperator,
|
|
54
|
+
SimpleMutation,
|
|
55
|
+
RandomMutation,
|
|
56
|
+
SingleMutation,
|
|
57
|
+
RandomCrossover,
|
|
58
|
+
AverageCrossover,
|
|
59
|
+
PartSwapCrossover,
|
|
60
|
+
PartAverageCrossover,
|
|
61
|
+
Nuevolution,
|
|
62
|
+
AdaptiveProbabilities,
|
|
63
|
+
NumpyEncoder,
|
|
64
|
+
load_latest_evolution
|
|
65
|
+
)
|
|
66
|
+
from .evo.callbacks import init_standard_evolution
|
|
67
|
+
|
|
68
|
+
__all__ = [
|
|
69
|
+
"Geo",
|
|
70
|
+
"acoustical_simulation",
|
|
71
|
+
"get_log_simulation_frequencies",
|
|
72
|
+
"get_notes",
|
|
73
|
+
"compute_ground_spektrum",
|
|
74
|
+
"vis_didge",
|
|
75
|
+
"plot_bore",
|
|
76
|
+
"plot_impedance_spectrum",
|
|
77
|
+
"plot_notes",
|
|
78
|
+
"plot_geo_impedance_notes",
|
|
79
|
+
"note_to_freq",
|
|
80
|
+
"freq_to_note",
|
|
81
|
+
"note_name",
|
|
82
|
+
"freq_to_note_and_cent",
|
|
83
|
+
"freq_to_wavelength",
|
|
84
|
+
"note_name_to_number",
|
|
85
|
+
"cent_diff",
|
|
86
|
+
"KigaliShape",
|
|
87
|
+
"init_standard_evolution",
|
|
88
|
+
"Genome",
|
|
89
|
+
"GeoGenome",
|
|
90
|
+
"GeoGenomeA",
|
|
91
|
+
"LossFunction",
|
|
92
|
+
"TestLossFunction",
|
|
93
|
+
"MutationOperator",
|
|
94
|
+
"CrossoverOperator",
|
|
95
|
+
"SimpleMutation",
|
|
96
|
+
"RandomMutation",
|
|
97
|
+
"SingleMutation",
|
|
98
|
+
"RandomCrossover",
|
|
99
|
+
"AverageCrossover",
|
|
100
|
+
"PartSwapCrossover",
|
|
101
|
+
"PartAverageCrossover",
|
|
102
|
+
"Nuevolution",
|
|
103
|
+
"AdaptiveProbabilities",
|
|
104
|
+
"NumpyEncoder",
|
|
105
|
+
"load_latest_evolution",
|
|
106
|
+
]
|