Gamecube chiptune player

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Gamecube chiptune player
by on (#127278)
I'm not sure if the Gamecube really qualifies as "retro" - but hey, it was released the same year as the Gameboy Advance.

In any case, I recently got an SD Media Launcher so that I can run my own code on the Gamecube, so I decided to write something. And what better to write than a chiptune player? :P

Here's the result:

Image

Download the DOL file if you want to run it on your own Gamecube (it also works quite well in Dolphin).
Or watch a YouTube video captured from my PAL Gamecube.

All the emulation code (6510, SID, YM2149) is my own. Audio is generated at 44.1 kHz mono and output using libasnd.

The UI is done in just about the least efficient way possible: I keep an offscreen 24-bit RGB buffer in RAM that I draw into. I then convert this buffer to the native framebuffer format (YUV 4:2:2) for every frame. It works well enough for what I needed, though.
Re: Gamecube chiptune player
by on (#127313)
Pretty cool. Are you planning to write more GameCube homebrew? I'd say it's getting to be retro or considered so.

I've thought about writing GameCube homebrew before, but I never looked into what tools and what if any libraries were available. I'm guessing SDL might have been ported? Though I prefer Allegro.
Re: Gamecube chiptune player
by on (#127315)
There's something called cubeSDL, but I haven't checked it out myself. I don't know if Allegro is available. The only thing I can find when I do a web search is a bunch of polish-language pages :P

devkitPro includes a bunch of examples for various areas (graphics, audio, accessing SD cards, etc), so I just took one of the example projects and started adding my own stuff to it. Then it was as simple as running "make" and opening the resulting DOL in Dolphin.
I'm not sure what kind of debugging support there is, though. Dolphin appears to be geared more towards gaming. The Gamecube does at least seem to have some kind of memory protection enabled, because I managed to trigger some sort of exception handler early on during development that threw up a register dump on screen out of pure digust with what my program was doing.
Re: Gamecube chiptune player
by on (#127354)
If I ever get around to it, I should look at this devkitPro with the examples. The GameCube seems like a reasonably capable system for alot of types of games. I suppose you could run a whole game off the SD card, loading whatever you needed into RAM as needed.
Re: Gamecube chiptune player
by on (#127355)
And that really wouldn't be too different from how real games for FDS, GameCube, DS, and Wii work.
Re: Gamecube chiptune player
by on (#127399)
Possible to make a Wii port of this? Would be very useful.
Re: Gamecube chiptune player
by on (#127401)
I've definitely booted gamecube .dol files directly on the wii using wiixplorer. I think I've done it using the homebrew channel netboot, too, but it's been long enough that I'm not certain.

Downside, I guess, is that you have to use the gamecube controller to control it.
Re: Gamecube chiptune player
by on (#127404)
Quote:
Possible to make a Wii port of this? Would be very useful.

That's sort of the idea (that's where the 'W' in the name comes from). I might not add wiimote support though (i.e. you'd need a Gamecube controller). The only thing I'm unsure of right now is whether it's possible to write straight into the framebuffer on the Wii, or if I'll need to change how I display the GUI.
Re: Gamecube chiptune player
by on (#127454)
A lot of the Wii's these days don't have GameCube ports anymore and unless you do a lot of searching it's not easy to find one that does have them.
Re: Gamecube chiptune player
by on (#127456)
Nintendo introduced the "Wii Family Edition", the first Wii revision outside Korea not to include GameCube support, in the fourth quarter of 2011. This means the first five years of used Wii consoles have GameCube support. The second Wii without GameCube support is the Wii mini, but that doesn't have an SD slot anyway so there's no way I can think of to run homebrew on it.
Re: Gamecube chiptune player
by on (#127475)
B00daW wrote:
A lot of the Wii's these days don't have GameCube ports anymore and unless you do a lot of searching it's not easy to find one that does have them.

Perhaps where you live, but I can easily get a used Wii around here for $30 or so with gamecube ports. I still haven't seen in person one without them yet.
Re: Gamecube chiptune player
by on (#127496)
I've updated the player with support for NSF (2A03 only) and VGM (SN76489 only) files. The number of panels in the GUI is static, so I only visualize the volume for the first 3 channels. However, the visual keyboard also shows the DMC channel, as well as the SN76489 noise channel when it's configured to output a square wave.

I've made a couple of additions to the controls as well: up/down on the analog stick can be used to scroll faster through the song list, and Z can be used to switch to solo mode (press repeatedly to select which channel to output).

Download the DOL here.
Watch a capture on youtube here.
Re: Gamecube chiptune player
by on (#127682)
Support for GBS files has been added. It's still a bit buggy (in particular, I believe there's a problem with the envelope generators), and it currently doesn't emulate the sweep unit.

Download the DOL here.
Watch a capture on youtube here.
Re: Gamecube chiptune player
by on (#127756)
The player now supports VRC6 and Sunsoft-5B audio (though not both at the same time). The S5B emulation is still a bit buggy, and my mixing of the expansion audio channels is probably not all that accurate.

Download the DOL here.
Watch a capture on youtube here.
Re: Gamecube chiptune player
by on (#127765)
mic_ wrote:
The player now supports VRC6 and Sunsoft-5B audio (though not both at the same time). The S5B emulation is still a bit buggy, and my mixing of the expansion audio channels is probably not all that accurate.

Download the DOL here.
Watch a capture on youtube here.

If it would help, I can make some reference recordings of Akumajou Dracula and Gimmick! for native VRC6 and 5B sound. So far every emulator I've tried has poorly done the mixing and a lot of things do not sound right.
Re: Gamecube chiptune player
by on (#127771)
Quote:
If it would help, I can make some reference recordings of Akumajou Dracula and Gimmick!

Recordings from a real NES/FC with a real VRC6/5B cart would be nice. Of course, the best thing would be if someone could run dedicated test ROMs, but the audio output from games that used these chips are better than nothing.
Re: Gamecube chiptune player
by on (#127806)
I've now built a Wii version of the player that can be loaded through the Homebrew Channel. It has basic wiimote support (no point-'n-click; just the d-pad and some buttons), but can also be controlled with a Gamecube controller on the Wii.

A small UI change in both versions is that during NSF playback, expansion audio channels are now visualized on the on-screen keyboard (using a slightly different color compared to the other channels).

Download the archive containing the Gamecube DOL and the Wii HBC app.
Re: Gamecube chiptune player
by on (#127808)
Looks and sounds nice! Unfortunately I'm foolish enough to be using 480i on a CRT, so the single scanline high white lines flicker obnoxiously.
Re: Gamecube chiptune player
by on (#127824)
I've added support for MMC5 audio (pulse channels only). Another new feature is the ability to toggle between output of just the 2A03 channels, and just the expansion audio channels.

Download the archive containing the Gamecube DOL and the Wii HBC app.
Watch a capture on youtube here.

Quote:
Unfortunately I'm foolish enough to be using 480i on a CRT, so the single scanline high white lines flicker obnoxiously.

I don't have any CRT TVs to test on. I'm using the 4:3 mode on an LCD TV.
Re: Gamecube chiptune player
by on (#127826)
To make a user interface look good in standard definition, you need to design it in 320x240, scale it up by a factor of 2, and round off the corners as needed. In 480i, font strokes should be at least 2 pixels wide.
Re: Gamecube chiptune player
by on (#127836)
tepples wrote:
You need to design it in 320x240, scale it up by a factor of 2, and round off the corners as needed.
You don't need to go that far. Just take the input 480-lines image and filter it vertically with a [.5 1 .5] filter, possibly with gamma correction and de-correction before and after the filter. Horizontally I wouldn't worry about things at all.

The service manual for this TV claims a resolution of 250Wx300H. This isn't equivalent to a 250x300 pixel bitmap, though, because phase information is retained within a pixel.
Re: Gamecube chiptune player
by on (#127839)
lidnariq wrote:
tepples wrote:
You need to design it in 320x240, scale it up by a factor of 2, and round off the corners as needed.
You don't need to go that far. Just take the input 480-lines image and filter it vertically with a [.5 1 .5] filter

The GameCube and Wii GPU can reportedly do exactly this, and Super Smash Bros. Melee and Super Smash Bros. Brawl give the player options to turn it on and off. But that still won't make tiny text very readable.

Phase information is retained within a low-resolution bitmap too, as gray shades on the sides of objects. That's what font antialiasing is supposed to be about, and it's how the primitive multisample AA worked on the Nintendo 64.
Re: Gamecube chiptune player
by on (#127842)
tepples wrote:
Phase information is retained within a low-resolution bitmap too, as gray shades on the sides of objects.
But that assumes the horizontal resolution limitation is due to the analog bandwidth of the TV, and is an analog lowpass with a clear extinction frequency, rather than (for example) an artifact of the aperture grille.