Mixing Music and Sfx

For anything related to sound (YM2612, PSG, Z80, PCM...)

Moderator: BigEvilCorporation

Post Reply
bfg.gamepassion
Newbie
Posts: 3
Joined: Sat Nov 15, 2014 2:44 pm

Mixing Music and Sfx

Post by bfg.gamepassion » Sat Nov 15, 2014 2:51 pm

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.

bfg.gamepassion
Newbie
Posts: 3
Joined: Sat Nov 15, 2014 2:44 pm

Post by bfg.gamepassion » Sat Nov 15, 2014 7:15 pm

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.

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Sat Nov 15, 2014 9:45 pm

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) =)

vingazole
Newbie
Posts: 1
Joined: Tue May 07, 2013 4:31 pm
Location: France (85)

Post by vingazole » Sat Nov 15, 2014 10:05 pm


bfg.gamepassion
Newbie
Posts: 3
Joined: Sat Nov 15, 2014 2:44 pm

Post by bfg.gamepassion » Sun Nov 16, 2014 4:18 am

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 :)

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Sun Nov 23, 2014 9:00 pm

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

Post Reply