Signal Processing Asked on November 23, 2021
I am just learning about sound so might be jumping the gun a bit. But it helps me stay motivated and get into an interesting problem to solve to ask these more complicated questions.
I am looking at Digital Waveguides, and would like to know how to implement them practically in JavaScript. I am new to all these concepts so have done some basic stuff with oscillators and played with Tone.js, but I am not familiar yet with how and where "digital waveguides" would be implemented in the Browser API situation.
I saw the Sound Synthesis Toolkit in C++, and they have a class in there called Mesh2D
. I’m not sure if that means Digital Waveguide 2D Mesh or what, but it looks like it’s getting close to a hello world example with code snippets like this:
StkFloat Mesh2D :: energy( void )
{
// Return total energy contained in wave variables Note that some
// energy is also contained in any filter delay elements.
int x, y;
StkFloat t;
StkFloat e = 0;
if ( counter_ & 1 ) { // Ready for Mesh2D::tick1() to be called.
for ( x=0; x<NX_; x++ ) {
for ( y=0; y<NY_; y++ ) {
t = vxp1_[x][y];
e += t*t;
t = vxm1_[x][y];
e += t*t;
t = vyp1_[x][y];
e += t*t;
t = vym1_[x][y];
e += t*t;
}
}
}
else { // Ready for Mesh2D::tick0() to be called.
for ( x=0; x<NX_; x++ ) {
for ( y=0; y<NY_; y++ ) {
t = vxp_[x][y];
e += t*t;
t = vxm_[x][y];
e += t*t;
t = vyp_[x][y];
e += t*t;
t = vym_[x][y];
e += t*t;
}
}
}
return e;
}
My question is, how do I implement this "Discrete simulation of the ideal, lossy waveguide" in JavaScript?
They say "sampling these exponentially traveling waves, etc.", and provide this sampling equation:
How do I connect these "dots" into a function that produces a sound on click, using this digital waveguide system? This would help introduce me into the world of implementation of the theoretical sound stuff, as well as the more advanced sound generation concepts. I am mainly confused what the data is supposed to be and how to map it to an actual sound in JavaScript.
Some related links:
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP