feat(09-02): update autoAssignFreq range to [2500, 4000] Hz
- Change baseHz from 1200.0 to 2500.0 - Change numSteps from uint32(24) to uint32(31) - Update function comment to reflect new range - Prevents collision with built-in frequencies (max 2449 Hz)
This commit is contained in:
+3
-3
@@ -205,15 +205,15 @@ func convertRules(raw []RawRule) []classify.Rule {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
// autoAssignFreq computes a deterministic frequency in [1200, 2350] Hz for a class name
|
// autoAssignFreq computes a deterministic frequency in [2500, 4000] Hz for a class name
|
||||||
// using FNV-32a hashing. Same input always produces the same output.
|
// using FNV-32a hashing. Same input always produces the same output.
|
||||||
func autoAssignFreq(className string) float64 {
|
func autoAssignFreq(className string) float64 {
|
||||||
h := fnv.New32a()
|
h := fnv.New32a()
|
||||||
h.Write([]byte(className))
|
h.Write([]byte(className))
|
||||||
const (
|
const (
|
||||||
baseHz = 1200.0
|
baseHz = 2500.0
|
||||||
stepHz = 50.0
|
stepHz = 50.0
|
||||||
numSteps = uint32(24)
|
numSteps = uint32(31) // [2500, 4000] Hz in 50 Hz steps
|
||||||
)
|
)
|
||||||
return baseHz + float64(h.Sum32()%numSteps)*stepHz
|
return baseHz + float64(h.Sum32()%numSteps)*stepHz
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user