ultraabox / ultrabox_typescript

ultrabox source code
MIT License
30 stars 19 forks source link

Yamaha FM Operator Waves #88

Open MainCharacteroftheProblem opened 9 months ago

MainCharacteroftheProblem commented 9 months ago

As suggested by Ruskah. Not putting this on #49 as I feel like it's enough of a different issue.

We definitely can add these, the question is just if we should.

2414-waveforms

MainCharacteroftheProblem commented 9 months ago

apparently there's a lack of information about the sound chip these waves are from (Yamaha YM2414) but that shouldn't stop us from recreating it

leovoel commented 9 months ago

Some of the unipolar/positive-only ones are making me think of the problem Imp pointed out where if you use the current waveforms as modulators, they don't really function the way you expect, noticeably if you use them at lower frequencies. They really would have to be their integrals in that case, which look kinda like this (original function shown in blue, integral in red):

image

(sine and cosine don't really need this because they're (more or less) integrals of each other)

The current waveforms really are incorrect when used as modulators but if we remove them we'll just break people's songs, so probably we would need to add these as new waveforms as well. I don't know what should be the name for them.

Before adding anything it would also be good to compare with existing FM synths (capturing output and viewing it with an oscilloscope and spectrogram), just to make sure we're not doing something completely wrong or unexpected.

wdym-lmao commented 4 months ago

found the names, it's up to you if you decide to add them https://www.tinyloops.com/doc/yamaha_tq5/waveforms.html

leovoel commented 4 months ago

Those plots look interestingly different from these: https://wave.hatenablog.com/entry/2021/09/12/234500

I didn't mention it earlier, but recreating these just from code shouldn't be difficult anyhow - as far as I know, all of these YM2414 waveforms are based only on reading a sine wave lookup table differently (hence the "triangle is made up of sine waves" comment in that link you posted). I believe we should also be able to check what a decent emulator for that soundchip does, which probably will be what I described...

Also I should've moved the "integral" thing to a different issue. Those will likely be computed automatically based on the source waveform, and the existing ones will be usable but as a "legacy" option.