Waveform synthesis
190n opened this issue · 7 comments
Could you add an instrument that is a sine wave generator?
For example:
sine: c d e f g
Excellent idea -- it's definitely on our to-do list, and one of my primary motivations for creating Alda. (MIDI just ended up being easier to implement, as a first step.) We can track it here in this issue.
The original idea I had was to use Overtone, but it depends on Supercollider, which I think would make it difficult to package. A Java-native solution would be better. Minim might be a good fit -- some work has been done in making it easier to use without Processing and as a Maven dependency.
If Alda becomes a cljc project (compiling to both Clojure and ClojureScript), I think we could move a lot faster with implementing waveform instruments in ClojureScript (via the Web Audio API, which I even have a little ClojureScript library for already) than we could in Clojure. In general, the types of libraries we have available to us in JavaScript vs. Java seem a lot more advanced. I've even had fleeting thoughts of abandoning Java altogether and just making Alda a ClojureScript project, which could potentially target the browser, the desktop, and maybe even the terminal via Node (although I'm not sure if you can use the Web Audio API without a browser).
(although I'm not sure if you can use the Web Audio API without a browser).
Apparently you can: https://github.com/sebpiq/node-web-audio-api
EDIT: Although apparently the OscillatorNode is not supported, so maybe we need to find another library. This one looks good: https://github.com/colinbdclark/flocking
JSyn looks promising.
Should also have a look at JSynthLib.
Klangmeister's connect->
has a DSL something like what I'm imagining as a way of designing synthesizer instruments in Alda.