Comments (3)
Cool. Good to know the expected behaviour. I'll try to make some tests
from virtual-audio-graph.
Sorry hijacking this thread for another followup question. Are nodes only updated when their key changes?
I'm creating a new audio graph where the buffers of the bufferSource's are changed but I only hear the new sound if i change the key.
from virtual-audio-graph.
Hi @voodoohop, custom nodes can be composed of other custom nodes. There is ony 1 test case for that though https://github.com/benji6/virtual-audio-graph/blob/master/test/customNodes/expectedBehaviour.ts#L26 so it's possible you hit an edge case.
I just tested this example which seemed fine:
const osc = createNode(
({ gain: gainValue, startTime, stopTime, ...rest }) => {
const duration = stopTime - startTime;
return {
0: gain("output", {
gain: [
["setValueAtTime", 0, startTime],
[
"linearRampToValueAtTime",
gainValue,
startTime + duration * 0.15,
],
["setValueAtTime", gainValue, stopTime - duration * 0.25],
["linearRampToValueAtTime", 0, stopTime],
],
}),
1: oscillator(0, { startTime, stopTime, ...rest }),
};
},
);
const pingPongDelay = createNode(({ decay, delayTime }) => ({
0: stereoPanner("output", { pan: -1 }),
1: stereoPanner("output", { pan: 1 }),
2: delay([1, 5], { delayTime, maxDelayTime: delayTime }),
3: gain(2, { gain: decay }),
4: delay([0, 3], { delayTime, maxDelayTime: delayTime }),
5: gain(4, { gain: decay }, "input"), // connections will be made here
}));
const synth = createNode(({ startTime, stopTime }) => ({
0: pingPongDelay("output", { decay: 0.8, delayTime: 0.5 }),
1: osc(0, {
frequency: 110,
gain: 0.2,
startTime,
stopTime,
type: "square",
}),
}));
const { currentTime } = virtualAudioGraph;
virtualAudioGraph.update({
0: synth("output", { startTime: currentTime, stopTime: currentTime + 1 }),
});
And in answer to your second question, nodes should be updated whenever any properties change (not just the key). There may be some limitations to this (e.g. if the underlying audio API does not allow this). Or of course there may be a bug - do share an example if you are having trouble.
from virtual-audio-graph.
Related Issues (20)
- The automated release is failing 🚨 HOT 1
- Redundant `exponentialRampToValueAtTime` calls cause click noises HOT 4
- The automated release is failing 🚨
- v1.1.1 release don't include the compiled module HOT 1
- Possible bug with offset HOT 3
- Example connect to a source from a file HOT 5
- VAG samples not working in safari HOT 8
- AudioContext in Safari always 'suspended' HOT 1
- The automated release is failing 🚨
- create node with no output? HOT 1
- Persisting audio graph definitions using functions HOT 8
- Access to currently playing sound? HOT 2
- The automated release is failing 🚨
- Code in custom node is interpreted in a different way HOT 4
- A custom node inside of a custom node HOT 5
- LFO HOT 1
- Support OfflineAudioContext (repeat #8) HOT 4
- How to use in browser. HOT 2
- Thank you so much for virtual-audio-graph
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from virtual-audio-graph.