LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

sampling analog signal- Sample and Hold!

About VI:

 

This is the logic I tried to implement:

 

Input an audio signal

Generate an impulse train (I have used for loop for it) with delay= sampling interval

Multiply the original signal with this impulse train 

build the new waveform with dt=sampling interval

 

For values:

 

By default they are zero..you can insert a sampling frequency of 1 (just to check)..for input any audio (wav format) and

number of impulse samples=10

 

**If there is another way to go about doing sampling instead of using impulses do let me know as I am totally new and trying very hard**

 

Thanks

0 Kudos
Message 11 of 27
(1,193 Views)

OK.  I think I see what you are trying to do.

 

1. Your impulses are not what you are expecting.  Notice the multicolored display in the Impulse graph.  That indicates that you have multiple signals.  If you expand the graph and choose a Common Plot style which puts a dot at each data point, you will see that each row in the 2D array has one impulse.  Create a numeric array indicator and you see 1s on the diagonal.  What you need is a 1D array of mostly zeros with equally spaced ones.

2. You can create this by using a shift register and Replace Array Subset rather than autoindexing a 2D array at the output.  There are probably easier ways, but you are learning, one step at at time.

3. Your impulse array should be the same length as the signal array.  Otherwise your sampling will not happen where you want it.

4. Why the while loop? What is changing?  If you want to sample the same wave file at different rates, move the file read outside the loop (no need to read the same file over and over again!) and then use an event structure to redo the sampling when the rate changes.

5. The output of the wave file is already sampled data.  Resampling at a different rate can cause interesting effects.  Pay attention to waht Mr. Nyquist said.

 

Lynn

0 Kudos
Message 12 of 27
(1,187 Views)

Hi,

 

I think I am getting ..Thanks for your help..okay one more question for now..I am trying to reproduce sampling (and to show aliasing as well, which will automatically I think display if done less than the nyquist criteria) but if the output of wav file read is already a sampled data, then what can be done?? I want to take raw data and sample it not sampled data and sample it..Any help?

0 Kudos
Message 13 of 27
(1,174 Views)

traceabc,

 

Thank you for using our forums.  If I understand your last question correctly you would like to sample a raw sound rather than using a .wav file.  If this is correct you will have to use a data aquisition card to sample raw data.  A .wav file is a digital representation of the anolog signal.  In order sample the raw data or the analog signal you will have to use either a data aquisition card (DAQ) or a Dynamic Signal Aquistion card (DSA) card to aquire the data.  A DAQ card would be good for a simple applications and looks better in the time domain while the DSA card works better for the frequency domain.  I hope that helps in your application.

 

Regards,

 

Brian P.

Applications Engineer
National Instruments
0 Kudos
Message 14 of 27
(1,146 Views)

@BBallBYU wrote:

traceabc,

 

Thank you for using our forums.  If I understand your last question correctly you would like to sample a raw sound rather than using a .wav file.  If this is correct you will have to use a data aquisition card to sample raw data.  A .wav file is a digital representation of the anolog signal.  In order sample the raw data or the analog signal you will have to use either a data aquisition card (DAQ) or a Dynamic Signal Aquistion card (DSA) card to aquire the data.  A DAQ card would be good for a simple applications and looks better in the time domain while the DSA card works better for the frequency domain.  I hope that helps in your application.

 

Regards,

 

Brian P.


Or Sound card.....That most computrs already have. And Labview actually support. And if we are talking audio. This will more than do in this case. Shall we start in that end firstSmiley Happy



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 15 of 27
(1,139 Views)

i wnat to implement line coding techniques in labview to digitize may audio signal.
how can i implement differential mancheter coding technique in labview any tool kit required or so???
regards

0 Kudos
Message 16 of 27
(1,116 Views)

Yes..That sounds like a good idea..I was thinking in order to sample (According to nyquist), how about if we obtain the sample at a particular point according to sampling interval e.g get sample/point of the signal at Ts, then 2Ts and so on..So how to get a waveform point at a particular instant and store it? Is it possible ..I tried 'get waveform component' but it doesn't seem to help me much!

 

This would also help me in dping quantization at the next stage..so if you can give me an idea how to go about getting a signal at a particular instant ???

 

thanks again

0 Kudos
Message 17 of 27
(1,113 Views)

idma,

 

Your question does not seem particularly relevant to this thread.  Please start a new thread.

 

traceabc,

 

Get Waveform Component(s): Y and dt.  Index Array Y[i].  The value of the index is i = [Ts/dt], where Ts is your desired sampling interval and dt is the Waveform timing interval.

 

Lynn

0 Kudos
Message 18 of 27
(1,107 Views)

Hi,

 

Thanks a lot for this..I did get what you said and tried it but one problem I just faced..the index may turn out to be e,g 2.5 because Ts will be changing for every sample, right? e.g first sample at Ts then 2Ts then 3Ts and so on..what can be done about it? and if I want to build the new waveform from these values that I had extracted from the original signal, should I use build waveform ?? Also, the dt of get waveform component is always fixed?? can we change it? dt represent the time interval between each signal sample..am I correct?

 

Thanks a lot for your help once again 🙂

0 Kudos
Message 19 of 27
(1,099 Views)

Working through your questions in reverse order, mostly.

 

dt represents the time interval between successive samples in the waveform.

 

You cannot change it because the waveform is already sampled. So, yes, it is fixed.

 

When you get fractional indexes, obviously you cannot get a data point at exactly that time.  You can interpolate between adjacent samples.  For an index of 2.5 you would use R[2.5] = (Y[3]-Y[2])/2.

 

You can build a new waveform from your resampled data.  Connect the R (for Reample) array to Y on the Build Waveform primitive and Ts to dt.

 

Lynn

 

0 Kudos
Message 20 of 27
(1,093 Views)