<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Sound on Programming the Atari VCS in Assembly</title><link>https://cdeever.github.io/atari-vcs/docs/sound/</link><description>Recent content in Sound on Programming the Atari VCS in Assembly</description><generator>Hugo</generator><language>en-us</language><atom:link href="https://cdeever.github.io/atari-vcs/docs/sound/index.xml" rel="self" type="application/rss+xml"/><item><title>The Audio Registers</title><link>https://cdeever.github.io/atari-vcs/docs/sound/the-audio-registers/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://cdeever.github.io/atari-vcs/docs/sound/the-audio-registers/</guid><description>&lt;h1 id="the-audio-registers"&gt;The Audio Registers&lt;a class="anchor" href="#the-audio-registers"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;The TIA gives you &lt;strong&gt;two independent audio channels&lt;/strong&gt;, and that&amp;rsquo;s the whole orchestra — two voices, no more. Each channel is described by exactly &lt;strong&gt;three registers&lt;/strong&gt;, and a sound is whatever you get by setting them and changing them over time.&lt;/p&gt;
&lt;table&gt;
 &lt;thead&gt;
 &lt;tr&gt;
 &lt;th&gt;Register&lt;/th&gt;
 &lt;th&gt;Width&lt;/th&gt;
 &lt;th&gt;Sets&lt;/th&gt;
 &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;strong&gt;&lt;code&gt;AUDC0&lt;/code&gt; / &lt;code&gt;AUDC1&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;4 bits&lt;/td&gt;
 &lt;td&gt;the &lt;strong&gt;waveform&lt;/strong&gt; — which tone or noise shape this channel makes&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;strong&gt;&lt;code&gt;AUDF0&lt;/code&gt; / &lt;code&gt;AUDF1&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;5 bits&lt;/td&gt;
 &lt;td&gt;the &lt;strong&gt;frequency&lt;/strong&gt; — a divisor, so 32 steps, higher value = lower pitch&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;strong&gt;&lt;code&gt;AUDV0&lt;/code&gt; / &lt;code&gt;AUDV1&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;4 bits&lt;/td&gt;
 &lt;td&gt;the &lt;strong&gt;volume&lt;/strong&gt; — 0 (silent) to 15 (loudest)&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;The three combine in a fixed signal path: &lt;code&gt;AUDC&lt;/code&gt; and &lt;code&gt;AUDF&lt;/code&gt; feed a tone/noise generator, whose output is scaled by &lt;code&gt;AUDV&lt;/code&gt;, and the two channels mix to the single output:&lt;/p&gt;</description></item><item><title>Tones, Noise &amp; Pitch</title><link>https://cdeever.github.io/atari-vcs/docs/sound/tones-noise-and-pitch/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://cdeever.github.io/atari-vcs/docs/sound/tones-noise-and-pitch/</guid><description>&lt;h1 id="tones-noise--pitch"&gt;Tones, Noise &amp;amp; Pitch&lt;a class="anchor" href="#tones-noise--pitch"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;Two registers shape &lt;em&gt;what a channel sounds like&lt;/em&gt;: &lt;code&gt;AUDC&lt;/code&gt; picks the waveform, and &lt;code&gt;AUDF&lt;/code&gt; picks the pitch. Together they&amp;rsquo;re the source of both the VCS&amp;rsquo;s distinctive voice and its most infamous flaw — it can&amp;rsquo;t play in tune.&lt;/p&gt;
&lt;h2 id="audc-pick-a-voice"&gt;AUDC: pick a voice&lt;a class="anchor" href="#audc-pick-a-voice"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;AUDC&lt;/code&gt; is a 4-bit selector (0–15) that routes the channel through different internal divider and polynomial-counter combinations. The result isn&amp;rsquo;t 16 evenly-graded timbres but a handful of distinct &lt;em&gt;families&lt;/em&gt; — pure tones, buzzy/reedy tones, and noise. The ones you&amp;rsquo;ll reach for most:&lt;/p&gt;</description></item><item><title>Playing Music</title><link>https://cdeever.github.io/atari-vcs/docs/sound/playing-music/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://cdeever.github.io/atari-vcs/docs/sound/playing-music/</guid><description>&lt;h1 id="playing-music"&gt;Playing Music&lt;a class="anchor" href="#playing-music"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;A steady tone is just six registers holding their values. &lt;strong&gt;Music&lt;/strong&gt; is what happens when you change them on a schedule — and the schedule is the &lt;a href="https://cdeever.github.io/atari-vcs/docs/prerequisites/how-the-tv-works/"&gt;frame&lt;/a&gt;. A small routine, run once per frame, reads a song out of a data table and updates the &lt;a href="https://cdeever.github.io/atari-vcs/docs/sound/the-audio-registers/"&gt;audio registers&lt;/a&gt;; that routine is a &lt;em&gt;sound engine&lt;/em&gt;, and even a tiny one carries a whole tune.&lt;/p&gt;
&lt;h2 id="a-song-is-a-data-table"&gt;A song is a data table&lt;a class="anchor" href="#a-song-is-a-data-table"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The simplest useful format is a list of &lt;strong&gt;(note, duration)&lt;/strong&gt; pairs — which is exactly what the &lt;code&gt;Song&lt;/code&gt; table in &lt;code&gt;xmas/xmas.asm&lt;/code&gt; is: a note index and a length in frames, terminated by a zero:&lt;/p&gt;</description></item></channel></rss>