10-21-2018 01:41 PM
Hello everyone, im having trouble realising an idea that i have, because i simply don't know how to do it and even if its possible, i want the output from this waveform generator to play continuous sound, with the parameters of the waveform so it can be measured with an osciloscope via the soundcard of the computer. If any one has any suggestions or knows how to do it, it would of extreme help to me, thank you!
Solved! Go to Solution.
10-21-2018 05:13 PM
The key step, it seems to me, is your desire to output sound through the PC's sound card. Did you look at the functions in the Graphics and Sound Palette? There's a sub-palette devoted to Sound Output, including a built-in Waveform Generator.
Bob Schor
10-22-2018 02:20 AM
I tried with the Waveform Generator, but when i integrate it to my function generator i keep getting an error either that the data types are different, when i correct that, then that my soundcard cannot play it because it is not compatible, which shouldnt be the case, because when i create a new Vi, like this one "Sound Playing Working", that i saw from a tutorial, everything works fine, but i can't seem to be able to output sound with the parameter from my function generator, because it imidietly stops when i try to run it.
10-22-2018 02:39 AM - edited 10-22-2018 02:41 AM
Hi Daixman,
the problem with images is: we cannot debug them using LabVIEW!
when i create a new Vi, like this one "Sound Playing Working", that i saw from a tutorial, everything works fine
Which sample frequency (fs) do you use with the "working" VI and which one in your "non-working" VI?
What are the settings in that Play ExpressVI? Does the device test in the ExpressVI work as expected?
10-22-2018 04:15 AM - edited 10-22-2018 04:19 AM
Im sorry for using images and the lack of skill for expressing for my problem, to be honest im still learning LabView.
I figured out that the error i was getting was because in my main Vi i was using the Frequency as my sampling rate, now ive set the sampling rate as a constant, since im using a simulate signal block and i can not control it with a numeric control, but now the image of my signal is running slower, its running without errors, (except if i set the sampling rate over 99999) which is an improvement, and i don't mind the image running slower.
But im still not hearing sound, while on my other Vi, where i have created just to test my soundcard i have sound.
Im attaching both Vi's.
"Virtual Function Generator" - This is the waveform generator that im trying to make a sound output with the parameters of the generated waveform.
"Play Sound" - This is the Vi i made just to test if everything was ok.
Maybe the problem is only with my computer and it will produce sound on other devices, or maybe i messed up someting when adding the waveform generator, if you can take a look, it would be greatly appreciated.
Thank you!
(My goal is to be abble to simulate a waveform via the soundcard of a computer that would be measureable with an osciloscope)
10-22-2018 05:45 AM
Hi Daixman,
I figured out that the error i was getting was because in my main Vi i was using the Frequency as my sampling rate, now ive set the sampling rate as a constant, since im using a simulate signal block and i can not control it with a numeric control, but now the image of my signal is running slower, its running without errors, (except if i set the sampling rate over 99999) which is an improvement, and i don't mind the image running slower.
This is a problem…
Your soundcard only supports a limited range (or set) of sampling frequencies - and your VI should use exactly those range/set!
Standard frequencies are 44.1kHz or 48kHz: use those frequencies to generate the waveforms!
One more problem:
Using the (evil) DDT (dynamic datatype) with all those ExpressVIs bloats your VI. (See the filesize?) Why do you convert the DDT to a DBL array, to just convert that array into a waveform? Why not convert to waveform directly? Why not use Waveform functions at all and get rid of all those ExpressVIs?
Btw.:
- clean up the VI
- NEVER delete the label of controls/indicators!
10-22-2018 06:03 AM
Yes i understand the there will be limitation on the frequencie range set, thats not an issue for me, i can work with the range, what im currious is if the arrangement i have set is correct and will the output will be what im expecting it if i measure it with an oscilosope.
10-22-2018 12:27 PM
@Daixman wrote:
Yes i understand the there will be limitation on the frequencie range set, thats not an issue for me, i can work with the range, what im currious is if the arrangement i have set is correct and will the output will be what im expecting it if i measure it with an oscilosope.
That depends on your sound card or chip. You are generating a waveform, a digital sampled approximation of a continuous curve, are delivering these numbers to some hardware that (a) understands the timing, (b) is capable of generating voltages corresponding to the digital values you present to it at the appropriate time(s), and (c) is otherwise "noise-free" with respect to the output terminals you are using to assess the signal with an oscilloscope.
Bob Schor