Waves

What if we want to graph the pressure changes in air made by somebody playing the flute? The graph might look a bit like this:

The vertical axis is pressure and the horizontal axis is time. We can see the pressure increase, decease and increase again. The idealised wave form shown here is a sine wave. This wave has exactly one frequency in it and is the simplest possible wave form.

If you generate a sine wave in your DAW and then zoom way in, you’ll see exactly the same shape, but in that case, the Y axis is how much the speaker cone will offset when we play back the sound. This makes sense. The speaker needs to push the air to make the sound wave. If we were looking at an analogue signal to the speaker via an oscilloscope, the Y axis would be the amount of voltage.

If the wave is taller, the speaker moves more air and the sound is louder. The height of the wave is the amplitude.

The distance from one peak to another, λ, is the wavelength. If the wavelength is shorter, the speaker cone moves faster. A faster movement and a shorter wavelength means a higher frequency.

We’ve measured from the peaks, but we could measure from any point along the curve, for instance, from the zero crossings, as long as the wave has been through a complete cycle.

If waves start at different points but have the same wavelength, we say they are the same frequency but have different phases. In figure 3, the red line starts at zero and is a sine wave. The blue line starts at 1 and is a cosine wave. They both are the same frequency.

We have the unit circle (with radius = 1) in green, placed at the origin at the bottom right.

In the middle of this circle, in yellow, is represented the angle theta (θ). This angle is the amount of counter-clockwise rotation around the circle starting from the right, on the x-axis, as illustrated. An exact copy of this little angle is shown at the top right, as a visual illustration of the definition of θ.

At this angle, and starting at the origin, a (faint) green line is traced outwards, radially. This line intersects the unit circle at a single point, which is the green point spinning around at a constant rate as the angle θ changes, also at a constant rate.

The vertical position of this point is projected straight (along the faint red line) onto the graph on the left of the circle. This results in the red point. The y-coordinate of this red point (the same as the y-coordinate of the green point) is the value of the sine function evaluated at the angle θ, that is:

    y coordinate of green point = sin θ

As the angle θ changes, the red point moves up and down, tracing the red graph. This is the graph for the sine function. The faint vertical lines seen passing to the left are marking every quadrant along the circle, that is, at every angle of 90° or π/2 radians. Notice how the sine curve goes from 1, to zero, to -1, then back to zero, at exactly these lines. This is reflecting the fact sin(0) = 0, sin(π/2) =1, sin(π) = 0 and sin(3π/ 2) -1

A similar process is done with the x-coordinate of the green point. However, since the x-coordinate is tilted from the usual convention to plot graphs (where y = f(x), with y vertical and x horizontal), an “untilt” operation was performed in order to repeat the process again in the same orientation, instead of vertically. This was represented by a “bend”, seen on the top right.

Again, the green point is projected upwards (along the faint blue line) and this “bent” projection ends up in the top graph’s rightmost edge, at the blue point. The y-coordinate of this blue point (which, due to the “bend” in the projection, is the same as the x-coordinate of the green point) is the value of the cosine function evaluated at the angle θ, that is:

    x coordinate of green point = cos θ

The blue curve traced by this point, as it moves up and down with changing θ, is the the graph of the cosine function. Notice again how it behaves at it crosses every quadrant, reflecting the fact cos(0) = 1, cos(π/2) = 0, cos(π) = -1 and cos(3π/2) = 0.
Figure 4: Sine and Cosine wave by Lucas Vieira, Public domain, via Wikimedia Commons

In figure 4, we can see an animation of the cosine and sine wave moving at the same frequency and how they are related to each other.

Summary

In the last three posts, we learned that sound is made up of tiny pressure waves which travel at 340 m/s. When these strike our ear drums, this in turn causes our basilar membrane to vibrate. Distinct vibrations on the membrane are heard as distinct frequencies.

We can graph the pressure waves of the sound. This is the same as the waveform graph in our DAW and is the same as the change in voltage of the signal going to our speakers. All signals going to our speakers have an amplitude, where taller is louder. Periodic sounds, like sine waves, also have a frequency, where a shorter wave length is a faster vibration and a higher pitch.

Waves can have the same frequency but be out of phase with each other, so their peaks and troughs do not line up.

Supplementary Reading

Everest, F.A. and Pohlmann, K.C. (2015). Master Handbook of Acoustics. Sixth edition. New York: McGraw-Hill Education. – Chapter 1

Activity

Materials

  • Audacity
  • Sonic Visualiser
  • A Microphone
  • An audio interface (or other way to get microphone input into your computer.)
  • A quiet corridor with a wall some meters distant
  • A tape measure
  • Optional: a room thermometer

Method

Place your microphone so it points at the wall. Start recording into Audacity. Stand behind the microphone. Clap. Stop recording.

Check your recording. You should have two impulses on the recording. One is the loud clap and the second is the echo of the clap. If these are too close together, move further from the wall.

Once you have a clean recording, export it as a WAV file and open it in Sonic Visualiser. Use the tape measure to measure how far you are from the wall.

Listen for when the first echo appears, and see if you can measure the distance in milliseconds using the display.

You might need to experiment a bit with the zoom controls, and possible other controls in Sonic Visualiser to make it clearer to see where the echo appears.

Also, it won’t necessarily be an exact point, so you may have to use your judgement.

Remember that the sound has to travel to the wall and back, so the total distance is double what you measured.

What was the speed of the sound. Is it what you expected? If you were able to measure the temperature, how much impact did that have on the speed?

Your Ear / Your Hearing

What’s happening in your ear? The outer ear, the pinna, helps you collect sound and holds your piercings, but the more interesting stuff, from a hearing perspective, is down the canal.

Sound waves hit our tympanic membrane, which is to say, our ear drum. Three tiny bones, the smallest in our bodies, the malleus, the incus and the stapes, transmit the movements of the ear drum to an oval window. The oval window is attached to the inner ear, which is a rigid structure. The stapes pushes on the window, moving fluid inside the inner ear. Below the oval window is a round window. As the oval window is pushed in, the round window bulges out. This allows the fluid to move, as liquids are much less compressible than air.

This whole structure of the ear drum, the little bones and the window, take a movement in air and turn it into a movement in liquid.

This liquid moves inside the cochlea, a snail shaped part of our ear. Inside that is the basilar membrane. This part of your ear is covered with tiny cells, called hair cells that wiggle in response to sound. The part of the membrane closest to the oval window responds to high frequency sounds, where the part furthest away responds to low frequency sounds.

When you hear a high frequency sound, the hair cells close to the oval window wiggle and send nerve signals to your brain. When you hear a low frequency sound, the hair cells further from the window are wiggling. These hair cells are fragile and can break in response to loud sounds. When they do break, they do not grow back. If you listen to ear buds too loudly, you can break these cells and your hearing will not come back. The hair cells closest to the ear drum are high frequencies and people tend to loose high frequency hearing first. When babies are born, their hearing is so sensitive that the lower threshold is just above individual air molecules hitting the tympanic membrane. People’s hearing gets worse from environmental factors including infections and exposure to loud sounds, but not from age. Wear protection to loud concerts and turn down your headphones to preserve your hearing.

When you are listening to two different frequencies, two different parts of your basilar membrane will wiggle. If those frequencies are far apart, you can hear each one individually. However, if the frequencies are close together, the parts of the basilar membrane that are wiggling can start to overlap. In this case, sometimes one sound can mask another, so we can’t hear both.

Image Sources:

Medical gallery of Blausen Medical 2014 (2014). WikiJournal of Medicine [Online] 1. Available at: https://en.wikiversity.org/wiki/WikiJournal_of_Medicine/Medical_gallery_of_Blausen_Medical_2014 [Accessed: 10 April 2024].

Further reading / watching:

Auditory Transduction (2002) (2009). [Online]. 6:43. Available at: https://www.youtube.com/watch?v=PeTriGTENoc [Accessed: 10 April 2024].

The Science of Sound

I’m not teaching any more, but I don’t want to just bin a decade worth’s of lecture notes, so here’s part of the first lecture tech students get in their first week of university:

To talk about sound, we must first talk about air. This is made up of about 78% nitrogen, 21% oxygen and various other gases. At 20 degrees Celsius (that is, room temperature), each air molecule is moving all the time at 500 metres per second. They are constantly colliding with each other and with anything in their path.

If a football hit you at 500 m/s, you’d be in trouble, but air molecules are tiny. Force = mass* acceleration. The force of a football is huge in comparison to a single nitrogen atom. But if you pump a lot of air into a tyre, say 6 bar (87 psi), the force of all the colliding air molecules will make the tyre very stiff. At sea level, the pressure of the atmosphere is about 1.03 bars (14.7 psi).

So how does sound propagate in air? Let’s say Adam Kryński hits his Bodhrán with a stick.

This causes the drum membrane to move very suddenly. He pushes the membrane and, on the other side of the drum, the membrane pushes on all the air molecules. They get packed in together. This creates a band of high pressure, that starts at the drum and moves outwards. All the molecules are moving at 500 m/s. But they’re not all going in the same direction. Some are going away from the drum, but some are going sideways or backwards. They’re all crowded though, and colliding into the molecules around them, so that wave of intense collisions, the high pressure wave, is moving away from the drum at 340 m/s, at room temperature.

If we were in Death Valley when it was 20 degrees out, the air pressure would be higher, so there would be more collisions. However, the air molecules would still be moving at their normal speed, so the pressure wave would still move at 340 m/s. If we were on Mount Everest at 20 degrees, there would be fewer collisions, but the speed would still be the same.

However, at 30 degrees, air moves faster, so sound moves faster. And at 10 degrees, air is slower so sound is slower.

Kryński’s drum head has creates a high pressure wave when it moved from being hit, but it doesn’t stay in that position. The drum head snaps back in the other direction, passing it’s mid point. This movement backwards creates a space where there are fewer air molecules. A low pressure wave follows the high one, moving at the same speed.

The head, still out of place snaps back forwards again, creating another, smaller, pressure wave and then another smaller wave of low pressure.

We can see a simulation of this drum head via Falstad.

Alternating light and dark lines fan out from the top of the image towards the bottom.
Figure 2: A ripple tank simulation of a vibrating plane with a short wall on either side, generated via Falstad

You can see the high and low pressure waves. In this simulation, the drum head vibrates forever, but it does give you an idea of the sound waves moving away from the drum.

These sound waves might reach your ear. But what is the amount of pressure change that your ear is actually perceiving? At sea level, the pressure of the atmosphere is 101.3 kilo pascals. The pressure change created by sound waves is in micro pascals, a tiny amount. It’s possible for air pressure to vary by more than that. A 1% change in pressure travelling at the speed of sound is, essentially, an explosion that can knock over a building. Atmospheric pressure, such as high and low pressure fronts you hear about in the weather forecast, has big variances relative to sound, but these changes happen very slowly.

Live-Blogging Dorkbot #2

More #Dorkbot
Kooman Samani

Lovotocs = Love + Robotics

This came out of social robots.
Western dualism includes both body and mind but also emotion and reason. This is falling out of favour towards monoism.

Love is covered by psychology philosophy etc.

Robots: industrial, service, social, and love?

There is a risk of the uncanny valley. Creepiness is also cultural. He decided to go for an abstract design and a simple looking interface.

Most people don’t think they could love a robot but are fine with robots loving them.

This project was fed by robots and AI but also by psychology.

Why do we fall in love? Repeat exposure is a factor.

His AI system emulated an endocrine system.

The state of the robot depends on the previous state, the endocrine emulation and the input.

This is slightly problematic … Like, one of the persistent problems in both AI and robots is that people want to assume emotion from the machine and this is just encouraging that.

Live-Blogging Dorkbot #1

Sarah Angliss wrote an opera. She did composition and sound design. She had to learn to write for other people and make everything reliable.

Fifteen years ago she went to the Hunter Museum in London, including a skeleton of Charles Burn, who did not want his skeleton exhibited. His body was stolen after his death by Hunter. Her opera was about Burn. She spent seven years writing the opera, during which time the Hunter museum responded to pressure and removed the display.

Some of the instruments in the opera are her robots, including a carillon. She also used theremin. But mostly 18th century instruments used in weird ways.

Theatre uses some software called Q Lab.

She’s got a live looping device that does subtle weird stretching. There are several loop points on the phrase.

She got really into 1969s spectralism. Her stuff is based on the nightingale. The problem with mapping an FFT to a violin is that violins also have spectrums. She wrote software to take into account the violin’s spectrum. IRCAM’s software OrkIdea does this well.

Obituary for Edward Hutchins

Edward Hutchins passed away on June 19th at the age of 83 in McKinney, TX, after a short illness.

Ed was born to Esther and Bert in St Louis, MO, in 1939, but the family soon relocated to Phoenix, AZ. After a brief stint at Arizona State, Ed joined the Army and was stationed in Alaska and then San Francisco. After being discharged, he earned a Bachelor and Masters degree in Electrical Engineering from Santa Clara University. In 1974, he married Eileen Forge and they raised two children in Cupertino, CA.

Ed worked as a chip designer at several Silicon Valley companies, including AMI, Chips and Technologies, IDT and SST. After retiring, he travelled the country on a motorcycle for two years with his tour ending in Vancouver, WA, where he became an avid square dancer with partner Elsie Bartling. He moved to Texas during the pandemic to be closer to his son and grandson.

Ed is predeceased by his parents and his wife Eileen. He is survived by his sons Charles and Edward Paul Jr and grandson William.

Funeral services were be held at St Joseph of Cupertino on August 14 at 1pm. Interment was the following day at Gate of Heaven Cemetery at 10am.

Shiva

My dad’s funeral is delayed for a few weeks due to logistics reasons. So, going out of order, I’ll be sitting shiva in London Tuesday and Wednesday of this week. Please email, text or signal for my address. I have very recently moved house.

A friend suggested I also do an online session. I am considering logistics and will post further details if I go ahead with that.

Graphic Notation Teaching Tool

This is designed for students with no experience of improvising. The idea is to start with just having one note and dots. Then dots and flat lines. Then gradually adding more notes.

It’s meant to fir the window width, so you may need to scroll sideways if you’re looking at this page with a sidebar.

Your browser does not support the HTML5 canvas tag.
<form id="formElem">
  <label for "notes">Notes:</label>
  <input type="text" name="notes" id="notes" value="C, G">
  
  <label for "dots">Dots:</label>
  <input type="checkbox" id="dots" name="dots" value="1" checked>
  
   <label for="lines">Lines:</label>
<select name="lines" id="lines">
  <option value="0">None</option>
  <option value="1">Flat</option>
  <option value="2">Sloped</option>
</select> 
  <label for "circles">Circles:</label>
  <input type="checkbox" id="circles" name="circles" value="1">

  <input type="submit">
</form>
<canvas height="310" id="canvas_images" style="border: 1px solid #d3d3d3;" width="1280">
    Your browser does not support the HTML5 canvas tag.</canvas>

<script>  
  
  function drawCircle(ctx, x, y, radius, fill, stroke, strokeWidth) {
  	ctx.beginPath()
  	ctx.arc(x, y, radius, 0, 2 * Math.PI, false)
  	if (fill) {
    	ctx.fillStyle = fill
    	ctx.fill()
  	}
  	if (stroke) {
    	ctx.lineWidth = strokeWidth
    	ctx.strokeStyle = stroke
    	ctx.stroke()
  	}
	}
	
	function scoreCircle(ctx, x, y, radius, fill) {}
  
  function drawDot(ctx, x,y) {
    var dots = document.getElementById("dots").value;
    
    if (dots ==0) {
      return false;
    }
    drawCircle(ctx, x, y, 5, 'black', 'black', 2);
    return true;
  }
  
  function drawLine(ctx, x1, y1, x2, y2) {
    ctx.strokeStyle = 'black';
    ctx.lineWidth = 5;

    // draw a red line
    ctx.beginPath();
    ctx.moveTo(x1, y1);
    ctx.lineTo(x2, y2);
    ctx.stroke();
  }
  
  
  function scoreLine(ctx, x1, y1, x2, height) {
  
    var lines = document.getElementById("lines").value;
    if( lines == 0) {
      return false;
    }
    
    if( lines == 1) {
    
      drawLine(ctx, x1, y1, x2, y1);
    } else {
  
      var slopes = [-1, 1, 0, 0, 0, 0, 0]
      var diagonal = slopes[Math.floor(Math.random()*slopes.length)]
  
      if (diagonal != 0) {
        x2 = x2 + height;
      }
    
      var y2 = y1 + (height * diagonal);
      drawLine(ctx, x1, y1, x2, y2);
    }
    
    return true;
  }


  function pickItem(ctx, x1, y1, x2, height, radius, fill) {
  
    index = Math.floor(Math.random() * options.length);
    switch (options[index]) {
      case 0:
        drawDot(ctx, x1, y1);
        break;
      case 1:
        scoreLine(ctx, x1, y1, x2, height);
        break;
      case 3:
        scoreCircle(ctx, x, y, radius, fill);
        break;
      }
  }
  
  
  function drawScore(ctx, staves, dots, lines, circles){
    var canvas_width = ctx.canvas.clientWidth;
		var canvas_height = ctx.canvas.clientHeight;
    var height = 0;
    var stave_height = Math.floor(canvas_height / ( staves + 1));
    var num_items;
  
    var range = canvas_width / 20;
    
   
		
		
    for (let i = 0; i < staves; i++) {
  		num_items = Math.floor(Math.random() * 5) + 5;
      height += stave_height;
      //drawDot(ctx, Math.floor(Math.random * canvas_width), height);
      for(let j=0; j < num_items; j++) {
        //  pickItem(ctx, x1, y1, x2, height, radius, fill)
     		//drawDot(ctx, Math.floor(Math.random() * canvas_width), height);
     		var x1 = Math.floor(Math.random() * canvas_width);
     		var x2 = x1 + Math.floor(Math.random() * range) + 20;
     		var radius = Math.floor((Math.random() * (stave_height / 2)) + (stave_height / 2));
     		pickItem(ctx, x1, height, x2, stave_height, radius , Math.floor(Math.random()  * 2));
      }
		} 
  }
  
  function parseForm(ctx) {
     ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
     
    var allnotes = document.getElementById("notes").value;
    context.fillText(allnotes, 30, 60);
    var notes = allnotes.split(",");
    
    options = [];
    
    //var dots = document.getElementById("dots").value;
    //console.log(dots);
    if (document.getElementById("dots").checked) {
      options.push(0);
    }
    var lines = document.getElementById("lines").value;
    if( lines != 0) {
      options.push(1);
    }
    
   var circles = document.getElementById("circles").value;
    if( circles != 0) {
      options.push(2);
    }
    
    console.log(options);
    
    if (options.length > 0 ) {
      drawScore(ctx, notes.length, 1, 0, 0, 0);
    }
  }
  

    var c = document.getElementById("canvas_images");
    c.width = 0.99 * window.screen.availWidth; 
    c.height = Math.max(c.height, 0.4 * window.screen.availHeight);
    var context = c.getContext("2d");
    //var numGlyphs = Math.floor((Math.random() * 3) + 1) + 1;
    //var blob = new Image();
    //var x, y;

    context.font = "300% Bravura";
    //blob.src = "https://farm8.staticflickr.com/7322/9736783860_4c2706d4ef_m.jpg"
    //blob.onload = function() {
    //    context.drawImage(blob, 0, 0);
    //    for (var i = 0; i < numGlyphs; i++) {
    //        x = Math.floor((Math.random() * i * 50) + 1) + 5;
    //        y = Math.floor((Math.random() * 205) + 1) + 7;
    //        //1f49b
    //        context.fillText("<3", x, y);
    //    };

    //};
    //context.fillText("<3", 100, 100);
    
    //drawScore(context, 1, 1, 0, 0);
    
    var options = [];
    
    parseForm(context);
    
    formElem.onsubmit = async (e) => {
    	e.preventDefault();
			parseForm(context);
    }

</script>