• Please review our updated Terms and Rules here

Best Place to Ask about Adlib OPL2 "math"?

chjmartin2

Experienced Member
Joined
Dec 26, 2012
Messages
433
Hi,

I am playing a bit with Adlib programming but really looking for how to model the various outputs. I found this link which is great as it shows the actual ROM tables used to create the 8 bit output. It also provides a cryptic (at least to me) formula of:

out = exp(logsin(phase2 + exp(logsin(phase1) + gain1)) + gain2)

I have figured out the math on how to calculate the output frequency based on Block and Fnum and know that the card operates at a sport 49,716 samples per second. Anyway, I am pretty sure this isn't the BEST place to ask for any would-be OPL2 geeks, but I don't know any and about 3 to 5 minutes of their time would be immensely helpful. I'm trying to figure out how to model the 8-bit output based on the various register settings. I know emulators can do that but in my experience unless I walk through and learn all the math I can't accomplish my goals. Ultimately I am trying to build an excel spreadsheet (for a single channel with two operators) that I can input the register values and it spits out the expect 8 bit output. Certainly I am willing to do the work but the above equation has me stuck and I am not certain that this is exactly how it works, plus the above doesn't even give me insight into the ADSR envelope either. Like I said, its a long shot. I have read every programming guide I can find on the topic and they have been useful in knowing how to program the Adlib - it doesn't help me get all the way there to the absolute math of it all. My next option is to try to decipher emulator code but I'm not a C guru to say the least. Any ideas?

Thanks,

Chris
 
Back
Top