How the Sample Rate Sets the Whistle Frequency Limit
The highest whistle setting on onlinedogwhistle.com is floor(actual AudioContext.sampleRate × 0.45). Multiply the actual sample rate by 0.45, then round down to a whole number. This ceiling limits digital tone generation. It does not certify that your speaker can reproduce the selected frequency.
Calculate the ceiling from the actual context
Use the sample rate of the active audio context when interpreting the formula. MDN documents sampleRate as a property of BaseAudioContext. A device name or an advertised audio specification is not a substitute for that actual value. For a sample rate of 44,100, the calculation is 44,100 × 0.45 = 19,845. At 48,000, the result is 21,600. Both results are whole numbers already. If a calculation produces a decimal, floor means keeping the whole number below it. The app uses this rule to set its maximum selectable frequency.
- Use the actual audio context value.
- Multiply that value by 0.45.
- Round downward if the result contains a fraction.
Read a preset after the cap is applied
The preset buttons request 4, 8, 12, 16, and 18 kHz. Each request is checked against the ceiling. For a calculation example, an actual sample rate of 32,000 Hz would produce a 14,400 Hz cap. The 16,000 and 18,000 Hz requests would then both be limited to 14,400 Hz. This example explains the rule; it is not a prediction about your browser. Read the visible frequency after pressing a preset. When comparing devices, compare their displayed settings rather than assuming that matching preset labels always produce matching generated frequencies.
- A preset can request more than the current ceiling.
- Several presets can share one capped result.
- The visible frequency records the selection after limiting.
Separate the numerical limit from speaker response
The ceiling describes what the app permits its sine generator to request. Speaker response is a separate physical issue. A high displayed number does not verify an ultrasonic signal at the speaker. Many built-in phone and laptop speakers cannot reproduce ultrasonic frequencies. Neither the frequency display nor the gain percentage measures acoustic output. The app uses no microphone, so it does not listen to the speaker to check the result. Keep system volume low and keep the device away from ears. If a tone seems absent, do not treat added volume as a way to confirm it.
- Digital settings are not speaker measurements.
- Software gain is capped at 25%, with a 10% default.
- Stop playback if the sound causes discomfort.
Check playback again after an audio change
Stop the whistle before connecting, disconnecting, or switching audio equipment. Once the change is complete, inspect the current frequency and playback state before starting another sound. Do not assume the previous selection proves anything about the new output route. The app stops on a devicechange signal, tab hiding, and audio interruption. MDN marks devicechange as having limited browser availability. A browser may therefore miss a route change, and automatic stopping cannot be promised for every switch. A successful initial cache can support later PWA use, but offline operation is not guaranteed across all browsers.
- Stop manually before changing the audio route.
- Review the visible setting after the change.
- Keep the tab in view during playback.
- Identify the actual audio context sample rate when checking the ceiling calculation.
- Multiply by 0.45 and discard any fractional remainder.
- Select a preset and compare the displayed frequency with that ceiling.
- Stop before switching output equipment, then check the current controls before restarting.
Why might the maximum differ between devices?
The formula uses the actual audio context sample rate. Different actual rates produce different numerical ceilings. A hardware label alone does not establish the value used.
Can the 100 Hz controls go above the cap?
No. The coarse adjustment size does not override the maximum. The cap remains the upper bound, even when its final digits do not form a 100 Hz interval.
Does a 21,600 Hz ceiling prove ultrasonic playback?
No. That result follows from a 48,000 Hz sample rate. It describes the digital limit, while the speaker's output remains unverified.