-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement nonlinear FDS DAC from plgDavid #80
base: master
Are you sure you want to change the base?
Conversation
I just noticed the footnote about FDS in #7. I will leave it to you to close this PR or not. |
From what I've seen, the nature of the FDS' DAC is that it's a resistor ladder where some of the resistors are a little off from their spec value, creating deviations from linear that have power-of-two groupings. So, I don't think I like simulating this with a magic table like that, which attempts to replicate one specific machine. The FDS recordings i've seen varied from machine to machine, some much closer to the ideal than others. What I'd rather do is have a model that can be made to produce that table and others. In theory, we should be able to closely model that table with an input of 6 resistor deviation coefficients. Maybe an advanced user could specify all 6 custom, to try and match whatever their system they want to match, but for regular users I think we could provide 1 or 2 preset coefficients + a slider that scales them from 0 to 200% or something like that. (Default to 0%) Also, can you provide a link to reference about plg's table? I notice a comment in your code about "NESDev server", but that doesn't constitute a reference that anyone can follow. If this is referring to a conversation on a discord server, I think it's quite problematic to use that as a reference. Can the data be discussed on a public and less ephemeral forum like the NESDev BBS instead? Links to threads there work much better as a reference. |
i'll have to ask him to post his recordings on the forums, ultimately it's not really mine and he was kind enough to share the voltage capture on the NESDev Discord server. i converted the voltage capture into averaged values for each level using some python scripting. recently, he's recording another DC voltage capture of the FDS running a beta version of the MDFourier FDS, so i may get around to working on this implementation more once data shows up. |
This is tapped directly in DC land on the 2C33 audio out (prior to filter). Will need to check on my four other devices how much that DAC's components vary. |
Thanks for the info! |
wouldn't this also apply to 2A03's (and maybe MMC5's) nonlinear DACs as well? last year, org from BreakingNES shared a model of the 2A03 nonlinear DAC in the NESDev server: |
Possibly. The 2A03 isn't using a measured table, it's using the formula given by Blargg years ago. A few years ago I attempted to measure and re-evaluate that model (thread) but I couldn't really come up with something better. BreakingNES' approach that you linked might be useful for improving that model, though these things always need to be compared with recorded output to see whether there are unchecked factors. The 5B emulation has a table in its implementation, but it's a much simpler one, and IIRC it's formula generated except for the highest value which appeared to be clipped when compared to hardware. Though, I was recently looking at emulation of the same chip family in Hatari, and there were some really interesting theoretical notes I have to follow up on there, which might apply to the 5B as well. In Hatari, the implementation based on the theory does not, in my opinion, match the reality of the output, and the sound quality was very poor as a result, but I want to do better than just throw out the prior work. Need to write a test, etc. |
Yuri213212 from the NESDev Discord server has published his study on the FDS DAC both on the server and the forums: while in the process of developing MDFourier FDS, i have updated Mesen2's emulation according to loopy's research in 2019 and have recreated the aliasing found on hardware. i might implement it here too. |
This PR aims to implement the nonlinear FDS DAC, based on DC capture measurements from plgDavid.
The new FDS output has a dB RMS delta of +0.01dB compared to before, though I think that might be precision errors from the previous function.
Changes in this PR: