Showing posts with label goattracker. Show all posts
Showing posts with label goattracker. Show all posts

Tuesday, 4 February 2020

SFX

I've been thinking about how to incorporate sound effects in the game since, when writing the music recently, I've kept the in-game music to two voices to enable this.

After reading my digital copy of Compute's 'Mapping the 64 and 64C', specifically the sections relating to the SID registers, I thought it might be easy to shove some data into said registers and see what happens!

After a bit of fiddling, low and behold, I made noise!  It really was as simple as writing a short routine that inserted some previously created values for the waveform type, pitch (note), attack/decay and so forth into their associated registers and then changing those values over a short period of time using another small routine.  It did sound a little like Paradroid to start with though!

Next, I inserted these little routines into my Chiller 2 code and called them when certain actions were performed, in this case when the player jumps or when crosses are collected.

It worked!

But... problem...

It seems that, even though I had kept a voice free on SID (in this case voice 3) for the effects, the GoatTracker music driver still writes values to the voice 3 registers, effectively neutering my sound effects.  Damn...

After a bit more reading around, it turns out that GoatTracker has a sound effects routine built in.  I've read the GoatTracker help file a few times over the years, so how the hell have I ever missed this information about sound effects!?!?  So I investigated this and within about 20 minutes, had sound effects playing using this GoatTracker routine!

The process goes a little like this:

When exporting your music file from GoatTracker as a .prg to include in your code (press F9), there is an option to enable the SFX player. Do this and once saved the SFX module is now part of the overall music file.  This does add about 150 bytes to the overall file size.

You then create your SFX exactly the same way as creating instruments in GoatTracker.  These instruments are then saved from within GoatTracker.  The instrument file is then converted to a sound effect using a tool bundled with GoatTracker called 'ins2snd2.exe', which gives you a text file with the associated hex data for the sound.  There are a couple of rules to follow for the tool to be able to convert the instruments to effects, but you'll have to read the GoatTracker help file yourself for those!

Currently, the data for my jump and collect SFX look a little like this...


; sfx data (lower the sfx data, the higher play priority it has)  
   
 sfx_jump  
     !byte $38,$F6,$04,$A0,$21,$A0,$A0,$A6,$A6,$A6,$20,$A9,$A9,$A9,$A2,$A2  
     !byte $A2,$A6,$A6,$A6,$A9,$A9,$A9,$A2,$A2,$A2,$A6,$A6,$A6,$A9,$A9,$A9  
     !byte $A2,$A2,$A2,$A6,$A6,$A6,$A9,$A9,$A9,$00  
       
 sfx_collect  
     !byte $00,$89,$04,$A2,$41,$A2,$A2,$A6,$A6,$A6,$40,$A9,$A9,$A9,$A2,$A2  
     !byte $A2,$A6,$A6,$A6,$A9,$A9,$A9,$A2,$A2,$A2,$A6,$A6,$A6,$A9,$A9,$A9  
     !byte $A2,$A2,$A2,$A6,$A6,$A6,$A9,$A9,$A9,$00 


To play the effect, you then insert a small simple piece of code that is triggered when, for example, the player jumps or collects a cross.  Something like this...

  
 lda #<sfx_jump       ; start address of the effect  
 ldy #>sfx_jump  
 ldx #$0e             ; 0, 7 or 14 for channels 1-3 (channel 3 use here, or $0e)  
 jsr music+$06        ; music = memory location where music is stored in memory  
                      ; sfx player is at +$06!


So Chiller 2 finally has some sound effects!  I've purposefully kept the sounds quite low in the 'mix' (quiet) currently, since both the jump and collect will be played quite frequently and I don't want to annoy the game player!

Sound effects... TICK!

Next diary entry...


Thursday, 30 January 2020

Sounding Off

I'm still immersed in the depths of GoatTracker!

Since the last blog entry a few days ago (read here), I've completely rewritten my 'get ready' tune so it now sounds more 'urgent' and suspenseful.  Well I think it does...

I've also written four more level tunes to accompany the one written the other day!  I was originally going to make them spooky sounding, but found that style didn't actually suit the gameplay.  More 'driving' bass lines are needed to motivate the player along.  Each tune is between 40 and 60 seconds long before repeat; I've deliberately made them short so I can have more tunes in memory for more variety for each level.  As mentioned in the previous blog entry, these tunes are written using only two voices, leaving the third free for sound effects.

Along with the level tunes, I've composed a really rather jolly game complete tune!  A bit premature maybe as I don't even know if I'll have a game complete screen yet, but it gives me options further down the line.

What?  You want proof I've actually written some music?  Below should be a player containing a test recording of the music currently assigned to Level 1 (this was recorded using SidPlay64 on my 8580 equipped C64c playing through my Dolby amp).  If the player doesn't appear from some reason, hear it on my SoundCloud page here.





Next diary entry...

Saturday, 25 January 2020

Sound Start

After another busy week in work I've fancied a change from level designing, so yesterday evening I started work on some music for the game.

Now I will be honest, I did start writing some music quite a few months ago and by that I mean the first 10 seconds of the title screen music, along with some place-holder notes for the 'get ready' screen so I knew that the music was being called/initiated and played correctly for the sequence of screens from the title screen, through the get ready screen to the game screen.

After yesterday's bout of composing, I have now refined my first 10 seconds of title screen music, modified my get ready music and added a (very) short piece for game over.  The biggest addition though is a brand new piece that is currently around a minute long that I'm using for the in-game music.

Of course, all this music will be refined, extended or even deleted and composed again from scratch as time goes on.  At present, I don't really want to aurally share the music in it's current state, but here is a screen dump of GoatTracker in action:


When being assembled, the code is loading the music to $0900, with the next block of memory being used by the charset at $2000.  This gives me just under 6K of memory for music at the moment.  Quite a bit!

I've decided that I may do short, simple repeating tunes so that each level has it's own music.  To this end, I did dive into the code and add a short routine that can detect the level number then initialise and play a different tune for each level.  Naturally, this code will be removed if I run short of memory in the future and only end up with one in-game tune.

I've written the first in-game tune with only 2 channels, keeping the third free.  I'm toying with the idea of having some sound effects too in the future, maybe for jumping or energy depletion.  Maybe...

Next diary entry...