Page 1 of 1

Mixing Music and Sfx

Posted: Sat Nov 15, 2014 2:51 pm
by bfg.gamepassion
Hi,

i'm new on the Genesis Homebrew Scene, and i'm trying do to a port of Pang for the megadrive.

Here is a video of a Work In Progress : https://www.youtube.com/watch?v=2Jod7r1F6K8

90% of the game logic is coded (even it's not show in the video), but i would make some music and sfx for the game.

I've succeeded playing music, converting midi to vgm and using :

SND_startPlay_VGM(pang13OK);

The music is ok (even if the midi is ugly, it's the same ugly music on the Genesis :)).

I've trying to play a sample (.wav) alone :

SND_startPlay_PCM ( ball_explode, 2304,SOUND_RATE_11025,SOUND_PAN_CENTER,0) ;

It's ok too.

When i try to mix the two :

SND_startPlay_VGM(pang13OK);
and
SND_playSfx_VGM (ball_explode, 2304);

It works, but the .wav, the ball explosion is not good, it looks like the sample has eaten a cat ...

I use rescomp and this configuration for the wav file :

# Generated with rescomp
VGM pang13OK "pang13OK.vgm"
WAV ball_explode "ball_explode.wav" 0 11025

Surely i'm doing something wrong, but how i can mix music and sfx with sgdk ?

Thanks a lot.

Posted: Sat Nov 15, 2014 7:15 pm
by bfg.gamepassion
I answer to myself.

1) The .wav must be 8khz
2) the rescomp ressource file :

WAV ball_explode "ball_explode.wav" 4

Then : SND_playSfx_VGM (ball_explode, 1536); to play it during :

SND_startPlay_VGM(pang13OK);

Seems to work.

Posted: Sat Nov 15, 2014 9:45 pm
by Stef
Hi bfg,

You were faster than me ;)
Indeed the included VGM driver only play PCM SFX at 8 Khz.
Normally when you declare your resource in WAV format :

WAV ball_explode "ball_explode.wav" 4

rescomp should resample automatically the wav to 8 Khz PCM so you don't have to care about it !

As i told you on another place, i am currently working on a new sound driver allowing VGM music playback while having 4 PCM channels at 14 Khz at same time. All these working on Z80 cpu (so without any impact on main CPU) =)

Posted: Sat Nov 15, 2014 10:05 pm
by vingazole

Posted: Sun Nov 16, 2014 4:18 am
by bfg.gamepassion
Stef wrote:Hi bfg,

You were faster than me ;)
Indeed the included VGM driver only play PCM SFX at 8 Khz.
Normally when you declare your resource in WAV format :

WAV ball_explode "ball_explode.wav" 4

rescomp should resample automatically the wav to 8 Khz PCM so you don't have to care about it !

As i told you on another place, i am currently working on a new sound driver allowing VGM music playback while having 4 PCM channels at 14 Khz at same time. All these working on Z80 cpu (so without any impact on main CPU) =)
Thanks for the explanation ! Cool if rescomp convert on 8Khz. I'll finish the game without music for the moment, i'm not musician, so compose or modify a track will be the big part :)

Posted: Sun Nov 23, 2014 9:00 pm
by Stef
A small update to let you know i finally released the XGM driver, you can find more informations about it in this topic :
viewtopic.php?p=25041#25041