Example Code

Basic Electronic Keyboard [Event Structures]

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 example contains the project files of a Basic Electronic Keyboard, which allows the user to generate the sounds of each key over 2 octaves either by pressing the on screen keys, or by the use of their computer keyboard.

 

Description
4.PNG

The Basic Electronic Keyboard (which I'll warn you is very basic!) allows the user to generate the sounds of each key over 2 octaves either by pressing the on screen keys, or by the use of their computer keyboard.

 

This is definitely a work in progress, and a key future improvement would be to improve the sound quality.

Currently the sound is produced from a system beep at a specified frequency for each key, but I plan on editing the code to generate the sounds using sine waves to produce a sine wave from each button as well as adjusting the code so that the sound is produced for the length of time that the key is pressed

 

 

Requirements

  • LabVIEW 2012 (or compatible)

 

Steps to Implement or Execute Code

  1. Download the attached ZIP file.
  2. Open the project file and Basic Electronic Keyboard 2012 NIVerified.vi
  3. Run the VI

 

Additional Information or References

VI Snippets1.png

 

2.png

3.png

 

If you have any suggestions of extra features you would like to see, please comment but currently I have thought of:

Recording and playback

  • Volume control
  • Chords (may be complicated!)
  • Different "voices" e.g. sine, square or triangle wave generations.

The files are saved into LabVIEW 2009 and 2010 SP1, but if you'd like a different version let me know.

 

 

 

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

Tori
Student

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

Comments
sccompu
Member
Member
on

Hello Tori M.,

nice, but your white B key should be a H !

Greetings

                    Chris

Tori.M
Member
Member
on

Attached for LabVIEW 2009 after Willy's request. Hoping to edit the code soon to improve sound quality.

Tori
Student