cyfaust 0.1.0__cp311-cp311-macosx_15_0_arm64.whl

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 (693) hide show
  1. cyfaust/CMakeLists.txt +93 -0
  2. cyfaust/__init__.py +0 -0
  3. cyfaust/__main__.py +819 -0
  4. cyfaust/box.pxd +46 -0
  5. cyfaust/box.pyx +2459 -0
  6. cyfaust/common.pxd +5 -0
  7. cyfaust/common.pyx +61 -0
  8. cyfaust/cyfaust.cpython-311-darwin.so +0 -0
  9. cyfaust/faust_box.pxd +298 -0
  10. cyfaust/faust_box_oo.pyx +66 -0
  11. cyfaust/faust_gui.pxd +261 -0
  12. cyfaust/faust_interp.pxd +160 -0
  13. cyfaust/faust_player.pxd +80 -0
  14. cyfaust/faust_signal.pxd +257 -0
  15. cyfaust/gui_statics.cpp +15 -0
  16. cyfaust/interp.pyx +673 -0
  17. cyfaust/player.cpp +32519 -0
  18. cyfaust/player.pyx +191 -0
  19. cyfaust/resources/architecture/AU/AUPublic/AUBase/AUBase.cpp +2327 -0
  20. cyfaust/resources/architecture/AU/AUPublic/AUBase/AUBase.h +1019 -0
  21. cyfaust/resources/architecture/AU/AUPublic/AUBase/AUDispatch.cpp +423 -0
  22. cyfaust/resources/architecture/AU/AUPublic/AUBase/AUDispatch.h +82 -0
  23. cyfaust/resources/architecture/AU/AUPublic/AUBase/AUInputElement.cpp +151 -0
  24. cyfaust/resources/architecture/AU/AUPublic/AUBase/AUInputElement.h +119 -0
  25. cyfaust/resources/architecture/AU/AUPublic/AUBase/AUOutputElement.cpp +62 -0
  26. cyfaust/resources/architecture/AU/AUPublic/AUBase/AUOutputElement.h +66 -0
  27. cyfaust/resources/architecture/AU/AUPublic/AUBase/AUPlugInDispatch.cpp +615 -0
  28. cyfaust/resources/architecture/AU/AUPublic/AUBase/AUPlugInDispatch.h +128 -0
  29. cyfaust/resources/architecture/AU/AUPublic/AUBase/AUScopeElement.cpp +512 -0
  30. cyfaust/resources/architecture/AU/AUPublic/AUBase/AUScopeElement.h +544 -0
  31. cyfaust/resources/architecture/AU/AUPublic/AUBase/ComponentBase.cpp +370 -0
  32. cyfaust/resources/architecture/AU/AUPublic/AUBase/ComponentBase.h +340 -0
  33. cyfaust/resources/architecture/AU/AUPublic/AUEffectBase/AUEffectBase.cpp +463 -0
  34. cyfaust/resources/architecture/AU/AUPublic/AUEffectBase/AUEffectBase.h +391 -0
  35. cyfaust/resources/architecture/AU/AUPublic/AUInstrumentBase/AUInstrumentBase.cpp +837 -0
  36. cyfaust/resources/architecture/AU/AUPublic/AUInstrumentBase/AUInstrumentBase.h +267 -0
  37. cyfaust/resources/architecture/AU/AUPublic/AUInstrumentBase/AUMIDIBase.cpp +495 -0
  38. cyfaust/resources/architecture/AU/AUPublic/AUInstrumentBase/AUMIDIBase.h +213 -0
  39. cyfaust/resources/architecture/AU/AUPublic/AUInstrumentBase/LockFreeFIFO.h +168 -0
  40. cyfaust/resources/architecture/AU/AUPublic/AUInstrumentBase/MIDIControlHandler.h +92 -0
  41. cyfaust/resources/architecture/AU/AUPublic/AUInstrumentBase/MusicDeviceBase.cpp +354 -0
  42. cyfaust/resources/architecture/AU/AUPublic/AUInstrumentBase/MusicDeviceBase.h +126 -0
  43. cyfaust/resources/architecture/AU/AUPublic/AUInstrumentBase/SynthElement.cpp +419 -0
  44. cyfaust/resources/architecture/AU/AUPublic/AUInstrumentBase/SynthElement.h +227 -0
  45. cyfaust/resources/architecture/AU/AUPublic/AUInstrumentBase/SynthEvent.h +145 -0
  46. cyfaust/resources/architecture/AU/AUPublic/AUInstrumentBase/SynthNote.cpp +138 -0
  47. cyfaust/resources/architecture/AU/AUPublic/AUInstrumentBase/SynthNote.h +186 -0
  48. cyfaust/resources/architecture/AU/AUPublic/AUInstrumentBase/SynthNoteList.cpp +93 -0
  49. cyfaust/resources/architecture/AU/AUPublic/AUInstrumentBase/SynthNoteList.h +232 -0
  50. cyfaust/resources/architecture/AU/AUPublic/Utility/AUBaseHelper.cpp +134 -0
  51. cyfaust/resources/architecture/AU/AUPublic/Utility/AUBaseHelper.h +80 -0
  52. cyfaust/resources/architecture/AU/AUPublic/Utility/AUBuffer.cpp +217 -0
  53. cyfaust/resources/architecture/AU/AUPublic/Utility/AUBuffer.h +267 -0
  54. cyfaust/resources/architecture/AU/AUPublic/Utility/AUMIDIDefs.h +136 -0
  55. cyfaust/resources/architecture/AU/AUPublic/Utility/AUSilentTimeout.h +93 -0
  56. cyfaust/resources/architecture/AU/English.lproj/InfoPlist.strings +0 -0
  57. cyfaust/resources/architecture/AU/FaustAU.exp +2 -0
  58. cyfaust/resources/architecture/AU/FaustAU.xcodeproj/project.pbxproj +968 -0
  59. cyfaust/resources/architecture/AU/FaustAU.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  60. cyfaust/resources/architecture/AU/FaustAUCustomView.plist +14 -0
  61. cyfaust/resources/architecture/AU/Info.plist +47 -0
  62. cyfaust/resources/architecture/AU/PublicUtility/CAAtomic.h +305 -0
  63. cyfaust/resources/architecture/AU/PublicUtility/CAAtomicStack.h +239 -0
  64. cyfaust/resources/architecture/AU/PublicUtility/CAAudioChannelLayout.cpp +153 -0
  65. cyfaust/resources/architecture/AU/PublicUtility/CAAudioChannelLayout.h +199 -0
  66. cyfaust/resources/architecture/AU/PublicUtility/CAAutoDisposer.h +508 -0
  67. cyfaust/resources/architecture/AU/PublicUtility/CABufferList.cpp +264 -0
  68. cyfaust/resources/architecture/AU/PublicUtility/CABufferList.h +319 -0
  69. cyfaust/resources/architecture/AU/PublicUtility/CAByteOrder.h +161 -0
  70. cyfaust/resources/architecture/AU/PublicUtility/CADebugMacros.cpp +88 -0
  71. cyfaust/resources/architecture/AU/PublicUtility/CADebugMacros.h +580 -0
  72. cyfaust/resources/architecture/AU/PublicUtility/CADebugPrintf.cpp +89 -0
  73. cyfaust/resources/architecture/AU/PublicUtility/CADebugPrintf.h +115 -0
  74. cyfaust/resources/architecture/AU/PublicUtility/CADebugger.cpp +77 -0
  75. cyfaust/resources/architecture/AU/PublicUtility/CADebugger.h +56 -0
  76. cyfaust/resources/architecture/AU/PublicUtility/CAException.h +83 -0
  77. cyfaust/resources/architecture/AU/PublicUtility/CAGuard.cpp +339 -0
  78. cyfaust/resources/architecture/AU/PublicUtility/CAGuard.h +133 -0
  79. cyfaust/resources/architecture/AU/PublicUtility/CAHostTimeBase.cpp +110 -0
  80. cyfaust/resources/architecture/AU/PublicUtility/CAHostTimeBase.h +231 -0
  81. cyfaust/resources/architecture/AU/PublicUtility/CALogMacros.h +140 -0
  82. cyfaust/resources/architecture/AU/PublicUtility/CAMath.h +68 -0
  83. cyfaust/resources/architecture/AU/PublicUtility/CAMutex.cpp +345 -0
  84. cyfaust/resources/architecture/AU/PublicUtility/CAMutex.h +163 -0
  85. cyfaust/resources/architecture/AU/PublicUtility/CAReferenceCounted.h +87 -0
  86. cyfaust/resources/architecture/AU/PublicUtility/CAStreamBasicDescription.cpp +795 -0
  87. cyfaust/resources/architecture/AU/PublicUtility/CAStreamBasicDescription.h +409 -0
  88. cyfaust/resources/architecture/AU/PublicUtility/CAThreadSafeList.h +255 -0
  89. cyfaust/resources/architecture/AU/PublicUtility/CAVectorUnit.cpp +191 -0
  90. cyfaust/resources/architecture/AU/PublicUtility/CAVectorUnit.h +100 -0
  91. cyfaust/resources/architecture/AU/PublicUtility/CAVectorUnitTypes.h +59 -0
  92. cyfaust/resources/architecture/AU/PublicUtility/CAXException.cpp +49 -0
  93. cyfaust/resources/architecture/AU/PublicUtility/CAXException.h +338 -0
  94. cyfaust/resources/architecture/AU/SectionPatternLight.tiff +0 -0
  95. cyfaust/resources/architecture/AU/Source/AUSource/FaustAU.h +38 -0
  96. cyfaust/resources/architecture/AU/Source/AUSource/FaustAU.r +153 -0
  97. cyfaust/resources/architecture/AU/Source/AUSource/FaustAUVersion.h +64 -0
  98. cyfaust/resources/architecture/AU/Source/CocoaUI/FaustAU_Bargraph.h +18 -0
  99. cyfaust/resources/architecture/AU/Source/CocoaUI/FaustAU_Bargraph.m +21 -0
  100. cyfaust/resources/architecture/AU/Source/CocoaUI/FaustAU_Button.h +20 -0
  101. cyfaust/resources/architecture/AU/Source/CocoaUI/FaustAU_Button.m +56 -0
  102. cyfaust/resources/architecture/AU/Source/CocoaUI/FaustAU_CustomView.h +87 -0
  103. cyfaust/resources/architecture/AU/Source/CocoaUI/FaustAU_CustomView.m +834 -0
  104. cyfaust/resources/architecture/AU/Source/CocoaUI/FaustAU_CustomViewFactory.h +13 -0
  105. cyfaust/resources/architecture/AU/Source/CocoaUI/FaustAU_CustomViewFactory.m +22 -0
  106. cyfaust/resources/architecture/AU/Source/CocoaUI/FaustAU_Knob.h +81 -0
  107. cyfaust/resources/architecture/AU/Source/CocoaUI/FaustAU_Knob.m +199 -0
  108. cyfaust/resources/architecture/AU/Source/CocoaUI/FaustAU_Slider.h +18 -0
  109. cyfaust/resources/architecture/AU/Source/CocoaUI/FaustAU_Slider.m +21 -0
  110. cyfaust/resources/architecture/AU/version.plist +16 -0
  111. cyfaust/resources/architecture/VST/Info.plist +28 -0
  112. cyfaust/resources/architecture/VST/PkgInfo +1 -0
  113. cyfaust/resources/architecture/VST/README +11 -0
  114. cyfaust/resources/architecture/VST/VST.xcode/project.pbxproj +655 -0
  115. cyfaust/resources/architecture/alsa-console.cpp +246 -0
  116. cyfaust/resources/architecture/alsa-gtk.cpp +220 -0
  117. cyfaust/resources/architecture/alsa-qt.cpp +229 -0
  118. cyfaust/resources/architecture/api/DspFaust.cpp +612 -0
  119. cyfaust/resources/architecture/api/DspFaust.h +511 -0
  120. cyfaust/resources/architecture/api/README.md +237 -0
  121. cyfaust/resources/architecture/api/doc/Generic.md +38 -0
  122. cyfaust/resources/architecture/au-effect.cpp +487 -0
  123. cyfaust/resources/architecture/au-instrument.cpp +573 -0
  124. cyfaust/resources/architecture/bench.cpp +91 -0
  125. cyfaust/resources/architecture/c-jack-gtk.c +227 -0
  126. cyfaust/resources/architecture/ca-gtk.cpp +284 -0
  127. cyfaust/resources/architecture/ca-qt.cpp +424 -0
  128. cyfaust/resources/architecture/cpal.rs +195 -0
  129. cyfaust/resources/architecture/csound.cpp +245 -0
  130. cyfaust/resources/architecture/csvplot.cpp +227 -0
  131. cyfaust/resources/architecture/daisy/Makefile +14 -0
  132. cyfaust/resources/architecture/daisy/README.md +50 -0
  133. cyfaust/resources/architecture/daisy/ex_faust.cpp +173 -0
  134. cyfaust/resources/architecture/dssi.cpp +1262 -0
  135. cyfaust/resources/architecture/dummy-mem.cpp +186 -0
  136. cyfaust/resources/architecture/dummy.cpp +294 -0
  137. cyfaust/resources/architecture/faust/au/AUUI.h +404 -0
  138. cyfaust/resources/architecture/faust/audio/alsa-dsp.h +693 -0
  139. cyfaust/resources/architecture/faust/audio/android-dsp.h +583 -0
  140. cyfaust/resources/architecture/faust/audio/audio.h +115 -0
  141. cyfaust/resources/architecture/faust/audio/channels.h +122 -0
  142. cyfaust/resources/architecture/faust/audio/coreaudio-dsp.h +1543 -0
  143. cyfaust/resources/architecture/faust/audio/coreaudio-ios-dsp.h +743 -0
  144. cyfaust/resources/architecture/faust/audio/dummy-audio.h +255 -0
  145. cyfaust/resources/architecture/faust/audio/esp32-dsp.h +284 -0
  146. cyfaust/resources/architecture/faust/audio/fpe.h +164 -0
  147. cyfaust/resources/architecture/faust/audio/jack-dsp.h +534 -0
  148. cyfaust/resources/architecture/faust/audio/juce-dsp.h +119 -0
  149. cyfaust/resources/architecture/faust/audio/netjack-dsp.h +354 -0
  150. cyfaust/resources/architecture/faust/audio/oboe-dsp.h +308 -0
  151. cyfaust/resources/architecture/faust/audio/ofaudio-dsp.h +155 -0
  152. cyfaust/resources/architecture/faust/audio/opensles-android-dsp.h +631 -0
  153. cyfaust/resources/architecture/faust/audio/osc-dsp.h +120 -0
  154. cyfaust/resources/architecture/faust/audio/portaudio-dsp.h +236 -0
  155. cyfaust/resources/architecture/faust/audio/rtaudio-dsp.h +241 -0
  156. cyfaust/resources/architecture/faust/audio/samAudio.h +140 -0
  157. cyfaust/resources/architecture/faust/audio/teensy-dsp.h +171 -0
  158. cyfaust/resources/architecture/faust/dsp/cmajor-cpp-dsp.h +253 -0
  159. cyfaust/resources/architecture/faust/dsp/cmajorpatch-dsp.h +483 -0
  160. cyfaust/resources/architecture/faust/dsp/cpp-dsp-adapter.h +38 -0
  161. cyfaust/resources/architecture/faust/dsp/dsp-adapter.h +836 -0
  162. cyfaust/resources/architecture/faust/dsp/dsp-bench.h +611 -0
  163. cyfaust/resources/architecture/faust/dsp/dsp-checker.h +115 -0
  164. cyfaust/resources/architecture/faust/dsp/dsp-combiner.h +810 -0
  165. cyfaust/resources/architecture/faust/dsp/dsp-compute-adapter.h +159 -0
  166. cyfaust/resources/architecture/faust/dsp/dsp-multi.h +702 -0
  167. cyfaust/resources/architecture/faust/dsp/dsp-multifun.h +90 -0
  168. cyfaust/resources/architecture/faust/dsp/dsp-optimizer.h +511 -0
  169. cyfaust/resources/architecture/faust/dsp/dsp-tools.h +229 -0
  170. cyfaust/resources/architecture/faust/dsp/dsp.h +321 -0
  171. cyfaust/resources/architecture/faust/dsp/fastmath.cpp +301 -0
  172. cyfaust/resources/architecture/faust/dsp/faust-dynamic-engine.cpp +494 -0
  173. cyfaust/resources/architecture/faust/dsp/faust-dynamic-engine.h +386 -0
  174. cyfaust/resources/architecture/faust/dsp/faust-engine.h +75 -0
  175. cyfaust/resources/architecture/faust/dsp/faust-poly-engine.h +638 -0
  176. cyfaust/resources/architecture/faust/dsp/interpreter-dsp-c.h +288 -0
  177. cyfaust/resources/architecture/faust/dsp/interpreter-dsp.h +362 -0
  178. cyfaust/resources/architecture/faust/dsp/interpreter-machine-dsp.h +233 -0
  179. cyfaust/resources/architecture/faust/dsp/libfaust-box-c.h +817 -0
  180. cyfaust/resources/architecture/faust/dsp/libfaust-box.h +889 -0
  181. cyfaust/resources/architecture/faust/dsp/libfaust-c.h +116 -0
  182. cyfaust/resources/architecture/faust/dsp/libfaust-signal-c.h +649 -0
  183. cyfaust/resources/architecture/faust/dsp/libfaust-signal.h +731 -0
  184. cyfaust/resources/architecture/faust/dsp/llvm-dsp-adapter.h +160 -0
  185. cyfaust/resources/architecture/faust/dsp/llvm-dsp-c.h +524 -0
  186. cyfaust/resources/architecture/faust/dsp/llvm-dsp.h +575 -0
  187. cyfaust/resources/architecture/faust/dsp/llvm-machine-dsp.h +215 -0
  188. cyfaust/resources/architecture/faust/dsp/one-sample-dsp.h +477 -0
  189. cyfaust/resources/architecture/faust/dsp/poly-dsp.h +1079 -0
  190. cyfaust/resources/architecture/faust/dsp/poly-interpreter-dsp.h +143 -0
  191. cyfaust/resources/architecture/faust/dsp/poly-llvm-dsp.h +249 -0
  192. cyfaust/resources/architecture/faust/dsp/poly-wasm-dsp.h +257 -0
  193. cyfaust/resources/architecture/faust/dsp/proxy-dsp.h +108 -0
  194. cyfaust/resources/architecture/faust/dsp/proxy-osc-dsp.h +109 -0
  195. cyfaust/resources/architecture/faust/dsp/rnbo-dsp.h +187 -0
  196. cyfaust/resources/architecture/faust/dsp/sound-player.h +428 -0
  197. cyfaust/resources/architecture/faust/dsp/timed-dsp.h +279 -0
  198. cyfaust/resources/architecture/faust/dsp/wasm-dsp-imp.h +188 -0
  199. cyfaust/resources/architecture/faust/dsp/wasm-dsp.h +309 -0
  200. cyfaust/resources/architecture/faust/dsp/ysfx-dsp.h +188 -0
  201. cyfaust/resources/architecture/faust/export.h +61 -0
  202. cyfaust/resources/architecture/faust/gui/APIUI.h +726 -0
  203. cyfaust/resources/architecture/faust/gui/BelaOSCUI.h +170 -0
  204. cyfaust/resources/architecture/faust/gui/CGlue.h +667 -0
  205. cyfaust/resources/architecture/faust/gui/CInterface.h +142 -0
  206. cyfaust/resources/architecture/faust/gui/ControlSequenceUI.h +197 -0
  207. cyfaust/resources/architecture/faust/gui/ControlUI.h +137 -0
  208. cyfaust/resources/architecture/faust/gui/DaisyControlUI.h +283 -0
  209. cyfaust/resources/architecture/faust/gui/DaisyPatchInitControlUI.h +254 -0
  210. cyfaust/resources/architecture/faust/gui/DecoratorUI.h +115 -0
  211. cyfaust/resources/architecture/faust/gui/Esp32ControlUI.h +341 -0
  212. cyfaust/resources/architecture/faust/gui/Esp32Reader.h +102 -0
  213. cyfaust/resources/architecture/faust/gui/Esp32SensorUI.h +137 -0
  214. cyfaust/resources/architecture/faust/gui/FUI.h +147 -0
  215. cyfaust/resources/architecture/faust/gui/GTKUI.h +1414 -0
  216. cyfaust/resources/architecture/faust/gui/GUI.h +465 -0
  217. cyfaust/resources/architecture/faust/gui/JSONControl.h +48 -0
  218. cyfaust/resources/architecture/faust/gui/JSONUI.h +722 -0
  219. cyfaust/resources/architecture/faust/gui/JSONUIDecoder.h +589 -0
  220. cyfaust/resources/architecture/faust/gui/JuceGUI.h +2061 -0
  221. cyfaust/resources/architecture/faust/gui/JuceOSCUI.h +163 -0
  222. cyfaust/resources/architecture/faust/gui/JuceParameterUI.h +158 -0
  223. cyfaust/resources/architecture/faust/gui/JuceReader.h +103 -0
  224. cyfaust/resources/architecture/faust/gui/JuceStateUI.h +88 -0
  225. cyfaust/resources/architecture/faust/gui/LayoutUI.h +423 -0
  226. cyfaust/resources/architecture/faust/gui/LibsndfileReader.h +366 -0
  227. cyfaust/resources/architecture/faust/gui/MapUI.h +370 -0
  228. cyfaust/resources/architecture/faust/gui/MemoryReader.h +111 -0
  229. cyfaust/resources/architecture/faust/gui/MetaDataUI.h +357 -0
  230. cyfaust/resources/architecture/faust/gui/MidiUI.h +939 -0
  231. cyfaust/resources/architecture/faust/gui/OCVUI.h +688 -0
  232. cyfaust/resources/architecture/faust/gui/OSCUI.h +219 -0
  233. cyfaust/resources/architecture/faust/gui/PathBuilder.h +228 -0
  234. cyfaust/resources/architecture/faust/gui/PresetUI.h +337 -0
  235. cyfaust/resources/architecture/faust/gui/PrintCUI.h +152 -0
  236. cyfaust/resources/architecture/faust/gui/PrintUI.h +121 -0
  237. cyfaust/resources/architecture/faust/gui/QTUI.h +1891 -0
  238. cyfaust/resources/architecture/faust/gui/RosCI.h +493 -0
  239. cyfaust/resources/architecture/faust/gui/RosUI.h +488 -0
  240. cyfaust/resources/architecture/faust/gui/SaveUI.h +163 -0
  241. cyfaust/resources/architecture/faust/gui/SimpleParser.h +583 -0
  242. cyfaust/resources/architecture/faust/gui/SoundUI.h +217 -0
  243. cyfaust/resources/architecture/faust/gui/Soundfile.h +342 -0
  244. cyfaust/resources/architecture/faust/gui/Styles/Blue.qrc +5 -0
  245. cyfaust/resources/architecture/faust/gui/Styles/Blue.qss +177 -0
  246. cyfaust/resources/architecture/faust/gui/Styles/Default.qrc +5 -0
  247. cyfaust/resources/architecture/faust/gui/Styles/Default.qss +117 -0
  248. cyfaust/resources/architecture/faust/gui/Styles/Grey.qrc +5 -0
  249. cyfaust/resources/architecture/faust/gui/Styles/Grey.qss +174 -0
  250. cyfaust/resources/architecture/faust/gui/Styles/Salmon.qrc +5 -0
  251. cyfaust/resources/architecture/faust/gui/Styles/Salmon.qss +171 -0
  252. cyfaust/resources/architecture/faust/gui/UI.h +87 -0
  253. cyfaust/resources/architecture/faust/gui/ValueConverter.h +543 -0
  254. cyfaust/resources/architecture/faust/gui/WaveReader.h +364 -0
  255. cyfaust/resources/architecture/faust/gui/console.h +322 -0
  256. cyfaust/resources/architecture/faust/gui/httpdUI.h +372 -0
  257. cyfaust/resources/architecture/faust/gui/meta.h +39 -0
  258. cyfaust/resources/architecture/faust/gui/mspUI.h +580 -0
  259. cyfaust/resources/architecture/faust/gui/qrcodegen.h +269 -0
  260. cyfaust/resources/architecture/faust/gui/qrcodegen.impl.h +1025 -0
  261. cyfaust/resources/architecture/faust/gui/ring-buffer.h +414 -0
  262. cyfaust/resources/architecture/faust/midi/RtMidi.cpp +3054 -0
  263. cyfaust/resources/architecture/faust/midi/RtMidi.h +1034 -0
  264. cyfaust/resources/architecture/faust/midi/bela-midi.h +266 -0
  265. cyfaust/resources/architecture/faust/midi/daisy-midi.h +116 -0
  266. cyfaust/resources/architecture/faust/midi/esp32-midi.h +185 -0
  267. cyfaust/resources/architecture/faust/midi/gramophone-midi.h +107 -0
  268. cyfaust/resources/architecture/faust/midi/iplug2-midi.h +148 -0
  269. cyfaust/resources/architecture/faust/midi/jack-midi.h +247 -0
  270. cyfaust/resources/architecture/faust/midi/juce-midi.h +275 -0
  271. cyfaust/resources/architecture/faust/midi/midi.h +475 -0
  272. cyfaust/resources/architecture/faust/midi/rt-midi.h +315 -0
  273. cyfaust/resources/architecture/faust/midi/teensy-midi.h +89 -0
  274. cyfaust/resources/architecture/faust/misc.h +106 -0
  275. cyfaust/resources/architecture/faust/sound-file.h +132 -0
  276. cyfaust/resources/architecture/faust/unity/AudioPluginInterface.h +301 -0
  277. cyfaust/resources/architecture/faust/vst/faust.h +141 -0
  278. cyfaust/resources/architecture/faust/vst/voice.h +43 -0
  279. cyfaust/resources/architecture/faust/vst/vstui.h +524 -0
  280. cyfaust/resources/architecture/faustvst.cpp +3435 -0
  281. cyfaust/resources/architecture/faustvstqt.h +91 -0
  282. cyfaust/resources/architecture/gen-json.cpp +76 -0
  283. cyfaust/resources/architecture/jack-console.cpp +267 -0
  284. cyfaust/resources/architecture/jack-gtk-ros.cpp +139 -0
  285. cyfaust/resources/architecture/jack-gtk.cpp +282 -0
  286. cyfaust/resources/architecture/jack-internal.cpp +560 -0
  287. cyfaust/resources/architecture/jack-qt-chain-footer.cpp +87 -0
  288. cyfaust/resources/architecture/jack-qt-chain-header.cpp +92 -0
  289. cyfaust/resources/architecture/jack-qt.cpp +281 -0
  290. cyfaust/resources/architecture/jack.rs +171 -0
  291. cyfaust/resources/architecture/juce/README.md +84 -0
  292. cyfaust/resources/architecture/juce/juce-plugin.cpp +809 -0
  293. cyfaust/resources/architecture/juce/juce-standalone.cpp +413 -0
  294. cyfaust/resources/architecture/juce/plugin/plugin-llvm.jucer +184 -0
  295. cyfaust/resources/architecture/juce/plugin/plugin.jucer +159 -0
  296. cyfaust/resources/architecture/juce/standalone/standalone-llvm.jucer +216 -0
  297. cyfaust/resources/architecture/juce/standalone/standalone.jucer +191 -0
  298. cyfaust/resources/architecture/ladspa.cpp +543 -0
  299. cyfaust/resources/architecture/latexheader.tex +65 -0
  300. cyfaust/resources/architecture/lv2.cpp +2090 -0
  301. cyfaust/resources/architecture/lv2qtgui.h +62 -0
  302. cyfaust/resources/architecture/lv2ui.cpp +1966 -0
  303. cyfaust/resources/architecture/max-msp/README.md +109 -0
  304. cyfaust/resources/architecture/max-msp/faustgen-wrapper-poly.maxpat +184 -0
  305. cyfaust/resources/architecture/max-msp/faustgen-wrapper.maxpat +163 -0
  306. cyfaust/resources/architecture/max-msp/max-msp.cpp +734 -0
  307. cyfaust/resources/architecture/max-msp/max-msp64.cpp +789 -0
  308. cyfaust/resources/architecture/max-msp/py2max/README.md +277 -0
  309. cyfaust/resources/architecture/max-msp/py2max/py2max/__init__.py +3 -0
  310. cyfaust/resources/architecture/max-msp/py2max/py2max/common.py +7 -0
  311. cyfaust/resources/architecture/max-msp/py2max/py2max/core.py +1387 -0
  312. cyfaust/resources/architecture/max-msp/py2max/py2max/maxclassdb.py +318 -0
  313. cyfaust/resources/architecture/max-msp/py2max/py2max/utils.py +20 -0
  314. cyfaust/resources/architecture/max-msp/rnbo.py +1591 -0
  315. cyfaust/resources/architecture/max-msp/sndfile/sndfile.h +857 -0
  316. cyfaust/resources/architecture/max-msp/ui.js +230 -0
  317. cyfaust/resources/architecture/max-msp/wrapper-poly.maxpat +153 -0
  318. cyfaust/resources/architecture/max-msp/wrapper.maxpat +131 -0
  319. cyfaust/resources/architecture/minimal-bench.cpp +100 -0
  320. cyfaust/resources/architecture/minimal-effect.c +149 -0
  321. cyfaust/resources/architecture/minimal-effect.cpp +70 -0
  322. cyfaust/resources/architecture/minimal-fixed-point.cpp +195 -0
  323. cyfaust/resources/architecture/minimal-static.cpp +160 -0
  324. cyfaust/resources/architecture/minimal.c +103 -0
  325. cyfaust/resources/architecture/minimal.cpp +84 -0
  326. cyfaust/resources/architecture/minimal.rs +223 -0
  327. cyfaust/resources/architecture/module.cpp +91 -0
  328. cyfaust/resources/architecture/octave.cpp +471 -0
  329. cyfaust/resources/architecture/oscio-gtk.cpp +115 -0
  330. cyfaust/resources/architecture/oscio-qt.cpp +121 -0
  331. cyfaust/resources/architecture/owl.cpp +345 -0
  332. cyfaust/resources/architecture/pa-gtk.cpp +119 -0
  333. cyfaust/resources/architecture/pa-qt.cpp +261 -0
  334. cyfaust/resources/architecture/path-printer.cpp +100 -0
  335. cyfaust/resources/architecture/plot.cpp +128 -0
  336. cyfaust/resources/architecture/portaudio.rs +192 -0
  337. cyfaust/resources/architecture/puredata.cpp +636 -0
  338. cyfaust/resources/architecture/ra-qt.cpp +238 -0
  339. cyfaust/resources/architecture/sam/fast_pow2.h +69 -0
  340. cyfaust/resources/architecture/sam/fastexp.h +140 -0
  341. cyfaust/resources/architecture/sam/samFaustDSP.cpp +125 -0
  342. cyfaust/resources/architecture/sam/samFaustDSP.h +107 -0
  343. cyfaust/resources/architecture/scheduler.cpp +1391 -0
  344. cyfaust/resources/architecture/sndfile.cpp +291 -0
  345. cyfaust/resources/architecture/supercollider.cpp +611 -0
  346. cyfaust/resources/architecture/teensy/README.md +13 -0
  347. cyfaust/resources/architecture/teensy/teensy.cpp +214 -0
  348. cyfaust/resources/architecture/teensy/teensy.h +71 -0
  349. cyfaust/resources/architecture/thread.h +373 -0
  350. cyfaust/resources/architecture/vcvrack/README.md +78 -0
  351. cyfaust/resources/architecture/vcvrack/template/.gitignore +6 -0
  352. cyfaust/resources/architecture/vcvrack/template/Makefile +22 -0
  353. cyfaust/resources/architecture/vcvrack/template/res/FaustModule.svg +299 -0
  354. cyfaust/resources/architecture/vcvrack/template/src/FaustModule.cpp +942 -0
  355. cyfaust/resources/architecture/vst.cpp +947 -0
  356. cyfaust/resources/libraries/aanl.lib +900 -0
  357. cyfaust/resources/libraries/all.lib +36 -0
  358. cyfaust/resources/libraries/analyzers.lib +980 -0
  359. cyfaust/resources/libraries/basics.lib +2681 -0
  360. cyfaust/resources/libraries/compressors.lib +1341 -0
  361. cyfaust/resources/libraries/delays.lib +401 -0
  362. cyfaust/resources/libraries/demos.lib +1556 -0
  363. cyfaust/resources/libraries/dx7.lib +1036 -0
  364. cyfaust/resources/libraries/effect.lib +1645 -0
  365. cyfaust/resources/libraries/envelopes.lib +666 -0
  366. cyfaust/resources/libraries/examples/README.md +13 -0
  367. cyfaust/resources/libraries/examples/ambisonics/fourSourcesToOcto.dsp +20 -0
  368. cyfaust/resources/libraries/examples/ambisonics/oneSourceToStereo.dsp +12 -0
  369. cyfaust/resources/libraries/examples/analysis/FFT.dsp +26 -0
  370. cyfaust/resources/libraries/examples/analysis/dbmeter.dsp +19 -0
  371. cyfaust/resources/libraries/examples/analysis/spectralLevel.dsp +8 -0
  372. cyfaust/resources/libraries/examples/analysis/spectralTiltLab.dsp +20 -0
  373. cyfaust/resources/libraries/examples/analysis/vumeter.dsp +18 -0
  374. cyfaust/resources/libraries/examples/autodiff/delay/diff.dsp +2 -0
  375. cyfaust/resources/libraries/examples/autodiff/delay/gt.dsp +2 -0
  376. cyfaust/resources/libraries/examples/autodiff/gain/diff.dsp +7 -0
  377. cyfaust/resources/libraries/examples/autodiff/gain/gt.dsp +1 -0
  378. cyfaust/resources/libraries/examples/autodiff/gain_dc/diff.dsp +7 -0
  379. cyfaust/resources/libraries/examples/autodiff/gain_dc/gt.dsp +4 -0
  380. cyfaust/resources/libraries/examples/autodiff/gain_exp/diff.dsp +9 -0
  381. cyfaust/resources/libraries/examples/autodiff/gain_exp/gt.dsp +1 -0
  382. cyfaust/resources/libraries/examples/autodiff/gain_pow/diff.dsp +9 -0
  383. cyfaust/resources/libraries/examples/autodiff/gain_pow/gt.dsp +1 -0
  384. cyfaust/resources/libraries/examples/autodiff/gain_pow_trig/diff.dsp +12 -0
  385. cyfaust/resources/libraries/examples/autodiff/gain_pow_trig/gt.dsp +1 -0
  386. cyfaust/resources/libraries/examples/autodiff/gain_sq/diff.dsp +7 -0
  387. cyfaust/resources/libraries/examples/autodiff/gain_sq/gt.dsp +1 -0
  388. cyfaust/resources/libraries/examples/autodiff/mem/diff.dsp +1 -0
  389. cyfaust/resources/libraries/examples/autodiff/mem/gt.dsp +1 -0
  390. cyfaust/resources/libraries/examples/autodiff/noise.dsp +2 -0
  391. cyfaust/resources/libraries/examples/autodiff/noop.dsp +2 -0
  392. cyfaust/resources/libraries/examples/autodiff/one_zero/diff.dsp +2 -0
  393. cyfaust/resources/libraries/examples/autodiff/one_zero/gt.dsp +2 -0
  394. cyfaust/resources/libraries/examples/autodiff/ramp.dsp +1 -0
  395. cyfaust/resources/libraries/examples/autodiff/recursion/diff.dsp +2 -0
  396. cyfaust/resources/libraries/examples/autodiff/recursion/gt.dsp +1 -0
  397. cyfaust/resources/libraries/examples/autodiff/recursion/target.dsp +13 -0
  398. cyfaust/resources/libraries/examples/autodiff/tremolo/diff.dsp +14 -0
  399. cyfaust/resources/libraries/examples/autodiff/tremolo/diffable.lib +7 -0
  400. cyfaust/resources/libraries/examples/autodiff/tremolo/gt.dsp +11 -0
  401. cyfaust/resources/libraries/examples/delayEcho/echo.dsp +15 -0
  402. cyfaust/resources/libraries/examples/delayEcho/quadEcho.dsp +21 -0
  403. cyfaust/resources/libraries/examples/delayEcho/smoothDelay.dsp +26 -0
  404. cyfaust/resources/libraries/examples/delayEcho/stereoEcho.dsp +16 -0
  405. cyfaust/resources/libraries/examples/delayEcho/tapiir.dsp +44 -0
  406. cyfaust/resources/libraries/examples/dynamic/compressor.dsp +8 -0
  407. cyfaust/resources/libraries/examples/dynamic/distortion.dsp +8 -0
  408. cyfaust/resources/libraries/examples/dynamic/gateCompressor.dsp +10 -0
  409. cyfaust/resources/libraries/examples/dynamic/noiseGate.dsp +8 -0
  410. cyfaust/resources/libraries/examples/dynamic/volume.dsp +15 -0
  411. cyfaust/resources/libraries/examples/filtering/APF.dsp +13 -0
  412. cyfaust/resources/libraries/examples/filtering/BPF.dsp +13 -0
  413. cyfaust/resources/libraries/examples/filtering/DNN.dsp +25 -0
  414. cyfaust/resources/libraries/examples/filtering/HPF.dsp +13 -0
  415. cyfaust/resources/libraries/examples/filtering/LPF.dsp +13 -0
  416. cyfaust/resources/libraries/examples/filtering/bandFilter.dsp +44 -0
  417. cyfaust/resources/libraries/examples/filtering/cryBaby.dsp +4 -0
  418. cyfaust/resources/libraries/examples/filtering/diodeLadder.dsp +12 -0
  419. cyfaust/resources/libraries/examples/filtering/filterBank.dsp +6 -0
  420. cyfaust/resources/libraries/examples/filtering/graphicEqLab.dsp +10 -0
  421. cyfaust/resources/libraries/examples/filtering/highShelf.dsp +13 -0
  422. cyfaust/resources/libraries/examples/filtering/korg35HPF.dsp +13 -0
  423. cyfaust/resources/libraries/examples/filtering/korg35LPF.dsp +13 -0
  424. cyfaust/resources/libraries/examples/filtering/lfBoost.dsp +40 -0
  425. cyfaust/resources/libraries/examples/filtering/lowBoost.dsp +40 -0
  426. cyfaust/resources/libraries/examples/filtering/lowCut.dsp +40 -0
  427. cyfaust/resources/libraries/examples/filtering/lowShelf.dsp +13 -0
  428. cyfaust/resources/libraries/examples/filtering/moogHalfLadder.dsp +12 -0
  429. cyfaust/resources/libraries/examples/filtering/moogLadder.dsp +12 -0
  430. cyfaust/resources/libraries/examples/filtering/moogVCF.dsp +6 -0
  431. cyfaust/resources/libraries/examples/filtering/multibandFilter.dsp +14 -0
  432. cyfaust/resources/libraries/examples/filtering/notch.dsp +13 -0
  433. cyfaust/resources/libraries/examples/filtering/oberheim.dsp +14 -0
  434. cyfaust/resources/libraries/examples/filtering/oberheimBPF.dsp +13 -0
  435. cyfaust/resources/libraries/examples/filtering/oberheimBSF.dsp +13 -0
  436. cyfaust/resources/libraries/examples/filtering/oberheimHPF.dsp +13 -0
  437. cyfaust/resources/libraries/examples/filtering/oberheimLPF.dsp +13 -0
  438. cyfaust/resources/libraries/examples/filtering/parametricEqLab.dsp +10 -0
  439. cyfaust/resources/libraries/examples/filtering/parametricEqualizer.dsp +6 -0
  440. cyfaust/resources/libraries/examples/filtering/peakNotch.dsp +13 -0
  441. cyfaust/resources/libraries/examples/filtering/peakingEQ.dsp +13 -0
  442. cyfaust/resources/libraries/examples/filtering/sallenKey2ndOrder.dsp +14 -0
  443. cyfaust/resources/libraries/examples/filtering/sallenKey2ndOrderBPF.dsp +13 -0
  444. cyfaust/resources/libraries/examples/filtering/sallenKey2ndOrderHPF.dsp +13 -0
  445. cyfaust/resources/libraries/examples/filtering/sallenKey2ndOrderLPF.dsp +13 -0
  446. cyfaust/resources/libraries/examples/filtering/sallenKeyOnePole.dsp +13 -0
  447. cyfaust/resources/libraries/examples/filtering/sallenKeyOnePoleHPF.dsp +12 -0
  448. cyfaust/resources/libraries/examples/filtering/sallenKeyOnePoleLPF.dsp +12 -0
  449. cyfaust/resources/libraries/examples/filtering/spectralTilt.dsp +8 -0
  450. cyfaust/resources/libraries/examples/filtering/vcfWahLab.dsp +12 -0
  451. cyfaust/resources/libraries/examples/filtering/vocoder.dsp +8 -0
  452. cyfaust/resources/libraries/examples/filtering/wahPedal.dsp +6 -0
  453. cyfaust/resources/libraries/examples/gameaudio/bubble.dsp +42 -0
  454. cyfaust/resources/libraries/examples/gameaudio/door.dsp +58 -0
  455. cyfaust/resources/libraries/examples/gameaudio/fire.dsp +46 -0
  456. cyfaust/resources/libraries/examples/gameaudio/insects.dsp +148 -0
  457. cyfaust/resources/libraries/examples/gameaudio/rain.dsp +27 -0
  458. cyfaust/resources/libraries/examples/gameaudio/wind.dsp +23 -0
  459. cyfaust/resources/libraries/examples/generator/filterOsc.dsp +8 -0
  460. cyfaust/resources/libraries/examples/generator/noise.dsp +52 -0
  461. cyfaust/resources/libraries/examples/generator/noiseMetadata.dsp +74 -0
  462. cyfaust/resources/libraries/examples/generator/osc.dsp +17 -0
  463. cyfaust/resources/libraries/examples/generator/osci.dsp +17 -0
  464. cyfaust/resources/libraries/examples/generator/sawtoothLab.dsp +8 -0
  465. cyfaust/resources/libraries/examples/generator/virtualAnalog.dsp +8 -0
  466. cyfaust/resources/libraries/examples/generator/virtualAnalogLab.dsp +10 -0
  467. cyfaust/resources/libraries/examples/misc/UITester.dsp +71 -0
  468. cyfaust/resources/libraries/examples/misc/autopan.dsp +59 -0
  469. cyfaust/resources/libraries/examples/misc/capture.dsp +24 -0
  470. cyfaust/resources/libraries/examples/misc/drumkit.dsp +36 -0
  471. cyfaust/resources/libraries/examples/misc/guitarix.dsp +184 -0
  472. cyfaust/resources/libraries/examples/misc/matrix.dsp +17 -0
  473. cyfaust/resources/libraries/examples/misc/midiTester.dsp +122 -0
  474. cyfaust/resources/libraries/examples/misc/mixer.dsp +27 -0
  475. cyfaust/resources/libraries/examples/misc/statespace.dsp +39 -0
  476. cyfaust/resources/libraries/examples/misc/switcher.dsp +20 -0
  477. cyfaust/resources/libraries/examples/misc/tester.dsp +32 -0
  478. cyfaust/resources/libraries/examples/misc/tester2.dsp +31 -0
  479. cyfaust/resources/libraries/examples/old/README.md +5 -0
  480. cyfaust/resources/libraries/examples/old/freeverb.dsp +109 -0
  481. cyfaust/resources/libraries/examples/old/rewriting/Makefile +21 -0
  482. cyfaust/resources/libraries/examples/old/rewriting/fact.dsp +3 -0
  483. cyfaust/resources/libraries/examples/old/rewriting/fold.dsp +61 -0
  484. cyfaust/resources/libraries/examples/old/rewriting/mesh.dsp +43 -0
  485. cyfaust/resources/libraries/examples/old/rewriting/mesh.pd +37 -0
  486. cyfaust/resources/libraries/examples/old/rewriting/sample.pd +12 -0
  487. cyfaust/resources/libraries/examples/old/rewriting/serial.dsp +7 -0
  488. cyfaust/resources/libraries/examples/old/rewriting/sum.dsp +55 -0
  489. cyfaust/resources/libraries/examples/old/rewriting/test.pd +48 -0
  490. cyfaust/resources/libraries/examples/phasing/flanger.dsp +8 -0
  491. cyfaust/resources/libraries/examples/phasing/phaser.dsp +8 -0
  492. cyfaust/resources/libraries/examples/phasing/phaserFlangerLab.dsp +12 -0
  493. cyfaust/resources/libraries/examples/physicalModeling/brass.dsp +8 -0
  494. cyfaust/resources/libraries/examples/physicalModeling/brassMIDI.dsp +8 -0
  495. cyfaust/resources/libraries/examples/physicalModeling/churchBell.dsp +8 -0
  496. cyfaust/resources/libraries/examples/physicalModeling/clarinet.dsp +8 -0
  497. cyfaust/resources/libraries/examples/physicalModeling/clarinetMIDI.dsp +8 -0
  498. cyfaust/resources/libraries/examples/physicalModeling/djembeMIDI.dsp +8 -0
  499. cyfaust/resources/libraries/examples/physicalModeling/elecGuitarMIDI.dsp +10 -0
  500. cyfaust/resources/libraries/examples/physicalModeling/englishBell.dsp +8 -0
  501. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/NLFeks.dsp +91 -0
  502. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/NLFfm.dsp +70 -0
  503. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/README +125 -0
  504. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/bass.dsp +84 -0
  505. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/bass.h +91 -0
  506. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/blowBottle.dsp +102 -0
  507. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/bowed.dsp +114 -0
  508. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/brass.dsp +103 -0
  509. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/clarinet.dsp +110 -0
  510. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/flute.dsp +116 -0
  511. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/fluteStk.dsp +121 -0
  512. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/glassHarmonica.dsp +131 -0
  513. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/harpsi.dsp +90 -0
  514. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/harpsichord.h +185 -0
  515. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/instrument.h +114 -0
  516. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/modalBar.dsp +122 -0
  517. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/modalBar.h +48 -0
  518. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/audio-out.pd +33 -0
  519. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/bottle.pd +10 -0
  520. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/clarinets.pd +15 -0
  521. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/canon/audio-out.pd +33 -0
  522. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/canon/bass.pd +162 -0
  523. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/canon/canon.pd +55 -0
  524. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/canon/flute.pd +343 -0
  525. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/canon/pachelbel.mid +0 -0
  526. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/daisy/audio-out.pd +33 -0
  527. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/daisy/daisy.mid +0 -0
  528. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/daisy/daisy.pd +45 -0
  529. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/daisy/piano.pd +205 -0
  530. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/daisy/voiceForm.pd +340 -0
  531. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/take5/audio-out.pd +33 -0
  532. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/take5/blowHole.pd +330 -0
  533. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/take5/piano.pd +205 -0
  534. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/take5/take5.mid +0 -0
  535. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/take5/take5.pd +45 -0
  536. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/turkish-march/audio-out.pd +33 -0
  537. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/turkish-march/harpsi.pd +204 -0
  538. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/turkish-march/turkish-march.mid +0 -0
  539. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/turkish-march/turkish-march.pd +31 -0
  540. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/what-a-friend/audio-out.pd +33 -0
  541. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/what-a-friend/bass.pd +162 -0
  542. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/what-a-friend/modalBar.pd +258 -0
  543. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/what-a-friend/piano.pd +205 -0
  544. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/what-a-friend/what-a-friend.pd +52 -0
  545. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fancy/what-a-friend/what_a_friend.mid +0 -0
  546. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/flutes.pd +15 -0
  547. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/fm.pd +10 -0
  548. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/glassBare.pd +10 -0
  549. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/harpsichord-poly.pd +10 -0
  550. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/ironBare.pd +10 -0
  551. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/midi-in.pd +111 -0
  552. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/modal.pd +10 -0
  553. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/osc.pd +26 -0
  554. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/piano-poly.pd +10 -0
  555. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/plucked.pd +20 -0
  556. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/saxophone.pd +10 -0
  557. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/tibetan.pd +10 -0
  558. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/trumpet.pd +10 -0
  559. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/violin.pd +10 -0
  560. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/voiceSynth.pd +10 -0
  561. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/pd-patches/woodenBare.pd +10 -0
  562. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/phonemes.h +189 -0
  563. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/piano.dsp +255 -0
  564. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/piano.h +751 -0
  565. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/saxophony.dsp +114 -0
  566. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/sitar.dsp +48 -0
  567. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/tibetanBowl.dsp +155 -0
  568. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/tunedBar.dsp +123 -0
  569. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/uniBar.dsp +100 -0
  570. cyfaust/resources/libraries/examples/physicalModeling/faust-stk/voiceForm.dsp +125 -0
  571. cyfaust/resources/libraries/examples/physicalModeling/fds/1dDampedWaveEquation.dsp +43 -0
  572. cyfaust/resources/libraries/examples/physicalModeling/fds/2dKirchhoffThinPlate.dsp +75 -0
  573. cyfaust/resources/libraries/examples/physicalModeling/fds/BowedString.dsp +61 -0
  574. cyfaust/resources/libraries/examples/physicalModeling/fds/ControllableNonPhysicalString.dsp +72 -0
  575. cyfaust/resources/libraries/examples/physicalModeling/fds/HammeredString.dsp +74 -0
  576. cyfaust/resources/libraries/examples/physicalModeling/fds/PianoHammeredString.dsp +85 -0
  577. cyfaust/resources/libraries/examples/physicalModeling/fds/StiffString.dsp +54 -0
  578. cyfaust/resources/libraries/examples/physicalModeling/flute.dsp +8 -0
  579. cyfaust/resources/libraries/examples/physicalModeling/fluteMIDI.dsp +8 -0
  580. cyfaust/resources/libraries/examples/physicalModeling/frenchBell.dsp +8 -0
  581. cyfaust/resources/libraries/examples/physicalModeling/germanBell.dsp +8 -0
  582. cyfaust/resources/libraries/examples/physicalModeling/guitarMIDI.dsp +8 -0
  583. cyfaust/resources/libraries/examples/physicalModeling/karplus.dsp +8 -0
  584. cyfaust/resources/libraries/examples/physicalModeling/marimbaMIDI.dsp +10 -0
  585. cyfaust/resources/libraries/examples/physicalModeling/mi-faust/00_BasicOscillator/harmonicOscillator.dsp +58 -0
  586. cyfaust/resources/libraries/examples/physicalModeling/mi-faust/00_BasicOscillator/harmonicOscillator2.dsp +62 -0
  587. cyfaust/resources/libraries/examples/physicalModeling/mi-faust/00_BasicOscillator/harmonicOscillator3.dsp +65 -0
  588. cyfaust/resources/libraries/examples/physicalModeling/mi-faust/01_ParamControl/paramOsc.dsp +63 -0
  589. cyfaust/resources/libraries/examples/physicalModeling/mi-faust/02_AudioParamControl/audioParamOsc.dsp +63 -0
  590. cyfaust/resources/libraries/examples/physicalModeling/mi-faust/03_HammerTime/hammerOsc.dsp +71 -0
  591. cyfaust/resources/libraries/examples/physicalModeling/mi-faust/04_Gravity/bouncingOsc.dsp +64 -0
  592. cyfaust/resources/libraries/examples/physicalModeling/mi-faust/05_PluckedOscillator/pluckedOsc.dsp +57 -0
  593. cyfaust/resources/libraries/examples/physicalModeling/mi-faust/06_BowedOscillator/bowedOsc.dsp +65 -0
  594. cyfaust/resources/libraries/examples/physicalModeling/mi-faust/07_NonLinearOscillator/nlOsc.dsp +78 -0
  595. cyfaust/resources/libraries/examples/physicalModeling/mi-faust/08_TwoMassChain/2massChain.dsp +75 -0
  596. cyfaust/resources/libraries/examples/physicalModeling/mi-faust/09_TinyString/tinyString.dsp +101 -0
  597. cyfaust/resources/libraries/examples/physicalModeling/mi-faust/10_PluckedString/pluckedString.dsp +678 -0
  598. cyfaust/resources/libraries/examples/physicalModeling/mi-faust/11_BowedString/bowedString.dsp +671 -0
  599. cyfaust/resources/libraries/examples/physicalModeling/mi-faust/12_TriangleMesh/triangleMesh.dsp +448 -0
  600. cyfaust/resources/libraries/examples/physicalModeling/mi-faust/13_Construction/construction.dsp +1036 -0
  601. cyfaust/resources/libraries/examples/physicalModeling/mi-faust/14_Polyphonic/polyTriangle.dsp +79 -0
  602. cyfaust/resources/libraries/examples/physicalModeling/mi-faust/15_PhysicalLFO/physicalLFO.dsp +107 -0
  603. cyfaust/resources/libraries/examples/physicalModeling/modularInterpInstrMIDI.dsp +8 -0
  604. cyfaust/resources/libraries/examples/physicalModeling/nylonGuitarMIDI.dsp +8 -0
  605. cyfaust/resources/libraries/examples/physicalModeling/old/harpe.dsp +45 -0
  606. cyfaust/resources/libraries/examples/physicalModeling/old/karplus.dsp +34 -0
  607. cyfaust/resources/libraries/examples/physicalModeling/old/karplus32.dsp +47 -0
  608. cyfaust/resources/libraries/examples/physicalModeling/russianBell.dsp +8 -0
  609. cyfaust/resources/libraries/examples/physicalModeling/standardBell.dsp +8 -0
  610. cyfaust/resources/libraries/examples/physicalModeling/violin.dsp +8 -0
  611. cyfaust/resources/libraries/examples/physicalModeling/violinMIDI.dsp +8 -0
  612. cyfaust/resources/libraries/examples/physicalModeling/vocalBP.dsp +8 -0
  613. cyfaust/resources/libraries/examples/physicalModeling/vocalBPMIDI.dsp +8 -0
  614. cyfaust/resources/libraries/examples/physicalModeling/vocalFOF.dsp +8 -0
  615. cyfaust/resources/libraries/examples/physicalModeling/vocalFOFMIDI.dsp +8 -0
  616. cyfaust/resources/libraries/examples/pitchShifting/pitchShifter.dsp +20 -0
  617. cyfaust/resources/libraries/examples/psychoacoustic/harmonicExciter.dsp +10 -0
  618. cyfaust/resources/libraries/examples/quantizing/quantizedChords.dsp +49 -0
  619. cyfaust/resources/libraries/examples/reverb/dattorro.dsp +8 -0
  620. cyfaust/resources/libraries/examples/reverb/fdnRev.dsp +8 -0
  621. cyfaust/resources/libraries/examples/reverb/freeverb.dsp +8 -0
  622. cyfaust/resources/libraries/examples/reverb/greyhole.dsp +8 -0
  623. cyfaust/resources/libraries/examples/reverb/jprev.dsp +8 -0
  624. cyfaust/resources/libraries/examples/reverb/reverbDesigner.dsp +12 -0
  625. cyfaust/resources/libraries/examples/reverb/reverbTester.dsp +8 -0
  626. cyfaust/resources/libraries/examples/reverb/zitaRev.dsp +8 -0
  627. cyfaust/resources/libraries/examples/reverb/zitaRevFDN.dsp +8 -0
  628. cyfaust/resources/libraries/examples/smartKeyboard/acGuitar.dsp +100 -0
  629. cyfaust/resources/libraries/examples/smartKeyboard/associatedEffects/elecGuitarEffect.dsp +8 -0
  630. cyfaust/resources/libraries/examples/smartKeyboard/associatedEffects/myEffect.dsp +5 -0
  631. cyfaust/resources/libraries/examples/smartKeyboard/associatedEffects/reverb.dsp +5 -0
  632. cyfaust/resources/libraries/examples/smartKeyboard/bells.dsp +80 -0
  633. cyfaust/resources/libraries/examples/smartKeyboard/bowed.dsp +87 -0
  634. cyfaust/resources/libraries/examples/smartKeyboard/brass.dsp +82 -0
  635. cyfaust/resources/libraries/examples/smartKeyboard/clarinet.dsp +113 -0
  636. cyfaust/resources/libraries/examples/smartKeyboard/crazyGuiro.dsp +96 -0
  637. cyfaust/resources/libraries/examples/smartKeyboard/drums.dsp +74 -0
  638. cyfaust/resources/libraries/examples/smartKeyboard/dubDub.dsp +87 -0
  639. cyfaust/resources/libraries/examples/smartKeyboard/elecGuitar.dsp +67 -0
  640. cyfaust/resources/libraries/examples/smartKeyboard/fm.dsp +78 -0
  641. cyfaust/resources/libraries/examples/smartKeyboard/frog.dsp +74 -0
  642. cyfaust/resources/libraries/examples/smartKeyboard/harp.dsp +84 -0
  643. cyfaust/resources/libraries/examples/smartKeyboard/midiOnly.dsp +62 -0
  644. cyfaust/resources/libraries/examples/smartKeyboard/multiSynth.dsp +75 -0
  645. cyfaust/resources/libraries/examples/smartKeyboard/toy.dsp +71 -0
  646. cyfaust/resources/libraries/examples/smartKeyboard/trumpet.dsp +59 -0
  647. cyfaust/resources/libraries/examples/smartKeyboard/turenas.dsp +114 -0
  648. cyfaust/resources/libraries/examples/smartKeyboard/violin.dsp +91 -0
  649. cyfaust/resources/libraries/examples/smartKeyboard/violin2.dsp +84 -0
  650. cyfaust/resources/libraries/examples/smartKeyboard/vocal.dsp +43 -0
  651. cyfaust/resources/libraries/examples/spat/panpot.dsp +17 -0
  652. cyfaust/resources/libraries/examples/spat/spat.dsp +25 -0
  653. cyfaust/resources/libraries/fds.lib +535 -0
  654. cyfaust/resources/libraries/filter.lib +1710 -0
  655. cyfaust/resources/libraries/filters.lib +3125 -0
  656. cyfaust/resources/libraries/hoa.lib +1081 -0
  657. cyfaust/resources/libraries/instruments.lib +263 -0
  658. cyfaust/resources/libraries/interpolators.lib +675 -0
  659. cyfaust/resources/libraries/math.lib +602 -0
  660. cyfaust/resources/libraries/maths.lib +798 -0
  661. cyfaust/resources/libraries/maxmsp.lib +237 -0
  662. cyfaust/resources/libraries/mi.lib +528 -0
  663. cyfaust/resources/libraries/misceffects.lib +998 -0
  664. cyfaust/resources/libraries/music.lib +496 -0
  665. cyfaust/resources/libraries/noises.lib +487 -0
  666. cyfaust/resources/libraries/oscillator.lib +450 -0
  667. cyfaust/resources/libraries/oscillators.lib +1838 -0
  668. cyfaust/resources/libraries/phaflangers.lib +235 -0
  669. cyfaust/resources/libraries/physmodels.lib +3990 -0
  670. cyfaust/resources/libraries/platform.lib +59 -0
  671. cyfaust/resources/libraries/quantizers.lib +310 -0
  672. cyfaust/resources/libraries/reducemaps.lib +235 -0
  673. cyfaust/resources/libraries/reverbs.lib +686 -0
  674. cyfaust/resources/libraries/routes.lib +262 -0
  675. cyfaust/resources/libraries/sf.lib +53 -0
  676. cyfaust/resources/libraries/signals.lib +570 -0
  677. cyfaust/resources/libraries/soundfiles.lib +234 -0
  678. cyfaust/resources/libraries/spats.lib +173 -0
  679. cyfaust/resources/libraries/stdfaust.lib +38 -0
  680. cyfaust/resources/libraries/synths.lib +322 -0
  681. cyfaust/resources/libraries/tonestacks.lib +427 -0
  682. cyfaust/resources/libraries/tubes.lib +5039 -0
  683. cyfaust/resources/libraries/vaeffects.lib +984 -0
  684. cyfaust/resources/libraries/version.lib +22 -0
  685. cyfaust/resources/libraries/wdmodels.lib +2276 -0
  686. cyfaust/resources/libraries/webaudio.lib +402 -0
  687. cyfaust/signal.pxd +44 -0
  688. cyfaust/signal.pyx +1993 -0
  689. cyfaust-0.1.0.dist-info/METADATA +355 -0
  690. cyfaust-0.1.0.dist-info/RECORD +693 -0
  691. cyfaust-0.1.0.dist-info/WHEEL +5 -0
  692. cyfaust-0.1.0.dist-info/entry_points.txt +3 -0
  693. cyfaust-0.1.0.dist-info/licenses/LICENSE +26 -0
@@ -0,0 +1,1591 @@
1
+ """
2
+ FAUST Architecture File
3
+ Copyright (C) 2023-2024 GRAME, Centre National de Creation Musicale
4
+ ---------------------------------------------------------------------
5
+ This Architecture section is free software; you can redistribute it
6
+ and/or modify it under the terms of the GNU Lesser General Public
7
+ License as published by the Free Software Foundation; either version 3
8
+ of the License, or (at your option) any later version.
9
+
10
+ This program is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU Lesser General Public License for more details.
14
+
15
+ You should have received a copy of the GNU Lesser General Public License
16
+ along with this program; If not, see <http://www.gnu.org/licenses/>.
17
+
18
+ EXCEPTION : As a special exception, you may create a larger work
19
+ that contains this FAUST architecture section and distribute
20
+ that work under terms of your choice, so long as this FAUST
21
+ architecture section is not modified.
22
+ """
23
+
24
+ """
25
+ Take the DSP name, the DSP compiled as codebox file and its associated JSON file, possibly the effect
26
+ compiled as codebox file and its associated JSON file, and the maxpat output file name.
27
+ Addionally, the C++ export path and filename can be specified, and the C++ code
28
+ will be exported and compiled if 'compile' is True.
29
+ The 'test' option allows to generate a patch with the 'RB_xx' prefixed labels for the parameters,
30
+ to be used with the C++ RNBO test application with the rnbo_dsp class.
31
+ The 'subpatcher' option allows to generate sub-patch as foo.rnbopat files.
32
+
33
+ Parsing the JSON file gives:
34
+ - the list of parameters (button, checkbox, sliders, nentry) to be added as "set param" objects
35
+ - the number of audio inputs/outputs to be added in the subpatch
36
+ - the MIDI state to be used in the patch
37
+ - the nvoices count to be used in the patch
38
+ The maxpat file is generated with the following structure:
39
+ - rnbo~ object for DSP
40
+ - subpatch
41
+ - codebox~ object
42
+ - input boxes
43
+ - output boxes
44
+ - parameter boxes possibly with MIDI control
45
+ - lines between boxes
46
+ - the subpatch can be generated as flat or as a foo.rnbopat file then loaded as a 'p' subpatcher
47
+ - the polyphony control is added if the MIDI state is True and the nvoices count is > 0. Effect is added as a 'p' subpatcher.
48
+ - possibly loadbang box and 'compile C++ and export' machinery
49
+ - possibly midiin/midiout objects
50
+ - dac~ object and possibly adc~ object (if the DSP has inputs)
51
+ """
52
+
53
+ from py2max.py2max import *
54
+ import argparse
55
+ import json
56
+ import logging
57
+ import re
58
+ from typing import Dict, List, Tuple, Optional
59
+
60
+
61
+ def get_midi_and_nvoices(json_data: dict) -> Tuple[bool, int]:
62
+ """
63
+ Extracts the MIDI state and nvoices count from the given JSON data.
64
+
65
+ Args:
66
+ json_data (dict): The JSON data in dictionary format.
67
+
68
+ Returns:
69
+ Tuple[bool, int]: A tuple containing the MIDI state (True or False) and nvoices count (int).
70
+ If the MIDI state or nvoices count is not present in the JSON, the corresponding
71
+ value in the tuple will be None.
72
+ """
73
+
74
+ # Initialize variables to store the MIDI state and nvoices count
75
+ midi_state = None
76
+ nvoices = None
77
+
78
+ # Extract the global meta section which is always present
79
+ global_meta = json_data["meta"]
80
+ for meta_item in global_meta:
81
+ # Check for options
82
+ if "options" in meta_item:
83
+ options = meta_item["options"]
84
+ # Extract MIDI state from options
85
+ midi_state = "[midi:on]" in options
86
+ # Extract nvoices count from options
87
+ nvoices_match = re.search(r"\[nvoices:(\d+)\]", options)
88
+ if nvoices_match:
89
+ nvoices = int(nvoices_match.group(1))
90
+ break
91
+
92
+ return midi_state, nvoices
93
+
94
+
95
+ def extract_items_info(json_data: dict) -> List[dict]:
96
+ """
97
+ Extracts information about UI items from the given DSP JSON data.
98
+
99
+ Args:
100
+ json_data (dict): DSP JSON data.
101
+
102
+ Returns:
103
+ List[dict]: A list of dictionaries containing information about each UI item.
104
+ """
105
+
106
+ def extract_from_ui(ui_items: List) -> List[dict]:
107
+ """
108
+ Recursive helper function to extract UI items information.
109
+
110
+ Args:
111
+ ui_items (List): List of UI items.
112
+
113
+ Returns:
114
+ List: A list of dictionaries containing information about each UI item.
115
+ """
116
+ info_list = []
117
+ for item in ui_items:
118
+ shortname = item.get("shortname", "")
119
+ item_type = item.get("type", "")
120
+
121
+ # get MIDI information
122
+ midi_info = []
123
+ for meta_item in item.get("meta", []):
124
+ if "midi" in meta_item:
125
+ midi_info.extend(meta_item["midi"].split())
126
+
127
+ # button and checkbox
128
+ if item_type in ["button", "checkbox"]:
129
+ info_list.append(
130
+ {
131
+ "shortname": shortname,
132
+ "type": item_type,
133
+ "init": 0,
134
+ "min": 0,
135
+ "max": 1,
136
+ "step": 1,
137
+ "midi": midi_info, # Include MIDI information as a list
138
+ }
139
+ )
140
+ # bargraph with "min", "max"
141
+ elif item_type in ["vbargraph", "hbargraph"]:
142
+ info_list.append(
143
+ {
144
+ "shortname": shortname,
145
+ "type": item_type,
146
+ "min": item["min"],
147
+ "max": item["max"],
148
+ "midi": midi_info, # Include MIDI information as a list
149
+ }
150
+ )
151
+ # slider and nentry, and has "min", "max", and "step"
152
+ elif all(key in item for key in ["min", "max", "step"]):
153
+ info_list.append(
154
+ {
155
+ "shortname": shortname,
156
+ "type": item_type,
157
+ "init": item.get("init", 0),
158
+ "min": item["min"],
159
+ "max": item["max"],
160
+ "step": item["step"],
161
+ "midi": midi_info, # Include MIDI information as a list
162
+ }
163
+ )
164
+
165
+ # possibly recurse
166
+ if "items" in item:
167
+ info_list.extend(extract_from_ui(item["items"]))
168
+ return info_list
169
+
170
+ # Extracting items info from the "ui" section
171
+ if "ui" in json_data:
172
+ ui_section = json_data["ui"]
173
+ return extract_from_ui(ui_section)
174
+ return []
175
+
176
+
177
+ # Creating the proper label for the parameter
178
+ def build_label(item_type: str, shortname: str, test: bool) -> str:
179
+ if test:
180
+ return "RB_" + item_type + "_" + shortname
181
+ elif shortname[0].isdigit():
182
+ return "cb_" + shortname
183
+ else:
184
+ return shortname
185
+
186
+
187
+ def add_polyphony_control(
188
+ sub_patch: Patcher,
189
+ set_param_pitch: Box,
190
+ set_param_gain: Box,
191
+ set_param_gate: Box,
192
+ is_freq: bool,
193
+ is_gain: bool,
194
+ ) -> None:
195
+ """
196
+ Adds polyphony control to a sub-patch for MIDI note input.
197
+
198
+ This function provides the flexibility to control pitch and gain parameters either
199
+ by frequency/MIDI key and gain/MIDI velocity. It takes parameters for setting pitch,
200
+ gain, and gate parameters, along with flags to specify control methods. The MIDI
201
+ notein and relevant processing objects are added to the sub-patch for polyphonic control.
202
+
203
+ Args:
204
+ sub_patch (Patcher): The sub-patch to which the polyphony control elements will be added.
205
+ set_param_pitch (Box): The objects for setting the pitch parameter.
206
+ set_param_gain (Box): The objects for setting the gain parameter.
207
+ set_param_gate (Box): The objects for setting the gate parameter.
208
+ is_freq (bool): Flag indicating whether pitch is controlled by frequency or MIDI key.
209
+ is_gain (bool): Flag indicating whether gain is controlled by gain or MIDI velocity.
210
+
211
+ Returns:
212
+ None
213
+ """
214
+
215
+ # Add MIDI notein
216
+ note_in = sub_patch.add_textbox("notein")
217
+
218
+ # Pitch can be controlled by frequency or MIDI key
219
+ if is_freq:
220
+ # MIDI key to frequency conversion
221
+ mtof = sub_patch.add_textbox("mtof")
222
+ # freq patching
223
+ sub_patch.add_line(note_in, mtof)
224
+ sub_patch.add_line(mtof, set_param_pitch)
225
+ else:
226
+ # MIDI key patching
227
+ sub_patch.add_line(note_in, set_param_pitch)
228
+
229
+ # Gain can be controlled by gain or MIDI velocity
230
+ if is_gain:
231
+ # MIDI velocity scaled to 0-1
232
+ scale_gain = sub_patch.add_textbox("scale 0 127 0 1")
233
+ # Velocity/gain patching
234
+ sub_patch.add_line(note_in, scale_gain, outlet=1)
235
+ sub_patch.add_line(scale_gain, set_param_gain)
236
+ else:
237
+ # MIDI velocity directly controls gain
238
+ sub_patch.add_line(note_in, set_param_gain, outlet=1)
239
+
240
+ # Velocity/gate patching
241
+ gate_op = sub_patch.add_textbox("> 0")
242
+ sub_patch.add_line(note_in, gate_op, outlet=1)
243
+ sub_patch.add_line(gate_op, set_param_gate)
244
+
245
+
246
+ def add_midi_control(
247
+ item: dict,
248
+ sub_patch: Patcher,
249
+ codebox: Box,
250
+ param: Optional[Box] = None,
251
+ set_param: Optional[Box] = None,
252
+ change: Optional[Box] = None,
253
+ ) -> bool:
254
+ """
255
+ Adds MIDI control to the subpatch.
256
+
257
+ This function handles the MIDI control for both input and output in the subpatch.
258
+ It checks the MIDI control type and prepares the necessary MIDI input and output messages.
259
+ The scaling for MIDI input and output messages is also defined based on the control type.
260
+
261
+ Args:
262
+ item (dict): The dictionary containing information about the UI item.
263
+ sub_patch (Patcher): The subpatcher object to which MIDI control will be added.
264
+ codebox (Box): The codebox~ object in the subpatcher.
265
+ param (Optional[Box]): The param object for the input UI items.
266
+ set_param (Optional[Box]): The 'set' param object for the input UI items.
267
+ change (Optional[Box]): The change object for bargraph UI items.
268
+
269
+ Returns:
270
+ bool: True if MIDI control type is supported and added successfully, possible logs an error and return False otherwise.
271
+ """
272
+
273
+ # Get the MIDI information from the item dictionary
274
+ midi_info = item.get("midi", None)
275
+ if not midi_info:
276
+ return False
277
+
278
+ # Define the Faust to RNBO syntax mapping for both MIDI input and output
279
+ midi_mapping = {
280
+ "ctrl": {"in": "ctlin", "out": "ctlout"},
281
+ "chanpress": {"in": "touchin", "out": "touchout"},
282
+ "keyon": {"in": "notein", "out": "noteout"},
283
+ "keyoff": {"in": "notein", "out": "noteout"},
284
+ "key": {"in": "notein", "out": "noteout"},
285
+ "pitchwheel": {"in": "bendin @bendmode 2", "out": "bendout @bendmode 2"},
286
+ "pgm": {"in": "pgmin", "out": "pgmout"},
287
+ }
288
+
289
+ # Check if the MIDI control type is supported
290
+ midi_type = midi_info[0]
291
+ if midi_type not in midi_mapping:
292
+ logging.error(f"MIDI control type '{midi_type}' not supported")
293
+ return False
294
+
295
+ # Prepare the MIDI input and output messages
296
+ midi_type = midi_info[0]
297
+ midi_args = " ".join(midi_info[1:])
298
+
299
+ # Scaling for MIDI input and output messages
300
+ # Pitchwheel case using @bendmode 2 (-8192, 8192) mode
301
+ if midi_type == "pitchwheel":
302
+ scaling_in = f"scale -8192 8192 {item['min']} {item['max']}"
303
+ scaling_out = f"scale {item['min']} {item['max']} -8192 8192"
304
+ # General case
305
+ else:
306
+ scaling_in = f"scale 0 127 {item['min']} {item['max']}"
307
+ scaling_out = f"scale {item['min']} {item['max']} 0 127"
308
+
309
+ # Connect the input objects
310
+ if set_param:
311
+ # Create MIDI object (TODO: handle all channels case: Faust 0 => RNBO -1)
312
+ midi_in = sub_patch.add_textbox(f"{midi_mapping[midi_type]['in']} {midi_args}")
313
+ midi_out = sub_patch.add_textbox(
314
+ f"{midi_mapping[midi_type]['out']} {midi_args}"
315
+ )
316
+ # Create the scaling box
317
+ scaling_in_box = sub_patch.add_textbox(scaling_in)
318
+ scaling_out_box = sub_patch.add_textbox(scaling_out)
319
+ # Input connections
320
+ sub_patch.add_line(midi_in, scaling_in_box)
321
+ sub_patch.add_line(scaling_in_box, set_param)
322
+ # Output connections
323
+ sub_patch.add_line(param, scaling_out_box)
324
+ sub_patch.add_line(scaling_out_box, midi_out)
325
+
326
+ # Connect the output objects
327
+ if change:
328
+ # Create MIDI object (TODO: handle all channels case: Faust 0 => RNBO -1)
329
+ midi_out = sub_patch.add_textbox(
330
+ f"{midi_mapping[midi_type]['out']} {midi_args}"
331
+ )
332
+ # Create the scaling box
333
+ scaling_out_box = sub_patch.add_textbox(scaling_out)
334
+ # Connections
335
+ sub_patch.add_line(change, scaling_out_box)
336
+ sub_patch.add_line(scaling_out_box, midi_out)
337
+
338
+ return True
339
+
340
+
341
+ def generate_io_info(
342
+ midi: bool, num_inputs: int, num_outputs: int
343
+ ) -> Tuple[int, int, dict, dict]:
344
+ """
345
+ Generate inlet and outlet information dictionaries based on the number of inputs and outputs.
346
+
347
+ Args:
348
+ midi (bool): A flag indicating whether to include MIDI inlet/outlet.
349
+ num_inputs (int): The number of input signals.
350
+ num_outputs (int): The number of output signals.
351
+
352
+ Returns:
353
+ Tuple: A tuple containing four elements:
354
+ - inlets (int): Total number of inlet ports, including MIDI if applicable.
355
+ - outlets (int): Total number of outlet ports, including MIDI if applicable.
356
+ - inletInfo (dict): Dictionary containing information about the input ports.
357
+ - outletInfo (dict): Dictionary containing information about the output ports.
358
+ """
359
+ inletInfo = {"IOInfo": []}
360
+ outletInfo = {"IOInfo": []}
361
+
362
+ if midi:
363
+ inlets = max(1, num_inputs) + 1
364
+ # First inlets are signals
365
+ for i in range(1, num_inputs + 1):
366
+ io_entry = {"comment": "", "index": i, "tag": f"in{i}", "type": "signal"}
367
+ inletInfo["IOInfo"].append(io_entry)
368
+ # Last inlet is MIDI
369
+ io_entry = {
370
+ "comment": "",
371
+ "index": inlets,
372
+ "tag": f"in{inlets}",
373
+ "type": "midi",
374
+ }
375
+ inletInfo["IOInfo"].append(io_entry)
376
+ # The MIDI outlet is added, then port message and dump outlets are always added
377
+ outlets = max(1, num_outputs) + 3
378
+ # First outlets are signals
379
+ for i in range(1, num_outputs + 1):
380
+ io_entry = {"comment": "", "index": i, "tag": f"out{i}", "type": "signal"}
381
+ outletInfo["IOInfo"].append(io_entry)
382
+ # Next outlet is MIDI
383
+ io_entry = {"comment": "", "index": i, "tag": f"out{i}", "type": "midi"}
384
+ outletInfo["IOInfo"].append(io_entry)
385
+ else:
386
+ inlets = max(1, num_inputs)
387
+ # All inlets are signals
388
+ for i in range(1, num_inputs + 1):
389
+ io_entry = {"comment": "", "index": i, "tag": f"in{i}", "type": "signal"}
390
+ inletInfo["IOInfo"].append(io_entry)
391
+ # Port message and dump outlets are always added
392
+ outlets = max(1, num_outputs) + 2
393
+ # All outlets are signals
394
+ for i in range(1, num_outputs + 1):
395
+ io_entry = {"comment": "", "index": i, "tag": f"out{i}", "type": "signal"}
396
+ outletInfo["IOInfo"].append(io_entry)
397
+
398
+ return inlets, outlets, inletInfo, outletInfo
399
+
400
+
401
+ def add_codebox_object(
402
+ patcher: Patcher,
403
+ sub_patcher: Patcher,
404
+ rnbo: Box,
405
+ prefix: str,
406
+ codebox_code: str,
407
+ items_info_list: List[dict],
408
+ midi: bool,
409
+ nvoices: int,
410
+ test: bool,
411
+ num_inputs: int,
412
+ num_outputs: int,
413
+ ) -> None:
414
+ """
415
+ Add a codebox~ object and parameter controls to a Max/MSP subpatcher.
416
+
417
+ This function sets up a codebox~ object and associated parameter controls
418
+ within a Max/MSP subpatcher. It generates input and output lines, handles
419
+ UI elements like buttons, sliders, and MIDI controls, and provides polyphony
420
+ control when applicable.
421
+
422
+ Parameters:
423
+ patcher (Patcher): The main Max/MSP patcher.
424
+ sub_patcher (Patcher): The subpatcher where the codebox~ will be added.
425
+ rnbo (Box): The rnbo object.
426
+ prefix (str): The prefix to be added to the label.
427
+ codebox_code (str): The code to be added to the codebox~.
428
+ items_info_list (list[dict]): List of dictionaries containing UI item information.
429
+ midi (bool): Whether MIDI controls should be added.
430
+ nvoices (int): Number of voices for polyphony control.
431
+ test (bool): Whether the code is for testing purposes.
432
+ num_inputs (int): Number of audio inputs.
433
+ num_outputs (int): Number of audio outputs.
434
+ """
435
+ # Create codebox~ section in the subpatcher
436
+ codebox = sub_patcher.add_codebox_tilde(
437
+ code=codebox_code, patching_rect=[500.0, 500.0, 400.0, 200.0]
438
+ )
439
+
440
+ # Generating the lines of code for inputs
441
+ for i in range(num_inputs):
442
+ input_box = sub_patcher.add_textbox(f"in~ {i + 1}")
443
+ sub_patcher.add_line(input_box, codebox, inlet=i)
444
+
445
+ # Generating the lines of code for outputs
446
+ for i in range(num_outputs):
447
+ output_box = sub_patcher.add_textbox(f"out~ {i + 1}")
448
+ sub_patcher.add_line(codebox, output_box, outlet=i)
449
+
450
+ # Parameter for polyphony handling
451
+ set_param_pitch = None
452
+ set_param_gain = None
453
+ set_param_gate = None
454
+ is_freq = False
455
+ is_gain = False
456
+
457
+ # Counter of bargraph to be used to outlet computation
458
+ bargraph_count = 0
459
+
460
+ # Add parameter control for button/checkbox and slider/nentry, annlyse for polyphony
461
+ for item in items_info_list:
462
+ shortname = item["shortname"]
463
+ item_type = item["type"]
464
+ label = build_label(item_type, shortname, test)
465
+ label_path = prefix + label
466
+ # print(label_path)
467
+
468
+ # button and checkbox use a 'toggle' object
469
+ if item_type in ["button", "checkbox"]:
470
+ # Add a global 'set' param object
471
+ set_param = sub_patcher.add_textbox(f"set {label}")
472
+
473
+ # Upper level parameter control with a 'toggle' and 'attrui' objects
474
+ toggle = patcher.add_textbox("toggle")
475
+ # Set the position and size of the toggle button on the canvas
476
+ toggle.patching_rect = [
477
+ toggle.patching_rect[0],
478
+ toggle.patching_rect[1],
479
+ 24.0,
480
+ 24.0,
481
+ ]
482
+ param_wrap = patcher.add_textbox(
483
+ "attrui",
484
+ maxclass="attrui",
485
+ attr=label,
486
+ parameter_enable=1,
487
+ minimum=0,
488
+ maximum=1,
489
+ saved_attribute_attributes={
490
+ "valueof": {
491
+ "parameter_initial": [label_path, 0],
492
+ "parameter_initial_enable": 1,
493
+ }
494
+ },
495
+ )
496
+ patcher.add_line(toggle, param_wrap)
497
+ patcher.add_line(param_wrap, rnbo)
498
+
499
+ param = sub_patcher.add_textbox(
500
+ f"param {label} 0 @min 0 @max 1",
501
+ )
502
+
503
+ # Add a line to connect the parameter control to the 'set' param object
504
+ sub_patcher.add_line(param, set_param)
505
+ # Add a line to connect the 'set' param object to the codebox
506
+ sub_patcher.add_line(set_param, codebox)
507
+
508
+ # Possibly add MIDI input control
509
+ if midi:
510
+ add_midi_control(
511
+ item, sub_patcher, codebox, param=param, set_param=set_param
512
+ )
513
+
514
+ # bargraph with "min", "max"
515
+ elif item_type in ["vbargraph", "hbargraph"]:
516
+ min_value = item["min"]
517
+ max_value = item["max"]
518
+
519
+ # Upper level parameter control with a 'attrui' object
520
+ param_wrap = patcher.add_textbox(
521
+ "attrui",
522
+ maxclass="attrui",
523
+ attr=label,
524
+ minimum=min_value,
525
+ maximum=max_value,
526
+ parameter_enable=1,
527
+ saved_attribute_attributes={
528
+ "valueof": {
529
+ "parameter_initial": [label_path, 0],
530
+ "parameter_initial_enable": 1,
531
+ }
532
+ },
533
+ )
534
+ patcher.add_line(param_wrap, rnbo)
535
+
536
+ param = sub_patcher.add_textbox(
537
+ f"param {label} 0 @min {min_value} @max {max_value}",
538
+ )
539
+
540
+ # Signal transformed in control
541
+ snapshot = sub_patcher.add_textbox("snapshot~ 10")
542
+ change = sub_patcher.add_textbox("change")
543
+
544
+ # Connect codebox outN to snapshot
545
+ sub_patcher.add_line(codebox, snapshot, outlet=num_outputs + bargraph_count)
546
+ # Connect snapshot to range
547
+ sub_patcher.add_line(snapshot, change)
548
+ # And finally change to param
549
+ sub_patcher.add_line(change, param)
550
+
551
+ # Possibly add MIDI output control
552
+ if midi:
553
+ add_midi_control(item, sub_patcher, codebox, change=change)
554
+
555
+ # Next bargraph
556
+ bargraph_count += 1
557
+
558
+ # slider and nentry use a 'param' object
559
+ else:
560
+ min_value = item["min"]
561
+ max_value = item["max"]
562
+ init_value = item["init"]
563
+ steps_value = (max_value - min_value) / item["step"]
564
+
565
+ # Add a global 'set' param object
566
+ set_param = sub_patcher.add_textbox(f"set {label}")
567
+
568
+ # Upper level parameter control with a 'attrui' object
569
+ param_wrap = patcher.add_textbox(
570
+ "attrui",
571
+ maxclass="attrui",
572
+ attr=label,
573
+ minimum=min_value,
574
+ maximum=max_value,
575
+ parameter_enable=1,
576
+ saved_attribute_attributes={
577
+ "valueof": {
578
+ "parameter_initial": [label_path, init_value],
579
+ "parameter_initial_enable": 1,
580
+ }
581
+ },
582
+ )
583
+ patcher.add_line(param_wrap, rnbo)
584
+
585
+ param = sub_patcher.add_textbox(
586
+ # Does not work with @steps, with parameter values slightly different
587
+ # f"param {label} {init_value} @min {min_value} @max {max_value} @steps {steps_value} ",
588
+ f"param {label} {init_value} @min {min_value} @max {max_value}",
589
+ )
590
+
591
+ # Add a line to connect the parameter control to the 'set' param object
592
+ sub_patcher.add_line(param, set_param)
593
+ # Add a line to connect the 'set' param object to the codebox
594
+ sub_patcher.add_line(set_param, codebox)
595
+
596
+ # Possibly add MIDI input control
597
+ if midi:
598
+ add_midi_control(
599
+ item, sub_patcher, codebox, param=param, set_param=set_param
600
+ )
601
+
602
+ # Analyze the parameter shortname for polyphony handing
603
+ if midi and nvoices > 0:
604
+ if shortname.endswith("freq"):
605
+ set_param_pitch = set_param
606
+ is_freq = True
607
+ elif shortname.endswith("key"):
608
+ set_param_pitch = set_param
609
+ is_freq = False
610
+ elif shortname.endswith("gain"):
611
+ set_param_gain = set_param
612
+ is_gain = True
613
+ elif shortname.endswith("velocity"):
614
+ set_param_gain = set_param
615
+ is_gain = False
616
+ elif shortname.endswith("gate"):
617
+ set_param_gate = set_param
618
+
619
+ # After analyzing all UI items to get freq/gain/gate controls, possibly add polyphony control
620
+ if midi and nvoices > 0 and set_param_pitch and set_param_gain and set_param_gate:
621
+ add_polyphony_control(
622
+ sub_patcher,
623
+ set_param_pitch,
624
+ set_param_gain,
625
+ set_param_gate,
626
+ is_freq,
627
+ is_gain,
628
+ )
629
+
630
+
631
+ def create_rnbo_object(
632
+ patcher: Patcher,
633
+ dsp_name: str,
634
+ midi: bool,
635
+ nvoices: int,
636
+ num_inputs: int,
637
+ num_outputs: int,
638
+ ):
639
+ """
640
+ Create and configure the rnbo~ object.
641
+
642
+ This function creates and configures the rnbo~ object within a Max/MSP patcher.
643
+ It sets attributes such as optimization, title, and polyphony (if applicable)
644
+ based on the provided parameters.
645
+
646
+ Parameters:
647
+ patcher (Patcher): The Max/MSP patcher where the rnbo~ object will be added.
648
+ dsp_name (str): The name of the DSP module.
649
+ midi (bool): Whether MIDI controls should be added.
650
+ nvoices (int): Number of voices for polyphony control.
651
+ num_inputs (int): Number of audio inputs.
652
+ num_outputs (int): Number of audio outputs.
653
+
654
+ Returns:
655
+ rnbo (Box): The created rnbo~ object.
656
+ """
657
+ # Create the rnbo~ object
658
+ rnbo_attributes = {"optimization": "O3", "title": dsp_name, "dumpoutlet": 1}
659
+ # Add the polyphony attribute only if midi is True and nvoices > 0
660
+ if midi and nvoices > 0:
661
+ rnbo_attributes["polyphony"] = nvoices
662
+
663
+ # Prepare the inlet and outlet information
664
+ inlets, outlets, inletInfo, outletInfo = generate_io_info(
665
+ midi, num_inputs, num_outputs
666
+ )
667
+
668
+ # Create the rnbo~ object
669
+ rnbo = patcher.add_rnbo(
670
+ inletInfo=inletInfo,
671
+ outletInfo=outletInfo,
672
+ title=dsp_name,
673
+ numinlets=inlets,
674
+ numoutlets=outlets,
675
+ saved_object_attributes=rnbo_attributes,
676
+ )
677
+ # And return it
678
+ return rnbo
679
+
680
+
681
+ def add_rnbo_object_flat(
682
+ patcher: Patcher,
683
+ dsp_name: str,
684
+ codebox_code: str,
685
+ items_info_list: List[dict],
686
+ midi: bool,
687
+ nvoices: int,
688
+ test: bool,
689
+ num_inputs: int,
690
+ num_outputs: int,
691
+ ) -> Box:
692
+ """
693
+ Adds DSP elements, routing, and parameter controls for a DSP to the given Patcher object in flat mode.
694
+
695
+ Parameters:
696
+ patcher (Patcher): The Patcher object to which DSP elements and controls will be added.
697
+ dsp_name (str): The name of the DSP.
698
+ codebox_code (str): The code to be executed by the DSP effect.
699
+ items_info_list (List[dict]): A list of dictionaries containing information about UI items.
700
+ midi (bool): Indicates whether MIDI control is enabled.
701
+ nvoices (int): The number of polyphony voices.
702
+ num_inputs (int): The number of audio input channels.
703
+ num_outputs (int): The number of audio output channels.
704
+
705
+ Returns:
706
+ Box: The added rnbo~ object representing the DSP.
707
+ """
708
+
709
+ # Create the rnbo~ object
710
+ rnbo = create_rnbo_object(patcher, dsp_name, midi, nvoices, num_inputs, num_outputs)
711
+
712
+ # Create the codebox subpatcher
713
+ sub_patcher = rnbo.subpatcher
714
+ add_codebox_object(
715
+ patcher,
716
+ sub_patcher,
717
+ rnbo,
718
+ "",
719
+ codebox_code,
720
+ items_info_list,
721
+ midi,
722
+ nvoices,
723
+ test,
724
+ num_inputs,
725
+ num_outputs,
726
+ )
727
+
728
+ return rnbo
729
+
730
+
731
+ def add_rnbo_object_subpatcher(
732
+ patcher: Patcher,
733
+ rnbopat_path: str,
734
+ dsp_name: str,
735
+ codebox_code: str,
736
+ items_info_list: List[dict],
737
+ midi: bool,
738
+ nvoices: int,
739
+ test: bool,
740
+ num_inputs: int,
741
+ num_outputs: int,
742
+ ) -> Box:
743
+ """
744
+ Adds DSP elements, routing, and parameter controls for a DSP to the given Patcher object in 'p' subpatcher.
745
+
746
+ Parameters:
747
+ patcher (Patcher): The Patcher object to which DSP elements and controls will be added.
748
+ rnbopat_path (str): The path to the directory where the maxpat will be saved.
749
+ dsp_name (str): The name of the DSP.
750
+ codebox_code (str): The code to be executed by the DSP effect.
751
+ items_info_list (List[dict]): A list of dictionaries containing information about UI items.
752
+ midi (bool): Indicates whether MIDI control is enabled.
753
+ nvoices (int): The number of polyphony voices.
754
+ num_inputs (int): The number of audio input channels.
755
+ num_outputs (int): The number of audio output channels.
756
+
757
+ Returns:
758
+ Box: The added rnbo~ object representing the DSP.
759
+ """
760
+
761
+ # Create the rnbo~ object
762
+ rnbo = create_rnbo_object(patcher, dsp_name, midi, nvoices, num_inputs, num_outputs)
763
+
764
+ # Create the codebox subpatcher in a rnbopat file
765
+ rnbopat = Patcher(rnbopat_path, classnamespace="rnbo")
766
+ add_codebox_object(
767
+ patcher,
768
+ rnbopat,
769
+ rnbo,
770
+ "poly/" + dsp_name + "/" if nvoices > 0 else dsp_name + "/",
771
+ codebox_code,
772
+ items_info_list,
773
+ midi,
774
+ nvoices,
775
+ test,
776
+ num_inputs,
777
+ num_outputs,
778
+ )
779
+
780
+ # Save the rnbopat file
781
+ rnbopat.save()
782
+
783
+ # Get the subpatcher
784
+ sub_patcher = rnbo.subpatcher
785
+
786
+ # Add the DSP subpatcher
787
+ if nvoices > 0:
788
+ p_dsp_box = sub_patcher.add_textbox(
789
+ f"p @title {dsp_name} @file {rnbopat_path} @polyphony {nvoices}"
790
+ )
791
+ else:
792
+ p_dsp_box = sub_patcher.add_textbox(f"p @title {dsp_name} @file {rnbopat_path}")
793
+
794
+ # Generating the lines of code for inputs
795
+ for i in range(num_inputs):
796
+ input_box = sub_patcher.add_textbox(f"in~ {i + 1}")
797
+ sub_patcher.add_line(input_box, p_dsp_box, inlet=i)
798
+
799
+ # Generating the lines of code for outputs
800
+ for i in range(num_outputs):
801
+ output_box = sub_patcher.add_textbox(f"out~ {i + 1}")
802
+ sub_patcher.add_line(p_dsp_box, output_box, outlet=i)
803
+
804
+ # Possibly add MIDI input/output control in the global patcher
805
+ # and connect the DSP rnbo~ object to the midiin/midiout objects.
806
+ # midi_in/midi_out are only needed in polyphonic mode
807
+ if midi and nvoices > 0:
808
+ midi_in = sub_patcher.add_textbox("midiin")
809
+ midi_out = sub_patcher.add_textbox("midiout")
810
+ connect_midi_subpatcher(
811
+ sub_patcher, p_dsp_box, midi_in, midi_out, num_inputs, num_outputs
812
+ )
813
+
814
+ return rnbo
815
+
816
+
817
+ def add_rnbo_object_poly_effect(
818
+ patcher: Patcher,
819
+ dsp_rnbopat_path: str,
820
+ effect_rnbopat_path: str,
821
+ dsp_name: str,
822
+ dsp_codebox_code: str,
823
+ effect_codebox_code: str,
824
+ dsp_items_info_list: List[dict],
825
+ effect_items_info_list: List[dict],
826
+ midi: bool,
827
+ nvoices: int,
828
+ test: bool,
829
+ dsp_num_inputs: int,
830
+ dsp_num_outputs: int,
831
+ effect_num_inputs: int,
832
+ effect_num_outputs: int,
833
+ ) -> Box:
834
+ """
835
+ Adds DSP elements, routing, and parameter controls for a DSP to the given Patcher object for DSP and effect.
836
+
837
+ Parameters:
838
+ patcher (Patcher): The Patcher object to which DSP elements and controls will be added.
839
+ dsp_rnbopat_path (str): The path to the directory where the DSP maxpat will be saved.
840
+ effect_rnbopat_path (str): The path to the directory where the effect maxpat will be saved.
841
+ dsp_name (str): The name of the DSP.
842
+ dsp_codebox_code (str): The code to be executed by the DSP.
843
+ effect_codebox_code (str): The code to be executed by the effect.
844
+ dsp_items_info_list (List[dict]): A list of dictionaries containing information about UI items for the DSP.
845
+ effect_items_info_list (List[dict]): A list of dictionaries containing information about UI items for the effect.
846
+ midi (bool): Indicates whether MIDI control is enabled.
847
+ nvoices (int): The number of polyphony voices.
848
+ dsp_num_inputs (int): The number of audio input channels.
849
+ dsp_num_outputs (int): The number of audio output channels.
850
+ effect_num_inputs (int): The number of audio input channels.
851
+ effect_num_outputs (int): The number of audio output channels.
852
+
853
+ Returns:
854
+ Box: The added rnbo~ object representing the DSP.
855
+ """
856
+
857
+ # Create the rnbo~ object
858
+ rnbo = create_rnbo_object(
859
+ patcher, dsp_name, midi, nvoices, dsp_num_inputs, effect_num_outputs
860
+ )
861
+
862
+ # Create the DSP codebox subpatcher in a dsp_rnbo_pat file
863
+ dsp_rnbo_pat = Patcher(dsp_rnbopat_path, classnamespace="rnbo")
864
+ add_codebox_object(
865
+ patcher,
866
+ dsp_rnbo_pat,
867
+ rnbo,
868
+ "poly/" + dsp_name + "/" if nvoices > 0 else dsp_name + "/",
869
+ dsp_codebox_code,
870
+ dsp_items_info_list,
871
+ midi,
872
+ nvoices,
873
+ test,
874
+ dsp_num_inputs,
875
+ dsp_num_outputs,
876
+ )
877
+
878
+ # Save the rnbo_pat file
879
+ dsp_rnbo_pat.save()
880
+
881
+ # Create the effect codebox subpatcher in a rnbo_effect_pat file
882
+ effect_rnbo_pat = Patcher(effect_rnbopat_path, classnamespace="rnbo")
883
+ add_codebox_object(
884
+ patcher,
885
+ effect_rnbo_pat,
886
+ rnbo,
887
+ "poly/" + dsp_name + "[1]/" if nvoices > 0 else dsp_name + "/",
888
+ effect_codebox_code,
889
+ effect_items_info_list,
890
+ midi,
891
+ -1,
892
+ False,
893
+ effect_num_inputs,
894
+ effect_num_outputs,
895
+ )
896
+
897
+ # Save the rnbo_effect_pat file
898
+ effect_rnbo_pat.save()
899
+
900
+ # Get the subpatcher
901
+ sub_patcher = rnbo.subpatcher
902
+
903
+ # Add the DSP subpatcher
904
+ if nvoices > 0:
905
+ p_dsp_box = sub_patcher.add_textbox(
906
+ f"p @title {dsp_name} @file {dsp_rnbopat_path} @polyphony {nvoices}"
907
+ )
908
+ else:
909
+ p_dsp_box = sub_patcher.add_textbox(
910
+ f"p @title {dsp_name} @file {dsp_rnbopat_path}"
911
+ )
912
+
913
+ # Add the effect subpatcher
914
+ p_effect_box = sub_patcher.add_textbox(
915
+ f"p @title {dsp_name} @file {effect_rnbopat_path}"
916
+ )
917
+
918
+ # Generating the lines of code for inputs
919
+ for i in range(dsp_num_inputs):
920
+ input_box = sub_patcher.add_textbox(f"in~ {i + 1}")
921
+ sub_patcher.add_line(input_box, p_dsp_box, inlet=i)
922
+
923
+ # Connect the DSP to the effect
924
+ connect_dsp_effect(
925
+ sub_patcher,
926
+ p_dsp_box,
927
+ p_effect_box,
928
+ dsp_num_outputs,
929
+ effect_num_inputs,
930
+ )
931
+
932
+ # Generating the lines of code for outputs
933
+ for i in range(effect_num_outputs):
934
+ output_box = sub_patcher.add_textbox(f"out~ {i + 1}")
935
+ sub_patcher.add_line(p_effect_box, output_box, outlet=i)
936
+
937
+ # Possibly add MIDI input/output control in the global patcher
938
+ # and connect the DSP rnbo~ object to the midiin/midiout objects
939
+ if midi:
940
+ midi_in = sub_patcher.add_textbox("midiin")
941
+ midi_out = sub_patcher.add_textbox("midiout")
942
+ connect_midi_subpatcher(
943
+ sub_patcher, p_dsp_box, midi_in, midi_out, dsp_num_inputs, dsp_num_outputs
944
+ )
945
+
946
+ return rnbo
947
+
948
+
949
+ def connect_dsp_effect(
950
+ patcher: Patcher,
951
+ dsp_box: Box,
952
+ effect_box: Box,
953
+ dsp_num_outputs: int,
954
+ effect_num_inputs: int,
955
+ ) -> None:
956
+ """
957
+ Connects a DSP module to an effect module within a patcher.
958
+
959
+ Args:
960
+ patcher (Patcher): The main patcher where objects will be added.
961
+ dsp_box (Box): The rnbo DSP module
962
+ effect_box (Box): The rnbo effect module
963
+ dsp_num_outputs (int): Number of output channels of the DSP module.
964
+ effect_num_inputs (int): Number of input channels of the effect module.
965
+
966
+ Notes:
967
+ This function establishes audio connections between the specified DSP module
968
+ and effect module by adding appropriate lines to the patcher.
969
+
970
+ Implementing this equivalent Faust written logic:
971
+ connect(1,1) = _;
972
+ connect(2,2) = _,_;
973
+ connect(1,2) = _ <: _,_;
974
+ connect(2,1) = _,_ :> _;
975
+ Returns:
976
+ None
977
+ """
978
+
979
+ # print(f"Connecting DSP to effect: {dsp_num_outputs} -> {effect_num_inputs}")
980
+
981
+ # Python 3.10 and later
982
+ # match (dsp_num_outputs, effect_num_inputs):
983
+ # case (1, 1):
984
+ # # print("1 -> 1")
985
+ # patcher.add_line(dsp_box, effect_box)
986
+ # case (1, 2):
987
+ # # print("1 -> 2")
988
+ # patcher.add_line(dsp_box, effect_box, inlet=0, outlet=0)
989
+ # patcher.add_line(dsp_box, effect_box, inlet=1, outlet=0)
990
+ # case (2, 1):
991
+ # # print("2 -> 1")
992
+ # patcher.add_line(dsp_box, effect_box, inlet=0, outlet=0)
993
+ # patcher.add_line(dsp_box, effect_box, inlet=0, outlet=1)
994
+ # case (2, 2):
995
+ # # print("2 -> 2")
996
+ # patcher.add_line(dsp_box, effect_box, inlet=0, outlet=0)
997
+ # patcher.add_line(dsp_box, effect_box, inlet=1, outlet=1)
998
+
999
+ if dsp_num_outputs == 1:
1000
+ if effect_num_inputs == 1:
1001
+ # print("1 -> 1")
1002
+ patcher.add_line(dsp_box, effect_box)
1003
+ elif effect_num_inputs == 2:
1004
+ # print("1 -> 2")
1005
+ patcher.add_line(dsp_box, effect_box, inlet=0, outlet=0)
1006
+ patcher.add_line(dsp_box, effect_box, inlet=1, outlet=0)
1007
+ elif dsp_num_outputs == 2:
1008
+ if effect_num_inputs == 1:
1009
+ # print("2 -> 1")
1010
+ patcher.add_line(dsp_box, effect_box, inlet=0, outlet=0)
1011
+ patcher.add_line(dsp_box, effect_box, inlet=0, outlet=1)
1012
+ elif effect_num_inputs == 2:
1013
+ # print("2 -> 2")
1014
+ patcher.add_line(dsp_box, effect_box, inlet=0, outlet=0)
1015
+ patcher.add_line(dsp_box, effect_box, inlet=1, outlet=1)
1016
+
1017
+
1018
+ def add_compile_test(
1019
+ patcher: Patcher, rnbo: Box, export_path: str, cpp_filename: str
1020
+ ) -> None:
1021
+ """
1022
+ Adds a series of objects and routing connections to the given Patcher object in order to set up a compile test.
1023
+
1024
+ Parameters:
1025
+ patcher (Patcher): The main patcher where objects will be added.
1026
+ rnbo (Box): The rnbo DSP module
1027
+ export_path (str): The path to the directory where the export will be saved.
1028
+ cpp_filename (str): The desired filename for the exported CPP code.
1029
+
1030
+ Returns:
1031
+ None
1032
+ """
1033
+ load_bang = patcher.add_textbox("loadbang")
1034
+ dump_target_config = patcher.add_message(
1035
+ "dumptargetconfig cpp-export cpp-code-export"
1036
+ )
1037
+ tb = patcher.add_textbox("t b b s")
1038
+ set_path = patcher.add_message(
1039
+ f"set output_path {export_path}, set export_name {cpp_filename}"
1040
+ )
1041
+ dict1 = patcher.add_textbox("dict")
1042
+ route_dict = patcher.add_textbox("route dictionary")
1043
+ export = patcher.add_message("export cpp-export cpp-code-export $1")
1044
+ route = patcher.add_textbox("route targetconfig")
1045
+
1046
+ # internal routing
1047
+ patcher.add_line(load_bang, dump_target_config)
1048
+ patcher.add_line(dump_target_config, rnbo)
1049
+ patcher.add_line(tb, dict1)
1050
+ patcher.add_line(tb, set_path, outlet=1)
1051
+ patcher.add_line(tb, dict1, outlet=2, inlet=1)
1052
+ patcher.add_line(set_path, dict1)
1053
+ patcher.add_line(dict1, route_dict)
1054
+ patcher.add_line(route_dict, export)
1055
+ patcher.add_line(route, tb)
1056
+
1057
+ # routing with rnbo object
1058
+ patcher.add_line(export, rnbo)
1059
+ # Right most outlet of rnbo is dump outlet
1060
+ patcher.add_line(rnbo, route, outlet=rnbo.numoutlets - 1)
1061
+
1062
+
1063
+ def create_audio_output(patcher: Patcher, rnbo: Box, num_outputs: int) -> None:
1064
+ """
1065
+ Creates the output audio object.
1066
+
1067
+ Parameters:
1068
+ patcher (Patcher): The main patcher where objects will be added.
1069
+ rnbo (Box): The rnbo DSP module
1070
+ num_outputs (int): The number of output channels to create.
1071
+
1072
+ Returns:
1073
+ None
1074
+
1075
+ Description:
1076
+ This function create an 'dac~' audio output with the specified number of output channels,
1077
+ then connect the rnbo object to the audio outputs.
1078
+ """
1079
+
1080
+ # Create the toggle button for audio output activation
1081
+ toggle = patcher.add_textbox("toggle")
1082
+
1083
+ # Set the position and size of the toggle button on the canvas
1084
+ toggle.patching_rect = [
1085
+ toggle.patching_rect[0],
1086
+ toggle.patching_rect[1],
1087
+ 24.0,
1088
+ 24.0,
1089
+ ]
1090
+
1091
+ # Generate a string for the 'dac~' object with the specified number of output channels
1092
+ dac_str = "dac~ " + " ".join(str(i + 1) for i in range(num_outputs))
1093
+
1094
+ # Create an audio output object with the generated 'dac~' string and the specified number of inlets
1095
+ audio_out = patcher.add_textbox(dac_str, numinlets=num_outputs)
1096
+
1097
+ # Connect the toggle button to the audio output object using a patch line
1098
+ patcher.add_line(toggle, audio_out)
1099
+
1100
+ # Connect the DSP rnbo~ object to audio_out using separate lines for each output channel
1101
+ for i in range(num_outputs):
1102
+ patcher.add_line(rnbo, audio_out, inlet=i, outlet=i)
1103
+
1104
+
1105
+ def create_audio_input(patcher: Patcher, rnbo: Box, num_inputs: int) -> None:
1106
+ """
1107
+ Creates the input audio object.
1108
+
1109
+ Parameters:
1110
+ patcher (Patcher): The main patcher where objects will be added.
1111
+ rnbo (Box): The rnbo DSP module
1112
+ num_inputs (int): The number of input channels to create.
1113
+
1114
+ Returns:
1115
+ None
1116
+
1117
+ Description:
1118
+ This function create an 'adc~' audio input with the specified number of input channels,
1119
+ then connect the audio inputs to the rnbo object.
1120
+ """
1121
+
1122
+ # Generate a string for the 'adc~' object with the specified number of input channels
1123
+ adc_str = "adc~ " + " ".join(str(i + 1) for i in range(num_inputs))
1124
+
1125
+ # Create an audio input object with the generated 'adc~' string and the specified number of outlets
1126
+ audio_in = patcher.add_textbox(adc_str, numoutlets=num_inputs)
1127
+
1128
+ # Connect audio_in to the DSP rnbo~ object using separate lines for each input channel
1129
+ for i in range(num_inputs):
1130
+ patcher.add_line(audio_in, rnbo, inlet=i, outlet=i)
1131
+
1132
+
1133
+ def connect_midi_rnbo(patcher: Patcher, rnbo: Box, midi_in: Box, midi_out: Box) -> None:
1134
+ """
1135
+ Connects MIDI input, a DSP, and MIDI output in a Max/MSP patcher.
1136
+
1137
+ Parameters:
1138
+ patcher (Patcher): The Max/MSP patcher to add connections to.
1139
+ rnbo (Box): The DSP object.
1140
+ midi_in (Box): The MIDI input object.
1141
+ midi_out (Box): The MIDI output object.
1142
+
1143
+ Returns:
1144
+ None
1145
+ """
1146
+
1147
+ # MIDI inlet will always be the right-most inlet, and inlets numbering starts at 0
1148
+ inlet_index = rnbo.numinlets - 1
1149
+ # MIDI outlet will always be the third from the right-most outlet, and outlets numbering starts at 0
1150
+ outlet_index = rnbo.numoutlets - 3
1151
+
1152
+ patcher.add_line(midi_in, rnbo, inlet=inlet_index)
1153
+ patcher.add_line(rnbo, midi_out, outlet=outlet_index)
1154
+
1155
+
1156
+ def connect_midi_subpatcher(
1157
+ patcher: Patcher,
1158
+ pbox: Box,
1159
+ midi_in: Box,
1160
+ midi_out: Box,
1161
+ inlet: int,
1162
+ outlet: int,
1163
+ ) -> None:
1164
+ """
1165
+ Connects MIDI input, a DSP, and MIDI output in a 'p' subpatcher.
1166
+
1167
+ Parameters:
1168
+ patcher (Patcher): The Max/MSP patcher to add connections to.
1169
+ rnbo (Box): The DSP object.
1170
+ midi_in (Box): The MIDI input object.
1171
+ midi_out (Box): The MIDI output object.
1172
+ inlet: (int): The index of the inlet to connect to.
1173
+ outlet: (int) : The index of the outlet to connect to.
1174
+
1175
+ Returns:
1176
+ None
1177
+ """
1178
+
1179
+ patcher.add_line(midi_in, pbox, inlet=inlet)
1180
+ patcher.add_line(pbox, midi_out, outlet=outlet)
1181
+
1182
+
1183
+ def create_rnbo_patch_flat(
1184
+ dsp_name: str,
1185
+ maxpat_path: str,
1186
+ export_path: str,
1187
+ cpp_filename: str,
1188
+ dsp_codebox_code: str,
1189
+ dsp_items_info_list: List[Dict],
1190
+ dsp_num_inputs: int,
1191
+ dsp_num_outputs: int,
1192
+ midi: bool,
1193
+ nvoices: int,
1194
+ effect_codebox_code: Optional[str] = None,
1195
+ effect_items_info_list: Optional[List[dict]] = None,
1196
+ effect_num_inputs: int = -1,
1197
+ effect_num_outputs: int = -1,
1198
+ compile: bool = False,
1199
+ test: bool = False,
1200
+ subpatcher: bool = False,
1201
+ ) -> None:
1202
+ """
1203
+ This function creates an RNBO Max patcher with the specified parameters.
1204
+
1205
+ Parameters:
1206
+ - dsp_name (str): The name of the DSP.
1207
+ - maxpat_path (str): The path where the Max patcher will be created.
1208
+ - export_path (str): The path for exporting the C++ code.
1209
+ - cpp_filename (str): The filename for the exported C++ code.
1210
+ - dsp_codebox_code (str): The code for the DSP codebox~ section in the subpatcher.
1211
+ - dsp_items_info_list (list): A list of dictionaries containing information about the items to be added.
1212
+ - dsp_num_inputs (int): The number of DSP audio inputs.
1213
+ - dsp_num_outputs (int): The number of DSP audio outputs.
1214
+ - effect_codebox_code (Optional[str]): The code for the effect codebox~ section in the subpatcher.
1215
+ - effect_items_info_list (Optional[List[dict]]): A list of dictionaries containing information about the items to be added.
1216
+ - effect_num_inputs (int): The number of effect audio inputs.
1217
+ - effect_num_outputs (int): The number of effect audio outputs.
1218
+ - midi (bool): A flag indicating whether to include MIDI input/output control.
1219
+ - nvoices (int): The number of voices in polyphonic mode.
1220
+ - compile (bool): A flag indicating whether to include the C++ compilation and export machinery.
1221
+ - test (bool): A flag indicating whether the patch is for testing purposes.
1222
+ - subpatcher (bool): A flag indicating whether to save subpatchers as foo.rnbopat files.
1223
+
1224
+ Returns:
1225
+ None
1226
+ """
1227
+
1228
+ # Create the patcher
1229
+ patcher = Patcher(maxpat_path)
1230
+
1231
+ # Faust generated patch comment
1232
+ patcher.add_comment(
1233
+ "Faust generated RNBO patch, Copyright (c) 2023-2024 Grame",
1234
+ patching_rect=[50.0, 10.0, 350.0, 100.0],
1235
+ fontsize=16,
1236
+ )
1237
+
1238
+ # Create the DSP rnbo~ object
1239
+ dsp_rnbo = add_rnbo_object_flat(
1240
+ patcher,
1241
+ dsp_name,
1242
+ dsp_codebox_code,
1243
+ dsp_items_info_list,
1244
+ midi,
1245
+ nvoices,
1246
+ test,
1247
+ dsp_num_inputs,
1248
+ dsp_num_outputs,
1249
+ )
1250
+
1251
+ # Possibly add MIDI input/output control in the global patcher
1252
+ # and connect the DSP rnbo~ object to the midiin/midiout objects
1253
+ if midi:
1254
+ midi_in = patcher.add_textbox("midiin")
1255
+ midi_out = patcher.add_textbox("midiout")
1256
+ connect_midi_rnbo(patcher, dsp_rnbo, midi_in, midi_out)
1257
+
1258
+ # Save subpatcher as an abstraction
1259
+ if subpatcher:
1260
+ dsp_rnbo.subpatcher.save_as(maxpat_path.rsplit(".", 1)[0] + "." + "rnbopat")
1261
+
1262
+ # Possibly create and connect the effect rnbo~ object
1263
+ if effect_codebox_code:
1264
+ effect_rnbo = add_rnbo_object_flat(
1265
+ patcher,
1266
+ "Effect",
1267
+ effect_codebox_code,
1268
+ effect_items_info_list,
1269
+ midi,
1270
+ -1,
1271
+ False,
1272
+ effect_num_inputs,
1273
+ effect_num_outputs,
1274
+ )
1275
+
1276
+ # Connect the DSP and effect rnbo~ objects
1277
+ connect_dsp_effect(
1278
+ patcher,
1279
+ dsp_rnbo,
1280
+ effect_rnbo,
1281
+ dsp_num_outputs,
1282
+ effect_num_inputs,
1283
+ )
1284
+
1285
+ # Save subpatcher as an abstraction with the '_effect' suffix
1286
+ if subpatcher:
1287
+ effect_rnbo.subpatcher.save_as(
1288
+ maxpat_path.rsplit(".", 1)[0] + "_effect." + "rnbopat"
1289
+ )
1290
+
1291
+ # Connect the effect rnbo~ object to the midiin/midiout objects
1292
+ if midi:
1293
+ connect_midi_rnbo(patcher, effect_rnbo, midi_in, midi_out)
1294
+
1295
+ # Add loadbang and 'compile C++ and export' machinery
1296
+ if compile:
1297
+ add_compile_test(patcher, dsp_rnbo, export_path, cpp_filename)
1298
+
1299
+ # Connect the appropriate rnbo~ object to audio_out
1300
+ if effect_codebox_code:
1301
+ # Create the audio driver output
1302
+ create_audio_output(patcher, effect_rnbo, effect_num_outputs)
1303
+ else:
1304
+ # Create the audio driver output
1305
+ create_audio_output(patcher, dsp_rnbo, dsp_num_outputs)
1306
+
1307
+ # Possibly create the audio driver input
1308
+ if dsp_num_inputs > 0:
1309
+ create_audio_input(patcher, dsp_rnbo, dsp_num_inputs)
1310
+
1311
+ # And finally save the patch
1312
+ patcher.save()
1313
+
1314
+
1315
+ # New version using 'p' subpatcher, to be used when MIDI out is fixed in C++ export
1316
+ def create_rnbo_patch(
1317
+ dsp_name: str,
1318
+ maxpat_path: str,
1319
+ export_path: str,
1320
+ cpp_filename: str,
1321
+ dsp_codebox_code: str,
1322
+ dsp_items_info_list: List[Dict],
1323
+ dsp_num_inputs: int,
1324
+ dsp_num_outputs: int,
1325
+ midi: bool,
1326
+ nvoices: int,
1327
+ effect_codebox_code: Optional[str] = None,
1328
+ effect_items_info_list: Optional[List[dict]] = None,
1329
+ effect_num_inputs: int = -1,
1330
+ effect_num_outputs: int = -1,
1331
+ compile: bool = False,
1332
+ test: bool = False,
1333
+ subpatcher: bool = False,
1334
+ ) -> None:
1335
+ """
1336
+ This function creates an RNBO Max patcher with the specified parameters.
1337
+
1338
+ Parameters:
1339
+ - dsp_name (str): The name of the DSP.
1340
+ - maxpat_path (str): The path where the Max patcher will be created.
1341
+ - export_path (str): The path for exporting the C++ code.
1342
+ - cpp_filename (str): The filename for the exported C++ code.
1343
+ - dsp_codebox_code (str): The code for the DSP codebox~ section in the subpatcher.
1344
+ - dsp_items_info_list (list): A list of dictionaries containing information about the items to be added.
1345
+ - dsp_num_inputs (int): The number of DSP audio inputs.
1346
+ - dsp_num_outputs (int): The number of DSP audio outputs.
1347
+ - effect_codebox_code (Optional[str]): The code for the effect codebox~ section in the subpatcher.
1348
+ - effect_items_info_list (Optional[List[dict]]): A list of dictionaries containing information about the items to be added.
1349
+ - effect_num_inputs (int): The number of effect audio inputs.
1350
+ - effect_num_outputs (int): The number of effect audio outputs.
1351
+ - midi (bool): A flag indicating whether to include MIDI input/output control.
1352
+ - nvoices (int): The number of voices in polyphonic mode.
1353
+ - compile (bool): A flag indicating whether to include the C++ compilation and export machinery.
1354
+ - test (bool): A flag indicating whether the patch is for testing purposes.
1355
+ - subpatcher (bool): A flag indicating whether to save subpatchers as foo.rnbopat files.
1356
+
1357
+ Returns:
1358
+ None
1359
+ """
1360
+
1361
+ # Create the patcher
1362
+ patcher = Patcher(maxpat_path)
1363
+
1364
+ # Faust generated patch comment
1365
+ patcher.add_comment(
1366
+ "Faust generated RNBO patch, Copyright (c) 2023-2024 Grame",
1367
+ patching_rect=[50.0, 10.0, 350.0, 100.0],
1368
+ fontsize=16,
1369
+ )
1370
+
1371
+ if effect_codebox_code:
1372
+ # Create the DSP rnbo~ object in 'p' subpatcher with DSP and effect
1373
+ dsp_rnbo = add_rnbo_object_poly_effect(
1374
+ patcher,
1375
+ maxpat_path.rsplit(".", 1)[0] + "." + "rnbopat",
1376
+ maxpat_path.rsplit(".", 1)[0] + "_effect." + "rnbopat",
1377
+ dsp_name,
1378
+ dsp_codebox_code,
1379
+ effect_codebox_code,
1380
+ dsp_items_info_list,
1381
+ effect_items_info_list,
1382
+ midi,
1383
+ nvoices,
1384
+ test,
1385
+ dsp_num_inputs,
1386
+ dsp_num_outputs,
1387
+ effect_num_inputs,
1388
+ effect_num_outputs,
1389
+ )
1390
+ else:
1391
+ if subpatcher:
1392
+ # Create the DSP rnbo~ object in 'p' subpatcher mode with DSP
1393
+ dsp_rnbo = add_rnbo_object_subpatcher(
1394
+ patcher,
1395
+ maxpat_path.rsplit(".", 1)[0] + "." + "rnbopat",
1396
+ dsp_name,
1397
+ dsp_codebox_code,
1398
+ dsp_items_info_list,
1399
+ midi,
1400
+ nvoices,
1401
+ test,
1402
+ dsp_num_inputs,
1403
+ dsp_num_outputs,
1404
+ )
1405
+ else:
1406
+ # Create the DSP rnbo~ object in flat mode with DSP
1407
+ dsp_rnbo = add_rnbo_object_flat(
1408
+ patcher,
1409
+ dsp_name,
1410
+ dsp_codebox_code,
1411
+ dsp_items_info_list,
1412
+ midi,
1413
+ nvoices,
1414
+ test,
1415
+ dsp_num_inputs,
1416
+ dsp_num_outputs,
1417
+ )
1418
+
1419
+ # Possibly add MIDI input/output control in the global patcher
1420
+ # and connect the DSP rnbo~ object to the midiin/midiout objects
1421
+ if midi:
1422
+ midi_in = patcher.add_textbox("midiin")
1423
+ midi_out = patcher.add_textbox("midiout")
1424
+ connect_midi_rnbo(patcher, dsp_rnbo, midi_in, midi_out)
1425
+
1426
+ # Add loadbang and 'compile C++ and export' machinery
1427
+ if compile:
1428
+ add_compile_test(patcher, dsp_rnbo, export_path, cpp_filename)
1429
+
1430
+ # Create the audio driver output
1431
+ create_audio_output(patcher, dsp_rnbo, dsp_num_outputs)
1432
+
1433
+ # Possibly create the audio driver input
1434
+ if dsp_num_inputs > 0:
1435
+ create_audio_input(patcher, dsp_rnbo, dsp_num_inputs)
1436
+
1437
+ # And finally save the patch
1438
+ patcher.save()
1439
+
1440
+
1441
+ def load_files_create_rnbo_patch(
1442
+ dsp_name: str,
1443
+ dsp_codebox_path: str,
1444
+ dsp_json_path: str,
1445
+ effect_codebox_path: Optional[str],
1446
+ effect_json_path: Optional[str],
1447
+ maxpat_path: str,
1448
+ export_path: str,
1449
+ cpp_filename: str,
1450
+ midi: bool,
1451
+ nvoices: int,
1452
+ compile: bool,
1453
+ test: bool,
1454
+ subpatcher: bool,
1455
+ ) -> None:
1456
+ """
1457
+ This function loads the codebox and JSON files, extracts relevant data in the JSON, and creates the RNBO Max patch.
1458
+
1459
+ Parameters:
1460
+ - dsp_name (str): The name of the DSP.
1461
+ - dsp_codebox_path (str): The path to the DSP codebox file.
1462
+ - dsp_json_path (str): The path to the DSP JSON file containing items info.
1463
+ - effect_codebox_path (Optional[str]): The path to the effect codebox file.
1464
+ - effect_json_path (Optional[str]): The path to the effect JSON file containing items info.
1465
+ - maxpat_path (str): The path where the Max patcher will be created.
1466
+ - export_path (str): The path for exporting the C++ code.
1467
+ - cpp_filename (str): The filename for the exported C++ code.
1468
+ - midi (bool): A flag indicating whether to include MIDI input/output control.
1469
+ - nvoices (int): The number of voices in polyphonic mode.
1470
+ - compile (bool): A flag indicating whether to include the C++ compilation and export machinery.
1471
+ - test (bool): A flag indicating whether the patch is for testing purposes (causing control parameter special naming).
1472
+ - subpatcher (bool): A flag indicating whether to save subpatchers as foo.rnbopat files.
1473
+
1474
+ Returns:
1475
+ None
1476
+ """
1477
+
1478
+ with open(dsp_codebox_path) as codebox_file:
1479
+ dsp_codebox_code = codebox_file.read()
1480
+
1481
+ with open(dsp_json_path, encoding="utf-8") as json_file:
1482
+ json_data = json.load(json_file)
1483
+ dsp_items_info_list = extract_items_info(json_data)
1484
+ # print(dsp_items_info_list)
1485
+ dsp_num_inputs = json_data.get("inputs", 0)
1486
+ dsp_num_outputs = json_data.get("outputs", 0)
1487
+ options = get_midi_and_nvoices(json_data)
1488
+
1489
+ if effect_codebox_path is not None and effect_json_path is not None:
1490
+ with open(effect_codebox_path) as codebox_file:
1491
+ effect_codebox_code = codebox_file.read()
1492
+
1493
+ with open(effect_json_path) as json_file:
1494
+ json_data = json.load(json_file)
1495
+ effect_items_info_list = extract_items_info(json_data)
1496
+ # print(effect_items_info_list)
1497
+ effect_num_inputs = json_data.get("inputs", 0)
1498
+ effect_num_outputs = json_data.get("outputs", 0)
1499
+
1500
+ create_rnbo_patch(
1501
+ dsp_name,
1502
+ maxpat_path,
1503
+ export_path,
1504
+ cpp_filename,
1505
+ dsp_codebox_code,
1506
+ dsp_items_info_list,
1507
+ dsp_num_inputs,
1508
+ dsp_num_outputs,
1509
+ # Take either the midi parameter or options[0] (= the midi state found in the JSON file)
1510
+ midi or options[0],
1511
+ # Take either the given nvoices, otherwise options[1](= the number of voices found in the JSON file) or -1
1512
+ nvoices if nvoices > 0 else options[1] if options[1] else -1,
1513
+ effect_codebox_code,
1514
+ effect_items_info_list,
1515
+ effect_num_inputs,
1516
+ effect_num_outputs,
1517
+ compile,
1518
+ test,
1519
+ subpatcher,
1520
+ )
1521
+ else:
1522
+ create_rnbo_patch(
1523
+ dsp_name,
1524
+ maxpat_path,
1525
+ export_path,
1526
+ cpp_filename,
1527
+ dsp_codebox_code,
1528
+ dsp_items_info_list,
1529
+ dsp_num_inputs,
1530
+ dsp_num_outputs,
1531
+ # Take either the midi parameter or options[0] (= the midi state found in the JSON file)
1532
+ midi or options[0],
1533
+ # Take either the given nvoices, otherwise options[1](= the number of voices found in the JSON file) or -1
1534
+ nvoices
1535
+ if nvoices is not None and nvoices > 0
1536
+ else options[1]
1537
+ if options[1]
1538
+ else -1,
1539
+ compile=compile,
1540
+ test=test,
1541
+ subpatcher=subpatcher,
1542
+ )
1543
+
1544
+
1545
+ # Main function to parse command-line arguments and run the script
1546
+ def main():
1547
+ parser = argparse.ArgumentParser()
1548
+ parser.add_argument("--dsp-name", type=str, help="DSP name")
1549
+ parser.add_argument("--dsp-codebox", type=str, help="DSP codebox file")
1550
+ parser.add_argument("--dsp-json", type=str, help="DSP JSON file")
1551
+ parser.add_argument("--effect-codebox", type=str, help="Effect codebox file")
1552
+ parser.add_argument("--effect-json", type=str, help="Effect JSON file")
1553
+ parser.add_argument("--maxpat", type=str, help="RNBO maxpat file")
1554
+ parser.add_argument("--cpp-export", type=str, help="C++ export folder path")
1555
+ parser.add_argument("--cpp-filename", type=str, help="C++ export filename")
1556
+ parser.add_argument("--midi", type=str, help="MIDI control")
1557
+ parser.add_argument("--nvoices", type=int, help="Set nvoices value")
1558
+ parser.add_argument("--compile", type=str, help="Whether to compile to C++ code")
1559
+ parser.add_argument(
1560
+ "--test",
1561
+ type=str,
1562
+ help="Whether to activate test mode with special labels",
1563
+ ),
1564
+ parser.add_argument(
1565
+ "--subpatcher",
1566
+ type=str,
1567
+ help="Whether to generate subpatchers as foo.rnbopat files",
1568
+ )
1569
+ args = parser.parse_args()
1570
+ # print(args)
1571
+
1572
+ load_files_create_rnbo_patch(
1573
+ args.dsp_name,
1574
+ args.dsp_codebox,
1575
+ args.dsp_json,
1576
+ args.effect_codebox,
1577
+ args.effect_json,
1578
+ args.maxpat,
1579
+ args.cpp_export,
1580
+ args.cpp_filename,
1581
+ args.midi == "True",
1582
+ args.nvoices,
1583
+ args.compile == "True",
1584
+ args.test == "True",
1585
+ args.subpatcher == "True",
1586
+ )
1587
+
1588
+
1589
+ # Parse command line
1590
+ if __name__ == "__main__":
1591
+ main()