Jump to content
IGNORED

Koffi -- got my first sounds working


Recommended Posts

I spent some of Sunday downloading OldGuru's 1 and 2-channel sound ASM samples, also Heaven/TQU's suggested SAP player and all the songs at his site's link. Got to hear a number of impressive techno tunes in the SAP player, which didn't really sound far off from some early Genesis bg music! Also looked at Calamari's Midi2Pok but didn't get time to mess with it.

 

Using OG's snd2 ASM code, I now have that often-used Pac-man theme playing once on my title screen, then once at the start of each level. It's a start! Note that I don't want this music in Koffi in the final version, its just a learning exercise.

 

Not much else to say but I may have some questions over the next few days and I'll post them here. I used OG's SAPReader on an SAP file "Alley Cat", but the output file is unreadable to Word. I assume I must disassemble it somehow? Ermm ... how?

 

Then I can snip the hex music codes into my pgm.

 

I also want to use Heaven/TQU's ThetaMC2, which I believe is a program I can run on Atari800win (it crashed at first, no time to check out why yet) and design my own melodies?

 

The music I want on Koffi's title screen is Beethoven's 6th Symphony, the Allegro entitled "merry gathering of country folk". Not all of it, just a 5-10 second clip from the middle & end of it. I don't suppose anyone is familiar with this piece of music or knows where I could get an MP3 of it? Perhaps I could use Midi2pok to convert an MP3 file (I downloaded one half a year ago, must have deleted it, cannot find where to find it now), but if ThetaMC2 is simple to use, and pumps out an SAP file that I can extract the notes from, then I can compose it myself (a simplified version of it probably).

 

It's a whole new world to me, and I'm not sure how much time I have to explore attempting to get different waves from the typical ones (square waves?), exploring 16-bit sound which you get by combining 2 Pokey 8bit channels, or attempting to modulate notes to mimic instruments as many of the SAP files do.

 

Any further help is welcome; in the meantime, I'm just doing a brain-dump here.

 

Check out Koffi's site and you can see I updated it with some new pics showing my water meter (its a missile believe it or not, it grows & shrinks at the right of screen) and an unanimated (currently) dousewater image.

http://cafeman.www9.50megs.com/atari/5200d...offiKopter.html

Link to comment
Share on other sites

MIDI2POK won't convert MP3's, just midi's. However, there are a LOT of midi's out there on the web free for the taking, and you will probably even find the song you are looking for. Check out http://www.midifarm.com for starters.

 

You will probably also want a midi editing program such as Cakewalk or Midi Studio.. you'd use the editor to isolate the 5-10 seconds of song you wanted and to make sure it's only playing 4 notes at any one time.

 

If you find the midi you need, let me know and I can help with editing.

 

calamari

Link to comment
Share on other sites

cafeman, i whish you good luck... with the music... it will be hard... but not unpossible...

 

best is... if you have the notes than it could be done easliy...

 

when you have the midi file and you use a midi sequenzer like steinberg's cubase or eJay Studio by eJay (oops... the comp i am working @) then try to grabb a demo version from somewhere... you can load midi files directly into the sequenzers... after that you can print out partitions but this is not what we want... we want the notes... so check out the "event editor" in midi software... there you have the played notes' names... with these it should be no problem at all to type them into thetamusic composer...

 

but theta music composer is a "tracker" which is based on patterns... so each sound channel has its own list of patterns and the lists of patterns will be the final song...

 

f.e.

 

pattern 0 will be something like

 

C 1 F

-----

D 1 F

-----

E 1 F

-----

F 1 F

-----

G 1 F

-----

A 1 F

-----

H 1 F

-----

C 2 F

-----

...

 

as far as i know... but i have to double check it...you can check this structure with any PC based MOD-TRACKER...to get familiar with the concept...

 

so... each patterns has the same size f.e. 64 notes...and each note will be entered directly like "C 1" with the octave ("1"). after that you can enter special commands here of course the Volume "F" (0-$0f) of course you can define to each note a special volume envelope or other effects...

 

so dont be confused with these music typed programs on PC or Atari.

 

boot theta music composer as 130xe in atari800win. type "L" for load song and type "D:CIHURTS.TMC" enter the editor and when you are in the editor press "RETURN" to play the actual pattern or the complete song... depending where the cursor stands. you can jump between the windows with "TAB".

 

heave fun...

 

hve

Link to comment
Share on other sites

Speaking of it: Karolj, maybe you could ask Fox or someone else from your demo group to give you a detailed English desription of one of the POKEY tracker formats (including all the effects), like CMC, MPT or TMC? I think then it would be much easier for us to write our own player routine in DASM compatible format, or even to create a PC-based editor program.

 

 

Thanks, Eckhard Stolberg

Link to comment
Share on other sites

Maybe I should write a music editor for my POK music format.

 

I've been thinking about how to add distortion effects (for instruments) without making songs larger that don't need the effects, and I have a few ideas on how it can be done within the existing framework (the player would need to be modified, but that's not big deal)

 

What would be interesting is having someone catalog some of their favorite Pokey effects into a sort of instrument library. That way it would be possible to select "Square wave" or "Bass drum" instead of distortion effect "$D7" (of course the option would always be available to type it in).

 

Currently my custom format can support up to 4 square wave tones at once, sixteeth note resolution, notes from C-3 through C-6, and adjustable length measures (up to 4.25 seconds long, as short as approx 1/60 a second).

 

Only repetitive music really benefits from a tracked format. And, if I made a tracker, the music format would have to be redesigned (support for loops, a pattern table, etc) and that would add overhead for features that probably wouldn't be used.

 

I've always meant to do some testing on my XL to see what kind of musical sounds could be made. Unfortunately, I am no good on identifying musical instruments, so that's why I ask for a Pokey instrument library

 

Or maybe not.. who knows what I'll work on.. I don't even know sometimes

 

calamari

Link to comment
Share on other sites

The next step is to disassemble it.

 

I've been using DIS6502. It took me a while to set it up but once done it run fine.

When disassembled, you'll get a whole 32KB out of which only a very samll section is what you'll need.

 

So how do you know what will you need?

 

1. SAPReader gives back Init address and Player address values when creating the bin file.

2. Use this addresses to search the code in the dissassembled code.

3. Now starts the tricky part: Most of the music files you'll extract have both code and data sections. You'll need to find these data sections (by reading and understanding the code) and convert them (within the disassembler) to data sections. This way your pointers will point to the correct data location.

Also, you must pay attention to the address (RAM locations) that the original code used. It might overwrite some of your current variables or, be complete out of range. You'll have to modify the various labels of the disassembled code to fit your code.

4. Copy and Paste the routines and data into your code. Then, before the main loop, call the Init subroutine. In the main loop call the Player subroutine.

5. Convert the Atari400/800 addresses to the A5200 ones (Mostly AUDC/F registers).

 

If everything works fine you'll hear the music.

 

What I ususally do is take a simple "hello world" program, add the music to it first, debug it there and only then copy it to my main program. I think that it makes it simpler to see the whole context this way.

 

Genrally, it never works for me on the first try. I then have to follow instruction by instruction and see what is going on.

 

My suggestion, never give up, the outcome usually makes it worth the trouble.

 

OG.

Link to comment
Share on other sites

eckahrd, i have a replay routine in assembler just for our XASeMbler... it would be hard to change it into DASM...

 

but why not changing the adresses to 5200 range and assemble the routine to the desired position with XASM??? and include it as binary with DASM?

 

i dont know how to handle sound effects with these programs. i guess we have to code our sound effects straight forward without any composing tool...

 

hve

Link to comment
Share on other sites

Karolj,

 

I don't even know the 5200 system architecture well enough to get that done. And Fox's XASM source code, that you sent me, unfortunately isn't much of a help in this respect either.

 

Also I'm not much of a fan of adding subroutines in binary form. I would prefer to know what the code is doing before I use it. That way it would probably also be a lot easier to create new songs with the tracker software that would actually work with the player routine.

 

There is no need to rush Fox with the format description, BTW. It's not as if I had a couple of games waiting, that are ready except for the sound code. I'm just curious about what the 7800 would be able to do from a technical standpoint.

 

 

Thanks, Eckhard Stolberg

Link to comment
Share on other sites

Okay!

 

It took a few days longer than I expected, but PokEdit 1.00 is done. All I need to do now is write up the documentation and make a few minor modifications to the 5200BAS player program.

 

One positive side effect of making this editor is that I discovered a bug in my Midi2Pok convertor.. it wasn't continuing long notes like I had thought it was. Now it is, and so I've decided to include that in the archive. That makes the example sound better, and my Solitaire title screen is a little better too

 

The archive will contain PokEdit 1.00, Midi2Pok 1.01, and Bin2Inc 1.01 (useful for converting binaries to .BYTE includes), as well as a full working example with 5200BAS and ASM source.

 

I am hopeful that these music tools will be useful, and I'd appreciate any constructive feedback.

 

I'll post here again when the file is ready for download.

 

calamari

Link to comment
Share on other sites

I haven't had any time to try out your stuff Calamari. Not yet! Good job though!

 

Anyway, to those who are also new to making sounds on the 5200/8bit hardware, if you download the most recent ROM of Koffi at my dev page, you hear that I'm experimenting with sounds. If you play the game you hear a boink when you grab a raindrop, also there is a lightning sound, and there is a dual-channel death sound.

 

Here is code for how I do each:

 

code:


KoffiFailSoundRoutine

lda KoffiFailPitch ;assume it is defaulted to some value

STA AUDF3

adc #$2

sta AUDF4 ;rwltst

lda #$ea ; note -- value of ca produces scratchy destuction/lightning sound

sta AUDC3

sta AUDC4

lda KoffiFailPitch

sec

sbc #$Fa

bcs KoffiFailSoundExit

inc KoffiFailPitch

inc KoffiFailPitch

inc KoffiFailPitch

KoffiFailSoundExit

rts

LightningSoundRoutine

lda LightningSound

beq LightningSoundExit ;0=no rain sound

cmp #$1 ;1=you just started to Lightning

beq StartLightningSound

;value of 2 means continue playing the tone:

inc LightningSoundPitch ;

lda LightningSoundPitch

sta AUDF2

cmp #$48 ;was 88

bne LightningSoundExit

;you've hit the max length, reset:

lda #$00

sta LightningSoundPitch

sta LightningSound ;0=no rain sound

sta AUDC2

sta AUDF2

jmp LightningSoundExit

StartLightningSound

lda #$02

sta LightningSound

lda #$10 ;was 70

sta AUDF2 ;try #$70 for a start 'note'

sta LightningSoundPitch

lda #$88 ;pure tone volume 10 rlwtst was e8

sta AUDC2

 

LightningSoundExit

rts

RainSoundRoutine

lda RainSound

beq RainSoundExit ;0=no rain sound

cmp #$1 ;1=you just picked up rain

beq StartRainSound

;value of 2 means continue playing the tone:

dec RainSoundPtr ;goes from $70 to $52 step -3 ;step-4 ;step-5

dec RainSoundPtr

dec RainSoundPtr

dec RainSoundPtr

dec RainSoundPtr

lda RainSoundPtr

sta AUDF3

 

lda RainSoundPtr

cmp #$3e ;was $48 ;was$52 ;10 'frames' I think

bne RainSoundExit

;you've hit the max length, reset:

lda #$00

sta RainSoundPtr

sta RainSound ;0=no rain sound

sta AUDC3

sta AUDF3

jmp RainSoundExit

StartRainSound

lda #$02

sta RainSound

lda #$70

sta AUDF3 ;try #$70 for a start 'note'

sta RainSoundPtr

; sbc #$10

; sta AUDF4 ;rwltst

lda #$e6 ;pure tone volume 10 rlwtst was e8

; sta AUDC4 ;rwltst

sta AUDC3

 

RainSoundExit

rts

 


 

Note that I literally hacked these together so my code may not be the most efficient method of doing things, but there it is if you guys want to try to mess around with your own sounds and start off.

 

Anyone know of any other good methods for getting 'lightning' or 'bump' or other good sounds?

 

I have figured out that "EA" value in one of the four AUDC1-4 regiesters makes a pure tone at volume "A", or 10 decimal. Changing the "E" to other values makes more distorted and scratchy sounds. All of my sounds effects simply start at a value then add/subtract from the frequency in steps. Either the boop goes down in pitch or the boink goes up in pitch.

 

Well, maybe I have some time to watch some TV before bed ... can't get to the net from work anymore so I may not be around much...

Link to comment
Share on other sites

  • 1 month later...

Thanks, Smirk! I wish I coulda shown it to some more people. I wanted to show Dan my color scheme changes to demonstrate the different between emulator-set colors and actual-5200 colors, but I don't think he saw it.

 

I also realize I should have made the demo a bit easier, I noticed gamers didn't really know what to do. Well, it's about half done, and the real 'game' development -- tweaking, setting parameters for each level, building the Pyro vs Koffi Cat&Mouse gameplay -- that's what I'm working on now.

 

Did we meet, Smirk?

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