Jump to content
IGNORED

Better-Than-Pitfall-II music for 2600!


supercat

Recommended Posts

The enclosed 4p.bin demonstrates four voice stereo music output at 15.75Khz; the music takes 46 cycles per scan line, leaving 30 for other things. The 4w.bin shows how it would sound using an output rate of 7.875Khz. That would require 54 cycles every other scan line. Alternatively, two-voice music on one channel (leaving one audio channel free) would take 27 cycles every other scan line. Might be practical for a hopping-amphibian game.

 

Probably couldn't do much of a game while playing this sort of music (since it requires work on EVERY scan line, including during vblank) but as title screen music it could have some real potential. The music is stored quite inefficiently here, but more efficient storage methods would not be unduly difficult.

 

As used here, the routine has a five octave range and the short demo tune in fact uses the full range. The routine can support the full chromatic scale throughout the entire range; pitches are accurate within about 1%, and all octaves are in tune with each other. Notes can be output in loud or soft mode (the demo outputs each note briefly in loud, then in soft, for a percussive effect). The required tables will take up most of a bank, but it should be possible to put note data in a different bank from the wave tables.

4p.bin

4w.bin

Link to comment
Share on other sites

VeRy, very cool. I don't understand a lot about music and sound generation, so I didn't get your explainations, but this sounds absolutely great. But why is the last note that much out of tune? :?

 

Should be properly in tune. Do you mean the high one or the low one? The top and bottom octave don't sound as nice as the middle octaves, but I wanted to show the full pitch range.

 

BTW: Any chance to reduce that "metallic" sound?

 

The 4P demo sounds pretty good on my machine. The 4W demo sounds rather fuzzier--a tradeoff between sound quality and CPU cycles.

 

Note that emulation may or may not sound good. The -R switch for Z26 helps quite a bit, but for this sort of demo the real test is to run it on an actual machine (in my case a 7800).

 

At least from my end, I'd say the sound quality is about comparable to Pitfall II, but with four voices instead of three, and with a bit of percussiveness to make things more interesting than a straight on/off envelope.

 

Further, while 30 cycles/line might not be a lot, it's enough for a decent title screen kernel.

Edited by supercat
Link to comment
Share on other sites

Should be properly in tune. Do you mean the high one or the low one?

The high one at the very end. It sounds almost intentionally out of tune.

 

The 4P demo sounds pretty good on my machine. The 4W demo sounds rather fuzzier--a tradeoff between sound quality and CPU cycles.

Yes, I noticed the increased fuzziness in 4w and even I can understand why it has to.

 

But what I meant to describe is, that both sound pretty "harsh", especially the higher notes. Maybe it has something to do with harmonics? :?

 

I am sure others may be better in explaining.

 

Note that emulation may or may not sound good.

Of course I tried with my Kroko Cart. :)

 

Maybe the result is different on PAL consoles? :?

 

And now I'll have a close look at your blog and code. Maybe I'll understand a bit of the theory behind it then.

Link to comment
Share on other sites

Just had an idea:

 

When two loud voices are played together, sometimes this causes some distortion. I don't know why, maybe the 2600 has a high distortion factor for loud sound? Especially when both voices are adding up. Maybe that has to with the original stereo design? :ponder:

 

Anyway, since you are adding up 4 volumes ranging up to 7 each, maybe this causes the problem on (my?) console. Maybe reducing the max volumes for each voice could help here?

 

BTW: Are the resulting volumes of the AUDVx registers evenly distributed?

Link to comment
Share on other sites

I noticed that the sound quality in Stella improved dramatically when I turned the volume *up*. At 23 or so, it sounded pretty aliased, but at 99 it sounds great.

 

So does this mean that *anything* in four voices, within a span of 5 octaves, can be played now? If so, it opens up a whole new world for us composers. What are the technical limitations?

Link to comment
Share on other sites

I don't mean to sound like an idiot, but I don't hear anything in either program, either with Stella or with z26. (I haven't tried them on the Krokodile Cartridge yet.) I've tried changing all of the different audio settings, turned my speakers up to 100%, etc.-- but I still get nothing. What settings are you all using? What versions of Stella or z26 are you using? And what version of Windows are you using? The sound works fine in Stella and z26 for other ROMs, just not for these.

 

Michael

Link to comment
Share on other sites

The high one at the very end. It sounds almost intentionally out of tune.

 

Well, the last chord jumps an octave so I could test the C5. The two upper notes should be exactly an octave up from where they would be if I didn't jump the octave.

 

But what I meant to describe is, that both sound pretty "harsh", especially the higher notes. Maybe it has something to do with harmonics? :?

 

It could very well. My code assumes that the AUDVx values will behave linearly; if there's any non-linearity in the audio output circuitry, distortion which wouldn't be too objectionable with normal 2600'ish sounds could be very bothersome.

 

Maybe the result is different on PAL consoles? :?

 

Could well be. How does Pitfall II sound?

Link to comment
Share on other sites

So does this mean that *anything* in four voices, within a span of 5 octaves, can be played now? If so, it opens up a whole new world for us composers. What are the technical limitations?

 

Yeah, it pretty much does mean that, at least if the guy writing the game doesn't mind the resource requirements of the music. My problem right now is I don't have any real plans for 16K-32K games which are the only size where this music would really make sense. A super musical title screen would add some nice polish to a game, but it doesn't make sense to push a 4K game to 8K or an 8K game to 32K just to add a title screen.

 

Though I was considering perhaps trying a joystick-based version of the DDR concept. That sort of kernel might be workable with the music player even at high quality mode, though there would be plenty of interesting challenges. And the use of high quality music would make sense.

 

Incidentally, in a 32K cart there would be some possibilities for limited multi-timbral music; in a 4A50 cart, even more such things would be possible.

Link to comment
Share on other sites

Not sure what exactly you're looking for, but this tool translates a MIDI file into an editable text file and back:

 

MIDI Disassembler

 

I've used it before, and it works fairly well, if you can figure it out. What are you trying to do? Because the MIDI file format is pretty simple, and it wouldn't be that hard to write your own MIDI parser (I wrote one in PHP to generate the MIDI files for my little musical experiment). Here's a good place to find the MIDI specs, if you're so inclined.

Edited by HeckYesIDid
Link to comment
Share on other sites

Probably couldn't do much of a game while playing this sort of music (since it requires work on EVERY scan line, including during vblank) but as title screen music it could have some real potential. The music is stored quite inefficiently here, but more efficient storage methods would not be unduly difficult.

I didn't run this, but ain't it fun what kind of sound you can make if you do code on EVERY scan line? Red Box/Blue Box took more cycles per line specifically because it was trying to do perfect sine waves. And it barely fit in 4K because of all the copies of that macro. Even then, it made all the difference that there were a few places that I could sacrifice 12 cycles for the JSR/RTS to call the macro as a subroutine.

Link to comment
Share on other sites

Even then, it made all the difference that there were a few places that I could sacrifice 12 cycles for the JSR/RTS to call the macro as a subroutine.

 

These music routines should be good sine waves, with about 1% pitch accuracy. If I made the data tables a bit larger it would get 0.5% accuracy which would be good enough for telcom use. The actual approach is quite elegant, and I touch on it in my blog.

 

For my version, there are four bits of code that must be run in order. Each may be invoked many ways (Part0 given as an example)

 PART0 ; Macro--do this on cycle 6
 jsr Part0 ; Do this on cycle zero (e.g. just after WSYNC)
 jsr Part0_2; Do this on cycle 74 (two cycles before zero)
 jsr Part0_3; 73
 jsr Part0_4; 72
 jsr Part0_5; 71
 jsr Part0_6; 70
 jsr Part0_W; Any time on or before cycle 67 (does a WSYNC at destination)

The macro itself is 24 bytes. If things subdivide so that I have enough time for the Part0_W version, that saves a couple bytes versus doing a WSYNC beforehand, but I can get six more cycles before the jsr if I put the wsync in the mainline code, or nine more if I do away with it entirely. The macro gives me another six cycles beyond that at the front end, and finishes six cycles sooner.

 

No self-modifying code is required, so the jsr's are only necessary when space is more valuable than time.

Link to comment
Share on other sites

BTW, does anyone have any nice utilities to turn a .MID file into some sort of easily-parsable format, or else a C library to parse .MID files?

 

The approach I've been working on is using python and the midi library that is available. I have written a simple test routine but don't have anything ready for prime time. I also have a python wave file test rig. I often use python for small utilities where speed isn't a huge concern.

Link to comment
Share on other sites

Here's my latest binary. This piece of music is less "entertaining" than the last one, if you'll pardon the pun, but it's a tougher challenge for the music driver. WTC.bin is the "well-tempered" version. As before, there's a lower-sample-rate version as well, the "wimpy" WTC.

 

On this one, the left difficulty switch toggles between percussive mode and mushy mode (percussive is much nicer). The right difficulty switch shifts everything by an octave; the upper and lower octaves have a different sound and feel to them.

 

No E-flats in the first 16 measures (which is all I have coded) but all other chromatics are present to give the driver a good workout.

wtc.bin

wwtc.bin

Link to comment
Share on other sites

Sounds very nice on my hardware. Congratulations! I nice choice of music for the timbre.

 

How do you like the upper versus lower octave?

 

Also, I haven't quite decided which voice utilization sequence I like best. There are five pitches but only four voices, so one of them has to get "bumped" during the tune. Right now the first two pitches will remain through a measure and the other are used alternately by the last three notes, but I don't know if that's best.

Link to comment
Share on other sites

Do these techniques allow for any use of noise-channel "drum" effects?

 

A sound channel cannot be used for simultaneous music and drum effects without spending a lot of extra code space on the drum-effect wave tables.

 

The BTP2 demo plays two music channels out of each of the TIA sound channels. If only one channel were used for music, the other could handle drums (or other effects) with no problem. Alternatively, for "hi-hat"-style effects, the music playing on one channel could be cut out briefly when the drum plays. Depending upon requirements, either approach could be better.

Link to comment
Share on other sites

Sounds more in tune than anything else before on the 2600!

 

Not that it could do anything about First Star's copyright policy, but it would nonetheless be interesting to hear what the Boulder Dash title tune would sound like using this technique. (If I remember right, Andrew Davie really wanted it to be implemented in a 'softsynth' version...)

 

This was my attempt at a chip version:

bdchip.bin

 

Regards,

Moderntimes99

 

Another version. This one has different options for the difficulty switches and for color/BW. Have fun, and let me know what switch combinations you like best.

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