Tag: teaching

near-ultrasound data transfer in Max using FSK (rtty)

An example of sending data through the air, from one computer to another, using sound. The carrier frequency – 18Khz – just below ultrasound, is inaudible to most humans. The data protocol is Audio Frequency Shift Keying (AFSK) at 45 bits/second. It uses two tones – to encode 1’s and 0’s. This protocol was developed for radio teletype (rtty).

One computer sends the word “hello” to the other computer every 10 seconds.

The idea came from a paper by Michael Hanspach and Michael Goetz – “On Covert Acoustical Mesh Networks in Air” – http://www.jocm.us/uploadfile/2013/1125/20131125103803901.pdf. In the paper they explain that the concept was borrowed from current technology for underwater data networks. They warn of the vulnerability of “air-gapping” as a method of computer security.

Actually, after watching the video I realized its difficult to make exciting videos that feature sounds you can’t hear. Especially when you are whispering. Well, the pro camera crew should be knocking on the door at any moment.



folder: frequency-shift-keying


  • rtty-recv12.maxpat
  • rtty-send12.maxpat
javascript files:
  • rtty-encode10.js
  • rtty-recv9.js


To run patches:

  • in rtty-send12 set carrier frequency to something like 200
  • then toggle start/stop
  • You may want to increase the speed to 32
  • On the receive side, clear the text box
  • Make sure to set audio as described below

In audio settings try

  • io vector = 512,
  •  signal vector = 32,
  •  overdrive and audio-interrupt should be enabled,
  •  SR=96 Khz.

Interesting discovery – or maybe a coincidence. Bit rates which are powers of 2 seem to work way better than arbitrary speeds.  I wonder if its because the signal vector size is also a power of 2?

Going from a direct audio connection to an through-the-air connection led to a number of issues with filtering and and levels.  The latest version of the Max patches have been organized into modules, like: encoder, transmitter, decoder, phasor-clock, etc., But they would benefit from some encapsulation.

It was interesting that throughput was better above 14Khz. Possibly due to less interference from environmental sounds – and less critical filtering. During the video I was able to talk (whisper), without interfering  with data transfer. But if I squeaked a chair or tapped the desk, it would screw-up. Also, the builtin mic/speaker on MacBooks have response curves that are all over the place.

The next version will have sharper filters and an automatic level control (compressor).  There’s  difficult interaction in the detection process between filtering and timing. Up to this point I’ve been reluctant to use frequency domain filtering due to loss of timing resolution. Latency is ok though. But the other thing is that we don’t want filters which soften or distort the shapes of the pulses.

So one question is how high can you go – with the built-in mic and speaker. They are not rated above 20 Khz. but you never know?


FM, AM, and SSB modulation/demodulation in Max

This is a radio – but also a modem, in a literal sense of the word. You may be familiar with AM and FM. Have your tried using them backwards?

In this patch, an audio signal is modulated using SSB, AM, and FM then frequency shifted to about 1/4 the nyquist frequency. Then the process is reversed revealing the original audio.


Have improved and simplified FM and AM detection. There is no frequency shift prior to detection. This eliminates some phase distortion.

Pd Version. (runs at 44.1 kHz, because I was too lazy to figure out how to do audio file playback which detects the SR of the audio file.

FM detection: The DC offset and makeup gain levels are sensitive to carrier frequency and SR. Will need to automate these corrections to prevent audio output problems.


max-projects: https://github.com/tkzic/max-projects

folder: demodulation/max

  • modem3.maxpat
  • obama.aiff

folder: demodulation/pd

  • modem-pd.pd
  • freqshift-abs~.pd
  • obama.aiff


phase cancellation encryption in Max

This patch mixes two audio signals, then makes one disappear by reversing its phase. A similar method was used by U.S. military to encrypt radio transmissions during the 20th century. A  phonograph record was the ‘key’ to unlock the encoded transmission. In practice it was difficult to synchronize the two recordings to achieve phase cancellation.



folder: phase-cancellation


  • phase-cancellation-example.maxpat
  • disappearing-act.maxpat


ep-4xx13 DSP – week 13

Signal processing with radio

  • unintended interactions
  • using the wrong tools
  • measuring the invisible
  • antennas
  • propagation is frequency dependent
  • Extreme frequencies, negative frequencies?


Demodulation of signals in Max

These patches are works in progress. Please contact me if you have questions about how they work.

  • Modem.maxpat – modulation/demodulation
  • gen-fm-detector2.maxpat – a phase locked loop in gen~. Use with modem.maxpat – but turn FM modulation level down to about 250.
  • pid-mrmapes2.maxpat – Using a PID controller to control oscillators

Frequencies and modes

  • Arduino transmitter: AM 1330 kHz.
  • Wireless micorophone: Wide FM 676 mHz.
  • Cordless phone: Narrow FM 926 mHz.
  • Cell phone: Digitally encrypted trunking FM 836 mHz.
  • Macbook trackpad: Noise 5 mHz.
  • Macbook AC adapter: Noise 600-1400 kHz.
  • Wifi: Digitally encoded PCM 2.4 gHz.
  • FM broadcast band: Wide FM 89.7 mHz
  • TV audio 600 mhz/660 mhz FMW


ep-4xx13 DSP – week 12




Holiday book recommendations:


Work on final projects. Due in class December 16th


ep-3xx41 Max – week 12

modern user Interface design:

Max For Live – part 2



  • chord2.amxd – a generative midi effect
  • gizmo-mod-example.amxd – (a Max help file made into an audio effect)


Max patches

  • Basic Max For Live audio effect
  • M4L instrument
  • adapting a help file
  • Live packs (Max for Live essentials from Cycling74)

Assignment – generative music

Design a patch that composes music

Next monday I will be meeting with all of you individually. Its a great opportunity to ask questions about anything – or get help with projects, ideas, etc.,


ep-3xx41 Max – week 8

David Zicarelli from Cycling74


– Music is technology independent.
– Technology has a sound.

Music exists on a continuum from predicability to unpredicability

  • David on Miller Puckette: He programmed with a bottle of Scotch (a chemical version of Occam’s razor?) His code also featured swear words as variable names. And allegedly he did not always wear pants while working
  • One of Cycling74’s goals was simply to make Max into a commercial product.
  • I was rejected from every graduate  school music program that I applied to.
  • The Internet provides an equivalent way for introverts to seek out extroverted people.
  • I do wear pants when I’m working.
  • The “jumping Rhoomba” – [When you don’t understand how to program something you can get interesting results].
  • The world has the same properties as a musical instrument.
  • Nobody cares about technology – just the outcome.
  • Computers were designed for office work.
  • David Rokeby http://en.wikipedia.org/wiki/David_Rokeby Using cameras as controllers to make sound. (specularity)
  • For example, Autotune technology has a sound.


Make music based on the two concepts:

  • music is technology independent
  • technology has a sound
David said that he would be willing to listen to the results and offer suggestions.