Changing the phase of a waveform

From a Max/MSP tutorial: http://cycling74.com/docs/max5/tutorials/msp-tut/mspchapter04.html at Cycling 74

Changing the phase of a waveform

For the most part, the phase offset of an isolated audio wave doesn’t have a substantial effect perceptually. For example, a sine wave in the audio range sounds exactly like a cosine wave, even though there is a theoretical phase difference of a quarter cycle. For that reason, we have not been concerned with the rightmost phase inlet of cycle~ until now.

A sine wave offset by a quarter cycle is a cosine wave

However, there are some very useful reasons to control the phase offset of a wave. For example, by leaving the frequency of cycle~ at 0, and continuously increasing its phase offset, you can change its instantaneous value (just as if it had a positive frequency). The phase offset of a sinusoid is usually referred to in degrees (a full cycle is 360°) or radians (a full cycle is 2π radians). In the cycle~ object, phase is referred to in wave cycles; so an offset of π radians is 1/2 cycle, or 0.5. In other words, as the phase varies from 0 to 2π radians, it varies from 0 to 1 wave cycles. This way of describing the phase is handy since it allows us to use the common signal range from 0 to 1.

So, if we vary the phase offset of a stationary (0 Hz) cycle~ continuously from 0 to 1 over the course of one second, the resulting output is a cosine wave with a frequency of 1 Hz.

The resulting output is a cosine wave with a frequency of 1 Hz

Incidentally, this shows us how the phasor~ object got its name. It is ideally suited for continuously changing the phase of a cycle~ object, because it progresses repeatedly from 0 to 1. If a phasor~ is connected to the phase inlet of a 0 Hz cycle~, the frequency of the phasor~ will determine the rate at which the cycle~ object’s waveform is traversed, thus determining the effective frequency of thecycle~.

The effective frequency of the 0 Hz cycle~ is equal to the rate of the phasor~

The important point demonstrated by the tutorial patch, however, is that the phase inlet can be used to read through the 512 samples of cycle~ object’s waveform at any desired rate. (In fact, the contents of cycle~ can be scanned at will with any value in the range 0 to 1.) In this case, line~ is used to change the phase of cycle~ from .75 to 1.75 over the course of 10 seconds.

The result is one cycle of a sine wave. The sine wave is multiplied by a ‘depth’ factor to scale its amplitude up to 8. This sub-audio sine wave, varying slowly from 0 up to 8, down to -8 and back to 0, is added to the frequency of Oscillator B. This causes the frequency of Oscillator B to fluctuate very slowly between 1008 Hz and 992 Hz.

• Click on the message box in the lower-left part of the window, and notice how the beat frequency varies sinusoidally over the course of 10 seconds, from 0 Hz up to 8 Hz (as the frequency of Oscillator B approaches 1008 Hz), back to 0 Hz, back up to 8 Hz (as the frequency of Oscillator B approaches 992 Hz), and back to 0 Hz.

ep-4yy13 DSP – week 7

frequency domain

transforming signals

  • DFT, FFT, STFT
  • The FFT produces a stream of complex numbers representing energy at frequencies across the spectrum
  • The length of the FFT determines the frequency resolution (number of bins)
  • Increasing length of FFT frame degrades resolution in time domain (rhythmic accuracy)
  • Amplitude = root of (r*r) + (i*i)  = magnitude
  • Phase = arctangent of i/r = angle

Practical Applications

  • Convolution/Deconvolution
  • Analysis
  • Spectral processing (pitch and timbre)
  • Amplitude processing: noise gates, crossovers
  • phase vocoder
  • radio

Examples

  • Max/MSP tutorials 25-26
  • Max/MSP Example DSP patches (in Extras | ExamplesOverview | MSP | FFT fun
    • convolution workshop
    • Forbidden planet
  • Fourier Filter (Vetter)
  • fft-tz2 (basics, SSB ring modulator)
  • fplanet-tz.maxpat: hacked version of forbidden-planet example which uses granular indexing to do spectral convolution and make spaceship sounds. To use patch: 1 ) turn on audio, 2) then press message boxes inside the green panel
  • fp-fft-tz.maxpat: pfft~ subpatch for above
  • fourierfilter (folder) containing fourierfiltertest.maxpat: Katja Vetter’s complex spectral filter example
  • Tristan Jehan’s frequency detector object
  • Little Tikes piano: https://reactivemusic.net/?p=6993
  • Helicopter frame rate video: http://www.youtube.com/watch?v=jQDjJRYmeWg
download example Max patches here:
Resources

Assignments

See notes from previous weeks: https://reactivemusic.net/?p=10109 

 

 

 

Bill Dixon

from an interview by Frank Rubolino 2002 

http://www.onefinalnote.com/features/2002/dixon/

So how would you sum up your life?

If you are you, 24 hours a day, then you do not have to remember who you are supposed to be in different situations—something that I imagine could be troublesome. Ornette once related to me years ago about his own work that people didn’t so much mind what he did, they minded that he had done it. Confidence in my ability that I could do work of substance had a long gestation period. Being able to believe and fully believe in myself took a long time. Even the idea of confidence had to be built, and it needed a foundation to be built upon. In the late 1930s, I looked around and said, this is the only life I am going to have. I had to attempt a sorting out of my strengths, to isolate them, and then get to work on my weaknesses. What did I want to do? What did I want to be? What could I do? What would I be permitted to do? I discovered music and I discovered painting. I have a thing about myself—it is not arrogance, it is that I am confident in my ability to continue to attempt work. And I am also disturbed that people do things and expect you to roll over and play dead. I don’t talk of serious things to certain people anymore. The cure for cancer may come from some poor kid in Harlem who at the present time is unable to even finish high school. We take incredible chances on whom we select to pay attention to. Every mind is important. Man is the only animal who can deal systematically with abstract thought. I firmly believe that if people will allow themselves to become feelingly educated, so that things that are openly painful can be honestly discussed, then this could be the way out of the morass.

 

Grace Hopper – Nanoseconds

http://youtu.be/JEpsKnWZrJ8

electricity and light

1 billionth of a second (1e-9 s)

  • nanosecond = 11.8 inches
  • microsecond = 984 feet
  • millisecond = 186 miles
  • second = 186,000 miles
  • nanosecond = 30 centimeters (300 millimeters)
  • microsecond = 300 Meters
  • millisecond = 300,000 Meters
  • second = 300,000,000 Meters

Audio (at 44.1 kHz 16 kHz stereo)

  • nanosecond =  .000044 samples
  • microsecond = .044 samples 
  • millisecond = 44.1 samples
  • second = 44,100 samples
1 sample = 22.67573 microseconds.

speed of sound (in air)

  • 340 m/s
  • 761 mph

How long does it take sound to travel 10 meters?

(sound travels 1 meter in 2.9 ms) 

Cesium FAQ

By Randal Nelson

https://www.cs.rochester.edu/~nelson/cesium/cesium_faq.html

  • 9193 MHz hyperfine transition
  • 99.9% pure Cesium metal has a street value of $161.10 per gram
  • used as a getter in vacuum systems due to its high affinity for oxygen
  • clocks are accurate to better than one second in a million years
  • The richest known deposit occurs at Bernic Lake Manitoba
  •  Atomic number 55, Cesium is the heaviest of the natural alkali metals
  • It melts at 28.4 C (84 F), just below body heat, and boils at 669.3 C