Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Need advice on how to lower the file size of sounds

Author
Message
Cyborg ART
17
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden - Sthlm
Posted: 21st Aug 2012 10:40
My app does more or less relay on multiple musicfiles (well, I use them as soundfiles since that suits my needs beter). Now I have run into a minor problem. All the music files gather up to 39Mb, and for an app I think its quite heavy.

So my question is, does anyone know a good way to lower the quality (and size) of .wav files?

I dont need the current quality since its "studio quality" so to say.

Any help is apreaciated

JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 21st Aug 2012 10:53
Suggest using Audacity (free) and down-sampling. Works well, even for music.

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 21st Aug 2012 10:53
MP3, OGG?

Compared to a raw wave file, an MP3 or OGG will be tiny, like 5% of the size.

Health, Ammo, and bacon and eggs!
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 21st Aug 2012 10:58 Edited at: 21st Aug 2012 11:02
I'm not very cluey on the inner workings of file sounds but this is from the AppGameKit documentation:

Quote: "Please note that compressed WAV files are not supported. You must use uncompressed WAV files to ensure compatibility on all platforms."


However, compression and lowering quality may not necessarily be the same thing. Which sound editor are you using? Lowering the quality might have to be done when saving and not after. Maybe check the manuals of your sound editor for lowering quality upon saving?

Edit-two posts in before mine, unbelievable!

@VanB: I think you can only load .wav files when using the LoadSound() command.

Cyborg ART
17
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden - Sthlm
Posted: 21st Aug 2012 11:28
Thanks for all the quick answers!

I converted the files to .mp3 and now they are 2.9 Mb instead of 31 Mb

Never thought mp3 was so much smaller!

Cyborg ART
17
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden - Sthlm
Posted: 21st Aug 2012 11:37
Well... now I get this:



Any idea? This is by using the audacity mp3 exporter

Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 21st Aug 2012 11:42
Are you using LoadMusic() or LoadSound()?

From the AppGameKit documentation, referring to LoadSound():

Quote: "The filename of the sound file to load, must be a WAV file."


Cyborg ART
17
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden - Sthlm
Posted: 21st Aug 2012 11:51
I use LoadSound()

Then I appear to be back where I started...

And by using LoadMusic() and PlayMusic() I wont be able to play several tracks at the same time.

Thats a real showstopper

Cyborg ART
17
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden - Sthlm
Posted: 21st Aug 2012 13:20
The main reason why I was asking was because the soundfiles didn't "merge" in the same way as they did in DB Pro, it sounded like if the files was to heavy and slowed down everything.

But now I did found out that AppGameKit is a bit faster (dont know what part really) and recuired the sound to be played after 3.70 seconds instead of 3.75 as in DB Pro. Thus resulting in the jerky playback.

Problem solved, kind off

JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 21st Aug 2012 16:38
You can use mp3 for music but NOT for LoadDSound() etc. This is a cross-platform constraint. Reduce your WAV files to 16,000 S/S and is they're just gunshots etc, make them mono (50% reduction if they were stereo).

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 21st Aug 2012 16:47
Ahh, I see what you mean.

All you can do, is reduce the sample rate or bit rate, and all you really need to do that is a sound converter - either Audacity, as Jim suggest, or I find that Wavosaur is pretty good, free, and easy to use, it's an old school wave editor, but it supports conversions, fading, loops, MP3 etc etc, all you need in one free package.

If I was trying to mix looping sound files, well I'd try and optimise them as much as possible, like using as short a loop as I can, trying to stick to a standard length. Also, I would load each sound in, and set the volumes to 0, then play each sound individually. That way, you might not have a timing glitch. If you load a few sound loops, and start them looping all at the same time, then there might be an issue with a delay in queing up the sound file. Often sound engines will wait until the sound is playing before loading anything, so it's best to kick start it by playing each sound beforehand, so it's ready to play with perfect timing.

Health, Ammo, and bacon and eggs!
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 21st Aug 2012 16:52
Also try to make your wav files 8 bit mono, this reduces the size a lot. For shortish ones it doesn't impact the sound much.

The format of my files (as reported by GoldWave) is "PCM unsigned 8 bit, 22050 Hz, 176 kbps, mono", "PCM unsigned 8 bit, 8000 Hz, 64 kbps, mono", "PCM unsigned 8 bit, 11025 Hz, 88 kbps, mono" and "PCM unsigned 8 bit, 44100 Hz, 352 kbps, mono" (this one is a bit big, 47.8kb for 1.11 seconds). They work on every platform I've tried (Windows, Mac, iPod Touch, iPad, Android 3.2, Android 4.1).

The key is making it 8 bit mono.

Cheers,
Ancient Lady
AGK Community Tester
Cyborg ART
17
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden - Sthlm
Posted: 21st Aug 2012 17:09
I couldnt find any options in Audacity to convert the .wav to 8-bit.

Anyhow, how my music goes:

Bass1 - Bass2 - Bass3 - Bass4 - Bass1 etc
Drum1 - Drum2 - Drum3 - Drum4 - Drum1 etc
Mel(1or2) - Mel(3or4) - Mel(5or6) - Mel(7or8) - Mel(1or2) etc

with 6 tracks, each track will have its own volume and play randomly to generate unique music in an endless loop.

But now it seem to work extremely smooth right now.
I will look into sampling it down to 8-bits

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 21st Aug 2012 17:26
GoldWave will to it. But it is not free software, it costs $49.

It is also very good for editing the sounds, like getting rid of blank sound at start and stop.

Cheers,
Ancient Lady
AGK Community Tester
Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 21st Aug 2012 17:32
I don't have Audacity open in front of me right now, but I believe when you export to wave, that's when you choose the sampling rate.

Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 21st Aug 2012 17:37
I suggest WavePad to edit sounds, if you don't have better paid for software. Wavepad is free to use for X days, then has a free licence afterwards. To reduce sample rates, you click on Edit, then Convert Sample Rate, and/or convert channels.

I use this for my sound editing since I can't be bothered to find my copy of Cool Edit Pro.

I live for video games! (And beers, and football, and cars!)
See what I live for here: [url]http:\\www.TeamDefiant.co.uk[/url]
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 21st Aug 2012 20:42
In Audacity:

(1) Change the default project settings
(2) Use the drop-down on Export to select the output

If you are exporting to 8-bit, make sure the waveform has plenty of amplitude - otherwise it will be noisy - you're reducing the amplitude range from +-32786 to +-128 !

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL

Login to post a reply

Server time is: 2024-11-23 20:29:06
Your offset time is: 2024-11-23 20:29:06