RTTY at 300+ bps in Max

notes

After a few vexing timing issues I have been able to send and decode RTTY (technically AFSK audio frequency shift keying ) in Max at 300 baud. Click hear to listen to an example of a 13 word message at 300 bps (300 baud)

The js object adds significant delays (on the order of a few milliseconds) – so I replaced the encoder with a coll and that cleaned up the timing problems when encoding. This patch demonstrates the issue:

Also… You can use threshold~ instead of snapshot~to feed binary pulse amplitude detection logic into edge~ – but you need to run the signal through average~ to prevent the amplitude from repeatedly dropping to zero at the signal frequency. Like this:

Is it better than snapshot~? it seems to be, but who knows – at these speeds it would probably be better to write the whole thing in gen~

There are a few other things – like using counter~ instead of phasor~ to drive the decoder clock. This allows you to restart the clock, when the onset of the start bit is detected – and you can add a variable amount of delay to find optimal point in the signal vector to read the pulse. At 300 bps, at 96k SR, each pulse is 320 samples (3.1 milliseconds) –

I’ll write more on this later –

The Katja Vetter article on Beat-Slicing was helpful – along with several Max tutorials on Audio control rates, and envelope followers.

Local Patches are in;

tkzic/ max teaching examples/

  • rtty-send10.maxpat
  • rtty-recv9a.maxpat

 

Max potpourri externals

By Eric Lyon

Have been relocated to:

https://github.com/ericlyon/LyonPotpourri-MaxMSP

Object Listing:

- adsr~ a simple ADSR envelope that can be click triggered
- arrayfilt~ fft-based filtering by drawing into an array
- bashfest~ a click driven buffer player with randomized DSP
- buffet~ provides operations on a stored buffer
- bvplay~ selective playback from a stored buffer with enveloping and increment control
- cartopol~ convert a spectral frame from cartesian to polar form
- channel~ access to a precise address in the signal vector
- chopper~ munging loop playback from a buffer
- clean_selector~ like selector~ but crossfades when switching channels
- click~ converts a bang to a click
- click2float~ translates a signal click to a float message
- clickhold~ sample and hold a click
- convolver~ non-real-time convolution with impulses of arbitrary size
- distortion~ lookup function distortion
- dmach~ pattern based sample accurate drum machine prototype
- expflam~ converts a click to an exponential flam click pattern
- flanjah~ simple flanger
- function~ write various functions into an array
- granola~ granular pitch scaling
- granulesf~ granular synthesis module reading from a soundfile in a buffer
- granule~ granular synthesis module reading from a stored waveform in a buffer
- greater~ compares two signals on a per-sample basis
- kbuffer~ low sampling rate buffer to capture gestures
- killdc~ DC block filter
- latch~ sustain an incoming click with sample-accurate timing
- magfreq_analysis~ transforms a time domain signal to a magnitude/frequency spectrum
- markov~ implements a first order Markov chain
- mask~ a click driven pattern sequencer
- npan~ power-panning to an arbitrary number of output channels
- oscil~ oscillator with flexible waveform specification
- phasemod~ phase modulated waveform
- player~ click driven buffer player that can sustain multiple iterations
- poltocar~ convert spectral frame from polar to complex representation
- pulser~ pulse wave generated by additive synthesis
- quadpan~ pan an incoming sound within a quadraphonic plane
- rotapan~ rotate an array of input channels to the same number of output channels
- rtrig~ generates random click triggers
- samm~ sample accurate multiple metronomes, with click signal articulation
- sarec~ sample accurate recording
- sel~ sample-accurate implementation of the sel algorithm  
- shoehorn~ collapse from a larger number to a smaller number of audio channels
- sigseq~ signal level numerical sequencer
- splitbank~ - split an incoming sound into complementary, independently tunable spectra
- splitspec~ split an incoming sound into complementary spectra
- squash~ implementation of a compression algorithm by Chris Penrose
- stutter~ stuttering playback from an array
- vdb~ a delay line using an array for storage (no vector limit on feedback delaytime)
- vdp~ a simple, self-contained delay unit
- vecdex~ outputs the sample index within the current signal vector 
- waveshape~ a Chebychev function lookup waveshaper
- windowvec~ apply a Hann window to the input signal vector

decoding RTTY in Max

Using a local clock

(update 12/18/2013) Here is a video that shows acoustic coupling between to computers running RTTY in Max at 12.5 bits/second

Next version will have better syncing within the patch (i.e.., sample accurate timing, instead of [metro], [delay], and [snapshot]

original post

Have added stop and start bits to ascii rtty signal and reversed mark and space to the normal setting.

The current local test patches are:

tkzic/max teaching examples/

  • rtty-sim7.maxpat
  • rtty-recv7.maxpat

Accurate communication only works at very low speeds – around 11 bits/sec.  The timing on the receive side is very critical. The way it works now, is that it uses the first start bit, after a period of inactivity, to reset the clock. The ‘delay’ setting for the clock seems to be the key factor in whether the bits get read as characters.

I think that any speed increases at this point will require sample accurate timing on both send and receive sides. But as a proof of concept we have a decent start.  Its also possible that the filtering/bit detecting could be improved – but again, this is a matter now of precise timing adjustments at the sample level – and using more frequent and accurate clock adjustments on the receive side to maintain sync.

Piping raw IQ data from rtl-sdr to Max

notes

Here is a discussion about mkfifo (pipes) but  I can’t seem to get Max to interpret the FIFO as audio samples

http://www.reddit.com/r/RTLSDR/comments/rd15f/some_noob_questions_after_succesfully_getting/

I think I know how to figure out the streaming IQ thing now. Capture samples to a file, then look at the format. Then maybe pipe the file through something like auconvert to make it into a wave file. If that works, then maybe there is a way to to it as streaming.

Or figure out how to stream from tcp/ip version to audio.

Max data recorder

This has been around for a while and is being used in several internetSensor projects. Records and plays back lists (this version allows lists where the first element is a symbol). Can record and playback simultaneously at different rates. Was originally adapted from MZ’s CNMAT example. And subsequently ruined.

download

https://github.com/tkzic/internet-sensors

folder: data-recorder

files

  • data-recorder-wrapper.maxpat (main entry point)
  • data_recorder_list-tz.maxpat (recorder abstraction)

There is also an example of multi-rate streaming in: data-recorder-tester.maxpat