Sound Effects & Music

headkaze · 34334

Offline headkaze

  • Administrator
  • Blue Gene Super Computer
  • **********
    • Posts: 7838
on: January 24, 2009, 02:06:00 am
I was playing with audio yesterday and have some good news and bad news. The good news is I have IMA-ADPCM audio playing. The bad news is we have to keep the binary under 4 MB unless were using a file system (ie. library). You can read about how I found this out here. So I vote we keep it under 4MB.

I tried using Adobe Audition to convert the samples but the audio sounded screwy on the DS. So then I tried sox. I realised sox doesn't have an mp3 decoder so I converted the songs to wav first then used sox.

The good news is all 3 songs come in at around 2.55 MB in the following format

Code: [Select]
Format: IMA-ADPCM (4 bit)
Sample Rate: 11025 Khz
Channels: 1 (Mono)

I used the following bat file to convert the music

Code: [Select]
sox -V "Warhawk - Title (Dany Carpentier 97 Mix).wav" -r11025 -t ima title.wav
sox -V "Warhawk - Ingame (Q Mix).wav" -r11025 -t ima ingame.wav
sox -V "Warhawk - Game Over (Ferrara).wav" -r11025 -t ima gameover.wav

So far so good but the first problem is the sound quality is pretty bad. I can hardly hear anything on the DS. First thing I did to deal with that was to use compression (in Adobe Audition) to maximize the dynamic range in the sound, and then I used two audio channels on the DS to play the music which made it a bit louder and it needed it. Still a bit quiet and the quality is still pretty bad, but if we reduce the song length I'm sure we can go up to 22050 Khz although I didn't notice a huge difference there. The sound files are around 5 MB when using 22050 so they would have to be reduced in length.

Anyway your welcome to have a play with the demo, pressing button A will play the music, and pressing button B will play a blaster sample. This also demonstrates how the music can play on the first two channels with the blaster sound on a third. You will also notice that the music ends earlier than it should. According to this code (which is the only real life example I could find that uses IMA-ADPCM compressed sound) to calculate the size you do...

Code: [Select]
SCHANNEL_LENGTH(channel + 1) = (((bytes + 4) & 0x7FFFFFFF) >> 2);
Which I translated as

Code: [Select]
ldr r0, =SCHANNEL_LENGTH(0)
ldr r1, =IPC_SOUND_LEN(0)
ldr r2, [r1]
and r2, #(~7)
add r2, #4
and r2, #0x7FFFFFFF
lsr r2, r2, #3
str r2, [r0]

Which looks the same to me yet it ends the song earlier than it should. I'd appreciate it if you could have a look at that. Overall though I think were ready for sound effects and music, we just need to get the audio quality sorted. Still it's really nice to hear that song playing through the DS speakers! :)
« Last Edit: January 24, 2009, 02:22:06 am by headkaze »



Offline flash

  • Administrator
  • Blue Gene Super Computer
  • **********
    • Posts: 13180
Reply #1 on: January 24, 2009, 02:42:18 am
I did think we could use it from rom dats? I will have a better look tomorrow as 3.45 am now! :)

Thanks as always HK!!!

Coding for the love of it!


Offline flash

  • Administrator
  • Blue Gene Super Computer
  • **********
    • Posts: 13180
Reply #2 on: January 24, 2009, 02:46:03 am
gonna go to bed and try to dream about it!! There must be some way to buffer from rom to ram <4m and pass that to the arm7?

Hmmm...

cogs working - Badly at the moment, but....

We are gonna use a lot more mem as yet, so we have to find a way?

Coding for the love of it!


Offline flash

  • Administrator
  • Blue Gene Super Computer
  • **********
    • Posts: 13180
Reply #3 on: January 24, 2009, 10:05:48 am
BTW, nice post HK.

Perhaps we can just have the same music on the title and in game? And just have the other one for gameover?

I have not had time to play as yet, but will do later today hopefully.

Coding for the love of it!


Offline flash

  • Administrator
  • Blue Gene Super Computer
  • **********
    • Posts: 13180
Reply #4 on: January 24, 2009, 05:48:10 pm
there must be some way to load the sounds into rom memory rather than working ram?

I have been searching and have had no luck as yet. But I can see no reason why it cannot be in rom and the pointers grab it from there?

Coding for the love of it!


Offline headkaze

  • Administrator
  • Blue Gene Super Computer
  • **********
    • Posts: 7838
Reply #5 on: January 25, 2009, 12:43:00 am
I was looking at filesystems but they are all written in "C". Official NDS games use what's called NitroFS for files that are appended to the ROM. DevKitPro examples use libfat and dldi patched ROMs for reading directly off the MicroSD (or other media).

I'd rather not have separate files and implementing libfat support in pure asm would be difficult so we would have to append the data to the end of the ROM and reference it somehow. There is an old filesystem for the GBA/DS called gbfs which I've used in the past. It's simple and would be fine for our purpose. What it does is search through ROM for a header ie. "PinEightGBFS" and then reads in GBFS_FILE which contains info about the number of files. Immediately after that we have the GBFS_ENTRY's for each file. It contains the name of the appended file, the offset to the data and length. From that you can calculate the exact position of the data. It searches for the header on a 256 byte boundry which only needs to be done once upon initialization. Once you have a pointer to this you can quickly read through the GBFS_ENTRY's to get a pointer to the data you need.

The data format looks like this:

Code: [Select]
typedef struct GBFS_FILE
{
  char magic[16];    /* "PinEightGBFS\r\n\032\n" */
  u32  total_len;    /* total length of archive */
  u16  dir_off;      /* offset in bytes to directory */
  u16  dir_nmemb;    /* number of files */
  char reserved[8];  /* for future use */
} GBFS_FILE;

typedef struct GBFS_ENTRY
{
  char name[24];     /* filename, nul-padded */
  u32  len;          /* length of object in bytes */
  u32  data_offset;  /* in bytes from beginning of file */
} GBFS_ENTRY;

Using GBFS has the benefit of already having the tools to put our data into a workable format and it shouldn't be too difficult to write some asm rountines to search through the ROM.



Offline flash

  • Administrator
  • Blue Gene Super Computer
  • **********
    • Posts: 13180
Reply #6 on: January 25, 2009, 09:50:08 am
It is certainly a solution.

But I cannot understand why the music cannot be moved into rom at compile? I understand that the code cannot excede 4m, but the file can.

How would using the file system work with the music as a memory pointer for the play routine?

Coding for the love of it!


Offline headkaze

  • Administrator
  • Blue Gene Super Computer
  • **********
    • Posts: 7838
Reply #7 on: February 11, 2009, 06:49:39 pm
Here are some SFX I have collected which might suit the game. Let me know any you like.



Offline flash

  • Administrator
  • Blue Gene Super Computer
  • **********
    • Posts: 13180
Reply #8 on: February 11, 2009, 06:51:10 pm
Here are a few that I liked.

I have made most of them myself in Soundforge, let me know what you think?

Coding for the love of it!


Offline flash

  • Administrator
  • Blue Gene Super Computer
  • **********
    • Posts: 13180
Reply #9 on: February 11, 2009, 06:54:14 pm
I like

ELECSHOT and STEEL, these could be used

Coding for the love of it!


Offline headkaze

  • Administrator
  • Blue Gene Super Computer
  • **********
    • Posts: 7838
Reply #10 on: February 11, 2009, 07:00:21 pm
Sweet I like them! It's hard to tell if they will sound okay in the game though until we run some tests. The hardest ones are the ones that repeat alot like the laser and explosion. They have to sound okay repeated alot.



Offline spacefractal

  • RBP Team Member
  • Blue Gene Super Computer
  • *****
    • Posts: 4138
Reply #11 on: March 08, 2009, 08:21:38 pm
hehe, shooter games like this might repeat very often. Since Im are musican too, can DS play lopped music, example that one I have done for my Space Taxi game (http://www.spacefractal.com)?

When I created music for Space Taxi (a Java game with Flash based music, due Java have a bad sound system when I wrote Space Taxi few years ago) I could turn op and down 2 times in various places (flash 5 limit) and could have 5 loops played same time. Flash 7 could play 7 channels same time, so I left some of them for the sound FX (that is what I remember). Do that whay all ingame music is about 65kb and dosent sound a 2 secs loop.

NB. Im are a new user, but I'm heard about this game from Headkaze itself in PM from arcadecontrols.com and long time user of it.




The Musician for the RetroBytes Portal Projects.


Offline spacefractal

  • RBP Team Member
  • Blue Gene Super Computer
  • *****
    • Posts: 4138
Reply #12 on: March 08, 2009, 09:40:35 pm
If you can get looped music to work with diffecent samples with diffecent points, I can and might create some music for this game. Howover the original Rob Hubbard music is not suitable for loop like this, since the loops I use is about 2-5 secs each (depends which sound I use), but the total is typical 1-2min length.

For my music, I have created all music for my own games at spacefractal.com (all looped) and also create one (in full length, not looped) for grid Wars 2 (music/ingame_3.mp3), which is included in the patch I created in the past (the original music is still used, and not created by me, I just added that one):
http://forum.arcadecontrols.com/index.php?topic=80123.0

Grid Wars is a excellent version of Geometry Wars.

The Musician for the RetroBytes Portal Projects.


Offline headkaze

  • Administrator
  • Blue Gene Super Computer
  • **********
    • Posts: 7838
Reply #13 on: March 08, 2009, 10:14:05 pm
Hey SpaceFractal and welcome to the boards :)

The DS has 16 channels and does support loops. I'm really not sure what were going to do just yet as we don't have enough room to fit the compressed music (in IMA-ADPCM format) into the DS memory (4 MB). We might be able to attach the music to the ROM using a simple file system though but I haven't researched that yet. Using loops may be an option to look into if we can attach the music or get the quality of the sound good enough.



Offline spacefractal

  • RBP Team Member
  • Blue Gene Super Computer
  • *****
    • Posts: 4138
Reply #14 on: March 09, 2009, 06:25:17 am
It need to been supported loops as I can turn it on and off and reloop again in various places. Here is the screenshot of a example tune:


As you see in this track I use 4 loops in stereo, but I can use more if I want. Since these loops is small I guess stereo ADPCM compressed 16bit in 22khz would sound nice, due these small loops.

Here is the test tune zipped with wav loops and mp3 file (which left some empty space at the end, propenty is the marked in the song I forget to remove):
http://www.spacefractal.com/files/TehcnoTest.zip


NB. Yes I known the tune is a bit hard music, and might soften or use a bit diffecent style, if needed. This is simply just a test to play with the loops.

If I added more wavs, it could been turn into more dynamic?


« Last Edit: March 09, 2009, 06:38:49 am by spacefractal »

The Musician for the RetroBytes Portal Projects.


Offline flash

  • Administrator
  • Blue Gene Super Computer
  • **********
    • Posts: 13180
Reply #15 on: March 09, 2009, 07:41:31 am
It is a great idea mate and a nice way of saving memory and retaining quality.

But... (and I am full of buts...) One of the things that Warhawk is really remembered for is its music. And I cannot see it possible to split that to loops.

We do need to have the entire tune in as high quality as possible, and anything else would not feel right sadly :(

Coding for the love of it!


Offline spacefractal

  • RBP Team Member
  • Blue Gene Super Computer
  • *****
    • Posts: 4138
Reply #16 on: March 09, 2009, 12:51:20 pm
Yes I known. But it can been issue with the limited memory with 4mb.

I think it could use some of the note from the main melodi and create some sort of mix which can been suitable for a loops (but a bit longer loops)?

If there exists a mod or xm player, it would do the great job too, since it mix "midi" and "samples" into one file.

[EDIT]
Looked on the main song with the remix used and started my own. If I can move some part around here and there and remove very few bits, I can bring it down to 6 loops (mightbeen 5) (each in about 11 secs with all instruments in) without to most lost of the mean theme and then double up the quality and only use one loop used at time. All loops is used a least twice.

« Last Edit: March 09, 2009, 03:58:25 pm by spacefractal »

The Musician for the RetroBytes Portal Projects.


Offline spacefractal

  • RBP Team Member
  • Blue Gene Super Computer
  • *****
    • Posts: 4138
Reply #17 on: March 10, 2009, 01:25:29 pm
BTW im working on my own remix of this song, but I do not release this to the public, if it ended to use in the game (otherwice I would release this to 64remix.org with history about this game). Its a looped version using 5 or 6 loops (the remix is not finsished yet) of the main theme and have wrote the song, so it dosent hear the pop and click when it looping to a new one (I using the wrap feature in FL-Stiduo which create seamless loops).


The Musician for the RetroBytes Portal Projects.


Offline headkaze

  • Administrator
  • Blue Gene Super Computer
  • **********
    • Posts: 7838
Reply #18 on: March 11, 2009, 10:31:10 pm
Well I really like the remix SpaceFractal!  8)



Offline spacefractal

  • RBP Team Member
  • Blue Gene Super Computer
  • *****
    • Posts: 4138
Reply #19 on: March 11, 2009, 10:39:37 pm
Thanks, Flash have the newest version of the music. I pm you with the link.

The Musician for the RetroBytes Portal Projects.


Offline spacefractal

  • RBP Team Member
  • Blue Gene Super Computer
  • *****
    • Posts: 4138
Reply #20 on: March 16, 2009, 09:43:09 pm
I have now 2 tunes ready and all is 2.4mb after converted to 22khz ADPCM mono, which sound acceptable for me. But as I wrote to flash (if you read this headkaze), don't try to mix both channels (left and right) to mono, since it actuelly did sound wrong for me (guess it due with the delay effect I use which might have use few use of stereo). Instead downmix one of the channel instead using editor software like Audacity. I tried that and sound ok in that way, even in IM-ADPCM 22khz mono (the nearst one I could choice in this software).

I heard music would not been a part in the first version, but I hope it can been fitted in the second game, since the music is one of the most important for this game... regaardlees if it use my mixes (not released to public) or other (all three is actuelly great, one of them I think there is a bit to much reverb?).

I do fully accept to use these mixes I created to the game, hence I only realse this to public (via remix64.com) if I got permission from Flash and/or headkaze.


The Musician for the RetroBytes Portal Projects.


Offline flash

  • Administrator
  • Blue Gene Super Computer
  • **********
    • Posts: 13180
Reply #21 on: March 16, 2009, 10:03:07 pm
You are always welcome to release the music....

and it is SWEET!!

And thanks for acknowledging how important the MUSIC is to warhawk - one does not work without the other.

Coding for the love of it!


Offline spacefractal

  • RBP Team Member
  • Blue Gene Super Computer
  • *****
    • Posts: 4138
Reply #22 on: March 16, 2009, 10:14:23 pm
ok, I release when I do, but I think I wait release it after the final version. I have created these for fun :-) and want some exclusive for the game (because it looking darn cool).

Personly I love the music my self, and I even want to disable the Sound FX either in the original.


The Musician for the RetroBytes Portal Projects.


Offline flash

  • Administrator
  • Blue Gene Super Computer
  • **********
    • Posts: 13180
Reply #23 on: March 28, 2009, 09:56:29 am
Just to let you know, Jasper from "Press Play On Tape" (http://www.pressplayontape.com/) has given permission to use their version of the Warhawk mix for the titlescreen for the game.

Only problem I have now, is locating one :) I have managed to buy the live version from c64Audio.org, but i know there is a far better version somewhere. Have emailed Jasper back about this.

Spacefractal:
I do not know if HK has got in touch?
But he is now working on the highscore entry and will be looking for a "celebration" version of the Warhawk theme for that and also one for in between levels when the scores are all added up?
There is no rush for anyhing here as we are not sure how long the tracks will need to be.. but there is something you can perhaps be thinking about..?
Thanks mate.



« Last Edit: March 28, 2009, 09:58:04 am by Flash »

Coding for the love of it!


Offline BaDToaD

  • Proterian
  • Dragon 32
  • *****
    • Posts: 76
Reply #24 on: March 28, 2009, 12:13:53 pm
There's a pretty cool PPOT Warhawk live track available free at their site. They've also got the Pet Shop Boys mix too but I prefer the original.



Offline headkaze

  • Administrator
  • Blue Gene Super Computer
  • **********
    • Posts: 7838
Reply #25 on: March 28, 2009, 09:25:23 pm
Space Fractal we are looking at using some of your music for the hiscore entry/game over screens. Also we need some sound effects (Eg big boss explode, powerup, powershot fired). Are you any good at that sort of thing?

Also can you please send me the latest music you've done?
« Last Edit: March 28, 2009, 10:06:16 pm by headkaze »



Offline spacefractal

  • RBP Team Member
  • Blue Gene Super Computer
  • *****
    • Posts: 4138
Reply #26 on: March 29, 2009, 10:45:03 am
Am are muxh more musician than sound FX artist. But I can try to look on that.

It fine with me not using the main warhawk tune, but nice to use to the hiscore/gameover tune (which I guess to save romspace).

Plans to use the alternative short versions I have created for some levels?

In the java space taxi (http://www.spacetaxi.net), I use used the Amiga Sound FX from the same game, but composed all my own music for that game.

I send a new version soon.
« Last Edit: March 29, 2009, 10:56:48 am by spacefractal »

The Musician for the RetroBytes Portal Projects.


Offline spacefractal

  • RBP Team Member
  • Blue Gene Super Computer
  • *****
    • Posts: 4138
Reply #27 on: March 29, 2009, 02:40:31 pm
I have pm the 3 short tunes which can fit to the game (one gameover with score not to the hiscore, one with) and a short alternative version. I still think one main theme is fine, also use the ingame tune allready used as a title tune as well to save romspace?

The Musician for the RetroBytes Portal Projects.


Offline spacefractal

  • RBP Team Member
  • Blue Gene Super Computer
  • *****
    • Posts: 4138
Reply #28 on: April 22, 2009, 09:50:51 pm
I have now done version 6 of the main theme which seen  now been accepted by Flash and Headkaze and it can still been changed a bit before finalized (but works fine as it are now). The tune is a bit shorther than the C64 original to save memory due the stream method they use. This mean I have shorted the intro tune as well the end of it, but it still have all suit of the original c64 original.

I have also created a nice game-end tune , a hiscore tune as well a gameover tune. The first one is a pretty original (do you cant do a happy tune without changing some chords), but very close to the main theme.

There is a public link to the main tune, if Flash and/or Headkaze want to officiel the main theme used, but I dedicated not to post that to my self. Its a exclusive to the game yet and have not uploaded to the http://www.remix64.org.

POTT (Press Play on Tape) version of the c64 tune is also included in the game as well.

The Musician for the RetroBytes Portal Projects.


Offline flash

  • Administrator
  • Blue Gene Super Computer
  • **********
    • Posts: 13180
Reply #29 on: May 06, 2009, 10:32:21 pm
The main theme is sounding really good SF!

as are the others!

Great work mate......

Coding for the love of it!