From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Speaker working frequency range issue

Solved!
Go to solution

Hello, 

I want to increase the working frequency range of the speaker in the code attached below

 

The details of the DAQ which I am using is

“NI  PCIe  -  6351,  X  Series  Multifunction    DAQ  (16  AI,  24  DIO,  2  AO),  1.25  MS/s     single  -  channel  sampling  rate”

and the working frequency range of the speaker which I have used is from 20 Hz to 20 KHz

The problem with the programme is that I am unable to get the sound beyond frequency of 9900 Hz though I tried to increase the number of samples, can you please help me out with this??

I have attached the programme below

0 Kudos
Message 1 of 6
(2,678 Views)

Hi Trupi,

 

when you use 20kHz samplerate as is set in your VI then Nyquist and Shannon will tell you why you can't achieve a sine with more than 9.99kHz frequency!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(2,671 Views)
Solution
Accepted by topic author @T

There are a couple of obstacles you can fall over:

1. Your sample rate is fixed. You define it when starting the task. Default values indicate a value of 20kHz for this. Due to Nyquist-Shannon theorem, the maximum output signal frequency is hence 10kHz.

2. As your output frequency is static, the time your buffer fills is getting shorter the higher your frequency is. Using regeneration mode however addresses this.

            a) Because you are using regeneration mode, your output could glitch when changing frequency.

3. You might want to consider changing the buffer size to increase with rising frequencies. That way, you can create a waveform which covers a specific time for each different frequency.

4. Do not use variables. They are not necessary in your case. Implement the task in a state machine. That way you can also remove the "first call" primitive.

 

I think these are the most important/prominent feedback points.

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 3 of 6
(2,661 Views)

Thank you @Norbert_B

And one more question if we are trying to get data of sound produced using speaker through microphone and we are getting two waveforms for the data acquired by microphones one of the graphs is time vs voltage amplitude and other is Power spectrum FFT i.e. frequency vs voltage amplitude why both the voltage amplitude won't match and what can we do to rectify it.

 

 

 

Regards, 

Trupti Ingle

Mechanical Engineering Department

Indian Institute of Technology Bombay

Mumbai

0 Kudos
Message 4 of 6
(2,617 Views)

Hi Trupti,

 

one of the graphs is time vs voltage amplitude and other is Power spectrum FFT i.e. frequency vs voltage amplitude why both the voltage amplitude won't match

You want to know why "voltage over time" looks different than "voltage over frequency"?

It's because those graphs show different signal domains!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 6
(2,608 Views)

I'm away from LV, but as I recall the power spectrum vi returns results in units related to power.  You can expect better correlation between peaks in the time domain and peaks in the freq domain by using the amplitude and phase FFT.  Look into the help to see the exact scaling involved.  There may be something like a sqrt(2)/2 factor if the FFT function reports amplitude in terms of RMS.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 6 of 6
(2,603 Views)