openal-soft icon indicating copy to clipboard operation
openal-soft copied to clipboard

Bass silent

Open ichee opened this issue 8 years ago • 38 comments

Bass is quiet on version 1.17 and up. Was fine on 1.16. Haven't noticed any settings that correct issue. Running Windows.

ichee avatar Sep 17 '16 06:09 ichee

What audio setup do you have (stereo speakers, headphones, 5.1 surround sound, ...)? And can you get a trace log? To do s, set the ALSOFT_LOGLEVEL environment variable to 3 and copy the output of stderr. Or also set the ALSOFT_LOGFILE environment variable to a foldername and filename where it can write the log to.

kcat avatar Sep 17 '16 16:09 kcat

It's a 5.1 surround sound setup via HDMI. Here's the log file for 1.17.2. al_1.17.2.txt

Also, I've included the log for 1.16 for reference. al_1.16.txt

ichee avatar Sep 18 '16 04:09 ichee

Hmm, I'm not seeing anything unexpected in those logs, though I notice a difference between them. In 1.17.2, it creates a context, destroys it, then creates another one, while 1.16 just creates one context when it opens a device.and keeps it. Shouldn't be an issue either way, though it's odd behavior for an app.

Is it a particular soundfile that's exhibiting the issue, or all output? A specific app, or all apps using OpenAL Soft? If it's a specific soundfile, can you provide a copy? Or if it's a specific app, which one?

kcat avatar Sep 18 '16 08:09 kcat

It's all sound and apps that use OpenAL Soft. All other sounds are correct volume, but bass is significantly reduced. Also, I've compiled from latest master to test and it exhibits the same behavior as 1.17.2.

ichee avatar Sep 18 '16 09:09 ichee

Hmm, I'm not sure I can explain that. Reduced bass would occur due to high-pass filters, but those are controlled entirely by the app and have been available since 1.16, so if it was using them, it should happen with both versions. The only other option I can think of is bad signal interaction somewhere in the mixing pipeline. Is the output true 5.1, or is it downmixing to stereo or something?

kcat avatar Sep 18 '16 19:09 kcat

It's 5.1 and is the most obvious with games. Had to be some change since 1.16 was first released and 1.17, although I can't think of what it might be. Bs2b.c comes to mind, but it seems to only affect stereo sources, unless I am mistaken. Is there any specific configuration option for just bass? If not, then which source file specifically controls how bass is output. Also, has there been any notable lfe changes in between those two releases, excluding those mentioned in the 1.17.2 changelog?

ichee avatar Sep 19 '16 02:09 ichee

bs2b.c only affects stereo output. There's no specific option for bass since OpenAL Soft doesn't do equalization except for the EFX effects apps have control of. No source file controls bass output since its not handled separately from the treble.

The only major difference is that 1.17 has a new panning algorithm, which uses ambisonics instead of pairwise mixing to calculate the speaker feeds. That won't affect the bass output though, since it's just panning and not doing anything specific to low frequencies.

Are you able to get recordings? Preferably from the system's loopback capture device (I think Windows has those? where it lets apps record what plays out of a specific device).

kcat avatar Sep 20 '16 05:09 kcat

Here's a recording sample for both 1.16 and 1.17.2 for comparison. Both were taken from the game Psychonauts, and are in ac3 format. Recorded with Audacity with WASAPI for reference.

sample.zip

Also, I noticed during recording that the waveform for the lfe channel was much lower for 1.17.2 than for 1.16.

ichee avatar Sep 20 '16 11:09 ichee

I don't hear anything wrong with the bass in those samples. Though the overall output maybe a little bit quieter in 1.17, for both bass and treble, which if a characteristic I've noticed of ambisonics in general (since its spreading out the energy to help position a sound, instead of just focusing on the nearest two speakers).

OpenAL Soft's LFE channel output is silent in both cases, as it will only write to it when given LFE input (from a 5.1, 6.1, or 7.1 sound buffer). That's the purpose of the LFE channel, to give a bit of extra kick to the bass, which complements the bass in the other channels. However, I've found that speaker systems will tend to use the sub-woofer to deliver all the low-frequency content that the satellite speakers can't handle, so even though the LFE channel is silent, the sub-woofer speaker is playing the low frequencies of the other speakers.

What may be happening is, if the sub-woofer's volume is turned up significantly, the reduction in amplitude given to the other speakers can cause the sub-woofer output to reduce by an extra factor (e.g. if the sub-woofer applies a 2x boost, if the overall signal drops by about -3dB, the bass will drop an extra -3dB), so the bass lowers faster as the overall input lowers.

Can you check to see if the sub-woofer has its own volume control that's been turned up high? And if so, does turning it down to normal make the bass output not sound so different? If that's what's happening, I can look into ways of fixing or improving it.

kcat avatar Sep 20 '16 20:09 kcat

Reducing the volume made no difference, however increasing it improved it significantly, but it becomes too loud for everything else, and creates a constant faint rumble. Volume was set to medium by default. For reference, sub is a Klipsch SW-450. For what it's worth, 1.16 sounds the closest to an X-Fi cards output.

As for ambisonics, is there any easy way to temporarily remove or avoid compiling with it to test if it's the cause?

ichee avatar Sep 21 '16 09:09 ichee

Unfortunately there isn't an easy way to temporarily remove ambisonics. Pairwise mixing is only left as an option for stereo output in the latest git, though even in 1.17.2, the ambisonic configuration will effectively use pairwise-style panning between -90 and +90 degrees. I would have to add a new option to go back to it for surround sound output.

kcat avatar Sep 22 '16 00:09 kcat

Until something can be figured out, any way to back port the band-limited sinc resampler to 1.16, and possibly the sse optimizations that were done?

ichee avatar Sep 22 '16 11:09 ichee

Spent some time bisecting commits and found that the first one to cause reduced bass was a77387b5490e8f40c682118c2a1c192cddc06939.

Commit 4d36ef65b2ec1cd3122bf9ee615df452f003d014 caused an increase in bass and some sound effects, but all other sounds, music, and voices were much quieter.

Hope this helps in fixing the problem.

ichee avatar Sep 23 '16 12:09 ichee

Alu.c from commit 79163b075517c88c86c8f63f32669c75f2c66404 when used in place of alu.c from commit a77387b5490e8f40c682118c2a1c192cddc06939 fixes issue when

ALfloat gain = 1.0f / sqrtf((float)Device->NumSpeakers);

is changed to

ALfloat gain = 0.6f / sqrtf((float)Device->NumSpeakers);

But, some sound effects seem to cut short or just played incorrectly.

ichee avatar Sep 23 '16 13:09 ichee

Commit a77387b5490e8f40c682118c2a1c192cddc06939 is simply trying to reduce the volume of ambient sounds to better match panned sounds, and so shouldn't affect bass any differently than non-bass. Though the volume calculation for ambient sounds has changed even more since then.

It's odd that using ALu.c from commit 79163b075517c88c86c8f63f32669c75f2c66404 still works after changing it to 0.6f / sqrtf((float)Device->NumSpeakers);. That's effectively only 2.5dB louder than the 1.0f / (float)Device->NumSpeakers; it uses afterward (0.2683 gain for the former, 0.2 gain for the latter), and given that it's the overall volume, I don't get why that would affect the bass any differently.

kcat avatar Sep 23 '16 21:09 kcat

It seems that bass is being dampened just slightly enough that it isn't being handled by the subwoofer much or at all, and a slight amplification is enough for it to receive the signal. With the subwoofer turned off, all versions sound mostly the same, with the exception of slightly quieter overall sound after commit a77387b5490e8f40c682118c2a1c192cddc06939. Most of the apparent bass reduction is in some music and reverb effects.

ichee avatar Sep 23 '16 21:09 ichee

I figured that may be the case. I suppose just turning up the normal speakers' volume knob (assuming there is one) doesn't get the subwoofer to pick it up?

Otherwise, a quick fix would be to add a volume adjustment option, which just globally increases the source output by a specified amount. Then anyone that finds the output too quiet like this, even at max in-game volume, can just turn it up.

kcat avatar Sep 23 '16 22:09 kcat

Turning up volume makes almost everything louder, but sub bass still sounds a bit muffled. The previous "ALfloat gain = 0.6f / sqrtf((float)Device->NumSpeakers);" change seems to amplify only bass, but without exaggerating overall output, so it's hard to tell how balanced it is. A global volume adjustment could work if it improves low frequencies enough, but in recent commits the boost option no longer has any effect on output, whether that would have a similar effect as a global volume option or not I don't know. Bass seems to be somewhat equalized with rest of the audio and loses that bass thumping effect you'd expect.

ichee avatar Sep 23 '16 23:09 ichee

The previous "ALfloat gain = 0.6f / sqrtf((float)Device->NumSpeakers);" change seems to amplify only bass

It actually amplifies all frequencies, by about 2.5dB compared to the following commit. Such a small amount would normally be difficult to consciously notice, but it seems it's just enough to get the subwoofer to play it.

kcat avatar Sep 24 '16 02:09 kcat

I've noticed that ambisonics in general doesn't reduce bass, it exaggerates it. It's commit a77387b5490e8f40c682118c2a1c192cddc06939 that equalizes and reduces the apparent bass output. For now, I guess I'll await a volume adjustment option to see if that will resolve the issue. I can't think of anything else to try at the moment.

ichee avatar Sep 24 '16 03:09 ichee

Commit f5e4a3ed85993f479c6cc1a967d5252378eb5211 adds a volume-adjust config option. You can increase the output by editing %AppData%\alsoft.ini and add something like:

[general]
volume-adjust = 6

where 6 is an adjustment in decibels (valid range is -24 to +24, with 0 being unchanged).

kcat avatar Sep 25 '16 02:09 kcat

Tested commit and everything is louder, except bass is still too quiet. It sounds the same as turning my receiver volume up. All problems seem to originate with the ambisonics commit 4d36ef65b2ec1cd3122bf9ee615df452f003d014. It seems like ambisonics is not handling lfe properly, or is mixing it incorrectly, since it only stands out when using a subwoofer. Any way to create an alternate code path with pre ambisonics code that would be used when user configurable option is set?

Also, any way to tag the bass signal as lfe, so as to allow it to more easily be picked up by a receiver as low frequency?

As a side note, I've found some documentation on ambisonics bass management here. It's at the bottom of the page.

ichee avatar Sep 26 '16 14:09 ichee

It seems like ambisonics is not handling lfe properly, or is mixing it incorrectly, since it only stands out when using a subwoofer.

Ambisonics itself isn't concerned with LFE. The old panning method wasn't either, since it's a non-locational output -- it's only used when given LFE input (e.g. from a 5.1 buffer format).

The difference is a result of the newer ambisonics method providing a more balanced output. Especially for ambient sounds that come from all directions, 5.1, 6.1, and 7.1 don't have equal spacing between speakers, so some speaker outputs for such a sound need to be quieter for it to sound properly centered on the listener. That change unfortunately results in your sub-woofer not picking out as much bass from the other speakers.

Any way to create an alternate code path with pre ambisonics code that would be used when user configurable option is set?

Maybe. The difficulty is that it won't necessarily work well with other parts of the rendering pipeline, such as the effects output and certain extensions which utilize ambisonics (source radius, and B-Format buffer formats).

Also, any way to tag the bass signal as lfe, so as to allow it to more easily be picked up by a receiver as low frequency?

In the program, you can use the ALC_EXT_DEDICATED extension to send certain sounds to the LFE channel. Otherwise, no. I've thought about adding the capability for a decoder definition to forward a little bit of all sound to the LFE channel, but the issue is that the channel should be explicitly low-pass filtered (since it's not guaranteed that the speaker itself will do it, as far as I know), whereas currently it can be assumed anything written to LFE was authored for it.

As a side note, I've found some documentation on ambisonics bass management here. It's at the bottom of the page.

That seems to suggest the same thing I figured:

"With this in mind, we may conclude that the best - and simplest - way to handle the LFE is not to use it at all, instead allowing the monitoring system in the studio or in the listener's system to handle bass frequencies: passing them to the sub if the speakers aren't full-range, or relaying it faithfully if they are. It's as simple as that!"

OpenAL Soft doesn't give anything to LFE unless explicitly told to, with AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT from the ALC_EXT_DEDICATEDextension, or a buffer format that contains LFE input. for everything else, it passes the full-range output to all the other speakers, and lets the speaker system work it out.

kcat avatar Sep 28 '16 04:09 kcat

Out of curiosity, how is the sub-woofer connected? With my 5.1 speakers, I have 3 3.5mm jack connections (2 channels for each, totaling 6 outputs) that go to the front-right speaker (where the power button and volume knob are), which then connects to the sub-woofer. The sub-woofer then connects to the remaining 4 speakers. It's difficult to get a detailed look at the connections on the Klipsch SW-450, although from what I can see, it doesn't appear to be used as a "hub" like mine is.

I wonder if the reason I don't hear the same issue is because my sub-woofer receives all 6 channel signals and produces an appropriate bass response using all of them, while your sub-woofer only gets signals from the front left and right, not the full output. It's hard to tell from the pictures I've found, but it looks like it only has two inputs, one right and one left, and nothing from the center or surround (rear or side) channels. If that's the case, then the problem isn't really the overall lowered volume, but because the front left and front right speakers aren't as dominant for the output (the front center and surround channels are helping out more now, but your sub-woofer is ignoring them).

And if that is indeed the problem, then it may help to instead use a decoder matrix that omits the front center output from the 3D render, making the front left and front right handle more of it.

kcat avatar Oct 06 '16 08:10 kcat

A single RCA connector from sub to home theatre receiver, and the 5 speakers are connected to receiver via high gauge speaker wire. The receiver handles all output to speakers and sub with a crossover frequency set to 80Hz. All speakers are full range, but I keep them set as small speakers in receiver controls so all bass below crossover will be passed to sub instead of speakers, mainly because speaker bass is a bit lacking sometimes.

For reference, receiver is a Sony STR-DN1040.

ichee avatar Oct 06 '16 19:10 ichee

I can confirm NO LFE in 1.20.1 too testing with a 5.1 sound file (built on purpose to test the LFE processing with foobar2000 and openal output plugin - but the simple redirection of low frequencies of a classic stereo file gives the same result: NO LFE signal at all). Please fix!

donizettilorenzo avatar May 11 '20 17:05 donizettilorenzo

@donizettilorenzo I've noticed poor frequency range in 1.20.1, at least with the pulseaudio backend. 1.20.0 sounds great though.

sjnewbury avatar Oct 15 '20 08:10 sjnewbury

@donizettilorenzo I've noticed poor frequency range in 1.20.1, at least with the pulseaudio backend. 1.20.0 sounds great though.

Can confirm. I'm using this with Minecraft, and everything on 1.20.1 and later sounds like I'm playing it off of laptop speakers rather than my headphones.

TorutheRedFox avatar Mar 04 '21 12:03 TorutheRedFox

I came across this testing 1.21.1 problems in BF2 (silent crash with ambdec file - Win10 20H1 using the analog 5.1 motherboard line outputs). 1.20.1 had no LFE with surround sound, but 1.20.0 was fine; alsoft logs didn't show anything. However, 1.21.0 also works for me, so I think this Issue can be closed?

jeremywh7 avatar May 05 '21 01:05 jeremywh7

OpenAL Soft doesn't synthesize an LFE signal, as it's expected a 5.1 system would have its own crossover stage to feed low frequencies from the 5 channels into the subwoofer. It can forward an LFE signal from a 5.1, 6.1, or 7.1 buffer using direct_channels, or feed it with a mono submix from the dedicated dialog/lfe effect (although it doesn't do filtering; it's assumed the input is prefiltered or the output/speakers will filter it).

I don't know of any change between 1.20.0 and 1.20.1 that would've changed anything there.

kcat avatar May 05 '21 03:05 kcat