HAM RADIO Python projects: SQUARE WAVE to SINE WAVE converter for a Morse Code Practice Oscillator

64 views
Skip to first unread message

Chuck Vaughn

unread,
Oct 7, 2022, 1:30:55 PM10/7/22
to iCW - internet CW

using a modified PYTHON SCRIPT from: https://brettviren.github.io/pygst-tutorial-org/pygst-tutorial.htm GSTREAMER python code used in this PYTHON SCRIPT example: # Set up the gstreamer pipeline self.player = Gst.parse_launch (" interleave name=i ! audioconvert ! queue ! ladspa-zamgate-ladspa-so-zamgate attack=5 release=5 threshold=-31 sidechain=true ! audioconvert ! audio/x-raw, rate=48000, layout=interleaved, format=F32LE, channels=1 ! audiomixer ! audiowsincband mode=band-pass lower-frequency=600 upper-frequency=800 length=424 window=3 low-latency=true ! audioconvert ! queue ! jackaudiosink buffer-time=3000 sync=false async=false audiotestsrc volume=0.6 freq=740 ! audioconvert ! multiqueue use-interleave=true ! i. jackaudiosrc ! audio/x-raw, channels=1 ! audioconvert ! multiqueue use-interleave=true ! i. ") this Gstreamer CODE performs many functions... 1. it creates a SINE WAVE at 740hz that connects to the upper port of the ladspa ZAMGATE SIDECHAIN PLUGin(ladspa-zamgate-ladspa-so-zamgate) 2. it creates an input port for receiving a CPO's//CW keyer's harsh square wave audio output, that it will use to trigger the SINE WAVE at 740hz to pass through the ZAMGATE upper port in exact timing precision with the original SQUARE WAVE cw note 3. it will set the RISE/fall time and weight by zamgate's controls (attack=5 release=5 threshold=-31 sidechain=true) 4. it will filter the ZAMGATE pure sine wave trapezoidal wave shape output into a raised cosine edged output(audiowsincband mode=band-pass lower-frequency=600 upper-frequency=800 length=424 window=3 low-latency=true)

aa0hw

unread,
Oct 7, 2022, 3:19:22 PM10/7/22
to iCW - internet CW
Here is another PYTHON PROJECT for the mumble output:
HAM RADIO Python projects: iCW Mumble Morse Code Audio output AGC, CW RE-GENERATOR & BandPass filter

 
GSTREAMER python code used in this PYTHON SCRIPT example: 
# Set up the gstreamer pipeline 
self.player = Gst.parse_launch (" interleave name=i ! audioconvert ! queue ! ladspa-zamgate-ladspa-so-zamgate attack=5 release=5 threshold=-40 sidechain=true ! audioconvert ! audio/x-raw, rate=48000, layout=interleaved, format=F32LE, channels=1 ! audiomixer ! audiowsincband mode=band-pass lower-frequency=600 upper-frequency=800 length=384 window=3 low-latency=true ! audioconvert ! queue ! jackaudiosink buffer-time=3000 sync=false async=false audiotestsrc volume=0.63 freq=740 ! audioconvert ! multiqueue use-interleave=true ! i. alsasrc device=hw:0,0 ! audioresample ! audioconvert ! audio/x-raw, channels=1 ! ladspa-la-loudmax64-so-ldmx-mono threshold=-30 output=-30 ! audioconvert ! multiqueue use-interleave=true ! i. ") 

 this Gstreamer CODE performs many functions... 
 1. it creates a SINE WAVE at 740hz that connects to the upper port of the ladspa ZAMGATE SIDECHAIN PLUGin(ladspa-zamgate-ladspa-so-zamgate) 
2. it creates an input port for receiving a CPO's//CW keyer's harsh square wave audio output, that it will use to trigger the SINE WAVE at 740hz to pass through the ZAMGATE upper port in exact timing precision with the original SQUARE WAVE cw note 3. it will set the RISE/fall time and weight by zamgate's controls (attack=5 release=5 threshold=-31 sidechain=true) 
4. it will filter the ZAMGATE pure sine wave trapezoidal wave shape output into a raised cosine edged output(audiowsincband mode=band-pass lower-frequency=600 upper-frequency=800 length=424 window=3 low-latency=true) 
5. it applies AGC to the incoming mumble output audio, up to 30 db range of operation to keep the volume the same, preparing it for the RE-GENERATOR pathways

Chuck Vaughn

unread,
Oct 8, 2022, 11:46:06 AM10/8/22
to i_...@googlegroups.com
if you are running iCW using a Raspberry Pi
 does not have a version for the pi...
however vlevel does...and you can run this line of code in the python Gstreamer section in
lieu of where the loudmax code is scripted into the Gstreamer/python code...        
ladspa-vlevel-ladspa-so-vlevel-mono look-ahead=.05 limit-multiplier=true multiplier-limit=20 strength=1

--

---
You received this message because you are subscribed to the Google Groups "iCW - internet CW" group.
To unsubscribe from this group and stop receiving emails from it, send an email to i_cw+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/i_cw/2eb873c5-2b65-41f4-b217-a70e5d3d2e54n%40googlegroups.com.

Chuck Vaughn

unread,
Oct 9, 2022, 8:28:51 PM10/9/22
to i_...@googlegroups.com
virtual audio cables for Mumble on iCW -
Mumble input/output gets AGC'd & Regenerated


using a modified PYTHON SCRIPT from:
https://brettviren.github.io/pygst-tutorial-org/pygst-tutorial.htm SETUP: use 2 alsa virtual audio cables(snd-aloop) one for mumble input, & another for mumble output WHY? to apply several ladspa apps and two native gstreamer scripts for a sine wave generator & cw audio bandpass filte; to REGEN the cw before it gets to the mumble input VAC, and the speaker/headphones(for monitoring your keyed sidetone in real time) AND to do the same for the mumble output VAC... AGC/Limit it, regenerate it, and then bandpass filter it, before it gets to the op's own sound card's speaker/headphone GSTREAMER python code used in this PYTHON SCRIPT example: # Set up the gstreamer pipeline self.player = Gst.parse_launch (" interleave name=i ! tee name=t t. ! queue ! audioconvert ! ladspa-zamgate-ladspa-so-zamgate attack=5 release=5 threshold=-5.5 sidechain=true ! audioconvert ! queue ! audiomixer ! audiowsincband mode=band-pass lower-frequency=529 upper-frequency=749 length=384 window=3 low-latency=true ! audioconvert ! audio/x-raw, rate=48000 ! queue ! audiomixer name=mix ! queue ! audioconvert ! ladspa-vlevel-ladspa-so-vlevel-mono look-ahead=.05 limit-multiplier=true multiplier-limit=3 strength=.7 ! audioconvert ! alsasink device=hw:7 buffer-time=35000 sync=false async=false t. ! queue ! audioconvert ! queue ! ladspa-zamgate-ladspa-so-zamgate attack=5 release=5 threshold=-5.5 sidechain=true ! audioconvert ! queue ! audiomixer ! audiowsincband mode=band-pass lower-frequency=529 upper-frequency=749 length=384 window=3 low-latency=true ! audioconvert ! audio/x-raw, rate=48000 ! queue ! alsasink device=plughw:0,1 buffer-time=70000 sync=false async=false audiotestsrc name=1 volume=0.63 freq=639 ! audioconvert ! multiqueue use-interleave=true ! i. alsasrc device=hw:7 ! queue ! audio/x-raw, rate=48000 ! audioconvert ! ladspa-vlevel-ladspa-so-vlevel-mono look-ahead=.05 limit-multiplier=true multiplier-limit=20 strength=1 ! audioconvert ! multiqueue use-interleave=true ! i. interleave name=j ! queue ! audioconvert ! ladspa-zamgate-ladspa-so-zamgate attack=5 release=5 threshold=-5.5 sidechain=true ! audioconvert ! queue ! audiomixer ! audiowsincband mode=band-pass lower-frequency=631 upper-frequency=851 length=384 window=3 low-latency=true ! audioconvert ! audio/x-raw, rate=(int)48000, layout=(string)interleaved, format=(string)S32LE, channels=(int)2, channel-mask=(bitmask)0x0000000000000003 ! queue ! mix. audiotestsrc name=2 volume=0.63 freq=741 ! audioconvert ! multiqueue use-interleave=true ! j. alsasrc device=hw:1,0 ! audioconvert ! audio/x-raw, layout=(string)interleaved, rate=(int)48000, format=(string)F32LE, channels=(int)1 ! ladspa-vlevel-ladspa-so-vlevel-mono look-ahead=.05 limit-multiplier=true multiplier-limit=20 strength=1 ! queue ! multiqueue use-interleave=true ! j. ") NOTE: this is just a first test run with the Gstreamer CODE above basic steps to the process... interleave allows 2 consecutive streams to be sent to the ZAMGATE SIDECHAIN GATE.... 1st one is a sine wave generator - "audiotestsrc" 
the 2nd is either the OP's own sidetone OR the output of mumble ...which keys the 2nd port of ZAMGATE and allows the sine wave to go through to the bandpass filter

Reply all
Reply to author
Forward
0 new messages