by opl3 » Sat Aug 03, 2013 9:49 pm
Hi Sto,
I am not 100% sure if the feedback is a sum of two previous samples, but at least the real chip and my emulation code matched this behaviour in my tests. It can be a coincidence or my test case was so limited that the real behaviour did not show. What I did was relatively simple, I just turned on a waveform at full volume and immediate attack, and the output happened to match. I have forgotten which waveform this was, but am sure I tried different feedback levels. I have to admit if the waveform was squarewave (and phase increment is zero), the real behaviour might not show. This needs re-testing with sinewave. Thanks for the link, I have to read it at some point.
Which op-amp filter you are referring to? Have you got any links, schematics or component values? Oh and a filter that removes DC offset is a high-pass filter, not low-pass filter. YAC512 datasheets don't have any filter, they only have the sample-and-hold buffers. And I have not seen any sound card with YMF262+YAC512 that would have a separate filter made with op-amps, they only have had simple inverting amplifier circuitry (with DC blocking capacitors) to mix YAC512 output with wavetable daughterboard output and then feed that into the mixer chip. The mixer chip might have some filtering and tone controls but that is another story.
Or are you referring to the anti-aliasing filter on a real Adlib card? That I have tried to model with two cascaded IIR biquad filters resembling the two second order low-pass filters, but I think the filter response is difficult to match with real analog filter when digital sampling frequency is only 49716 Hz while the filter cutoff frequency is about 15 kHz. But also other components affect the sound, not just filters. Good thinking about emulating the 10-bit DAC output resolution, I have thought about that too, but I thought the filter alters the sound more so I tried it first. I think for modeling the analog portions the sound should be oversampled, filtered and then resampled to 48 or 44.1 kHz for real-time output. But a sound editor like Audacity can be used to process the sampling rate conversion in non-real time if necessary when making compressed audio files or CD audio tracks.
So that's why the emulation of analog parts has not been the most important thing in my mind. Mainly my thoughts about enhancing the sound output would be to make the emulation core somehow configurable, for instance longer waveform tables with more resolution, so basically the full PCM output could be 24-bit instead of 16-bit. And maybe somehow generate 2x or 4x oversampled output directly, but so that all the timing and noise etc would still work at the native 1x rate, to avoid the possible problems the other emulators have when directly outputing at a resampled rate. Of course selectable emulation of DAC and different filters. The OPL4 and its YAC513 DAC have a third order filter suggestion in the datasheet. And selectable emulation of different OPL chip revisions that have different timing and output resampling, or even emulation of OPL clones that may sound wildly different in some cases.
Edit: After looking at your code comments, I think you have understood op-amps and their usage here wrong. They have open-loop gains (no feedback) in the order of 70-100 dB you mention, but in YAC512 datasheet circuitry, they are used as unity gain buffers, so that the sample-and-hold capacitor sees a very high impedance load (the op-amp input) so the voltage does not sag during hold stage and also in turn the op-amp output can drive a much larger load, such as on-board speaker amplifier chip, line level output or headphones directly. And on my Aztech sound card there is a different circuitry as I explained above, an inverting buffer powered by only +5V and -5V. Personally, I think there is no real need to model the sound of different op-amps. Really, the tolerance of the filter component values can be between 1% and 10% depending on manufacturer and price, which affects the sound more than just an op-amp. In addition, the Aztech had an error in the Ctb capacitor value, it was much too large (by a decade or so?) to keep stereo channels separated, so modeling this error would be way too complex.