from gpiozero.tones import Tone from gpiozero import TonalBuzzer import time b = TonalBuzzer(15) def bip(f,t): b.play(Tone(f)) time.sleep(t) b.stop()