vgmrips / vgmtools

A collection of tools for the VGM file format
GNU General Public License v2.0
118 stars 18 forks source link

vgm_ptch strip command does not strip individual channels #19

Closed meyertime closed 2 years ago

meyertime commented 2 years ago

Hi, first of all, thanks for these tools! I thought I found the holy grail when I saw that vgm_ptch has a strip command to filter out specific chips and channels. However, when I tried to use it, it will filter out the entire chip, but not individual channels. The .vgm files I am using are for the Genesis, so they have SN76496 and YM2612 data.

Is channel stripping implemented for those chips? If not, could you point me in the right direction in the code?

Ok, so since writing this, I see that vgm_ptch -striplist says that YM2612 does not support channel stripping, but it doesn't say that about SN76496, and when I try it, it doesn't work for either chip. But in any case, if you can offer any insight, it would help me try to add support.

I'm trying to produce a .vgm file for each channel so that I can play them individually on a real Genesis with a flash cartridge and a VGM player ROM. I have already accomplished this with vgm2wav, which was super helpful, but now I want to record it from the real hardware.

ValleyBell commented 2 years ago

The channel stripping code is in chip_strp.c.

sn76496_write handles SN76496 channels ... aaand, actually [the code is broken and only "channel 0" is working. This bit shift should be >>5 instead of >>1.

ym2612_write handles YM2612 stripping and currently is dummied out using a return true. The rest of the code is leftover stuff from vgm_cmp (chip_cmp.c). In order to add per-channel stripping support, you need to determine the channel for each register and return false for everything that needs to be trimmed off.

meyertime commented 2 years ago

Thanks @ValleyBell, this is really helpful! Do you know if there is any documentation or code I could refer to in order to learn the instructions for the YM2612 chip?

ValleyBell commented 2 years ago

You could look at the YM2612 manual, which should be decent enough to get an idea of how the chip works in general. vgm2txt (chiptext.c) also has some YM2612 code, which you could use to get an idea of how the register <-> channel assignments work.

ValleyBell commented 2 years ago

solved by #20