datdamnzotz / FoundryVTT-Game-Audio-Bundle-1

Foundry VTT - Game Audio Bundle 1
17 stars 2 forks source link

Use opus for lower bitrate? #3

Open haasn opened 3 years ago

haasn commented 3 years ago
datdamnzotz commented 3 years ago
  • The entire set of bundles is rather large

6.2 Gb for all the packs - better than the 104 Gb the original wav files are : ] 160Gb if you include 2020.

  • Opus is supported by all browsers modern enough to run FoundryVTT (it's part of the WebM standard)
  • Opus delivers the same quality as Vorbis at lower bitrates

I hear you. I think I originally encoded them with vorbis at 128 something like that.

  • Assuming you still have access to the lossless sources, it would be straightforward to re-encode them with Opus instead of Vorbis as the audio codec.

Straight forward of about 4 days of fixing names/categories and encoding : ]

Btw, everyone has access to the sources ; ] they are found here https://sonniss.com/gameaudiogdc/

SonnissGDC2020AudioBundle isn't in the packs yet - it might roll over to a 5th pack to keep them reasonable on download sizes. I don't want to go over 1Gb for each.

flamableconcrete commented 3 years ago

I wrote this Python script that converts the original .wav files to Opus encoded .ogg files. I tested it on the full set of original 160 GB of .wav files from Sonniss, and it worked on every file I randomly selected to test. Then I stupidly deleted the folder after doing something else. Anyway, just wanted to drop this here in case you wanted it for reference. Also, I noticed that your 4 mega-packs here are not the same ordering that I saw from the bundles from Sonniss, so I figure I'd leave that up to you anyway.

And thanks for turning this into a Foundry module in the first place!

https://gist.github.com/flamableconcrete/0515335c3281efabfc3d9ed07c9b8048

datdamnzotz commented 3 years ago

The indexes in the packs have changed from the originals - I tried to logically group the sounds together better so that guns where in guns etc. Instead of under the author. It's a mess but a good first stab- as the original index's are by author - category and the categories are all over the place.

My index is really by Category

I have a one liner script that does something very similar @flamableconcrete Instead of convert_to_ogg(audio_file, full_output_file) its ffmpeg that does the heavy lifting.

Original encoding was done with:

FOR /F "tokens=*" %G IN ('dir /b /s *.wav') DO ffmpeg -hide_banner -loglevel warning -i "%G" -vn -c:a libvorbis -q:a 5 "c:%~pG%~nG.ogg">>log.log

I just need to re-encode with Opus instead of Vorbis which is:

FOR /F "tokens=*" %G IN ('dir /b /s *.wav') DO ffmpeg -hide_banner -loglevel warning -i "%G" -vn -c:a libopus -q:a 5 "c:%~pG%~nG.ogg">>log.log

Might just jump to https://packages.ubuntu.com/opus-tools and use that. Which would be something like:

for f in *.wav; do | opusenc --bitrate 128 - "${f%.flac}.opus"; done

Need to fiddle with the best bit rates for web streaming so probably opusenc --bitrate 128 or just go straight FLAC and call it a day. I don't think any of these files contain 5.1 or 7.1 so opusenc -bitrate 128-256 probably would be sufficient. https://wiki.xiph.org/Opus_Recommended_Settings

maybe @haasn could chime in since they were the ones that wanted opus to begin with.

Lot's of ways to produce a ogg file https://askubuntu.com/questions/211054/how-to-convert-a-sound-file-to-opus

datdamnzotz commented 3 years ago

I do have all the original source files - Original goal was to make it easy to use in VTT (or anything else for that matter) I didn't want a listing of

SoundMorph - Bloody Nightmare
SoundMorph - Doom Drones
SoundMorph - Future Weapons
SoundMorph - Modular UI - By Richard Devine
SoundMorph - Road Riders
SoundMorph - Robotic Lifeforms
SoundMorph - Sinematic
SoundMorph - Solar Sky
SoundMorph - Users of Tommorow
Soundopolis - Blades
Soundopolis - Burps and Farts
Soundopolis - CB Radio
Soundopolis - Foley Plus_Full
Soundopolis - Glass Smash Full
Soundopolis - Gore Toolkit HD
Soundopolis - Natures Fury_Rain_01
Soundopolis - Natures Fury_Thunder
Soundopolis - Natures Fury_Wind_01
Soundopolis - Percussion 01
Soundopolis - Sci-Fi Electric
Soundopolis - Tools_Construction 01
Soundopolis - Underwater
Soundopolis - Water 01
Soundopolis - Water Ambiences 01`

But rather a category like Water and

Soundopolis - Water 01
Soundopolis - Water Ambiences 01

Goes under Water. So all things water would go under Water This is where the time comes in - to categorize this mess.

Just typing outloud here - maybe a better approach would be convert 1:1 (same source structure) but separate repo that contains all the source.

Then an app to manages the source/target rename index that does the shuffling into the 'mega packs' directory then creates the VTT playlist.db which is really the index of what the source is.

And hell Github can even host the raw files. Hummm...

flamableconcrete commented 3 years ago

I think the ultimate best case scenario would be to make this integrate with the Soundboard module (https://github.com/BlitzKraig/fvtt-SoundBoard) in the cleanest way possible. I agree that categorizing the content would be key here, but even after categorizing, it would be nice to have just one folder per type, and a bunch of options in that folder, instead of further subfolders. In the separate repo that contains some code it could have a mapping of where everything came from/got mapped to if you wanted to be super specific.

Anyway, let's say all that was done and bundled the way it currently is, that is split up across multiple mega-packs. Or maybe split into multiple, even smaller packs. At that point (or before), it might be worth approaching the Soundboard by Blitz author to have a new option in their settings that optionally picks up other modules that adhere to a specific standard, say ones that have a top level audio/ folder with subfolders of sound files that would look clean in that interface.

I think it has some real super potential!

Edit: This is a related issue on the Soundboard issue tracker - https://github.com/BlitzKraig/fvtt-SoundBoard/issues/11

datdamnzotz commented 3 years ago

I agree. Having some sort of soundboard interface like BlitzKraig's fvtt-SoundBoard inside vtt is ideal. And it just consumes these packs. I messed with fvtt-SoundBoard a while back it is is pretty clunky to get all the files loaded up and use - Part of the issue is how VTT stores the playlists. Get too many files inside a playlist and it starts to bog down.

BlitzKraig commented 3 years ago

Hi, I just saw the issue link in my repo. You may be interested in the SoundPack feature in SoundBoard 1.4.0+

You can see an example implementation in the CommunityPack

Feel free to drop me a message if you are interested in leveraging this.