Dwedit's Board

Enjoy the board

You are not logged in.

Announcement

Welcome, fellow visitors from other websites!
Whenever you download a file, I'd appreciate it if you posted a nice "Thank You" message, then tell me which site you came from. Thanks.
- Dwedit

#1 2005-12-28 6:26:41 pm

Rhete
Member
Registered: 2005-06-15
Posts: 22

NES Music in flash

From Dwedits page:

"Uses a special trick to get high quality NES music for the small file size.
The square waves and triangle wave are extracted as separate wav files.  They are included in the .swf as RAW format audio events.  Then Flash 6's gzip compression kicks in, and the file becomes much much smaller.  Like from 12 megs to <150k"


Two questions, how do I extract square and triangle wavs seperately?

Secondly will the compression work in flash 5?

Offline

#2 2005-12-28 7:36:04 pm

Dwedit
Administrator
From: Chicago
Registered: 2004-12-12
Posts: 1,017
Website

Re: NES Music in flash

Get G-NSF from http://www.zophar.net/utilities/nsf.html
Click the Setting menu.  Enable only one of the first 5 channels.
File > Export WAV.  Enter a time length to export in seconds (it always exports from the beginning).
Repeat for each channel, obviously using a different output file for each channel.
Then edit them with goldwave or something if you want to trim them to loop nicely.  Make sure they are the exact same length.

In the example I made, the square wave, other square wave, and triangle wave were audio events, and the noise+dpcm was a stream.  I had the square waves played with different panning for a little stereo effect.

Note: Flash Player can only play 4 audio events at the same time.

I don't know of Flash 5 supports exporting audio events as RAW format, but Flash 6 can.  To compress a Flash 5 movie, use F2B SWF Compressor (attached).

Edit: After a little while of hacking around, I've figured out exactly how that program works, and how to compress even better than that program does...

Edit: That program gives poor compression ratios.  I'll go write a better one!  7-ZIP POWER!


Attachments:
Attachment Icon SwfCompressorSetup.zip, Size: 82,337 bytes, Downloads: 176

"We are merely sprites that dance at the beck and call of our button pressing overlord."

Offline

#3 2005-12-28 9:37:03 pm

Rhete
Member
Registered: 2005-06-15
Posts: 22

Re: NES Music in flash

Thank you a lot for the help.  I was able to get it working somewhat in Flash 4, though with some trouble.  The wav files play too slowly, and it doesnt always want to start 3 layers of sound at the exact same moment which is annoying.  Plus streaming sound + games = bad news when it comes to framerate.  I think i'll just stick to mp3 compression for now

Offline

#4 2005-12-29 12:22:09 am

Dwedit
Administrator
From: Chicago
Registered: 2004-12-12
Posts: 1,017
Website

Re: NES Music in flash

I finished my swf recompressor program, and it seems to only be effective on the nes music demo swf!  It was quite effective on it though, reducing 450k to 380k.


"We are merely sprites that dance at the beck and call of our button pressing overlord."

Offline

#5 2005-12-29 2:30:46 am

Rhete
Member
Registered: 2005-06-15
Posts: 22

Re: NES Music in flash

I'm paranoid of swf compressors.  One I used changed something in my boot settings (I use windows 2000) and I had to reinstall windows.  The worst part?  Newgrounds didnt even accept swf files compressed with it for some reason.

I use one now called 123 Flash Compressor.  Doesnt crash my computer and Newgrounds likes it

Heres a minute or so of some megaman song, if you wanna try to compress it further

Attachement is screwed up, sorry
http://www.inconsequentialexistence.com/Movie1.swf

Last edited by Rhete (2005-12-29 2:35:23 am)


Attachments:
Attachment Icon megaman.swf, Size: 20,480 bytes, Downloads: 175

Offline

#6 2005-12-29 8:56:22 am

Dwedit
Administrator
From: Chicago
Registered: 2004-12-12
Posts: 1,017
Website

Re: NES Music in flash

Here's a copy of the SWF compressor I made... Probably very buggy, back up your original swf first.  Doesn't work on compressed swfs unless you copy them to the directory the program is in.  But I don't see any way it could mess with system settings.


Attachments:
Attachment Icon swf.zip, Size: 68,276 bytes, Downloads: 178

"We are merely sprites that dance at the beck and call of our button pressing overlord."

Offline

#7 2005-12-29 2:52:44 pm

Rhete
Member
Registered: 2005-06-15
Posts: 22

Re: NES Music in flash

Doesnt work for me =/

Runtime error 9
Subscript out of range

Offline

#8 2005-12-29 8:04:22 pm

Dwedit
Administrator
From: Chicago
Registered: 2004-12-12
Posts: 1,017
Website

Re: NES Music in flash

It's failed on a few flash files for me, I made this as a 4 hour hack without knowing anything about the swf file format, and looking at things with a hex editor.  But it's worked for me on most of what I've tired.  See if it works any better on non-compressed flash movies.


"We are merely sprites that dance at the beck and call of our button pressing overlord."

Offline

Registered users online in this topic: 0, guests: 1
[Bot] claudebot

Board footer

Powered by FluxBB
Modified by Visman