# How does an electrical speaker determine amplitude and frequency? [closed]

So, I know that a DAC converts coded binary signals into analog signals, but what sort of thing determines the pitch and amplitude of the outgoing sound?

Does the DAC use a clock for frequency and an amp for sound?

Furthermore is the protocol we use to communicate with the speaker: standardized or does every DAC use a proprietary method?

If its standardized: can you teach me [the machine code signal protocol for the audio and ways to manipulate it to do my bidding]?

Thank you for your time, I just wanna be able to play with audio, and I'm an enthusiast and a hobbyist but have very little experience

Starting over:

If digital electronics can only vary the pulse-width of their ones and zeroes, how can they ever hope to send amplitude data to a speaker?

It's obviously more complicated than one signal, because it would be multitone singular-volume, so it must have parallel channels, and a way of requesting amplification, right?

How are some ways this is achieved?

## closed as unclear what you're asking by Chris Stratton, Scott Seidman, Voltage Spike, Bruce Abbott, R DrastJul 10 '18 at 10:13

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• Protocol? I guess you could call a speaker's electrical to acoustical transfer function that, but it would be unusual. There doesn't seem to be an actual engineering question here, more a search for endorsement for oddball ideas, which you will not receive. – Chris Stratton Jul 10 '18 at 0:40
• Get Audacity.exe (free) and explore it. I can't imagine what you cannot do with audio using Audacity ( except speech recognition) – Sunnyskyguy EE75 Jul 10 '18 at 0:58
• Pitch and amplitude are not actually part of the signal, they're ways of analyzing the signal. It's like "I know my legs convert thoughts into movement, but how do they know if I'm going to the bathroom or the kitchen?" - quite simply they don't. – immibis Jul 10 '18 at 0:58
• The protocol is yt = Amplitude * sin(2 * Pi * f * C) – Brian Moreau Jul 10 '18 at 12:20

Pitch and amplitude are not actually part of the signal as the DAC or the speaker sees it. They're things you work out by analyzing the signal. The actual signal is just how far you want the speaker to move at any given moment. It's the opposite of what a microphone does, we just want the speaker to re-create the same vibrations that the microphone saw when we recorded the signal.

The "instructions" that you send to the DAC are just how high of a voltage you want it to output at that particular moment - which translates into how far the speaker moves. You can tell it to output 2 volts, then half a millisecond later you can tell it to output 2.1 volts, then half a millisecond later you can tell it to output 2.2 volts. Each of these is called a sample.

Asking how the DAC knows about pitch and amplitude is a bit like asking "I know my legs convert thoughts into movement, but how do they know if I'm going to the bathroom or the kitchen?". Quite simply it doesn't know or care.

Does the DAC use a clock for frequency and an amp for sound?

Not all DACs need a clock - often you can output a new sample whenever you like. For simplicity we generally pick a sample frequency and stick to it though. A higher sample frequency always makes the sound more accurate. Some widely accepted standard values are 44100 Hz (44100 evenly spaced samples per second) and 48000 Hz, but if it's your hardware you can do what you like.

There isn't always a power amplifier involved; it depends how loud you need the sound to be.

Furthermore is the protocol we use to communicate with the speaker: standardized or does every DAC use a proprietary method?

It depends on the DAC. Some are parallel DACs, which means (for example) you can write out an 8-bit binary number on 8 separate wires connected to the DAC. Some of them use serial protocols like I2C or SPI or I2S. None of them should be very complicated. Check the datasheet for your DAC.

It's worth nothing you can also build your own parallel DAC with a resistor network and an op-amp.

If its standardized: can you teach me [the machine code signal protocol for the audio and ways to manipulate it to do my bidding]?

It's not machine code.

For how to send samples to the DAC - check the datasheet for your DAC.

For how to generate samples, it's too broad to cover here unless you know what you want to generate. For a start, try playing back a microphone recording, or try sine waves with different frequencies.

• Very helpful thank you. I knew I had misconceptions, but I couldn't get rid of them myself without not having them in the first place, hence why I asked. – user179283 Jul 10 '18 at 1:22
• Yeah, I see what your saying. I feel like "🤦‍♂️" a speaker is just a solonoid motor on a drum🤦‍♂️!!! So frequency doesn't exist to it, just force and interval, right? – user179283 Jul 10 '18 at 1:25
• So, how does it get louder without getting higher pitch? Wouldn't more energy make it faster and higher pitch, not louder? Or .... what am I missing? ------------- is the speed of the diaphram expansion per pulse constant with varying torque dependent on voltage? Because otherwise a speaker wouldn't get louder it would just reach it's destination faster and get all distorted sounding and chipmunky – user179283 Jul 10 '18 at 1:30
• I just got up, and I'm having trouble gathering my thoughts cos there's noise in the background and I'm very frustrated with myself, sorry – user179283 Jul 10 '18 at 1:31
• @user179283 Yes, if you want a louder sound you need a bigger speaker that can travel farther (which pushes the air more) or it will get to the ends of its travel and cause distortion. – immibis Jul 10 '18 at 2:21

So, how does it get louder without getting higher pitch? Wouldn't more energy make it faster and higher pitch, not louder? Or .... what am I missing? ------------- is the speed of the diaphragm expansion per pulse constant with varying torque dependent on voltage? Because otherwise a speaker wouldn't get louder it would just reach it's destination faster and get all distorted sounding and chipmunky (sic)?

You are missing some basic physics. Pitch is the frequency of oscillation of a sound wave. Volume is the amplitude (size) of the oscillation.

A microphone converts sound pressure waves into an analogous signal. That means the voltage waveform will vary in proportion to the instantaneous sound pressure. The electrical signal can be amplified to drive a loudspeaker directly or it may be sampled and stored digitally at a rate high enough to give enough fidelity when converted to analog again.

A loudspeaker converts (a higher powered) electrical waveform to sound. Again, this is an analog conversion. The pitch is the frequency of oscillation of the electrcial signal and the resultant sound wave. Volume is the amplitude (size) of the oscillation.

Get a frequency generator app for your phone, plug it into your amplifier and put your fingers lightly on the speaker cone as you vary pitch and volume. You might get best touch results at low frequencies.

If digital electronics can only vary the pulse-width of their ones and zeroes, how can they ever hope to send amplitude data to a speaker?

Pulse-width modulation with low-pass filtering allows any voltage to be recreated between minimum and maximum output voltage of the amplifier.

Figure 1. A PWM amplifier output reproduction of a sinewave. Source: Vanatoo.

It should be clear from the image above that to reproduce the sinewave at full volume the PWM needs to vary from clost to 0% to 100%. To reproduce the sinewave at 40% volume the PWM would be limited to 30% to 70% modulation.

It's obviously more complicated than one signal, because it would be multitone singular-volume, so it must have parallel channels, and a way of requesting amplification, right?

I don't know what you mean by "multitone singular-volume" but I'll assume that you mean broad-spectrum sound such as music or speech. All sound impinging on your ear is the instantaneous sum of sound pressure waves so to recreate this waveform we need to PWM at sufficiently high frequency to be able to generate the highest frequencies of interest. There is no "requesting amplification". We just reproduce the original waveform as best as the chosen hardware allows.

... so you would only be able to control pulse-width was my thinking, unless you had a DAC, and a way to tell it it produce more voltage per pulse?

The point of PWM is that you can do DAC simply with an on-off digital output and low-pass filter. The filtered output voltage is simply proportional to the pulse width.

There is however, a such thing as: 00001111 or 010101010, the first being low frequency and the second being high frequency, although, again, there's no change in amplitude, not via digital signal alone.

No, this is incorrect.

• The binary values determine the PWM pulse width.
• '00001111' = decimal 31. On an 8-bit (256 steps) system this would result in a pulse width of 31/256 = 12.1% pulse width. On a 5 V digital system this would result in an average voltage of 0.605 V.
• '10101010' = decimal 170. On the 8-bit system the pulse width would then be 170/256 = 66.4% and the average voltage would be 3.32 V.

The data is stored in bytes or words. These bytes or words are converted to pulse widths by the controller hardware. The pulse widths determine the average voltage. By updating fast enough we can reproduce a high-fidelity version of the original analog signal.

• Well, yeah, but digital outputs at a constant voltage, so you would only be able to control pulse-width was my thinking, unless you had a DAC, and a way to tell it it produce more voltage per pulse? – user179283 Jul 14 '18 at 6:53
• See the update. – Transistor Jul 14 '18 at 8:56
• By "multitone singular volume" I mean there's no such thing as a BIG one or a BIG zero, nor a such thing as a little one or a little zero. There is however, a such thing as: 00001111 or 010101010, the first being low frequency and the second being high frequency, although, again, there's no change in amplitude, not via digital signal alone – user179283 Jul 14 '18 at 10:18
• Do you not understand my answer? The patterns you are describing are converted into pulse width and that determines the filtered analog output voltage, yes, by digital signal alone. – Transistor Jul 14 '18 at 10:23
• So, lemme see if I understand what your saying: you're saying that all output is at the maximum volume, but that it varies intensity by varying the duration, and spacing out packets of back-and-forth frequencies, and by putting the frequency packets farther apart it creates and illusion of quietness? I thought it would just move the speaker head/drum/diaphram/thingy less far per pulse to give it less intensity somehow... so it's like those touchable "starwars" holograms the ones with the lasers; in that the intensity of the beam never changes bu the duration of your exposure to that in.... – user179283 Jul 14 '18 at 10:33