The GPAD firmware could encapsulate and abstract Buzzer functions in objects perhaps as follows.
The GPAD buzzer system hardware is capable of making tone with the Arduino Tone command on two pins, the Tone pin on PB0 aka D8 and Attenuate pin PD4 aka D4 . . See the Arduino Tone documentation for frequency range and duration.
https://www.arduino.cc/reference/en/language/functions/advanced-io/tone/
These tones can ONLY be steady state or with a time out and the Tone command is non blocking.
Buzzer Levels which parallel the alarm levels*.
Buzzer_Alarms can four Buzzer Levels {Off, Low, Medium, High}.
For Off, both the Tone pin is off and the Attenuate pin is DO NOT CARE
For Low, the Attenuate pin is set for output and set to LOW. The Tone Pin is set for a tone(pin, frequency, duration).
For Medium, Tone pin is set is set for output and set to LOW. The Attenuate pin is set for tone(pin, frequency, duration).
For High, Attenuate pin is set for Input and set to DO NOT CARE. The Tone Pin is set for a tone(pin, frequency, duration).
Notes on amplected estimates
Approximate weighting for Low, Medium and High are (0, 300/(300+1000+10000), 1000/(300+1000+10000) and 10000/(1000+10000)
Approximate weighting for Low, Medium and High are (0, 300/(11300), 1000/(11300) and 10000/(11000)
Approximate weighting for Low, Medium and High are (0, 3/(113), 10/(113) and 10/(11)
Approximate weighting for Low, Medium and High are (mute, -31dB, -10dB and -.8dB relative to the full amplitude the buzzer rated sound at 5Vp-p drive and ignoring the loss through the class B stage.
Buzzer Sounds
Each alarm level might have a Buzzers object which can be set for tone and with additional firmware play melodies which could combine in addition to the tone and duration the alarm levels as above.
Each alarm might be assigned a melody and an amplitude or a warble as described below.
Melody
An array of note frequency and durations of notes. An overall and constant level is set and applied to all notes.
Caution: The Melody firmware example from Arduino IDE are blocking.
More Elaborate Melody
An array of note frequency, amplitude and durations of notes. Amplitude is set note by note.
This would be an elaboration of the Melody example above.
Warbles
A signal note might be time modulated by changing amplitude of the Buzzer with out changing the tone. With complex enough firmware all four levels
The GPAD firmware could encapsulate and abstract Buzzer functions in objects perhaps as follows.
The GPAD buzzer system hardware is capable of making tone with the Arduino Tone command on two pins, the Tone pin on PB0 aka D8 and Attenuate pin PD4 aka D4 . . See the Arduino Tone documentation for frequency range and duration. https://www.arduino.cc/reference/en/language/functions/advanced-io/tone/
These tones can ONLY be steady state or with a time out and the Tone command is non blocking.
Buzzer Levels which parallel the alarm levels*.
Buzzer_Alarms can four Buzzer Levels {Off, Low, Medium, High}.
Notes on amplected estimates
Approximate weighting for Low, Medium and High are (0, 300/(300+1000+10000), 1000/(300+1000+10000) and 10000/(1000+10000) Approximate weighting for Low, Medium and High are (0, 300/(11300), 1000/(11300) and 10000/(11000) Approximate weighting for Low, Medium and High are (0, 3/(113), 10/(113) and 10/(11) Approximate weighting for Low, Medium and High are (mute, -31dB, -10dB and -.8dB relative to the full amplitude the buzzer rated sound at 5Vp-p drive and ignoring the loss through the class B stage.
Buzzer Sounds
Each alarm level might have a Buzzers object which can be set for tone and with additional firmware play melodies which could combine in addition to the tone and duration the alarm levels as above.
Each alarm might be assigned a melody and an amplitude or a warble as described below.
Melody
An array of note frequency and durations of notes. An overall and constant level is set and applied to all notes. Caution: The Melody firmware example from Arduino IDE are blocking.
More Elaborate Melody
An array of note frequency, amplitude and durations of notes. Amplitude is set note by note. This would be an elaboration of the Melody example above.
Warbles
A signal note might be time modulated by changing amplitude of the Buzzer with out changing the tone. With complex enough firmware all four levels
References
Referrer to the GPAD schematic for pins driving the Buzzer. https://github.com/PubInv/general-alarm-device/blob/main/Hardware/GeneralPurposeAlarmDevicePCB/PDF/Schematic-GeneralPurposeAlarmDevicePCB-V120220810.pdf See especialy page 1/6 and page 5/6
Firmware example for a blocking melody.
https://docs.arduino.cc/built-in-examples/digital/toneMelody
Lee's expanded Melody example covering several octaves. Caution, this code still blocks. https://github.com/ForrestErickson/toneMelody