From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

Count Peaks in a WAV File with Sound and Vibration Software

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview

This VI reads in a .WAV file and uses the Sound and Vibration Measurement Suite to programmatically determine the peaks of the file.

Description

This example VI reads and plays a WAV file which is specified by the user. The WAV data is then scaled to engineering units. After this, the power spectrum of the WAV data is computed over a subset of the baseband span and the spectrum peaks are identified and listed in a table. The peaks are identified using an algorithm that accounts for the time-domain window applied to the data. The threshold for the peak search can be manually entered or an automatic threshold will be used if the default value is used for the threshold.

Requirements

Software

Hardware

  • None, but could be expanded to use hardware instead of a WAV file

Steps to Implement or Execute Code

  1. Download the VI
  2. Select the .WAV file you wish to analyze with the example VI in the path control
  3. Run the VI

Additional Information or References

Front Panel


**This document has been updated to meet the current required format for the NI Code Exchange.**

Product Support Engineer
National Instruments

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Contributors