Most viewed recipes tagged "audio"http://code.activestate.com/recipes/tags/audio/views/2016-12-30T19:06:32-08:00ActiveState Code RecipesSimple audio with ctypes and SDL also for Tkinter (Python) 2015-08-17T18:54:17-07:00Jiri Justrahttp://code.activestate.com/recipes/users/4192188/http://code.activestate.com/recipes/579070-simple-audio-with-ctypes-and-sdl-also-for-tkinter/ <p style="color: grey"> Python recipe 579070 by <a href="/recipes/users/4192188/">Jiri Justra</a> (<a href="/recipes/tags/audio/">audio</a>, <a href="/recipes/tags/sdl/">sdl</a>, <a href="/recipes/tags/sdl_mixer/">sdl_mixer</a>, <a href="/recipes/tags/tkinter/">tkinter</a>). Revision 3. </p> <p>I've needed just to play audio in my Tkinter application, but it seems there is no easy way to do this, so I have made this simple code. It is small ctypes wrapper around SDL_mixer.</p> <p>It should work for Win and *nix also .. I've tested it on ubuntu-14.04.3-desktop-i386</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>&gt;&gt;&gt; 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>&gt;&gt;&gt; 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> A command-line musical alarm clock (Python) 2016-12-30T19:06:32-08:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/580739-a-command-line-musical-alarm-clock/ <p style="color: grey"> Python recipe 580739 by <a href="/recipes/users/4173351/">Vasudev Ram</a> (<a href="/recipes/tags/alarm/">alarm</a>, <a href="/recipes/tags/audio/">audio</a>, <a href="/recipes/tags/clock/">clock</a>, <a href="/recipes/tags/multimedia/">multimedia</a>, <a href="/recipes/tags/music/">music</a>, <a href="/recipes/tags/playsound/">playsound</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/time/">time</a>, <a href="/recipes/tags/utilities/">utilities</a>, <a href="/recipes/tags/utility/">utility</a>). </p> <p>This is a simple musical alarm clock in Python. You pass a command-line argument specifying the time in minutes after which the alarm should go off. When that time arrives, it plays a musical sound.</p> How to stream an mp3 file using vlc.py, with a simple TKinter GUI. (Python) 2013-06-09T12:52:30-07:00Anton Vredegoorhttp://code.activestate.com/recipes/users/2667360/http://code.activestate.com/recipes/578556-how-to-stream-an-mp3-file-using-vlcpy-with-a-simpl/ <p style="color: grey"> Python recipe 578556 by <a href="/recipes/users/2667360/">Anton Vredegoor</a> (<a href="/recipes/tags/audio/">audio</a>, <a href="/recipes/tags/streaming/">streaming</a>, <a href="/recipes/tags/tkinter/">tkinter</a>, <a href="/recipes/tags/vlc/">vlc</a>). </p> <p>This script can be used to stream an existing mp3 file to multiple computers. It has a simple Tkinter GUI with only one button to start/stop the stream, and a slider to indicate or change the position.</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>&gt;&gt;&gt; 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> Using vlc.py to record an mp3 and save a cue file (Python) 2011-07-25T15:55:38-07:00Anton Vredegoorhttp://code.activestate.com/recipes/users/2667360/http://code.activestate.com/recipes/577802-using-vlcpy-to-record-an-mp3-and-save-a-cue-file/ <p style="color: grey"> Python recipe 577802 by <a href="/recipes/users/2667360/">Anton Vredegoor</a> (<a href="/recipes/tags/audio/">audio</a>, <a href="/recipes/tags/recording/">recording</a>). Revision 2. </p> <p>This is an example of how to use vlc.py . It records an mp3 file from an online audio stream, using the track announcements to write an accompanying cue file. </p> Simple Audio Capture For Windows... (Python) 2014-10-17T14:39:16-07:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578952-simple-audio-capture-for-windows/ <p style="color: grey"> Python recipe 578952 by <a href="/recipes/users/4177147/">Barry Walker</a> (<a href="/recipes/tags/audio/">audio</a>, <a href="/recipes/tags/audio_capture/">audio_capture</a>, <a href="/recipes/tags/capture/">capture</a>, <a href="/recipes/tags/sample/">sample</a>, <a href="/recipes/tags/signal_capture/">signal_capture</a>, <a href="/recipes/tags/windows/">windows</a>). </p> <p>This snippet will capture from approximately 1 second to nearly 10000 hours of audio silently using Windows SoundRecorder.exe and save automatically to a file named SAMPLE.WAV in the C:\Windows\Temp\ folder/drawer/directory. It is 16 bit signed integer depth, stereo and sampled at 44100 Hz. This is for Python 2.0.1 to 3.3.2, (my latest version).</p> <p>Enjoy finding simple solutions to very difficult problems...</p> <p>(An OSX version is on its way too...)</p> <p>Bazza...</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> Seven Bit Colored Analogue Bar Graph Generator DEMO... (Python) 2011-03-17T22:14:52-07:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/577612-seven-bit-colored-analogue-bar-graph-generator-dem/ <p style="color: grey"> Python recipe 577612 by <a href="/recipes/users/4177147/">Barry Walker</a> (<a href="/recipes/tags/analogue/">analogue</a>, <a href="/recipes/tags/anim/">anim</a>, <a href="/recipes/tags/audio/">audio</a>, <a href="/recipes/tags/bargraph/">bargraph</a>, <a href="/recipes/tags/color/">color</a>, <a href="/recipes/tags/colour/">colour</a>, <a href="/recipes/tags/demo/">demo</a>, <a href="/recipes/tags/display/">display</a>, <a href="/recipes/tags/linux/">linux</a>). Revision 3. </p> <p>..For STANDARD Python 2.6 and above...</p> <p>This code will display a horizontal full colour analogue "VU" style meter. It displays green for normal, yellow for warning and red for danger with a critical error beep near the end of full scale, at value 120+.</p> <p>This version is for Python 2.6 and above and only for the Linux, (*nix?), platform.</p> <p>It is an "at a glance" display that is in colour rather than having to read say a digitally generated number.</p> <p>A Python 3.x version can be found here:-</p> <p><a href="http://www.linuxformat.com/forums/viewtopic.php?t=13443" rel="nofollow">http://www.linuxformat.com/forums/viewtopic.php?t=13443</a></p> <p>This has uses "for at a glance" voltmeters, ammeters, data-loggers, anemometers etc, etc...</p> <p>Watch for wordwrapping etc...</p> <p>NOTE:- This is Public Domain and you may do with it as you please.</p> <p>73...</p> <p>Bazza, G0LCU...</p> <p>Team AMIGA...</p> Recursive Multimedia (audio, video) M3U Playlist Generator (Python) 2014-02-08T01:03:36-08:00Mano Bastardohttp://code.activestate.com/recipes/users/4182040/http://code.activestate.com/recipes/578771-recursive-multimedia-audio-video-m3u-playlist-gene/ <p style="color: grey"> Python recipe 578771 by <a href="/recipes/users/4182040/">Mano Bastardo</a> (<a href="/recipes/tags/audio/">audio</a>, <a href="/recipes/tags/ffmpeg/">ffmpeg</a>, <a href="/recipes/tags/generate/">generate</a>, <a href="/recipes/tags/m3u/">m3u</a>, <a href="/recipes/tags/mulitmedia/">mulitmedia</a>, <a href="/recipes/tags/os/">os</a>, <a href="/recipes/tags/playlist/">playlist</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/system/">system</a>, <a href="/recipes/tags/video/">video</a>). Revision 9. </p> <p>Generate an m3u playlist searching recursively for multimedia files (video or audio) in the given directory. Information from ID3 tags will be extracted for audio files with <a href="http://en.wikipedia.org/wiki/FFmpeg">FFmpeg</a> available.</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> Wav audio file dynamic range compressor (C) 2013-04-18T15:04:25-07:00Granning Stolinehttp://code.activestate.com/recipes/users/4186069/http://code.activestate.com/recipes/578510-wav-audio-file-dynamic-range-compressor/ <p style="color: grey"> C recipe 578510 by <a href="/recipes/users/4186069/">Granning Stoline</a> (<a href="/recipes/tags/audio/">audio</a>, <a href="/recipes/tags/compressor/">compressor</a>, <a href="/recipes/tags/dynamic/">dynamic</a>, <a href="/recipes/tags/file/">file</a>, <a href="/recipes/tags/range/">range</a>, <a href="/recipes/tags/wav/">wav</a>). Revision 4. </p> <p>Wav audio file dynamic range compressor</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 &gt; /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>