Question about sound encoding

Create music and sound effects for mainline or user-made content.

Moderator: Forum Moderators

User avatar
hyperactivething
Posts: 45
Joined: December 8th, 2007, 5:35 pm
Location: Santiago, Chile

Question about sound encoding

Post by hyperactivething »

I was looking throught he sounds directory and I was surprised to see that many files were in wav format. (50 in total...I'm using 1.2.8)

So I was wondering why these were not encoded into ogg, like the rest. Are there any specific reasons? Or was it just a 'missed a spot' situation?
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

Here's how it went, more or less:

1) Originally, all the sounds were in .wav. Probably for no particular reason, it was the format the original set of sounds happened to be in and .wav is easiest to work with. No problem with space, as there were so few of them (1.14MB for all sfx of 1.0.2 :lol:).

2) Then, I started to make more sounds and add most of them as .ogg's, to save space.

3) Then, I figured that not having the original .wav's around is stupid, because .ogg is a lossy format and thus all possible subsequent editing should be done on the lossless .wav's instead (and then converted to .ogg's again). So, I didn't quite know whether to just use .wav instead or use .ogg and try to keep the .wav's myself somewhere. However, since I also started making stereo sounds instead of mono, the filesizes started doubling so .wav became very unfeasible, so we came up with this:

4) We now have a location in the SVN repository for storing the master .wav's of sounds, and the intention is to convert all sounds in the release packages to .ogg's sooner or later, and have the master .wav's in the separate location so people can use those when they need the lossless version. It just hasn't been done for all sounds yet.
User avatar
hyperactivething
Posts: 45
Joined: December 8th, 2007, 5:35 pm
Location: Santiago, Chile

Post by hyperactivething »

Yeah, I was aware that you had to keep the originals somewhere in a non-lossy format for further edition. It just seemed strange to me that they came packaged with the game as well.

I'm just curious as to why it hasn't been done for all sound files. I mean, oggenc doesn't take much time to encode short sfx files. I'll have a look around in the repository anyways.
torangan
Retired Developer
Posts: 1365
Joined: March 27th, 2004, 12:25 am
Location: Germany

Post by torangan »

For very short sounds the overhead of the ogg container makes the vorbis encoding useless.
WesCamp-i18n - Translations for User Campaigns:
http://www.wesnoth.org/wiki/WesCamp

Translators for all languages required: contact me. No geek skills required!
User avatar
vonHalenbach
Translator
Posts: 398
Joined: May 3rd, 2006, 10:23 am
Location: united europe

Post by vonHalenbach »

How about using FLAC in the first place? Does SDL support flac? It is lossless and small. Encoding needs more computing power than decoding, so it is easier to decode than ogg-vorbis. Then we don't need to store some masterfiles additionally and all are happy playing Battle for Wesnoth. :D
User avatar
hyperactivething
Posts: 45
Joined: December 8th, 2007, 5:35 pm
Location: Santiago, Chile

Post by hyperactivething »

torangan wrote:For very short sounds the overhead of the ogg container makes the vorbis encoding useless.
Completely acceptable reason.

What about FLAC, as vonHalenbach says? Does the overhead make it useless as well?
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

I've never tried to encode a .wav into an .ogg and found the filesize to increase.

I've wanted and suggested FLAC myself, but SDL doesn't support it.
hyperactivething wrote:I'm just curious as to why it hasn't been done for all sound files. I mean, oggenc doesn't take much time to encode short sfx files.
Yes, but you also have to update all references to those sounds in the code and WML, since the filenames need to change along with the format. Not hard, just a bit of grunt work. For little gain, at the moment.
Boucman
Inactive Developer
Posts: 2119
Joined: March 31st, 2004, 1:04 pm

Post by Boucman »

just to add a point to zookeeper's history report

the original entry of .ogg wasn't for sound, but for musics... having a 4' piece of wave was completely impracticall

for a long time, all sounds were wav and music ogg, it's only recently that we started having ogg sounds lying around...
Fight key loggers: write some perl using vim
User avatar
dontano
Posts: 379
Joined: November 6th, 2007, 9:50 pm
Location: Anywhere...

Post by dontano »

Boucman wrote:just to add a point to zookeeper's history report

the original entry of .ogg wasn't for sound, but for musics... having a 4' piece of wave was completely impracticall

for a long time, all sounds were wav and music ogg, it's only recently that we started having ogg sounds lying around...
That's true. I never founded a wav music in this game. But can you show me a .wav/.mp3 to.flac encoder for Linux/Unix? I have mp32ogg to change the .mp3 encoding into .ogg, but what about .flac? I don't think that a deep search into Synaptic would actually work, 'cos many things ain't there.
Trust yourself first, then trust others.
Current activity/ies: what...!?
User avatar
West
Retired Lord of Music
Posts: 1173
Joined: October 30th, 2006, 7:24 am
Location: In the philotic connections between ansibles.
Contact:

Post by West »

dontano wrote:That's true. I never founded a wav music in this game. But can you show me a .wav/.mp3 to.flac encoder for Linux/Unix? I have mp32ogg to change the .mp3 encoding into .ogg, but what about .flac? I don't think that a deep search into Synaptic would actually work, 'cos many things ain't there.
Why would you want to convert mp3 to flac? The mp3 file is already "ruined" as mp3 is a lossy format. All you gain by converting it to a lossless format is excessive filesize, it won't sound any better.
User avatar
Iris
Site Administrator
Posts: 6742
Joined: November 14th, 2006, 5:54 pm
Location: Chile
Contact:

Post by Iris »

I'd be glad to:

1) Try encoding my music tunes with FLAC
2) Implement Ogg FLAC support on Wesnoth!

If you can provide me a good comparison of results between Ogg Vorbis and Ogg FLAC.
Author of the unofficial UtBS sequels Invasion from the Unknown and After the Storm (now available for Wesnoth 1.14.x and 1.15.4+).
User avatar
hyperactivething
Posts: 45
Joined: December 8th, 2007, 5:35 pm
Location: Santiago, Chile

Post by hyperactivething »

dontano wrote:But can you show me a .wav/.mp3 to.flac encoder for Linux/Unix?
West is right. Just ogg it, turning it into a flac file is pretty pointless.

Shadow Master, isn't comparing vorbis and flac a bit pointless? One is lossy, one is lossless, it's obvious one encoding will always be larger than the other one. Or did I misunderstand the question?
User avatar
West
Retired Lord of Music
Posts: 1173
Joined: October 30th, 2006, 7:24 am
Location: In the philotic connections between ansibles.
Contact:

Post by West »

hyperactivething wrote:Shadow Master, isn't comparing vorbis and flac a bit pointless? One is lossy, one is lossless, it's obvious one encoding will always be larger than the other one. Or did I misunderstand the question?
I *think* Shadow Master is talking about the overhead of using flac as opposed to using vorbis. I.e. if flac eats a lot more cpu cycles, using it might not be practical even if the sound quality gets (slightly) better.
User avatar
hyperactivething
Posts: 45
Joined: December 8th, 2007, 5:35 pm
Location: Santiago, Chile

Post by hyperactivething »

West wrote:I *think* Shadow Master is talking about the overhead of using flac as opposed to using vorbis. I.e. if flac eats a lot more cpu cycles, using it might not be practical even if the sound quality gets (slightly) better.
Oh. Well, anyways, I thought sending lossy-encoded files with the game was not being discussed, I thought it was a discussion about how to store files in the repository for further edition.

My opinion would be to package ogg files with the game, and store the originals as flac files in the repository. I think that makes more sense.
User avatar
vonHalenbach
Translator
Posts: 398
Joined: May 3rd, 2006, 10:23 am
Location: united europe

Post by vonHalenbach »

Shadow Master wrote:I'd be glad to:

1) Try encoding my music tunes with FLAC
2) Implement Ogg FLAC support on Wesnoth!

If you can provide me a good comparison of results between Ogg Vorbis and Ogg FLAC.
I converted a 2 channel wav file (1second long) into flac and ogg.

1 second wav = 248KB
1 second flac = 119KB
1 second ogg = 25,4 KB with 128 Kbit/sec rate.

Decoding power on a wav is almost nonexistent, because you copy them just around. Decoding of ogg needs a bit of processing power. Decoding of flac is lesser cpu-intensive as ogg.

To compress a wav file, you get about 60% filesize as flac. This is not much, but better then storing them as wav. It makes only sense for the music files imho. The sounds should stay as wav.
Post Reply