Noob's investigation of VGM and DMF and SMD audio drivers
-
- Enthusiast
- Posts: 619
- Joined: Fri Feb 20, 2009 9:24 am
- Location: Almaty (Kazakhstan. not Borat, but Triple G)
- Contact:
Re: Noob's investigation of VGM
for you simple but for me - it is chinese language...
about timers - maybe your case have some timing dll's? i mean plug some dll, where lays timing procedure for microsecunds. or use delay 0 - it eat cpu, but it will be correct timings.
about timers - maybe your case have some timing dll's? i mean plug some dll, where lays timing procedure for microsecunds. or use delay 0 - it eat cpu, but it will be correct timings.
-
- Enthusiast
- Posts: 619
- Joined: Fri Feb 20, 2009 9:24 am
- Location: Almaty (Kazakhstan. not Borat, but Triple G)
- Contact:
Re: Noob's investigation of VGM
now i start to make player of converter and final format some "code" type - it is text logs of GEMS audio driver. and i see how you make loops for PSG case. can you give a little advice about arrays? VGM have directly loops, my "code" have many tracks per song - every track can have his own loop. i think get loopstart marker - index of array where it is start, then when get loopend - i will have index of end. how to add in the end of array his own part? i mean redim and make + of part of array.
some kind:
redim Array(arraysize(Array) + lenghofloop)
Array(loopendmarker) + (Array(loopstartmarker) to Array(loopendmarker))
have arraycommand some kind of it? or i will need to make it with ugly "for"?
some kind:
redim Array(arraysize(Array) + lenghofloop)
Array(loopendmarker) + (Array(loopstartmarker) to Array(loopendmarker))
have arraycommand some kind of it? or i will need to make it with ugly "for"?
Re: Noob's investigation of VGM
You could use a separate loop pointer for each track without appending data I guess.
If you want to append part of the array to the end, you will need to do that yourself.
There's not a simple command to do so unfortunately.
If you want to append part of the array to the end, you will need to do that yourself.
There's not a simple command to do so unfortunately.
Windows (x64)
Raspberry Pi OS (Arm64)
Raspberry Pi OS (Arm64)
-
- Enthusiast
- Posts: 619
- Joined: Fri Feb 20, 2009 9:24 am
- Location: Almaty (Kazakhstan. not Borat, but Triple G)
- Contact:
Re: Noob's investigation of VGM
i am play in one "for". if loops will have different marker - this for will be very confuse and second problem is "retriger" commands. i am not sure how it works, but probably if loops have 2 - first part plays with first retriger, second time loop will play with second retriger. it need for fade off at end of song for example. so i think it will be need write all cases in a array, only then play. will think. thanks.
Re: Noob's investigation of VGM
There seems to be a tool to merge vgm files.
https://vgmrips.net/forum/viewtopic.php?f=3&t=207
Maybe you can get inspiration from that. The source code is also available.
https://vgmrips.net/forum/viewtopic.php?f=3&t=207
Maybe you can get inspiration from that. The source code is also available.
Windows (x64)
Raspberry Pi OS (Arm64)
Raspberry Pi OS (Arm64)
-
- Enthusiast
- Posts: 619
- Joined: Fri Feb 20, 2009 9:24 am
- Location: Almaty (Kazakhstan. not Borat, but Triple G)
- Contact:
Re: Noob's investigation of VGM
not realy VGM have direct line - one line.this "code" can have many, with individual loops. it need for economy place. sega meda drive games is very limited by size so for example main melody can have length 100, drums track only 10, but have loop per 10 times. and you can hear drums in all track.
Re: Noob's investigation of VGM
I'm still a bit confused. Are you creating music for a game which should run on a real Sega and uses this GEMS driver ?SeregaZ wrote:not realy VGM have direct line - one line.this "code" can have many, with individual loops. it need for economy place. sega meda drive games is very limited by size so for example main melody can have length 100, drums track only 10, but have loop per 10 times. and you can hear drums in all track.
Windows (x64)
Raspberry Pi OS (Arm64)
Raspberry Pi OS (Arm64)
-
- Enthusiast
- Posts: 619
- Joined: Fri Feb 20, 2009 9:24 am
- Location: Almaty (Kazakhstan. not Borat, but Triple G)
- Contact:
Re: Noob's investigation of VGM
yes most work was done by some nickname shell - he make some "unpacker" and "packer" song for GEMS audiodriver. i am not romhacker, just was nice of playing in Dune with 5 houses (3 in original game). then i saw post some romhacker about politick hack of Dune - as mentat was Putin and Obama in beta version. i say joke: you need a anthem as mentat backsound. he says: made it for me. so all this starts as joke, but now i am so far from that beta version midi2gems was done, but not very well... becouse i have no VGM instruments, that can sound more close to midi-pc sound. some instruments sounds very bad. convert result is not realy... that was made by this my converter midi.
https://www.youtube.com/watch?v=1ZJHrQPVbUo
so vgm2gems was next step - convert any melody from sega games to gems. good part - instruments and notes for same cpu and will sound very very close to original. bad part - it have some dificult slide effect still make me sad but i am still work on it. little step by little step. now it sounds by some kind of this:
https://www.youtube.com/watch?v=v81qVqbz8nY
vgm track was from battletoads - non gems game. this is special gems rom for smd for tests. but it can be apply for Dune (or in a future for other gems games).
vgm player was easy part - it have ready to eat command for chips. but for more deep investigation i make code (code - txt logs of gems unpacker) player too. i hope after done this work i will understand more about PSG part of converting. problem is - YM have instruments - it is clear to understand, becouse YM have registers for this instruments settings, PSG have only 1 command, but GEMS have instrument for PSG too. this "instrument" by logic it is behavior of commands - when it need to start, how to up volume in a time, how to fade off - and etc brainbreak unanderstanable things it have 7 params - it is plan of behavior. so now i think about it. loops probably can wait.
aaa! i forgot ask about arrays my structure have some image of file - for creating it a make allocatememory and write into it. when song is change - main array is Dim to 0 again (Redim to 0 some how is not helps and new song remember part of oldone, that is why i made Dim again with same name). this allocates need to be free, or this new Dim with same name - make frees by default? or i have memory leak?
https://www.youtube.com/watch?v=1ZJHrQPVbUo
so vgm2gems was next step - convert any melody from sega games to gems. good part - instruments and notes for same cpu and will sound very very close to original. bad part - it have some dificult slide effect still make me sad but i am still work on it. little step by little step. now it sounds by some kind of this:
https://www.youtube.com/watch?v=v81qVqbz8nY
vgm track was from battletoads - non gems game. this is special gems rom for smd for tests. but it can be apply for Dune (or in a future for other gems games).
vgm player was easy part - it have ready to eat command for chips. but for more deep investigation i make code (code - txt logs of gems unpacker) player too. i hope after done this work i will understand more about PSG part of converting. problem is - YM have instruments - it is clear to understand, becouse YM have registers for this instruments settings, PSG have only 1 command, but GEMS have instrument for PSG too. this "instrument" by logic it is behavior of commands - when it need to start, how to up volume in a time, how to fade off - and etc brainbreak unanderstanable things it have 7 params - it is plan of behavior. so now i think about it. loops probably can wait.
aaa! i forgot ask about arrays my structure have some image of file - for creating it a make allocatememory and write into it. when song is change - main array is Dim to 0 again (Redim to 0 some how is not helps and new song remember part of oldone, that is why i made Dim again with same name). this allocates need to be free, or this new Dim with same name - make frees by default? or i have memory leak?
Re: Noob's investigation of VGM
That's quite amazing, that you are attempting to create music for that GEMS driver.
It's probably not only volume which is affected by it. It is also very likely the instrument choice results in slight frequency changes while a tone is playing.SeregaZ wrote:PSG have only 1 command, but GEMS have instrument for PSG too. this "instrument" by logic it is behavior of commands - when it need to start, how to up volume in a time, how to fade off - and etc brainbreak unanderstanable things it have 7 params - it is plan of behavior.
I'm not sure if it will leak this way or not. You could use the debugger tools. Another option is to use C-style arrays and allocate the memory yourself.SeregaZ wrote:this allocates need to be free, or this new Dim with same name - make frees by default? or i have memory leak?
Windows (x64)
Raspberry Pi OS (Arm64)
Raspberry Pi OS (Arm64)
-
- Enthusiast
- Posts: 619
- Joined: Fri Feb 20, 2009 9:24 am
- Location: Almaty (Kazakhstan. not Borat, but Triple G)
- Contact:
Re: Noob's investigation of VGM
yes yes slide effect do this note still plays, but it change pitch per time. like Rock'n'Roll Racing game songs. it have a loooot this slideswilbert wrote: It's probably not only volume which is affected by it. It is also very likely the instrument choice results in slight frequency changes while a tone is playing.
Re: Noob's investigation of VGM
I know slide effects do this but what I really meant was a sort of vibrato, where the frequency constantly floats around the desired note instead of maintaining the exact note frequency.SeregaZ wrote:yes yes slide effect do this note still plays, but it change pitch per time. like Rock'n'Roll Racing game songs. it have a loooot this slides
Windows (x64)
Raspberry Pi OS (Arm64)
Raspberry Pi OS (Arm64)
-
- Enthusiast
- Posts: 619
- Joined: Fri Feb 20, 2009 9:24 am
- Location: Almaty (Kazakhstan. not Borat, but Triple G)
- Contact:
Re: Noob's investigation of VGM
this gems have some modulation_03.mod files - probably this is it - vibrato i probably will make a lot of test to understand how this files work.
-
- Enthusiast
- Posts: 619
- Joined: Fri Feb 20, 2009 9:24 am
- Location: Almaty (Kazakhstan. not Borat, but Triple G)
- Contact:
Re: Noob's investigation of VGM
this part of code ValleyBell probably read this modulations file:
but i am not understand yet it is parse all modulation, or individual. probably all.
file of all is:
individual:
this individual makes slide with low of note. and by idea it need to have some: time, frequency, time, frequency... (time probably long of time, not when start time). or not frequency but pitch value. pitch value must be 2 bytes - becouse code file have pitch command and it looks like "pitch $0000"
aha! DOS GEMS is help... particular...
Code: Select all
// DOENVELOPE - update the pitch envelope processor
static void DOENVELOPE(void)
{
UINT8* CurECB; // Register IX
UINT8 TestRes;
UINT32 SegPos; // Register HL
UINT8 SegCntr; // Register A
UINT16 SegVal;
UINT8* CurPB; // Register IY
CurECB = ECB; // point at the envelope control blocks
//envloop:
while(1)
{
DACxME();
if (CurECB[ECBCHAN] & 0x80) // end of list? [BIT #7]
break; // yup - return
if (! (CurECB[ECBCHAN] & 0x40)) // active ? [BIT #6]
{
//envactive: // check if this envelope's timebase has ticked
if (TBASEFLAGS & 0x20) // sfx timebase? [BIT #5]
//envsfx:
TestRes = (TBASEFLAGS & 0x01); // yes - check sfx tick flag [BIT #0]
else
TestRes = (TBASEFLAGS & 0x02); // no - check music tick flag [BIT #1]
if (TestRes)
{
//envticked:
if (CurECB[ECBCTR] == 0) // ctr at 0?
{
//envnextseg: // yes - [Note: The comment is really cut here.]
SegPos = (CurECB[ECBPTRH] << 8) | (CurECB[ECBPTRL] << 0);
SegPos -= 0x1E80; // [1E80 is subtracted to make up for ENV0BUF[]]
SegCntr = ENV0BUF[SegPos];
if (SegCntr == 0)
{
// jr envdone
TestRes = 0x00;
}
else
{
SegPos ++;
CurECB[ECBDELL] = ENV0BUF[SegPos];
SegPos ++;
CurECB[ECBDELH] = ENV0BUF[SegPos]; // ECB's delta <- this segment's delta
SegPos ++;
DACxME();
SegPos += 0x1E80; // [not in actual code, SegPos is relative to ENV0BUF here]
CurECB[ECBPTRL] = (SegPos & 0x00FF) >> 0;
CurECB[ECBPTRH] = (SegPos & 0xFF00) >> 8;
// [fall through to envseg]
}
}
else // no - process segment
{
SegCntr = CurECB[ECBCTR] - 1;
}
if (TestRes) // [need to check that, since envdone skips envseg]
{
//envseg:
CurPB = &PBTBL[CurECB[ECBCHAN] & ~0x20]; // ptr to this channel's pitchbend entries [RES #5]
CurECB[ECBCTR] = SegCntr;
SegVal = (CurPB[PBEBH] << 8) | (CurPB[PBEBL] << 0);
SegVal += (CurECB[ECBDELH] << 8) | (CurECB[ECBDELL] << 0);
CurPB[PBEBL] = (SegVal & 0x00FF) >> 0;
CurPB[PBEBH] = (SegVal & 0xFF00) >> 8;
// [fall through to envneedupd]
}
else
{
//envdone:
CurPB = &PBTBL[CurECB[ECBCHAN] & ~0x20]; // ptr to this channel's pitchbend entries [RES #5]
CurPB[PBEBL] = 0; // zero the envelope bend on this channel
CurPB[PBEBH] = 0;
CurECB[ECBCHAN] = 0x40; // shut off this envelope
//jr envneedupd
}
//envneedupd:
CurPB[PBRETRIG] |= 0x01; // [SET #0]
NEEDBEND = 1;
//jr envnext
}
}
//envnext: // nope - loop
CurECB ++;
}
return;
}
file of all is:
Code: Select all
02 00 00 00 FA E7 FF 32 E7 FF 32 E7 FF 32 E7 FF 00
individual:
Code: Select all
00 00 FA E7 FF 32 E7 FF 32 E7 FF 32 E7 FF 00
aha! DOS GEMS is help... particular...
Code: Select all
*
* Modulator Offset Table
*
dc.b $02,$00 ; Offset to modulator #0: 2
*
* Modulator Data
*
* Modulator 0 "NEW": Pitch
dc.b $57,$04 ; initial value = 1111
dc.b $D05,$5C,$11 ; len = 3333, slope = 4444
dc.b 0
Re: Noob's investigation of VGM
That makes more sense compared to the other code you postedSeregaZ wrote:aha! DOS GEMS is help... particular...Code: Select all
* * Modulator Offset Table * dc.b $02,$00 ; Offset to modulator #0: 2 * * Modulator Data * * Modulator 0 "NEW": Pitch dc.b $57,$04 ; initial value = 1111 dc.b $D05,$5C,$11 ; len = 3333, slope = 4444 dc.b 0
Windows (x64)
Raspberry Pi OS (Arm64)
Raspberry Pi OS (Arm64)
-
- Enthusiast
- Posts: 619
- Joined: Fri Feb 20, 2009 9:24 am
- Location: Almaty (Kazakhstan. not Borat, but Triple G)
- Contact:
Re: Noob's investigation of VGM
but i am anyway not see light in a dark tunnel this dos says 2 byte per param, but that unpacked version have 3 bytes for all data. files always x3. 6bytes, 9, 15, 63 - end etc x3. it means 1 byte per param. manual tests still mystery... logic am still dont understand maybe it need to find that dos version autors )))) this program was made in 1994.