LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Play input data in serial connection in speakers ?

Hi.

I want to play input data with system speakers. Data receive from Serial Port and I want to play it realtime. my data frequency rabge is between 10 to 500 and it;s amplitude is up to 1. I use this Subvi that I right it for put in final Vi. 

PW1.png

Sampling frequency is 2000. 

anyway, I put this subvi in my final code, but It doesn/' work !!

anybody has idea ?

Thanks.

0 Kudos
Message 1 of 17
(4,062 Views)

Curious.  Thanks for posting the code as a Snippet -- I dropped it into an empty Block Diagram, replaced the Device input with a Constant (which was 0), replaced the Data with a Basic Function Generator set to make a Sine Wave (default) at 440 Hz, Amplitude 1 (default), 1000 points at 1000 Hz.  When I ran it, I got a second of the note "A 440".

 

My conclusion is that your code is fine, the problem is that one or more of your Inputs is wrong or missing.

 

Bob Schor

Message 2 of 17
(4,029 Views)

I send my final desin which play input signal from VISA read function. as you can see, in program this VI doesn't work !!

L2.png

I use notifier for play a specified song when input signal cross over 3.1 , it worked correct when I don't use first post VI, and when I put first post VI into above VI, LV show an error.

0 Kudos
Message 3 of 17
(4,018 Views)
What error? It looks like you are passing a scalar. What sort of sound do you expect with a single point and not a waveform?
0 Kudos
Message 4 of 17
(4,009 Views)

you are right, it is scaller, but I use numer to array function for DATA input of VI, and my data which come from MCU are digital (I use an ADC for sampling from an analog signal) and in every time I have just 1 sample. with this circumstances can I use this block for play input data ?

or is anyway to play input data ?

0 Kudos
Message 5 of 17
(3,994 Views)
A single point is still a single point whether you stick it into an array or not. I suspect this is the source of the error that you still have not provided.
Message 6 of 17
(3,991 Views)

Thank you Dennis,

I run circuit tommorow and then put error text exatly here.

but as I say for play input signal which come from VISA read, what I can do ?

0 Kudos
Message 7 of 17
(3,983 Views)
Accumulate more samples before trying to play.
Message 8 of 17
(3,980 Views)

with 2ksps, what time need for accumulate samples ?

and if I use buld array functions for that , is it worked cooreclty ?

I want use queue in VI (like producer/consumer) , in your mind is it good way ?

and if it is possible for you, can you give an example for your way ?

Thanks.

0 Kudos
Message 9 of 17
(3,974 Views)

how I can acoomulate samples before playing them ?

0 Kudos
Message 10 of 17
(3,796 Views)