- #1khz test tone generator install#
- #1khz test tone generator generator#
- #1khz test tone generator code#
:) global sine global square global triangle global sawtoothplus global sawtoothminus global pulseplus global pulseminus global waveform global select global count # Allocate values to variables. def main (): # Make all variables global, a quirk of mine. system ( "clear" ), chr ( 13 ), " ", chr ( 13 ), # The program proper. import os # Clear a terminal window ready to run this program. o) # It is EASILY possible to generate pseudo-random noise also but # I'll leave that for you to work out. # You will need an oscilloscope connected to the earphone socket(s) # to see the resultant waveform(s) generated, or listen to the # harshness of the sound. # Coded on a(n) HP dual core notebook running PCLinuxOS 2009 and # Python 2.5.2 for Linux. :) # Using my notebook about 150mV p-p was generated at the earphone # socket(s).
#1khz test tone generator generator#
# 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.
# For a quick way to run just use at the ">" prompt:- # > import afg # And away we go. # Copy the file to the Lib folder(/drawer/directory) or where the modules # reside as "afg.py". # Ensure the sound system is not already in use.
#1khz test tone generator install#
# It is assumed that /dev/audio exists if NOT, then install oss-compat # from the distro`s repository. # (Original idea copyright, (C)2009, B.Walker, G0LCU.) # Issued as Public Domain, (to LXF) and you may do with it as you please. # It would be tricky to change the output level using STANDARD Python # for (PC)Linux(OS) 2009 using this idea to generate waveforms, but it # is possible within limits.
#1khz test tone generator code#
# (It has now been tested on Debian 6.0.0 and Knoppix 5.1.1!) # Although it is fairly easy to alter the frequency within limits I # have left it at approximately 1KHz to keep the code size down. # This is for (PC)Linux(OS), (ONLY?), and was done purely for fun. # - # A fun Python program to generate a Sine, Square, Triangle, Sawtooth, # and Pulse waveforms using STANDARD Python at the earphone sockets. (There will be more to come in the future.
This is Public Domain and you may do with it as you like. Noise is not included but that is SO easy that I left it out FTTB.Īll that is required to make this a piece of audio test equipment is a cable plugged into to the earphoneĪssuming it is copied into the module(s) drawer just type:- > import afg :)Īn oscilloscope will show the waveforms generated at the earphone socket. Signal source, for free, without external hardware, AND, using standard Python, what more do you want. The waveforms generated are unfiltered and therefore not "pure", but hey, an audio function generator Sine, Square, Triangle, Sawtooth+, Sawtooth-, Pulse+ and Pulse- signals are generated in 10 second bursts. It needs /dev/audio to work if you haven't got it then install oss-compat from your distro's repository.Įnsure the audio system is NOT in use for this to work. It is a basic audio signal generator and can be used as a starter test signal source for amateur electronics This code is a stand alone program to generate a signal, at the earphone sockets, of 1KHz. Simple 1KHz Audio Function Generator Using Standard Python In Linux - afg.py