Bad Apple demo for SNES

Discussion of hardware and software development for Super NES and Super Famicom. See the SNESdev wiki for more information.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
tepples
Posts: 22915
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Bad Apple demo for SNES

Post by tepples »

Then what's the impulse response of your expensive prefilter? For example, if I pass the sample [..., 0, 0, 16384, 0, 0, ...] through it, what do I get?
psycopathicteen
Posts: 3197
Joined: Wed May 19, 2010 6:12 pm

Re: Bad Apple demo for SNES

Post by psycopathicteen »

I think I'll just stick to plain vanilla 16kHz BRR for now.
93143
Posts: 1875
Joined: Fri Jul 04, 2014 9:31 pm

Re: Bad Apple demo for SNES

Post by 93143 »

tepples wrote:Then what's the impulse response of your expensive prefilter? For example, if I pass the sample [..., 0, 0, 16384, 0, 0, ...] through it, what do I get?
...I'm really not thinking things through here. I'm chronically behind on my research, so I end up in a mild panic whenever I do anything else.

The impulse responses are different for different input frequencies, as I mentioned earlier. I only did 16 and 32 kHz; here are the full impulse responses at 24-bit resolution:
gpre_ir.rar
(5.55 KiB) Downloaded 295 times
The 16 kHz one clipped when I used 50% amplitude as an input, so I went with 25% for both.

Since the filtering is done at the specified input sample rate, rather than at a higher rate for later resampling, the 16 kHz one should be applicable at a range of sample rates as long as they don't approach 32 kHz. If the response near 32 kHz works the way I suspect it does, it's probably not hard to come up with a differential filter that could be applied before resampling or something like that, so that the lower-rate filter would then work across the whole range, but I really have to stop this for the moment and do some work...
psycopathicteen wrote:I think I'll just stick to plain vanilla 16kHz BRR for now.
That's probably a good idea. In addition to complicating the sound driver, this scheme requires somebody to do a lot of fiddly sequencing; I really don't have the time right now and I can't really ask anyone else to do it. (I was hoping someone with actual SPC700 expertise would take an interest and volunteer, but...) Plus, since it doesn't require any extra CPU time, it won't disturb the video codec, meaning it shouldn't be especially hard to add in later.

How do you plan to stream the audio?
93143
Posts: 1875
Joined: Fri Jul 04, 2014 9:31 pm

Re: Bad Apple demo for SNES

Post by 93143 »

I hesitate to bump this thread, but I don't want this stuff scattered around the forum, and anyway it's not a whole lot less relevant to the topic than it was the first time...

I've modified my 16 kHz filter slightly, adding a very narrow 1.1 dB cut at 7,860 Hz. You might not hear a difference, but it now meets the +/- 0.2 dB ripple spec right up until the plot starts to go nuts in a case-dependent fashion a little past 7.8 kHz. The IR is significantly longer than the first version, possibly because the new filter is very steep, or possibly because I ran out of filter slots in PLParEQ3 (it's in the name) and had to use a second instance, so the up- and down-sampling was done twice.
gpre_ir_v2.7z
(19.94 KiB) Downloaded 262 times
93143 wrote:I'd kinda like to be able to do the squiggly synth sound that sometimes accompanies the crash at the beginning of a section, but it's very difficult to isolate and I don't believe in my ability to reconstruct it from scratch (I'm not a synth guy)...
Never mind; it wasn't that tough after all. A high-frequency sine wave with strong triangle LFO pitch modulation at ~18 Hz seems to work well enough, particularly with some reverb added.

The new sample is well over a second long, with the result that the whole sample pack is now 54,468 bytes. It's not all that tough to get a half-decent-sounding loop, but I'm probably not going to try to optimize until it's clear there's a need.
basamples_v2.7z
(48.8 KiB) Downloaded 241 times
Oh, and the new sample is much louder than it should be with respect to the other samples, because it was synthesized rather than lifted from the (CD version of the) track itself. My excuse is that it's better to use one's ears at mix time rather than attempting to gain-correct things a priori and getting them slightly wrong but not wrong enough to notice until it's too late...
Last edited by 93143 on Tue Mar 03, 2015 10:19 pm, edited 1 time in total.
psycopathicteen
Posts: 3197
Joined: Wed May 19, 2010 6:12 pm

Re: Bad Apple demo for SNES

Post by psycopathicteen »

Is there some kind of glitch in BSNES that doesn't allow the 65816, SPC700 and DSP to do be properly synced at the same time? I can get it to run code that alters the BRR samples in real time, and have the 65816 transfer data to the SPC700 in real time, but not both at once.
lidnariq
Site Admin
Posts: 11716
Joined: Sun Apr 13, 2008 11:12 am

Re: Bad Apple demo for SNES

Post by lidnariq »

93143 wrote:The IR is significantly longer than the first version, possibly because the new filter is very steep
That's exactly why. The sharper the filter, the longer it takes to determine whether any given input frequency is affected or not.
psycopathicteen
Posts: 3197
Joined: Wed May 19, 2010 6:12 pm

Re: Bad Apple demo for SNES

Post by psycopathicteen »

93143
Posts: 1875
Joined: Fri Jul 04, 2014 9:31 pm

Re: Bad Apple demo for SNES

Post by 93143 »

Cool. Getting closer...

Are you just using a tight loop then? That would certainly explain the extra slowdown. The reduced pitch does make it nicer to watch through to the end, since it kind of stays in sync (it crashes to a garbage screen after finishing).

Also, there seems to be fairly regular popping in the audio, which I assume is not part of the data itself. Could it be related to bank boundaries?

How much spare CPU time do you have without the music? Did you manage to completely eliminate the slowdown? I figure it should be possible to use HDMA to get the audio overhead down to a few percent of a frame.
User avatar
TOUKO
Posts: 307
Joined: Mon Mar 30, 2015 10:14 am
Location: FRANCE

Re: Bad Apple demo for SNES

Post by TOUKO »

psycopathicteen wrote:
Speaking of which, how's that Bad Apple demo going?
I had difficulty programming the compression encoder, since I am not used to high level languages.

I did notice that it can be compressed a lot, just by doing RLE on 8x1 slivers in a vertical direction. Using per pixel LZSS looks a bit overkill to me.
Hi guy, you have a full lz4 compressor(PC side)/decompressor for 65816 here :
http://www.brutaldeluxe.fr/products/crossdevtools/lz4/

All is very well explained,if it can help you .
Stef
Posts: 263
Joined: Mon Jul 01, 2013 11:25 am

Re: Bad Apple demo for SNES

Post by Stef »

psycopathicteen wrote:http://s000.tinyupload.com/index.php?fi ... 8411147693
http://www.megafileupload.com/796/BadApple.zip

I got the music working, but it doesn't use the HDMA trick.
Cool to see it happen, really close indeed, well done :)
I used No$SNS 1.5 to play it and i got some garbage in sound, i guess it comes from the emulator... which emulator is the best suited to emulate properly here ? Higan maybe ?
User avatar
TOUKO
Posts: 307
Joined: Mon Mar 30, 2015 10:14 am
Location: FRANCE

Re: Bad Apple demo for SNES

Post by TOUKO »

psycopathicteen wrote:http://s000.tinyupload.com/index.php?fi ... 8411147693
http://www.megafileupload.com/796/BadApple.zip

I got the music working, but it doesn't use the HDMA trick.
wahou, congrats i'am speechless, really :shock: ...
93143
Posts: 1875
Joined: Fri Jul 04, 2014 9:31 pm

Re: Bad Apple demo for SNES

Post by 93143 »

Stef wrote:I used No$SNS 1.5 to play it and i got some garbage in sound, i guess it comes from the emulator... which emulator is the best suited to emulate properly here ? Higan maybe ?
I used higan (balanced, of course - my laptop can't keep up with accuracy core). It pops every few seconds, but nothing like the mess no$sns makes. And of course the pitch is a bit low; I assume this is a temporary measure to compensate for the slowdown.

Snes9X freezes, and ZSNES doesn't even start. I can't run it on a real SNES; my Super Everdrive complains that the file is too big...
Stef
Posts: 263
Joined: Mon Jul 01, 2013 11:25 am

Re: Bad Apple demo for SNES

Post by Stef »

Cool thanks, i will try that on Higan then :) Is there any flashcart supporting 8 MB file on SNES ?
Edit:
I guess i have my reply : viewtopic.php?f=12&t=4380&start=75 :)
93143
Posts: 1875
Joined: Fri Jul 04, 2014 9:31 pm

Re: Bad Apple demo for SNES

Post by 93143 »

SD2SNES and PowerPak can handle 8 MB or even 12 MB (the Star Ocean hack) just fine.

I should have checked more carefully; I thought the Super Everdrive could handle 8 MB, but the manual says 7 MB. Darn it...
Stef
Posts: 263
Joined: Mon Jul 01, 2013 11:25 am

Re: Bad Apple demo for SNES

Post by Stef »

Too bad, i had the same surprise with my everdrive. I though it can handle 8 MB rom because it has 8 MB flash but it does only support 6 MB max :-/
Post Reply