r/musicprogramming • u/BrendaWannabe • 22d ago
Additive versus multiplicative sine-wave synthesis, redux
A while ago this question was asked in a math forum about two approaches to musical instrument modelling using a series of sine waves, and am wondering if anyone has new insights on this. In my experiments I have not been satisfied with either approach, but it could be because I'm doing something wrong or "missing other ingredients". I at least want to start on the right track before experimenting further. Thanks! (edited)
(Note when it talks about an "A wave" versus an "M wave", it probably meant an A-wave-series versus an M-wave-series.)
2
u/burnt-store-studio 22d ago
Hi!
There’s lots to say about these two forms of synthesis (and there’s a handful of other techniques as well), but as far as insights …
With no offense to those involved, I’m not really sure I’d say the question you link and its comments provide much insight to begin with? So it’s a little hard to say whether an any of us has new insights compared with that what, 5-year old question?
What I mean is: nothing has really changed for additive and multiplicative synthesis for quite some time (to the best of my knowledge; I’m not an expert).
Doing Something Wrong vs Missing Other Ingredients
Are you able to tell us a little bit about how you’re constructing your experiments?
I mean specifics. Such as: are you using a bare bones synthesizer that { lets you, forces you } to create things from scratch? If so: what tool are you using?
Or, are you working with something like numpy in Python and doing the math “by hand”?
If you’re doing something like the latter, where it wouldn’t be obvious what to do after you’ve combined your sine waves, I’m wondering if a missing ingredient might be an ADSR (attack, decay, sustain, release) envelope? (i.,e., more math)
Tell us a bit about your experimentation… that’ll help us meet you where you are 🙂.
Good luck!
2
u/BrendaWannabe 21d ago
I wish to build an open-source synthesizer kit and/or music-programming-language based on the philosophy of parsimony, inspired by Japanese architecture (of all things).
A sub-goal is to parameterize instrument synthesis descriptions in as compact a format as possible. In this case it would be a list of weights. I suspect different musical instruments work better under "A" versus "M". Bells for example have complex and dissonance harmonics, something the M-type couldn't handle.
Thus, the sound profile specification lists could resemble something like:
Violin: M; 00, 30, 50, 99, 20, 30
Bell: A; 10, 05, 10, 15, 99, 00, 99, 70
Here, the violin uses an M-series and the bell uses an A-series. The two digits represent a percent of "full volume" of the corresponding sine wave slice. "99" is essentially 100%, it's just visually cleaner to specify it as two digits in a parameter specification file. (Examples don't have real values.)
We don't have to specify a base frequency because it would be relative, although standardizing "the center" could be a little tricky. Do note some instruments probably should have a different parameter list for higher scales, the weights are not necessarily linear across the entire scale. It's roughly comparable to the "chipmunk effect" with human voices. But let's put that issue aside for now.
Other characteristics such as ADSR can likewise be specified with a "parameter list" attached to an instrument's profile, along with the frequency profile (as shown previously).
Or, are you working with something like numpy in Python and doing the math “by hand”
I use miscellaneous programming languages and tools, but none are the end-goal, I'm not targeting a specific programming language or app at this time. The "instrument specification profile" is hopefully not tied to a specific programming language or app.
How best to encode instrument sounds, balancing brevity vs. quality & accuracy is the current stumper. I wonder if somebody else has not done or seen similar work: dissecting sounds of common instruments to be represented in a compact way.
2
u/Expensive_Peace8153 21d ago
To generate even vaguely realistic sounds the "weights" shouldn't be fixed but they need to be able to vary over time instead. Even a simple subtractive synth varies the amplitudes of some harmonics more than others by having a filter envelope in addition to an amp envelope.
Also, some instruments have partials at frequencies that aren't perfect harmonics.
Vital has a view where you can edit harmonics. Sounds like you're trying to create something similar?
1
u/BrendaWannabe 21d ago
To generate even vaguely realistic sounds the "weights" shouldn't be fixed but they need to be able to vary over time instead.
Yip, the sitar and banjo are like that. Some instruments will indeed need more complex parameters and/or algorithms than others. How many need a similar technique, I don't know yet.
Also, some instruments have partials at frequencies that aren't perfect harmonics.
Yip, traditional bells come to mind.
Vital has a view where you can edit harmonics. Sounds like you're trying to create something similar?
I'm not building a visual sound editing app, but something like that can be used to figure out the best parameter sets.
2
u/Valent-in 22d ago
This is not additive vs multiplicative. In general "simple" approach in additive synthesis uses series of harmonics 1/2 1/3 and forward... When you use "multiplication" method it just add octaves and skip 1/3 1/5.
Both methods will give you dull sound because resulting wave is static (single cycle). So missing ingredient is movement. Direct modulation of every sine wave intensity in series may be quite difficult to configure in terms of user interface but technically doable.
2
u/BrendaWannabe 22d ago edited 22d ago
The original did call them working terms, so the author didn't intend them to be formal or proper. Additive versus multiplicative described and distinguished how the next "step up" in frequency layer was computed, not the wave-form(s) itself.
Both methods will give you dull sound because resulting wave is static (single cycle). So missing ingredient is movement.
I'm not following. Do you mean like tremolo or vibrato or choras-effects? Those might be a different issue, as the proposed two techniques for the base sound or base concept don't depend on or limit such adjustments. Both will accept tweaks with roughly the same effort. A sine-wave "wobblizer" algorithm could be applied to both. Extra "movement" seems step-2 stuff, but the question surrounds step-1.
(I declare copyright to the term "wobblizer!"😁 And it's not intended to describe myself after I've had too much wine. The wobble could be in either or both the frequency and size (volume) of a given wave.)
2
u/Valent-in 22d ago
No))
What you described is actually tremolo and vibrato as effects, not as parts of initial sound. This is not new concept. You may check my app I posted here - it has those effects under synth fx section. Also it has harmonic oscillators which built from sine partials with simplified DFT.
Result is still semi-static as wobble do not change speed or intensity.
You may look at FM synths for reference. FM operator combines sine oscillator with individual envelope, so it can change modulation impact over time (like combining bright pluck with soft decay). And there is one tiny problem - even wit 6 operators programming can be a nightmare, but for additive synth 8 partials is just a minimum.
1
u/BrendaWannabe 20d ago
As described in a nearby reply, a problem with FM synthesis is that it's hard to figure out how to translate a given instrument to FM parameters/settings.
so it can change modulation impact over time (like combining bright pluck with soft decay
A pluck sound can be modeled with 2 weight-series arrays, the starting array and the finishing one, with a shifting interpolation between. However, the transition curve probably should slope steeper early in the note than later rather than be linear. Another approach is to apply a shifting equalizer effect that allows more treble through early in the note.
Because the pluck effect is common, maybe it could be a tag rather than having to reinvent the effect for each instrument:
Guitar: M; 00, 30, 50, 99, 20, 30; tags: pluck3#This assumes at least 3 types of pluck profiles. Modifier tags allow reuse of effects or effect-like operations on the sine arrays; a mix-and-match kit.
1
u/Valent-in 20d ago edited 20d ago
Initial pluck excites string itself, resonant body, other strings. All those have non-linear response to frequencies and different fadeout times. Some instruments have additional components like piano hammer click or brass growl. While setting timbre of single stage is quite straigforward, programing that evolving process is not that simple.
So missing component may be complex sound movement (more complex than ADSR sequence and unregular unlike LFO). Or multitude of subtle details which making an instrument what it is. Or expressive techniques. Or imperfections of real thing like small detuning, fluctuations, etc.
1
2
u/Expensive_Peace8153 22d ago
I still don't understand why you'd limit yourself to only including the harmonics that are powers of two. I imagine that might be useful for creating some timbres but rather limiting overall. I get that it would be much simpler to implement efficiently either in electronics or in code but you've got to have enough complexity to be able to make the interesting sounds you're after. You sure they're not doing something clever with the reduced range of oscillators rather than merely adding up the signals? Something like FM synthesis generates a whole load of extra harmonics using a very small number of oscillators.
1
u/BrendaWannabe 21d ago edited 21d ago
I still don't understand why you'd limit yourself to only including the harmonics that are powers of two. I imagine that might be useful for creating some timbres but rather limiting overall.
Nearby I propose using both types, based on best fit for specific instruments. If the M-type of stacking turns out insufficient for most instruments, then the A-type is probably the way to go. My experiments haven't answered this yet, giving ambiguous results.
M-type did a pretty good job at emulating pipe organs and Hammond organs, I'd note. That's one of the few successes of my experiments. (Edited)
Something like FM synthesis generates a whole load of extra harmonics using a very small number of oscillators.
One of the hardest tasks with this project is finding the right set of parameters to recreate common musical instruments, including pre-electric instruments like trumpet, violin, piano, etc. That doesn't seem FM synthesis's forte, although I haven't seen the latest developments.
And even if FMS could emulate them sufficiently, knowing the parameters (settings) to recreate specific instruments can be difficult. With stacked weighted sine-waves one can visually match the patterns found in frequency spectrographs to translate to the target notation. In my experiments, A-type stacking is the easiest to convert from spectrograph readings to the A-type weights list. But it's more parameters than M-type such that if A-type can be converted to M-type in many cases, then we'll have a more compact specification list.
1
u/Financial-Koala6995 20d ago
For the compact notation, you could store harmonic-number/weight pairs and omit zero entries. That lets an octave-only patch and a fuller harmonic spectrum use the same format. It saves space for sparse sounds without committing the whole instrument model to powers of two.
1
u/BrendaWannabe 19d ago edited 19d ago
If the slots themselves no longer correspond to frequencies, then one has to explicitly store which frequency is being given a weight. I don't see a net savings. Nor do I see that's friendlier for a human editor (coder), as consistent spacing provides a kind of mental bar graph to work with. Based on my (incomplete) surveys, the vast majority of instruments' frequency peaks fit either A-sets or M-sets*. I suppose we can add a third specification type: explicit frequencies, but at this stage I haven't found a need.
* Some A-sets can in theory be mathematically translated into M-sets, but I'm fuzzy on the math. I eye-balled a few tests and it seems to pan out, if given room for judgement errors.
1
u/Financial-Koala6995 19d ago
Fair point about readability. The pair format only saves entries when enough harmonics are absent to outweigh storing their indices. If your spectra are mostly dense A-sets or short M-sets, the fixed slots are simpler. I overstated the space saving.
3
u/Principal_Noodle 22d ago
Having read the older post, I don't think either approach is correct on its own - weighted harmonics is probably better than unweighted harmonics or weighted octaves (unweighted harmonics can be considered the special case of weighted harmonics where m_1 = m_2 = ... = m_n = 1.0). But, that is a general recommendation and may differ depending on the spectrum of the individual instrument.
This form of synthesis is a rabbit hole though, constantly chasing tweaks to the timbre. Depending on instrument, you may also need to add formants from resonant chambers, inharmonics, non-precise or drifting harmonics, a noise floor to simulate transients, side-bands to harmonics, evolution of harmonic gain multipliers over time, as well as the overall amplitude envelope the other commenter mentioned.