Offline
Brisbane QLD Australia

Hello, I am new here and am starting to get into VGM Maker to compose music for the Megadrive. I am yet to fully understand the program and do not know a whole lot about the Megadrive's music limitations on the technical side of things.

I am using VGM Maker v1.02 and want to add .wav sample for a sound effect in a game. Once I export it as TFD file for the Megadrive, I compile it using BasiEgaXorz and test it on a Emulator using a .bin file and it doesn't work. My source code on the ROM side of things is okay, but I know there are limitations with .wav files regarding VGM and the Megadrive and want to know what they are.

I have a .wav that was stereo, I changed it to mono using Adobe Audition 3 with the lowest quality settings possible that I know of. I then added the sample into VGM and it worked (I can hear it), but then the emulator won't play it. Is there something specific I need to do with the Global PMC Quality settings? it says the total bank size of the .wav file when loaded into VGM is 17928 bytes, is this too much?

If anyone knows anything please explain to me in basic terms as I am a beginner and any help would be appreciated.

Offline

This might be a dumb question, but are you using the S command in one of the PSG channels to play the sample? If it can be loaded and heard in  the sample editor, I don't see why it wouldn't  work on the tracker. ):>

Offline
Brazil

I think the sample works in the 6th channel with the S command. There is a test.vge I think.
Try using the S command!

Offline
Russia, Moscow

TFD format does not support PSG or samples, and never will - it was designed for other purposes and now is obsolete. Currently there are no players to use music made in VGM MM in games.

Offline
Brisbane QLD Australia
shitbird wrote:

This might be a dumb question, but are you using the S command in one of the PSG channels to play the sample? If it can be loaded and heard in the sample editor, I don't see why it wouldn't  work on the tracker. ):>

Yes I was using the s command on one of the PSG channels. I'm guessing the FM channels are also incapable of doing it?

Shiru wrote:

TFD format does not support PSG or samples, and never will - it was designed for other purposes and now is obsolete. Currently there are no players to use music made in VGM MM in games.

That sucks, so is there ANYWAY at all to be able to get a .wav sample into a Megadrive game? Even if you somehow have to diminish the quality of it quite a bit.

Last edited by flatuswalrus (Sep 17, 2011 11:39 pm)

Offline
Russia, Moscow

Of course, just write a sample player or reuse an existing one.It is easy, if it just plays samples and nothing more. It is difficult to make a driver that plays FM and samples using just Z80. Easiest way is to play FM and PSG on M68K side and samples on Z80 side, stopping Z80 when you need to write 2612 registers.

Offline
Brisbane QLD Australia
Shiru wrote:

Of course, just write a sample player or reuse an existing one. It is easy, if it just plays samples and nothing more. It is difficult to make a driver that plays FM and samples using just Z80. Easiest way is to play FM and PSG on M68K side and samples on Z80 side, stopping Z80 when you need to write 2612 registers.

When you say Z80, that is the Zilog Z80 which is an 8-bit microprocessor right? Because I know practically nothing about all this as I am just starting out, I didn't really understand anything else you said at all lol. I am guessing I would be the most knowledgeable user on this forum. I will talk to a few people I know that know a little about this stuff as to not bother you with a million questions I could probably come up with. I appreciate your reply, thank you. Oh by the way, I am an amateur musician who is attempting to compose the music for a new home-brew Megadrive game, I can write the music okay, but this world of video game music making (hardware / software) is COMPLETELY new to me.

EDIT: So m68k is the port of Linux to run on systems using Motorola's microprocessor? Megadrive's CPU is a Motorola 68000 correct? So to start off would you recommend downloading Linux and trying to get my head wrapped around that? Or being at the level I am at (starting out) is there something else you would recommend?

Last edited by flatuswalrus (Sep 18, 2011 12:42 am)

Offline
Russia, Moscow

Genesis/Megadrive has two CPUs: Motorola 68000 (often called M68K, 68K means 68000 for short) and Zilog Z80 (often called Z80). Z80 is auxilary CPU that is added to provide backwards support with Sega Master System, in Genesis/MD games it often used to run sound code and free main CPU (68K) for other things.

With BasiEgaXorz, simplest way to make sound is to have FM only music (no PSG and samples) and samples for sound effects (single channel). To do this, you need to use TFD player code I've posted somewhere on BEX forums, which not uses Z80, and also use any Z80 -based sample player. To make them work together you need to mod TFD player a bit. You can also use PSG for sound effects, but this would require some new code.

I can provide help with sound code when you will have completed game (without music/sound).

Last edited by Shiru (Sep 18, 2011 1:06 am)

Offline
Brisbane QLD Australia
Shiru wrote:

I can provide help with sound code when you will have completed game (without music/sound).

That would be much appreciated indeed, thank you.

Offline

Shiru,
Over on the BEX forums, someone said that you would be able to use 2 instances of your TFM driver to use sound effects (albeit canceling out channels used in the music) by changing the variable names. I tried this and it froze the emulation. What would it take to get it to work? I also found over on the BEX forums a WAV player, though it halts the game entirely until the WAV is done playing. Not sure if there was another method/driver on the forums, as the search feature is very limited.

Thanks!

Offline
Russia, Moscow

This may work. i don't know why it or WAV player hangs, it could be just a bug in your or BEX code (BEX had a lot of bugs in the past).

However, FM music+effects is not that easy. In early games you can see that few FM channels were used for music only, and few other channels for effects only. That's because methods of mixing few sounds into one channel that works well for simple, PSG-like synths, won't work well with FM - you need to reload a lot of parameters, and you don't have solid control on envelopes. Typical situation where you will have problem: your music channel plays something with long slow attack, then you played a short BOOM sound on this channel, and now you just can't restore previous sound.

If I would need to make FM music+effects, I'd probably go that way: first four FM channels for music, two other for sound effects. For these two channels algorithms and ADSR is always the same, infinite sustain, and sound effects player only changes TLs and MULT - in this case mixing methods that works for PSGs should work well, but effects have to be designed with a custom tool.

Offline

The WAV player isn't running like your replayer driver, so it's halting while playing the sound clip. I'm not a sound programmer or have any experience with that, so I'm unsure on how to change it or modify it to work like your driver.

The WAV player:
http://devster.proboards.com/index.cgi? … thread=481

That's the example I was using. I also have no idea on how to get it to run simultaneously with your replayer as well, so any help would be greatly appreciated smile

(sorry to thread-jack ya Dane, but since we're working on this project together, I didn't think you'd mind lol)

Edit:
Also, a different solution would be to use Kramlib for BEX, though I'm unsure of how to make SMPS tracks/sound fx like he managed to use in his example (or ripped from Sonic games). Any idea on how to convert TFM/VGM's to SMPS? lol

Last edited by elusive (Sep 18, 2011 3:22 am)

Offline
Russia, Moscow

I don't know about BEX internals much, as far as I remember, the reason why BEX TFD player wasn't worked on the hardware is wrong memory access alignment BEX produced for POKE, you had to replace some pokes with assembly code that does the same but with proper alignment.

Regarding WAV player, the one there uses all the M68K time to play a sample, i.e. while sample plays, it can't do anything else. To make FM+samples without stopping main program, you need to move sample player to Z80 side, i.e. write or use a driver that works on Z80 and do the same. Such a driver in simplest form is very simple, there are many such drivers around.

Regarding SMPS, I doubt it is possible to convert music from VGM MM, because it is superior feature-wise. I recall someone worked on a SMPS tracker, i.e. a tracker that is specially designed to make music for SMPS.

Last edited by Shiru (Sep 18, 2011 3:34 am)

Offline

I know kram said he was going to make one, but I'm not sure if he ever finished it or released it.

Can you point me to some simple WAV drivers for the z80? (I'm still not even sure how to get it to run along side your replayer anyway, so I'm not sure what good that will do me, but I need to start learning this stuff anyway lol)

As for the TFD player not working on the hardware, this is what I did and it worked perfectly fine:
Grabbed the replayer out of LAKABAJO (or whatever it's called), and added kram's init function out of his library. That solved any issues on the real hardware smile

Offline
Russia, Moscow

Here is one that I've made for a project, it is very simple, <150 bytes of code. It plays only one channel of sound, allowing to place sample data without caring about bank boundaries (however, you can only put samples in first 512K of ROM). It always works at 16000hz. I've used it together with FM part on M68K side.

Check sound.c for example how to load and use - you need to stop Z80 before loading the driver, reset it after loading, and to play new sample you need to halt Z80, put address and size of a sample into certain place in Z80 RAM (0x1f00..0x1f06 in Z80 address space), and run Z80.

Last edited by Shiru (Sep 18, 2011 4:14 am)

Offline

Yeah... this is above my head, plus it's in C and ASM, I'm using BEX tongue