LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Piano code

I am trying to make piano using LabVIEW. But in my code I am having delay in playing the sound file. Is there any method to produce the sound without delay and getting sound when two keys are pressed simultaneously.

 

0 Kudos
Message 1 of 3
(2,739 Views)

@Ashish1190 wrote:

I am trying to make piano using LabVIEW. But in my code I am having delay in playing the sound file. Is there any method to produce the sound without delay.


If what you are asking LabVIEW to do is to contact the operating system (OS) of your computer to locate a sound file, open it, read in the data and then pipe it out as a sound, are you really surprised that there is a delay? All these things take some finite amount of time. Good hardware and an OS that can focus on the specific task that you deem to be most important can help, but it's still not instantaneous.  You'd have better luck to read all the sound files (88?) into memory when the program started and then select and shove the data out when a dataset is selected. At least then you'd eliminate the file I/O.

 

Is there any method to produce the sound when two keys are pressed simultaneously.

What keys?  Virtual keys in a screen GUI?  How may OS's have you seen that allow you to click two places at once on the screen?  How many computer keyboards allow you to press two keys simultaneously and produce intelligible data as seen by the OS? You'd need something like a real piano keyboard with an 88-bit equivalent digital interface that could be read by a digital input module.

0 Kudos
Message 2 of 3
(2,688 Views)

It's old but look here for an example of a possible better way.

 

Creating a MIDI Keyboard in LabVIEW

========================
=== Engineer Ambiguously ===
========================
Message 3 of 3
(2,665 Views)