Popular recipes tagged "sinewave"http://code.activestate.com/recipes/tags/sinewave/2014-11-23T19:24:46-08:00ActiveState Code RecipesA 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>
DEMO - Generate A Crude 1KHz Sinewave Using A BASH Script. (Bash)
2013-03-01T19:41:47-08:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578477-demo-generate-a-crude-1khz-sinewave-using-a-bash-s/
<p style="color: grey">
Bash
recipe 578477
by <a href="/recipes/users/4177147/">Barry Walker</a>
(<a href="/recipes/tags/audio/">audio</a>, <a href="/recipes/tags/bash/">bash</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/shell/">shell</a>, <a href="/recipes/tags/sinewave/">sinewave</a>, <a href="/recipes/tags/sound/">sound</a>).
</p>
<p>A very simple crude sinewave generator using a BASH script inside a Linux Terminal.</p>
<p>The file required is generated inside the code and requires /dev/audio to work.</p>
<p>Ensure you have this device, if not the download oss-compat from your OS's repository...</p>
<p>It lasts for about 8 seconds before exiting and saves a 65536 byte file to your working directory/drawer/folder as sinewave.raw.</p>
<p>Use an oscilloscope to check the waveform generated...</p>
<p>It is entirely Public Domain and you may do with it as you please...</p>
<p>Enjoy finding simple solutions to often very difficult problems... ;o)</p>
<p>Bazza, G0LCU...</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>