Example Code

Simple Sound Sequencer in LabVIEW

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 code allows the user to load up 3 .WAV Sound Files into an 8 beat palette and generate some basic tunes.

 

Description

This VI uses a Output Sound VIs to create a Sound Sequencer. First Creates a 2D Waveform from 3 .WAV Files. The user Clicks on a Control Array Boolean Related with the three .WAV Files. Every Click will play a Sample of every .WAV File. Using a Producer-Consumer Pattern, the Producer Iterates Row and Columns looking for True, each True of Control Boolean Array Mixes Samples and Enqueue Element. The Consumer uses Output Sound VIs to output sound of combination of the 3 .wav Files.

 

Requirements

LabVIEW 2012 (or compatible)

 

Steps to Implement or Execute Code

  1. Load 3 .WAV short sample files
    (Long samples will get cut short in the next beat (overflow output is there ready to be coded in)
  2. Enter the Sample Rate of your files, ideally they would all be the same although it will work fine otherwise
  3. Run VI
  4. Click on the green LED's of the Array Control to trigger the sound for that beat (You could resize the Boolean arrays to get more beats/lines and change the code accordingly)

Additional Information or References

5822.png

 

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

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