Talk:OPL chip

From ModdingWiki
Jump to navigation Jump to search

Does changing the frequency just after a note-off cause a pitch bend for those instruments with lengthy release rates?

I have not verified myself, but I am pretty confident that triggering a note-off only affects the envelope generator, not the phase generator. Thus changing the frequency register should always affect the frequency. This is how every emulator I have seen works. It should be easy to test and verify with Scream Tracker for example.

You might have to be careful with Scream Tracker - its Adlib support seems a bit weird. The F-Numbers seem a bit off and other strangeness. I think you are right though, I just would like to test it for real to confirm. -- Malvineous (talk) 03:14, 20 July 2013 (GMT)
Confirmed by directly poking registers that after turning the key-on bit off and changing f-num of decaying sound, the sound frequency does change. --Kermes (talk) 18:58, 25 October 2013 (GMT)

About frequency/block/multiplier numbers

It is true that for best match of any arbitrary frequency, one should select FNUM as high as possible and adjust BLOCK accordingly to get the correct octave. But since the chip is most often playing musical notes with 12 notes per octave, a simple music player could just have a 12-entry FNUM table where note A equals to FNUM 580. Then the selected octave is just selected with BLOCK value, for example 440Hz note A-4 is FNUM 580 at BLOCK 4, and 880 Hz note A-5 is FNUM 580 at BLOCK 5. Taking a look at how the key level scaling and key rate scaling are done with different BLOCK and FNUM ranges, the chip is really meant to be used like this, and it is also the easiest way. The hardest part is to decide the NOTESEL bit, which decides whether to use FNUM bit 8 or bit 9 to determine if a note belongs to upper or lower half within an octave. Some music players may just ignore these hardware octave split points and just use 8-bit FNUM values with high FNUM bits being always 0b00 or 0b01, most likely not many will hear the difference of lower frequency granularity.

Coarseness of frequencies is not an issue with musical notes, as difference between two notes at octave 5 is relatively larger than in octave 4 anyway, so changing FNUM value by +/- X always results into pitch bend of +/- Y cents regardless of octave. This method allows a span of 8 octaves (96 notes) out of MIDI's 128 notes (nearly 11 octaves that start from -1). To extend the scale for lower notes it is always possible by scaling FNUM values down, but it is not possible to have higher notes like A-8 just by changing FNUM and BLOCK. There is a catch though, explained below.

Basically the chip calculates a per-channel phase increment from FNUM and BLOCK values, and each operator has separate operator multiplier for the channel increment. When BLOCK is 1, the FNUM is directly used, and when BLOCK is 0 the FNUM is halved, one bit shifted away. So a tone with BLOCK 0 FNUM 1 would not advance at all, while FNUM 4 BLOCK 0 would equal to FNUM 2 BLOCK 1 for example. If higher tones like A-8 is wanted, just set the FNUM and BLOCK to A-7 and use operator multipliers to scale the modulator and carrier frequencies up by 2. Equally A-9 is just A-7 base tone with a timbre that is multiplied by 4. This sort of matches real instruments or MIDI sounds nicely, as single patch or timbre does not always span full 128 notes. A bass guitar could span 8 lower octaves only and lead guitar could span 8 higher octaves only. Setting the multiplier to 0.5 will again just shift away one bit from the per-channel base increment, while 1x multiplier just uses the base increment as-is. So even a tone with FNUM 3 BLOCK 0 MULTI 0.5 won't advance at all as the two FNUM bits are lost.

Very interesting, thanks for the explanation! I had not even thought of using the chip in this manner. I hope you will consider adding this to the article - if not I will try. -- Malvineous (talk) 03:14, 20 July 2013 (GMT)

Waveform images

The 8 graphics of the waveforms appear to have been captured from the audio output, they exhibit both a dc bias, and a drift which is not present on the actual chip digital output. The digital waveforms are centered at 0, the flat parts of the waveform are stable and remain at zero (except for the square wave which is either fully positive or fully negative). It should be trivial to create more accurate graphics from the digital outputs. I have some digital captures that would be suitable. Carbon14 (talk) 13:41, 30 September 2014 (GMT)

If you can get more accurate or clearer images then by all means. Bonus points if you can make them SVG! -- Malvineous (talk) 23:12, 3 October 2014 (GMT)
I have 8 svg images available. Having trouble uploading them. "File:OPL Wave0 Digital.svg" is uploaded but the wiki failed to auto-create a thumbnail.Carbon14 (talk) 07:59, 6 October 2014 (GMT)
Sorry about that, the server was missing a few packages needed to do the conversion to png. Should be working now! Feel free to use a brighter colour/thicker line, dark green on black might look like an oscilloscope but it's not the clearest colour combination... -- Malvineous (talk) 15:13, 6 October 2014 (GMT)