Most viewed recipes tagged "sound"http://code.activestate.com/recipes/tags/sound/views/2015-10-22T18:24:08-07:00ActiveState Code RecipesPlay sound files with pygame in a cross-platform manner (Python)
2007-06-21T14:16:58-07:00Chris Arndthttp://code.activestate.com/recipes/users/1499228/http://code.activestate.com/recipes/521884-play-sound-files-with-pygame-in-a-cross-platform-m/
<p style="color: grey">
Python
recipe 521884
by <a href="/recipes/users/1499228/">Chris Arndt</a>
(<a href="/recipes/tags/multimedia/">multimedia</a>, <a href="/recipes/tags/pygame/">pygame</a>, <a href="/recipes/tags/sound/">sound</a>, <a href="/recipes/tags/sysadmin/">sysadmin</a>).
Revision 4.
</p>
<p>This simple script shows how to play back a sound file using the mixer module from the pygame library. If you have pygame installed, this will work on all major platforms. The mixer module supports WAV and OGG files with many different sample rates, bits per sample and channels. The script will play back all supported files given on the command line sequentially.</p>
Use PyAudio to play a list of WAV files (Python)
2015-10-22T18:24:08-07:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/579116-use-pyaudio-to-play-a-list-of-wav-files/
<p style="color: grey">
Python
recipe 579116
by <a href="/recipes/users/4173351/">Vasudev Ram</a>
(<a href="/recipes/tags/audio/">audio</a>, <a href="/recipes/tags/music/">music</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/python2/">python2</a>, <a href="/recipes/tags/sound/">sound</a>).
</p>
<p>This recipe shows how to use PyAudio, a 3rd-party Python audio toolkit, to play a list of WAV files on your computer. This is an enhanced version of a basic WAV code example on the PyAudio site. You can specify either one WAV filename on the command line, like this:</p>
<p>py pyaudio_play_wav.py chimes.wav</p>
<p>or specify a text file containing names of WAV files to play, like this:</p>
<p>py pyaudio_play_wav.py -f wav_fil_list.txt</p>
<p>The only dependency is PyAudio, which you can install with pip.</p>
Simple White Noise Generator Using Standard Python In Linux. (Python)
2011-03-10T18:03:55-08:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/577604-simple-white-noise-generator-using-standard-python/
<p style="color: grey">
Python
recipe 577604
by <a href="/recipes/users/4177147/">Barry Walker</a>
(<a href="/recipes/tags/audio/">audio</a>, <a href="/recipes/tags/demo/">demo</a>, <a href="/recipes/tags/generator/">generator</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/noise/">noise</a>, <a href="/recipes/tags/program/">program</a>, <a href="/recipes/tags/signal/">signal</a>, <a href="/recipes/tags/sound/">sound</a>, <a href="/recipes/tags/source/">source</a>).
</p>
<p>Simple White Noise Generator Using Standard Python In Linux - noise.py</p>
<p>This code is a stand alone program to generate a signal, at the earphone sockets, of white noise.</p>
<p>It needs /dev/dsp to work; if you haven't got it then install oss-compat from your distro's repository.
(NOTE:- /dev/audio could also be used but I decided to use /dev/dsp to show that this was within easy
reach of standard Python too.)</p>
<p>Ensure the audio system is NOT in use for this to work and all the levels are set up for your normal requirements.
In my case root level WAS NOT required but that does not mean that root level IS NOT required - so be aware.</p>
<p>All that is required to make this a piece of audio test equipment is a cable plugged into to the earphone
socket. The output level is fully controllable inside the code and the noise is generated in about 10 second
bursts</p>
<p>Assuming it is copied into the module(s) drawer just type:-</p>
<pre class="prettyprint"><code>>>> import noise[RETURN/ENTER]
</code></pre>
<p>And away you go...</p>
<p>This is Public Domain and you may do with it as you like.</p>
<p>Read the program for more information.
(There will be more to come in the future... :)</p>
<p>Enjoy finding simple solutions to often very difficult problems... ;o)</p>
<p>73...</p>
<p>Bazza, G0LCU...</p>
<p>Team AMIGA...</p>
Simple 1KHz Audio Function Generator Using Standard Python In Linux... (Python)
2011-03-01T19:37:16-08:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/577592-simple-1khz-audio-function-generator-using-standar/
<p style="color: grey">
Python
recipe 577592
by <a href="/recipes/users/4177147/">Barry Walker</a>
(<a href="/recipes/tags/audio/">audio</a>, <a href="/recipes/tags/demo/">demo</a>, <a href="/recipes/tags/function/">function</a>, <a href="/recipes/tags/generator/">generator</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/program/">program</a>, <a href="/recipes/tags/signal/">signal</a>, <a href="/recipes/tags/sound/">sound</a>, <a href="/recipes/tags/source/">source</a>).
</p>
<h5 id="simple-1khz-audio-function-generator-using-standard-python-in-linux-afgpy">Simple 1KHz Audio Function Generator Using Standard Python In Linux - afg.py</h5>
<p>This code is a stand alone program to generate a signal, at the earphone sockets, of 1KHz.
It is a basic audio signal generator and can be used as a starter test signal source for amateur electronics
enthusiasts testgear suite(s).</p>
<p>It needs /dev/audio to work; if you haven't got it then install oss-compat from your distro's repository.</p>
<p>Ensure the audio system is NOT in use for this to work.</p>
<p>Sine, Square, Triangle, Sawtooth+, Sawtooth-, Pulse+ and Pulse- signals are generated in 10 second bursts.
The waveforms generated are unfiltered and therefore not "pure", but hey, an audio function generator
signal source, for free, without external hardware, AND, using standard Python, what more do you want... :)
An oscilloscope will show the waveforms generated at the earphone socket.</p>
<p>Noise is not included but that is SO easy that I left it out FTTB.
(This will be a future upload. ;o)</p>
<p>All that is required to make this a piece of audio test equipment is a cable plugged into to the earphone
socket.</p>
<p>Assuming it is copied into the module(s) drawer just type:-</p>
<pre class="prettyprint"><code>>>> import afg[RETURN/ENTER]
</code></pre>
<p>And away you go...</p>
<p>This is Public Domain and you may do with it as you like.</p>
<p>Read the program for more information.
(There will be more to come in the future... :)</p>
Sound Generator Using WAV file (Python)
2012-06-19T00:41:22-07:00FB36http://code.activestate.com/recipes/users/4172570/http://code.activestate.com/recipes/578168-sound-generator-using-wav-file/
<p style="color: grey">
Python
recipe 578168
by <a href="/recipes/users/4172570/">FB36</a>
(<a href="/recipes/tags/audio/">audio</a>, <a href="/recipes/tags/sound/">sound</a>).
</p>
<p>This is an example for generating sound using wave files.
It is equivalent to:</p>
<p>from winsound import Beep</p>
<p>Beep(freq, duration * 1000)</p>
<p>But of course wave files can also be used to generate any other kinds of sounds. </p>
Clear screen and beep for various platforms. (Python)
2011-02-26T14:26:02-08:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/577588-clear-screen-and-beep-for-various-platforms/
<p style="color: grey">
Python
recipe 577588
by <a href="/recipes/users/4177147/">Barry Walker</a>
(<a href="/recipes/tags/amiga/">amiga</a>, <a href="/recipes/tags/audio/">audio</a>, <a href="/recipes/tags/beep/">beep</a>, <a href="/recipes/tags/clearscreen/">clearscreen</a>, <a href="/recipes/tags/display/">display</a>, <a href="/recipes/tags/error_beep/">error_beep</a>, <a href="/recipes/tags/error_sound/">error_sound</a>, <a href="/recipes/tags/e_uae/">e_uae</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/screenclear/">screenclear</a>, <a href="/recipes/tags/sound/">sound</a>, <a href="/recipes/tags/windows/">windows</a>, <a href="/recipes/tags/winuae/">winuae</a>).
</p>
<p>This little module gives a clear screen and beep for the classic AMIGA, WinUAE, Windows and Linux all in
CLI/Command-Prompt/Terminal mode.</p>
<p>It works from Python 1.4.x to 2.7.x; talk about backwards compatibility... ;oD
With very little modification it will work on Python 3.x.x easily.)</p>
<p>See the file clsbeep.py attached for more information.</p>
<p>it is saved as clsbeep.py and placed into the Python - Lib drawer or where-ever the modules are located
and called as a module:-</p>
<pre class="prettyprint"><code>>>> import clsbeep
</code></pre>
<p>Its usage is:-</p>
<p>clsbeep.cls() and clears the screen.
clsbeep.beep() and creates an error beep.
clsbeep.both() creates an error beep first then clears the screen.</p>
<p>It is Public Domain and if you modify it to suit other platforms please let me have a copy of your code... :)</p>
<p>Enjoy finding simple solutions to often very difficult problems. ;o)</p>
Record and Playbac using standard Python. (Python)
2011-02-25T19:33:59-08:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/577587-record-and-playbac-using-standard-python/
<p style="color: grey">
Python
recipe 577587
by <a href="/recipes/users/4177147/">Barry Walker</a>
(<a href="/recipes/tags/audio/">audio</a>, <a href="/recipes/tags/demo/">demo</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/playback/">playback</a>, <a href="/recipes/tags/record/">record</a>, <a href="/recipes/tags/sound/">sound</a>).
</p>
<p>This very simple DEMO code records a few seconds of your voice from a microphone, (internal mic' on a laptop), and
replays your voice immedaiately after recording. It goes without saying that the RAW recording can be saved in
any extension of your choice and used as error reporting using the playback method.</p>
<p>There is the possibility of using it as a simple means of a single channel audio oscilloscope using the external
mic input and suitable Python GUI or with simple home built HW a seismometer recorder, plus other ideas.</p>
<p>Enjoy finding simple solutions to often very difficult problems...</p>
<p>Read the code for more information...</p>
<p>73...</p>
<p>Bazza, G0LCU...</p>
<p>Team AMIGA...</p>
Countdown Timer (Python)
2012-12-06T03:24:35-08:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/578363-countdown-timer/
<p style="color: grey">
Python
recipe 578363
by <a href="/recipes/users/2608421/">Stephen Chappell</a>
(<a href="/recipes/tags/demonstration/">demonstration</a>, <a href="/recipes/tags/sound/">sound</a>, <a href="/recipes/tags/timer/">timer</a>, <a href="/recipes/tags/utility/">utility</a>).
</p>
<p>Ever wanted to set a timer that went off after a specified number of hours / minutes / seconds? This Windows recipe runs on the command line and does that with the arguments it accepts. Simple but effective, the program works well for remembering food in the oven among other things.</p>
Platform Independent 1KHz Pure Audio Sinewave Generator... (Python)
2012-10-23T12:53:37-07:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578301-platform-independent-1khz-pure-audio-sinewave-gene/
<p style="color: grey">
Python
recipe 578301
by <a href="/recipes/users/4177147/">Barry Walker</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/generator/">generator</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/macbook_pro/">macbook_pro</a>, <a href="/recipes/tags/program/">program</a>, <a href="/recipes/tags/pyaudio/">pyaudio</a>, <a href="/recipes/tags/signal/">signal</a>, <a href="/recipes/tags/sinewave/">sinewave</a>, <a href="/recipes/tags/sound/">sound</a>, <a href="/recipes/tags/source/">source</a>, <a href="/recipes/tags/windows/">windows</a>).
Revision 2.
</p>
<p>IKHz_SW_OSX.py</p>
<p>A mono _pure_ sinewave generator using standard text mode Python 2.6.7 to at least 2.7.3.</p>
<p>This DEMO kids level 1KHz generator is mainly for a MacBook Pro, (13 inch in my case),
OSX 10.7.5 and above. See below...</p>
<p>It is another simple piece of testgear for the young amateur electronics enthusiast and
uses pyaudio fully installed for it to work.</p>
<p>PyAudio can be obtained from here:- <a href="http://people.csail.mit.edu/hubert/pyaudio/" rel="nofollow">http://people.csail.mit.edu/hubert/pyaudio/</a></p>
<p>This was primarily for a MacBook Pro, but works on at least 2 Linux flavours and Windows Vista 32 bit...</p>
<p>The sinewave generated is near excellent...</p>
<p>Enjoy finding simple solutions to often very difficult problems... Bazza, G0LCU...</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>
Morse Code (Python)
2012-01-12T23:45:12-08:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/578012-morse-code/
<p style="color: grey">
Python
recipe 578012
by <a href="/recipes/users/2608421/">Stephen Chappell</a>
(<a href="/recipes/tags/demo/">demo</a>, <a href="/recipes/tags/demonstration/">demonstration</a>, <a href="/recipes/tags/example/">example</a>, <a href="/recipes/tags/experiment/">experiment</a>, <a href="/recipes/tags/morse/">morse</a>, <a href="/recipes/tags/morse_code/">morse_code</a>, <a href="/recipes/tags/program/">program</a>, <a href="/recipes/tags/sound/">sound</a>).
Revision 3.
</p>
<p>After seeing another recipe recently that helps people with Morse Code, I was inspired to clean up the following code just a bit to make it worthy for the rest of the world. After being executed, it waits for lines of text to be entered, compiles each one in turn into timing codes, and plays them back with a simple execution</p>
Platform Independent White Noise Generator... (Python)
2012-11-25T10:10:45-08:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578350-platform-independent-white-noise-generator/
<p style="color: grey">
Python
recipe 578350
by <a href="/recipes/users/4177147/">Barry Walker</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/generator/">generator</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/macbook_pro/">macbook_pro</a>, <a href="/recipes/tags/noise/">noise</a>, <a href="/recipes/tags/program/">program</a>, <a href="/recipes/tags/pyaudio/">pyaudio</a>, <a href="/recipes/tags/signal/">signal</a>, <a href="/recipes/tags/sound/">sound</a>, <a href="/recipes/tags/source/">source</a>, <a href="/recipes/tags/windows/">windows</a>).
</p>
<p>This code is a derivative of the Pure Sinewave Generator and produces a continuous noise out of the speakers or headphone sockets.</p>
<p>It is for the hobbyist to be able to generate a pseudo-random noise signal for testing with.</p>
<p>It is issued as Public Domian and you may do with it as you please.</p>
<p>It is very easy to convert to Python 3.x.x but as OSX only has 2.7.x and lower ATM then these are what are used...</p>
<p>An installation of pyaudio IS needed for this to work; see the code for more information.</p>
<p>It is near platform independent but sadly the AMIGA is not included, but hey, I have already shown how generate sound for Classic AMIGAs.</p>
<p>Enjoy finding simple solutions to often very difficult problems...</p>
<p>Bazza, G0LCU...</p>
Metronome For Beginner Musicians... (Python)
2012-05-18T19:30:04-07:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578139-metronome-for-beginner-musicians/
<p style="color: grey">
Python
recipe 578139
by <a href="/recipes/users/4177147/">Barry Walker</a>
(<a href="/recipes/tags/audio/">audio</a>, <a href="/recipes/tags/demo/">demo</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/metronome/">metronome</a>, <a href="/recipes/tags/music_accessory/">music_accessory</a>, <a href="/recipes/tags/sound/">sound</a>).
Revision 2.
</p>
<p>This DEMO code is a simple metronome for the Linux platform. It is for newcomers to playing musical instruments as a timing unit for practicing with.</p>
<p>It is issued as Public Domain and you may do with it as you please...</p>
<p>The device /dev/dsp IS required for this to work. If your machine lacks this then install oss-compat from you distro's repository.</p>
<p>It exploits a flaw in the default /dev/dsp device inside linux...</p>
<p>The part of the code the uses Ctrl-C to exit a loop has a flaw. This is not a bug. I will let the big guns explain what is happening if they want to in the comments section.</p>
<p>Enjoy finding simple solutions to often very difficult pronblems...</p>
<p>Bazza, G0LCU...</p>
Simple Morse Code Generator And Tutor. (Python)
2012-01-09T22:51:12-08:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578009-simple-morse-code-generator-and-tutor/
<p style="color: grey">
Python
recipe 578009
by <a href="/recipes/users/4177147/">Barry Walker</a>
(<a href="/recipes/tags/audio/">audio</a>, <a href="/recipes/tags/code/">code</a>, <a href="/recipes/tags/demo/">demo</a>, <a href="/recipes/tags/generator/">generator</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/morse/">morse</a>, <a href="/recipes/tags/morse_code/">morse_code</a>, <a href="/recipes/tags/sound/">sound</a>).
Revision 2.
</p>
<p>This is not for the big guns, but for the Amateur coder AND radio enthusiast.</p>
<p>It is a DEMO Morse Code Generator and tutor that will generate the tones required for
the original standard letters A to Z and numbers 0 to 9. Puctuation is NOT included but
hey it is SOOOO simple to modify the code that I will let you, (the ones interested),
do that for yourselves... ;o)
Read the code for more informaton.</p>
<p>It is for at least standard text mode Python 2.5.2 to 2.7.2 using PCLinuxOS 2009 and
Debian 6.0.0. It may well work at a much earlier version. I do have a version for
Python 3.x.x but that will be uploaded elsewhere.</p>
<p>As it stands it _sends_ at around 8 WPM, (Words Per Minute).</p>
<p>It is written in such a way that youngsters can understand what is going on.</p>
<p>Enjoy finding simple solutions to often very difficult problems... ;o)</p>
<p>Bazza, G0LCU...</p>
A Function To Create A 1 Second Sinewave WAVE Beep File. (Python)
2014-11-23T19:24:46-08:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578971-a-function-to-create-a-1-second-sinewave-wave-beep/
<p style="color: grey">
Python
recipe 578971
by <a href="/recipes/users/4177147/">Barry Walker</a>
(<a href="/recipes/tags/amiga/">amiga</a>, <a href="/recipes/tags/apple/">apple</a>, <a href="/recipes/tags/audio/">audio</a>, <a href="/recipes/tags/beep/">beep</a>, <a href="/recipes/tags/error_beep/">error_beep</a>, <a href="/recipes/tags/error_sound/">error_sound</a>, <a href="/recipes/tags/e_uae/">e_uae</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/sinewave/">sinewave</a>, <a href="/recipes/tags/sound/">sound</a>, <a href="/recipes/tags/wav/">wav</a>, <a href="/recipes/tags/wave/">wave</a>, <a href="/recipes/tags/windows/">windows</a>, <a href="/recipes/tags/winuae/">winuae</a>).
</p>
<p>sinebeep.py</p>
<p>Creating an audio file called...</p>
<p>beep.wav</p>
<p>...that can be played using almost ANY audio player available.</p>
<p>This simple snippet of code generates a 1 second sinewave WAVE file.
It IS saved inside the CURRENT drawer so that you can find it... ;o)</p>
<p>This works on:-
Classic stock AMIGA A1200, using Python 1.4.0.
WinUAE and E-UAE, AmigaOS 3.0.x using Python 1.4.0 to 2.0.1.
Windows, to at least 7, using Python 2.0.1 to 3.3.2.
Various Linux flavours using Python 2.4.6 to 3.2.2.
Apple OSX 10.7.x and above using Python 2.5.6 to 3.4.1.</p>
<p>The file size is 8044 bytes and _IF_ you need to it can be palyed directly
without a player on some Linux flavours that have the /dev/dsp device.
It is an 8 bit, unsigned integer, mono, 8000Hz sampling speed 8000 byte
RAW file with the WAVE header added.</p>
<p>It will still work with PulseAudio and OSS using...</p>
<p>cat /full/path/to/beep.wav > /dev/dsp</p>
<p>...but with a momenatry click due to the 44 header bytes; but hey it is
a beep alternative...</p>
<p>Enjoy finding simple solutions to often very difficult problems.</p>
<p>Bazza.</p>
Amplitude Modulation - Tremolo, Was:- An Audio/Sound Snippet For Linux... ;o) (Python)
2012-01-21T14:18:28-08:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578013-amplitude-modulation-tremolo-was-an-audiosound-sni/
<p style="color: grey">
Python
recipe 578013
by <a href="/recipes/users/4177147/">Barry Walker</a>
(<a href="/recipes/tags/amplitude/">amplitude</a>, <a href="/recipes/tags/audio/">audio</a>, <a href="/recipes/tags/demo/">demo</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/mod/">mod</a>, <a href="/recipes/tags/modulation/">modulation</a>, <a href="/recipes/tags/sound/">sound</a>, <a href="/recipes/tags/tremolo/">tremolo</a>).
Revision 2.
</p>
<p>This IS for the big guns as well as the amatuer...</p>
<p>I am always being told that too many comments inside any code is bad and that professional coders are clever enough to work out what a program does without comments...</p>
<p>So here goes! This snippet of code hits /dev/dsp in Linux and has no comments as to what it does.
Make sure that /dev/dsp is available in your Linux install - if not then install oss.compat from your repository.</p>
<p>It needs Python 2.6 minimum, but may well work on a much earlier version</p>
<p>Don't run the code first but have a go at working out what it does and see if you are correct... ;o)</p>
<p>You can email me if you think you are/were correct:- <a href="http://wisecracker_at_tesco.net" rel="nofollow">wisecracker_at_tesco.net</a></p>
<p>Bear in mind I don't think this has ever been done before by hitting the /dev/dsp __directly__.</p>
<p>NOTE:- NO imports are required at all!!!</p>
<p>It runs for about 7 seconds before exiting...</p>
<p>Another BIG PLUS for Linux.</p>
<p>(I have a feeling poeple on here might like this, possibly even vote it up. ;)</p>
<p>Answer now at the bottom of this page...</p>
<p>Enjoy...</p>
<p>Bazza, G0LCU...</p>
Launch virtualbox with emulated USB microphones (Python)
2010-12-14T14:53:07-08:00Joseph Reaglehttp://code.activestate.com/recipes/users/4171494/http://code.activestate.com/recipes/577467-launch-virtualbox-with-emulated-usb-microphones/
<p style="color: grey">
Python
recipe 577467
by <a href="/recipes/users/4171494/">Joseph Reagle</a>
(<a href="/recipes/tags/sound/">sound</a>, <a href="/recipes/tags/virtualbox/">virtualbox</a>).
Revision 4.
</p>
<p>A small Python script that sets sound emulation variables for a particular USB microphone that you want to use, and sets the microphone volume level, since that is often set at zero in the Linux context.</p>
For 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 Morse Code Practice Oscillator. (Python)
2012-01-09T22:49:05-08:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578010-simple-morse-code-practice-oscillator/
<p style="color: grey">
Python
recipe 578010
by <a href="/recipes/users/4177147/">Barry Walker</a>
(<a href="/recipes/tags/audio/">audio</a>, <a href="/recipes/tags/code/">code</a>, <a href="/recipes/tags/demo/">demo</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/morse/">morse</a>, <a href="/recipes/tags/morse_code/">morse_code</a>, <a href="/recipes/tags/morse_practice_oscillator/">morse_practice_oscillator</a>, <a href="/recipes/tags/sound/">sound</a>).
Revision 2.
</p>
<p>This is not for the big guns, but for the Amateur coder AND radio enthusiast.</p>
<p>It is a DEMO Morse Code Practice Oscillator that will allow the user to practice
sending Morse code using the "o" and "p" keys as a PSEUDO-paddle key. It is set to
around 8 WPM, (Words Per Minute). The code allows "O" and "P" to be used at around
12 WPM, when "Caps Lock" is turned on. Read the code for more informtion.</p>
<p>It is for at least standard text mode Python 2.5.2 to 2.7.2 using PCLinuxOS 2009 and
Debian 6.0.0. It may well work at a much earlier version. I do have a version for
Python 3.x.x but that will be uploaded elsewhere.</p>
<p>It is written in such a way that youngsters can understand what is going on.</p>
<p>Enjoy finding simple solutions to often very difficult problems... ;o)</p>
<p>Bazza, G0LCU...</p>
Yet Another Python Generator... (Python)
2011-12-19T08:14:55-08:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/577990-yet-another-python-generator/
<p style="color: grey">
Python
recipe 577990
by <a href="/recipes/users/4177147/">Barry Walker</a>
(<a href="/recipes/tags/audio/">audio</a>, <a href="/recipes/tags/demo/">demo</a>, <a href="/recipes/tags/generator/">generator</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/signal/">signal</a>, <a href="/recipes/tags/sound/">sound</a>, <a href="/recipes/tags/source/">source</a>, <a href="/recipes/tags/sweep/">sweep</a>).
</p>
<p>Aha, but not what big guns were expecting...</p>
<p>LF Audio Sweep Generator.</p>
<p>Another kids level project to do for yourselves...</p>
<p>This is a Python DEMO to show the power of the sound card using Linux to
generate an Audio Sweep Signal from 4KHz down to 100Hz and back again.</p>
<p>Written in such a way that anyone can understand how it works...
This is for Linux and Python 2.x.x. Read the code for much more information, and......
A Python 3.x.x version is here:-</p>
<p><a href="http://www.linuxformat.com/forums/viewtopic.php?t=14411" rel="nofollow">http://www.linuxformat.com/forums/viewtopic.php?t=14411</a></p>
<p>Enjoy finding simple solutions to often VERY difficult problems...</p>
<p>Bazza, G0LCU...</p>