Hard Light Productions Forums

Modding, Mission Design, and Coding => The Modding Workshop => Topic started by: HLD_Prophecy on October 12, 2016, 08:33:26 am

Title: Mainhall Muisc won't play?
Post by: HLD_Prophecy on October 12, 2016, 08:33:26 am
Hey all, I'm trying to get a custom mainhall to work. I changed the music from the original to a file that's in my data/music folder, Joshua_Menu.wav:

Code: [Select]
;; GR_1024
$Main Hall

+Bitmap:                                        2_MainScreen
+Mask:                                          2_MainScreen-M
+Music: Joshua_Menu.wav

+Num Intercom Sounds: 1
+Intercom delay: 8000 15000 ;; min and max random delay for intercom sound 0
+Intercom sound: 1 ;; empty
+Intercom pan: 0.0 ;; pan for intercom sound 0


But when I load the mainhall, the music won't play. I just hear the wind rushing or rumbling or whatever that ambient effect is.

Does anyone know what's going on here? Thanks!
Title: Re: Mainhall Muisc won't play?
Post by: m!m on October 12, 2016, 08:43:44 am
Are you using a nightly build? If yes then try this one (http://www.hard-light.net/forums/index.php?topic=92614.0) and check if the issue is still present. If the issue is not present then I broke something in the new audio code in which case I'll need the music file and any other required assets in order to reproduce the bug and hopefully fix it.
Title: Re: Mainhall Muisc won't play?
Post by: Yarn on October 12, 2016, 01:13:32 pm
You can't use a file directly as your main hall's music; you have to create an entry for that file in either music.tbl or a table ending in -mus.tbm and point your main hall to that. Assuming your mod doesn't have its own music table, you can easily do this by creating a file called (for example) "joshua-mus.tbm" in your mod's data\tables folder and adding the following to the table:
Code: [Select]
#Menu Music Start

$Name:      Joshua_Menu
$Filename:  Joshua_Menu.wav

#Menu Music End

Then set your main hall's music to Joshua_Menu.
Title: Re: Mainhall Muisc won't play?
Post by: AdmiralRalwood on October 12, 2016, 02:09:23 pm
Also, you probably shouldn't use .wav files for music, but that's a separate issue.
Title: Re: Mainhall Muisc won't play?
Post by: HLD_Prophecy on October 13, 2016, 08:12:19 pm
You can't use a file directly as your main hall's music; you have to create an entry for that file in either music.tbl or a table ending in -mus.tbm and point your main hall to that. Assuming your mod doesn't have its own music table, you can easily do this by creating a file called (for example) "joshua-mus.tbm" in your mod's data\tables folder and adding the following to the table:
Code: [Select]
#Menu Music Start

$Name:      Joshua_Menu
$Filename:  Joshua_Menu.wav

#Menu Music End

Then set your main hall's music to Joshua_Menu.

Oh, that makes sense, thanks!

Also, you probably shouldn't use .wav files for music, but that's a separate issue.

Um, why is this? Are .ogg files better?

Are you using a nightly build? If yes then try this one (http://www.hard-light.net/forums/index.php?topic=92614.0) and check if the issue is still present. If the issue is not present then I broke something in the new audio code in which case I'll need the music file and any other required assets in order to reproduce the bug and hopefully fix it.

No, I'm using 3.7.4 No SSE Debug official build. Thanks for the help anyway. :)
Title: Re: Mainhall Muisc won't play?
Post by: X3N0-Life-Form on October 14, 2016, 12:22:10 am
Um, why is this? Are .ogg files better?

In pretty much every concievable way. In my experience, .ogg have much better sound quality while being significantly smaller.

.wav files should have died with the 1990s.
Title: Re: Mainhall Muisc won't play?
Post by: Mongoose on October 14, 2016, 06:23:01 am
Um, not quite.  Given the same source audio, there's no possible way that an .ogg file can have better quality than a .wav, as the latter represents the raw uncompressed audio data, whereas the former is a lossy compressed format.  (Well technically there's a way to compress .wavs too, but let's ignore that for the moment.)  Your source files should always be kept as .wavs, or at least as a lossless compressed format like .flac.  That being said, .wav files are big, and they should definitely not be distributed in a mod's released form so as to save on space.  You'll want to encode everything as .ogg before you ship things out.
Title: Re: Mainhall Muisc won't play?
Post by: AdmiralRalwood on October 14, 2016, 07:13:49 am
Generally, a .wav file that doesn't sound like crap will take up way more space than an .ogg file that will sound indistinguishable to the audience. Most people would rather not have individual music files take up dozens of megabytes (takes longer to download, if nothing else).
Title: Re: Mainhall Muisc won't play?
Post by: jr2 on October 14, 2016, 01:33:01 pm
Middle ground would be FLAC, if FSO supports it (lossless audio with decent compression).

The wiki (http://www.hard-light.net/wiki/index.php/Multimedia_Files) seems to indicate it does (but the container must be .ogg, so instead of OGG Vorbis, it would be OGG FLAC, see here (https://xiph.org/flac/faq.html#general__native_vs_ogg):
Quote
What is the difference between (native) FLAC and Ogg FLAC?

You can think of an audio codec as having two layers. The inside layer is the raw compressed data, and the outside layer is the "container" or "transport layer" that splits and arranges the compressed data in pieces so it can be seeked through, edited, etc.

"Native" FLAC is the compressed FLAC data stored in a very minimalist container, designed to be very efficient at storing single audio streams.

Ogg FLAC is the compressed FLAC data stored in an Ogg container. Ogg is a much more powerful transport layer that enables mixing several kinds of different streams (audio, data, metadata, etc). The overhead is slightly higher than with native FLAC.

In either case, the compressed FLAC data is the same and one can be converted to the other without re-encoding.

Which should I use, (native) FLAC or Ogg FLAC?

The short answer right now is probably "native FLAC". If all you are doing is compressing audio to be played back later, native FLAC will do everything you need, is more widely supported, and will yield smaller files. If you plan to edit the compressed audio, or want to multiplex the audio with video later in an Ogg container, Ogg FLAC is a better choice.
Title: Re: Mainhall Muisc won't play?
Post by: AdmiralRalwood on October 14, 2016, 06:24:06 pm
Given we now handle audio through ffmpeg, we could probably be made to support .flac by just adding it to the list of valid audio file extensions; still, even FLAC is massive overkill from a disk space standpoint (there is absolutely no reason for end users to need lossless audio files).
Title: Re: Mainhall Muisc won't play?
Post by: niffiwan on October 14, 2016, 07:00:56 pm
There could be a case for encouraging content creators to share their source files; even so I don't see that as being a big issue for audio (more an issue for textures & similar images)
Title: Re: Mainhall Muisc won't play?
Post by: HLD_Prophecy on October 14, 2016, 07:45:49 pm
So what you guys are saying is that I really should go back and convert all my .wav files (and adjust the play-sound-from-file symbolic expressions accordingly) before release?