The Max remote receiver project described in an earlier post: https://reactivemusic.net/?p=20965 now includes support for OpenWebRx and KiwiSDR sites.
When using OpenWebRx, you need to select a “profile” that supports the receive frequency range, before you can operate within that frequency. Its an unusual system that uses an offset frequency within the selected profile, instead of a global “actual frequency” like the other platforms.
The KiwiSDR sites, in general, have very good quality reception and audio.
The next step in this project will be to consolidate a directory of sites that are useful for remote reception in the ham bands for various parts of the world.
This Max patch connects to a radio transceiver and reads the frequency data using hamlib. Hamlib provides a common API for amateur radio devices. https://hamlib.github.io/. The hamllib server runs in the background using TCP/IP. This patch uses Jeremy Bernstein’s shell object. https://github.com/jeremybernstein/shell and the Sadam Library of externals, installed with the Max package manager.
Files
hamlibtcptest1.maxpat : select radio, starts rigcltd dameon, poll frequency via tcp/ip
launch-rigctld.sh : shell script to run rigctld
Libraries
Max: Jeremy Bernstein’s shell external, and the sadam library from Max package manager.
hamlib can be installed using homebrew
Notes
There is some latency when using the Elecraft K4. Need to look into the internal CAT settings.
Also, look into communication latency of TCP/IP and associated libraries.
I’m exploring a version of this that uses node.js instead of the shell external and tcp/ip library in Max. Initial problem is that the rigctld daemon stays active after Max is closed and needs to get killed manually.
Using an Arduino Uno to detect the transmit state of a radio. The amplifier keying line (PTT) is grounded on transmit. The Arduino sees it as a switch being pulled low. The keying line is connected to digital input 2 (D2) and ground. The digital input uses the builtin pullup resistor. The sketch is the Arduino digital | input pullup example. Max polls the serial data from the Arduino and displays the state of the keying line.
Files
arduino-ptt-detect2.maxpat – reads serial data from Arduino and converts to on/off state. The patch is nearly identical to the Arduino serial read example in the max-projects github.
ampkey2test2.ino – this sketch is almost identical to the Arduino Example | digital | input pullup – sketch. Except the baud rate is set to 38400.
Note: files are not yet available. Local files in max teaching examples.
Remote receiver project using Websdr as a remote alternative to a local receiver.
Demonstration of a Max/MSP program that connects an amateur radio transceiver to Websdr – transmitting locally from Maine (USA) while receiving remotely using a radio in the Netherlands. The Max program reads the frequency from a Elecraft K4 transceiver, to control the Websdr sites. It also loads the remote receivers, controls audio routing, mode, filter, and waterfall display settings. An iPad, running touchOSC, acts a a control panel. Up to 4 remote receivers operate at the same time. Websdr is a remarkable system, developed by PA3FWM at http://websdr.org/. It lets you control remote receivers worldwide, from your Web browser.
Components:
Max/MSP
Websdr
TouchOSC
Elecraft K4 transceiver with antenna system
Skookumlogger (logging software)
Max Patches:
websdrjweb7.maxpat : main control program. Contains [jweb] objects for launching websdr instances. Also code for injecting javascript to control parameters like frequency, filter, and volume. This patch acts as an intermediary between TouchOSC, WebSDR, and allows external MIDI control as well as getting frequency input from CAT controlled radios like the Elecraft K4.
websdrCATaudio.maxpat : handles serial port interaction for the K4. Also reads audio stream from either the K4 receiver (via USB) or the websdr receiver (via Blackhole.) I created an aggregate audio device called K4sdr to allow Max to read both devices at the same time. Audio switching and levels are handled using a Korg nanoControl2. For example to switch between the audio streams or listen to both.
Optional: arduino-ptt-detect2.maxpat : reads serial data from an Arduino, connected to the amplifier keying line, to determine whether the radio is in transmit mode, so we can switch back to the local audio stream to eliminate latency of hearing your signal via websdr. See subsequent post about this setup…
TouchOSC
websdrCW3.touchOSC : controls all 4 websdr channels, ie,., volume, mute, filter, CW offset, filtershift, – Also handles window management, loading js code, zoom in/out websdr and selecting channel waterfall views or Max code views.
CW Offset
websdr doesn’t have a control for CW pitch offset. To sync the frequency of the K4, the websdr is run in LSB mode with a frequency offset equal to the CW pitch setting in the transceiver. eg., 450 Hz. This works for most of the websdr sites, but unfortunately some of the sdr’s are off-frequency. You can usually compensate by adjusting the CWfreqOffset for that channel (in Max or TouchOSC).
Setting the offset also requires shifting the filter so it is centered over the actual signal.
Files
This is currently a work in progress, not available on Github. Local files are in max teaching examples folder.
How to get video from applications, like a web browser, into Syphon.
This example shows how to get a Youtube video from Firefox into Max/MSP Vizzie.
Use NDI Scan Converter (From NDI Tools https://ndi.video/tools/ ) and select Firefox from the Capture menu
Use NDISyphon to convert the NDI stream to Syphon. Use virtual audio routing (eg., black hole) for system audio, or route audio directly into Max.
In Max, use the Syphon client from the package manager to receive video. Here is an example using Vizzie abstractions described in previous posts:
notes:
NDI scan converter allows screen capture from apps and broadcasts in NDI format over the LAN. Then NDISyphon app converts NDI stream into Syphon. For youtube, use theatre mode to fill the window – full screen doesn’t really work. see this link: https://support.telestream.net/s/article/Wirecast-Remote-Computer-Screen-Capture-with-NDI-macOS
Using 40 meter SSB, Max/MSP, and Websdr to build a feedback delay from Maine to the Netherlands.
A Max patch plays an audio file into the transmitter in Maine. Then, using a websdr receiver in the Netherlands, the received signal is amplified and mixed back into the audio to be retransmitted. Effectively creating a feedback delay line.
Here is an example of what it sounds like on 40 meters.
The audio from Websdr is routed to the input of Max by creating a multi-output device (In Audio Midi Setup) combining “Blackhole 2ch” and external headphone output (for monitoring). The audio output of Max is assigned to the transmitter SSB input.
Patch not yet available. Local version is in max teaching examples.
I needed a text to morse code generator in Max for the Twitter streaming map project. There was an ancient one that used [mxj] but its kind of a pain to use that object. I thought it can’t be that difficult to write one? I didn’t really have any idea where to start. Something about the blank Max patch causes brain activity? I went through about 5 different approaches. Eventually came up with this pattern thing, from thinking about the lighted buttons on the tr-808 drum machine.
For example, the letter A is . _ (dot dash)
morse code has rules for spacing:
dot = 1
space between tones = 1
dash = 3
space between letters = 3
space between words = 7
If you think of a drum machine pattern, the pattern for letter A would be: 1 0 1 1 1 0 0 0 (with the 3 trailing 0’s for letter spacing)
I made a [coll] with all the letter patterns indexed by ascii codes.
Then just concatenate letter patterns, for a given block of text, together into one big list and run it through [zl.nth] clocked by a [metro] and [counter]. the ones and zero’s turn an oscillator on and off.
local file: tkzic/internetsensors/twitter-stream2/morse5.maxpat
Sonification of Mass Ave buses, from Nubian to Harvard.
Updated for Max8 and Catalina
This patch requests data from MBTA API to get the current location of buses – using the Max js object. Latitude and Longitude data is mapped to oscillator pitch. Data is polled every 10 seconds, but it seems like the results might be more interesting to poll at a slower rate, because the updates don’t seem that frequent. And buses tend to stop a lot.
This project uses version 3 of the API. There are quality issues with the realtime data. For example, there are bus stops not associated with the route. The direction_id and stop_sequence data from the buses is often wrong. Also, buses that are not in service are not removed from the vehicle list or indicated as such.
The patch uses a [multislider] object to graph the position of the buses along the route – but due to the data problems described above, the positions don’t always reflect the current latitude/longitude coordinates or the bus stop name.
You will need to replace the API key in the message object at the top of the patch with your own key. Or you can probably just remove it. The key distributed with the patch is fake. You can request your own developer API key from MBTA. It’s free.
instructions
Open mbta.maxpat
Open the Max console window so you can see what’s happening with the data
click on the yellow [getstops] message to get the current bus stop data
Toggle the metro (at the top of the patch) to start polling
Turn on the audio (click speaker icon) and turn up the gain
Note: there will be more buses running during rush hours in Boston. Try experimenting with the polling rate and ramp length in the poly-oscillator patch. Also, you can experiment with the pitch range.