Popular recipes tagged "scope" but not "script"http://code.activestate.com/recipes/tags/scope-script/2012-10-07T14:15:55-07:00ActiveState Code RecipesFor MacBook_Pro-Heads Only. Simple LF Audio Oscilloscope Using Standard Text Mode Python. (Python)
2012-10-07T14:15:55-07:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578282-for-macbook_pro-heads-only-simple-lf-audio-oscillo/
<p style="color: grey">
Python
recipe 578282
by <a href="/recipes/users/4177147/">Barry Walker</a>
(<a href="/recipes/tags/anim/">anim</a>, <a href="/recipes/tags/apple/">apple</a>, <a href="/recipes/tags/audio/">audio</a>, <a href="/recipes/tags/demo/">demo</a>, <a href="/recipes/tags/display/">display</a>, <a href="/recipes/tags/macbook_pro/">macbook_pro</a>, <a href="/recipes/tags/oscilloscope/">oscilloscope</a>, <a href="/recipes/tags/pyaudio/">pyaudio</a>, <a href="/recipes/tags/scope/">scope</a>, <a href="/recipes/tags/sound/">sound</a>).
</p>
<p>For MacBook_Pro-Heads Only. Simple LF Audio Oscilloscope Using Standard Text Mode Python.</p>
<p>SimpleScope_OSX.py</p>
<p>Do you remember this upload from myself on 26-06-2011...</p>
<p><a href="http://code.activestate.com/recipes/577771-simple-lf-audio-oscilloscope-using-standard-text-m/?in=user-4177147" rel="nofollow">http://code.activestate.com/recipes/577771-simple-lf-audio-oscilloscope-using-standard-text-m/?in=user-4177147</a></p>
<p>Well here is an August 2012 vintage MacBook Pro 13 inch version of it for OSX 10.7.5...</p>
<p>This is proof of concept code for a kids level project I am doing for a MacBook Pro, 13 inch, OSX 10.7.5.
A DEMO to show how to display a waveform using standard text mode Python.
"pyaudio" must be installed for this to work.
Levels are set using the standard audio mixers, (System Preferences -> Sound).</p>
<p>Just whistle a signal of say 300Hz to 3KHz, (normal voice spectrum), using say, the internal mic, and watch a waveform appear inside the X-Y graticule.</p>
<p>Read the code for more information.</p>
<p>$VER: SimpleScope_OSX.py_Version_0.00.10_(C)2012_B.Walker_G0LCU.</p>
<p>This code is GPL2, but, the hardware information is Public Domain.</p>
<p>(I am looking into including Windows and Linux variants too using pyaudio to access the sound system.)</p>
<p>Enjoy finding simple solutions to often very difficult problems.</p>
<p>Bazza, G0LCU...</p>
Simple LF Audio Oscilloscope Using Standard Text Mode Python. (Python)
2011-06-26T21:42:55-07:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/577771-simple-lf-audio-oscilloscope-using-standard-text-m/
<p style="color: grey">
Python
recipe 577771
by <a href="/recipes/users/4177147/">Barry Walker</a>
(<a href="/recipes/tags/anim/">anim</a>, <a href="/recipes/tags/audio/">audio</a>, <a href="/recipes/tags/demo/">demo</a>, <a href="/recipes/tags/display/">display</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/oscilloscope/">oscilloscope</a>, <a href="/recipes/tags/scope/">scope</a>, <a href="/recipes/tags/sound/">sound</a>).
</p>
<p>A Linux DEMO to show how to display a waveform using standard text mode Python.
The audio device /dev/dsp is used and must be available. Levels are set using the
standard audio mixers.</p>
<p>Just feed a signal of say 300Hz to 3KHz, (normal voice spectrum), using say, the
internal mic, and watch the waveform appear inside the X-Y graticule.</p>
<p>This method WILL be used for a program proper and may be uploaded to this site
in the future.</p>
<p>Read the code for more information.</p>
<p>This code is Public Domain and you may do with it as you please.</p>
<p>Enjoy finding simple solutions to often very difficult problems.</p>
Decorator to expose local variables of a function after execution (Python)
2010-07-07T22:01:23-07:00Pietro Berkeshttp://code.activestate.com/recipes/users/4174299/http://code.activestate.com/recipes/577283-decorator-to-expose-local-variables-of-a-function-/
<p style="color: grey">
Python
recipe 577283
by <a href="/recipes/users/4174299/">Pietro Berkes</a>
(<a href="/recipes/tags/decorator/">decorator</a>, <a href="/recipes/tags/function/">function</a>, <a href="/recipes/tags/inner/">inner</a>, <a href="/recipes/tags/local/">local</a>, <a href="/recipes/tags/scope/">scope</a>, <a href="/recipes/tags/variables/">variables</a>).
Revision 2.
</p>
<p>Decorator to expose the local variables defined in the inner scope of a function. At the exit of the decorated function (regular exit or exceptions), the local dictionary is copied to a read-only property, <code>locals</code>.</p>
<p>The main implementation is based on injecting bytecode into the original function, and requires the lightweight module <code>byteplay</code> (available <a href="http://code.google.com/p/byteplay/">here</a>). See below for an alternative implementation that only uses the standard library.</p>
Simple LF Audio Oscilloscope Using Standard Python. (Python)
2011-04-07T17:17:57-07:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/577644-simple-lf-audio-oscilloscope-using-standard-python/
<p style="color: grey">
Python
recipe 577644
by <a href="/recipes/users/4177147/">Barry Walker</a>
(<a href="/recipes/tags/anim/">anim</a>, <a href="/recipes/tags/audio/">audio</a>, <a href="/recipes/tags/demo/">demo</a>, <a href="/recipes/tags/display/">display</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/oscilloscope/">oscilloscope</a>, <a href="/recipes/tags/scope/">scope</a>, <a href="/recipes/tags/sound/">sound</a>).
</p>
<p>AudioScope.py</p>
<p>I think this might be a first for both Python.</p>
<p>Initially uploaded to LXF, now also here under the MIT licence.</p>
<p>I am building a kids level seismometer and wanted to use standard Python inside Linux.</p>
<p>This DEMO code was my starter idea and looks as though using standard ASCII only might just work a real treat.</p>
<p>I've issued it to LXF under the MIT licence for future reasons.</p>
<p>It doesn't look much on screen except that the waveform(s) shown is/are a basic visual, electrical representation
of your voice. ;o)</p>
<p>It is possible to link the earphone socket on this notebook to the mic input and start the Audio Function
Generator, elsewhere in this site, in a separate Python terminal and see those waveforms inside the
AudioScope.py`s own Python terminal.</p>
<p>This grabs a 1 second 8KB burst, and then displays it onto the Python terminal. The timebase, amplitude, trigger,
single shot and others are not included but the main grab and display using /dev/dsp is shown. This can be made
platform independent by changing the /dev/dsp to something external like the Arduino Dev Board. This uses
STANDARD Python 2.5.x and later and tested on PCLinuxOS 2009 and Debian 6.0.0.</p>
<p>Enjoy finding simple solutions to often very difficult problems.</p>
<p>Bazza, G0LCU.</p>
Decorator to expose local variables of a function after execution [alternative implementation] (Python)
2010-07-08T09:44:28-07:00Andrea Maffezzolihttp://code.activestate.com/recipes/users/4171157/http://code.activestate.com/recipes/577295-decorator-to-expose-local-variables-of-a-function-/
<p style="color: grey">
Python
recipe 577295
by <a href="/recipes/users/4171157/">Andrea Maffezzoli</a>
(<a href="/recipes/tags/decorator/">decorator</a>, <a href="/recipes/tags/function/">function</a>, <a href="/recipes/tags/inner/">inner</a>, <a href="/recipes/tags/local/">local</a>, <a href="/recipes/tags/scope/">scope</a>, <a href="/recipes/tags/variables/">variables</a>).
Revision 6.
</p>
<p>Please note that the present is a fork of the <a href="http://code.activestate.com/recipes/577283/">recipe 577283</a> "Decorator to expose local variables of a function after execution" of Pietro Berkes, available at <a href="http://code.activestate.com/recipes/577283-decorator-to-expose-local-variables-of-a-function-/" rel="nofollow">http://code.activestate.com/recipes/577283-decorator-to-expose-local-variables-of-a-function-/</a> , and aiming only to report the alternative implementation "persistent_locals2", whose I'm co-author with Pietro Berkes, and which was submitted together to the original recipe. Refer to the latter for an exhaustive description and discussion.</p>