VOGONS


First post, by moon

User metadata
Rank Newbie
Rank
Newbie

I wrote some C++ code inspired by Adlib Tracker ][ and using Nuked OPL3. What I found was that if I just play a series of notes, every note has an annoying pop on start and finish. I have tried a dozen things to eliminate this but nothing worked except one thing, playing multiple channels of audio where note durations seem to overlap, I guess??? causing the emulated chip to never go "idle".

Does anybody understand this behavior and how to mitigate it? I'm trying to write my own music stuff but the popping sucks. Maybe it won't ever come up if you're always mixing multiple tracks but I want to know what you "should" do.

Reply 1 of 5, by Tiido

User metadata
Rank l33t
Rank
l33t

The reason for it is that the phase generator is reset on every new note-on, and it causes an abrupt change which will result in a click. Similarly on note-off- but that can be mitigated by using slower release time, so that there isn't at abrupt disappearing of sound. This is inherent to the chip and you cannot do very much about it.

Overlapping channels helps to mask the clicks and in general having a busy mix. If you have a sustained tone then it will also help not to create new note on/offs but just to change the frequency to whatever note is wanted.

T-04YBSC, a new YMF71x based sound card & Official VOGONS thread about it
Newly made 4MB 60ns 30pin SIMMs ~
mida sa loed ? nagunii aru ei saa 😜

Reply 2 of 5, by mkarcher

User metadata
Rank l33t
Rank
l33t
Tiido wrote on 2025-09-28, 11:50:

Overlapping channels helps to mask the clicks and in general having a busy mix. If you have a sustained tone then it will also help not to create new note on/offs but just to change the frequency to whatever note is wanted.

Just changing the frequency will not re-start the envelope. This might be what you want, but having an envelope per note is one of the features that sets the "advanced" synthesis chips apart from the PC speaker. If you don't want to overlap channels, the best way to avoid popping is making sure the envolope of the previous note is finished before the envelope of the next note starts. You can achieve that by ensuring that there is enough time with the note turned off for the release to complete. So my suggestion (not knowing what kind of sound you want to achieve) would be to use a quite fast, but not immediate release, and using a on-to-off ration of something like 7:1 (one eight of the time, the "KEY ON" bit is clear).

Reply 3 of 5, by moon

User metadata
Rank Newbie
Rank
Newbie

I need to make a comprehensive list of what I tried but I believe that I tried just changing the frequency and also tried manipulating the envelope on-off timing. I'll make a couple tests and post some later. I'm learning C++ while doing this.

Reply 4 of 5, by bakemono

User metadata
Rank Oldbie
Rank
Oldbie

Don't know about Adlib Tracker, but maybe you can manually insert a 'key off' event in the row before each new note, so there is time for the old note to release. Or alternate between two different channels, so each note can fade out while the next one plays. (This is a good idea in general for bells and things like that.)

GBAJAM 2024 submission on itch: https://90soft90.itch.io/wreckage

Reply 5 of 5, by Tiido

User metadata
Rank l33t
Rank
l33t
mkarcher wrote on 2025-09-28, 17:53:

Just changing the frequency will not re-start the envelope.

Yeah, only note-on restarts the Envelope Generator (and Phase Generator). Also unlike PG, the EG will not zero out attenuation on note-ons and current attenuation is used as starting point for the next note. As a result, sounds with slow attacks can have their attacks eaten up if not enough time is given after a note-off for things to quiet down. Slow attacks on new notes can help with clicks too but it won't work for a lot of sounds unfortunately and waiting for a channel to become silent before new note isn't always an option either...

OPL family also has lower resolution on most parameters which isn't helping things either but as far as OPL3 goes, the massive amount of channels will definitely be able to maximise the channel overlap or perhaps alternating, both of which will allow some nice chorus effect when done right. It is unfortunate there are only 2 presets for the release parameter however.

But if one wants to go beyond the original chip then implementing note-ons at zero crossings of the waveform will avoid nearly all the clicks entirely, although with (very) low frequencies there can be significant timing jitter due to the long wavelengths of the waveforms. When I was writing my OPN2 emulator, I had the phase generator reset accidentally missed and it avoided almost all the clicks (remaining ones only came from instant attacks) and it also gave a nice "lively" sound since all the modulation inputs kept freerunning. One day I'll make an "OPN4" and it'll feature per operator PG reset bits just for this sort of stuff, and perhaps zero crossing waits for some things too.

T-04YBSC, a new YMF71x based sound card & Official VOGONS thread about it
Newly made 4MB 60ns 30pin SIMMs ~
mida sa loed ? nagunii aru ei saa 😜