ctford / cljs-bach Goto Github PK
View Code? Open in Web Editor NEWA Clojurescript wrapper for the Web Audio API.
License: Other
A Clojurescript wrapper for the Web Audio API.
License: Other
This relates to the issue I opened in klangmeister repo
Please refer description there.
Per https://developers.google.com/web/updates/2017/09/autoplay-policy-changes#webaudio , AudioContext will not be granted until user has done some interaction with the site. So how do we create it?
I noticed in the pure-JS HTML example there is a function called sample
:
https://github.com/ctford/cljs-bach/search?utf8=%E2%9C%93&q=sample
I would love to know more about what is possible with this.
In the adsr function, the remainder for the hold is calculated by subtracting the attack, decay, and sustain from the duration. I think this should be attack, decay, and release instead, as those are the adsr time parameters, and sustain is a level parameter.
https://github.com/ctford/cljs-bach/blob/master/src/cljs_bach/synthesis.cljs#L92
I'm really enjoying using this library along with leipzig for web-based music generation, they're really great.
I was wondering if there was any recommended pattern for updating an AudioParam of a node that is part of a synthesizer? For example, I would like to be able to bind the gain
parameter of a gain node to some dynamic value based on a slider from an <input type="range">
element:
(defn ping [freq]
(connect->
(square freq)
(percussive 0.01 0.4)
(gain dynamic-value-here?)))
I've been trying various approaches involving calling AudioParam.setValueAtTime()
from an event listener and using an AudioBufferSourceNode
to provide a changing value to other nodes, but nothing I try seems to work correctly.
If work is required to the library to be able to support something like this, I'd be happy to help out if I can.
paste from cljs.bach.synthesis:
(defn oscillator
"A periodic wave."
[type freq]
(fn [context at duration]
(source
(doto (.createOscillator context)
(-> .-frequency .-value (set! 0))
(-> .-frequency (plug freq context at duration))
(-> .-type (set! type))
(.start at)
(.stop (+ at duration 1.0)))))) <----- here
If I create an oscillator like this
(oscillator "sine" another-synth)
the extra second added (see the "here" mark) need to be added to another-synth, is this really wanted?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.