02-04-2017 06:24 AM
Hello,
I am new to LabVIEW-programming and trying to make a project with the myDAQ. I would be happy to get help from the community here for the following issue:
I have a simple *.txt-file where is one row with voltage-values. In fact this are values from a audio-file with the following properties:
Number of entrys: 3306
Recorded at sample-rate: 44,1 kHz
(So the calculated time duration of the audio-file is (1/44100)*3306=74,966 ms)
Now I want to play this audio-file over an Analog-output where the sequence of 74,966 ms is running again and again without a pause between the loops. My Idea now was, to make a timed loop with exactly 74,966 ms and write with the DAQmx exactly these 3306 samples within this time-span to the analog output. If I run it, I can see that the loop-time is longer (Around 140 ms) and if I listen to the audio, of course there are brakes between the loops....
I am sure my structure is inefficient because of reading the file, configuring the DAQmx task and probably my programm structure is not suitable for this problem.
Can someone tell me how I can make a proper structure for this problem? (Later, I want to read in different audio-files which have different length and modulate them with the "arbitrary waveform generator" in frequency and amplitude.
But first I would be happy to get this basics done...
Thank you very much!
02-04-2017 07:27 AM
A few wrong things in your vi. Never configure/clear task over and over in a loop, Configure once before and clear after. A time loop is useless, the timing is performed by your sample clock.
For what you want to do set the generation mode to continuous, it will generate the buffered data over and over again until you press stop.
Ben64
02-04-2017 08:20 AM
Hi ben64,
thank you very much for you answer! I just changed my VI according to your advice and it generates a constant output and repeats endless which is very good :-). Some further questions came to my mind:
02-04-2017 10:05 AM
02-04-2017 10:16 AM
Hi ben64, I must correct myself, it only between 15-16 ms, I tried it again. I dont know why it was at the first try 6 seconds....
02-04-2017 04:17 PM
Tooly a écrit :
Hi ben64, I must correct myself, it only between 15-16 ms, I tried it again. I dont know why it was at the first try 6 seconds....
This make more sense. I don't know about the 6 seconds, if you ran only 1 loop iteration and got this value it can be explained by the shift register initialized to 0 instead of being initialized with the tick count function (also the tick count roll back to 0 when it reaches 2^32-1). It is expected that the loop delay is different from the time it takes to generate 3306 samples, in the loop we are only polling the task status repetitively.
I'm not sure what is your goal with the second part of your questin, why don't you just concatenate the 3 pattern arrays?
Ben64