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,1645 @@
1
+ //////////////////////////////////////////////////////////////////////////////////////////
2
+ // WARNING: Deprecated Library!!
3
+ // Read the README file in /libraries for more information
4
+ //////////////////////////////////////////////////////////////////////////////////////////
5
+
6
+ declare name "Faust Audio Effect Library";
7
+ declare author "Julius O. Smith (jos at ccrma.stanford.edu)";
8
+ declare copyright "Julius O. Smith III";
9
+ declare version "1.33";
10
+ declare license "STK-4.3"; // Synthesis Tool Kit 4.3 (MIT style license)
11
+ declare deprecated "This library is deprecated and is not maintained anymore. It will be removed in August 2017.";
12
+
13
+ import("filter.lib"); // dcblocker*, lowpass, filterbank, ...
14
+
15
+ // The following utilities (or equivalents) could go in music.lib:
16
+
17
+ //----------------------- midikey2hz,pianokey2hz ------------------------
18
+ midikey2hz(mk) = 440.0*pow(2.0, (mk-69.0)/12); // MIDI key 69 = A440
19
+ pianokey2hz(pk) = 440.0*pow(2.0, (pk-49.0)/12); // piano key 49 = A440
20
+ hz2pianokey(f) = 12*log2(f/440.0) + 49.0;
21
+ log2(x) = log(x)/log(2.0);
22
+
23
+ //---------------- cross2, bypass1, bypass2, select2stereo --------------
24
+ //
25
+ cross2 = _,_,_,_ <: _,!,_,!,!,_,!,_;
26
+
27
+ bypass1(bpc,e) = _ <: select2(bpc,(inswitch:e),_)
28
+ with {inswitch = select2(bpc,_,0);};
29
+
30
+ bypass2(bpc,e) = _,_ <: ((inswitch:e),_,_) : select2stereo(bpc) with {
31
+ inswitch = _,_ : (select2(bpc,_,0), select2(bpc,_,0)) : _,_;
32
+ };
33
+
34
+ select2stereo(bpc) = cross2 : select2(bpc), select2(bpc) : _,_;
35
+
36
+ //---------------------- levelfilter, levelfilterN ----------------------
37
+ // Dynamic level lowpass filter:
38
+ //
39
+ // USAGE: levelfilter(L,freq), where
40
+ // L = desired level (in dB) at Nyquist limit (SR/2), e.g., -60
41
+ // freq = corner frequency (-3dB point) usually set to fundamental freq
42
+ //
43
+ // REFERENCE:
44
+ // https://ccrma.stanford.edu/realsimple/faust_strings/Dynamic_Level_Lowpass_Filter.html
45
+ //
46
+ levelfilter(L,freq,x) = (L * L0 * x) + ((1.0-L) * lp2out(x))
47
+ with {
48
+ L0 = pow(L,1/3);
49
+ Lw = PI*freq/SR; // = w1 T / 2
50
+ Lgain = Lw / (1.0 + Lw);
51
+ Lpole2 = (1.0 - Lw) / (1.0 + Lw);
52
+ lp2out = *(Lgain) : + ~ *(Lpole2);
53
+ };
54
+
55
+ levelfilterN(N,freq,L) = seq(i,N,levelfilter((L/N),freq));
56
+
57
+ //------------------------- speakerbp -------------------------------
58
+ // Dirt-simple speaker simulator (overall bandpass eq with observed
59
+ // roll-offs above and below the passband).
60
+ //
61
+ // Low-frequency speaker model = +12 dB/octave slope breaking to
62
+ // flat near f1. Implemented using two dc blockers in series.
63
+ //
64
+ // High-frequency model = -24 dB/octave slope implemented using a
65
+ // fourth-order Butterworth lowpass.
66
+ //
67
+ // Example based on measured Celestion G12 (12" speaker):
68
+ // speakerbp(130,5000);
69
+ //
70
+ // Requires filter.lib
71
+ //
72
+ speakerbp(f1,f2) = dcblockerat(f1) : dcblockerat(f1) : lowpass(4,f2);
73
+
74
+
75
+ //--------------------- cubicnl(drive,offset) -----------------------
76
+ // Cubic nonlinearity distortion
77
+ //
78
+ // USAGE: cubicnl(drive,offset), where
79
+ // drive = distortion amount, between 0 and 1
80
+ // offset = constant added before nonlinearity to give even harmonics
81
+ // Note: offset can introduce a nonzero mean - feed
82
+ // cubicnl output to dcblocker to remove this.
83
+ //
84
+ // REFERENCES:
85
+ // https://ccrma.stanford.edu/~jos/pasp/Cubic_Soft_Clipper.html
86
+ // https://ccrma.stanford.edu/~jos/pasp/Nonlinear_Distortion.html
87
+ //
88
+ cubicnl(drive,offset) = *(pregain) : +(offset) : clip(-1,1) : cubic
89
+ with {
90
+ pregain = pow(10.0,2*drive);
91
+ clip(lo,hi) = min(hi) : max(lo);
92
+ cubic(x) = x - x*x*x/3;
93
+ postgain = max(1.0,1.0/pregain);
94
+ };
95
+
96
+ cubicnl_nodc(drive,offset) = cubicnl(drive,offset) : dcblocker;
97
+
98
+ //--------------------------- cubicnl_demo --------------------------
99
+ // USAGE: _ : cubicnl_demo : _;
100
+ //
101
+ cubicnl_demo = bypass1(bp,
102
+ cubicnl_nodc(drive:smooth(0.999),offset:smooth(0.999)))
103
+ with {
104
+ cnl_group(x) = vgroup("CUBIC NONLINEARITY cubicnl
105
+ [tooltip: Reference:
106
+ https://ccrma.stanford.edu/~jos/pasp/Cubic_Soft_Clipper.html]", x);
107
+ bp = cnl_group(checkbox("[0] Bypass
108
+ [tooltip: When this is checked, the nonlinearity has no effect]"));
109
+ drive = cnl_group(hslider("[1] Drive
110
+ [tooltip: Amount of distortion]",
111
+ 0, 0, 1, 0.01));
112
+ offset = cnl_group(hslider("[2] Offset
113
+ [tooltip: Brings in even harmonics]",
114
+ 0, 0, 1, 0.01));
115
+ };
116
+
117
+ //------------------------------- exciter -------------------------------
118
+ // Psychoacoustic harmonic exciter, with GUI
119
+ //
120
+ // USAGE: _ : exciter : _
121
+ // REFERENCES:
122
+ // https://secure.aes.org/forum/pubs/ebriefs/?elib=16939
123
+ // https://www.researchgate.net/publication/258333577_Modeling_the_Harmonic_Exciter
124
+
125
+ declare exciter_name "Harmonic Exciter";
126
+ declare exciter_author "Priyanka Shekar (pshekar@ccrma.stanford.edu)";
127
+ declare exciter_copyright "Copyright (c) 2013 Priyanka Shekar";
128
+ declare exciter_version "1.0";
129
+ declare exciter_license "MIT License (MIT)";
130
+
131
+ exciter = _ <: (highpass : compressor : pregain : harmonicCreator : postgain), _ : balance with {
132
+
133
+ compressor = bypass1(cbp,compressorMono) with {
134
+
135
+ comp_group(x) = vgroup("COMPRESSOR [tooltip: Reference: http://en.wikipedia.org/wiki/Dynamic_range_compression]", x);
136
+
137
+ meter_group(x) = comp_group(hgroup("[0]", x));
138
+ knob_group(x) = comp_group(hgroup("[1]", x));
139
+
140
+ cbp = meter_group(checkbox("[0] Bypass [tooltip: When this is checked, the compressor has no effect]"));
141
+
142
+ gainview = compression_gain_mono(ratio,threshold,attack,release) : linear2db : meter_group(hbargraph("[1] Compressor Gain [unit:dB] [tooltip: Current gain of the compressor in dB]",-50,+10));
143
+
144
+ displaygain = _ <: _,abs : _,gainview : attach;
145
+
146
+ compressorMono = displaygain(compressor_mono(ratio,threshold,attack,release));
147
+
148
+ ctl_group(x) = knob_group(hgroup("[3] Compression Control", x));
149
+
150
+ ratio = ctl_group(hslider("[0] Ratio [style:knob] [tooltip: A compression Ratio of N means that for each N dB increase in input signal level above Threshold, the output level goes up 1 dB]",
151
+ 5, 1, 20, 0.1));
152
+
153
+ threshold = ctl_group(hslider("[1] Threshold [unit:dB] [style:knob] [tooltip: When the signal level exceeds the Threshold (in dB), its level is compressed according to the Ratio]",
154
+ -30, -100, 10, 0.1));
155
+
156
+ env_group(x) = knob_group(hgroup("[4] Compression Response", x));
157
+
158
+ attack = env_group(hslider("[1] Attack [unit:ms] [style:knob] [tooltip: Time constant in ms (1/e smoothing time) for the compression gain to approach (exponentially) a new lower target level (the compression `kicking in')]",
159
+ 50, 0, 500, 0.1)) : *(0.001) : max(1/SR);
160
+
161
+ release = env_group(hslider("[2] Release [unit:ms] [style: knob] [tooltip: Time constant in ms (1/e smoothing time) for the compression gain to approach (exponentially) a new higher target level (the compression 'releasing')]",
162
+ 500, 0, 1000, 0.1)) : *(0.001) : max(1/SR);
163
+
164
+ };
165
+
166
+ //Exciter GUI controls
167
+ ex_group(x) = hgroup("EXCITER [tooltip: Reference: Patent US4150253 A]", x);
168
+
169
+ //Highpass - selectable cutoff frequency
170
+ fc = ex_group(hslider("[0] Cutoff Frequency [unit:Hz] [style:knob] [scale:log]
171
+ [tooltip: Cutoff frequency for highpassed components to be excited]",
172
+ 5000, 1000, 10000, 100));
173
+ highpass = component("filter.lib").highpass(2, fc);
174
+
175
+ //Pre-distortion gain - selectable percentage of harmonics
176
+ ph = ex_group(hslider("[1] Harmonics [unit:percent] [style:knob] [tooltip: Percentage of harmonics generated]", 20, 0, 200, 1)) / 100;
177
+ pregain = * (ph);
178
+
179
+ //Asymmetric cubic soft clipper
180
+ harmonicCreator(x) = x <: cubDist1, cubDist2, cubDist3 :> _;
181
+ cubDist1(x) = (x < 0) * x;
182
+ cubDist2(x) = (x >= 0) * (x <= 1) * (x - x ^ 3 / 3);
183
+ cubDist3(x) = (x > 1) * 2/3;
184
+
185
+ //Post-distortion gain - undoes effect of pre-gain
186
+ postgain = * (1/ph);
187
+
188
+ //Balance - selectable dry/wet mix
189
+ ml = ex_group(hslider("[2] Mix [style:knob] [tooltip: Dry/Wet mix of original signal to excited signal]", 0.50, 0.00, 1.00, 0.01));
190
+ balance = (_ * ml), (_ * (1.0 - ml)) :> _;
191
+
192
+ };
193
+
194
+ //------------------------- moog_vcf(res,fr) ---------------------------
195
+ // Moog "Voltage Controlled Filter" (VCF) in "analog" form
196
+ //
197
+ // USAGE: moog_vcf(res,fr), where
198
+ // fr = corner-resonance frequency in Hz ( less than SR/6.3 or so )
199
+ // res = Normalized amount of corner-resonance between 0 and 1
200
+ // (0 is no resonance, 1 is maximum)
201
+ //
202
+ // REQUIRES: filter.lib
203
+ //
204
+ // DESCRIPTION: Moog VCF implemented using the same logical block diagram
205
+ // as the classic analog circuit. As such, it neglects the one-sample
206
+ // delay associated with the feedback path around the four one-poles.
207
+ // This extra delay alters the response, especially at high frequencies
208
+ // (see reference [1] for details).
209
+ // See moog_vcf_2b below for a more accurate implementation.
210
+ //
211
+ // REFERENCES:
212
+ // [1] https://ccrma.stanford.edu/~stilti/papers/moogvcf.pdf
213
+ // [2] https://ccrma.stanford.edu/~jos/pasp/vegf.html
214
+ //
215
+ moog_vcf(res,fr) = (+ : seq(i,4,pole(p)) : *(unitygain(p))) ~ *(mk)
216
+ with {
217
+ p = 1.0 - fr * 2.0 * PI / SR; // good approximation for fr << SR
218
+ unitygain(p) = pow(1.0-p,4.0); // one-pole unity-gain scaling
219
+ mk = -4.0*max(0,min(res,0.999999)); // need mk > -4 for stability
220
+ };
221
+
222
+ //----------------------- moog_vcf_2b[n] ---------------------------
223
+ // Moog "Voltage Controlled Filter" (VCF) as two biquads
224
+ //
225
+ // USAGE:
226
+ // moog_vcf_2b(res,fr)
227
+ // moog_vcf_2bn(res,fr)
228
+ // where
229
+ // fr = corner-resonance frequency in Hz
230
+ // res = Normalized amount of corner-resonance between 0 and 1
231
+ // (0 is min resonance, 1 is maximum)
232
+ //
233
+ // DESCRIPTION: Implementation of the ideal Moog VCF transfer
234
+ // function factored into second-order sections. As a result, it is
235
+ // more accurate than moog_vcf above, but its coefficient formulas are
236
+ // more complex when one or both parameters are varied. Here, res
237
+ // is the fourth root of that in moog_vcf, so, as the sampling rate
238
+ // approaches infinity, moog_vcf(res,fr) becomes equivalent
239
+ // to moog_vcf_2b[n](res^4,fr) (when res and fr are constant).
240
+ //
241
+ // moog_vcf_2b uses two direct-form biquads (tf2)
242
+ // moog_vcf_2bn uses two protected normalized-ladder biquads (tf2np)
243
+ //
244
+ // REQUIRES: filter.lib
245
+ //
246
+ moog_vcf_2b(res,fr) = tf2s(0,0,b0,a11,a01,w1) : tf2s(0,0,b0,a12,a02,w1)
247
+ with {
248
+ s = 1; // minus the open-loop location of all four poles
249
+ frl = max(20,min(10000,fr)); // limit fr to reasonable 20-10k Hz range
250
+ w1 = 2*PI*frl; // frequency-scaling parameter for bilinear xform
251
+ // Equivalent: w1 = 1; s = 2*PI*frl;
252
+ kmax = sqrt(2)*0.999; // 0.999 gives stability margin (tf2 is unprotected)
253
+ k = min(kmax,sqrt(2)*res); // fourth root of Moog VCF feedback gain
254
+ b0 = s^2;
255
+ s2k = sqrt(2) * k;
256
+ a11 = s * (2 + s2k);
257
+ a12 = s * (2 - s2k);
258
+ a01 = b0 * (1 + s2k + k^2);
259
+ a02 = b0 * (1 - s2k + k^2);
260
+ };
261
+
262
+ moog_vcf_2bn(res,fr) = tf2snp(0,0,b0,a11,a01,w1) : tf2snp(0,0,b0,a12,a02,w1)
263
+ with {
264
+ s = 1; // minus the open-loop location of all four poles
265
+ w1 = 2*PI*max(fr,20); // frequency-scaling parameter for bilinear xform
266
+ k = sqrt(2)*0.999*res; // fourth root of Moog VCF feedback gain
267
+ b0 = s^2;
268
+ s2k = sqrt(2) * k;
269
+ a11 = s * (2 + s2k);
270
+ a12 = s * (2 - s2k);
271
+ a01 = b0 * (1 + s2k + k^2);
272
+ a02 = b0 * (1 - s2k + k^2);
273
+ };
274
+
275
+ //------------------------- moog_vcf_demo ---------------------------
276
+ // Illustrate and compare all three Moog VCF implementations above
277
+ // (called by <faust>/examples/vcf_wah_pedals.dsp).
278
+ //
279
+ // USAGE: _ : moog_vcf_demo : _;
280
+
281
+ moog_vcf_demo = bypass1(bp,vcf) with {
282
+ mvcf_group(x) = hgroup("MOOG VCF (Voltage Controlled Filter)
283
+ [tooltip: See Faust's effect.lib for info and references]",x);
284
+ cb_group(x) = mvcf_group(hgroup("[0]",x));
285
+
286
+ bp = cb_group(checkbox("[0] Bypass [tooltip: When this is checked, the Moog VCF has no effect]"));
287
+ archsw = cb_group(checkbox("[1] Use Biquads
288
+ [tooltip: Select moog_vcf_2b (two-biquad) implementation, instead of the default moog_vcf (analog style) implementation]"));
289
+ bqsw = cb_group(checkbox("[2] Normalized Ladders
290
+ [tooltip: If using biquads, make them normalized ladders (moog_vcf_2bn)]"));
291
+
292
+ freq = mvcf_group(hslider("[1] Corner Frequency [unit:PK]
293
+ [tooltip: The VCF resonates at the corner frequency (specified in PianoKey (PK) units, with A440 = 49 PK). The VCF response is flat below the corner frequency, and rolls off -24 dB per octave above.]",
294
+ 25, 1, 88, 0.01) : pianokey2hz) : smooth(0.999);
295
+
296
+ res = mvcf_group(hslider("[2] Corner Resonance [style:knob]
297
+ [tooltip: Amount of resonance near VCF corner frequency (specified between 0 and 1)]",
298
+ 0.9, 0, 1, 0.01));
299
+
300
+ outgain = mvcf_group(hslider("[3] VCF Output Level [unit:dB] [style:knob]
301
+ [tooltip: output level in decibels]",
302
+ 5, -60, 20, 0.1)) : component("music.lib").db2linear : smooth(0.999);
303
+
304
+ vcfbq = _ <: select2(bqsw, moog_vcf_2b(res,freq), moog_vcf_2bn(res,freq));
305
+ vcfarch = _ <: select2(archsw, moog_vcf(res^4,freq), vcfbq);
306
+ vcf = vcfarch : *(outgain);
307
+ };
308
+
309
+ //-------------------------- wah4(fr) -------------------------------
310
+ // Wah effect, 4th order
311
+ // USAGE: wah4(fr), where fr = resonance frequency in Hz
312
+ // REFERENCE "https://ccrma.stanford.edu/~jos/pasp/vegf.html";
313
+ //
314
+ wah4(fr) = 4*moog_vcf((3.2/4),fr:smooth(0.999));
315
+
316
+ //------------------------- wah4_demo ---------------------------
317
+ // USAGE: _ : wah4_demo : _;
318
+
319
+ wah4_demo = bypass1(bp, wah4(fr)) with {
320
+ wah4_group(x) = hgroup("WAH4
321
+ [tooltip: Fourth-order wah effect made using moog_vcf]", x);
322
+ bp = wah4_group(checkbox("[0] Bypass
323
+ [tooltip: When this is checked, the wah pedal has no effect]"));
324
+ fr = wah4_group(hslider("[1] Resonance Frequency [scale:log]
325
+ [tooltip: wah resonance frequency in Hz]",
326
+ 200,100,2000,1));
327
+ // Avoid dc with the moog_vcf (amplitude too high when freq comes up from dc)
328
+ // Also, avoid very high resonance frequencies (e.g., 5kHz or above).
329
+ };
330
+
331
+ //------------------------ autowah(level) -----------------------------
332
+ // Auto-wah effect
333
+ // USAGE: _ : autowah(level) : _;
334
+ // where level = amount of effect desired (0 to 1).
335
+ //
336
+ autowah(level,x) = level * crybaby(amp_follower(0.1,x),x) + (1.0-level)*x;
337
+
338
+ //-------------------------- crybaby(wah) -----------------------------
339
+ // Digitized CryBaby wah pedal
340
+ // USAGE: _ : crybaby(wah) : _;
341
+ // where wah = "pedal angle" from 0 to 1.
342
+ // REFERENCE: https://ccrma.stanford.edu/~jos/pasp/vegf.html
343
+ //
344
+ crybaby(wah) = *(gs) : tf2(1,-1,0,a1s,a2s)
345
+ with {
346
+ Q = pow(2.0,(2.0*(1.0-wah)+1.0)); // Resonance "quality factor"
347
+ fr = 450.0*pow(2.0,2.3*wah); // Resonance tuning
348
+ g = 0.1*pow(4.0,wah); // gain (optional)
349
+
350
+ // Biquad fit using z = exp(s T) ~ 1 + sT for low frequencies:
351
+ frn = fr/SR; // Normalized pole frequency (cycles per sample)
352
+ R = 1 - PI*frn/Q; // pole radius
353
+ theta = 2*PI*frn; // pole angle
354
+ a1 = 0-2.0*R*cos(theta); // biquad coeff
355
+ a2 = R*R; // biquad coeff
356
+
357
+ // dezippering of slider-driven signals:
358
+ s = 0.999; // smoothing parameter (one-pole pole location)
359
+ a1s = a1 : smooth(s);
360
+ a2s = a2 : smooth(s);
361
+ gs = g : smooth(s);
362
+
363
+ tf2 = component("filter.lib").tf2;
364
+ };
365
+
366
+ //------------------------- crybaby_demo ---------------------------
367
+ // USAGE: _ : crybaby_demo : _ ;
368
+
369
+ crybaby_demo = bypass1(bp, crybaby(wah)) with {
370
+ crybaby_group(x) = hgroup("CRYBABY [tooltip: Reference: https://ccrma.stanford.edu/~jos/pasp/vegf.html]", x);
371
+ bp = crybaby_group(checkbox("[0] Bypass [tooltip: When this is checked, the wah pedal has no effect]"));
372
+ wah = crybaby_group(hslider("[1] Wah parameter [tooltip: wah pedal angle between 0 (rocked back) and 1 (rocked forward)]",0.8,0,1,0.01));
373
+ };
374
+
375
+ //------------ apnl(a1,a2) ---------------
376
+ // Passive Nonlinear Allpass:
377
+ // switch between allpass coefficient a1 and a2 at signal zero crossings
378
+ // REFERENCE:
379
+ // "A Passive Nonlinear Digital Filter Design ..."
380
+ // by John R. Pierce and Scott A. Van Duyne,
381
+ // JASA, vol. 101, no. 2, pp. 1120-1126, 1997
382
+ // Written by Romain Michon and JOS based on Pierce switching springs idea:
383
+ apnl(a1,a2,x) = nonLinFilter
384
+ with{
385
+ condition = _>0;
386
+ nonLinFilter = (x - _ <: _*(condition*a1 + (1-condition)*a2),_')~_ :> +;
387
+ };
388
+
389
+ //------------ piano_dispersion_filter(M,B,f0) ---------------
390
+ // Piano dispersion allpass filter in closed form
391
+ //
392
+ // ARGUMENTS:
393
+ // M = number of first-order allpass sections (compile-time only)
394
+ // Keep below 20. 8 is typical for medium-sized piano strings.
395
+ // B = string inharmonicity coefficient (0.0001 is typical)
396
+ // f0 = fundamental frequency in Hz
397
+ //
398
+ // INPUT:
399
+ // Signal to be filtered by the allpass chain
400
+ //
401
+ // OUTPUTS:
402
+ // 1. MINUS the estimated delay at f0 of allpass chain in samples,
403
+ // provided in negative form to facilitate subtraction
404
+ // from delay-line length (see USAGE below).
405
+ // 2. Output signal from allpass chain
406
+ //
407
+ // USAGE:
408
+ // piano_dispersion_filter(1,B,f0) : +(totalDelay),_ : fdelay(maxDelay)
409
+ //
410
+ // REFERENCE:
411
+ // "Dispersion Modeling in Waveguide Piano Synthesis
412
+ // Using Tunable Allpass Filters",
413
+ // by Jukka Rauhala and Vesa Valimaki, DAFX-2006, pp. 71-76
414
+ // URL: http://www.dafx.ca/proceedings/papers/p_071.pdf
415
+ // NOTE: An erratum in Eq. (7) is corrected in Dr. Rauhala's
416
+ // encompassing dissertation (and below).
417
+ // See also: http://www.acoustics.hut.fi/research/asp/piano/
418
+ //
419
+ piano_dispersion_filter(M,B,f0) = -Df0*M,seq(i,M,tf1(a1,1,a1))
420
+ with {
421
+ a1 = (1-D)/(1+D); // By Eq. 3, have D >= 0, hence a1 >= 0 also
422
+ D = exp(Cd - Ikey(f0)*kd);
423
+ trt = pow(2.0,1.0/12.0); // 12th root of 2
424
+ logb(b,x) = log(x) / log(b); // log-base-b of x
425
+ Ikey(f0) = logb(trt,f0*trt/27.5);
426
+ Bc = max(B,0.000001);
427
+ kd = exp(k1*log(Bc)*log(Bc) + k2*log(Bc)+k3);
428
+ Cd = exp((m1*log(M)+m2)*log(Bc)+m3*log(M)+m4);
429
+ k1 = -0.00179;
430
+ k2 = -0.0233;
431
+ k3 = -2.93;
432
+ m1 = 0.0126;
433
+ m2 = 0.0606;
434
+ m3 = -0.00825;
435
+ m4 = 1.97;
436
+ wT = 2*PI*f0/SR;
437
+ polydel(a) = atan(sin(wT)/(a+cos(wT)))/wT;
438
+ Df0 = polydel(a1) - polydel(1.0/a1);
439
+ };
440
+
441
+ //===================== Phasing and Flanging Effects ====================
442
+
443
+ //--------------- flanger_mono, flanger_stereo, flanger_demo -------------
444
+ // Flanging effect
445
+ //
446
+ // USAGE:
447
+ // _ : flanger_mono(dmax,curdel,depth,fb,invert) : _;
448
+ // _,_ : flanger_stereo(dmax,curdel1,curdel2,depth,fb,invert) : _,_;
449
+ // _,_ : flanger_demo : _,_;
450
+ //
451
+ // ARGUMENTS:
452
+ // dmax = maximum delay-line length (power of 2) - 10 ms typical
453
+ // curdel = current dynamic delay (not to exceed dmax)
454
+ // depth = effect strength between 0 and 1 (1 typical)
455
+ // fb = feedback gain between 0 and 1 (0 typical)
456
+ // invert = 0 for normal, 1 to invert sign of flanging sum
457
+ //
458
+ // REFERENCE:
459
+ // https://ccrma.stanford.edu/~jos/pasp/Flanging.html
460
+ //
461
+ flanger_mono(dmax,curdel,depth,fb,invert)
462
+ = _ <: _, (-:fdelay(dmax,curdel)) ~ *(fb) : _,
463
+ *(select2(invert,depth,0-depth))
464
+ : + : *(0.5);
465
+
466
+ flanger_stereo(dmax,curdel1,curdel2,depth,fb,invert)
467
+ = flanger_mono(dmax,curdel1,depth,fb,invert),
468
+ flanger_mono(dmax,curdel2,depth,fb,invert);
469
+
470
+ //------------------------- flanger_demo ---------------------------
471
+ // USAGE: _,_ : flanger_demo : _,_;
472
+ //
473
+ flanger_demo = bypass2(fbp,flanger_stereo_demo) with {
474
+ flanger_group(x) =
475
+ vgroup("FLANGER [tooltip: Reference: https://ccrma.stanford.edu/~jos/pasp/Flanging.html]", x);
476
+ meter_group(x) = flanger_group(hgroup("[0]", x));
477
+ ctl_group(x) = flanger_group(hgroup("[1]", x));
478
+ del_group(x) = flanger_group(hgroup("[2] Delay Controls", x));
479
+ lvl_group(x) = flanger_group(hgroup("[3]", x));
480
+
481
+ fbp = meter_group(checkbox(
482
+ "[0] Bypass [tooltip: When this is checked, the flanger has no effect]"));
483
+ invert = meter_group(checkbox("[1] Invert Flange Sum"));
484
+
485
+ // FIXME: This should be an amplitude-response display:
486
+ flangeview = lfor(freq) + lfol(freq) : meter_group(hbargraph(
487
+ "[2] Flange LFO [style: led] [tooltip: Display sum of flange delays]", -1.5,+1.5));
488
+
489
+ flanger_stereo_demo(x,y) = attach(x,flangeview),y :
490
+ *(level),*(level) : flanger_stereo(dmax,curdel1,curdel2,depth,fb,invert);
491
+
492
+ lfol = component("oscillator.lib").oscrs; // sine for left channel
493
+ lfor = component("oscillator.lib").oscrc; // cosine for right channel
494
+ dmax = 2048;
495
+ dflange = 0.001 * SR *
496
+ del_group(hslider("[1] Flange Delay [unit:ms] [style:knob]", 10, 0, 20, 0.001));
497
+ odflange = 0.001 * SR *
498
+ del_group(hslider("[2] Delay Offset [unit:ms] [style:knob]", 1, 0, 20, 0.001));
499
+ freq = ctl_group(hslider("[1] Speed [unit:Hz] [style:knob]", 0.5, 0, 10, 0.01));
500
+ depth = ctl_group(hslider("[2] Depth [style:knob]", 1, 0, 1, 0.001));
501
+ fb = ctl_group(hslider("[3] Feedback [style:knob]", 0, -0.999, 0.999, 0.001));
502
+ level = lvl_group(hslider("Flanger Output Level [unit:dB]", 0, -60, 10, 0.1)) : db2linear;
503
+ curdel1 = odflange+dflange*(1 + lfol(freq))/2;
504
+ curdel2 = odflange+dflange*(1 + lfor(freq))/2;
505
+ };
506
+
507
+ //------- phaser2_mono, phaser2_stereo, phaser2_demo -------
508
+ // Phasing effect
509
+ //
510
+ // USAGE:
511
+ // _ : phaser2_mono(Notches,phase,width,frqmin,fratio,frqmax,speed,depth,fb,invert) : _;
512
+ // _,_ : phaser2_stereo(") : _,_;
513
+ // _,_ : phaser2_demo : _,_;
514
+ //
515
+ // ARGUMENTS:
516
+ // Notches = number of spectral notches (MACRO ARGUMENT - not a signal)
517
+ // phase = phase of the oscillator (0-1)
518
+ // width = approximate width of spectral notches in Hz
519
+ // frqmin = approximate minimum frequency of first spectral notch in Hz
520
+ // fratio = ratio of adjacent notch frequencies
521
+ // frqmax = approximate maximum frequency of first spectral notch in Hz
522
+ // speed = LFO frequency in Hz (rate of periodic notch sweep cycles)
523
+ // depth = effect strength between 0 and 1 (1 typical) (aka "intensity")
524
+ // when depth=2, "vibrato mode" is obtained (pure allpass chain)
525
+ // fb = feedback gain between -1 and 1 (0 typical)
526
+ // invert = 0 for normal, 1 to invert sign of flanging sum
527
+ //
528
+ // REFERENCES:
529
+ // https://ccrma.stanford.edu/~jos/pasp/Phasing.html
530
+ // http://www.geofex.com/Article_Folders/phasers/phase.html
531
+ // 'An Allpass Approach to Digital Phasing and Flanging', Julius O. Smith III,
532
+ // Proc. Int. Computer Music Conf. (ICMC-84), pp. 103-109, Paris, 1984.
533
+ // CCRMA Tech. Report STAN-M-21: https://ccrma.stanford.edu/STANM/stanms/stanm21/
534
+
535
+ vibrato2_mono(sections,phase01,fb,width,frqmin,fratio,frqmax,speed) =
536
+ (+ : seq(i,sections,ap2p(R,th(i)))) ~ *(fb)
537
+ with {
538
+ tf2 = component("filter.lib").tf2;
539
+ // second-order resonant digital allpass given pole radius and angle:
540
+ ap2p(R,th) = tf2(a2,a1,1,a1,a2) with {
541
+ a2 = R^2;
542
+ a1 = -2*R*cos(th);
543
+ };
544
+ SR = component("music.lib").SR;
545
+ R = exp(-pi*width/SR);
546
+ cososc = component("oscillator.lib").oscrc;
547
+ sinosc = component("oscillator.lib").oscrs;
548
+ osc = cososc(speed) * phase01 + sinosc(speed) * (1-phase01);
549
+ lfo = (1-osc)/2; // in [0,1]
550
+ pi = 4*atan(1);
551
+ thmin = 2*pi*frqmin/SR;
552
+ thmax = 2*pi*frqmax/SR;
553
+ th1 = thmin + (thmax-thmin)*lfo;
554
+ th(i) = (fratio^(i+1))*th1;
555
+ };
556
+
557
+ phaser2_mono(Notches,phase01,width,frqmin,fratio,frqmax,speed,depth,fb,invert) =
558
+ _ <: *(g1) + g2mi*vibrato2_mono(Notches,phase01,fb,width,frqmin,fratio,frqmax,speed)
559
+ with { // depth=0 => direct-signal only
560
+ g1 = 1-depth/2; // depth=1 => phaser mode (equal sum of direct and allpass-chain)
561
+ g2 = depth/2; // depth=2 => vibrato mode (allpass-chain signal only)
562
+ g2mi = select2(invert,g2,-g2); // inversion negates the allpass-chain signal
563
+ };
564
+
565
+ phaser2_stereo(Notches,width,frqmin,fratio,frqmax,speed,depth,fb,invert)
566
+ = phaser2_mono(Notches,0,width,frqmin,fratio,frqmax,speed,depth,fb,invert),
567
+ phaser2_mono(Notches,1,width,frqmin,fratio,frqmax,speed,depth,fb,invert);
568
+
569
+ //------------------------- phaser2_demo ---------------------------
570
+ // USAGE: _,_ : phaser2_demo : _,_;
571
+ //
572
+ phaser2_demo = bypass2(pbp,phaser2_stereo_demo) with {
573
+ phaser2_group(x) =
574
+ vgroup("PHASER2 [tooltip: Reference: https://ccrma.stanford.edu/~jos/pasp/Flanging.html]", x);
575
+ meter_group(x) = phaser2_group(hgroup("[0]", x));
576
+ ctl_group(x) = phaser2_group(hgroup("[1]", x));
577
+ nch_group(x) = phaser2_group(hgroup("[2]", x));
578
+ lvl_group(x) = phaser2_group(hgroup("[3]", x));
579
+
580
+ pbp = meter_group(checkbox(
581
+ "[0] Bypass [tooltip: When this is checked, the phaser has no effect]"));
582
+ invert = meter_group(checkbox("[1] Invert Internal Phaser Sum"));
583
+ vibr = meter_group(checkbox("[2] Vibrato Mode")); // In this mode you can hear any "Doppler"
584
+
585
+ // FIXME: This should be an amplitude-response display:
586
+ //flangeview = phaser2_amp_resp : meter_group(hspectrumview("[2] Phaser Amplitude Response", 0,1));
587
+ //phaser2_stereo_demo(x,y) = attach(x,flangeview),y : ...
588
+
589
+ phaser2_stereo_demo = *(level),*(level) :
590
+ phaser2_stereo(Notches,width,frqmin,fratio,frqmax,speed,mdepth,fb,invert);
591
+
592
+ Notches = 4; // Compile-time parameter: 2 is typical for analog phaser stomp-boxes
593
+
594
+ // FIXME: Add tooltips
595
+ speed = ctl_group(hslider("[1] Speed [unit:Hz] [style:knob]", 0.5, 0, 10, 0.001));
596
+ depth = ctl_group(hslider("[2] Notch Depth (Intensity) [style:knob]", 1, 0, 1, 0.001));
597
+ fb = ctl_group(hslider("[3] Feedback Gain [style:knob]", 0, -0.999, 0.999, 0.001));
598
+
599
+ width = nch_group(hslider("[1] Notch width [unit:Hz] [style:knob] [scale:log]", 1000, 10, 5000, 1));
600
+ frqmin = nch_group(hslider("[2] Min Notch1 Freq [unit:Hz] [style:knob] [scale:log]", 100, 20, 5000, 1));
601
+ frqmax = nch_group(hslider("[3] Max Notch1 Freq [unit:Hz] [style:knob] [scale:log]", 800, 20, 10000, 1)) : max(frqmin);
602
+ fratio = nch_group(hslider("[4] Notch Freq Ratio: NotchFreq(n+1)/NotchFreq(n) [style:knob]", 1.5, 1.1, 4, 0.001));
603
+
604
+ level = lvl_group(hslider("Phaser Output Level [unit:dB]", 0, -60, 10, 0.1)) : component("music.lib").db2linear;
605
+
606
+ mdepth = select2(vibr,depth,2); // Improve "ease of use"
607
+ };
608
+
609
+ //---------------------------- vocoder -------------------------
610
+ // A very simple vocoder where the spectrum of the modulation signal
611
+ // is analyzed using a filter bank.
612
+ //
613
+ // USAGE:
614
+ // vocoder(nBands,att,rel,BWRatio,source,excitation) : _;
615
+ //
616
+ // where
617
+ // nBands = Number of vocoder bands
618
+ // att = Attack time in seconds
619
+ // rel = Release time in seconds
620
+ // BWRatio = Coefficient to adjust the bandwidth of each band (0.1 - 2)
621
+ // source = Modulation signal
622
+ // excitation = Excitation/Carrier signal
623
+
624
+ oneVocoderBand(band,bandsNumb,bwRatio,bandGain,x) = x : resonbp(bandFreq,bandQ,bandGain) with{
625
+ bandFreq = 25*pow(2,(band+1)*(9/bandsNumb));
626
+ BW = (bandFreq - 25*pow(2,(band)*(9/bandsNumb)))*bwRatio;
627
+ bandQ = bandFreq/BW;
628
+ };
629
+
630
+ vocoder(nBands,att,rel,BWRatio,source,excitation) = source <: par(i,nBands,oneVocoderBand(i,nBands,BWRatio,1) : amp_follower_ar(att,rel) : _,excitation : oneVocoderBand(i,nBands,BWRatio)) :> _ ;
631
+
632
+ //---------------------------- vocoder_demo -------------------------
633
+ // Use example of the vocoder function where an impulse train is used
634
+ // as excitation.
635
+ // USAGE:
636
+ // _ : vocoder_demo : _;
637
+
638
+ vocoder_demo = hgroup("My Vocoder",_,impTrain(freq)*gain : vocoder(bands,att,rel,BWRatio) <: _,_) with{
639
+ bands = 32;
640
+ impTrain = component("oscillator.lib").lf_imptrain;
641
+ vocoderGroup(x) = vgroup("Vocoder",x);
642
+ att = vocoderGroup(hslider("[0] Attack [style:knob] [tooltip: Attack time in seconds]",5,0.1,100,0.1)*0.001);
643
+ rel = vocoderGroup(hslider("[1] Release [style:knob] [tooltip: Release time in seconds]",5,0.1,100,0.1)*0.001);
644
+ BWRatio = vocoderGroup(hslider("[2] BW [style:knob] [tooltip: Coefficient to adjust the bandwidth of each band]",0.5,0.1,2,0.001));
645
+ excitGroup(x) = vgroup("Excitation",x);
646
+ freq = excitGroup(hslider("[0] Freq [style:knob]",330,50,2000,0.1));
647
+ gain = excitGroup(vslider("[1] Gain",0.5,0,1,0.01) : smooth(0.999));
648
+ };
649
+
650
+ //------------------------- stereo_width(w) ---------------------------
651
+ // Stereo Width effect using the Blumlein Shuffler technique.
652
+ //
653
+ // USAGE: "_,_ : stereo_width(w) : _,_", where
654
+ // w = stereo width between 0 and 1
655
+ //
656
+ // At w=0, the output signal is mono ((left+right)/2 in both channels).
657
+ // At w=1, there is no effect (original stereo image).
658
+ // Thus, w between 0 and 1 varies stereo width from 0 to "original".
659
+ //
660
+ // REFERENCE:
661
+ // "Applications of Blumlein Shuffling to Stereo Microphone Techniques"
662
+ // Michael A. Gerzon, JAES vol. 42, no. 6, June 1994
663
+ //
664
+ stereo_width(w) = shuffle : *(mgain),*(sgain) : shuffle
665
+ with {
666
+ shuffle = _,_ <: +,-; // normally scaled by 1/sqrt(2) for orthonormality,
667
+ mgain = 1-w/2; // but we pick up the needed normalization here.
668
+ sgain = w/2;
669
+ };
670
+
671
+ //--------------------------- amp_follower ---------------------------
672
+ // Classic analog audio envelope follower with infinitely fast rise and
673
+ // exponential decay. The amplitude envelope instantaneously follows
674
+ // the absolute value going up, but then floats down exponentially.
675
+ //
676
+ // USAGE:
677
+ // _ : amp_follower(rel) : _
678
+ //
679
+ // where
680
+ // rel = release time = amplitude-envelope time-constant (sec) going down
681
+ //
682
+ // REFERENCES:
683
+ // Musical Engineer's Handbook, Bernie Hutchins, Ithaca NY, 1975
684
+ // Electronotes Newsletter, Bernie Hutchins
685
+
686
+ amp_follower(rel) = abs : env with {
687
+ p = tau2pole(rel);
688
+ env(x) = x * (1.0 - p) : (+ : max(x,_)) ~ *(p);
689
+ };
690
+
691
+ //--------------------------- amp_follower_ud ---------------------------
692
+ // Envelope follower with different up and down time-constants
693
+ // (also called a "peak detector").
694
+ //
695
+ // USAGE:
696
+ // _ : amp_follower_ud(att,rel) : _
697
+ //
698
+ // where
699
+ // att = attack time = amplitude-envelope time constant (sec) going up
700
+ // rel = release time = amplitude-envelope time constant (sec) going down
701
+ //
702
+ // NOTE: We assume rel >> att. Otherwise, consider rel ~ max(rel,att).
703
+ // For audio, att is normally faster (smaller) than rel (e.g., 0.001 and 0.01).
704
+ // Use
705
+ //
706
+ // _ : amp_follower_ar(att,rel) : _
707
+ //
708
+ // below to remove this restriction.
709
+ //
710
+ // REFERENCE:
711
+ // "Digital Dynamic Range Compressor Design --- A Tutorial and Analysis", by
712
+ // Dimitrios Giannoulis, Michael Massberg, and Joshua D. Reiss
713
+ // http://www.eecs.qmul.ac.uk/~josh/documents/GiannoulisMassbergReiss-dynamicrangecompression-JAES2012.pdf
714
+
715
+ amp_follower_ud(att,rel) = amp_follower(rel) : smooth(tau2pole(att));
716
+
717
+ // Begin contributions by Jonatan Liljedahl at http://kymatica.com
718
+ // (in addition to his refinement of amp_follower above)
719
+
720
+ /*****************************************************
721
+ _ : amp_follower_ar(att,rel) : _;
722
+
723
+ Envelope follower with independent attack and release times. The
724
+ release can be shorter than the attack (unlike in amp_follower_ud
725
+ above).
726
+
727
+ *****************************************************/
728
+
729
+ amp_follower_ar(att,rel) = abs : lag_ud(att,rel);
730
+
731
+ /*****************************************************
732
+ _ : lag_ud(up, dn, signal) : _;
733
+
734
+ Lag filter with separate times for up and down.
735
+ *****************************************************/
736
+
737
+ lag_ud(up,dn) = _ <: ((>,tau2pole(up),tau2pole(dn):select2),_:smooth) ~ _;
738
+
739
+ /*****************************************************
740
+ _ : peakhold(mode,sig) : _;
741
+
742
+ Outputs current max value above zero.
743
+ 'mode' means:
744
+ 0 - Pass through. A single sample 0 trigger will work as a reset.
745
+ 1 - Track and hold max value.
746
+ *****************************************************/
747
+
748
+ peakhold = (*,_:max) ~ _;
749
+
750
+ /*****************************************************
751
+ sweep(period,run);
752
+
753
+ Counts from 0 to 'period' samples repeatedly, while 'run' is 1.
754
+ Outsputs zero while 'run' is 0.
755
+ *****************************************************/
756
+
757
+ sweep = %(int(*:max(1)))~+(1);
758
+
759
+ /*****************************************************
760
+ peakholder(holdtime, sig);
761
+
762
+ Tracks abs peak and holds peak for 'holdtime' samples.
763
+ *****************************************************/
764
+
765
+ peakholder(holdtime) = peakhold2 ~ reset : (!,_) with {
766
+ reset = sweep(holdtime) > 0;
767
+ // first out is gate that is 1 while holding last peak
768
+ peakhold2 = _,abs <: peakhold,!,_ <: >=,_,!;
769
+ };
770
+
771
+ // End of contributions (so far) by Jonatan Liljedahl at http://kymatica.com
772
+
773
+ //=============== Gates, Limiters, and Dynamic Range Compression ============
774
+
775
+ //----------------- gate_mono, gate_stereo -------------------
776
+ // Mono and stereo signal gates
777
+ //
778
+ // USAGE:
779
+ // _ : gate_mono(thresh,att,hold,rel) : _
780
+ // or
781
+ // _,_ : gate_stereo(thresh,att,hold,rel) : _,_
782
+ //
783
+ // where
784
+ // thresh = dB level threshold above which gate opens (e.g., -60 dB)
785
+ // att = attack time = time constant (sec) for gate to open (e.g., 0.0001 s = 0.1 ms)
786
+ // hold = hold time = time (sec) gate stays open after signal level < thresh (e.g., 0.1 s)
787
+ // rel = release time = time constant (sec) for gate to close (e.g., 0.020 s = 20 ms)
788
+ //
789
+ // REFERENCES:
790
+ // - http://en.wikipedia.org/wiki/Noise_gate
791
+ // - http://www.soundonsound.com/sos/apr01/articles/advanced.asp
792
+ // - http://en.wikipedia.org/wiki/Gating_(sound_engineering)
793
+
794
+ gate_mono(thresh,att,hold,rel,x) = x * gate_gain_mono(thresh,att,hold,rel,x);
795
+
796
+ gate_stereo(thresh,att,hold,rel,x,y) = ggm*x, ggm*y with {
797
+ ggm = gate_gain_mono(thresh,att,hold,rel,abs(x)+abs(y));
798
+ };
799
+
800
+ gate_gain_mono(thresh,att,hold,rel,x) = x : extendedrawgate : amp_follower_ar(att,rel) with {
801
+ extendedrawgate(x) = max(float(rawgatesig(x)),holdsig(x));
802
+ rawgatesig(x) = inlevel(x) > db2linear(thresh);
803
+ minrate = min(att,rel);
804
+ inlevel = amp_follower_ar(minrate,minrate);
805
+ holdcounter(x) = (max(holdreset(x) * holdsamps,_) ~-(1));
806
+ holdsig(x) = holdcounter(x) > 0;
807
+ holdreset(x) = rawgatesig(x) < rawgatesig(x)'; // reset hold when raw gate falls
808
+ holdsamps = int(hold*SR);
809
+ };
810
+
811
+ //-------------------- compressor_mono, compressor_stereo ----------------------
812
+ // Mono and stereo dynamic range compressors
813
+ //
814
+ // USAGE:
815
+ // _ : compressor_mono(ratio,thresh,att,rel) : _
816
+ // or
817
+ // _,_ : compressor_stereo(ratio,thresh,att,rel) : _,_
818
+ //
819
+ // where
820
+ // ratio = compression ratio (1 = no compression, >1 means compression)
821
+ // thresh = dB level threshold above which compression kicks in (0 dB = max level)
822
+ // att = attack time = time constant (sec) when level & compression going up
823
+ // rel = release time = time constant (sec) coming out of compression
824
+ //
825
+ // REFERENCES:
826
+ // - http://en.wikipedia.org/wiki/Dynamic_range_compression
827
+ // - https://ccrma.stanford.edu/~jos/filters/Nonlinear_Filter_Example_Dynamic.html
828
+ // - Albert Graef's <faust2pd>/examples/synth/compressor_.dsp
829
+ // - More features: https://github.com/magnetophon/faustCompressors
830
+
831
+ compressor_mono(ratio,thresh,att,rel,x) = x * compression_gain_mono(ratio,thresh,att,rel,x);
832
+
833
+ compressor_stereo(ratio,thresh,att,rel,x,y) = cgm*x, cgm*y with {
834
+ cgm = compression_gain_mono(ratio,thresh,att,rel,abs(x)+abs(y));
835
+ };
836
+
837
+ compression_gain_mono(ratio,thresh,att,rel) =
838
+ amp_follower_ar(att,rel) : linear2db : outminusindb(ratio,thresh) :
839
+ kneesmooth(att) : db2linear
840
+ with {
841
+ // kneesmooth(att) installs a "knee" in the dynamic-range compression,
842
+ // where knee smoothness is set equal to half that of the compression-attack.
843
+ // A general 'knee' parameter could be used instead of tying it to att/2:
844
+ kneesmooth(att) = smooth(tau2pole(att/2.0));
845
+ // compression gain in dB:
846
+ outminusindb(ratio,thresh,level) = max(level-thresh,0.0) * (1.0/float(ratio)-1.0);
847
+ // Note: "float(ratio)" REQUIRED when ratio is an integer > 1!
848
+ };
849
+
850
+ //---------------------------- gate_demo -------------------------
851
+ // USAGE: _,_ : gate_demo : _,_;
852
+ //
853
+ gate_demo = bypass2(gbp,gate_stereo_demo) with {
854
+
855
+ gate_group(x) = vgroup("GATE [tooltip: Reference: http://en.wikipedia.org/wiki/Noise_gate]", x);
856
+ meter_group(x) = gate_group(hgroup("[0]", x));
857
+ knob_group(x) = gate_group(hgroup("[1]", x));
858
+
859
+ gbp = meter_group(checkbox("[0] Bypass [tooltip: When this is checked, the gate has no effect]"));
860
+
861
+ gateview = gate_gain_mono(gatethr,gateatt,gatehold,gaterel) : linear2db :
862
+ meter_group(hbargraph("[1] Gate Gain [unit:dB] [tooltip: Current gain of the gate in dB]",
863
+ -50,+10)); // [style:led]
864
+
865
+ gate_stereo_demo(x,y) = attach(x,gateview(abs(x)+abs(y))),y :
866
+ gate_stereo(gatethr,gateatt,gatehold,gaterel);
867
+
868
+ gatethr = knob_group(hslider("[1] Threshold [unit:dB] [style:knob] [tooltip: When the signal level falls below the Threshold (expressed in dB), the signal is muted]",
869
+ -30, -120, 0, 0.1));
870
+
871
+ gateatt = knob_group(hslider("[2] Attack [unit:us] [style:knob] [scale:log]
872
+ [tooltip: Time constant in MICROseconds (1/e smoothing time) for the gate gain to go (exponentially) from 0 (muted) to 1 (unmuted)]",
873
+ 10, 10, 10000, 1)) : *(0.000001) : max(1.0/float(SR));
874
+
875
+ gatehold = knob_group(hslider("[3] Hold [unit:ms] [style:knob] [scale:log]
876
+ [tooltip: Time in ms to keep the gate open (no muting) after the signal level falls below the Threshold]",
877
+ 200, 1, 1000, 1)) : *(0.001) : max(1.0/float(SR));
878
+
879
+ gaterel = knob_group(hslider("[4] Release [unit:ms] [style:knob] [scale:log]
880
+ [tooltip: Time constant in ms (1/e smoothing time) for the gain to go (exponentially) from 1 (unmuted) to 0 (muted)]",
881
+ 100, 1, 1000, 1)) : *(0.001) : max(1.0/float(SR));
882
+ };
883
+
884
+ //---------------------------- compressor_demo -------------------------
885
+ // USAGE: _,_ : compressor_demo : _,_;
886
+ //
887
+ compressor_demo = bypass2(cbp,compressor_stereo_demo) with {
888
+
889
+ comp_group(x) = vgroup("COMPRESSOR [tooltip: Reference: http://en.wikipedia.org/wiki/Dynamic_range_compression]", x);
890
+
891
+ meter_group(x) = comp_group(hgroup("[0]", x));
892
+ knob_group(x) = comp_group(hgroup("[1]", x));
893
+
894
+ cbp = meter_group(checkbox("[0] Bypass [tooltip: When this is checked, the compressor has no effect]"));
895
+
896
+ gainview =
897
+ compression_gain_mono(ratio,threshold,attack,release) : linear2db :
898
+ meter_group(hbargraph("[1] Compressor Gain [unit:dB] [tooltip: Current gain of the compressor in dB]",
899
+ -50,+10));
900
+
901
+ displaygain = _,_ <: _,_,(abs,abs:+) : _,_,gainview : _,attach;
902
+
903
+ compressor_stereo_demo =
904
+ displaygain(compressor_stereo(ratio,threshold,attack,release)) :
905
+ *(makeupgain), *(makeupgain);
906
+
907
+ ctl_group(x) = knob_group(hgroup("[3] Compression Control", x));
908
+
909
+ ratio = ctl_group(hslider("[0] Ratio [style:knob]
910
+ [tooltip: A compression Ratio of N means that for each N dB increase in input signal level above Threshold, the output level goes up 1 dB]",
911
+ 5, 1, 20, 0.1));
912
+
913
+ threshold = ctl_group(hslider("[1] Threshold [unit:dB] [style:knob]
914
+ [tooltip: When the signal level exceeds the Threshold (in dB), its level is compressed according to the Ratio]",
915
+ -30, -100, 10, 0.1));
916
+
917
+ env_group(x) = knob_group(hgroup("[4] Compression Response", x));
918
+
919
+ attack = env_group(hslider("[1] Attack [unit:ms] [style:knob] [scale:log]
920
+ [tooltip: Time constant in ms (1/e smoothing time) for the compression gain to approach (exponentially) a new lower target level (the compression `kicking in')]",
921
+ 50, 1, 1000, 0.1)) : *(0.001) : max(1/SR);
922
+
923
+ release = env_group(hslider("[2] Release [unit:ms] [style: knob] [scale:log]
924
+ [tooltip: Time constant in ms (1/e smoothing time) for the compression gain to approach (exponentially) a new higher target level (the compression 'releasing')]",
925
+ 500, 1, 1000, 0.1)) : *(0.001) : max(1/SR);
926
+
927
+ makeupgain = comp_group(hslider("[5] Makeup Gain [unit:dB]
928
+ [tooltip: The compressed-signal output level is increased by this amount (in dB) to make up for the level lost due to compression]",
929
+ 40, -96, 96, 0.1)) : db2linear;
930
+ };
931
+
932
+ //------------------------------- limiter_* ------------------------------------
933
+ // USAGE:
934
+ // _ : limiter_1176_R4_mono : _;
935
+ // _,_ : limiter_1176_R4_stereo : _,_;
936
+ //
937
+ // DESCRIPTION:
938
+ // A limiter guards against hard-clipping. It can be can be
939
+ // implemented as a compressor having a high threshold (near the
940
+ // clipping level), fast attack and release, and high ratio. Since
941
+ // the ratio is so high, some knee smoothing is
942
+ // desirable ("soft limiting"). This example is intended
943
+ // to get you started using compressor_* as a limiter, so all
944
+ // parameters are hardwired to nominal values here.
945
+ //
946
+ // REFERENCE: http://en.wikipedia.org/wiki/1176_Peak_Limiter
947
+ // Ratios: 4 (moderate compression), 8 (severe compression),
948
+ // 12 (mild limiting), or 20 to 1 (hard limiting)
949
+ // Att: 20-800 MICROseconds (Note: scaled by ratio in the 1176)
950
+ // Rel: 50-1100 ms (Note: scaled by ratio in the 1176)
951
+ // Mike Shipley likes 4:1 (Grammy-winning mixer for Queen, Tom Petty, etc.)
952
+ // Faster attack gives "more bite" (e.g. on vocals)
953
+ // He hears a bright, clear eq effect as well (not implemented here)
954
+ //
955
+ limiter_1176_R4_mono = compressor_mono(4,-6,0.0008,0.5);
956
+ limiter_1176_R4_stereo = compressor_stereo(4,-6,0.0008,0.5);
957
+
958
+ //========================== Schroeder Reverberators ======================
959
+
960
+ //------------------------------ jcrev,satrev ------------------------------
961
+ // USAGE:
962
+ // _ : jcrev : _,_,_,_
963
+ // _ : satrev : _,_
964
+ //
965
+ // DESCRIPTION:
966
+ // These artificial reverberators take a mono signal and output stereo
967
+ // (satrev) and quad (jcrev). They were implemented by John Chowning
968
+ // in the MUS10 computer-music language (descended from Music V by Max
969
+ // Mathews). They are Schroeder Reverberators, well tuned for their size.
970
+ // Nowadays, the more expensive freeverb is more commonly used (see the
971
+ // Faust examples directory).
972
+
973
+ // The reverb below was made from a listing of "RV", dated April 14, 1972,
974
+ // which was recovered from an old SAIL DART backup tape.
975
+ // John Chowning thinks this might be the one that became the
976
+ // well known and often copied JCREV:
977
+
978
+ jcrev = *(0.06) : allpass_chain <: comb_bank : mix_mtx with {
979
+
980
+ rev1N = component("filter.lib").rev1;
981
+
982
+ rev12(len,g) = rev1N(2048,len,g);
983
+ rev14(len,g) = rev1N(4096,len,g);
984
+
985
+ allpass_chain =
986
+ rev2(512,347,0.7) :
987
+ rev2(128,113,0.7) :
988
+ rev2( 64, 37,0.7);
989
+
990
+ comb_bank =
991
+ rev12(1601,.802),
992
+ rev12(1867,.773),
993
+ rev14(2053,.753),
994
+ rev14(2251,.733);
995
+
996
+ mix_mtx = _,_,_,_ <: psum, -psum, asum, -asum : _,_,_,_ with {
997
+ psum = _,_,_,_ :> _;
998
+ asum = *(-1),_,*(-1),_ :> _;
999
+ };
1000
+ };
1001
+
1002
+ // The reverb below was made from a listing of "SATREV", dated May 15, 1971,
1003
+ // which was recovered from an old SAIL DART backup tape.
1004
+ // John Chowning thinks this might be the one used on his
1005
+ // often-heard brass canon sound examples, one of which can be found at
1006
+ // https://ccrma.stanford.edu/~jos/wav/FM_BrassCanon2.wav
1007
+
1008
+ satrev = *(0.2) <: comb_bank :> allpass_chain <: _,*(-1) with {
1009
+
1010
+ rev1N = component("filter.lib").rev1;
1011
+
1012
+ rev11(len,g) = rev1N(1024,len,g);
1013
+ rev12(len,g) = rev1N(2048,len,g);
1014
+
1015
+ comb_bank =
1016
+ rev11( 778,.827),
1017
+ rev11( 901,.805),
1018
+ rev11(1011,.783),
1019
+ rev12(1123,.764);
1020
+
1021
+ rev2N = component("filter.lib").rev2;
1022
+
1023
+ allpass_chain =
1024
+ rev2N(128,125,0.7) :
1025
+ rev2N( 64, 42,0.7) :
1026
+ rev2N( 16, 12,0.7);
1027
+ };
1028
+
1029
+ //---------------------------- mono_freeverb, stereo_freeverb -------------------------
1030
+ // A simple Schroeder reverberator primarily developed by "Jezar at Dreampoint" that
1031
+ // is extensively used in the free-software world. It uses four Schroeder allpasses in
1032
+ // series and eight parallel Schroeder-Moorer filtered-feedback comb-filters for each
1033
+ //audio channel, and is said to be especially well tuned.
1034
+ //
1035
+ // USAGE:
1036
+ // _ : mono_freeverb(fb1, fb2, damp, spread) : _;
1037
+ // or
1038
+ // _,_ : stereo_freeverb(fb1, fb2, damp, spread) : _,_;
1039
+ //
1040
+ // where
1041
+ // fb1 = coefficient of the lowpass comb filters (0-1)
1042
+ // fb2 = coefficient of the allpass comb filters (0-1)
1043
+ // damp = damping of the lowpass comb filter (0-1)
1044
+ // spread = spatial spread in number of samples (for stereo)
1045
+
1046
+ mono_freeverb(fb1, fb2, damp, spread) = _ <: par(i,8,lbcf(combtuningL(i)+spread,fb1,damp)) :> seq(i,4,allpass_comb(1024, allpasstuningL(i)+spread, -fb2))
1047
+ with{
1048
+ origSR = 44100;
1049
+
1050
+ // Filters parameters
1051
+ combtuningL(0) = 1116*SR/origSR : int;
1052
+ combtuningL(1) = 1188*SR/origSR : int;
1053
+ combtuningL(2) = 1277*SR/origSR : int;
1054
+ combtuningL(3) = 1356*SR/origSR : int;
1055
+ combtuningL(4) = 1422*SR/origSR : int;
1056
+ combtuningL(5) = 1491*SR/origSR : int;
1057
+ combtuningL(6) = 1557*SR/origSR : int;
1058
+ combtuningL(7) = 1617*SR/origSR : int;
1059
+
1060
+ allpasstuningL(0) = 556*SR/origSR : int;
1061
+ allpasstuningL(1) = 441*SR/origSR : int;
1062
+ allpasstuningL(2) = 341*SR/origSR : int;
1063
+ allpasstuningL(3) = 225*SR/origSR : int;
1064
+ // Lowpass Feedback Combfiler:
1065
+ // https://ccrma.stanford.edu/~jos/pasp/Lowpass_Feedback_Comb_Filter.html
1066
+ lbcf(dt, fb, damp) = (+:@(dt)) ~ (*(1-damp) : (+ ~ *(damp)) : *(fb));
1067
+ };
1068
+
1069
+ stereo_freeverb(fb1, fb2, damp, spread) = + <: mono_freeverb(fb1, fb2, damp,0), mono_freeverb(fb1, fb2, damp, spread);
1070
+
1071
+ //---------------------------- freeverb_demo -------------------------
1072
+ // USAGE: _,_ : freeverb_demo : _,_;
1073
+ //
1074
+
1075
+ freeverb_demo = _,_ <: (*(g)*fixedgain,*(g)*fixedgain : stereo_freeverb(combfeed, allpassfeed, damping, spatSpread)), *(1-g), *(1-g) :> _,_ with{
1076
+ scaleroom = 0.28;
1077
+ offsetroom = 0.7;
1078
+ allpassfeed = 0.5;
1079
+ scaledamp = 0.4;
1080
+ fixedgain = 0.1;
1081
+ origSR = 44100;
1082
+ parameters(x) = hgroup("Freeverb",x);
1083
+ knobGroup(x) = parameters(vgroup("[0]",x));
1084
+ damping = knobGroup(vslider("[0] Damp [style: knob] [tooltip: Somehow control the density of the reverb.]",0.5, 0, 1, 0.025)*scaledamp*origSR/SR);
1085
+ combfeed = knobGroup(vslider("[1] RoomSize [style: knob] [tooltip: The room size between 0 and 1 with 1 for the largest room.]", 0.5, 0, 1, 0.025)*scaleroom*origSR/SR + offsetroom);
1086
+ spatSpread = knobGroup(vslider("[2] Stereo Spread [style: knob] [tooltip: Spatial spread between 0 and 1 with 1 for maximum spread.]",0.5,0,1,0.01)*46*SR/origSR : int);
1087
+ g = parameters(vslider("[1] Wet [tooltip: The amount of reverb applied to the signal between 0 and 1 with 1 for the maximum amount of reverb.]", 0.3333, 0, 1, 0.025));
1088
+ };
1089
+
1090
+ //=============== Feedback Delay Network (FDN) Reverberators ==============
1091
+
1092
+ //-------------------------------- fdnrev0 ---------------------------------
1093
+ // Pure Feedback Delay Network Reverberator (generalized for easy scaling).
1094
+ //
1095
+ // USAGE:
1096
+ // <1,2,4,...,N signals> <:
1097
+ // fdnrev0(MAXDELAY,delays,BBSO,freqs,durs,loopgainmax,nonl) :>
1098
+ // <1,2,4,...,N signals>
1099
+ //
1100
+ // WHERE
1101
+ // N = 2, 4, 8, ... (power of 2)
1102
+ // MAXDELAY = power of 2 at least as large as longest delay-line length
1103
+ // delays = N delay lines, N a power of 2, lengths perferably coprime
1104
+ // BBSO = odd positive integer = order of bandsplit desired at freqs
1105
+ // freqs = NB-1 crossover frequencies separating desired frequency bands
1106
+ // durs = NB decay times (t60) desired for the various bands
1107
+ // loopgainmax = scalar gain between 0 and 1 used to "squelch" the reverb
1108
+ // nonl = nonlinearity (0 to 0.999..., 0 being linear)
1109
+ //
1110
+ // REFERENCE:
1111
+ // https://ccrma.stanford.edu/~jos/pasp/FDN_Reverberation.html
1112
+ //
1113
+ // DEPENDENCIES: filter.lib (filterbank)
1114
+
1115
+ fdnrev0(MAXDELAY, delays, BBSO, freqs, durs, loopgainmax, nonl)
1116
+ = (bus(2*N) :> bus(N) : delaylines(N)) ~
1117
+ (delayfilters(N,freqs,durs) : feedbackmatrix(N))
1118
+ with {
1119
+ N = count(delays);
1120
+ NB = count(durs);
1121
+ //assert(count(freqs)+1==NB);
1122
+ delayval(i) = take(i+1,delays);
1123
+ dlmax(i) = MAXDELAY; // must hardwire this from argument for now
1124
+ //dlmax(i) = 2^max(1,nextpow2(delayval(i))) // try when slider min/max is known
1125
+ // with { nextpow2(x) = ceil(log(x)/log(2.0)); };
1126
+ // -1 is for feedback delay:
1127
+ delaylines(N) = par(i,N,(delay(dlmax(i),(delayval(i)-1))));
1128
+ delayfilters(N,freqs,durs) = par(i,N,filter(i,freqs,durs));
1129
+ feedbackmatrix(N) = bhadamard(N);
1130
+ vbutterfly(n) = bus(n) <: (bus(n):>bus(n/2)) , ((bus(n/2),(bus(n/2):par(i,n/2,*(-1)))) :> bus(n/2));
1131
+ bhadamard(2) = bus(2) <: +,-;
1132
+ bhadamard(n) = bus(n) <: (bus(n):>bus(n/2)) , ((bus(n/2),(bus(n/2):par(i,n/2,*(-1)))) :> bus(n/2))
1133
+ : (bhadamard(n/2) , bhadamard(n/2));
1134
+
1135
+ // Experimental nonlinearities:
1136
+ // nonlinallpass = apnl(nonl,-nonl);
1137
+ // s = nonl*PI;
1138
+ // nonlinallpass(x) = allpassnn(3,(s*x,s*x*x,s*x*x*x)); // filter.lib
1139
+ nonlinallpass = _; // disabled by default (rather expensive)
1140
+
1141
+ filter(i,freqs,durs) = filterbank(BBSO,freqs) : par(j,NB,*(g(j,i)))
1142
+ :> *(loopgainmax) / sqrt(N) : nonlinallpass
1143
+ with {
1144
+ dur(j) = take(j+1,durs);
1145
+ n60(j) = dur(j)*SR; // decay time in samples
1146
+ g(j,i) = exp(-3.0*log(10.0)*delayval(i)/n60(j));
1147
+ // ~ 1.0 - 6.91*delayval(i)/(SR*dur(j)); // valid for large dur(j)
1148
+ };
1149
+ };
1150
+
1151
+ // ---------- prime_power_delays -----
1152
+ // Prime Power Delay Line Lengths
1153
+ //
1154
+ // USAGE:
1155
+ // bus(N) : prime_power_delays(N,pathmin,pathmax) : bus(N);
1156
+ //
1157
+ // WHERE
1158
+ // N = positive integer up to 16
1159
+ // (for higher powers of 2, extend 'primes' array below.)
1160
+ // pathmin = minimum acoustic ray length in the reverberator (in meters)
1161
+ // pathmax = maximum acoustic ray length (meters) - think "room size"
1162
+ //
1163
+ // DEPENDENCIES:
1164
+ // math.lib (SR, selector, take)
1165
+ // music.lib (db2linear)
1166
+ //
1167
+ // REFERENCE:
1168
+ // https://ccrma.stanford.edu/~jos/pasp/Prime_Power_Delay_Line.html
1169
+ //
1170
+ prime_power_delays(N,pathmin,pathmax) = par(i,N,delayvals(i)) with {
1171
+ Np = 16;
1172
+ primes = 2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53;
1173
+ prime(n) = primes : selector(n,Np); // math.lib
1174
+
1175
+ // Prime Power Bounds [matlab: floor(log(maxdel)./log(primes(53)))]
1176
+ maxdel=8192; // more than 63 meters at 44100 samples/sec & 343 m/s
1177
+ ppbs = 13,8,5,4, 3,3,3,3, 2,2,2,2, 2,2,2,2; // 8192 is enough for all
1178
+ ppb(i) = take(i+1,ppbs);
1179
+
1180
+ // Approximate desired delay-line lengths using powers of distinct primes:
1181
+ c = 343; // soundspeed in m/s at 20 degrees C for dry air
1182
+ dmin = SR*pathmin/c;
1183
+ dmax = SR*pathmax/c;
1184
+ dl(i) = dmin * (dmax/dmin)^(i/float(N-1)); // desired delay in samples
1185
+ ppwr(i) = floor(0.5+log(dl(i))/log(prime(i))); // best prime power
1186
+ delayvals(i) = prime(i)^ppwr(i); // each delay a power of a distinct prime
1187
+ };
1188
+
1189
+ //--------------------- stereo_reverb_tester --------------------
1190
+ // Handy test inputs for reverberator demos below.
1191
+
1192
+ stereo_reverb_tester(revin_group,x,y) = inx,iny with {
1193
+ ck_group(x) = revin_group(vgroup("[1] Input Config",x));
1194
+ mutegain = 1 - ck_group(checkbox("[1] Mute Ext Inputs
1195
+ [tooltip: When this is checked, the stereo external audio inputs are disabled (good for hearing the impulse response or pink-noise response alone)]"));
1196
+ pinkin = ck_group(checkbox("[2] Pink Noise
1197
+ [tooltip: Pink Noise (or 1/f noise) is Constant-Q Noise (useful for adjusting the EQ sections)]"));
1198
+
1199
+ impulsify = _ <: _,mem : - : >(0);
1200
+ imp_group(x) = revin_group(hgroup("[2] Impulse Selection",x));
1201
+ pulseL = imp_group(button("[1] Left
1202
+ [tooltip: Send impulse into LEFT channel]")) : impulsify;
1203
+ pulseC = imp_group(button("[2] Center
1204
+ [tooltip: Send impulse into LEFT and RIGHT channels]")) : impulsify;
1205
+ pulseR = imp_group(button("[3] Right
1206
+ [tooltip: Send impulse into RIGHT channel]")) : impulsify;
1207
+
1208
+ inx = x*mutegain + (pulseL+pulseC) + pn;
1209
+ iny = y*mutegain + (pulseR+pulseC) + pn;
1210
+ pn = 0.1*pinkin*component("oscillator.lib").pink_noise;
1211
+ };
1212
+
1213
+ //------------------------- fdnrev0_demo ---------------------------
1214
+ // USAGE: _,_ : fdnrev0_demo(N,NB,BBSO) : _,_
1215
+ // WHERE
1216
+ // N = Feedback Delay Network (FDN) order
1217
+ // = number of delay lines used = order of feedback matrix
1218
+ // = 2, 4, 8, or 16 [extend primes array below for 32, 64, ...]
1219
+ // NB = number of frequency bands
1220
+ // = number of (nearly) independent T60 controls
1221
+ // = integer 3 or greater
1222
+ // BBSO = Butterworth band-split order
1223
+ // = order of lowpass/highpass bandsplit used at each crossover freq
1224
+ // = odd positive integer
1225
+
1226
+ fdnrev0_demo(N,NB,BBSO,x,y) = stereo_reverb_tester(revin_group,x,y)
1227
+ <: fdnrev0(MAXDELAY,delays,BBSO,freqs,durs,loopgainmax,nonl)
1228
+ :> *(gain),*(gain)
1229
+ with {
1230
+ MAXDELAY = 8192; // sync w delays and prime_power_delays above
1231
+ defdurs = (8.4,6.5,5.0,3.8,2.7); // NB default durations (sec)
1232
+ deffreqs = (500,1000,2000,4000); // NB-1 default crossover frequencies (Hz)
1233
+ deflens = (56.3,63.0); // 2 default min and max path lengths
1234
+
1235
+ fdn_group(x) = vgroup("FEEDBACK DELAY NETWORK (FDN) REVERBERATOR, ORDER 16
1236
+ [tooltip: See Faust's effect.lib for documentation and references]", x);
1237
+
1238
+ freq_group(x) = fdn_group(vgroup("[1] Band Crossover Frequencies", x));
1239
+ t60_group(x) = fdn_group(hgroup("[2] Band Decay Times (T60)", x));
1240
+ path_group(x) = fdn_group(vgroup("[3] Room Dimensions", x));
1241
+ revin_group(x) = fdn_group(hgroup("[4] Input Controls", x));
1242
+ nonl_group(x) = revin_group(vgroup("[4] Nonlinearity",x));
1243
+ quench_group(x) = revin_group(vgroup("[3] Reverb State",x));
1244
+
1245
+ nonl = nonl_group(hslider("[style:knob] [tooltip: nonlinear mode coupling]",
1246
+ 0, -0.999, 0.999, 0.001));
1247
+ loopgainmax = 1.0-0.5*quench_group(button("[1] Quench
1248
+ [tooltip: Hold down 'Quench' to clear the reverberator]"));
1249
+
1250
+ pathmin = path_group(hslider("[1] min acoustic ray length [unit:m] [scale:log]
1251
+ [tooltip: This length (in meters) determines the shortest delay-line used in the FDN reverberator.
1252
+ Think of it as the shortest wall-to-wall separation in the room.]",
1253
+ 46, 0.1, 63, 0.1));
1254
+ pathmax = path_group(hslider("[2] max acoustic ray length [unit:m] [scale:log]
1255
+ [tooltip: This length (in meters) determines the longest delay-line used in the FDN reverberator.
1256
+ Think of it as the largest wall-to-wall separation in the room.]",
1257
+ 63, 0.1, 63, 0.1));
1258
+
1259
+ durvals(i) = t60_group(vslider("[%i] %i [unit:s] [scale:log]
1260
+ [tooltip: T60 is the 60dB decay-time in seconds. For concert halls, an overall reverberation time (T60) near 1.9 seconds is typical [Beranek 2004]. Here we may set T60 independently in each frequency band. In real rooms, higher frequency bands generally decay faster due to absorption and scattering.]",
1261
+ take(i+1,defdurs), 0.1, 100, 0.1));
1262
+ durs = par(i,NB,durvals(NB-1-i));
1263
+
1264
+ freqvals(i) = freq_group(hslider("[%i] Band %i upper edge in Hz [unit:Hz] [scale:log]
1265
+ [tooltip: Each delay-line signal is split into frequency-bands for separate decay-time control in each band]",
1266
+ take(i+1,deffreqs), 100, 10000, 1));
1267
+ freqs = par(i,NB-1,freqvals(i));
1268
+
1269
+ delays = prime_power_delays(N,pathmin,pathmax);
1270
+
1271
+ gain = hslider("[3] Output Level (dB) [unit:dB]
1272
+ [tooltip: Output scale factor]", -40, -70, 20, 0.1) : db2linear;
1273
+ // (can cause infinite loop:) with { db2linear(x) = pow(10, x/20.0); };
1274
+ };
1275
+
1276
+ //------------------------------- zita_rev_fdn -------------------------------
1277
+ // Internal 8x8 late-reverberation FDN used in the FOSS Linux reverb zita-rev1
1278
+ // by Fons Adriaensen <fons@linuxaudio.org>. This is an FDN reverb with
1279
+ // allpass comb filters in each feedback delay in addition to the
1280
+ // damping filters.
1281
+ //
1282
+ // USAGE:
1283
+ // bus(8) : zita_rev_fdn(f1,f2,t60dc,t60m,fsmax) : bus(8)
1284
+ //
1285
+ // WHERE
1286
+ // f1 = crossover frequency (Hz) separating dc and midrange frequencies
1287
+ // f2 = frequency (Hz) above f1 where T60 = t60m/2 (see below)
1288
+ // t60dc = desired decay time (t60) at frequency 0 (sec)
1289
+ // t60m = desired decay time (t60) at midrange frequencies (sec)
1290
+ // fsmax = maximum sampling rate to be used (Hz)
1291
+ //
1292
+ // REFERENCES:
1293
+ // http://www.kokkinizita.net/linuxaudio/zita-rev1-doc/quickguide.html
1294
+ // https://ccrma.stanford.edu/~jos/pasp/Zita_Rev1.html
1295
+ //
1296
+ // DEPENDENCIES:
1297
+ // filter.lib (allpass_comb, lowpass, smooth)
1298
+ // math.lib (hadamard, take, etc.)
1299
+
1300
+ zita_rev_fdn(f1,f2,t60dc,t60m,fsmax) =
1301
+ ((bus(2*N) :> allpass_combs(N) : feedbackmatrix(N)) ~
1302
+ (delayfilters(N,freqs,durs) : fbdelaylines(N)))
1303
+ with {
1304
+ N = 8;
1305
+
1306
+ // Delay-line lengths in seconds:
1307
+ apdelays = (0.020346, 0.024421, 0.031604, 0.027333, 0.022904,
1308
+ 0.029291, 0.013458, 0.019123); // feedforward delays in seconds
1309
+ tdelays = ( 0.153129, 0.210389, 0.127837, 0.256891, 0.174713,
1310
+ 0.192303, 0.125000, 0.219991); // total delays in seconds
1311
+ tdelay(i) = floor(0.5 + SR*take(i+1,tdelays)); // samples
1312
+ apdelay(i) = floor(0.5 + SR*take(i+1,apdelays));
1313
+ fbdelay(i) = tdelay(i) - apdelay(i);
1314
+ // NOTE: Since SR is not bounded at compile time, we can't use it to
1315
+ // allocate delay lines; hence, the fsmax parameter:
1316
+ tdelaymaxfs(i) = floor(0.5 + fsmax*take(i+1,tdelays));
1317
+ apdelaymaxfs(i) = floor(0.5 + fsmax*take(i+1,apdelays));
1318
+ fbdelaymaxfs(i) = tdelaymaxfs(i) - apdelaymaxfs(i);
1319
+ nextpow2(x) = ceil(log(x)/log(2.0));
1320
+ maxapdelay(i) = int(2.0^max(1.0,nextpow2(apdelaymaxfs(i))));
1321
+ maxfbdelay(i) = int(2.0^max(1.0,nextpow2(fbdelaymaxfs(i))));
1322
+
1323
+ apcoeff(i) = select2(i&1,0.6,-0.6); // allpass comb-filter coefficient
1324
+ allpass_combs(N) =
1325
+ par(i,N,(allpass_comb(maxapdelay(i),apdelay(i),apcoeff(i)))); // filter.lib
1326
+ fbdelaylines(N) = par(i,N,(delay(maxfbdelay(i),(fbdelay(i)))));
1327
+ freqs = (f1,f2); durs = (t60dc,t60m);
1328
+ delayfilters(N,freqs,durs) = par(i,N,filter(i,freqs,durs));
1329
+ feedbackmatrix(N) = hadamard(N); // math.lib
1330
+
1331
+ staynormal = 10.0^(-20); // let signals decay well below LSB, but not to zero
1332
+
1333
+ special_lowpass(g,f) = smooth(p) with {
1334
+ // unity-dc-gain lowpass needs gain g at frequency f => quadratic formula:
1335
+ p = mbo2 - sqrt(max(0,mbo2*mbo2 - 1.0)); // other solution is unstable
1336
+ mbo2 = (1.0 - gs*c)/(1.0 - gs); // NOTE: must ensure |g|<1 (t60m finite)
1337
+ gs = g*g;
1338
+ c = cos(2.0*PI*f/float(SR));
1339
+ };
1340
+
1341
+ filter(i,freqs,durs) = lowshelf_lowpass(i)/sqrt(float(N))+staynormal
1342
+ with {
1343
+ lowshelf_lowpass(i) = gM*low_shelf1_l(g0/gM,f(1)):special_lowpass(gM,f(2));
1344
+ low_shelf1_l(G0,fx,x) = x + (G0-1)*lowpass(1,fx,x); // filter.lib
1345
+ g0 = g(0,i);
1346
+ gM = g(1,i);
1347
+ f(k) = take(k,freqs);
1348
+ dur(j) = take(j+1,durs);
1349
+ n60(j) = dur(j)*SR; // decay time in samples
1350
+ g(j,i) = exp(-3.0*log(10.0)*tdelay(i)/n60(j));
1351
+ };
1352
+ };
1353
+
1354
+ // Stereo input delay used by zita_rev1 in both stereo and ambisonics mode:
1355
+ zita_in_delay(rdel) = zita_delay_mono(rdel), zita_delay_mono(rdel) with {
1356
+ zita_delay_mono(rdel) = delay(8192,SR*rdel*0.001) * 0.3;
1357
+ };
1358
+
1359
+ // Stereo input mapping used by zita_rev1 in both stereo and ambisonics mode:
1360
+ zita_distrib2(N) = _,_ <: fanflip(N) with {
1361
+ fanflip(4) = _,_,*(-1),*(-1);
1362
+ fanflip(N) = fanflip(N/2),fanflip(N/2);
1363
+ };
1364
+
1365
+ //--------------------------- zita_rev_fdn_demo ------------------------------
1366
+ // zita_rev_fdn_demo = zita_rev_fdn (above) + basic GUI
1367
+ //
1368
+ // USAGE:
1369
+ // bus(8) : zita_rev_fdn_demo(f1,f2,t60dc,t60m,fsmax) : bus(8)
1370
+ //
1371
+ // WHERE
1372
+ // (args and references as for zita_rev_fdn above)
1373
+
1374
+ zita_rev_fdn_demo = zita_rev_fdn(f1,f2,t60dc,t60m,fsmax)
1375
+ with {
1376
+ fsmax = 48000.0;
1377
+ fdn_group(x) = hgroup(
1378
+ "Zita_Rev Internal FDN Reverb [tooltip: ~ Zita_Rev's internal 8x8 Feedback Delay Network (FDN) & Schroeder allpass-comb reverberator. See Faust's effect.lib for documentation and references]",x);
1379
+ t60dc = fdn_group(vslider("[1] Low RT60 [unit:s] [style:knob]
1380
+ [style:knob]
1381
+ [tooltip: T60 = time (in seconds) to decay 60dB in low-frequency band]",
1382
+ 3, 1, 8, 0.1));
1383
+ f1 = fdn_group(vslider("[2] LF X [unit:Hz] [style:knob] [scale:log]
1384
+ [tooltip: Crossover frequency (Hz) separating low and middle frequencies]",
1385
+ 200, 50, 1000, 1));
1386
+ t60m = fdn_group(vslider("[3] Mid RT60 [unit:s] [style:knob] [scale:log]
1387
+ [tooltip: T60 = time (in seconds) to decay 60dB in middle band]",
1388
+ 2, 1, 8, 0.1));
1389
+ f2 = fdn_group(vslider("[4] HF Damping [unit:Hz] [style:knob] [scale:log]
1390
+ [tooltip: Frequency (Hz) at which the high-frequency T60 is half the middle-band's T60]",
1391
+ 6000, 1500, 0.49*fsmax, 1));
1392
+ };
1393
+
1394
+ //---------------------------- zita_rev1_stereo ---------------------------
1395
+ // Extend zita_rev_fdn to include zita_rev1 input/output mapping in stereo mode.
1396
+ //
1397
+ // USAGE:
1398
+ // _,_ : zita_rev1_stereo(rdel,f1,f2,t60dc,t60m,fsmax) : _,_
1399
+ //
1400
+ // WHERE
1401
+ // rdel = delay (in ms) before reverberation begins (e.g., 0 to ~100 ms)
1402
+ // (remaining args and refs as for zita_rev_fdn above)
1403
+
1404
+ zita_rev1_stereo(rdel,f1,f2,t60dc,t60m,fsmax) =
1405
+ zita_in_delay(rdel)
1406
+ : zita_distrib2(N)
1407
+ : zita_rev_fdn(f1,f2,t60dc,t60m,fsmax)
1408
+ : output2(N)
1409
+ with {
1410
+ N = 8;
1411
+ output2(N) = outmix(N) : *(t1),*(t1);
1412
+ t1 = 0.37; // zita-rev1 linearly ramps from 0 to t1 over one buffer
1413
+ outmix(4) = !,butterfly(2),!; // probably the result of some experimenting!
1414
+ outmix(N) = outmix(N/2),par(i,N/2,!);
1415
+ };
1416
+
1417
+ //----------------------------- zita_rev1_ambi ---------------------------
1418
+ // Extend zita_rev_fdn to include zita_rev1 input/output mapping in
1419
+ // "ambisonics mode", as provided in the Linux C++ version.
1420
+ //
1421
+ // USAGE:
1422
+ // _,_ : zita_rev1_ambi(rgxyz,rdel,f1,f2,t60dc,t60m,fsmax) : _,_,_,_
1423
+ //
1424
+ // WHERE
1425
+ // rgxyz = relative gain of lanes 1,4,2 to lane 0 in output (e.g., -9 to 9)
1426
+ // (remaining args and references as for zita_rev1_stereo above)
1427
+
1428
+ zita_rev1_ambi(rgxyz,rdel,f1,f2,t60dc,t60m,fsmax) =
1429
+ zita_in_delay(rdel)
1430
+ : zita_distrib2(N)
1431
+ : zita_rev_fdn(f1,f2,t60dc,t60m,fsmax)
1432
+ : output4(N) // ambisonics mode
1433
+ with {
1434
+ N=8;
1435
+ output4(N) = select4 : *(t0),*(t1),*(t1),*(t1);
1436
+ select4 = _,_,_,!,_,!,!,! : _,_,cross with { cross(x,y) = y,x; };
1437
+ t0 = 1.0/sqrt(2.0);
1438
+ t1 = t0 * 10.0^(0.05 * rgxyz);
1439
+ };
1440
+
1441
+ //---------------------------------- zita_rev1 ------------------------------
1442
+ // Example GUI for zita_rev1_stereo (mostly following the Linux zita-rev1 GUI).
1443
+ //
1444
+ // Only the dry/wet and output level parameters are "dezippered" here. If
1445
+ // parameters are to be varied in real time, use "smooth(0.999)" or the like
1446
+ // in the same way.
1447
+ //
1448
+ // REFERENCE:
1449
+ // http://www.kokkinizita.net/linuxaudio/zita-rev1-doc/quickguide.html
1450
+ //
1451
+ // DEPENDENCIES:
1452
+ // filter.lib (peak_eq_rm)
1453
+
1454
+ zita_rev1(x,y) = zita_rev1_stereo(rdel,f1,f2,t60dc,t60m,fsmax,x,y)
1455
+ : out_eq : dry_wet(x,y) : out_level
1456
+ with {
1457
+
1458
+ fsmax = 48000.0; // highest sampling rate that will be used
1459
+
1460
+ fdn_group(x) = hgroup(
1461
+ "[0] Zita_Rev1 [tooltip: ~ ZITA REV1 FEEDBACK DELAY NETWORK (FDN) & SCHROEDER ALLPASS-COMB REVERBERATOR (8x8). See Faust's effect.lib for documentation and references]", x);
1462
+
1463
+ in_group(x) = fdn_group(hgroup("[1] Input", x));
1464
+
1465
+ rdel = in_group(vslider("[1] In Delay [unit:ms] [style:knob]
1466
+ [tooltip: Delay in ms before reverberation begins]",
1467
+ 60,20,100,1));
1468
+
1469
+ freq_group(x) = fdn_group(hgroup("[2] Decay Times in Bands (see tooltips)", x));
1470
+
1471
+ f1 = freq_group(vslider("[1] LF X [unit:Hz] [style:knob] [scale:log]
1472
+ [tooltip: Crossover frequency (Hz) separating low and middle frequencies]",
1473
+ 200, 50, 1000, 1));
1474
+
1475
+ t60dc = freq_group(vslider("[2] Low RT60 [unit:s] [style:knob] [scale:log]
1476
+ [style:knob] [tooltip: T60 = time (in seconds) to decay 60dB in low-frequency band]",
1477
+ 3, 1, 8, 0.1));
1478
+
1479
+ t60m = freq_group(vslider("[3] Mid RT60 [unit:s] [style:knob] [scale:log]
1480
+ [tooltip: T60 = time (in seconds) to decay 60dB in middle band]",
1481
+ 2, 1, 8, 0.1));
1482
+
1483
+ f2 = freq_group(vslider("[4] HF Damping [unit:Hz] [style:knob] [scale:log]
1484
+ [tooltip: Frequency (Hz) at which the high-frequency T60 is half the middle-band's T60]",
1485
+ 6000, 1500, 0.49*fsmax, 1));
1486
+
1487
+ out_eq = pareq_stereo(eq1f,eq1l,eq1q) : pareq_stereo(eq2f,eq2l,eq2q);
1488
+ // Zolzer style peaking eq (not used in zita-rev1) (filter.lib):
1489
+ // pareq_stereo(eqf,eql,Q) = peak_eq(eql,eqf,eqf/Q), peak_eq(eql,eqf,eqf/Q);
1490
+ // Regalia-Mitra peaking eq with "Q" hard-wired near sqrt(g)/2 (filter.lib):
1491
+ pareq_stereo(eqf,eql,Q) = peak_eq_rm(eql,eqf,tpbt), peak_eq_rm(eql,eqf,tpbt)
1492
+ with {
1493
+ tpbt = wcT/sqrt(max(0,g)); // tan(PI*B/SR), B bw in Hz (Q^2 ~ g/4)
1494
+ wcT = 2*PI*eqf/SR; // peak frequency in rad/sample
1495
+ g = db2linear(eql); // peak gain
1496
+ };
1497
+
1498
+ eq1_group(x) = fdn_group(hgroup("[3] RM Peaking Equalizer 1", x));
1499
+
1500
+ eq1f = eq1_group(vslider("[1] Eq1 Freq [unit:Hz] [style:knob] [scale:log]
1501
+ [tooltip: Center-frequency of second-order Regalia-Mitra peaking equalizer section 1]",
1502
+ 315, 40, 2500, 1));
1503
+
1504
+ eq1l = eq1_group(vslider("[2] Eq1 Level [unit:dB] [style:knob]
1505
+ [tooltip: Peak level in dB of second-order Regalia-Mitra peaking equalizer section 1]",
1506
+ 0, -15, 15, 0.1));
1507
+
1508
+ eq1q = eq1_group(vslider("[3] Eq1 Q [style:knob]
1509
+ [tooltip: Q = centerFrequency/bandwidth of second-order peaking equalizer section 1]",
1510
+ 3, 0.1, 10, 0.1));
1511
+
1512
+ eq2_group(x) = fdn_group(hgroup("[4] RM Peaking Equalizer 2", x));
1513
+
1514
+ eq2f = eq2_group(vslider("[1] Eq2 Freq [unit:Hz] [style:knob] [scale:log]
1515
+ [tooltip: Center-frequency of second-order Regalia-Mitra peaking equalizer section 2]",
1516
+ 1500, 160, 10000, 1));
1517
+
1518
+ eq2l = eq2_group(vslider("[2] Eq2 Level [unit:dB] [style:knob]
1519
+ [tooltip: Peak level in dB of second-order Regalia-Mitra peaking equalizer section 2]",
1520
+ 0, -15, 15, 0.1));
1521
+
1522
+ eq2q = eq2_group(vslider("[3] Eq2 Q [style:knob]
1523
+ [tooltip: Q = centerFrequency/bandwidth of second-order peaking equalizer section 2]",
1524
+ 3, 0.1, 10, 0.1));
1525
+
1526
+ out_group(x) = fdn_group(hgroup("[5] Output", x));
1527
+
1528
+ dry_wet(x,y) = *(wet) + dry*x, *(wet) + dry*y with {
1529
+ wet = 0.5*(drywet+1.0);
1530
+ dry = 1.0-wet;
1531
+ };
1532
+
1533
+ drywet = out_group(vslider("[1] Dry/Wet Mix [style:knob]
1534
+ [tooltip: -1 = dry, 1 = wet]",
1535
+ 0, -1.0, 1.0, 0.01)) : smooth(0.999);
1536
+
1537
+ out_level = *(gain),*(gain);
1538
+
1539
+ gain = out_group(vslider("[2] Level [unit:dB] [style:knob]
1540
+ [tooltip: Output scale factor]", -20, -70, 40, 0.1))
1541
+ : db2linear : smooth(0.999);
1542
+
1543
+ };
1544
+
1545
+ //---------------------------------- mesh_square ------------------------------
1546
+ // Square Rectangular Digital Waveguide Mesh
1547
+ //
1548
+ // USAGE:
1549
+ // bus(4*N) : mesh_square(N) : bus(4*N);
1550
+ //
1551
+ // WHERE
1552
+ // N = number of nodes along each edge - a power of two (1,2,4,8,...)
1553
+ //
1554
+ // REQUIRES: math.lib
1555
+ //
1556
+ // REFERENCE:
1557
+ // https://ccrma.stanford.edu/~jos/pasp/Digital_Waveguide_Mesh.html
1558
+ //
1559
+ // SIGNAL ORDER IN AND OUT:
1560
+ // The mesh is constructed recursively using 2x2 embeddings. Thus,
1561
+ // the top level of mesh_square(M) is a block 2x2 mesh, where each
1562
+ // block is a mesh(M/2). Let these blocks be numbered 1,2,3,4 in the
1563
+ // geometry [NW,NE;SW,SE], i.e., as
1564
+ // 1 2
1565
+ // 3 4
1566
+ // Each block has four vector inputs and four vector outputs, where the
1567
+ // length of each vector is M/2. Label the input vectors as Ni,Ei,Wi,Si,
1568
+ // i.e., as the inputs from the North, East South, and West,
1569
+ // and similarly for the outputs. Then, for example, the upper
1570
+ // left input block of M/2 signals is labeled 1Ni. Most of the
1571
+ // connections are internal, such as 1Eo -> 2Wi. The 8*(M/2) input
1572
+ // signals are grouped in the order
1573
+ // 1Ni 2Ni
1574
+ // 3Si 4Si
1575
+ // 1Wi 3Wi
1576
+ // 2Ei 4Ei
1577
+ // and the output signals are
1578
+ // 1No 1Wo
1579
+ // 2No 2Eo
1580
+ // 3So 3Wo
1581
+ // 4So 4Eo
1582
+ // or
1583
+ // In: 1Ni 2Ni 3Si 4Si 1Wi 3Wi 2Ei 4Ei
1584
+ // Out: 1No 1Wo 2No 2Eo 3So 3Wo 4So 4Eo
1585
+ // Thus, the inputs are grouped by direction N,S,W,E, while the
1586
+ // outputs are grouped by block number 1,2,3,4, which can also be
1587
+ // interpreted as directions NW, NE, SW, SE. A simple program
1588
+ // illustrating these orderings is `process = mesh_square(2);`.
1589
+ //
1590
+ // EXAMPLE: Reflectively terminated mesh impulsed at one corner:
1591
+ // `mesh_square_test(N,x) = mesh_square(N)~(busi(4*N,x)) // input to corner
1592
+ // with { busi(N,x) = bus(N) : par(i,N,*(-1)) : par(i,N-1,_), +(x); };
1593
+ // process = 1-1' : mesh_square_test(4); // all modes excited forever`
1594
+ // In this simple example, the mesh edges are connected as follows:
1595
+ // 1No -> 1Ni, 1Wo -> 2Ni, 2No -> 3Si, 2Eo -> 4Si,
1596
+ // 3So -> 1Wi, 3Wo -> 3Wi, 4So -> 2Ei, 4Eo -> 4Ei
1597
+ // A routing matrix can be used to obtain other connection geometries.
1598
+
1599
+ // four-port scattering junction:
1600
+ mesh_square(1) =
1601
+ bus(4) <: par(i,4,*(-1)), (bus(4) :> (*(.5)) <: bus(4)) :> bus(4);
1602
+
1603
+ // rectangular NxN square waveguide mesh:
1604
+ mesh_square(N) = bus(4*N) : (route_inputs(N/2) : par(i,4,mesh_square(N/2)))
1605
+ ~(prune_feedback(N/2))
1606
+ : prune_outputs(N/2) : route_outputs(N/2) : bus(4*N)
1607
+ with {
1608
+ block(N) = par(i,N,!);
1609
+
1610
+ // select block i of N, block size = M:
1611
+ s(i,N,M) = par(j, M*N, Sv(i, j))
1612
+ with { Sv(i,i) = bus(N); Sv(i,j) = block(N); };
1613
+
1614
+ // prune mesh outputs down to the signals which make it out:
1615
+ prune_outputs(N)
1616
+ = bus(16*N) :
1617
+ block(N), bus(N), block(N), bus(N),
1618
+ block(N), bus(N), bus(N), block(N),
1619
+ bus(N), block(N), block(N), bus(N),
1620
+ bus(N), block(N), bus(N), block(N)
1621
+ : bus(8*N);
1622
+
1623
+ // collect mesh outputs into standard order (N,W,E,S):
1624
+ route_outputs(N)
1625
+ = bus(8*N)
1626
+ <: s(4,N,8),s(5,N,8), s(0,N,8),s(2,N,8),
1627
+ s(3,N,8),s(7,N,8), s(1,N,8),s(6,N,8)
1628
+ : bus(8*N);
1629
+
1630
+ // collect signals used as feedback:
1631
+ prune_feedback(N) = bus(16*N) :
1632
+ bus(N), block(N), bus(N), block(N),
1633
+ bus(N), block(N), block(N), bus(N),
1634
+ block(N), bus(N), bus(N), block(N),
1635
+ block(N), bus(N), block(N), bus(N) :
1636
+ bus(8*N);
1637
+
1638
+ // route mesh inputs (feedback, external inputs):
1639
+ route_inputs(N) = bus(8*N), bus(8*N)
1640
+ <:s(8,N,16),s(4,N,16), s(12,N,16),s(3,N,16),
1641
+ s(9,N,16),s(6,N,16), s(1,N,16),s(14,N,16),
1642
+ s(0,N,16),s(10,N,16), s(13,N,16),s(7,N,16),
1643
+ s(2,N,16),s(11,N,16), s(5,N,16),s(15,N,16)
1644
+ : bus(16*N);
1645
+ };