digital-sound-antiques / vgm-conv

Chip-type and clock converter for VGM
ISC License
45 stars 3 forks source link

Add option to log VOPM .OPM files when converting OPN to YM2413 #76

Closed dquenne closed 10 months ago

dquenne commented 1 year ago

I have modified OPNToYM2413Converter to optionally log a .opm voice file for VOPM for a given VGM file. OPNToYM2413Converter already does most of the work to compile and normalize voices, so this is a pretty trivial change.

If this change seems reasonable, I can move the new contents of the opm.ts file into ym-voice instead, since that seems like a more appropriate separation of concerns. This code works for my needs as-is, though, so I want to get some confirmation that this feature is acceptable before going through those upstream changes.

Another note: some OPM values are hard-coded, because they are not represented in OPNVoice.

An example .opm file I generated from running

vgm-conv -f ym2203 -t ym2413 -o test.vgz ./01\ Feena.vgz -D opmOutput='voicetest.opm'
//VOPM tone data
//Ripped by vgm-conv

@:0 CH0,1,2
//  LFRQ AMD PMD WF NFRQ
LFO:  31  64  64  0    0
// PAN  FL CON AMS PMS SLOT NE
CH: 64   0   4   0   0  127  0
//   AR D1R D2R  RR D1L  TL  KS MUL DT1 DT2 AMS-EN
M1:  18   0   0   6   0  35   0   2   6   0      0
C1:  18   0   0   6   0   0   0   2   5   0      0
M2:  18   0   0   6   0  35   0   2   1   0      0
C2:  18   0   0   6   0   0   0   2   0   0      0

@:1 CH2
//  LFRQ AMD PMD WF NFRQ
LFO:  31  64  64  0    0
// PAN  FL CON AMS PMS SLOT NE
CH: 64   7   4   0   0  127  0
//   AR D1R D2R  RR D1L  TL  KS MUL DT1 DT2 AMS-EN
M1:  31   2   2   0   0  33   2   2   6   0      0
C1:  22   2   3   4   2   0   1   2   5   0      0
M2:  31   2   2   0   0  13   1   1   2   0      0
C2:  22   2   3   4   2   0   1   2   1   0      0

@:2 CH0,1
//  LFRQ AMD PMD WF NFRQ
LFO:  31  64  64  0    0
// PAN  FL CON AMS PMS SLOT NE
CH: 64   7   4   0   0  127  0
//   AR D1R D2R  RR D1L  TL  KS MUL DT1 DT2 AMS-EN
M1:  31   0   8   0   4  32   3   1   2   0      0
C1:  25   7   7   7   3   0   2   1   4   0      0
M2:  31   0   8   0   4  28   3   3   5   0      0
C2:  25   8   6   7   3   0   2   1   1   0      0

@:3 CH0,1,2
//  LFRQ AMD PMD WF NFRQ
LFO:  31  64  64  0    0
// PAN  FL CON AMS PMS SLOT NE
CH: 64   7   2   0   0  127  0
//   AR D1R D2R  RR D1L  TL  KS MUL DT1 DT2 AMS-EN
M1:  25  10   0   5   1  29   1   1   4   0      0
C1:  25  11   0   8   5  15   1   5   4   0      0
M2:  28  13   0   6   2  48   1   1   3   0      0
C2:  14   4   0   6   0   0   1   1   4   0      0
okaxaki commented 1 year ago

Hi, I'm sorry for my late response.

I think the feature you suggested is great.

You're right; it would probably be better to include the contents of opm.ts in ym-voice. Could you possibly send a pull request to ym-voice as well?

Thank you very much.

dquenne commented 1 year ago

Yup no problem! I’m out of town right now but should be able to PR that in a couple weeks. Thanks!

dquenne commented 10 months ago

@okaxaki Got around to adding file generation methods to ym-voice here: https://github.com/digital-sound-antiques/ym-voice/pull/1. I've tested changes to this branch using the new ym-voice method and everything is working as expected, with much simpler code in this branch.

okaxaki commented 10 months ago

Thank you very much! I have combined this with the new patched ym-voice and verified that it works as expected. I will merge this pull request. After that, I will change the reference of ym-voice in package.json to 0.2.0.