# Logic analyzer gives me much more pulses than expected

Let me start the question by saying that I am using a logic analyzer for the first time, so I am probably doing something wrong.

I sniffed the signal that goes to a speaker. The signal is probably PWM. My goal was to figure out each note's pulse width.

Keep in mind that the whole sequence lasts around 20 seconds and the notes change around 25 times.

In my mind, I expected to see about 25 different pulses, each in varying length.

Instead, this is what I saw:

Let me zoom in a little closer:

I can't even comprehend what is going on the slightest. Could someone give me a hint on what is going on or how I should be able to identify each note (each different signal?)

• "note" != "pulse". There's many 1000's of pulses of many varying lengths to make up a note. May 16, 2022 at 1:27
• Are you sure you're not trying to view an analog signal with a logic analyzer? A logic analyzer can only display two levels. A speaker output (unless you're looking at a raw class D amplifier output) is an analog signal. To view it you'll need an oscilloscope. May 16, 2022 at 2:27
• If you expect a speaker to be driven by PWM, why is that? Which device it is that you are measuring, and what kind of tones, and what sampling rate you use on the analyzer? May 16, 2022 at 4:22

Logic Levels are usually selected in the menu with some positive threshold. AC Audio signals are bipolar with an avearage of 0V. Thus using a positive logic threshold can add to the errors you are seeing.

Be careful you do not exceed the maximum input voltage.

If a note lasts about a second you should expect to see 40 thousand identical pulse width pulses.

Not wanting to discourage you...

First of all: The logic analyzer is probably not the right tool for the task at hand.

Use an oscilloscope and look at what you get. And learn, what Signal to expect. For this:

• Learn, what a tone is and how the waveform for a tone would look like
• Learn how PWM works and how this could influence what signal to expect
• Learn, what a logic analyzer is and wher it can be benefical to use one (in this case, its not the right tool).

So just a few short pointers:

Tone:

A pure sinewave tone is defined by it's frequency (pitch) and amplitude (volume). So if you play a middle A thats 440 Hz. So with a tone of 1s length you get a Sinewave with 440 peaks and 440 valleys. If the tone is not a pure sine wave it's getting more complicated.

PWM: Pulsewith-Modulation is used to mimic- analog values with a digital signal. By switching a signal on and off at a high frequency and filtering the signal afterwards you get an averaged analog signal. In most cases, the PWM-Frequency is fixed (means, from switching the signal on to the next time the signal is switched on, is always the same time). The thing that changes is the time the signal is in "on" state during this time (can vary betwen 0% and 100%).

Class D amplifiers often use switching frequencies in the range of 250kHz to 1MHz. So if your logic analyzer can measure the signal you'd get 250000 to 1000000 pulses per second playtime on your logic analyzer. This frequency will stay the same independently of the tone the amplifier is playing.

So: Take an oscilloscope and take a look at the signal and see if you can learn from this.