Sound effects

Arkos Tracker 2 has a powerful support for sound effects. They are managed in a different way as Arkos Tracker 1, to be even more simple to use.

The sound effects must be composed in a specific song, and each instruments can then be exported as sound effects, on the desired frequency. This allows to use the same sound effect set among multiple songs (or to be used even without music), thing that was not possible with Arkos Tracker 1.

Creating the sound effects

  • Create a new song or use the default one when launching AT2.
  • Make sure the subsong has the right PSG parameters. Especially, makes sure the PSG frequency is the right one. To do that: Edit > Song properties.
  • Create as many instruments as there are sound effects. Don’t worry if you don’t use them all: you will indicate what sound effects are actually used, on export.
  • Don’t hesitate to make tracks using the instruments to make sure they sound right. The tracks won’t be exported, so there is no loss of memory.

 

Exporting the sound effects

When you are satisfied with the sound effects, you can export them to use them in your productions. It’s easy, click on File > Export > Export sound effects (AKX). A new window opens:

The list at the top shows all the instruments of the song. They are all considered “used” by default, but you can remove those you don’t want by unticking the “export?” checkbox.

You can see that a sound effect relates to an “export note”: this is the note at which the sound effect will be played, so it is obviously important to set it right. To do so, simply click on “C-4” and, just like in the Test Area, use the keyboard to listen and set the note.

Please heed the “play test parameters” below: they are used to parameterize the sound you hear, but they will not be exported (you will be able to set these on real-time when triggering your sound effects by calling the player). If the sound you play is too low, increase the “octave” and continue testing. When the current sound effect sounds right, simply click on the “C-4” of the next sound effect, and continue the procedure.

When all the sounds effects are well set, you can press “OK” to save these new parameters and exit, or “Export” to export them for the sound effect player to use.

 

Using the sound effects

After you have clicked on “Export”, generating either a binary or an AKX source file, it is time to play them on hardware.

Technical note: the sound effect player is somewhat decoupled from the players. Ideally, I wanted to have one sound effect player for all the available players. But this has proved inefficient: each player has its specificity. So each player has its sound-player counterpart, in another source file.

The sound effect player is always linked to a player: it may be AKY, Lightweight or AKG. Finds the one you need and activate the sound effect in the Z80 code, at the beginning of the source.

 

Initialization

Just like the music player, the sound effect player must be initialized. It’s easy:

ld hl,soundEffects
call PLY_InitSoundEffects

The “soundEffect” points on the data of the exported sound effects, which is either pure binary or source file.

Initializing the sound effect player can be done at any time, as long as it is done before playing a sound effect: you can even do it before initializing the music player.

 

Playing a sound effect

You have your music running and your sound effect player initialized. The character of your game jumps: let’s call the “jump” noise!

ld a,soundEffectNumber
ld c,channel
ld b,invertedVolume
call PLY_PlaySoundEffect

That’s it! The “soundEffectNumber” is the number, as seen in the Export window above: it is simply the instrument to play. For example, to play “ENEMYEXP”, set A to 2.

The “channel” is from 0 to 2 and defines on which channel the sound is played.

The “invertedVolume” is the volume of the sound effect, from 0 to 16. 0 is the loudest, 16 is mute. Why 16 do you ask, as the CPC only has a volume range from 0 to 15? Because hardware sounds are also faded by this volume: they are consider a 16th volume. But fading them will also make them lose their “hardware” status: they will sound differently. But will be able to fade them, at least.

 

Stopping a sound effect

Your sound may loop and you want to stop it, or the player has pressed “esc” and you want to mute all the channels. This is possible:

ld a,channel
call PLY_StopSoundEffectFromChannel

Once again, the channel is from 0 to 2. If you want to stop all the channels, call this method three time using the 0, 1, 2 values.

 

Sound priority

If a sound is played on the channel 1, playing another sound on the same channel will take priority on the previous sound.

You may want to manage priorities on the sound effects: for example, an explosion sound can not be stopped by a bullet firing sound. It’s is not managed by the player, so you have to do it by yourself.

 

Sound effects without music

You may want to play sound effects but don’t need music in your production. There are two ways of doing it:

  • Use the stand-alone sound effects player, in the AT2 kit.
  • Generates an empty music and use one of the player to play it (of course, nothing will be heard). Use the related sound effect player to play your sounds. There is of course big overhead since you integrate a full music player that is not required! However, this is a convenient solution if you already have a player at hand (AKG, Lightweight), no need to integrate a second one.