Jump to content
IGNORED

Emultation of the TIA Audio


MemberAtarian

Recommended Posts

Hi folks.

 

I'm on the way on creating a new development framework for the Atari 2600 (you can see some peek of the development here: 

), but unfortunately, I came to a point that I cannot understand.

 

So, I plant to go with the audio editor and for that, I would like the generate the exact tones in the preview section that the TIA can produce.
I looked at KK's own kernel, at Stella's, Javatari's code and even tough I understand how shift registers and poly work, I just cannot find out what kind of result I should get in the buffer, is my code working (translated well from C to Py).

I attached both where I am right now (TiaTone) and also the also the code of Adam Wozniak from 2003 (wow, I was 16 and in attended high school that time!), this was easiest to me to understand as a source / inspiration.

 

What kind of result should I get in the buffer? My guess is that there should be 44100 (or other freq) 0 or 1, that could be sent directly to the sound output channel, but since I get 0, 4 ot 6 with this code,  even the lenght changes.

It's not neccessary to be the most precise since the generated TIA data will be opened in Stella, but I would like to add some kind of preview as the user presses a piano button or hits a drum, etc.

This is the project on github: https://github.com/MemberA2600/Fortari2600

TiaTone.py More sound source code (was Re_ [stella] TIA Audio Polynomia.pdf

  • Like 1
Link to comment
Share on other sites

This is the TIA audio implementation for Gopher2600, which might give you a different view on it. In a nutshell, the audio.Mix() function is called every TIA video cycle. That function counts to 114 in order to produce the 31403Hz sample frequency from the 3.58Mhz video clock. On every 114th video cycle the two audio channels are processed and the volume of each channel mixed to produce a single volume value. 

 

https://github.com/JetSetIlly/Gopher2600/tree/master/hardware/tia/audio

 

When writing to an audio buffer therefore, an output volume (an 8bit value in the case of Gopher2600) is written every 114 video cycles. If the playback sample rate is set to 31403Hz then the sound heard should be correct.

 

To answer the question, "what kind of result should I get in the buffer?" my answer is a stream of samples (bytes) at a rate of 31403 per second.

 

Hope this helps.

Link to comment
Share on other sites

9 minutes ago, JetSetIlly said:

This is the TIA audio implementation for Gopher2600, which might give you a different view on it. In a nutshell, the audio.Mix() function is called every TIA video cycle. That function counts to 114 in order to produce the 31403Hz sample frequency from the 3.58Mhz video clock. On every 114th video cycle the two audio channels are processed and the volume of each channel mixed to produce a single volume value. 

 

https://github.com/JetSetIlly/Gopher2600/tree/master/hardware/tia/audio

 

When writing to an audio buffer therefore, an output volume (an 8bit value in the case of Gopher2600) is written every 114 video cycles. If the playback sample rate is set to 31403Hz then the sound heard should be correct.

 

To answer the question, "what kind of result should I get in the buffer?" my answer is a stream of samples (bytes) at a rate of 31403 per second.

 

Hope this helps.


Thankfully, I solved it yesterday in the morning. :D

 


https://github.com/MemberA2600/Fortari2600/blob/master/src/Scripts/TiaTone.py

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...