Jump to content
IGNORED

TIA Perceptual Tuning


RevEng

Recommended Posts

In the battle to make good sounding music with TIA, we have a few weapons at hand: atonal composition, cherry picking notes, wavering, and Tune2600. (any more I've missed?)

 

I came up with an alternate one called Perceptual Tuning, and wrote up about it at the 7800 Development Wiki. I figured I'd post about it here, since it's equally applicable to the 2600.

 

Enjoy!

  • Like 3
Link to comment
Share on other sites

any more I've missed?

 

One important weapon is missing IMHO: Good tools that actual musicians can use. I find it amazing that the VCS is 38 years old already, and yet almost everyone is still coding music in source code using Paul Slocum's mature, but also somewhat limited player. I feel that even with the TIA's limitations, an experienced chip musician would be able to do much better music if there were user-friendly tools helping him to focus on creating instruments and actual composing, without the need to understand programming.

 

My current goal is to change that. I have already developed a music player that supports instruments with ADSR envelopes, patterns of arbitrary length, "overlay" custom percussion instruments and more, at the price of a bit more ROM and RAM (right now ~200 bytes of ROM and 9 bytes of RAM, less if certain features are not used). At the moment I'm developing a tracker with (hopefully) a musician-friendly GUI that provides as much help as possible for dealing with the TIA's pecularities. For example, it supports a combined, virtual "Pure" distortion value that combines AUDC values 4 and 12, which when the song is exported to asm will get split automatically into two separate instruments. In addition, I'd like to incorporate Thomas' Tune2600 routines, and this Perceptual Tuning article already gives me some ideas how to improve that. :)

 

The tracker uses Stella's sound emulation routines, and the instrument editor is finished already (see screenshot). Both player and tracker will be open source; release is slated for Easter 2016. I hope this will help to bring in some more "real" musicians who show us what the TIA chip is really capable of. ;)

 

One can dream...

post-35905-0-47312700-1450899597_thumb.jpg

  • Like 3
Link to comment
Share on other sites

One important weapon is missing IMHO: Good tools that actual musicians can use.

Higher level editing would be fantastic, especially with built-in TIA emulation. Looking forward to how this unfolds. Would this be a Windows app?

 

 

just to chuck my $.02 in - I had a good luck at https://en.wikipedia.org/wiki/Just_intonation a few years ago and I seem to remember you could get some pretty complete scales going in at least one key - none of my projects have actually got to the point where they're ready for music yet :)

Interesting idea. I did a quick search of TIA frequency space using my utility modified for just intonation (without weighting for perceptual tuning). To me it looks like 2 octaves doesn't work well, but 1 octave seems doable. Would be interesting to hear the results, when you get around to them. :)

Link to comment
Share on other sites

I just wanted to add that, especially on good 7800 games, TIA music was amazing!

I wonder what tools they used?

 

The "Instant Replay" TIA song in Food Fight is spot on amazing with slides, lots of notes, and no sour notes.

I guess by that time, the larger 7800 ROM space could be used for complex tunes.

Just compare the two Xevious versions, 7800 & 2600. The 2600 could sound as good and the same as the 7800, but the prototype seemed to cut more out.

Link to comment
Share on other sites

Waveform addition. Used in Pitfall II, main menu of Stella's Stocking, and Stay Frosty 2 to get multiple voices out of a single sound channel.

Same for the Boulder Dash title screen.

 

How about frequency mixing? You have to update the frequency multiple times per frame, the more the better. I did that for the Star Castle siren sound.

  • Like 3
Link to comment
Share on other sites

Higher level editing would be fantastic, especially with built-in TIA emulation. Looking forward to how this unfolds. Would this be a Windows app?

 

I'm developing TIATracker under Windows, but I'm using only Qt and SDL, both of which are platform independent. So this should run under Linux and OS X as well, although I haven't looked into the details of how this works exactly yet.

Edited by Kylearan
Link to comment
Share on other sites

Please excuse my ignorance, but how exactly does this work?

 

If you set AUDCx to 0 or 11 TIA output will always be "on" for the specified channel. By rapidly changing the volume you can set that always on value to anything from 0 thru 15 and play back 4 bit digit samples.

 

In 1983 this was used to play back small snippets of speech in Quadrun(at 0:11) and Open Sesame (at 1:12).

 

In 1984 Pitfall II used DPC, a coprocessor, to use waveform addition to play back 3 square waves on a single channel.

 

In 2007 supercat used waveform addition for the menu music in Stella's Stocking. If I remember correctly, he used both channels and added together 2 distinct waveforms on each channel for 4 waveforms in total. He didn't use a coprocessor, just stock 6507 code, though did use a custom bankswitch method to easily access 8K of audio data during the kernel.

 

In 2010 a group of us created an updated version of DPC that we called DPC+. One of the enhancements over DPC was we added support for arbitrary 32 byte waveforms. These are the waveforms used in that demo

	align 32
SOUND_OFF = (* & $1fff)/32
	.byte 0,0,0,0,0,0,0,0
	.byte 0,0,0,0,0,0,0,0
	.byte 0,0,0,0,0,0,0,0
	.byte 0,0,0,0,0,0,0,0 

	align 32
SINE_WAVE = (* & $1fff)/32
	.byte 3,3,3,4,4,5,5,5
	.byte 5,5,5,5,4,4,3,3
	.byte 3,2,2,1,1,0,0,0
	.byte 0,0,0,0,1,1,2,2 

	align 32
TRIANGLE_WAVE = (* & $1fff)/32
	.byte 0,0,1,1,1,2,2,2
	.byte 3,3,3,4,4,4,5,5
	.byte 5,5,4,4,4,3,3,3
	.byte 2,2,2,1,1,1,0,0
	
 	align 32
SAWTOOTH_WAVE = (* & $1fff)/32
	.byte 0,0,0,0,1,1,1,1
	.byte 1,1,2,2,2,2,2,2
	.byte 3,3,3,3,3,3,4,4
	.byte 4,4,4,4,5,5,5,5
	
	align 32
SQUARE_WAVE_VOL5 = (* & $1fff)/32
	.byte 0,0,0,0,0,0,0,0
	.byte 0,0,0,0,0,0,0,0
	.byte 5,5,5,5,5,5,5,5
	.byte 5,5,5,5,5,5,5,5

	align 32
SQUARE_WAVE_VOL4 = (* & $1fff)/32
	.byte 0,0,0,0,0,0,0,0
	.byte 0,0,0,0,0,0,0,0
	.byte 4,4,4,4,4,4,4,4
	.byte 4,4,4,4,4,4,4,4

	align 32
SQUARE_WAVE_VOL3 = (* & $1fff)/32
	.byte 0,0,0,0,0,0,0,0
	.byte 0,0,0,0,0,0,0,0
	.byte 3,3,3,3,3,3,3,3
	.byte 3,3,3,3,3,3,3,3
	
	align 32
NOISE_WAVE = (* & $1fff)/32
	.byte  7, 1, 9,10, 2, 8, 8,14
	.byte  3,13, 8, 5,12, 2, 3, 7
	.byte  7, 1, 8, 4,15, 1,13, 5
	.byte  8, 5,11, 6, 8, 7, 9, 2
Link to comment
Share on other sites

I'm developing TIATracker under Windows, but I'm using only Qt and SDL, both of which are platform independent. So this should run under Linux and OS X as well, although I haven't looked into the details of how this works exactly yet.

Very nice. Definitely looking forward to it, and would look at adding an import option for 7800basic. I've recently added a homegrown MML type format and tracker support to 7800basic, but choices are good and these would be 2 very different choices.

 

 

How about frequency mixing? You have to update the frequency multiple times per frame, the more the better. I did that for the Star Castle siren sound.

I was thinking about the same approach when I originally said "wavering", but your description sounds better. :)

 

 

I just wanted to add that, especially on good 7800 games, TIA music was amazing!

In addition to the ROM and RAM differences, my guess is that there was just more expectation from the public for 7800 titles, and sometimes the developers rose to the challenge, cherry picking notes, transposing compositions until the sour notes were in unused positions, etc.

 

That's not to say there aren't shining examples on the 2600, and stinkers on the 7800.

Link to comment
Share on other sites

Damn.

 

I actually wrote a Windows application a few years ago that takes real time input from a MIDI controller (i.e. MIDI Keyboard) and converts it to TIA or Pokey data. I even bought a MIDI guitar (that I ended up returning because it sucked) because I'm more of a guitarist than a keyboardist. I had planned on using for any music I needed to create for the 7800 games I was doing.

 

It was looking very promising, but the major issue I could not get around was the delay between hitting the keys and playing the note on the application. (Probably from converting MIDI, to a USB Serial port, to input in the application which then converted it to Pokey/TIA data). That killed the project completely. :(

 

Kylearan, your idea looks very cool. Id' like to see that come to fruition! :)

Bob

Link to comment
Share on other sites

For some reason I hadn't considered that DPC+ could totally liberate composers from worrying about the TIA, and use any waveform or pitch they want. OTOH, there is a certain amount of inevitable grit to most or all of the VCS wavetable synthesis I've heard -- the tones aren't as pure or clear as the TIA's native sounds.

 

I really like the challenge of writing for the Atari's limited palette of notes, but there have been some amazing wavetable feats too.

 

Just intonation is a fine idea but the problem is that the VCS uses the undertone series, which is the exact opposite of the harmonic relationships needed for just intonation! :) Maybe other tuning systems are possible, though.

 

I'd still like to figure out how to get my phaser demo to reliably work on real hardware; sounds great on Stella, but doesn't work properly on the VCS.

  • Like 1
Link to comment
Share on other sites

RevEng, quick note on an error in the Perceptual Tuning page -- all but one of your melodies are actually in a key a perfect fourth away from what you're listing them as. In other words, the three versions of O Tannenbaum are in the keys of G, F, and D, and your suggested pitch palette for the traditional melodies you present is actually the key of D. The Salvo homebrew tune is in A, though.

 

Overall, it's a good idea and maps out well, but the fourth degree of the scale (in D) is quite sharp, which is a problem for many traditional diatonic tunes that often use the 4th degree heavily. Actually, that note -- somewhere between G and G# -- sounds pretty close to the 11th harmonic, which is almost exactly a 1/4 tone out of tune (+51 or -49 cents), and matches the just intonation suggestion from earlier.

 

(If you write in A, that same note is the 7th degree, but doesn't have a counterpart in the lower end of the harmonic series.)

 

For 2-voice music, a lot of tuning problems can be concealed by using different timbres for the bass and soprano voices, e.g. using distortion #1 for the bass while the soprano is using one of the square-wave timbres.

Link to comment
Share on other sites

For some reason I hadn't considered that DPC+ could totally liberate composers from worrying about the TIA, and use any waveform or pitch they want. OTOH, there is a certain amount of inevitable grit to most or all of the VCS wavetable synthesis I've heard -- the tones aren't as pure or clear as the TIA's native sounds.

The grit pretty much clears up if the update to AUDV0 happens at exactly the same cycle for each and every scanline. However, that's very difficult to achieve during the busy kernels that DPC+ lends itself to. You also can't control when the update occurs when custom ARM code is running.

Link to comment
Share on other sites

RevEng, quick note on an error in the Perceptual Tuning page -- all but one of your melodies are actually in a key a perfect fourth away from what you're listing them as. In other words, the three versions of O Tannenbaum are in the keys of G, F, and D, and your suggested pitch palette for the traditional melodies you present is actually the key of D. The Salvo homebrew tune is in A, though.

Oops, nice catch. I should have looked a bit longer at the relationships. I just transposed O Tannenbaum correctly to A3, and it sounds great. I'll generate updated mp3s and update the entry when I get a sec... just about to step out for festivities.

Link to comment
Share on other sites

The grit pretty much clears up if the update to AUDV0 happens at exactly the same cycle for each and every scanline.

Exactly. For BD I did just that and the result is very clear. But this is only a title screen, in-game kernels tend to be much more complex and demanding.

 

However, that's very difficult to achieve during the busy kernels that DPC+ lends itself to. You also can't control when the update occurs when custom ARM code is running.

IIRC we did a round of cycle corrections in the 6502 code without much noticeable result. So I tend to believe that the distortions are coming from the ARM code. Not sure if that can be fixed.
Link to comment
Share on other sites

Some of those "Better Than Pitfall II" demos are amazing, clean and clear with 4 note.

Stella's Stocking is just as amazing.

Boulder Dash is so good, I had no idea how that was done without your explanation.

 

The routines Darryl got from supercat? compiled the note data into very nice music, with vibrato (or staccatto).

If anyone is interested I could attach a binary of early Stay Frosty music with great playback...

But 2 things degraded that.

Darryl had to rewrite the assembly into something he could understand, and as mentioned, the DPC+ code running during the music made it harsher.

I like EVERY way that music is made on the 2600, but I'm a bit sensitive to off notes as in Gyruss by Parker Bros' approach of just using everything no matter how off it is.

Link to comment
Share on other sites

I'd still like to figure out how to get my phaser demo to reliably work on real hardware; sounds great on Stella, but doesn't work properly on the VCS.

Not sure what you're running into exactly, but I've always had luck slow phasing ~60Hz with ~5 WSYNCs for the differing frequency period.

 

I decreased the WSYNCs in your demo from 15 to 14, and it started phasing on real hardware, but there's some kind of volume pulsing going on. Bringing it down to 5 WSYNCs makes it sound like the familliar phase effect.

phaser06.fix5wsyncs.bin

phaser06.fix14wsyncs.bin

  • Like 1
Link to comment
Share on other sites

^Awesome, thanks very much for that! My recollection is that the effect with 15 WSYNCs was working perfectly on Stella but sounded like mush on real hardware; if memory serves, a smaller number wasn't working on Stella, or didn't sound as convincing.

 

I just tried your two files in Stella (3.8.1 and 4.2) and both sound good, though the one with 14 WSYNCs definitely sounds richer and has more obvious high-frequency harmonics. I'll give them both a shot on real hardware later today, and will also reboot into a later OS (no Snow Leopard support past 4.2...) so I can try them on more recent versions of Stella.

Link to comment
Share on other sites

Ahh the old won't work gambit, I fall for it everytime :)

 

That's a cool demo -- the version of "Greensleeves" is charmingly off-kilter with those octave transpositions, but still more than recognizable. Are you saying that you're using frequencies that line up with just intonation (i.e. slightly sharp fifths and slightly flat major thirds)? If so, how did the math work out for you? Show your work! :D

Link to comment
Share on other sites

Please bare in mind that I know essentially no music theory.

 

The idea is to have a bunch of notes that are perfectly in tune with each other according to just intonation. There is a nice reference here with ratios for various modes: http://www.csufresno.edu/folklore/Olson/JUSTINT.HTM

 

I think aeolian is by far the best suited to the TIA as there are only powers of 2 & 3 in the top part of the ratio.

 

Here are my notes (baddum tish)...

Aeolian:

1
9/8
6/5
4/3
3/2
8/5
9/5

E3	1/192 = 1/6 * 1/32
F3	1/180 = 1/6 * 1/30
...
A4	1/144 = 1/6 * 1/24
B4	1/128 = xxxxxxxxxx
C4	1/120 = 1/6 * 1/20
D4	1/108 = 1/6 * 1/18
E4	1/96  = 1/6 * 1/16
F4	1/90  = 1/6 * 1/15
G4	1/80  = xxxxxxxxxx
A5	1/72  = 1/6 * 1/12
B5	1/64  = 1/2 * 1/32
C5	1/60  = 1/2 * 1/30
D5	1/54  = 1/2 * 1/27
E5	1/48  = 1/2 * 1/24
F5	1/45  = xxxxxxxxx
G5      1/40  = 1/2 * 1/20
A6      1/36  = 1/2 * 1/18
B6	1/32  = 1/2 * 1/16
C6	1/30  = 1/2 * 1/15
D6      1/27  = xxxxxxxxx
E6	1/24  = 1/2 * 1/12
F6      2/45  = xxxxxxxxx
G6	1/20  = 1/2 * 1/10
A7	1/18  = 1/2 * 1/9
B7	1/16  = 1/2 * 1/8
C7	1/15  = xxxxxxxxx
D7	2/27  = xxxxxxxxx
E7	1/12  = 1/2 * 1/6
F7	4/45  = xxxxxxxxx
G7	1/10  = 1/2 * 1/5
A8	1/9   = xxxxxxxxx
B8	1/8   = 1/2 * 1/4
...
E8	1/6   = 1/2 * 1/3
...
B9	1/4   = 1/2 * 1/2
...
B10	1/2   = 1/2

I guess the note names are non-standard here, the numbers should probably be increasing on each C rather than A......

 

The music is basically butchered from here: http://wiki.cs.princeton.edu/index.php/Green.ckbut that is clearly not in aeolian, I've just changed the G#s and F#s to Gs and Fs, which probably isn't the right thing to do?

Link to comment
Share on other sites

  • 4 weeks later...

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...