Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support dmg sound channels with sw mixer and tracker? #749

Open
flydecahedron opened this issue Aug 15, 2024 · 5 comments
Open

Support dmg sound channels with sw mixer and tracker? #749

flydecahedron opened this issue Aug 15, 2024 · 5 comments

Comments

@flydecahedron
Copy link

Hello! Is there any interest in supporting the 4 dmg channels with the sw mixer and tracker? I've heard a few songs made that mix in the dmg sound channels like in summon night: swordcraft story, and it'd be really cool to compose with the real dmg apu alongside higher quality samples! In theory, utilizing the dmg channels could take some cpu load off of the sw mixer. I'd be willing to poke at this if given some direction.

I did see there's notes saying to not use the dmg module and the mixer module at the same time, so I get the feeling this might not align with the goals of this lib..

@gwilymk
Copy link
Contributor

gwilymk commented Aug 17, 2024

I think that would be really cool. The dmg module was thrown together in the very early days of agb, and I don't think anything uses it yet.

Would need to think about a sensible API around audio so that both the software mixing and the dmg audio could work together. But I haven't spent much time thinking about that yet since I've mainly been focused on the background handling rewrite.

Once the on-going game jams are over, I'll take a look to see what this would involve

@flydecahedron
Copy link
Author

The API I would want is essentially tracker support for the 4 dmg channels. Perhaps, during the conversion from .xm to agb's internal tracker format, the appropriate .xm commands would be translated to their dmg equivalents while checking for anything that would be unsupported. For example, there's more you can do with the wave channel than the pulse channels, and some minor differences between pulse channel 1 & 2.

I imagine if the channels are in use by the tracker, you could "override" a channel for one-off sound effects a la 1st/2nd gen pokemon. Personally, I would write any dmg-based sound effects in a tracker for a game.

For the implementation details, I believe you'd want to set the output ratios for Direct Sound and the dmg apu to 50% respectively. So, 0x0001 in REG_SOUNDCNT_H in the bottom nibble. Then, rely on the envelope and length controls to more finely mix the dmg channels with Direct Sound fifo. Ideally, that would abstract away all the gory details from the user.

Admittedly, my experience with dmg music and trackers is with LSDj, so I'm probably missing some workflow needs for a game.

@gwilymk
Copy link
Contributor

gwilymk commented Oct 15, 2024

I feel like I saw an example on discord where someone was using agb and also producing dmg audio, although I can't remember who it was that did it.

I think the biggest issue will be having it sound reasonable while your writing the music in the tracker. Ideally you'd want to enable the cool things you can do with the dmg audio, like changing the envelopes etc, but maybe we drop that entirely for this?

I personally don't have the skills to write music well enough to actually need this myself :P. But if there are some tunes using the basic sounds you can get out of the dmg sound channels, then that would help with the implementation.

@flydecahedron
Copy link
Author

Here's an example of combining GBT with Maxmod to achieve this: https://github.com/AntonioND/gbt-player/tree/master/gba/examples/combined_maxmod

They provide a tracker template (S3M files) where channels 1-4 correspond with the dmg audio channels, and the rest of the channels are Direct Sound sample based channels. The composer has to limit what they do in the tracker to the capabilities of the dmg audio channels. Then, they have a tool that splits the channels out into their GBT and Maxmod respective parts.

I imagine a similar approach could be taken here at first. For finer control of the dmg specific features, like advance usage of the wave channel, that would probably require a bespoke tracker like hugetracker or LSDj.

Matching GBT's capabilities or using it directly would be awesome. I'm happy to whip up a little test tune that exercises all the dmg audio commands. I'd Milkytracker and export to .xm, or potentially another format if needed. I could follow the same conventions laid out in that GBT/Modmax example.

SFX is a little trickier. There are tools like FX-Hammer for dmg, but I haven't used them myself. It might make sense to try to match what GB Studio supports, like this SFX pack: https://yogi-tronimal.itch.io/gbfx2.

@Chiptun3r
Copy link

Big +1 on this one.
I wanted to include nes tracks in my games and this would help greatly (I would only need to use the sw mixer for the triangle and the samples)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants