complex FM synthesis

GoldWave general discussions and community help
Post Reply
ultrasound
Posts: 3
Joined: Sat Dec 01, 2018 10:13 am
Location: Texas, United States

complex FM synthesis

Post by ultrasound »

Greetings folks. Since this is my first post, hate to go offtopic but there's a little bit of info I think you should know. I am a 17-year-old purely blind user of GoldWave, using the NVDA screen reader for those who know what that is. As such I navigate entirely using the keyboard and cannot visualize the waveforms/peaks.
Now that we've got that stuff out of the way, I am attempting to further my understanding and mastery of the complexities of FM synthesis. For this experiment I am using GoldWave to touch frequencies and envelopes at raw instead of going through an emulated FM chip or synthesizer. Obviously the evaluator is in use. I have not yet touched Mattlab, probably spelled that wrong, as I do not know how screen reader friendly it is. By looking at the expression used for frequency modulation I have:
  • noticed that the preset applied is more accurately to be called phase modulation, although if I understand right most FM synths do it via phase modulation simply because it's simpler to implement and works just about the same. Hardware did this and so software I guess had to.
  • created my own testing preset where I have control of the carrier and modulator under the waves section.
  • noticed that when modulating an audio signal produced by chaining periodic waveforms together for envelopes, a smoother must be applied about 10 ms to the left and right of the boundary to avoid odd spikes in the tone.
  • attempted to craft an expression that would allow me to modulate a waveform by another waveform instead of using a tone, so that I may simulate more than 2 operator synthesis, or do two operator with variation in the carrier. At this point I noticed an anomaly that I will cover in this post.
So believing I had static carrier and varying modulator under control I proceeded to craft the phase modulation expression that would allow me to modulate one waveform by another waveform and store the destination in a third.

Code: Select all

wave1(n+y*wave2(n))
Upon doing this with two simple varying tones, one 500 Hz one that fades in for 2 seconds and fades out for 1, and another which sweeps from 0 to 750 for 2 seconds and fades out holding 750 for 1, I noticed a strange effect happening with my result.
It seemed that once the constant part of the modulator, the sweeping one, was in effect, there was some strange sort of fuzz or quantization artifacts being produced in my resultant signal. Turning up the modulation index at y causes them to be even more pronounced. It should produce a simple hollow ringing sound at that point in time, instead it produces an almost warbling steppy broken thing.
Given that I am not a master of FM yet, I would love to know what could be producing these strange artifacts that are corrupting my result. Is my expression wrong? Can I improve it somehow? Is there some kind of internal mixing error? Thinking for a second maybe it's the fault of 16-bit mixing I took to the new file dialog only to discover that I couldn't tell it to create a new file in 32-bit floating point. So at this point I really have no idea what's wrong, but I would love to get it corrected so that I may begin to experiment with multi-operator FM and begin to figure out the relationships needed for the sounds I want, so that I may then take that result and begin applying it to FM chips like an emulated Sega Megadrive and VSTi synths.
ultrasound
Posts: 3
Joined: Sat Dec 01, 2018 10:13 am
Location: Texas, United States

Re: complex FM synthesis

Post by ultrasound »

OK I am aware why the quantization effect is there, because I'm trying to work in terms of n, a simple index integer, instead of t, a variable time, as is used in the other FM equation. I know that n=t/T. However I am unable to come up with an expression to make wave work in terms of t while adding the second wave correctly. I tried

Code: Select all

wave1(t+wave2(n)/T)
but that didn't work either. This time it ramps up into oblivion and makes more of a white noise or buzz. Does anyone have an expression I can try?
DougDbug
Posts: 2172
Joined: Wed Feb 16, 2005 3:33 pm
Location: Silicon Valley

Re: complex FM synthesis

Post by DougDbug »

Sorry, this probably won't be much help. You are more "advanced" than anything I've done, and maybe everybody else too (so far) because nobody has replied. I've only used the expression evaluator presets. And, I've heard of FM synthesis, but I've never studied how it works.

Chris (GoldWave's developer) doesn't seem to visit the forum very often, but if you have a specific question there is a Web-Email form that you can use to contact Chris directly and he can email you back: https://www.goldwave.com/contact.php I've used it a couple of times and he's always been helpful.

My guess would be that you are getting aliasing. That's when you try to go above the Nyquist limit (half the sample rate) and you get "false frequencies". But, that's just a random guess. The ONLY reason I'm guessing aliasing is that it's easy to mess-up. For example, it's easy to write an expression that tries to create a 100kHz sine wave at a sample rate of 44.1kHz. You'll get a lower frequency (something below 22,050Hz that I don't want to figure-out right now) and the expression evaluator will happily make the calculations without warning you. (At least I think it won't warn you).

I know that GoldWave "normally" uses 32-bit floating point, and I'm pretty sure the expression evaluator uses floating point too.

In case you don't know this, 0dB in floating point is 1.0 so most of your sample values should be less than one. Is that what you're finding with the expression evaluator? You can go way-way over 1.0 but you'll clip your DAC (if you play at full-digital volume) and you'll clip if/when you render to an integer format.

With integer formats 0dB peaks are represented as the "highest you can count" with a given number of bits. For example, a 16-bit WAV file (or audio CD) can hold sample values between -32,768 and +32,767 and 0dB represents the maximum

In both cases silence is zero.

When you play a file, the data is converted/scaled (by the drivers) to match the bit-depth of the DAC (which is integer-based) so that floating point, 8-bit, 16-bi., etc., all play at the same volume.

If you Maximize Volume before saving (or before playing) the audio shouldn't clip. (The Maximize Volume effect will bring the amplitude up or down as needed for 0dB peaks.)

Oh... There is "something bad" that can happen with integers... If you go over the maximum count, the numbers will roll-over and actually go negative (because the most significant bit is the sign-bit and because of negative numbers are represented by two's complement). This is MUCH WORSE than clipping. Audio programmers have to add extra programming to force clipping rather than allowing roll-over.
ultrasound
Posts: 3
Joined: Sat Dec 01, 2018 10:13 am
Location: Texas, United States

Re: complex FM synthesis

Post by ultrasound »

I knew most of that, but I did not know that 0DB was represented as the maximum value. Are you familiar with quantization noise? If you've messed with 8-bit pcm data you should know at least a little bit about it. That's what's happening here, because I'm working in terms of the wrong value. I just can't formulate an expression to work with t. Whoever wrote the expression evaluator appendix in the manual is who I need to contact. Thanks for trying to be of assistance though. Am I really that intimidating? I'll check this contact page.
Post Reply