SNES Tracker

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
SNES Tracker
by on (#115144)
I am planning on making a video game for SNES, and one of the things it needs is Music. I once started getting intimate with SPC700 around the time eKid (Mukunda) was doing a lot of work with it, and we were friends at some point. He managed to help me get started. It has been years since, and I'm back at having practically no knowledge on the s***. So I remember back in that day, we were (me and kids dreaming of a SNES video game), dreaming of creating a SNES tracker, most likely as a SNES ROM itself, so that the special effects of the SNES APU could be heard authentically. I wonder what is the feasibility of this?

Audio in code form is foreign to me. Can anyone catch me up with the basic concepts I would need to master in order to get a minimal functional prototype? like something with pre-packaged samples, adjustable rhythm and pitch, adjust main song speed. I would consider that pretty minimal working first prototype (maybe even just one channel to start)

I understand loosely the concepts of uploading your SPC code to the SPC via the IPL protocol. I remember doing that once or twice in the past. Then it's just a factor of mastering the interfacing with SPC specific registers. What I have absolutely no experience in is how to get a sample playing at a certain tempo, and varying its pitch in accordance to musical note names "C-4, E-3" etc.

So that's what I need to learn. How do you, in code form, ensure rhythm and pitch?any insight is appreciated boys.
Re: SNES Tracker
by on (#115150)
Tempo is determined by the rate at which you call your playback update routine.
Traditionally on old consoles and home computers this has been tied to the vertical blanking interrupt (50 Hz on PAL machines, approximately 60 Hz on NTSC machines and most handheld systems), since this offered a regular interval at which you could call your playback routine, without being so frequent that you'd spend too many CPU cycles on music playback. This put some limits of the set of tempi that were possible to use; for example, on a PAL machine you'd have 50*60 = 3000 vblanks/minute, so your set of possible tempi would be 3000/i for 1 <= i <= 3000 (e.g. 136 BPM, 143 BPM, 150 BPM, etc).

On the SNES you're not quite as limited because you've got a processor fully dedicated to handling audio playback, so you can burn all the clock cycles you want and not care about stalling your game logic, since it runs on a separate processor. The timers offered to you by the SPC have a resolution of either 8000 Hz or 64000 Hz, both of which allow you to specify a much larger set of tempi than with vblank-based timing.

An example:

One of the 8000 Hz timers is used, and the playback routine is called at half that the timer rate (4000 Hz).
You want a tempo of 105 BPM (with one beat == one quarter note).
Your quarter notes should therefor be 38 ticks long (where one tick == one call to the playback routine). This gives you an actual tempo of 4000/38 = 105.26 BPM.


As for the pitch, it depends on the pitch of your sample, and the rate at which it was sampled. Let's say that you've got a middle C (about 262 Hz) tone sampled at 16000 Hz. If you wanted to play that sample and make it sound like a middle C you'd play it at its sample rate (16000 Hz in my example). If you wanted to transpose it one octave down you'd play it at half its sample rate, and so on.
Re: SNES Tracker
by on (#115151)
Another thing that might justify an SPC700-specific tracker is the DSP's approach to envelopes, which I don't think is identical to that of XM or IT.
Re: SNES Tracker
by on (#115152)
There is a good reason to have a SPC700 tracker: 'what you hear is what you get'. With converters and stuff it is difficult to get idea how a song will actually sounds like, you have to convert and compile it, listen, remember places where it is not quite like you want it, go back to the source, add changes, repeat the process. In my experience, it could take many hours to make minor tweaks.

However, I'd personally stay away from making a tracker like this, as it could eat major amount of time that could be rather spent to making games and other things. The only option that I may consider in the future is a SPC700 module for my 1tracker, technically it should be possible to make a SPC700 tracker based on its modules system, although with some limitations (like, no cursor that displays actual play position, and few others).
Re: SNES Tracker
by on (#115869)
Hey, bazz! It's your old pal KungFuFurby! :D

I had an idea on how a tracker could work on the SNES in a variety of different ways (one would just simply stream the note data... in this fashion, it's NES-style composing all over again, since you're limited to the SNES's clock unless you wanted to get more creative. This would happen if you have a module that's too big and you're not streaming data in "patterns"... at least in Schism Tracker terminology).

I remember a long time ago (this is back in 2007-2008) that there was an idea for a tracker called Super Spectrum from >Entertainment. I produced three of them, mainly for the opening sequence and Main Menu. I actually converted the three tracks I made to .spc as a test session with Mukunda way back in 2009 by sending the songs to Mukunda and getting the .spc files in return (I have since compiled SNESMod and have now produced a whole bunch of music... even better, there are a few SNES games that have been completed and have my music in them! ^_^ Basically, it's like a dream come true.). I had to convert my .xm files that I downloaded back to .it because I lost the originals in a hard drive crash in mid-August 2008 (however, anything produced on the G3 up until September 2007 has survived the crash.)...

The catch with a native SNES tracker is that you need a method to transfer samples from a computer to the SNES application, whether it be via .srm files or simply patching the ROM.

I also had ideas that not only could pitch modulation and noise be implemented, but theoretically, a psuedo-synth mode could be used with a collection of samples and simply modifying the loop point after a certain period of time. This should only be done with small samples (the lower your intended pitch, the larger the samples can be)... otherwise, the illusion of a synth sample probably won't work. I also have ideas for sample offset (this would be done in BRR blocks and might not be completely safe depending on the sample).
Re: SNES Tracker
by on (#115873)
Quote:
I also had ideas that not only could pitch modulation and noise be implemented, but theoretically, a psuedo-synth mode could be used with a collection of samples and simply modifying the loop point after a certain period of time. This should only be done with small samples (the lower your intended pitch, the larger the samples can be)... otherwise, the illusion of a synth sample probably won't work. I also have ideas for sample offset (this would be done in BRR blocks and might not be completely safe depending on the sample).

Modify the loop point sounds a bit weird (while technically perfectly possible), but modifying the short sample data itself directly is done by Chrono Trigger (instrument #16). It's used heavily in both music and sound effect.
Re: SNES Tracker
by on (#115874)
What up dude!! I was completely blind-sided by your comment. Man the memories!!!
Re: SNES Tracker
by on (#115875)
I suppose I shouldn't say that I was in >Entertainment X: