ChrisV 389 Posted September 12, 2014 Hey guys! Was working on some sounds and music for Hostile. Exported some footstep sounds in .ogg format, and tried playing them ingame by modifying the script. Unfortunaly, it's not possible to play those sounds, because .ogg isn't supported in LE? I can easily convert them to .wav, that's no problem. And, for small sound files like footsteps or screams or whatever, wav would be acceptable...but, not really for music. A 3 minute music file in .wav format is around 30 MB. So, if you have like 10 music files in .wav, you'll need a lot of disk space for them. If you then add all the other sounds, and other media (art, textures, models, etc...), you'll end up with a game that uses a lot of disk space. The same 3 minute song is like 10 times smaller in .ogg format, while still keeping a pretty good sound quality. The same for .mp3 format, but from what i've read, .mp3 isn't allowed commercially? Anyways, i think it would be a good idea to have support for .ogg and other formats that can save disk space without loss of quality. Quote Share this post Link to post
gamecreator 804 Posted September 12, 2014 .ogg and other formats that can save disk space without loss of quality. Just to be clear, if the OGG containts FLAC, then it's lossless and the size is reduced around 40-50%, per the wiki. Otherwise, it's lossy (and smaller). Quote Share this post Link to post
BES 112 Posted September 12, 2014 I agree there should be support for .ogg in LE3. Quote Share this post Link to post
Josh 8,452 Posted September 12, 2014 Here's some decoding code: // oggdecoder.c #include <stdlib.h> #include <stdio.h> #include <errno.h> #include <string.h> #include <vorbis/vorbisfile.h> static int quiet = 0; static int bits = 16; #if __APPLE__ && __BIG_ENDIAN__ static int endian = 1; #else static int endian = 0; #endif static int raw = 0; static int sign = 1; typedef struct oggio oggio; struct oggio { OggVorbis_File vf; ov_callbacks cb; }; /* void _analysis_output_always(char *base,int i,float *v,int n,int bark,int dB,ogg_int64_t off) { }; */ void *Decode_Ogg(void *stream,void *oread,void *oseek,void *oclose,void *otell,int *samples,int *channels,int *freq) { oggio *ogg; int res; ogg_int64_t samples64; *samples=-1; ogg=(oggio*)malloc(sizeof(oggio)); ogg->cb.read_func=oread; ogg->cb.seek_func=oseek; ogg->cb.close_func=oclose; ogg->cb.tell_func=otell; res=ov_open_callbacks(stream,&ogg->vf,0,0,ogg->cb); if (res<0) {free(ogg);return 0;} samples64=ov_pcm_total(&ogg->vf,0); *samples=(int)samples64; *channels=ov_info(&ogg->vf,-1)->channels; *freq=ov_info(&ogg->vf,-1)->rate; return ogg; } int Read_Ogg(oggio *ogg,char *buf,int bytes) // null buffer to close { int res,bs; if (buf==0) return ov_clear(&ogg->vf); while (bytes>0) { res=ov_read(&ogg->vf,buf,bytes,endian,bits/8,sign,&bs); if (res<0) { if (bs) return -1; // Only one logical bitstream currently supported return -2; // Warning: hole in data } buf+=res; bytes-=res; } return 0; } Quote Share this post Link to post
damvcoool 16 Posted September 15, 2014 How would i go about doin't it on LUA? Quote Share this post Link to post
AggrorJorn 1,692 Posted September 16, 2014 I second this. My main project exists out of 3.8 GB of sound and that is just speach and not even music. I think ogg support is something that should be part of the core leadwerks functionality. Quote Share this post Link to post
insomniac_lemon 0 Posted October 24, 2014 I agree. As a free-and-open format it should be supported by default. Every sound I record is stored as OGG. Quote Share this post Link to post
macklebee 883 Posted October 25, 2014 Agree - after having ogg supported in LE2 and to go to wav for LE3 has required me to have to convert almost all sounds from ogg to a filesize twice the original size... Quote Share this post Link to post
Ywa 24 Posted October 27, 2014 If you have some C++ knowledge you can add support for the BASS audio library (supports MP3, OGG and more). It's free of charge for non-commercial use. What you need: - http://www.un4seen.com/ (library) - https://github.com/brachyonic/LuaBASS (Lua bind for BASS) - A wrapper to mimic/replace the common Sound Lua functions. I'm working on this, might release it when I'm done and people want it. Quote Share this post Link to post
gamecreator 804 Posted October 27, 2014 I remember loving the simplicity of that library but I also thought it supported password protected ZIP files, which isn't mentioned in the feature list. Dang. Quote Share this post Link to post
Ywa 24 Posted October 27, 2014 Are your sounds that important? I mean.. I can understand you want to protect your Lua code and such, but many commercial games store their sounds in normal files. Or is it due to licensing? -- I just finished my wrapper which overwrites the normal Sound & Source, which works perfectly. I also made some updates to the LuaBASS bind. If anyone wants more info just send me a PM. Quote Share this post Link to post
gamecreator 804 Posted October 27, 2014 All of the above. Many indie games also sell their soundtracks to offset costs and the generally low prices of their games. Quote Share this post Link to post
Josh 8,452 Posted October 29, 2014 As of 3.3 we have official support for encrypted zip archives that are created automatically in the publish process. Quote Share this post Link to post
gamecreator 804 Posted October 29, 2014 This is a powerful addition to the engine! However, as ZIP is horrible at compressing WAV, the file size issue will remain. Edit: Just did a quick test at home on a 5 minute song. WAV (16 bit PCM, 2 channels, 44,100 Hz): 50.4MB ZIPped WAV: 44.5MB OGG (7 quality, around 190kbps, 44kHz): 7.28MB From my understanding these are typical results and all projects with music and sound (and how many don't have them eventually?) would benefit from this implementation. Quote Share this post Link to post
Olby 184 Posted November 15, 2014 As a sound designer I completely agree. OGG is a must. It will not only reduce the size of your games but also improve loading times since there's a lot less data to be parsed. Additionally we could use WAV/OGG asset playback straight from the editor. Its very annoying to Alt-Tab between your audio editing package and LE just to audition the sounds you want to use. Quote Share this post Link to post
DerRidda 101 Posted November 15, 2014 One more thing: Most of us here probably have low upload speeds, as soon as you start collaborating with other people or pushing your project backups online we will probably lose a lot of time just because of the wav files. Quote Share this post Link to post
Bytecroc 7 Posted December 2, 2014 .ogg would be great and .x + .b3d with animations for models directly. Quote Share this post Link to post
abyssus 3 Posted January 10, 2015 Adding support for playing oog sound files would be a valuable improvement to the Leadwerks engine. Quote Share this post Link to post
YouGroove 865 Posted January 11, 2015 I would like to see it supported somewhere this year, perhaps , reducing a lot file sound file size it's as good as texture compression. Specially to publish make tiny demo game concept demos. Quote Share this post Link to post
Olby 184 Posted January 11, 2015 Yesterday during the Leadwerks hangout Josh said its not a priority. "who has that much music to benefit from compression" were his words. Unfortunately. [Edit] An average WAV music file can weight around 40 to 60 MB. An equivalent OGG file would be about 5-10 MB depending on quality. The argument that encrypted ZIP files help in this case is not appropriate. ZIP compression is horrible at reducing audio file size and besides the file it self is never reduced it still needs to be decompressed in RAM which can be used for other [more useful] purposes. OGG uses psychoacoustic compression which strips parts of audio that we as humans would never hear anyway. Thus reducing the file bandwidth. I guess for now its up to us to implement some kind of audio compression. Quote Share this post Link to post
YouGroove 865 Posted January 11, 2015 Yesterday during the Leadwerks hangout Josh said its not a priority. If foliage and some other features comes faster, than it's ok to leave Ogg for now. And perhaps someone will write a plugin and Lua binding for all LE3 users ? Quote Share this post Link to post
Olby 184 Posted January 11, 2015 If foliage and some other features comes faster, than it's ok to leave Ogg for now. And perhaps someone will write a plugin and Lua binding for all LE3 users ? He promised a slew of new features that we all are waiting for. So OGG can wait indeed, especially if no one is stopping you from writing your own parser. Quote Share this post Link to post