Short: Create a WAVE format Beep for Python. Author: wisecracker@tesco.net (Barry Walker) Uploader: wisecracker tesco net (Barry Walker) Type: dev/src Version: 1.00.00 Architecture: generic; m68k-amigaos Distribution: Public Domain, Emailware. ============================================================================ Architectures: Classic AMIGAs, WinUAE, Windows, Linux and E-UAE. ---------------------------------------------------------------- MINIMUM Requirements Are:- -------------------------- 1) Amiga environment:- 68EC020 CPU and 2MB RAM total, example, a standard A1200(HD). WinUAE, AF2005 minimum. Standard OS3.0x install or better. Full Python 1.4.x, minimum, installed. (Python 1.5.2 to 2.0.x are also available on AMINET.) 2) Windows environment:- Windows Vista and 7 from Python 2.0.1 to 3.3.2. 3) Linux environment:- Python 2.5.2 for PCLinuxOS 2009, Debian from Python 2.5.6 to 3.2.2. 4) Apple OSX 10.7.x and higher from Python 2.5.6 to 3.4.1. ---------------------------------------------------------------------------- History:- --------- 25-11-2014. ----------- Version 1.00.00. Probably the one and only upload for this archive. ---------------------------------------------------------------------------- General:- --------- sinebeep.py Creating an audio WAVE file called... beep.wav ...that can be played using almost ANY audio player available. 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) This works on:- Classic stock AMIGA A1200, using Python 1.4.0 to 2.0.1. 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. The file size is 8044 bytes and _IF_ you need to it can be played 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. It will still work with PulseAudio and OSS using... cat /full/path/to/beep.wav > /dev/dsp ...but with a momenatry click due to the 44 header bytes; but hey it is a beep alternative... The Python code is `sinebeep.py.txt` and is uncompressed. On downloading just rename `sinebeep.py.txt` to `sinebeep.py` and then place it into the PYTHON: volume drawer/folder/directory where Python is installed. Read the comments inside the code on how to use it. In the AMIGA environment and from a any Python prompt it is called as:- >>> exec(open("PYTHON:sinebeep.py").read()) READ THE CODE FOR MORE INFORMATION! This is a _hack_ to work around the differences between the various Python versions available. The chr() function is common to ALL versions of Python for HEX character values from 0x00 to 0x7F, decimal 0 to 127, inclusive. It COULD be considered eqivalent to _bytes_ inside these two limits. As these two limits are effectively 7 bits in size then creating almost any wave shape is possible within the limits of the HW in use. Remember this is a hack, so...... ......therefore it is easily possible to juggle the header to stay inside 7 bits per byte and create ALMOST any 7 bit waveform, any length, mono or stereo at any standard sampling speed. It is NOT practically possible to do 16 bit signed values that satisfies ALL Python versions, BUT, it IS if there are two versions, one to suit pre-version 3.0.0 and the other to suit post-version 3.0.0... ---------------------------------------------------------------------------- This archive is issued under the MIT licence. Original idea and (C)2014 goes to B.Walker, G0LCU. ---------------------------------------------------------------------------- IMPORTANT:- ----------- The Legal Stuff:- ----------------- This code is MIT licenced. All of the files must remain unaltered and intact including this one. The author is not responsible for any damage to, or loss of, or failure of equipment or data caused in any way by the use of these programs. There is NO warranty with the use of these software releases and YOU USE THEM AT YOUR OWN RISK. ---------------------------------------------------------------------------- Testing Evaluation:- -------------------- Debian 6.0.x on a Dual Core laptop using Python 2.6.6 to 3.1.3. E-UAE on the same machine using Python 1.4.0 to 2.0.1. Classic standard AMIGA A1200 using Python 1.4.0. Windows Vista on a Quad Core machine using Python 2.0.1 to 3.3.2. PCLinuxOS 2009 and Knoppix 5.1.1 using Python 2.5.2. WinUAE on the Windows Vista machine above using Python 1.4.0 to 2.0.1. Apple MacBook Pro, OSX 10.7.5 using Python 2.5.6 to 3.4.1. All WinUAE and Classic AMIGA test conditions were/are running standard OS3.0x/OS3.1x and using standard ~topaz 8~ fonts throughout. I have no idea what strange configuration setups will create so refer to the ~The Legal Stuff~ above. ---------------------------------------------------------------------------- Contact:- --------- Mr Barry Walker, G0LCU. Email:- wisecracker@tesco.net Author of the ~TestGear?~ projects in the ~docs/hard~ drawer of AMINET. ---------------------------------------------------------------------------- A very useful HardWare related site, (C) Anthony Hoffman, for modifications, schematics, repairs and the like is:- http://amiga.serveftp.net/ ============================================================================