Changes

Line 197: Line 197:  
The following code is now a built in sample <i>sinewave.py</i>.  
 
The following code is now a built in sample <i>sinewave.py</i>.  
   −
[[File:2tone python.jpg]]
+
def myblock(lc, x):
 +
    import os
 +
    os.system('speaker-test -t sine -l 1 -f %d' % (int(x)))
 +
 
    
How it works: the 1000 and 1100 blocks are input x in the Python code. The -f option in speaker-test is the frequency, {0} gets replaced by x which in turn is replaced by 1000 or 1100 so speaker-test is sent either -f 1000 or -f 1100 giving frequencies of 1000 Hz or 1100 Hz.
 
How it works: the 1000 and 1100 blocks are input x in the Python code. The -f option in speaker-test is the frequency, {0} gets replaced by x which in turn is replaced by 1000 or 1100 so speaker-test is sent either -f 1000 or -f 1100 giving frequencies of 1000 Hz or 1100 Hz.
2,486

edits