Author Topic: FSO sound code: request for community feedback  (Read 7751 times)

0 Members and 2 Guests are viewing this topic.

Offline jg18

  • A very happy zod
  • 210
  • can do more than spellcheck
FSO sound code: request for community feedback
Hey guys,

I'm back and continuing my work for the SCP. Personal details are in WHIYL if you're interested.

I'm now looking into the sound code for possible improvements, and I'd like to get the community's take on

(1) bugs/problems with the current sound code

(2)  features that the sound code should support but currently doesn't. Please justify all features you mention, meaning please don't just say "It would be cool if X were possible" without explaining why.

Thanks!


 

Offline niffiwan

  • 211
  • Eluder Class
Re: FSO sound code: request for community feedback
I think it'd be really cool to allow the number of concurrent channels to be set by the user (based on the assumption that autodetecting this seems hard). This would allow those with the support for it to have really rich & dense soundscapes.  For instance, with taylors old code I set the max OpenALSoft channels to be 256, and it sounded glorious :)

On a more mundane note, I've noticed with newer versions of OpenALSoft, this warning is being spewed to STDOUT.

Code: [Select]
AL lib: alcOpenDevice: Option 'format' is deprecated, please use 'channels' and 'sample-type'

This would be good to fix prior to the format option disappearing completely (although it may require some version specific hackery in order to work with both OpenAL and OpenALSoft).


Lastly, it'd be really good to know exactly why OpenAL & OpenALSoft work for some people and not others. i.e. it's hard to recommend just one of them for everyone, which leads to (maybe) version specific hackery as mentioned above.
Creating a fs2_open.log | Red Alert Bug = Hex Edit | MediaVPs 2014: Bigger HUD gauges | 32bit libs for 64bit Ubuntu
----
Debian Packages (testing/unstable): Freespace2 | wxLauncher
----
m|m: I think I'm suffering from Stockholm syndrome. Bmpman is starting to make sense and it's actually written reasonably well...

 

Offline m!m

  • 211
Re: FSO sound code: request for community feedback
There is a way to get the number of supported mono sources (http://stackoverflow.com/questions/2871905/openal-determine-maximum-sources) which is better than nothing.
I tested it with OpenALSoft and it reported 255, maybe that could be used for determining the maximum number of sources.

On a more mundane note, I've noticed with newer versions of OpenALSoft, this warning is being spewed to STDOUT.

Code: [Select]
AL lib: alcOpenDevice: Option 'format' is deprecated, please use 'channels' and 'sample-type'

This would be good to fix prior to the format option disappearing completely (although it may require some version specific hackery in order to work with both OpenAL and OpenALSoft).
From looking at the OpenALSoft source code this seems to be a configuration file issue and not an issue caused by FSO.

 

Offline niffiwan

  • 211
  • Eluder Class
Re: FSO sound code: request for community feedback
There is a way to get the number of supported mono sources (http://stackoverflow.com/questions/2871905/openal-determine-maximum-sources) which is better than nothing.
I tested it with OpenALSoft and it reported 255, maybe that could be used for determining the maximum number of sources.

That looks decent, as you probably saw from the mantis ticket the idea of "create them until it fails" doesn't seem to work at all.

On a more mundane note, I've noticed with newer versions of OpenALSoft, this warning is being spewed to STDOUT.

Code: [Select]
AL lib: alcOpenDevice: Option 'format' is deprecated, please use 'channels' and 'sample-type'

This would be good to fix prior to the format option disappearing completely (although it may require some version specific hackery in order to work with both OpenAL and OpenALSoft).
From looking at the OpenALSoft source code this seems to be a configuration file issue and not an issue caused by FSO.

:nervous: Thanks, and removing "format" from ~/.alsoftrc has indeed has fixed the "issue".
Creating a fs2_open.log | Red Alert Bug = Hex Edit | MediaVPs 2014: Bigger HUD gauges | 32bit libs for 64bit Ubuntu
----
Debian Packages (testing/unstable): Freespace2 | wxLauncher
----
m|m: I think I'm suffering from Stockholm syndrome. Bmpman is starting to make sense and it's actually written reasonably well...

 

Offline Spoon

  • 212
  • ヾ(´︶`♡)ノ
Re: FSO sound code: request for community feedback
Something that might be worth looking into is the horrible soundclipping that occures when multiple of the same sounds play at the same time. For example, listen to the unholy noise your speakers will produce when you're right next to 6 fighters warping in at the same time.
I'm aware this is mostly caused by hardware limitations, onboard motherboard soundcards etc. But this was something that didn't happen as badly with the old soundcode, I think mostly because a lot of concurrent sounds got pruned back in retail.

(unless I somehow completely missed this being fixed in the mean time, in that case never mind me)
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 jr2

  • The Mail Man
  • 212
  • It's prounounced jayartoo 0x6A7232
    • Steam
Re: FSO sound code: request for community feedback
Is there a way to use a chorus effect type thing instead of just overlapping sounds?

e.g., instead of just playing 6 of the same sound, play one sound with a chorus effect set for 6?

No I don't know if that's possible, but it seems to make sense to me.

 

Offline Dragon

  • Citation needed
  • 212
  • The sky is the limit.
Re: FSO sound code: request for community feedback
There's something I'd like to see for fast-firing weapons. It'd be nice if it was possible to define a sound that would loop when a weapon is being fired, and be created once, instead of for all individual guns (maybe with number of guns defining the volume).
The reason is that when multiple fast guns are firing in unison, it doesn't sound good, and can sometimes "saturate" the sound system completely. That way, just a single sound would be played per ship, despite there being 10-50 shots per second. That could also make the gun sound faster than it actually is, which could be useful, too.

 

Offline Fury

  • The Curmudgeon
  • 213
Re: FSO sound code: request for community feedback
How about smooth transition between sound channels? Prime example of this would be when you have a beam weapon firing past you to your left, its sound is coming from left channel. When you begin turning past the beam, it suddenly switches to right channel. There is no transition, its either one or the other and that can be jarring. Alternative to a beam weapon would be jump-in or jump-out sound, or basically anything that keeps looping for prolonged time.

 

Offline m!m

  • 211
Re: FSO sound code: request for community feedback
How about smooth transition between sound channels? Prime example of this would be when you have a beam weapon firing past you to your left, its sound is coming from left channel. When you begin turning past the beam, it suddenly switches to right channel. There is no transition, its either one or the other and that can be jarring. Alternative to a beam weapon would be jump-in or jump-out sound, or basically anything that keeps looping for prolonged time.
I think that was a bug and has been fixed in trunk.

 

Offline AdmiralRalwood

  • 211
  • The Cthulhu programmer himself!
    • Skype
    • Steam
    • Twitter
Re: FSO sound code: request for community feedback
How about smooth transition between sound channels? Prime example of this would be when you have a beam weapon firing past you to your left, its sound is coming from left channel. When you begin turning past the beam, it suddenly switches to right channel. There is no transition, its either one or the other and that can be jarring.
That bug has been fixed since r10798.

Alternative to a beam weapon would be jump-in or jump-out sound, or basically anything that keeps looping for prolonged time.
I'm not aware of any similar problem with warp sounds...
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 Fury

  • The Curmudgeon
  • 213
Re: FSO sound code: request for community feedback
Oh well, haven't been playing FSO at all past year. Good to see stuff gets fixed. :p

 

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Chopped liver
    • Steam
    • Twitter
Re: FSO sound code: request for community feedback
My biggest issue with the sound code right now is that audio playback is weirdly tied to framerate somehow. What I mean is that low FPS causes sound stuttering. I've only ever noticed this in FSO. Any other games I play on PC don't have audio issues when my framerate decreases or becomes unstable.
Cutscene Upgrade Project - Mainhall Remakes - Between the Ashes
Youtube Channel - P3D Model Box
Between the Ashes is looking for committed testers, PM me for details.
Freespace Upgrade Project See what's happening.

 

Offline Mongoose

  • Rikki-Tikki-Tavi
  • Global Moderator
  • 212
  • This brain for rent.
    • Minecraft
    • Steam
    • Something
Re: FSO sound code: request for community feedback
Really?  I've seen something like that happen in multiple games, though usually when my framerate hits dire levels, like 5 or less.

 

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Chopped liver
    • Steam
    • Twitter
Re: FSO sound code: request for community feedback
I can't remember seeing FPS that low on other games. Either way, should FSO really be doing it when the rate drops from 60 to 40?
Cutscene Upgrade Project - Mainhall Remakes - Between the Ashes
Youtube Channel - P3D Model Box
Between the Ashes is looking for committed testers, PM me for details.
Freespace Upgrade Project See what's happening.

 

Offline niffiwan

  • 211
  • Eluder Class
Re: FSO sound code: request for community feedback
That certainly is oddball, but I don't believe I've seen it occur, e.g. BP Artemis station goes from 60-20 fps for me, and the sound is smooth throughout.

Or on other words, what's your sound setup/environment?  (I've got Linux, SB Audigy, OpenALSoft 1.14, Headphones)
Creating a fs2_open.log | Red Alert Bug = Hex Edit | MediaVPs 2014: Bigger HUD gauges | 32bit libs for 64bit Ubuntu
----
Debian Packages (testing/unstable): Freespace2 | wxLauncher
----
m|m: I think I'm suffering from Stockholm syndrome. Bmpman is starting to make sense and it's actually written reasonably well...

 

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Chopped liver
    • Steam
    • Twitter
Re: FSO sound code: request for community feedback
Win 7, SoundBlaster Recon3D, OpenALSoft

In fact, I went and bought a dedicated card to get off my mobo onboard card specifically to try and remedy the FSO sound issues. It wasn't until I searched high and low and learned about the OpenALSoft config file that I was able to mitigate it a little.
Cutscene Upgrade Project - Mainhall Remakes - Between the Ashes
Youtube Channel - P3D Model Box
Between the Ashes is looking for committed testers, PM me for details.
Freespace Upgrade Project See what's happening.

 

Offline jg18

  • A very happy zod
  • 210
  • can do more than spellcheck
Re: FSO sound code: request for community feedback
Thanks, guys! This also helps give me the extra motivation needed to work on this.

Between wrapping my head around the current sound code and getting up to speed on OpenAL and game audio, all on top of RL issues, there likely won't be anything ready to test for months.

FWIW here's my development setup:
- Onboard audio (Realtek  ALC898 on Gigabyte GA-Z77X-UD5H)
- Discrete audio (Sound Blaster Z)
- Headphones (JVC HA-RX 900)

niffiwan/m!m: just changing MAX_CHANNELS won't do much with the current sound code because of the engine's per-sound concurrency limits (see Iss Mneur's comments in Mantis 2266 about his fix for it). Maybe changing those limits would help (see my posts in the internal).

Also, I wish I knew why taylor decided that 48 sources should be the minimum (why MAX_CHANNELS + 16?), setting aside the problem that his test doesn't work.

Spoon: I believe this should be fixed.

jr2: I'm not sure what you mean by chorus effect; could you elaborate?

Dragon: Interesting, thanks for mentioning it.

Mjn: Hmm, once I'm up to speed, I'll have to see if I can repro that.


Also, I've heard from Battuta that explosions are loud and clippy, although apparently he's out for a month, so I won't be getting his opinion anytime soon. :sigh:

 

Offline jr2

  • The Mail Man
  • 212
  • It's prounounced jayartoo 0x6A7232
    • Steam
Re: FSO sound code: request for community feedback
A chorus effect basically gives a sound multiple 'voices', as if they were a singing chorus.

I did a quick search using the term
Chorus effect
And this seems to explain it:

http://testtone.com/fundamentals/what-chorus-effect

Quote
What is a Chorus Effect?
A chorus (or ensemble) is a modulation effect used to create a richer, thicker sound and add subtle movement. The effect roughly simulates the slight variations in pitch and timing that occur when multiple performers sing or play the same part.

Chorus is a common guitar pedal effect that gives a clean electric guitar a "dreamy" quality. It's also widely used on acoustic guitar, electric piano, and clavinet. On strings and synth pads, chorus creates a richer, more complex sound. Stereo chorus effects also can be used to widen a stereo image.

How does it work?
The chorus effect is based upon a short delay. Incoming audio is split and run through the delay, then mixed with the original audio and sent to the effect's output. With short delay times (20 to 50ms), the delayed audio blends with the original audio instead of creating a distinct echo.

To add movement, chorus effects slowly modulate the delay time with a low-frequency oscillator (LFO). As the LFO cycles the delay time up and down, the delayed audio shifts up and down in pitch by a little bit.

Principal controls
 Apple's Chorus for GarageBand
Apple's Chorus for GarageBand
GarageBand's plugin is a typical
single-voice stereo chorus. Its controls
adjust the speed and depth of the LFO,
and the wet/dry mix is fixed at 50%. Left
and right stereo channels are modulated
180 degrees out of phase to create a
wide stereo image.
Most chorus effects include knobs to adjust the LFO speed (a.k.a. rate or period) and depth (a.k.a. amplitude or intensity). LFO speeds are usually in the range of natural human vibrato (up to about 10 Hertz).

Some plugins include control of the wet/dry mix. At 100% wet, the pitch modulation of a chorus effect sounds like vibrato. To blend the modulated audio with the original, the wet/dry mix is often set at 50% of each.

Common variations
Mono, stereo, and surround chorus
A mono chorus operates on a mono input, or sums its inputs to mono before running them through a single modulated delay. The output of the effect may be stereo. Guitar pedals are usually mono effects generating stereo outputs.

A stereo chorus applies the effect to left and right stereo inputs, or to a duplicated mono input, using two independent delays. The two delays may share the same LFO, but the delays are often modulated 180 degrees out of phase. This makes the left channel cycle up while the right channel cycles down, and vice versa, creating a richer chorus and a wider stereo image.

A surround chorus applies the effect to each surround channel using independent delays. Like a stereo chorus, the surround chorus may use the same LFO for all of the delays, but modulate the delays out of phase to create a wider surround image.

Single and multi-voice chorus
 Apple's Ensemble for Logic
Apple's Ensemble for Logic
Logic's plugin is a multi-voice stereo and
surround chorus that uses a single delay
modulated by three summed LFOs. LFO
phase offsets for the stereo or surround
outputs may be adjusted to narrow or
widen the stereo/surround image.
A single voice chorus uses a single delay that creates a single modulated duplicate of the incoming audio. Basic chorus effects and inexpensive guitar pedals are often single-voice.

A multiple voice chorus uses multiple modulated delays to create a richer sound with more movement. Some chorus effects use the same LFO to modulate all of the delays in sync, but at different points in the LFO's cycle. Other effects use multiple LFOs to modulate the delays independently. The latter creates a richer, less obviously cyclical effect, but with added complexity in the user interface and a higher CPU use.

Complex LFOs
A single LFO chorus can create a noticeable up-and-down pitch wobble. To make the wobble less obvious, a plugin may use multiple LFOs summed together. When each LFO has a different speed and depth, the resulting modulation waveform is complex and the wobble less obvious.

Uncommon variations
Reverb chorus
 Audio Damage's Vapor
Audio Damage's Vapor
Audio Damage's plugin uses a diffuse
reverb algorithm instead of a delay. Plugin
controls adjust the LFO speed and depth,
the delay time, the wet/dry mix, and the
amount of reverb diffusion. A low-cut
filter removes low frequencies that can
muddy the diffusion.
Some chorus effects replace the delay with a diffuse reverb tail algorithm. Instead of a single echo to double the sound, reverb creates a diffuse scattering of echos that are pitch shifted up and down randomly.

Delay time and feedback
Some multi-effect plugins include controls to adjust the delay time and delay feedback. Neither of these are strictly necessary for chorusing, which always uses a short delay time and little or no feedback. The additional knobs allow the plugin to perform a wider range of effects. For instance, a short delay time and high feedback creates flanging. A deep LFO and no delay creates vibrato.

Related effects
Unison mode on a synthesizer creates a bigger sound by playing multiple slightly detuned notes each time a keyboard key is pressed. The effect can be similar to chorus.

Flanging is the same as chorus except that it uses a shorter delay time and delay feedback. This creates a distinctive "zipper" noise as the effect's LFO modulates the delay time back and forth.

Phasing is similar to chorus except that it uses multiple all-pass filters instead of a delay. When the filtered audio is mixed with the original audio, it creates comb filtering effects. When modulated, phasing creates a "swirling" feel to the sound.

Further reading
Chorus effect at Wikipedia. A brief explanation and links.
Chorus effect at WikiAudio. A brief explanation.
Mixing Audio by Roey Izhaki. An excellent book on audio technology, including chorus effects.

Now, the question is, is that something that would work for multiple simultaneous sound events instead of what we get now.
Quote

 

Offline zookeeper

  • *knock knock* Who's there? Poe. Poe who?
  • 210
Re: FSO sound code: request for community feedback
I might be wrong of course, but I don't see how chorus would allow you to decrease the number of sounds. If several sounds start playing at the same time, then sure, it could work, but not if they start at different times, which would practically always be the case.

Effects like that would be useful in other ways, though, if their parameters could be adjusted in real-time by some in-game conditions. For example, the sound emitted by a beam could get gradually chorused if you get very close to it, or the sound of your engines could be pitch-shifted based on how much thrust you're using.

 

Offline niffiwan

  • 211
  • Eluder Class
Re: FSO sound code: request for community feedback
niffiwan/m!m: just changing MAX_CHANNELS won't do much with the current sound code because of the engine's per-sound concurrency limits (see Iss Mneur's comments in Mantis 2266 about his fix for it). Maybe changing those limits would help (see my posts in the internal).

Indeed.  Something like dynamically adjusting the current per-sound concurrency limits based on the total number of sounds available would be very cool, at the same time avoiding clipping issue that Spoon mentioned.
Creating a fs2_open.log | Red Alert Bug = Hex Edit | MediaVPs 2014: Bigger HUD gauges | 32bit libs for 64bit Ubuntu
----
Debian Packages (testing/unstable): Freespace2 | wxLauncher
----
m|m: I think I'm suffering from Stockholm syndrome. Bmpman is starting to make sense and it's actually written reasonably well...