Blargg APU, SPC seek() implementation

Seek()

Especially with regard to one of STD’s primary functionalities — Transcribing music — it would be essential to have a seek ability, much like any wave file player.. Teh difference is that an SPC is a program, not just data that is read and played like a WAV. An SPC is a living program. Thus, you cannot just seek 20 seconds into a program without actually executing it at an extremely high rate in order to make that change instantaneous. This is the problem with seeking on SPC.

1) Create a second-by-second Savestate Profile

You have your base SPC..
after every second passes, you record down a minimized diff-SPC from the 0:00 one.
repeat until end of song..
you then have a sequence of second-interval diff-SPC’s that can be loaded as the user seeks to different positions in time.

The format of a diff-SPC is contingent on progress being made…will update soon

2) Seek at High-Rate

Seeking at a high rate may be possible, and may [not] be limited to the resolution of the clocks on the SPC700, [and performance of your PC??]..I am not sure if I can run the APU emulator even faster at a high level, but it’s worth looking into. I have sent the creator of the emu, Blargg, an email for his advice on this seek function I am looking to implement. I have not heard back from him yet, and it’s been a few days.

One thing that can be done is

/* Skip several seconds */
error( spc_skip( snes_spc, 60 * spc_sample_rate * 2 ));

This example will take several seconds to skip 60 second. It’s a fair trade at the time being.

I might be able to cheat a little.. See, most SPCs use the same clock and clock value, timer 1. And there are 2 levels of tempo adjustments possible. one at the SNES level, and one at the emulator level.. The stock emulator-level tempo adjustment only allows a speed-up of 4X. The first thing I will check is if this value can be increased further. That’s not at all close to an instantaneous seek speed. But, maybe perhaps by bringing the SNES-level clock down.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s