posts:gstreamer:beep: use argparse default values for frequency.
authorW. Trevor King <wking@tremily.us>
Fri, 14 Sep 2012 16:32:56 +0000 (12:32 -0400)
committerW. Trevor King <wking@tremily.us>
Fri, 14 Sep 2012 16:32:56 +0000 (12:32 -0400)
posts/GStreamer/beep.py

index 55ecf63cf4ad357c010112e1f7cc067a537c0142..50bb305e3b0f3ee4d498003468ff1874fcac7f92 100755 (executable)
@@ -31,14 +31,11 @@ if __name__ == '__main__':
 
     parser = argparse.ArgumentParser(description='Play a pure tone')
     parser.add_argument(
-        '-f', '--frequency', type=float, help='tone frequency in Hz')
+        '-f', '--frequency', type=float, default=440,
+        help='tone frequency in Hz')
 
     args = parser.parse_args()
 
-    frequency = 440
-    if args.frequency:
-        frequency = args.frequency
-
-    start=Beep(frequency=frequency)
+    start=Beep(frequency=args.frequency)
     while True:
         time.sleep(10)