VGM playback on the SPC

Discussion of hardware and software development for Super NES and Super Famicom.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
mic_
Posts: 922
Joined: Thu Oct 05, 2006 6:29 am

Post by mic_ »

Huh.. is that PAL or NTSC? I've tested it mainly on a PAL SNES / BSNES with PAL emulation. Never noticed any graphical glitches.
orwannon
Posts: 40
Joined: Fri Feb 20, 2009 10:07 am

Post by orwannon »

I tried it under 60 Hz only (NTSC SNES & bsnes) but will try again in PAL mode. :)
mic_
Posts: 922
Joined: Thu Oct 05, 2006 6:29 am

Post by mic_ »

I just tried it in BSNES.. in NTSC mode I can replicate it if I press X & Y repeatedly in fairly quick succession. In PAL mode I wasn't able to replicate it.

I guess I'm pretty tight on vblank time in NTSC mode. Perhaps I should do the volume bar update to RAM instead and DMA the new data to VRAM during the next vblank, like I do with the song list.
mic_
Posts: 922
Joined: Thu Oct 05, 2006 6:29 am

Post by mic_ »

I've released the source code for my music disk (you can download it here). Included is the UI code, as well as the VGM playback code for the SPC. The VGM packer is also included in the archive, so it's possible to replace the songs.

This code wasn't originally meant to be released, so it's not pretty to look at. At least I've cleaned it up a little bit.

The graphical glitches that orwannon reported have been fixed AFAICT, as well as a couple of other minor UI bugs.
mic_
Posts: 922
Joined: Thu Oct 05, 2006 6:29 am

Re: VGM playback on the SPC

Post by mic_ »

I've made some updates on the musicdisk. The new ROM is found here (and here's a video of it running on my SNES).

The compression scheme used for the VGM data has been improved, so I decided to include some more songs. 18 more to be precise. This also left me with some spare RAM on the SPC side, which is decided to give to the DSP's echo processor to implement a sort-of poor man's delayed bass boost (you can toggle this on/off with Select+A).
I've also improved the timing, so the playback rate should be more even now.
User avatar
blargg
Posts: 3717
Joined: Mon Sep 27, 2004 8:33 am
Location: Central Texas, USA
Contact:

Re: VGM playback on the SPC

Post by blargg »

Delayed? As I recall, EDL=0 gives you only one sample delayed echo, and the FIR still works normally (since the history buffer is in internal registers, rather than read from RAM each sample). Or maybe you want it delayed...

Seems like you could do treble and bass adjustment by feeding everything into the echo buffer, turning main volume to zero so that only the echo plays through its FIR, and having feedback volume=0 so you don't get any feedback. Then set the center FIR coefficient to 64 (0.5) and you can then increase/decrease treble and bass. Just going by memory of the SPC here.
mic_
Posts: 922
Joined: Thu Oct 05, 2006 6:29 am

Re: VGM playback on the SPC

Post by mic_ »

It's mainly because I started out with a standard echo with a flat frequency response filter, which I thought sounded better with a fairly long delay. Then I tried out different types of filters, but kept the delay and feedback pretty much unchanged.

Could be nice to have several different filters that the user can select from. I still have some spare RAM on the SPC, so it should be possible to shoehorn in somewhere.

That would make a nice feature for a SNES sound library btw; low/high/band pass filters with adjustable cutoff frequency, so you can do SID-style filter sweeps.
mic_
Posts: 922
Joined: Thu Oct 05, 2006 6:29 am

Re: VGM playback on the SPC

Post by mic_ »

Here's yet another updated ROM (youtube video).

The latest source code is available here. For the filter-related stuff, look for the update_filter routine in vgmplay_spc700_ext.asm, which is triggered by the NextFilter routine in t700c.asm.

This version has the following filter settings that you can switch between:
* Off (no filtering)
* Standard echo, 80ms delay
* Bass boost (low pass filter mixed with an attenuated version of the original signal)
* Bass boost, 80ms delay
* Treble boost (high pass filter mixed with an attenuated version of the original signal)

Use Right on the D-Pad to switch filter. I also made it so that the song isn't restarted when a new filter setting is applied.
User avatar
zephemeros
Posts: 2
Joined: Sun Nov 04, 2012 5:42 pm
Location: Campbell River, BC

Re: VGM playback on the SPC

Post by zephemeros »

Not sure if it really matters anymore or if it's worth the bump, but I'm getting some graphical glitches on real (2-1-3) NTSC hardware using an sd2snes.

EDIT: Turns out this was an sd2snes issue, not an actual hardware issue. The latest firmware update seems to have fixed things.
mic_
Posts: 922
Joined: Thu Oct 05, 2006 6:29 am

Re: VGM playback on the SPC

Post by mic_ »

There is actually a GUI bug even in the latest version of my player where the volume bars can get messed up. I've triggered it myself a couple of times, but I don't have a sure-fire way of reproducing it.
Post Reply