Skip to content

Commit 1ccf037

Browse files
authored
Merge pull request #6548 from smoogipoo/remove-frequency-clamp
Remove `TrackBass` frequency clamping
2 parents 28ca7a8 + 9e1b216 commit 1ccf037

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

osu.Framework/Audio/BassRelativeFrequencyHandler.cs

+3-6
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,9 @@ public void SetFrequency(double relativeFrequency)
6767
if (channel == 0)
6868
throw new InvalidOperationException("Attempted to set the channel frequency without calling SetChannel() first.");
6969

70-
// http://bass.radio42.com/help/html/ff7623f0-6e9f-6be8-c8a7-17d3a6dc6d51.htm (BASS_ATTRIB_FREQ's description)
71-
// Above documentation shows the frequency limits which the constants (min_bass_freq, max_bass_freq) came from.
72-
const int min_bass_freq = 100;
73-
const int max_bass_freq = 100000;
74-
75-
int channelFrequency = (int)Math.Clamp(Math.Abs(initialFrequency * relativeFrequency), min_bass_freq, max_bass_freq);
70+
// In the past, allowing frequency to go too low (like 1 Hz) caused audible artifacts.
71+
// For this reason, the lower range is clamped to 100Hz, a value which is usually low enough to naturally be silent.
72+
int channelFrequency = (int)Math.Max(100, Math.Abs(initialFrequency * relativeFrequency));
7673
Bass.ChannelSetAttribute(channel, ChannelAttribute.Frequency, channelFrequency);
7774

7875
// Maintain internal pause on zero frequency due to BASS not supporting them (0 is took for original rate in BASS API)

0 commit comments

Comments
 (0)