Jump to content

Photo

TIA sound polynomial counters?

tia atari 2600 sound polynomial counter poly counter emulation

5 replies to this topic

#1 StinkerB06 OFFLINE  

StinkerB06

    Combat Commando

  • 7 posts
  • Location:California, U.S.

Posted Mon Dec 4, 2017 1:09 PM

I found most emulators have sound that is accurate to the hardware, and the TIA involves two channels with a 9-bit polynomial counter each. The TIA involves 16 waveshape selections, with most of them duplicated and some silent. These range from pure squares, to buzzy tones, to white noise.

 

But the problem is, every doc I found on the internet does not provide the exact timbral or feedback taps that give the sounds their accuracy. If any TIA emulator developer knows of these, let me know immediately!



#2 Rybags OFFLINE  

Rybags

    Quadrunner

  • 15,261 posts
  • Location:Australia

Posted Mon Dec 4, 2017 11:23 PM

Poly counters = LFSRs (Linear Feedback Shift Register).

 

They can be replicated programatically easily.  With an LFSR the existing value is shifted, 2 existing bits have a formula applied (like XOR) which is used as the incoming bit, and another bit is tapped to use in the audio algorithm.

AFAIK with Atari's use of them with TIA and Pokey the audio algorithm might either use the LFSR output directly or AND it with the flip/flop that toggles at AUDF frequency that if selected by AUDC would normally give a pure tone.

 

There's various length polys, the values generated are predictable and easily reproducable and repeat each 2 to the power of (n-1) samples.

From memory the Pokey polys update every machine cycle but the TIA ones update based on the AUDF value for each voice.  The problem with updating indepdendant of AUDF is that in some situations the AUDF divisor will mean you can read the same sample which gives silent output.

 

 

Not sure if the exact LFSR algorithms are documented on a webpage but emulator source code would likely have the info required.



#3 iesposta OFFLINE  

iesposta

    River Patroller

  • 3,427 posts
  • Retro-gaming w/my VCS
  • Location:Pennsylvania

Posted Tue Dec 5, 2017 12:46 AM

The current best 2600 emulator, Stella, doesn't get it totally correct. 

An upcoming version will improve the audio reproduction, but of course at the cost of using more processor power. 

 

I read a long text that thoroughly explained the sound generation. 

I don't remember where, but someone here may remember the link. 



#4 stephena OFFLINE  

stephena

    River Patroller

  • 3,020 posts
  • Stella maintainer
  • Location:Newfoundland, Canada

Posted Tue Dec 5, 2017 6:09 AM

IMO, none of the 2600 emulators has ever gotten this fully correct, since they were almost all based on Ron Fries sound code, which, while quite accurate, described sound at a high level, and didn't take interference patterns into account (where each channel interferes with the other).

 

There has been much work done on this over the past year.  It started with a document by Crispy, then my attempt to get it working in Stella, and finally new code being added to Stellerator.  This work is being ported to Stella, and will be present in the next major point release after 5.1.  Some documentation on this as follows:



#5 DirtyHairy OFFLINE  

DirtyHairy

    Moonsweeper

  • 270 posts
  • Location:Germany

Posted Tue Dec 5, 2017 1:42 PM

The only full "documentation" of the audio generation logic that I am currently aware of:

  • Crispys audio code (available in the old new-sound branch in the Stella repo on github)

  • The implementation in 6502.ts which is a straightforward port of said code

  • The TIA schematics :)

If you're curious, you can find the relevant code in Stella here and in 6502.ts here and here. I am currently in the progress of porting the rewritten audio code back to Stella.


Edited by DirtyHairy, Tue Dec 5, 2017 1:42 PM.


#6 vidak OFFLINE  

vidak

    Moonsweeper

  • 252 posts
  • Location:Sydney, Australia

Posted Wed Dec 6, 2017 10:06 AM

I remember there being some discussion about the TIA sound polynomial counters in the Stella Mailing List. If you search "polynomial" in my Commo Dig you should see the discussion I logged down. Not sure if it's useful though.





Also tagged with one or more of these keywords: tia, atari 2600, sound, polynomial counter, poly counter, emulation

0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users