csoundengine 2.23.0__tar.gz → 2.23.1__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 (134) hide show
  1. {csoundengine-2.23.0 → csoundengine-2.23.1}/.github/workflows/test2.yml +38 -0
  2. {csoundengine-2.23.0 → csoundengine-2.23.1}/PKG-INFO +11 -6
  3. {csoundengine-2.23.0 → csoundengine-2.23.1}/README.rst +7 -2
  4. {csoundengine-2.23.0 → csoundengine-2.23.1}/csoundengine/csoundlib.py +16 -79
  5. {csoundengine-2.23.0 → csoundengine-2.23.1}/csoundengine/dependencies.py +18 -63
  6. {csoundengine-2.23.0 → csoundengine-2.23.1}/csoundengine.egg-info/PKG-INFO +11 -6
  7. {csoundengine-2.23.0 → csoundengine-2.23.1}/csoundengine.egg-info/SOURCES.txt +2 -2
  8. {csoundengine-2.23.0 → csoundengine-2.23.1}/csoundengine.egg-info/requires.txt +2 -2
  9. csoundengine-2.23.1/docs/Installation.rst +15 -0
  10. {csoundengine-2.23.0 → csoundengine-2.23.1}/docs/Introduction.rst +3 -2
  11. {csoundengine-2.23.0 → csoundengine-2.23.1}/docs/index.rst +2 -1
  12. {csoundengine-2.23.0 → csoundengine-2.23.1}/pyproject.toml +6 -6
  13. csoundengine-2.23.1/test/testdeps.py +46 -0
  14. csoundengine-2.23.0/.cirrus.yml +0 -40
  15. csoundengine-2.23.0/docs/Installation.rst +0 -19
  16. {csoundengine-2.23.0 → csoundengine-2.23.1}/.gitignore +0 -0
  17. {csoundengine-2.23.0 → csoundengine-2.23.1}/LICENSE.txt +0 -0
  18. {csoundengine-2.23.0 → csoundengine-2.23.1}/MANIFEST.in +0 -0
  19. {csoundengine-2.23.0 → csoundengine-2.23.1}/cmake/csound-custom-macos.cmake +0 -0
  20. {csoundengine-2.23.0 → csoundengine-2.23.1}/csoundengine/__init__.py +0 -0
  21. {csoundengine-2.23.0 → csoundengine-2.23.1}/csoundengine/_common.py +0 -0
  22. {csoundengine-2.23.0 → csoundengine-2.23.1}/csoundengine/_palette.py +0 -0
  23. {csoundengine-2.23.0 → csoundengine-2.23.1}/csoundengine/abstractrenderer.py +0 -0
  24. {csoundengine-2.23.0 → csoundengine-2.23.1}/csoundengine/baseschedevent.py +0 -0
  25. {csoundengine-2.23.0 → csoundengine-2.23.1}/csoundengine/busproxy.py +0 -0
  26. {csoundengine-2.23.0 → csoundengine-2.23.1}/csoundengine/config.py +0 -0
  27. {csoundengine-2.23.0 → csoundengine-2.23.1}/csoundengine/contants.py +0 -0
  28. {csoundengine-2.23.0 → csoundengine-2.23.1}/csoundengine/csd.py +0 -0
  29. {csoundengine-2.23.0 → csoundengine-2.23.1}/csoundengine/csounddefs.py +0 -0
  30. {csoundengine-2.23.0 → csoundengine-2.23.1}/csoundengine/csoundparse.py +0 -0
  31. {csoundengine-2.23.0 → csoundengine-2.23.1}/csoundengine/engine.py +0 -0
  32. {csoundengine-2.23.0 → csoundengine-2.23.1}/csoundengine/enginebase.py +0 -0
  33. {csoundengine-2.23.0 → csoundengine-2.23.1}/csoundengine/engineorc.py +0 -0
  34. {csoundengine-2.23.0 → csoundengine-2.23.1}/csoundengine/errors.py +0 -0
  35. {csoundengine-2.23.0 → csoundengine-2.23.1}/csoundengine/event.py +0 -0
  36. {csoundengine-2.23.0 → csoundengine-2.23.1}/csoundengine/instr.py +0 -0
  37. {csoundengine-2.23.0 → csoundengine-2.23.1}/csoundengine/instrtools.py +0 -0
  38. {csoundengine-2.23.0 → csoundengine-2.23.1}/csoundengine/interact.py +0 -0
  39. {csoundengine-2.23.0 → csoundengine-2.23.1}/csoundengine/internal.py +0 -0
  40. {csoundengine-2.23.0 → csoundengine-2.23.1}/csoundengine/jacktools.py +0 -0
  41. {csoundengine-2.23.0 → csoundengine-2.23.1}/csoundengine/jupytertools.py +0 -0
  42. {csoundengine-2.23.0 → csoundengine-2.23.1}/csoundengine/linuxaudio.py +0 -0
  43. {csoundengine-2.23.0 → csoundengine-2.23.1}/csoundengine/magic.py +0 -0
  44. {csoundengine-2.23.0 → csoundengine-2.23.1}/csoundengine/offline.py +0 -0
  45. {csoundengine-2.23.0 → csoundengine-2.23.1}/csoundengine/offlineengine.py +0 -0
  46. {csoundengine-2.23.0 → csoundengine-2.23.1}/csoundengine/offlineorc.py +0 -0
  47. {csoundengine-2.23.0 → csoundengine-2.23.1}/csoundengine/paramtable.py +0 -0
  48. {csoundengine-2.23.0 → csoundengine-2.23.1}/csoundengine/plotting.py +0 -0
  49. {csoundengine-2.23.0 → csoundengine-2.23.1}/csoundengine/py.typed +0 -0
  50. {csoundengine-2.23.0 → csoundengine-2.23.1}/csoundengine/renderjob.py +0 -0
  51. {csoundengine-2.23.0 → csoundengine-2.23.1}/csoundengine/schedevent.py +0 -0
  52. {csoundengine-2.23.0 → csoundengine-2.23.1}/csoundengine/session.py +0 -0
  53. {csoundengine-2.23.0 → csoundengine-2.23.1}/csoundengine/sessionhandler.py +0 -0
  54. {csoundengine-2.23.0 → csoundengine-2.23.1}/csoundengine/sessioninstrs.py +0 -0
  55. {csoundengine-2.23.0 → csoundengine-2.23.1}/csoundengine/sftools.py +0 -0
  56. {csoundengine-2.23.0 → csoundengine-2.23.1}/csoundengine/state.py +0 -0
  57. {csoundengine-2.23.0 → csoundengine-2.23.1}/csoundengine/synth.py +0 -0
  58. {csoundengine-2.23.0 → csoundengine-2.23.1}/csoundengine/tableproxy.py +0 -0
  59. {csoundengine-2.23.0 → csoundengine-2.23.1}/csoundengine/tools.py +0 -0
  60. {csoundengine-2.23.0 → csoundengine-2.23.1}/csoundengine.egg-info/dependency_links.txt +0 -0
  61. {csoundengine-2.23.0 → csoundengine-2.23.1}/csoundengine.egg-info/top_level.txt +0 -0
  62. {csoundengine-2.23.0 → csoundengine-2.23.1}/docs/Builtin-Opcodes.rst +0 -0
  63. {csoundengine-2.23.0 → csoundengine-2.23.1}/docs/Makefile +0 -0
  64. {csoundengine-2.23.0 → csoundengine-2.23.1}/docs/Reference.rst +0 -0
  65. {csoundengine-2.23.0 → csoundengine-2.23.1}/docs/_static/custom.css +0 -0
  66. {csoundengine-2.23.0 → csoundengine-2.23.1}/docs/_static/offlineengine-example1.mp3 +0 -0
  67. {csoundengine-2.23.0 → csoundengine-2.23.1}/docs/assets/config-edit.png +0 -0
  68. {csoundengine-2.23.0 → csoundengine-2.23.1}/docs/assets/eventui.png +0 -0
  69. {csoundengine-2.23.0 → csoundengine-2.23.1}/docs/assets/eventui2.png +0 -0
  70. {csoundengine-2.23.0 → csoundengine-2.23.1}/docs/assets/jupyter-config.png +0 -0
  71. {csoundengine-2.23.0 → csoundengine-2.23.1}/docs/assets/jupyter-plotTable.png +0 -0
  72. {csoundengine-2.23.0 → csoundengine-2.23.1}/docs/assets/jupyter-session-1.png +0 -0
  73. {csoundengine-2.23.0 → csoundengine-2.23.1}/docs/assets/offlineengine-example1.png +0 -0
  74. {csoundengine-2.23.0 → csoundengine-2.23.1}/docs/assets/select-preset.png +0 -0
  75. {csoundengine-2.23.0 → csoundengine-2.23.1}/docs/assets/synthui.png +0 -0
  76. {csoundengine-2.23.0 → csoundengine-2.23.1}/docs/assets/tableplot-sine.png +0 -0
  77. {csoundengine-2.23.0 → csoundengine-2.23.1}/docs/assets/tableplot-stereo.png +0 -0
  78. {csoundengine-2.23.0 → csoundengine-2.23.1}/docs/assets/tableproxy-plot.png +0 -0
  79. {csoundengine-2.23.0 → csoundengine-2.23.1}/docs/assets/tableproxy-plotspectrogram.png +0 -0
  80. {csoundengine-2.23.0 → csoundengine-2.23.1}/docs/assets/ui2.png +0 -0
  81. {csoundengine-2.23.0 → csoundengine-2.23.1}/docs/conf.py +0 -0
  82. {csoundengine-2.23.0 → csoundengine-2.23.1}/docs/config.rst +0 -0
  83. {csoundengine-2.23.0 → csoundengine-2.23.1}/docs/configkeys.rst +0 -0
  84. {csoundengine-2.23.0 → csoundengine-2.23.1}/docs/csoundengine.rst +0 -0
  85. {csoundengine-2.23.0 → csoundengine-2.23.1}/docs/csoundlib.rst +0 -0
  86. {csoundengine-2.23.0 → csoundengine-2.23.1}/docs/instr.rst +0 -0
  87. {csoundengine-2.23.0 → csoundengine-2.23.1}/docs/jupyternotebook.rst +0 -0
  88. {csoundengine-2.23.0 → csoundengine-2.23.1}/docs/magics.rst +0 -0
  89. {csoundengine-2.23.0 → csoundengine-2.23.1}/docs/make.bat +0 -0
  90. {csoundengine-2.23.0 → csoundengine-2.23.1}/docs/offline.rst +0 -0
  91. {csoundengine-2.23.0 → csoundengine-2.23.1}/docs/offlineengine.rst +0 -0
  92. {csoundengine-2.23.0 → csoundengine-2.23.1}/docs/offlineengine_example.inc +0 -0
  93. {csoundengine-2.23.0 → csoundengine-2.23.1}/docs/offlineengine_example2.inc +0 -0
  94. {csoundengine-2.23.0 → csoundengine-2.23.1}/docs/offlinerenderer.rst +0 -0
  95. {csoundengine-2.23.0 → csoundengine-2.23.1}/docs/renderjob.rst +0 -0
  96. {csoundengine-2.23.0 → csoundengine-2.23.1}/docs/requirements.txt +0 -0
  97. {csoundengine-2.23.0 → csoundengine-2.23.1}/docs/schedevent.rst +0 -0
  98. {csoundengine-2.23.0 → csoundengine-2.23.1}/docs/session.rst +0 -0
  99. {csoundengine-2.23.0 → csoundengine-2.23.1}/docs/synth.rst +0 -0
  100. {csoundengine-2.23.0 → csoundengine-2.23.1}/docs/tables.rst +0 -0
  101. {csoundengine-2.23.0 → csoundengine-2.23.1}/notebooks/buses.ipynb +0 -0
  102. {csoundengine-2.23.0 → csoundengine-2.23.1}/notebooks/offlineengine-playback.ipynb +0 -0
  103. {csoundengine-2.23.0 → csoundengine-2.23.1}/notebooks/offlineengine.ipynb +0 -0
  104. {csoundengine-2.23.0 → csoundengine-2.23.1}/notebooks/snd/colours-german-male.flac +0 -0
  105. {csoundengine-2.23.0 → csoundengine-2.23.1}/notebooks/snd/piano-pitchtest-2.flac +0 -0
  106. {csoundengine-2.23.0 → csoundengine-2.23.1}/notebooks/snd/voiceover-fragment-48k.flac +0 -0
  107. {csoundengine-2.23.0 → csoundengine-2.23.1}/notebooks/test/plltrack.ipynb +0 -0
  108. {csoundengine-2.23.0 → csoundengine-2.23.1}/notebooks/test/test-bus.ipynb +0 -0
  109. {csoundengine-2.23.0 → csoundengine-2.23.1}/notebooks/test/test-dealloc-synth.ipynb +0 -0
  110. {csoundengine-2.23.0 → csoundengine-2.23.1}/notebooks/test/test-delay.ipynb +0 -0
  111. {csoundengine-2.23.0 → csoundengine-2.23.1}/notebooks/test/test-engine-params.ipynb +0 -0
  112. {csoundengine-2.23.0 → csoundengine-2.23.1}/notebooks/test/test-libcsound.ipynb +0 -0
  113. {csoundengine-2.23.0 → csoundengine-2.23.1}/notebooks/test/test-named-events.ipynb +0 -0
  114. {csoundengine-2.23.0 → csoundengine-2.23.1}/notebooks/test/test-new-named-params.ipynb +0 -0
  115. {csoundengine-2.23.0 → csoundengine-2.23.1}/notebooks/test/test-offline-render.ipynb +0 -0
  116. {csoundengine-2.23.0 → csoundengine-2.23.1}/notebooks/test/test-offlinesession.ipynb +0 -0
  117. {csoundengine-2.23.0 → csoundengine-2.23.1}/notebooks/test/test-params.ipynb +0 -0
  118. {csoundengine-2.23.0 → csoundengine-2.23.1}/notebooks/test/test-playsample.ipynb +0 -0
  119. {csoundengine-2.23.0 → csoundengine-2.23.1}/notebooks/test/test-stop.ipynb +0 -0
  120. {csoundengine-2.23.0 → csoundengine-2.23.1}/notebooks/test/test-tight-scheduling.ipynb +0 -0
  121. {csoundengine-2.23.0 → csoundengine-2.23.1}/notebooks/test/test-whenfinished.ipynb +0 -0
  122. {csoundengine-2.23.0 → csoundengine-2.23.1}/notebooks/voice-pitch-track.ipynb +0 -0
  123. {csoundengine-2.23.0 → csoundengine-2.23.1}/pyrightconfig.json +0 -0
  124. {csoundengine-2.23.0 → csoundengine-2.23.1}/readthedocs.yml +0 -0
  125. {csoundengine-2.23.0 → csoundengine-2.23.1}/scripts/download-plugins.py +0 -0
  126. {csoundengine-2.23.0 → csoundengine-2.23.1}/scripts/update-config-docs.py +0 -0
  127. {csoundengine-2.23.0 → csoundengine-2.23.1}/setup.cfg +0 -0
  128. {csoundengine-2.23.0 → csoundengine-2.23.1}/test/importtime.py +0 -0
  129. {csoundengine-2.23.0 → csoundengine-2.23.1}/test/libcsoundtest.py +0 -0
  130. {csoundengine-2.23.0 → csoundengine-2.23.1}/test/simple.py +0 -0
  131. {csoundengine-2.23.0 → csoundengine-2.23.1}/test/test1.csd +0 -0
  132. {csoundengine-2.23.0 → csoundengine-2.23.1}/test/test1.py +0 -0
  133. {csoundengine-2.23.0 → csoundengine-2.23.1}/test/test2.py +0 -0
  134. {csoundengine-2.23.0 → csoundengine-2.23.1}/test/testargs.py +0 -0
@@ -169,3 +169,41 @@ jobs:
169
169
  with:
170
170
  name: artifact-csound7-${{ matrix.os }}-${{ matrix.python-version }}-${{ strategy.job-index }}
171
171
  path: test/*.wav
172
+
173
+ testdeps:
174
+ name: Check that all dependencies are installed without a system csound
175
+ # csound is not preinstalled on these runners. Importing libcsound (which
176
+ # happens when importing csoundengine) is expected to install csound and
177
+ # its plugins on demand.
178
+ # ubuntu-latest -> linux x86_64, macos-latest -> macos arm64
179
+ # (intentionally not linux-arm64 nor windows, where this is not supported)
180
+ runs-on: ${{ matrix.os }}
181
+ strategy:
182
+ matrix:
183
+ os: ["ubuntu-latest", "macos-latest"]
184
+ python-version: ["3.12", "3.13"]
185
+ fail-fast: false
186
+
187
+ steps:
188
+ - uses: actions/checkout@v3
189
+
190
+ - uses: actions/setup-python@v4
191
+ with:
192
+ python-version: ${{ matrix.python-version }}
193
+
194
+ - name: check that csound is not preinstalled
195
+ run: |
196
+ if command -v csound; then
197
+ echo "ERROR: this test expects csound to not be installed beforehand"
198
+ exit 1
199
+ fi
200
+ echo "csound is not preinstalled, good"
201
+
202
+ - name: install csoundengine (csound is not installed on purpose)
203
+ run: |
204
+ pip install .
205
+
206
+ - name: check that all dependencies (csound, plugins) get installed
207
+ run: |
208
+ cd test
209
+ python testdeps.py
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: csoundengine
3
- Version: 2.23.0
3
+ Version: 2.23.1
4
4
  Summary: An audio synthesis framework using csound
5
5
  Author-email: Eduardo Moguillansky <eduardo.moguillansky@gmail.com>
6
6
  License: GNU GENERAL PUBLIC LICENSE
@@ -680,7 +680,7 @@ License: GNU GENERAL PUBLIC LICENSE
680
680
  Project-URL: Homepage, https://github.com/gesellkammer/csoundengine
681
681
  Classifier: Programming Language :: Python :: 3
682
682
  Classifier: Operating System :: OS Independent
683
- Requires-Python: >=3.10
683
+ Requires-Python: >=3.12
684
684
  Description-Content-Type: text/x-rst
685
685
  License-File: LICENSE.txt
686
686
  Requires-Dist: numpy
@@ -695,12 +695,12 @@ Requires-Dist: ipywidgets
695
695
  Requires-Dist: xxhash
696
696
  Requires-Dist: docstring_parser
697
697
  Requires-Dist: typing_extensions
698
- Requires-Dist: libcsound>=0.16.1
698
+ Requires-Dist: libcsound>=0.17.0
699
699
  Requires-Dist: sndfileio>=2.1.1
700
700
  Requires-Dist: emlib>=1.20
701
701
  Requires-Dist: configdict>=2.10.0
702
702
  Requires-Dist: pitchtools>=1.14.0
703
- Requires-Dist: risset>=3.2.2
703
+ Requires-Dist: risset>=3.5.4
704
704
  Requires-Dist: sounddevice
705
705
  Dynamic: license-file
706
706
 
@@ -885,8 +885,13 @@ https://csoundengine.readthedocs.io/en/latest/Installation.html
885
885
  Dependencies
886
886
  ~~~~~~~~~~~~
887
887
 
888
- * python >= 3.9
889
- * csound 6 >= 6.17 (https://github.com/csound/csound/releases). Csound 7 is supported and recommended
888
+ * python >= 3.12
889
+ * csound 7 >= 7.0 (csound 6 is supported but it is declared EOL)
890
+
891
+ .. note::
892
+ csound only needs to be installed previously on windows at the moment, for
893
+ the other platforms it is installed automatically if not present
894
+
890
895
 
891
896
  .. code-block:: bash
892
897
 
@@ -179,8 +179,13 @@ https://csoundengine.readthedocs.io/en/latest/Installation.html
179
179
  Dependencies
180
180
  ~~~~~~~~~~~~
181
181
 
182
- * python >= 3.9
183
- * csound 6 >= 6.17 (https://github.com/csound/csound/releases). Csound 7 is supported and recommended
182
+ * python >= 3.12
183
+ * csound 7 >= 7.0 (csound 6 is supported but it is declared EOL)
184
+
185
+ .. note::
186
+ csound only needs to be installed previously on windows at the moment, for
187
+ the other platforms it is installed automatically if not present
188
+
184
189
 
185
190
  .. code-block:: bash
186
191
 
@@ -39,12 +39,6 @@ if TYPE_CHECKING:
39
39
  logger = _logging.getLogger("csoundengine")
40
40
 
41
41
 
42
- _cache: dict[str, Any] = {
43
- 'opcodes': None,
44
- 'versionTriplet': None
45
- }
46
-
47
-
48
42
  _audioDeviceRegex = r"(\d+):\s((?:adc|dac)\d+)\s*\((.*)\)(?:\s+\[ch:(\d+)\])?"
49
43
 
50
44
 
@@ -401,6 +395,8 @@ class _AlsaBackend(AudioBackend):
401
395
 
402
396
  @_functools.cache
403
397
  def _getAvailableAudioBackends() -> dict[str, AudioBackend]:
398
+ # This is not correct, we should actually check which plugins
399
+ # are available
404
400
  _backendPortaudioCallback = _PortaudioBackend('callback')
405
401
 
406
402
  backends: dict[str, AudioBackend] = {
@@ -414,7 +410,6 @@ def _getAvailableAudioBackends() -> dict[str, AudioBackend]:
414
410
 
415
411
  if sys.platform == 'linux':
416
412
  backends['alsa'] = _AlsaBackend()
417
- backends['pulseaudio'] = _PulseAudioBackend()
418
413
  elif sys.platform == 'darwin':
419
414
  auhal = AudioBackend('auhal', alwaysAvailable=True, hasSystemSr=True,
420
415
  needsRealtime=False, longname="coreaudio",
@@ -439,17 +434,7 @@ def findCsound() -> str | None:
439
434
  return csound
440
435
 
441
436
 
442
- def _getVersionViaApi() -> tuple[int, int, int]:
443
- """
444
- Returns the csound version as tuple (major, minor, patch)
445
- """
446
- if (version := _cache.get('versionTriplet')) is not None:
447
- return version
448
- return _csoundGetInfoViaAPI()['versionTriplet']
449
-
450
-
451
- @_functools.cache
452
- def getVersion(useApi=True) -> tuple[int, int, int | str]:
437
+ def getVersion(opcodedir='') -> tuple[int, int, int | str]:
453
438
  """
454
439
  Returns the csound version as tuple (major, minor, patch)
455
440
 
@@ -464,34 +449,7 @@ def getVersion(useApi=True) -> tuple[int, int, int | str]:
464
449
  Raises RuntimeError if csound is not present or its version
465
450
  can't be parsed
466
451
  """
467
- if useApi:
468
- return _getVersionViaApi()
469
-
470
- csound = findCsound()
471
- if not csound:
472
- raise IOError("Csound not found")
473
- cmd = '{csound} --version'.format(csound=csound).split()
474
- proc = _subprocess.Popen(cmd, stderr=_subprocess.PIPE)
475
- proc.wait()
476
- if proc.stderr is None:
477
- return (0, 0, 0)
478
- outputbytes = proc.stderr.read()
479
- if not outputbytes:
480
- raise RuntimeError("Could not read csounds output")
481
- output = outputbytes.decode('utf8')
482
- lines = output.splitlines()
483
- for line in lines:
484
- if match := _re.search(r"Csound\s+version\s+(\d+)\.(\d+)(\.\w+)?", line):
485
- major = int(match.group(1))
486
- minor = int(match.group(2))
487
- patch = match.group(3)
488
- if patch is None:
489
- patch = 0
490
- elif patch.isdigit():
491
- patch = int(patch)
492
- return (major, minor, patch)
493
- else:
494
- raise RuntimeError(f"Did not find a csound version, csound output: '{output}'")
452
+ return csoundGetInfo(opcodedir=opcodedir)['versionTriplet']
495
453
 
496
454
 
497
455
  def csoundSubproc(args: list[str], piped=True, wait=False) -> _subprocess.Popen:
@@ -558,28 +516,6 @@ def getSystemSr(backend: str) -> float | None:
558
516
  return b.getSystemSr()
559
517
 
560
518
 
561
- # def _getJackSrViaClient() -> float:
562
- # import jack
563
- # c = jack.Client("query")
564
- # sr = c.samplerate
565
- # c.close()
566
- # return sr
567
-
568
-
569
- # def _getCsoundSystemSr(backend: str) -> float:
570
- # if backend not in {'jack', 'auhal'}:
571
- # raise ValueError(f"backend {backend} does not support system sr")
572
- # import libcsound
573
- # csound = libcsound.Csound()
574
- # csound.setOption(f"-+rtaudio={backend}")
575
- # csound.setOption("-odac")
576
- # csound.setOption("--use-system-sr")
577
- # csound.start()
578
- # sr = csound.sr()
579
- # csound.stop()
580
- # return sr
581
-
582
-
583
519
  def getDefaultBackend() -> AudioBackend:
584
520
  """
585
521
  Get the default active backend for platform
@@ -743,6 +679,7 @@ def testCsound(dur=8., nchnls=2, backend='', device="dac", sr=0, ksmps=64,
743
679
  sr = {sr}
744
680
  ksmps = {ksmps}
745
681
  nchnls = {nchnls}
682
+ 0dbfs = 1
746
683
 
747
684
  instr 1
748
685
  iperiod = 1
@@ -778,15 +715,17 @@ def installedOpcodes(cached=True, opcodedir: str = '') -> set[str]:
778
715
  Returns:
779
716
  a list of all available opcodes
780
717
  """
781
- if opcodedir:
782
- cached = False
783
- if cached and _cache.get('opcodes') is not None:
784
- return _cache['opcodes']
785
- return _csoundGetInfoViaAPI(opcodedir=opcodedir)['opcodes']
718
+ #if not cached:
719
+ # csoundGetInfo.cache_clear()
720
+ return csoundGetInfo(opcodedir=opcodedir)['opcodes']
786
721
 
787
722
 
788
- def _csoundGetInfoViaAPI(opcodedir='') -> dict:
789
- global _cache
723
+ # @_functools.cache
724
+ def csoundGetInfo(opcodedir='') -> dict:
725
+ """
726
+ Returns a dict of {'opcodedefs': list[OpcodeDef], 'opcodes': set[str], 'versionTriplet': (major, minor, patch)}
727
+
728
+ """
790
729
  import libcsound
791
730
  cs = libcsound.Csound(opcodeDir=opcodedir)
792
731
  cs.setOption("-d")
@@ -799,11 +738,9 @@ def _csoundGetInfoViaAPI(opcodedir='') -> dict:
799
738
  major = int(vs[:-3])
800
739
  versionTriplet = (major, minor, patch)
801
740
  opcodes = cs.getOpcodes()
802
- opcodenames = set(opc.name for opc in opcodes)
803
- _cache['versionTriplet'] = versionTriplet
804
- _cache['opcodes'] = opcodenames
805
- _cache['opcodedefs'] = opcodes
806
741
  cs.stop()
742
+ cs.destroy()
743
+ opcodenames = {opc.name.split(".")[0] for opc in opcodes}
807
744
  return {'opcodedefs': opcodes,
808
745
  'opcodes': opcodenames,
809
746
  'versionTriplet': versionTriplet}
@@ -10,9 +10,7 @@ import tempfile
10
10
  from datetime import datetime
11
11
  from pathlib import Path
12
12
 
13
- from . import tools
14
13
  from .state import state
15
- from . import csounddefs
16
14
 
17
15
 
18
16
  logger = logging.getLogger("csoundengine.dependencies")
@@ -151,13 +149,17 @@ def pluginsInstalled(cached=True) -> bool:
151
149
  from . import csoundlib
152
150
  installedOpcodes = csoundlib.installedOpcodes(cached=cached)
153
151
  neededOpcodes = {
154
- "atstop", "pwrite", "pread", "initerror",
155
- "dict_new", "dict_set", "dict_get",
156
- "pool_gen", "pool_pop", "pool_push", "pool_isfull",
152
+ "atstop", "pwrite",
153
+ "dict_new", "pool_gen", "pool_pop", "pool_push",
157
154
  'interp1d', 'bisect', 'ftsetparams', 'zeroarray',
158
155
  'panstereo'
159
156
  }
160
- return neededOpcodes.issubset(installedOpcodes)
157
+ ok = neededOpcodes.issubset(installedOpcodes)
158
+ if not ok:
159
+ notfound = neededOpcodes - installedOpcodes
160
+ logger.debug("Opcodes not found: %s", notfound)
161
+ logger.debug("Opcodes found: %s...", sorted(installedOpcodes)[:20])
162
+ return ok
161
163
 
162
164
 
163
165
  def _getDownloadsFolder() -> Path:
@@ -169,44 +171,6 @@ def _getDownloadsFolder() -> Path:
169
171
  return tempdir
170
172
 
171
173
 
172
- def _installPluginsFromDist(apiversion=6, codesign=True) -> None:
173
- platformid = tools.platformId()
174
- rootfolder = Path(os.path.split(__file__)[0])
175
- assert rootfolder.exists()
176
- globpattern = {
177
- 'macos': '*.dylib',
178
- 'windows': '*.dll',
179
- 'linux': '*.so'
180
- }.get(platformid.osname, None)
181
- if globpattern is None:
182
- raise RuntimeError(f"Platform {platformid} not supported")
183
-
184
- subfolder = str(platformid)
185
- pluginspath = rootfolder/f'data/plugins{apiversion}'/subfolder
186
- if not pluginspath.exists():
187
- raise RuntimeError(f"Could not find own csound plugins. Folder: {pluginspath}")
188
- plugins = list(pluginspath.glob(globpattern))
189
- if not plugins:
190
- logger.error(f"Plugins not found. Plugins folder: '{pluginspath}', "
191
- f"glob patter: '{globpattern}'")
192
- raise RuntimeError("Plugins not found")
193
- pluginsDest = csounddefs.userPluginsFolder(apiversion=f'{apiversion}.0')
194
- logger.info(f"Installing plugins in folder: '{pluginsDest}'")
195
- os.makedirs(pluginsDest, exist_ok=True)
196
- _copyFiles([plugin.as_posix() for plugin in plugins], pluginsDest, verbose=True)
197
- if platformid.osname == 'macos' and codesign:
198
- installedBinaries = [os.path.join(pluginsDest, plugin.name)
199
- for plugin in plugins]
200
- assert all(os.path.exists(binary) for binary in installedBinaries)
201
- try:
202
- _codesignBinaries(installedBinaries)
203
- except RuntimeError as e:
204
- logger.error(f"Could not code-sign the binaries, error: {e}")
205
- if platformid.arch == 'arm64':
206
- logger.error(f"... The needed plugins will probably not work as is. You can still "
207
- f"manually authorize them via right-click. The paths are: {installedBinaries}")
208
-
209
-
210
174
  def _installPluginsViaRisset(majorversion: int | None = None) -> bool:
211
175
  """
212
176
  Tries to install plugins via risset
@@ -215,7 +179,7 @@ def _installPluginsViaRisset(majorversion: int | None = None) -> bool:
215
179
  """
216
180
  logger.info("Trying to install plugins via risset")
217
181
  import risset
218
- idx = risset.MainIndex(update=True, majorversion=majorversion)
182
+ idx = risset.MainIndex(update=True, major_version=majorversion or 7)
219
183
  for pluginname in ['else', 'beosc', 'klib']:
220
184
  p = idx.plugins.get(pluginname)
221
185
  if p is None:
@@ -224,10 +188,12 @@ def _installPluginsViaRisset(majorversion: int | None = None) -> bool:
224
188
  elif idx.is_plugin_installed(p):
225
189
  logger.debug(f"Plugin '{pluginname}' already installed, skipping")
226
190
  else:
191
+ logger.debug(f"Installing plugin {pluginname}")
227
192
  errmsg = idx.install_plugin(p)
228
193
  if errmsg:
229
194
  logger.error(f"Error while installing plugin {pluginname}: {errmsg}")
230
195
  return False
196
+ logger.debug("---- Installed all plugins")
231
197
  return True
232
198
 
233
199
 
@@ -251,30 +217,30 @@ def installPlugins() -> bool:
251
217
  " listed by csound")
252
218
  from . import csoundlib
253
219
  opcodes = csoundlib.installedOpcodes(cached=False)
254
- opcodestr = ', '.join(opcodes)
255
- logger.error(f"List of opcodes loaded by csound: {opcodestr}")
220
+ logger.error("List of opcodes loaded by csound: %s", ', '.join(sorted(opcodes)))
256
221
  return False
257
222
  except Exception as e:
258
223
  logger.error(f"Exception {e} while trying to install plugins via risset")
259
224
  return False
260
225
 
261
226
 
262
- def _checkDependencies(fix=False, quiet=False) -> str:
227
+ def _checkDependencies(fix=False) -> str:
263
228
  """
264
229
  Returns an error message on failure, or an empty string on success
265
230
  """
266
231
  from . import csoundlib
267
- version = csoundlib.getVersion(useApi=True)
232
+ info = csoundlib.csoundGetInfo()
233
+ version = info['versionTriplet']
268
234
 
269
235
  if version < (6, 16, 0):
270
236
  return f"Csound version ({version}) is too old, should be >= 6.16"
271
237
 
272
- if version[0] >= 7:
273
- logger.debug("Csound 7 support is experimental")
238
+ elif version < (7, 0, 0):
239
+ logger.info("Support for csound 6 has been deprecated, use at your own risk")
274
240
 
275
241
  if not pluginsInstalled():
276
242
  if fix:
277
- print("** csoundengine: Csound external plugins are not installed or are too old."
243
+ print("** csoundengine: Csound external plugins are not installed"
278
244
  " I will try to install them now")
279
245
  ok = installPlugins()
280
246
  if ok:
@@ -337,14 +303,3 @@ def checkDependencies(force=True, fix=False) -> bool:
337
303
  if not fix:
338
304
  logger.error("Missing dependencies might be installed by calling installDependencies()")
339
305
  return not errormsg
340
-
341
-
342
- def _codesignBinaries(binaries: list[str]) -> None:
343
- """
344
- Calls codesign to sign the binaries with adhoc signature
345
-
346
- Raises RuntimeError on fail
347
- """
348
- import risset
349
- logger.warning(f"Codesigning macos binaries: {binaries}")
350
- risset.macos_codesign(binaries, signature='-')
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: csoundengine
3
- Version: 2.23.0
3
+ Version: 2.23.1
4
4
  Summary: An audio synthesis framework using csound
5
5
  Author-email: Eduardo Moguillansky <eduardo.moguillansky@gmail.com>
6
6
  License: GNU GENERAL PUBLIC LICENSE
@@ -680,7 +680,7 @@ License: GNU GENERAL PUBLIC LICENSE
680
680
  Project-URL: Homepage, https://github.com/gesellkammer/csoundengine
681
681
  Classifier: Programming Language :: Python :: 3
682
682
  Classifier: Operating System :: OS Independent
683
- Requires-Python: >=3.10
683
+ Requires-Python: >=3.12
684
684
  Description-Content-Type: text/x-rst
685
685
  License-File: LICENSE.txt
686
686
  Requires-Dist: numpy
@@ -695,12 +695,12 @@ Requires-Dist: ipywidgets
695
695
  Requires-Dist: xxhash
696
696
  Requires-Dist: docstring_parser
697
697
  Requires-Dist: typing_extensions
698
- Requires-Dist: libcsound>=0.16.1
698
+ Requires-Dist: libcsound>=0.17.0
699
699
  Requires-Dist: sndfileio>=2.1.1
700
700
  Requires-Dist: emlib>=1.20
701
701
  Requires-Dist: configdict>=2.10.0
702
702
  Requires-Dist: pitchtools>=1.14.0
703
- Requires-Dist: risset>=3.2.2
703
+ Requires-Dist: risset>=3.5.4
704
704
  Requires-Dist: sounddevice
705
705
  Dynamic: license-file
706
706
 
@@ -885,8 +885,13 @@ https://csoundengine.readthedocs.io/en/latest/Installation.html
885
885
  Dependencies
886
886
  ~~~~~~~~~~~~
887
887
 
888
- * python >= 3.9
889
- * csound 6 >= 6.17 (https://github.com/csound/csound/releases). Csound 7 is supported and recommended
888
+ * python >= 3.12
889
+ * csound 7 >= 7.0 (csound 6 is supported but it is declared EOL)
890
+
891
+ .. note::
892
+ csound only needs to be installed previously on windows at the moment, for
893
+ the other platforms it is installed automatically if not present
894
+
890
895
 
891
896
  .. code-block:: bash
892
897
 
@@ -1,4 +1,3 @@
1
- .cirrus.yml
2
1
  .gitignore
3
2
  LICENSE.txt
4
3
  MANIFEST.in
@@ -127,4 +126,5 @@ test/simple.py
127
126
  test/test1.csd
128
127
  test/test1.py
129
128
  test/test2.py
130
- test/testargs.py
129
+ test/testargs.py
130
+ test/testdeps.py
@@ -10,10 +10,10 @@ ipywidgets
10
10
  xxhash
11
11
  docstring_parser
12
12
  typing_extensions
13
- libcsound>=0.16.1
13
+ libcsound>=0.17.0
14
14
  sndfileio>=2.1.1
15
15
  emlib>=1.20
16
16
  configdict>=2.10.0
17
17
  pitchtools>=1.14.0
18
- risset>=3.2.2
18
+ risset>=3.5.4
19
19
  sounddevice
@@ -0,0 +1,15 @@
1
+ Installation
2
+ ============
3
+
4
+ For all platforms, the installation is the same::
5
+
6
+ pip install csoundengine
7
+
8
+
9
+ Dependencies
10
+ ------------
11
+
12
+ on windows, **csoundengine** depends on **csound** being installed. For the other platforms
13
+ it will be installed if it is not present. If you already have csound installed, the
14
+ version detected will be used, but bear in mind that if using csound 7, a recent version
15
+ is needed since the plugins used are compiled against the last development version
@@ -297,8 +297,9 @@ Features
297
297
  parameters and default values. This makes it very easy to create instruments with
298
298
  many parameters. When an instance of such an instrument is scheduled **csoundengine**
299
299
  fills the values of any parameter which is not explicitely given with the default
300
- value. Any parg can also be modulated in real-time. See :meth:`Engine.setp() <csoundengine.engine.Engine.setp>`
301
- and :meth:`Engine.getp() <csoundengine.engine.Engine.getp>`
300
+ value. Any parg can also be modulated in real-time.
301
+ See :meth:`Engine.setp() <csoundengine.engine.Engine.setp>`
302
+
302
303
  * **Event ids / Modulation** - in *csoundengine* every event can have a unique id assigned,
303
304
  allowing the user to control it during performance, from python or from csound directly.
304
305
  * **Informed use of the Csound API** - *csoundengine* uses the most convenient part of the
@@ -14,7 +14,8 @@ Interaction with *csound* is through its API using
14
14
  `libcsound <https://github.com/csound-plugins/libcsound>`_.
15
15
  See the `Csound FLOSS manual <https://flossmanual.csound.com/introduction/preface>`_
16
16
  to learn more about csound and its syntax and run examples online. **csoundengine**
17
- is compatible with any recent version of csound6 (>= 6.16) and csound7
17
+ is compatible with any recent version of csound7 (csound 6 is supported but
18
+ it has been declared EOL)
18
19
 
19
20
  The source code of this package is hosted at https://github.com/gesellkammer/csoundengine
20
21
 
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
5
5
 
6
6
  [project]
7
7
  name = "csoundengine"
8
- version = "2.23.0"
8
+ version = "2.23.1"
9
9
  license = { file = "LICENSE.txt" }
10
10
  description = "An audio synthesis framework using csound"
11
11
  authors = [
@@ -19,7 +19,7 @@ classifiers = [
19
19
  "Operating System :: OS Independent",
20
20
  ]
21
21
 
22
- requires-python = ">=3.10"
22
+ requires-python = ">=3.12"
23
23
 
24
24
  dependencies = [
25
25
  "numpy",
@@ -35,12 +35,12 @@ dependencies = [
35
35
  "docstring_parser",
36
36
  "typing_extensions",
37
37
 
38
- "libcsound>=0.16.1",
38
+ "libcsound>=0.17.0",
39
39
  "sndfileio>=2.1.1",
40
40
  "emlib>=1.20",
41
41
  "configdict>=2.10.0",
42
42
  "pitchtools>=1.14.0",
43
- "risset>=3.2.2",
43
+ "risset>=3.5.4",
44
44
  "sounddevice",
45
45
  ]
46
46
 
@@ -48,8 +48,8 @@ dependencies = [
48
48
  packages = ["csoundengine"]
49
49
 
50
50
 
51
- [tool.setuptools.package-data]
52
- csoundengine = ['csoundengine/data']
51
+ # [tool.setuptools.package-data]
52
+ # csoundengine = ['csoundengine/data']
53
53
 
54
54
 
55
55
  [project.urls]
@@ -0,0 +1,46 @@
1
+ """
2
+ Check that all dependencies needed by csoundengine (csound and its plugins)
3
+ are available even if csound is not preinstalled in the system.
4
+
5
+ csoundengine does not use the csound binary. The csound library comes
6
+ with the pip package ``libcsound``, which installs csound (and the needed
7
+ plugins) on demand the first time it is imported if no csound
8
+ installation is found.
9
+
10
+ This test is meant to be run in a clean environment where csound is not
11
+ installed (see the ``testdeps`` job in .github/workflows/test2.yml)
12
+ """
13
+ import sys
14
+ import shutil
15
+ import platform
16
+ import logging
17
+
18
+ logging.basicConfig(level=logging.DEBUG,
19
+ format="%(levelname)s %(name)s: %(message)s")
20
+
21
+ print("python :", sys.version)
22
+ print("platform:", platform.platform())
23
+ print("machine :", platform.machine())
24
+
25
+ csoundbin = shutil.which("csound")
26
+ print(f"csound binary in path: {csoundbin or '<not found>'}")
27
+ if csoundbin:
28
+ print("Warning: csound is preinstalled, the auto-installation of csound"
29
+ " by libcsound will not be exercised")
30
+
31
+ # Importing csoundengine imports libcsound. If no csound installation is
32
+ # found, libcsound installs csound (together with its plugins) automatically
33
+ import csoundengine # noqa: F401
34
+ from csoundengine import dependencies
35
+
36
+ ok = dependencies.checkDependencies(force=True, fix=True)
37
+ pluginsok = dependencies.pluginsInstalled(cached=False)
38
+ print(f"Dependencies ok: {ok}")
39
+ print(f"Plugins ok: {pluginsok}")
40
+ if not (ok and pluginsok):
41
+ print("******************* Some dependencies are not met")
42
+ sys.exit(1)
43
+
44
+ from csoundengine import csoundlib
45
+ print("csound version:", csoundlib.getVersion())
46
+ print(":::::::::::::::: All dependencies are installed")
@@ -1,40 +0,0 @@
1
- container:
2
- image: python:latest
3
-
4
- test_task:
5
-
6
- macos_instance:
7
- image: ghcr.io/cirruslabs/macos-ventura-xcode:latest
8
-
9
- test_script: |
10
- set -x
11
- ls -l
12
- python3 -c 'import platform; print(platform.machine(), platform.uname())' # , platform.dist())'
13
- brew install csound
14
-
15
- python3 -m venv .venv
16
- source .venv/bin/activate
17
-
18
- python3 -m pip install .
19
- cd test
20
- python3 test1.py -o test1-mac-arm64.wav
21
- python3 test2.py
22
-
23
- ls -l
24
- cd ..
25
-
26
- binaries_artifacts:
27
- path: test/*.wav
28
-
29
-
30
-
31
- #
32
- # OSX
33
- #
34
- #osx_task:
35
- # auto_cancellation: true
36
-
37
- #
38
- # check_script:
39
- # - python3 -c "import platform; print(platform.machine(), platform.architecture())"
40
-
@@ -1,19 +0,0 @@
1
- Installation
2
- ============
3
-
4
- `csoundengine` needs a python version >= 3.8. For all platforms, the installation is
5
- the same::
6
-
7
- pip install csoundengine
8
-
9
-
10
- Dependencies
11
- ------------
12
-
13
- **csoundengine** depends on **csound** itself being installed. At the moment the minimal
14
- version of csound supported is **6.16**. **csound 7**, even if not officially released
15
- yet, is supported and tested regularly.
16
-
17
- For **macos** and **windows**, **csound** can be installed by the provided installers
18
- (`<https://github.com/csound/csound/releases>`_). For linux, the installation via
19
- the distribution's package manager is the recommended way.
File without changes
File without changes
File without changes
File without changes