VGM music maker and samples

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

Moderator: BigEvilCorporation

Post Reply
Fernando
Newbie
Posts: 7
Joined: Tue Mar 05, 2013 4:04 pm
Location: Argentina

VGM music maker and samples

Post by Fernando » Tue Mar 05, 2013 4:35 pm

Hello. I'm Fernando, 20 years old, electronics student from argentina. English is not my native language, so sorry if I commit mistakes.

It's been a while since I found about SGDK and this wonderful community. I love the genny and programming (but I'm not an expert, just some basic, visual basic and C), so I think is perfect for me. I decided to register since I have the next problem, and couldn't find the solution for myself:

Lately I've been trying to start composing using Shiru's VGM Music Maker (having some success even when I'm not a musician at all), and I already have made some songs. The problem is that when I export them to the VGM format and try to use them in SGDK with the SND_startPlay_VGM function, and play the resulting rom in Gens Kmod or Kega , it doesn't play the samples, so I loose all my percussion. I know for the Green Hill Zone sound example included in SGDK that playing samples with that driver is possible, but I don`t know how to do it.

I would really appreciate your help!
Maybe when this little problem is solved I can share some of my creations with you!
Thanks a lot for reading me.

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

Post by Stef » Wed Mar 06, 2013 9:16 am

Hi Fernando :)

Welcome on the board, hope you will enjoy the place ! It's always a pleasure to see new Genny developer =)

I'm not 100% sure of that but i heard that Shiru's VGM maker tool produce VGM with missing enable DAC command so PCM are not played on the VGM driver. I wonder if you can somehow patch the VGM file to add the "enable DAC" command before playing ? Something you can try is to do "manual" DAC enable command on YM2612 after manual loading of the VGM driver :

Code: Select all

// load VGM driver
Z80_loadDriver(Z80_DRIVER_VGM, 1);

Z80_requestBus(1);
// enable DAC
YM2612_enableDAC();
Z80_releaseBus();

// play VGM
SND_startPlay_VGM(vgm_music);

Fernando
Newbie
Posts: 7
Joined: Tue Mar 05, 2013 4:04 pm
Location: Argentina

Post by Fernando » Wed Mar 06, 2013 11:52 am

Hi Stef! :D Thanks a lot for your help!
Yes, I really like this place. Hope someday I will be a decent Genny developer. :)

Well, I just tried your code but, sadly, it doesn't work to me. Maybe I'm doing something wrong?



So, basically, the problem could be (could be) that VGM music maker is not telling the driver that it will be using the channel 6 in the ym2612 to reproduce samples?

Maybe I could try changing my question to "What music composing program will produce a VGM file that will reproduce the samples on the VGM driver??", and, in that case "Can I export the songs I've already made to that program, and then export them again to the VGM format?" but that last question is not really crucial, is not like I've made a lot of songs.

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

Post by Stef » Wed Mar 06, 2013 12:08 pm

Fernando wrote:Hi Stef! :D Thanks a lot for your help!
Yes, I really like this place. Hope someday I will be a decent Genny developer. :)

Well, I just tried your code but, sadly, it doesn't work to me. Maybe I'm doing something wrong?

So, basically, the problem could be (could be) that VGM music maker is not telling the driver that it will be using the channel 6 in the ym2612 to reproduce samples?

Maybe I could try changing my question to "What music composing program will produce a VGM file that will reproduce the samples on the VGM driver??", and, in that case "Can I export the songs I've already made to that program, and then export them again to the VGM format?" but that last question is not really crucial, is not like I've made a lot of songs.

Did you tried the DefleMask tracker ?
http://www.delek.com.ar/deflemask

Maybe it can help you in fixing the sample play. Also you have to know the current Z80 VGM player in SGDK is not optimized for sample play so you have to limit you only on low sample rate as 11 Khz or even 8 Khz.

You can also try to enable DAC after having started VGM play command :

Code: Select all

// play VGM
SND_startPlay_VGM(vgm_music);

waitMs(100);

Z80_requestBus(1);
// enable DAC
YM2612_enableDAC();
Z80_releaseBus();
But that remains a ugly workaround...

Fernando
Newbie
Posts: 7
Joined: Tue Mar 05, 2013 4:04 pm
Location: Argentina

Post by Fernando » Wed Mar 06, 2013 2:01 pm

I just tried with some of the output examples of DefleMask... and.. They work perfectly! Samples and all! (The songs that have sample rate superior to 11Khz are slow, so you are right... I will limit myself to 8Khz or 11 Khz samples) The only problem is that I won't be able to use my previous compositions for my Mega Drive programs, but... doesn't matters, I will make new ones.

Now I just need to try to compose something on my own and see if that works.

Thanks a lot for the help. Maybe later I will post a little demo with some songs, if everything keeps going well :)

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

Post by Stef » Wed Mar 06, 2013 7:22 pm

Fernando wrote:I just tried with some of the output examples of DefleMask... and.. They work perfectly! Samples and all! (The songs that have sample rate superior to 11Khz are slow, so you are right... I will limit myself to 8Khz or 11 Khz samples) The only problem is that I won't be able to use my previous compositions for my Mega Drive programs, but... doesn't matters, I will make new ones.

Now I just need to try to compose something on my own and see if that works.

Thanks a lot for the help. Maybe later I will post a little demo with some songs, if everything keeps going well :)
Yeah unfortunately you cannot re import any VGM in the tracker, they have their own input format.
Did you tried the ugly fix i told you ? :p
Anyway a better solution is maybe just stand with DefleMask tracker :)

Good luck with your project, don't hesitate to ask for help ! I'm looking forward your little demo =)

Fernando
Newbie
Posts: 7
Joined: Tue Mar 05, 2013 4:04 pm
Location: Argentina

Post by Fernando » Wed Mar 06, 2013 11:02 pm

Yes, I tried the fix, but didn't work either. Anyway, Deflemask is the solution, so, no problem.

Again, thanks a lot! Sure, I will ask for help whenever I need it :D

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

Post by Stef » Thu Mar 07, 2013 9:26 am

Ok, good to know there is something definitely wrong with sample on VGM produced by VGMMaker. Have fun coding time :)

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Fri Mar 08, 2013 1:03 am

Stef wrote:Ok, good to know there is something definitely wrong with sample on VGM produced by VGMMaker. Have fun coding time :)
It probably inits FM ch6, which of course kills the DAC. Your second suggestion might work... start the VGM, wait a bit, and then turn on the DAC. I suppose another thing would be to change the VGM player to automatically turn on the DAC when the PCM command it encountered.

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

Post by Stef » Fri Mar 08, 2013 8:45 am

Well, enabling DAC on PCM command would consume too much time i guess, but it can be an easy fix indeed.
Anyway i think the VGM lpayer should be rewrite to ASM at some point to allow faster PCM sample rate or even faster VGM command parsing :)

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Fri Mar 08, 2013 7:31 pm

Stef wrote:Well, enabling DAC on PCM command would consume too much time i guess, but it can be an easy fix indeed.
Anyway i think the VGM lpayer should be rewrite to ASM at some point to allow faster PCM sample rate or even faster VGM command parsing :)
Yeah, I'm really surprised at how well it works for being written in C. :D

It's better if people just make proper streams, but this particular tool isn't being worked on anymore. I did tests for one dev to help him get his VGM output proper. The problem comes from devs using a VGM player for the PC which treats the PCM as separate hardware from the FM - they have the 6 FM channels AS WELL AS a separate PCM stream. That's easy for a PC, but doesn't emulate the actual hardware.

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

Post by Stef » Sat Mar 09, 2013 12:53 am

Chilly Willy wrote: Yeah, I'm really surprised at how well it works for being written in C. :D

It's better if people just make proper streams, but this particular tool isn't being worked on anymore. I did tests for one dev to help him get his VGM output proper. The problem comes from devs using a VGM player for the PC which treats the PCM as separate hardware from the FM - they have the 6 FM channels AS WELL AS a separate PCM stream. That's easy for a PC, but doesn't emulate the actual hardware.
True, it works pretty nicely giving the fact it was wrote in pure C.

About the VGM format, actually the external PCM hardware design has an advantage, you can add extra PCM channel and so it you implement a driver capable of supporting 2 PCM in VGM (unlikely to happen but who know) then you don't have to change the format.

Post Reply