LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Metronome is missing samples

Hello,

 

I am working on a metronome for a step test. 

The programm has to give a beep every time the person should take a step.

I build a programm in which I can put in the frequency (BPM) and duration (seconds) and the programm will automatically calculate when it has to give a beep signal. 

So far, most of the programm is working fine, except for 90 BPM (or 180, 270, 360). For some reason, samples are missing when the programm is running for at least 60 seconds. It suddenly skips one beat, but after a while the programm 'recovers' and goes back to the correct rithm. 

I did a simple test of 60 seconds to check which samples were missing. I used the frequencies: 45, 90, 180, 270 and 360 BPM.

In the attached excel file you will find which samples were missing. 

I also runned the programm for 20 minutes, and the problem keeps comming back at certain times (find graph image attached).

 

Could you help me with this problem?

 

I hope I described everything correct, but if you have any questions, please ask me. 

 

Thank you!

 

 

 

 

Download All
0 Kudos
Message 1 of 4
(2,939 Views)

You do a LOT of array calculations, are you sure that your arrays are correct? 

 

I have cleaned up your VI. 

You need to tell us what your controls are when it does not work. 

Save the VI with the controls filled out with data and set to "Make current Value default". 

You should really go through all your array operation and think about if you really need them. 

0 Kudos
Message 2 of 4
(2,895 Views)

One highly probable reason for missing beeps is your use of equality testing on floating point numbers.  Because you divide and multiply by infintely repeating fractions (in binary), it is quite likely occasionally the equals? test will fail because the two inputs differ by a few parts in 1E-15.  The Search 1D Array function probably has the same issue.

 

As dkfire mentioned you have some very unusual array manipulations. Array Subset is often preferable to Delete from Array and Build Array is better the Insert into Array. Even better thatn building an array inside a loop is to Initialize the array outside the loop then use Replace Array Subset inside the loop.  I did not study the array process thoroughly but a concatenating tunnel might generate the same result with a lot less code.

 

The sequence structure does nothing.  Remove it. Learn to use the dataflow paradigm of LabVIEW and you will find that the sequence structure is very rarely needed.

 

Lynn

0 Kudos
Message 3 of 4
(2,876 Views)

Thank you for your help, I restarted and made a much more simple metronome, and now I don't have the problem anymore!

 

 

0 Kudos
Message 4 of 4
(2,831 Views)