LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Create a melody with Labview/ Function Generator

Hi (first sorry for poor english, not my native language)

 

I have a project at school which is creating a melody using Labview and a function generator. I've worked on it for hours now and i still can't get through it.

I joined the vi file with my post so you can get a look at what i've done so far.

 

First, i do'nt know which loop i have to use (u'll understand soon enough if u just take a look at the vi file), the problem is that i want to create 4 arrays using 2 text files.

The first one is used as a reference : exemple the frequency to play an A is 440Hz, so my first text file looks like that :

A 440

B 493

...

 

the second one is my melody, which includes the notes and the tempo (in ms)
 , so it's like :

B 1000

C 1500

....

 

I used the first two loops to seperate each string lines of my files so I have at the end 4 different arrays. One containing the note's references, one containing the frequency, one containing my melody's notes and one containing the duration of each notes.

The problem is that when I use a while loop, it seems that my arrays are not containing every elements it should, it only has the last one. Just try to run the vi file.

 

Could anyone give me some help ? Don't hesitate to ask more questions if u didn't fully understand my problem !

Thx

 

 

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

Hello


I took the liberty to improve your code arrangement, without changing any single function.

This will help further developers to easily analyze your code.

 

improved.png

 

Hope this helps.
[Edit: Image attached to save some clicks]

Mondoni
0 Kudos
Message 2 of 3
(2,583 Views)

Hi claudeuntel,

 

Your array contains just the last note because at each for loop iteration a new table is created.

 

You have to send the table you created at one iteration to the next one.

 

To do this you can use shift register.

 

I didn't have tested the VI below but it should looks like that.

 

snap.png

 

Valentin

 

 

Valentin
Certified LabVIEW Architect
Certified TestStand Architect
Certified LabWindowsCVI Developer
National Instruments France

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