VGM driver slow?
Moderator: Stef
-
- Very interested
- Posts: 2984
- Joined: Fri Aug 17, 2007 9:33 pm
The thread is a good read on issues surrounding VGM playback. I did a 68000 VGM player for the Myth menu, and I've done a number of z80 drivers for different compressed audio tests, so I totally understand the issues... just not 100% certain I can solve them.
What would be helpful is posting some links to examples of the different kinds of VGM files the driver would need to handle, as well as a couple sound effects. I can then do a test rom that plays the VGM, and play a sound effect when the user presses a button.
I'm especially interested in the "new" VGM format... I don't think I have any of those. All the ones I currently have are all in the old format.
What would be helpful is posting some links to examples of the different kinds of VGM files the driver would need to handle, as well as a couple sound effects. I can then do a test rom that plays the VGM, and play a sound effect when the user presses a button.
I'm especially interested in the "new" VGM format... I don't think I have any of those. All the ones I currently have are all in the old format.
Just to clarify a bit. There are two different ways that PCMs are played back at a high level, but the "new" has a few subtle variations.
1.) Old way. First the position in one giant PCM bank is set with a 0xE0 opcode. Then 0x8n commands are used to play back one byte of the sample. The 'n' indicates how long to wait after the byte playback and is used to essentially set the playback frequency.
2.) The new, less verbose, way. PCM data is held in one or more data blocks at the start of the VGM file. A 0x92 opcode is first used to set the playback frequency of a stream. Then one of a couple things can happen:
2.a) A 0x95 (fast call) opcode is used to set the data block and stream to begin playing back. This can be set to loop or not.
2.b) A 0x93 opcode is used to index into the databank, much like the 0xE0 opcode above.
In my driver, I then interpreted the 0x61, 0x62, 0x63 and 0x7n sample wait opcodes as the opportunity to play the PCM samples.
Here are some sample VGMs:
https://dl.dropboxusercontent.com/u/101 ... amples.tgz
* Ghz.vgm - Uses PCM new style 2a (this is a sample from Deflemask)
* rrpc.vgm - A busy VGM file with no PCM, spans many banks.
* tjae_eb.vgm - A very PCM heavy song using the old style.
* tjae_tjsj.vgm - An example of a song that midway that uses PCM of the old style and switches channel 6 from FM playback to PCM playback. A good test for sound effects.
* bhb_s1.vgm - An old style PCM song with a continuous short sample of a faster than average PCM sample
Plus a few more I had laying around.
1.) Old way. First the position in one giant PCM bank is set with a 0xE0 opcode. Then 0x8n commands are used to play back one byte of the sample. The 'n' indicates how long to wait after the byte playback and is used to essentially set the playback frequency.
2.) The new, less verbose, way. PCM data is held in one or more data blocks at the start of the VGM file. A 0x92 opcode is first used to set the playback frequency of a stream. Then one of a couple things can happen:
2.a) A 0x95 (fast call) opcode is used to set the data block and stream to begin playing back. This can be set to loop or not.
2.b) A 0x93 opcode is used to index into the databank, much like the 0xE0 opcode above.
In my driver, I then interpreted the 0x61, 0x62, 0x63 and 0x7n sample wait opcodes as the opportunity to play the PCM samples.
Here are some sample VGMs:
https://dl.dropboxusercontent.com/u/101 ... amples.tgz
* Ghz.vgm - Uses PCM new style 2a (this is a sample from Deflemask)
* rrpc.vgm - A busy VGM file with no PCM, spans many banks.
* tjae_eb.vgm - A very PCM heavy song using the old style.
* tjae_tjsj.vgm - An example of a song that midway that uses PCM of the old style and switches channel 6 from FM playback to PCM playback. A good test for sound effects.
* bhb_s1.vgm - An old style PCM song with a continuous short sample of a faster than average PCM sample
Plus a few more I had laying around.
Here are some sound effects I've used:
https://dl.dropboxusercontent.com/u/101 ... amples.tgz
These can be converted into 8khz unsigned 8bit samples with something like the following:
https://dl.dropboxusercontent.com/u/101 ... amples.tgz
These can be converted into 8khz unsigned 8bit samples with something like the following:
Code: Select all
%.pcm: %.wav
ffmpeg -i $< -f u8 -ar 8000 -acodec pcm_u8 $@
%.h: %.pcm
bin2c -o $@ $<
-
- Very interested
- Posts: 2984
- Joined: Fri Aug 17, 2007 9:33 pm
-
- Very interested
- Posts: 208
- Joined: Mon Jun 25, 2007 7:19 pm
- Location: Besançon,France
- Contact:
Hi,
Excuse for bumping this thread but i used Genny and Flstudio for making a VGM File with a midi file at start.
My VGM file not use any PCM at all , it's just three channel FM with some instrument ripped from TFM.
here is the .vgm it seems to play fine with Winamp :
http://sega4ever.power-heberg.com/tutod ... /Ahead.zip
But when i include it with SGDK the music seems to be slow and crashed afetr few seconds.
i have tested some tools for reduce the size of the VFM but the result is same..
Can you tell me what is wrong ?
Excuse for bumping this thread but i used Genny and Flstudio for making a VGM File with a midi file at start.
My VGM file not use any PCM at all , it's just three channel FM with some instrument ripped from TFM.
here is the .vgm it seems to play fine with Winamp :
http://sega4ever.power-heberg.com/tutod ... /Ahead.zip
But when i include it with SGDK the music seems to be slow and crashed afetr few seconds.
i have tested some tools for reduce the size of the VFM but the result is same..
Can you tell me what is wrong ?
I took a look at it. Looks like there is a bug having to do with really long pauses "65535 samples" This *should* work but doesn't for some reason. Reducing that fixes the song.
https://dl.dropboxusercontent.com/u/101 ... Ahead2.zip
I have a tool in the gendev source tree that I hacked to split the long pauses up: https://code.google.com/p/gendev/source ... vgm_upg.py
https://dl.dropboxusercontent.com/u/101 ... Ahead2.zip
I have a tool in the gendev source tree that I hacked to split the long pauses up: https://code.google.com/p/gendev/source ... vgm_upg.py