Author Topic: Sound set test builds  (Read 13416 times)

0 Members and 1 Guest are viewing this topic.

Offline m!m

  • 211
Sound set test builds
Some time ago, there was a request for "advanced" sound effects which would allow to specify multiple sound files for a single sound.tbl entry. I even wrote an implementation of that feature but for some reason it never got merged and that was a good thing. The code was so horribly written that I refuse to even look at it now. So, now I decided that it may be a good time to revisit that problem but with a better solution than the one I used originally.

Test builds are available here: http://swc.fs2downloads.com/builds/test/soundSets/

Even if you are not a modder who might use this feature you can still try the builds above to test if the normal sound playback still works.

If you are a modder who might use this feature then you will need some documentation on how this new feature works. The new sound set syntax is based on the existing SCP syntax so if you already use this then it should be easy to use this new feature. Other than the feature described in the original thread, these sound sets do not use a separate section in the sounds table and can be used in all sections documented in the sounds.tbl wiki page.

You start your sound entry as usual with $Name to give your sound a name. Then you can add as many sounds as you like with separate +Entry parameters (but there has to be at least one entry):
Code: [Select]
$Name: TestSet
+Entry: L_Sidearm.wav
+Entry: L_Scalpel.wav
+Entry: L_Flail2.wav
+Entry: L_Prom_R.wav
+Entry: L_Prom_S.wav

This is a complete sound entry that will use the default values for all entries but you probably want to change those. Every option listed here must come in the exact sequence they are listed here but you can omit an option and it will use a default value.

+Cycle type: This specified how the next entry of the various sound entries is selected. Possible values are sequential and random. These types do exactly what their names suggest. The first uses the sounds sequentially one after another and the second type selects a random sound entry every time the sound is played. The way the sequential mode works at the moment is that one sound entry only has a single global index counter so if two sources use the same sound effect then the first source will use sound 1, the second will use sound 2 and if source one wants to play the sound again it will use sound 3 of the list.

+Preload: Same as with the usual SCP syntax

+Volume: Specifies the volume of the sound but now this accepts a range of possible values from which a random value will be chosen every time the sound is played. The syntax is a list of floating point numbers like this:
Code: [Select]
+Volume: (0.4 0.6)
This will cause the sound to use 40% to 60% volume.

+3D Sound, +Priority, +Limit: Same as with the usual SCP syntax.

+Pitch: This is another new addition to the sound sets which lets you specify the pitch of the sound. This is also a random range like volume:
Code: [Select]
+Pitch: (0.5 2.0)
The values must be greater than zero and 1.0 will use the original sound without changing the pitch. What these values mean is quite technical so I would suggest trying different values and checking how they sound like.

Here is an example of a full sound set table:
Code: (soundSets-snd.tbm) [Select]
#Game Sounds Start

$Name: TestSet
+Entry: L_Sidearm.wav
+Entry: L_Scalpel.wav
+Entry: L_Flail2.wav
+Entry: L_Prom_R.wav
+Entry: L_Prom_S.wav

+Cycle type: sequential
+Preload: False
+Volume: (0.4 0.6)
+3D Sound:
+Attenuation start: 50
+Attenuation end: 400
+Priority: Medium-Low
+Limit: 8
+Pitch: (0.5 2.0)

#Game Sounds End

Let me know if you find any bugs or if the existing behavior should be changed in any way. The current implementation and table syntax is not set in stone so if you have a suggestion for how this could be improved please let me know here.
« Last Edit: October 08, 2017, 11:57:03 am by m!m »

 

Offline AdmiralRalwood

  • 211
  • The Cthulhu programmer himself!
    • Skype
    • Steam
    • Twitter
Re: Sound set test builds
Nice work! :yes:
Ph'nglui mglw'nafh Codethulhu GitHub wgah'nagl fhtagn.

schrödinbug (noun) - a bug that manifests itself in running software after a programmer notices that the code should never have worked in the first place.

When you gaze long into BMPMAN, BMPMAN also gazes into you.

"I am one of the best FREDders on Earth" -General Battuta

<Aesaar> literary criticism is vladimir putin

<MageKing17> "There's probably a reason the code is the way it is" is a very dangerous line of thought. :P
<MageKing17> Because the "reason" often turns out to be "nobody noticed it was wrong".
(the very next day)
<MageKing17> this ****ing code did it to me again
<MageKing17> "That doesn't really make sense to me, but I'll assume it was being done for a reason."
<MageKing17> **** ME
<MageKing17> THE REASON IS PEOPLE ARE STUPID
<MageKing17> ESPECIALLY ME

<MageKing17> God damn, I do not understand how this is breaking.
<MageKing17> Everything points to "this should work fine", and yet it's clearly not working.
<MjnMixael> 2 hours later... "God damn, how did this ever work at all?!"
(...)
<MageKing17> so
<MageKing17> more than two hours
<MageKing17> but once again we have reached the inevitable conclusion
<MageKing17> How did this code ever work in the first place!?

<@The_E> Welcome to OpenGL, where standards compliance is optional, and error reporting inconsistent

<MageKing17> It was all working perfectly until I actually tried it on an actual mission.

<IronWorks> I am useful for FSO stuff again. This is a red-letter day!
* z64555 erases "Thursday" and rewrites it in red ink

<MageKing17> TIL the entire homing code is held up by shoestrings and duct tape, basically.

 

Offline Spoon

  • 212
  • ヾ(´︶`♡)ノ
Re: Sound set test builds
This looks amazing, this should improve the soundscape a lot. (Now I can stop having multiple substitute weapon entries just to have sound variation)

But I dont think you uploaded the right build here? I've been trying the fs2_open_3_8_1_soundSets_x64_SSE2 one, but it gives me:
Error: sounds.tbl(line 1314):
Error: Missing required token: [+Preload:]. Found [+Entry: Light laser.ogg] instead.
Urutorahappī!!

[02:42] <@Axem> spoon somethings wrong
[02:42] <@Axem> critically wrong
[02:42] <@Axem> im happy with these missions now
[02:44] <@Axem> well
[02:44] <@Axem> with 2 of them

 

Offline m!m

  • 211
Re: Sound set test builds
I am pretty sure that those builds are correct since that error message would look very different if the build didn't support sound sets.

What is your entire table? Maybe you found a bug in the parsing code.

 

Offline Spoon

  • 212
  • ヾ(´︶`♡)ノ
Re: Sound set test builds
I am pretty sure that those builds are correct since that error message would look very different if the build didn't support sound sets.
Actually, thats how those error messages always look when a build doesn't support some table feature. I would know, I've had a very long history of running into these things  :p
And I even checked with another build just to be sure, and it gave me that exact same error message.

What is your entire table? Maybe you found a bug in the parsing code.


Code: [Select]
$Name: 330
+Filename: Light laser.ogg
+Entry: Light laser.ogg
+Cycle type: sequential
+Preload: no
+Volume: (0.55 0.65)
+3D Sound:
        +Attenuation start: 250
        +Attenuation end: 1200
+Priority: High
+Limit: 10 ; VX-02 fired
+Pitch: (0,8 1,2)
I've tried a bunch of different variations, removing and adding bits. But any of the new features throw up an error. I don't think its a parsing code bug.
Urutorahappī!!

[02:42] <@Axem> spoon somethings wrong
[02:42] <@Axem> critically wrong
[02:42] <@Axem> im happy with these missions now
[02:44] <@Axem> well
[02:44] <@Axem> with 2 of them

 

Offline m!m

  • 211
Re: Sound set test builds
+Filename: is not valid if you want to create a sound set and is only still supported for backwards compatibility. +Entry effectively replaces +Filename with the slight difference that you can have multiple entries :p

Actually, thats how those error messages always look when a build doesn't support some table feature. I would know, I've had a very long history of running into these things  :p
And I even checked with another build just to be sure, and it gave me that exact same error message.
The +Filename triggers the "old" parsing code so that explains why you see the same message in both builds. I only looked at the new parsing code so that explains why I didn't understand where that error was coming from.

So, just remove the +Filename line and it should work.

 

Offline Spoon

  • 212
  • ヾ(´︶`♡)ノ
Re: Sound set test builds
+Filename: is not valid if you want to create a sound set and is only still supported for backwards compatibility. +Entry effectively replaces +Filename with the slight difference that you can have multiple entries :p

Actually, thats how those error messages always look when a build doesn't support some table feature. I would know, I've had a very long history of running into these things  :p
And I even checked with another build just to be sure, and it gave me that exact same error message.
The +Filename triggers the "old" parsing code so that explains why you see the same message in both builds. I only looked at the new parsing code so that explains why I didn't understand where that error was coming from.
Aaah okay then!

So, just remove the +Filename line and it should work.
It werks!

Boy, does adding a wide pitch range make for... interesting sound effects  :lol:
But even just a slight pitch change, already makes a stream of pew pew sounds, sound more diverse. I'm going to be messing with these sound sets for a while.


(Also, has it always been possible to use letters instead of numbers for $Name: ?  :nervous: Because that sure would have been more easy to organize tables with, rather than these dumb numbers! :P I always assumed  :v: had sounds.tbl indexed with numbers for some hardcoded reason)

(Also also, damnit m!m, stop adding all these neat features that will delay WoD's release even more! :P )
Urutorahappī!!

[02:42] <@Axem> spoon somethings wrong
[02:42] <@Axem> critically wrong
[02:42] <@Axem> im happy with these missions now
[02:44] <@Axem> well
[02:44] <@Axem> with 2 of them

 

Offline m!m

  • 211
Re: Sound set test builds
(Also, has it always been possible to use letters instead of numbers for $Name: ?  :nervous: Because that sure would have been more easy to organize tables with, rather than these dumb numbers! :P I always assumed  :v: had sounds.tbl indexed with numbers for some hardcoded reason)
It has been like that for some time already. It's documented on the wiki.

(Also also, damnit m!m, stop adding all these neat features that will delay WoD's release even more! :P )
I only have to fix a minor issue until I have a working setup of basic impact decals so I guess I'm looking forward to seeing the release of WoD in 2030 :p

 

Offline Spoon

  • 212
  • ヾ(´︶`♡)ノ
Re: Sound set test builds
.
Urutorahappī!!

[02:42] <@Axem> spoon somethings wrong
[02:42] <@Axem> critically wrong
[02:42] <@Axem> im happy with these missions now
[02:44] <@Axem> well
[02:44] <@Axem> with 2 of them

 

Offline Spoon

  • 212
  • ヾ(´︶`♡)ノ
Re: Sound set test builds
After adding a bunch of sound sets, I can only add that this is fantastic  :yes:


However, I ran in a game breaking bug, that is most likely not directly related to this particular soundset feature. But it happens in this build.
Ingame messages are bugging out (using Axem's message script). It gets stuck on the first message that plays, and never plays anything after that. I dont know if this is specific to this particular build, or just something that got introduced with recent nightlies. (It's always kind of a hassle for me to test these things with WoD, since I have to comment out multilock in weapon entries, and now with these sound sets, I have an extra thing to comment out before I can run a 'regular' build.)

Edit: Actually tested with BP, latest nightly has no issues, this build also causes the messages in BP to freeze after the first one.
Since message length is tied to sound file length, it might actually be related to this sound change?
« Last Edit: October 10, 2017, 10:16:46 am by Spoon »
Urutorahappī!!

[02:42] <@Axem> spoon somethings wrong
[02:42] <@Axem> critically wrong
[02:42] <@Axem> im happy with these missions now
[02:44] <@Axem> well
[02:44] <@Axem> with 2 of them

 

Offline Kiloku

  • 27
  • Buzzbuzz!
    • Minecraft
I just left Audio class at college (Game Dev course) where the prof was talking about pitch shifting a single repeating sound randomly makes it  have great variation. Then I get home to this thread! Awesome!
Potato!

 

Offline m!m

  • 211
Edit: Actually tested with BP, latest nightly has no issues, this build also causes the messages in BP to freeze after the first one.
Since message length is tied to sound file length, it might actually be related to this sound change?
Thank you for this information. That should make it much easier to find the issue. I'm currently working on the decal stuff but I'll fix this issue ASAP.

EDIT: I found an issue where an assertion was triggered when a voice file was played. I updated the test branch and new builds should be available relatively soon. Until those are compiled, could you rerun your test with a debug build (I assume that you were using a release build since playing any voice file would crash the engine)? The bug I fixed is consistent with the issue you reported so hopefully I fixed the right issue...
« Last Edit: October 10, 2017, 11:51:44 am by m!m »

 

Offline Spoon

  • 212
  • ヾ(´︶`♡)ノ
Running the debug build, this assert error pops up on the first message played

Code: [Select]
ASSERTION: "pitch > 0.0f" at ds.cpp:1280
 Pitch may not be less than zero!

Assert: "pitch > 0.0f"
File: ds.cpp
Line: 1280
Pitch may not be less than zero!

ntdll.dll! ZwWaitForSingleObject + 10 bytes
KERNELBASE.dll! WaitForSingleObjectEx + 156 bytes
fs2_open_3_8_1_soundSets_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_1_soundSets_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_1_soundSets_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_1_soundSets_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_1_soundSets_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_1_soundSets_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_1_soundSets_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_1_soundSets_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_1_soundSets_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_1_soundSets_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_1_soundSets_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_1_soundSets_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_1_soundSets_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_1_soundSets_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_1_soundSets_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_1_soundSets_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_1_soundSets_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_1_soundSets_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_1_soundSets_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_1_soundSets_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_1_soundSets_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_1_soundSets_x64_SSE2-FASTDBG.exe! <no symbol>
kernel32.dll! BaseThreadInitThunk + 13 bytes
[...]
[ This info is in the clipboard so you can paste it somewhere now ]


Use Debug to break into Debugger, Exit will close the application.

Int3(): From C:\projects\fs2open-github-com\code\osapi\dialogs.cpp at line 355
ntdll.dll! ZwWaitForSingleObject + 10 bytes
KERNELBASE.dll! WaitForSingleObjectEx + 156 bytes
fs2_open_3_8_1_soundSets_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_1_soundSets_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_1_soundSets_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_1_soundSets_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_1_soundSets_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_1_soundSets_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_1_soundSets_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_1_soundSets_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_1_soundSets_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_1_soundSets_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_1_soundSets_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_1_soundSets_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_1_soundSets_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_1_soundSets_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_1_soundSets_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_1_soundSets_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_1_soundSets_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_1_soundSets_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_1_soundSets_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_1_soundSets_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_1_soundSets_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_1_soundSets_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_1_soundSets_x64_SSE2-FASTDBG.exe! <no symbol>
fs2_open_3_8_1_soundSets_x64_SSE2-FASTDBG.exe! <no symbol>
kernel32.dll! BaseThreadInitThunk + 13 bytes
ntdll.dll! RtlUserThreadStart + 33 bytes
Urutorahappī!!

[02:42] <@Axem> spoon somethings wrong
[02:42] <@Axem> critically wrong
[02:42] <@Axem> im happy with these missions now
[02:44] <@Axem> well
[02:44] <@Axem> with 2 of them

 

Offline m!m

  • 211
Good, that's the one I fixed.

EDIT: The builds have finished so you can try the new builds to to check if that fixed the issue.
« Last Edit: October 12, 2017, 08:14:46 am by m!m »

 

Offline m!m

  • 211
@Spoon: Did the newest build fix the Assertion/sound issue?

 

Offline Spoon

  • 212
  • ヾ(´︶`♡)ノ
@Spoon: Did the newest build fix the Assertion/sound issue?
Oh ****, sorry for not reporting back on that! Yes it has been fixed :yes:
As far as I can tell, all of the sound set features seems to work properly now.
Urutorahappī!!

[02:42] <@Axem> spoon somethings wrong
[02:42] <@Axem> critically wrong
[02:42] <@Axem> im happy with these missions now
[02:44] <@Axem> well
[02:44] <@Axem> with 2 of them

 

Offline m!m

  • 211
Thank you for testing. If everything works right then I'll start bothering people on Discord until I get a code review :p

 

Offline m!m

  • 211
The changes have been merged and will appear in the next nightly build (whenever that may be since the nightly script cannot create new posts at the moment).

 

Offline m!m

  • 211
I added the documentation for this feature to the wiki: http://wiki.hard-light.net/index.php/Sounds.tbl

 

Offline Bryan See

  • Has anyone really been far as decided to use even go want to do look more like?
  • 210
  • Trying to redeem, but under Tiger Parents
    • Skype
    • Steam
    • Twitter
Excuse me, what about music?
Bryan See - My FreeSpace Wiki User Page (Talk, Contributions)

Full Projects:
Shattered Stars

Campaigns:
Lost in the Mist - Cyrene vs. Psamtik
FreeSpace: Reunited

Ships:
GTS Hygeia, GTT Argo, SC Raguel

Tools:
FSO TC/Game template

I've been under attack by Tiger Parents like Jennifer Pan...