Closed gtaylormb closed 2 weeks ago
Is this a possible bug in PPPlay too maybe? I tried to follow your changes, but I don't understand any of the code.
Is this a possible bug in PPPlay too maybe? I tried to follow your changes, but I don't understand any of the code.
No, ppplay appears correct. The issue was I was missing a shift in the phase increment (the right shift by 1 after the block shift), and I was dropping off the bottom 10 bits of the phase accumulator instead of the bottom 9 bits for the final phase. This bug has existed in my code for the last decade or so.
Good thing you found it.
A lot of red herrings debugging this fix. Spent most of the time thinking this was an envelope issue, as discussed here: https://github.com/gtaylormb/opl3_fpga/issues/47
Turns out the OPL3 is generating a ~22-24KHz sine wave after ~0.02s, which gets filtered out post DAC by the LPF (and obviously you cannot hear it). I was truncating an extra fractional bit in the phase generator. This may or may not have an audible effect on "normal" music but it is a positive fix either way.