Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/pysamples/sinewave.py
blob: a060f340c15d765566a413327a43357fddfceb06 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#Copyright (c) 2010-11, Tony Forster

# This procedure is invoked when the user-definable block on the
# "extras" palette is selected.

# Usage: Import this code into a Python (user-definable) block and
# pass a frequency in Hertz to the Python block. A tone will play over
# the speaker at the specified frequency.


def myblock(tw, args):
    ''' Plays a sound at frequency frequency '''

    import os
    frequency = args[0]
    os.system('speaker-test -t sine -l 1 -f %d' % (int(frequency)))