Audiolib.js: Changing values of existing “objects”

徘徊边缘 提交于 2019-12-24 21:40:24

问题


so I looked into Audiolib.js and can make some basic stuff but what I don't know and can't figure out by searching through the internet.

The question is how I can change specific values of some "objects" without "re-appending" it. For example:

var osc;
osc = audioLib.Oscillator(44100 /*or some other samplerate */ , 400 );

function changefrequency(freq)
osc.frequency = freq; /* is there a way to do stuff like this? */

(Btw. with "objects" I mean oscillators, lfo's, filters and so on.) Since there are many other situations where I would like to change values without interrupting the whole process, I would realy like to do stuff like this.


回答1:


It looks like this library allows you to modify the properties of its objects. For example, this tutorial is modifying the "frequency" property of the Oscillator to change notes. It also uses the "reset" method to reset its phase when changing notes.



来源:https://stackoverflow.com/questions/19773237/audiolib-js-changing-values-of-existing-objects

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!