Max core audio drivers

Normal core audio verses ad_portaudio core audio

Solved an issue with Maxradio project – when using soft66lc2 which delivers baseband samples to Max via audio input – the bandwidth was only half of what it should be – I switched back from ad_portaudio to default core audio drivers and everything was fine.

The real mystery now is why the fun cube pro+ doesn’t run in Max when using default core audio drivers?

 

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?

links

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
[wpdm_file id=15]

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

 

PID controller in Max

Here is a PID controller (proportional, integral, derivative) in Max that controls the pitch of an oscillator so you can watch how a process responds to various setting of PID coefficients. It features an external perturbance generator (ie., noise maker) to check how fast the system can adjust and continue.

Tried using fiddle~ for frequency detection (as the sensor input) but it provides faulty data below about 200hz – and that totally messes up the PID. so I am just using the actually frequency being used to set the oscillator as the response sensor.

update:  Tristan Jehan wrote a Max external that extends lower frequency range of  [fiddle~]. It would be worth trying for this patch.

The PID algorithm is written in javascript.

download

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

folder: pid-controller

patch: pid-mrmapes2.maxpat

javascript code: pid.js

Instructions

  • turn on audio
  • change test interval to something like 20
  • click on message boxes to change set point. Listen and watch results
  • try different presets – which alter PID settings and then try changing the set point. For example, with the 2nd preset you will see overshoot and oscillation during settling phase.

more about PID controllers

wikipedia page: http://en.wikipedia.org/wiki/PID_controller

 

Phase locked loop FM detection in Max

Here is an example of audio from the patch.

The source is a speech by Barack Obama which is FM modulated on an audio carrier at 23040 Hz.  Warning turn down the volume. You can hear as the PLL locks on to the signal. Then some of the params are tweaked in such a way that it is impossible to lock on to the signal, but the algorithm keeps on trying – producing an interesting result

A picture of the signal as its locking-on and when it loses the lock:

[original post]

A phase-locked loop algorithm running in Max (gen~)

The patch is unstable – but actually demodulates FM now.

download

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

folder: demodulation/max/phase-locked-loop

patch

gen-fm-detector2.maxpat

(also uses output from modem3.maxpat in folder: demodulation/max/)

instructions

  • run modem3.maxpat
  • set FM modulation level to less than 250
  • run gen-fm-detector2.maxpat
  • turn up audio output and try presets

notes

Two things: 1) I really don’t know what I’m doing with gen~ and 2) There are serious issues with the P and I coefficients in the algorithm. There is no ‘D’ coefficient yet – nor do I know whether its needed.

The thing that finally got it working was the loop filter component – which cleans up the output of the phase detector. The phase detector is essentially a phase ring modulator which contains not only the error signal, but also the sum of the incoming carrier and the reference oscillator. So the low pass filter gets rid of the high frequency component. By setting the resonance and cutoff extremely low, you can make the PLL start going a bit crazy in a beautiful way, lots of motion and spectral shifting.

Need to go through and analyze the output of the various stages, now to get the coefficients set properly – also, may need some kind of AGC on the input stage. Its very sensitive to over modulation and will distort badly.

Its interesting to play with the coefficients and hear the difference in how the demodulation works. By slowing down the P coefficient  it not only slows lock response, but during lock, the output is muffled  – so the P coefficient acts as a low pass filter – because it changes how responsive the circuit is in detecting changes in the input signal frequency (i.e., modulation).

There’s a weird thing going on – a fixed carrier is getting mixed with the error signal (output)   The patch is using notch filters to eliminate it, but it seems like it shouldn’t be there at all. Or should get filtered by the Loop filter.

Another thing to mention if I haven’t already is that I’m using a somewhat inefficient way to detect phase difference. Its the convert to complex and slope detection method used in the differentiator – but done using signals from reference oscillator instead of from delayed samples from original signal. Simply multiplying the two signals without complex conversion would probably do.

ep-3xx41 Max – week 12

modern user Interface design:

Max For Live – part 2

notes

patches

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

[wpdm_file id=14]

links

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

Notes:

– 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.

Assignment:

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.