Popular recipes tagged "sound" but not "linux"http://code.activestate.com/recipes/tags/sound-linux/2015-10-22T18:24:08-07:00ActiveState Code RecipesUse 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>
A SOX 1KHz Sinewave Generator Using A Windows, (TM), Batch File... (Batch)
2013-05-02T17:48:18-07:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578516-a-sox-1khz-sinewave-generator-using-a-windows-tm-b/
<p style="color: grey">
Batch
recipe 578516
by <a href="/recipes/users/4177147/">Barry Walker</a>
(<a href="/recipes/tags/audio/">audio</a>, <a href="/recipes/tags/generator/">generator</a>, <a href="/recipes/tags/sound/">sound</a>, <a href="/recipes/tags/sound_exchange/">sound_exchange</a>, <a href="/recipes/tags/sox/">sox</a>, <a href="/recipes/tags/windows/">windows</a>).
</p>
<p>32 bit Windows to Windows 7...</p>
<p>This batch file generates a 65536 byte binary file to give 8 seconds of pure sinewave at the earphone/speaker output(s)...</p>
<p>It uses ONLY a default Windows 32 bit installation, to Windows 7, except for the installation of SOX...</p>
<p>Obtain SOX from here:-</p>
<p><a href="http://sox.sourceforge.net/" rel="nofollow">http://sox.sourceforge.net/</a></p>
<p>Notepad was the _main_ editor... ;o)</p>
<p>Hopefully the code section does NOT corrupt the binary part which is 8 bytes in size.
If it does then let me know on here and I will post a pointer from where to grab it...</p>
<p>Enjoy...</p>
Play a Sound File in Python using PyGame (Python)
2013-01-08T18:08:55-08:00Captain DeadBoneshttp://code.activestate.com/recipes/users/4184772/http://code.activestate.com/recipes/578410-play-a-sound-file-in-python-using-pygame/
<p style="color: grey">
Python
recipe 578410
by <a href="/recipes/users/4184772/">Captain DeadBones</a>
(<a href="/recipes/tags/pygame/">pygame</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/sound/">sound</a>).
</p>
<p>This is how you can play an ogg sound file in python using the pygame library. This is part of an article about <a href="http://thelivingpearl.com/2013/01/08/morse-code-and-dictionaries-in-python-with-sound/">Morse Code and Dictionaries in Python</a></p>
Samuel F. B. Morse's Code (Python)
2012-12-06T04:20:31-08:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/578364-samuel-f-b-morses-code/
<p style="color: grey">
Python
recipe 578364
by <a href="/recipes/users/2608421/">Stephen Chappell</a>
(<a href="/recipes/tags/code/">code</a>, <a href="/recipes/tags/demonstration/">demonstration</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>).
</p>
<p>Many people have heard of Morse['s] Code, and it still is a helpful skill to have in certain context, as advanced as technology has become. The following recipe shows two sample ways that it can be implemented and shows some diversity in how problems can be solved in Python or many other languages for that matter.</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>
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>
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>
Random Sound FX Using WAV File (Python)
2012-07-01T19:54:17-07:00FB36http://code.activestate.com/recipes/users/4172570/http://code.activestate.com/recipes/578180-random-sound-fx-using-wav-file/
<p style="color: grey">
Python
recipe 578180
by <a href="/recipes/users/4172570/">FB36</a>
(<a href="/recipes/tags/audio/">audio</a>, <a href="/recipes/tags/sound/">sound</a>).
</p>
<p>It generates random sound effects using AM and FM.</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>
For AMIGA-Heads Only. Generating An Audio Signal In Text Mode Python. (Python)
2011-11-30T21:23:20-08:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/577971-for-amiga-heads-only-generating-an-audio-signal-in/
<p style="color: grey">
Python
recipe 577971
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/demo/">demo</a>, <a href="/recipes/tags/e_uae/">e_uae</a>, <a href="/recipes/tags/sound/">sound</a>, <a href="/recipes/tags/winuae/">winuae</a>).
</p>
<p>This DEMO is not for the big guns. It is aimed at those who still use
a minimum of an ancient classic AMIGA A1200(HD), E-UAE, WinUAE, of which
there are still a lot of us about...</p>
<p>No comments about the use of "eval()" as Python Version 1.4.0 does not
have "int()" and this is designed to work on all versions of Python
available for the above platform. See the code for minimum requirements
and much more information.</p>
<p>MANY THANKS to Irmen de Jong for porting early versions of Python to
the classic AMIGA to give we lowly users a taste of what was/is to come.</p>
<p>This code will probably make the professionals cough a little, but, boy
what fun it is to see how powerful Python can be on an open platform
like the AMIGA.</p>
<p>Written in such a way that anyone can understand how it works...</p>
<p>I really don't care how you vote this as it is for those, including
professionals, who enjoy messing with AMIGA variants purely for fun and
relaxation, and, to......</p>
<p>Enjoy finding simple solutions to often VERY difficult problems... ;o)</p>
<p>Bazza, G0LCU...</p>
Sound in the STL (Python)
2011-08-15T09:28:12-07:00Russell Fosterhttp://code.activestate.com/recipes/users/4178972/http://code.activestate.com/recipes/577843-sound-in-the-stl/
<p style="color: grey">
Python
recipe 577843
by <a href="/recipes/users/4178972/">Russell Foster</a>
(<a href="/recipes/tags/audio/">audio</a>, <a href="/recipes/tags/game/">game</a>, <a href="/recipes/tags/sound/">sound</a>, <a href="/recipes/tags/stl/">stl</a>).
</p>
<p>I get to use a number of languages and have found Python lacks good sound implementation in it's STL. Sure you can download a module, but many organisations make it difficult to install add ons, and when you hand apps to people you don't want to have to say, first install python, then install x, y, z from these websites. The STL needs to have a module added in that handles sound cross platform. I have noticed people are happy with PyGame. Perhaps adding that to the STL would be good for everybody?</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>
Play 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>