I'm working on a project, where we're recording sound with a piezo-disc which looks a little something like this:


Now, unless we're doing something horribly horribly wrong, I've discovered that we're only recording the magnitude of sound, since a piezo-disc emits a response to pressure, regardless of direction.

This is a sound-recognition project and previously, we'd been working with smartphone microphones. Back then, we could MFCC to perform feature extraction, yet now it looks like some things will break:

MFCC diagram

I fear that the pre-emphasis step in particular might lead to faulty results.

What kind of an approach could we follow?

  1. Is there a way to "guesstimate" the amplitude from the magnitude?
  2. Assuming that I do skip pre-emphasis, I don't expect the Fourier transform of the magnitude over time to differ from that of the Fourier transform of the amplitude over time. But am I better of skipping it, or fine-tuning it?
  3. I should just ignore all of these concerns and just continue to take MFCC's as usual.

Any other ideas?

  • $\begingroup$ Are you sure it's only magnitude? I thought piezo discs could generate both positive and negative output signal. $\endgroup$ – user253751 Jul 16 '20 at 16:38
  • 2
    $\begingroup$ I think your analog-to-digital converter (ADC), or preamp if you have one, is unable to handle negative voltages, which the piezo does also generate. So you need biasing. $\endgroup$ – Olli Niemitalo Jul 17 '20 at 4:24
  • $\begingroup$ @OlliNiemitalo This! $\endgroup$ – jojek Jul 17 '20 at 8:35

There is no reason why your piezo shouldn't be able to produce a bipolar output, if you use proper biasing and/or preamp. See for example https://www.homemade-circuits.com/diy-contact-mic-circuit/

Working with the magnitude only is probably a non-starter. $y = |x|$ is a highly non-linear operation and will dramatically change your spectrum. For example a sine wave at $f_0$ has just a single spectral line. The spectrum of the magnitude has a strong DC bias, lots of even harmonics $2f_0, 4f_0 ...$ but no content at $f_0$ at all anymore


I am not sure what do you mean by magnitude, but you should be getting a waveform that's perfectly fine for further analysis you wish to do. Just keep in mind that you don't know the frequency response of the transduer and it's rather difficult to measure it unless you have access to lab hardware.

As an example, I've just plugged my piezo sensor to an oscilloscope, attached to the speaker and recorded 300 Hz sine wave. Looks fine to me, possibly you could comment on that?

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.