Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

How to compare audio signal to 300KHz sawtooth for PWM output?

Dan,

 

If I can read an audio signal at 40MHz in a loop so that I could compare it with the sawtooth wave running at 300KHz in the FPGA that would be perfect. Then I am using the 9401 module to send the data out of the board.  I have been trying a few options and I can't seem to figure out how to save the audio data in the RT so that it I can use a FIFO to send it to the FPGA . The document I have attached is what i have been trying to use to save a .wav file. Is there anyway you could post some code showing me how to save the .wav file in the RT? Also what .wav file format can the RT handle does it have to be 16 bit?

 

0 Kudos
Message 11 of 13
(1,281 Views)

Dan,

 

Ok, I figure I can save the music file in my project explorer window under the RT by drag and drop. Then I can use an array to extract the wav file data and then index the array. Does this automatically take any .wav file and change it into a 16-bit or does it matter. I ask this, because I figure I could use an external program to convert my MP3 files into a .wav file and I am not sure if it will convert all files to the same .wav format. I will try all this tomorrow.

 

Thanks for the help,

Dane Miller

0 Kudos
Message 12 of 13
(1,278 Views)

Excuse me, Dane, but I sent that last reply without double-checking it. The Sound File Simple Read VI is not available in RealTime programming but will be available on a development machine. You can use this VI, index the array of waveform data that comes out of it, then Get Waveform Components and save that data to a file that can be opened on the RT target.

 

Once you have the file on the RT target, you can read the data out of it directly into the RT FIFO. That will bring the data into the FPGA VI where you can make any calculations you'd like on it at whatever speed you'd like.

 

Waveform data is automatically set up as Double Precision data so you'll have to handle conversions programmatically.

 

Keep in mind that dragging an item to a RealTime target will not change its storage location. You'll need to download any files via FTP or other communication protocol. You could also do so programmatically with a shared variable, potentially. You'll want to be aware of file sizes and make sure not to use up too much space on your RT Target.

 

I hope this helps. Let us know if you have additional questions.

 

Regards,

Dan Richards
Certified LabVIEW Developer
0 Kudos
Message 13 of 13
(1,267 Views)