- use the Source
Sound design tutorials
(part 4 section III)

Page contains some sound design tutorials in PureData.

Sponsored by the number 1.844674e+19

Electric Motors

Motor sounds are essential for all types of machine noises, sliding spaceship doors, drills, killer robots and much more. There are many motor designs, some use AC electricity, some use DC, some have a rotor that surrounds a stationary core, some are normal axle motors, some work on 3 phase power, some have brush contacts, others do not. We will consider only one kind of motor but we will try to make our generic motor sound be able to produce a wide range of effects like other designs too. Let's quickly look at the operational theory. The rotor is the bit that spins, it's usually in the middle and connected to an axle. It has a coil wound around it and so is often the heaviest component. The stator, that's the outside bit that stays still is a cylinder of permanent magnets or coils. The rotor is held in the middle by an axle fixed by two plates, the dimes, one at each end, which usually have some kind of bearing to lubricate the axle. The typical DC motor works by having two or more brushes which conduct power to the rotor coil through a broken, slotted ring called the comutator. Lastly the motor has some kind of housing or frame which will resonate.

We don't need to go into a lot of detail about the physics and electromagnetic theory here, we know what happens, power is applied and it spins. But the mechanics are worth a few words. In a DC motor the brushes make contact with the comutator, at least twice and sometimes many more times per revolution. Each time this happens we hear a little click. The click may be due to the brush moving over different materials, first a metal conductor then an insulator, then a conductor again. Sometimes ridges on the comutator move the brush in and out slightly as it rotates. Another source of clicking sounds in DC motors are sparks that happen between the comutator and brush, as it disconnects from the coil a back EMF due to the coils inductance makes a high voltage.

While the rotor is spinning it makes some other sounds. Even a near perfect motor isn't completely balanced and has some slight eccentricity to the spin which will produce a fairly sinewave like vibration in the housing. Some friction in the bearings may cause a regular squealing sound too. But by far the most prominent noise is due to the way forces are shifted as the motor revolves. A DC motor moves in pulses, usually two per cycle, it's angular motion, or more correctly the torque on the rotor accelerates and then collapses as the current is applied then disconnected by the comutator. This makes a quite different sound from a brushless AC motor which applies a constant rotational force to the rotor and is much quieter.


Materially, the important components of a motor sound are usually metallic. Motors with plastic parts are common in low power toys and gizmos, but not in killer robots or spaceships. When constructing a synthesiser for a machine we need to remember that much of the vibrations and sound happen because the motor is connected physically to some mounting or other material. A motor held freely in the air or mounted with a well damped rubber grommet makes far less noise. Therefore we need to stick to our holistic physical approach if building a complex machine by coupling some of the sound from the motor housing to other parts of the overall design to get a coherence in the sounds.

Control code

The speed of a motor is a very important feature of its sound. Because the rotor is heavy its mass means it takes a while to build up angular velocity, the lighter and smaller the motor the faster this usually happens. A big heavy motor, or one under a lot of load will take longer. However in all cases we observe a certain shape. When the motor is spinning slowly a big current flows through it and its torque is very high. Its angular acceleration is high at this point. After a while it reaches an optimal speed, even when not loaded, where it won't spin any faster. As it approaches this point the torque and the change in angular velocity decreases and flattens off at the motors top speed. When the power is removed the decay in speed is almost perfectly linear since only friction and load, which are constants, act against it.


Let's start with a couple of control level units then build the brushes and a resonator that give us the clicking sound. What shall we use as our input parameter? Voltage or current? That would be nice for a thorough design that let us specify the physics of the motor in detail, but we also have unknown factors like the load to account for. Let's just model the speed directly as a practical compromise. From the above description of how the speed changes the most obvious envelope generator for the job is [ead~]. Again this very useful unit crops up, exponential curves are found in so many natural phenomena. We will apply the output of the envelope to a [phasor~]. We need to choose a scale, and most motors are specified in RPM. To get Hz from RPM we just divide by 60, so a motor that spins up to 30,000 RPM will give us a signal of around 500Hz.

The phasor on its own is much too pitched, it's not unlike the police siren sound we made in the very first exercises of the tutorials. We want a sharper more clicking sound. As usual we shape the decay of each phasor cycle by taking its square or higher power, in this case the 4th seems fine.  By mixing a little bit of a constant against the noise with [sig~] we can get a mixture of noisy clicking sounds for the brushes and a more pitched sound for the rotor spinning. We need to modulate the final amplitude by the envelope too, since theres no knowing at which phase the phasor will stop and it can end up just passing the noise signal through and leaving the patch making a hissing sound when the motor has stopped spinning. The audio example demonstrates the brushes, then the rotor mixed in, and then a change of speed and duration.


Audio .mp3   Puredata file .pd

Metalic clicking

The noise source is much too wide in spectrum, so lets use a few filters to bash it into a more banded metallic spectrum.The result now is getting better. On it's own it represents what the brushes on the comutator might sound like up very close. 


FM as resonance

We need to model the body of the motor now, the effect that each pulse of rotational force has on the metal stator and housing. I'm going to use a bit of FM to get a cluster of sidebands. If we were to feed the phasor into a [cos~] function we would get a sinewave output, but that's much too clean. Instead lets modulate the carrier signal with another signal at a few hundred Hz to get a metal ringing sound. Normally we use FM by changing the modulator and modulation index to affect the sidebands in a signal. In this patch we doing something more unusual. The index and modulation frequency stay fixed while the carrier signal, our rotor sound, moves up and down. What we get is an effect that we hear in engines and motors quite a lot, as the speed hits certain frequencies it sets the body frame resonating, causing higher frequency sounds like rattling to happen, but as it moves past this resonant peak the rattle fades out. There are usually many points at which a resonant peak occurs so as the motor speeds up or slows down we hear these undulations of tone coming and going in slow waves. To make it work well we need to carefully control the spectrum of the carrier signal so I've added a filter. It's a [vcf~] because we have an audio rate signal to use as our center frequency parameter. This makes a bandpass which tracks the rotor pulses up and down and restricts the range of harmonics getting to the FM section, and hence the sidebands produced. The clip unit is something I found useful too. By clipping the rotor we can get more odd harmonics. We named this control fader "hardness" as it changes how hollow or solid the sound seems. Using a combination of "resonance", "hardness" and "harmonics" controls a very wide range of apparent body sizes and tones can be achieved. The last change to this stage is to add a [sqrt~] unit to the amplitude modulator, it makes the sound louder at low speeds so we get a more even volume. Notice also that the patch is less clttered by subpatching the metalic filters for the brush sound. The audio example demonstrates some different settings of  resonance and harmonics.


Audio .mp3   Puredata file .pd

Finally we want a slightly less brash and heavy sound, the loudness of the motor increases too much with its speed and it sounds much too bright at high speeds. A gentle resonant filter after the FM process helps to create the more mellow sound , it acts like a housing for our motor. Notice that I changed the frequency scaling immediately after the [ead~] unit to do this, there is an extra [*~ 0.125] just before the phasor. One very last thing to improve the range of effects is to modify the metallic noise source so we can change the size of the brush-comutator sound a bit. That gives us nine controls in total.

Subpatching the whole motor

With the controls we have we can make a nice range of motor sounds based on easy to understand parameters. But theres rather a lot of them and the patch looks quite ugly. Many machines we will want to make have more than one motor sound to them so it makes sense to condense the DSP code into a little subpatch called "motor". Instead of having lots of inlets I've opted to use the pack-unpack method which creates a list of parameters we can unpack and distribute to each object. A useful trick when doing this in Puredata is to highlight each connection in turn as you wire up the unpack unit, it helps you keep track of which connection is going where as you move your eye down the diagram.


Creating unique motors

Here is how we might go about using our motor patch. The control sliders we had in the previous versions have been pulled out of the subpatch and now make a "programmer". A pack unit combines all the slider settings into a single list. Notice the required trigger unit to make sure the list is rebuilt each time a slider moves. Using the "set" command in a message with dollar substitutions lets us store the good settings we discover in a new message as a list. This is the simplest form of "patch memory" we can make in Puredata. When you get settings you like just copy the message containing the numbers to use later. 


  Puredata file .pd

Improvements and variations

A motor sound is generally doing one of three things, starting (speeding up), running at constant speed, or stopping (slowing down). All those bits are built into our design using the [ead~] envelope already. There is a special case for 3 phase squirrel cage motors which make an interesting sound when they are first switched on, a powerful whining and humming sound as a large current flows to build up the magnetic field while it is not moving. With robotics we actually use stepper motors which move in clicks at a more regular rate, the sounds we hear tend to come from gearbox cogs more than the motor itself. A gearbox with a positive ratio can be achieved quite effectively by using a frequency doubler or harmoniser to multiply the motor sound pitch by some factor. Alternatively we could do it more efficiently by running the fundamental motor phasor at a higher rate and dividing down the signal to get wavecycles at subfrequencies, something we will look at in another section. As always it's a good idea to add a [switch~] unit to control CPU usage, so the motors used in the following example piece have been modified.

Killer Robots

A bunch of motors and a simple sequencer make a more complete scene.  Note the wide range of sounds we can obtain with this patch. I haven't really stretched the use of parameters at all so have a play with the programmer patch yourself and see what kind of weird motor like sounds you can get.


Audio .mp3   Puredata file .pd


continue to the NEXT SECTION  or back to the tutorials list  or  main page
FSF Europe  GNU   Debian   Slack