28 Oct 2012 Welcome to SoftCW vs 1.07 - Code Practice Oscillator - It is basically a sine wave tone generator that employs the ASIO protocol to send the audio to your sound card. - signals generated feature raised cosine tapering and whole waves at chosen frequency cut at the zero crossings for a clean signal with a negligible DC component. - Tap out a message in Morse Code by pressing to sound a tone. - Optionally trigger tone generation via the serial or parallel port. (This last implies a little hardware hacking ability on the part of the user) - a green "LED" lights up in the lower left corner of the screen while a tone is triggered - the application generates debug logs providing a wealth of diagnostic information for the user - source code is made available to give user the ability to extend and maintain the application. Operation _________ The application must be placed in a folder along with ASIOHost.dll and Config.ini - Config.ini provides user preference information for the SoftCW application - ASIOHost.dll provides access to an ASIO sound card for the SoftCW application - When the application is initialized, this DLL puts up a notice identifying itself on the screen. - Simply click "Ok" and the application will complete initialization. Before you begin though, open Config.ini in a simple ASCII text editor such as NotePad and supply the desired parameters. Here is an example: iASIODevNum 3 dAttenuation 3.0 dFrequency 1000.0 dRiseTime 0.01 dFallTime 0.01 sPort COM1 sComEventMonitored DSR iDebounceDelay 20 The first value is the number of your ASIO sound card device. If you only have one ASIO device on your platform, put '0' (without the quotes); If you are not sure, put '0' and run the app. Your ASIO devices will be enumerated and displayed in the debug log, like so... ASIO devices found: 4 Device number: 0 - ASIO DirectX Full Duplex Driver Device number: 1 - ASIO4ALL v2 Device number: 2 - Generic Low Latency ASIO Driver Device number: 3 - M-Audio FireWire ASIO From the devices listed for your platform, note the number of the desired device. For volume level if you want maximum volume put '0' (without the quotes) for dAttenuation. If you want to reduce the volume level use a number that represents the number of dBs of attenuation desired. The frequency of the tone generated can be set to the desired value. The rise time and fall time of signal's attack and decay are supplied in seconds. In the example above, they are set to 0.01 seconds, or 10 ms. The duration for attack rise time will be adjusted to the nearest half wave length samples based on the chosen frequency. The duration for decay fall time will be adjusted to the nearest wave length samples based on the chosen frequency. During attack/decay time, signal will be tapered via a raised cosine function. In any event, with or without such a delay, signal length as commanded by the keyer or space bar is always adjusted to nearest full wave zero crossing. During operation, success and errors messages are sent to the debug log. Look in SoftCWDbg.log if you have any problems. Here is an example from a debug log after a successful session with the application... Initializing device: 3 ASIO Initialized Create ASIO buffers success! Buffer sample size: 128 Sample rate: 48000 WaveLength: 72.72727 dwTotalRiseTimeSamples: 254 dwCalculatedFallTimeSamples: 254 Create virtual channel success! Frequency: 660.000000 Attenuation: 0 Rise time: 0.005 Fall time: 0.005 Monitoring port COM1 for DSR Debounce delay: 20 Timer initialized Started port monitor thread Exiting port monitor thread! Time waiting for thread to release mutex: 1 Shut down ASIO Count buffers played: 657 Shutting down debug logging system... Date: Monday, October/22/2012 - Time: 07:20:29 313 Goodbye If you want to key the tone from the serial or parallel port, you need to supply the port name (COM1, COM2, COM3, etc or LPT1, LPT2, etc) and which signal you want to monitor, whether DSR (data-set-ready), CTS (clear-to-send), RING (ring detected), or RSLD (receive-line-signal-detect). Keyers generate contact noise called "switch bounce". This can cause noise at the onset of tone generation and other problems with the SoftCW application. Keeping your keyer contacts clean can help a bit. Rub them gently with a pencil eraser or slide a clean white unglazed piece of paper between the contacts, then clean them with alcohol or preferably use contact cleaner. You may enable "software contact debouncing" in SoftCW by providing a non-zero value for the debounce delay. Unfortunately, software switch debouncing without external filtering is a poor solution for SoftCW. The method employed is to simply wait after each event is detected some number of milliseconds before beginning monitoring for the next event. The theory is that this delay allows the switch contact voltage time to reach a steady state. However, if a state change arrives too soon after the previous, during the debounce interval, it will not be detected, so that limits the speed you can reliably send code at. 10 ms was found to be best delay with no hardware filtering, but this is only adequate at slow code speeds. A hardware "contact debouncing" Schmitt trigger circuit should be used to ensure a solid ON and OFF signal, but in lieu of that you could at least use a simple R/C EXTERNAL DEBOUNCE circuit. The best results were with a delay of 5 on the software debounce along a simple R/C EXTERNAL DEBOUNCE circuit. If you want to disable software switch debouncing, use a value of 0 for iDebounceDelay. This delay does not have any effect when using the space bar for keying. Example: sPort COM1 sComEventMonitored DSR iDebounceDelay 20 If you don't want to use a port, just set sPort to "NONE" (without the quotes) Example: sPort NONE sComEventMonitored DSR iDebounceDelay 20 *** That last item in the debug log... "Count buffers played: 657" ...is an indication that the audio was successfully sent to your sound card. If you didn't hear it, then you forgot to turn your speakers on or plug in your headphones. Note: To reduce latency to the minimum, go into the ASIO Control Panel for your sound card and chose the minimum buffer size. Choosing a higher sample rate will further reduce latency. I have supplied the source code under a Creative Commons - Non-Commercial license so that the user may maintain or extend it. If you are a competent programmer and have added some cool new feature or fixed a bug, please send the new code to me that I might integrate it into the project. Thanks. Have fun, George Taylor gtaylor@TropicalCoder.com http://www.tropicalcoder.com/