If you are looking for the decompiler itself, visit https://github.com/jindrapetrik/jpexs-decompiler
NEW : We have got a new blog where we post some interesting SWF internals info.

#2259 Poor sound quality
Author:
Paleoforest

Date created:
Type: bug
Visibility: Everybody
Assigned to:
Labels: Sound
State: upgraded 

I really want to export music from many games. In the SWF preview, it's very compressed,
compared to how it sounds in the game (and you know how music sounds in old flash games)!
I expected to hear original sound quality regardless of file extension, but this doesn't
happen. No matter how I export, it always has exactly the same quality as in preview. The
only format that retains original quality is .swf, but it must initially be encoded in
files, because exporting .wav in other extensions (I can't export it as .swf) doesn't make
sense.
I using version 20.1.0. I have Windows 10 64-bit Home Edition.
Ok, I attach a random file from which I want to extract music. For comparison, I add same
music (in audio.swf it renamed as "pyramidOutdoorHeliSide"), but exported from other files
as independent .swf, which has original in-game quality.
All games have same issue.


When you export DefineSound(1) from "Mini game Grey Matter.swf" and you select
"MP3/WAV/FLV" format (default),
it should save an MP3 file which has exactly same MP3 data as those stored in the SWF
file,
without any recompression.
So when you play it in your favourite player, it should sound same as original.
If not, then the FlashPlayer does some magic with the MP3 data, or just uses some special
MP3 decoder, or some Hardware processing.
In FFDec, we use JLayer library for MP3 decoding - this affects playing in preview as well
as exporting WAV files.
I tried to test your file and I am pretty sure I hear FP plays it a bit differently -
better - than WinAmp on MP3 file.
Note that here the DefineSound(1) is stored in the SWF file as MP3 with only 11kHz
sampling rate, mono,
there's no much space how FlashPlayer can enhance it... but looks like it does.
I can't do much with the MP3 export, as it directly takes SWFs data,
but maybe I can fix the preview playback and WAV file export,
but it would require much of effort, since there's not much Java MP3 decoders in the
wild.
I tried Ruffle SWF player and it looks like it plays the MP3 correctly (same way as in
FP),
so maybe to get some inspiration from its source - but I don't understand Rust language at
all,
so this would be hard.
Please try new FFDec - nightly 2791.
Sounds in the preview are now resampled to 44kHz,
and if you select WAV as option for export (NOT just MP3/WAV option), you can check new
checkbox "Resample to 44kHz" in the export dialog.
This is probably the thing that FlashPlayer does to the played sounds.
Please try it.
State: new→upgraded
I download nightly 2795 (is 2791 a typo? 'cause I can't find it) and check this out.
Honestly, it sounds rude, but it's literally a crutch, that at the software level improves
sound, I suppose. Well, some of them with this checkbox began to sounds different from
their in-game version, but this is definitely a cool update!
If you're interested in what else I've tested, you can listen to and compare another music
with and -out new checkbox. Check "SuspenseTheme3.wav" inside.
Still don't know what's going on with MP3/WAV exporting, so I guess it's okay not touch
it?
And by the way, if there’s classic 44 kHZ, then there’s also 48 kHZ. What would happen
if you did second upgrade?

When I say nightly 2791 I mean 2791 or later, 2795 is okay.
If you select "MP3/WAV/FLV" or "MP3/WAV" option during export,
then it checks whether data are stored in SWF in MP3 format, if so, then it exports as MP3
file,
otherwise it decodes it to a WAV or stores as FLV.
This way it saves as MP3, but I cannot modify such MP3 - resample it, since it would
require reencoding whole file and I do not have an MP3 encoder.
So you need to select "WAV" as output format for the resampling to make happen.
If you still think that sound processed this way is way different that playback in
flashplayer,
I can't do anything for you.
Me personally, I hear the sound with 44 resampling is pretty similar to what I head in
flashplayer.
I won't resample it to 48kHz since it is not multiple of 11025, I don't know how to do
it.
And I also think 44kHz is enough.
Either you have got a perfect hearing or there is something different on my computer than
on yours, that makes big sound differences. Maybe I have a different version of FP?
Maybe you should make a recording - video - of playing the sound in FP and in FFDec with
and without the 44kHz option.
Because I start loosing my mind hearing the audio again and again to tell difference.
I also think the main purpose of decompiler is to provide original - unproccessed - audio
files,
without any modification.
Here you go. I have Adobe Flash Player 32 (Projector).
