spirit ·
hello, my question is simply how to implement a mathematical equation? for example, i have the math equation of a piano chord(string) and i don't exactly now how to implement that math equation. Any suggestions? Thanks in advance
From the original SynthMaker forum (2004–2014), with its members’ names and dates.
spirit ·
hello, my question is simply how to implement a mathematical equation? for example, i have the math equation of a piano chord(string) and i don't exactly now how to implement that math equation. Any suggestions? Thanks in advance
oddson ·
Welcome to the forum...
The first thing you need to do is extract out the part of the formula that must be run at sample rate (if any) from that which is only required to be run when parameters change.
For example, if you want the following output function:
y[n] = (1 - a)^2 * y[n-1] + (1 - a^2) * x[n]
(which is DSP gibberish and just to demonstrate a point)
You might want to precalculate the coefficients outside the code component rather than have them calculate over and over when they only change when 'a' changes.
In other circumstances you may only need the result of a mathematical formula outside of sample rate calculation. Then you need to use the green data math components only.
Here's an example:
spirit ·
oddson wrote: For example, if you want the following output function:
y[n] = (1 - a)^2 * y[n-1] + (1 - a^2) * x[n]
By this for example, do you mean that i must take in consideration all the variables such as y, a, n, x and so on? Can i somehow, like your example above, write down the equation as is? Sorry if i am asking stupid questions, i am a bit new to this situation.
P.S. what you mean by "...must be run at sample rate..."?
oddson ·
If you are working on an audio signal you want to do whatever math that is not intrinsically part of the audio process outside the code module which calculates at sample rate (i.e. each line is done 44100 times per second if that's your sample rate). You can save a lot of CPU by not making the code module do the same thing over and over when nothing is actually changing.
If the example formula I gave the coefficients (1-a)^2 and (1 - a^2) do not involve the audio signal and should only be recalculated when the value for a changes.
These can then be fed to the code module and calculated.
Note the 'y' output is on the left and right-hand sides of the equation in the code module. On the left the current sample (n) is being assigned from the values on the right. On the right the current value of 'y' is for n-1 the previous output value as the value for the sample n is not yet calculated.
(BTW - 'n' as used by me here is not a variable in the normal sense, it's the current index value of the time series data in the stream.)
There has been talk of a code module for green data for a long time (so that you don't have to chain together math primitives to make complex equations) but I don't think it's high on the developers priority list (if it's on it at all).
I hope this helps. If this is still missing the mark read chapter 5 of the User Guide.
spirit ·
yes, this is much more clear to understand, so my presumptions were exactly as you described, but when you are no sure, you know... you must have support! Thanks, regards
spirit ·
hmm... it's not that easy as i thought... I need to have some vision in front of me to understand how exactly to implement audible math equations. By audible i mean how to make the physical modeled instrument audible. I am in a process of a piano synthesis by physical modeling principles, so my exact question is, when i am building the string(which is the audible section), how to make implementation of the physics(math equations) of the piano string so they can interact with the oscillator? Do i need to make some harmonic summations before implementing the math equations or similar to it?
P.S. The hammer and the dumper of the piano in the synthesis process are in consideration to be replaced by low, high and comb filters, the box of the piano with the FIR filter etc. (just giving a point to understand my question)
oddson ·
Search the forum for 'karplus' and you'll find a fair bit about how to do Karplus Strong synthesis in SynthMaker - I can't recall anyone doing full waveguide stuff but you can at least see a 'MIDI-to-sound' example of a physical modelling synth in action.
For a very basic version start with this thread: [old link]
spirit ·
Thank you oddson, you are great. This may help me much. Thanks again, regards
Wrote something here? To have a post removed or your name hidden, write to [email protected].