From the original SynthMaker forum (2004–2014), with its members’ names and dates.
lesobrod ·
Here is a Bell-like sound VST instrument.
In fact, there are many ways to make such sounds.
Most of them more simple and use less CPU.
But this one has follow interesting features:
- real physical simulation synthezis;
- fully natural, nonlinear ADSR, without any artifical time modulation;
- harmonics interaction as in real bells and bowls;
- code and modules structure can be easy changed for some crazy experiments. 😮
VST schematic consists of 13 😈 identical, synchronized modules - harmonics.
Every module include two main parts - Attack OSC and Main OSC.
Interaction between them made accordingly to real vibration theory equations
and produce sine oscilation with tunable attack time, decay degree, sustain with vibratto
and release up to 1 minute.
Every harmonic module links with two neighbours for producing harmonics interaction.
(If someone would like to know detailed how code works, just let me know.)
Parameters for harmonic are:
- Harmonic coeff (base note freq multiplied by it);
- Volume in dB;
- Balance.
Attack, Decay and Release parameters are general for all OSC, but not the same exactly.
Big blue knobs set values of ADR for first, base OSC.
Little grey knobs set, how parameter will be changing from one harmonic to another.
I choose simple "power low" which close enough to real bell-sound responses.
For example, let we set Attack time knob to some value, T0 and corresponding Power knob
to -1. This means, that first harmonic will have attack time T0, second - T0*(HarmCoeff_2)^(-1) == T0/(HarmCoeff_2),
third - T0*(HarmCoeff_3)^(-1) == T0/(HarmCoeff_3) etc. ( For real bells, both attack and release time
decreasing while frequency rising.)
Detune knob set vibrato freq for Sustain stage. Parameter "K" set degree of harmonics interaction.
As ADR, they can tuning for all OSC by power low.
If Sustain trigger sets to "Off" (grey), there will no Sustain stage and sound will be like after one struck by bell.
If Sustain "On" sound will be produced all the time while key pressed (and then Release stage).
For to make sustain sound more interesting, slightly random vibrato are used.
Min, Max and Rnd knobs set color of vibrato effect.
Vibration theory show that more than 3 linked OSC may sometimes behave non-predictable,
especially when K is high.
(Very interesting but unstable sound appears if linear harmonics interaction low
k*(x-prev-next) in code replaced by some non-linear).
To avoid ears damage 😠 , VST contains limiters in every code and one for the all output.
Normally all values must be between -1 and 1 so limiters not affect.
If sound starts clicking or just stops, use Reset button and change parameters.
This is my very first VST 😇 , so please be patience, but any practical criticism and advices
are welcome.
Many thanks to all forum people, escpecially trogluddite, infuzion,Megahurtz,stw,tor,..
For GUI part I use practical sliders and knobs from TekTooG and peppermint' collections.
tektoog ·
FIrst thing that comes to mind, IMHO, is too many knob styles...
Stick with variations of one knob style... 2 at most I would say...
I prefer also dark backgrounds, as when you work a long time with the same GUI, it's better if it does not leave you with white dots in your eyes when you stop looking at it...
The sound is cool, but the presets sound too similar too each others to really see the potential of the synth...IMO...
Presets restore fine, midi learn for control would be nice...
Good job!
Keep on going!
infuzion ·
tektoog wrote: FIrst thing that comes to mind, IMHO, is too many knob styles... Stick with variations of one knob style... 2 at most I would say...
NOthing wRong with tOO maNy kNob SYLes!
What is that top number above the volume for?
lesobrod ·
I'm work with GUI very little.It is just example, not presentation 😇
Will try to unificate styles!
infuzion wrote: What is that top number above the volume for?
It is harmonic factor. Classic instruments have 1,2,3,4,.. harmonic series;
but,e.g. pan-flute has only odd harmonics.
Bells have not only harmonics, but many overtones. Their factors are nor integer,
nor even rational. They are combinations of Bessel function roots (as harmonics are
combination of sine roots).
trogluddite ·
Like it - the 'struck metal' sounds have a lot of realism, and with a bit of tweaking 'wooden' sounds also. The 'physical model' method has a lot of potential, I am very keen to see where you take this.
It is maybe a little too easy to create unstable sounds that do not decay - a tricky proposition for many users, though personally I find some of the 'edge of instability' effects very interesting. It is potentially very useful for 'sound design' type work as well as more tonal uses.
Physical models will naturally be more CPU intensive that more conventional methods - but looking at your schematic, there is a lot of room to optimise the design by combining modules or the use of assembly. A 50% or more reduction would be a quite realistic target, and the modular design makes this less work than you might think. Once you have perfected your algorithm, you can get some help with that if you need it - optimising code/assembly does not always require that the helpers understand all of the underlying maths theory.
tektoog wrote: The sound is cool, but the presets sound too similar too each others
It does take a bit of wrangling, as the interface is less immediate than a regular subtractive synth, but with some patience much more variety is possible. Here is a little download including a few presets I made with an hour or so of just messing about...
cyto ·
I really like the sound of this instrument, but it does eat up a lot of CPU. I find myself going to the "reset" button quite a bit (then again, I'm testing this on my little netbook, which craps out pretty easily).
Lesobrod, can you explain a little bit the "conceptual" idea behind the envelopes? I've tried to deconstruct what's going on, but all of the conditionals and interaction have me a bit baffled. The reason I ask is that I have been experimenting lately with "responsive" non-linear envelopes (that don't rely on counters and are extremely CPU-lite) and I think some of my ideas could be incorporated in this instrument to significantly cut down some of the processing requirements. Without fully understanding the maths involved in the envelope scheme, I'm a little scared to go in and start experimenting.
-cyto
lesobrod ·
cyto wrote: I'm testing this on my little netbook
Yeah I'v got C2D 2Hz x 2G old notebook.
It seems such software as Wolfram Math, Adobe Audition and Synthmaker (compliment to SM? ))) )
take so CPU so they need. So in "safety low CPU" regime, my synth eats up to 40% CPU;
but on "full power" and as VST on Reaper it eats only 15% that's not bad for 13x2 OSC's.
cyto wrote: Lesobrod, can you explain a little bit the "conceptual" idea behind the envelopes?
Well firstly we have simple sin osc (w = sin(freq)/2):
http://www.dsprelated.com/dspbooks/pasp ... ators.html
Let it will be Attack:
x_att = x1_att +w*y1_att;
y_att = y1_att - w*x_att;
x1_att = x_att; y1_att = y_att;
Secondly, damping sin osc. http://en.wikipedia.org/wiki/Damping
After some shamanism, here the code for decaying sin (d - coeff of damping, w = sin(freq)/2):
a = (1-d)/(1+d); b = w/sqrt(1+d); (This is my little invention)
x = a*x1 + b*y1 ;
y = y1 - b*x;
x1 = x; y1 = y;
If we would "pumping up" this damping osc by some simple sin oscillatior, real Attack process would happen:
http://demonstrations.wolfram.com/Drive ... scillator/
y = y1 - b*x; ==>> y = y1 - b*(x-x_att);
And after Release it decaying exponentially.
Well I learned vibration theory by Landau/Lifshitz and Arnold.
But it seems that there are many good books and net resources in English about dynamics,
acoustics and chaos theory 😀
And later I'm going to post some another weird and terrible schematic 😈 with the same principles but
only with 2 - 3 OSC's so the processes should come more clear.
lesobrod ·
trogluddite wrote: there is a lot of room to optimise the design by combining modules or the use of assembly. A 50% or more reduction would be a quite realistic target
Thank you Trog for really crazy presets! 😀 😀
But what about CPU.. It seems only converting to ASM makes real effect.
I've not found what can be improved on schematic structure 🙁
trogluddite ·
lesobrod wrote: But what about CPU.. It seems only converting to ASM makes real effect.
Sorry, i wasn't terribly clear about that.
It is when converting to asm that collecting small modules into one larger block makes the biggest difference, but there can also be a useful saving with code or even stream primitives.
In fact, reducing the number of 'links' would have been a better way to describe it...
Each stream link is really a memory address storing a value for the connected parts to use. So, every time there is a stream link, there must be some instructions (movaps), copying the values from the link into (or out of) the modules or primitives at each end of the link. Combining modules can therefore reduce the number of times that the data has to be moved - especially with assembly, where some values might be kept only in the xmm registers rather than using temporary variables. (the links can also be thought of as 'temporary variables')
When there is a very large number of stream links, it is even more important to consider this, as the number of memory addresses required can easily exceed the size of the CPU cache(s) - this can lead to cache misses (where the main motherboard memory must be accessed), each of which can cost dozens of clock cycles. Even a small reduction in the 'memory footprint' can make a useful reduction in CPU 'spikes'.
Also there are a few places where you have (for example) multiply primitives connected to hopped code blocks.
The primitives are never hopped, and nor are their memory transfers to the links, wasting CPU cycles calculating values that the hopped code will never use - therefore, you can save some CPU by bringing them inside the code blocks
lesobrod ·
Well I start to work with optimization, presets and stability.
Sales clerk in Yamaha' shop plays "on" this VST using good MIDI keys, Reaper
and big B&W speackers; and sound was good and powerfull.
But GUI will stay simple, just more "homotypic" (Is there such ambiguous 😉 word in English?)
cyto ·
lesobrod wrote: Well firstly we have simple sin osc (w = sin(freq)/2)[...]
Secondly, damping sin osc.[...]
If we would "pumping up" this damping osc by some simple sin oscillatior, real Attack process would happen:
Interesting. The use of "damping" is a technique that I hadn't considered before. I will definitely look into that more.
One thing concerns me, though. It seems this whole oscillation scheme is built on a self-resonating (infinite Q) filters, right? This type of sine-wave generation is perfectly fine for low-frequency oscillation, but things get a little unpredictable as the frequency moves up through the audible range. Things go completely out of control as you're hovering around .5 normalized (or PI if thinking in radians). Look at your starting equation. If you insert those values into it, you get zero output. When you are generating "overtones," chances are pretty good that you will be operating in that crazy area. Here is a little demonstration:
Now, in your synth, It's hard for me to pick out that instability (at least audibly). But I'm wondering if the "inharmonic" nature of the additive architecture is masking it. The reason I bring it up, is I am very interested in this "sympathetic" additive synthesis approach and the use of oscillating filters would be a nice weapon in the arsenal, if it weren't for the instability in the (higher) audible range. I would imagine any solutions would be very sensitive to different sample rates. It's a little hard to follow your maths from box to box in the schematic (especially when the "envelope" is integrated into the oscillator). Have you addressed the instability of the oscillators? If so, could you explain a little about your approach?
-cyto
lesobrod ·
Many manu thanx 😀 😀
Making my first VST I got so many troubles with Poly and Envelopes,
so just made a great mistake in simple math. But your .osm has also some mess. 😉
Exact formulas here:
Let F - frequency in Hz, SR - sample rate, PI = 3.1415926.
Then normalized freq NF = 2 * F / SR;
Coeff W = 2 * SIN( PI * NF / 2) (!! Here exact math SIN, not sin1 !!).
And then
out=out1+y1*w;
y=y1-w*out;
out1=out;
y1=y;
Look at the FFT and you will see that now it's all OK even for 22000 Hz.
New version of Bell sound will have wright values of freq.
But the real reason of instability not in this mistake, but in the harmoincs interaction.
In a couple of days I'll try to post some interesting yet simple example about OSC interactions.
cyto ·
lesobrod wrote: Look at the FFT and you will see that now it's all OK even for 22000 Hz.
Much better!
...but 😉 be careful with the volumes of this function (especially over .5). You can't really see it on the graph, as the graph is only scaled -1 to 1, but the filter osc does start shooting up in volume at higher frequencies (and to a lesser extent, decreases in volume at lower frequencies). Shouldn't be that hard to come up with a fix: volume curve as a function of normalized freq, or something.
That is an excellent little oscillator, though!
-cyto
martinvicanek ·
cyto wrote: ...but 😉 be careful with the volumes of this function (especially over .5). You can't really see it on the graph, as the graph is only scaled -1 to 1, but the filter osc does start shooting up in volume at higher frequencies (and to a lesser extent, decreases in volume at lower frequencies). Shouldn't be that hard to come up with a fix: volume curve as a function of normalized freq, or something.
-cyto
The oscillator is a staggered update type, sometimes referred to as magic circle. You have to initialize the recursion properly else it won't be a (unit) circle:
Since "out" and "y" are nearly orthogonal (except for high frequencies), the oscillator will tolerate some moderate (not too fast) modulation, i.e. the amplitude will not explode.
P.s. Actually you can save two lines in stage(2) by performing the recursion on out and y directly, omitting out1 and y1.
lesobrod ·
Yeah... It seems that guy who post this
http://www.dsprelated.com/dspbooks/pasp ... ators.html
check these processes out on old calculator, or even on abacus... 😕 😕
All of them behave very strange. And it's not SM problem;
Wolfram (with 32-digit accuracy) show almost the same.
Iteration #1 has very good tolerance to freq modulation,
but has non-zero damping, so amplitude slowly fall (or rise(!) ), ~1% per minute.
So this one suitable for Poly synths, where work time of OSC less than several min.
Iteration #2 (even with martinvicanek's optimization) non-stable to frq changes.
And iteration #3 is a b*****it at all.
In fact, digital iterations often show weird behavior as result of interaction
many types of errors - discretization, rounding, noise from hot processor 😉 etc.
Well I very very like such researching anyway.
By the other side, even if some process not correct in exact math sense, it can help us
to make new, exotic sound, so many thanx for attention, to be continued 😀 😀
Wrote something here? To have a post removed or your name hidden, write to [email protected].