Print

To play 8 bit samples on an OPL2 there is a simple technique to use the test bit to freeze the voltage output from the chip, which can then be controlled by setting the lower 8 bits of the frequency to an 8-bit sample value. 

The original trick was written by Mitsutaka Okazaki.
https://github.com/digital-sound-antiques/emu2413/wiki/DAC-in-test-mode
 
Some background info from Grauw, who helped me get this trick to OPL2. 
https://www.msx.org/forum/development/msx-development/limitations-msx-music?page=2#comment-371119
 
Details on TEST register and the undocumented bit 2 function
https://siliconpr0n.org/archive/doku.php?id=vendor:yamaha:opl2
(if 1, resets (and holds, while active) the PG count for Car/Mod at 0 )
 
You can in fact simply write an 8 bit unsigned sample to a channel when the test bit is set (after a bit more preparation) at a proper sample rate and you will hear the sample play. However, the voltage is taken from the sine table on the chip, and that has a slightly different output than you might expect if you were dealing with a linear type of relationship with your unsigned value (you know, $80 being silence, 0 most negative output and 255 most positive). 
The result is that samples may sound slightly different, a bit more "sharp". Grauw took a look at the outputs and constructed a table that accounts for that internal chip look-up. 
 
Here I compare the two methods. The fast, don't look up, just output the sample method, and the Grauw's table method. (Of course, you can convert your samples using Grauw's table before and then still have a fast no-look-up method, but it takes an extra step. 
 
I take a simple approach, play a sample that goes from 0 to 255 and then back to 0 in steps of 1, and that 4 times. I do it without Grauw's conversion and with that conversion. 
 
 
The picture above illustrates how well Grauw's table is doing the trick. Note that the non-converted left wave is a bit louder, but not in proper phase. Where you would expect a maximum (positive or negative) at end of each half of a period, this is the case only after conversion, you see two quarter sines (inverted). So Grauw neatly matched it to the quarter sine output table on the chip. :) 
 
Will you hear a lot difference in the samples? Probably not, especially if you don't know how it should sound. But to the trained ear, there is a slight difference. Nothing to worry about. But we do want things to be perfect. So great work, Grauw!