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.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

real time audio with NI PCI 6255

NI PCI 6255 with SCC 68 and SCB 68

WITH 80 CHANNELS

AND 16 BIT RESOLUTION

 

Given below Visual C++ code that acquire the data and then play it.

We have set ON 78 channels but an audio frequency is applied only at a single channel through function generator, we want to play the channel audio in real time after acquiring data according to parameters given below, even though the NI card is set to continuous mode for acquiring samples, we can hear breaks are some breaks in the data.

Kindly reply if any one has any possible solution in mind………

 

 

////  VARIABLE INITIALIZATION ////////////////////

#define num_chan 78

#define samps_per_chan 1024

#define _BUFFER_SIZE_ 10

double data[num_chan*samps_per_chan];

double Buffering_data[_BUFFER_SIZE_][num_chan*samps_per_chan] = {0.0f};

 

 

DAQmxErrChk (DAQmxReadAnalogF64(taskHandle,samps_per_chan,-1.0, DAQmx_Val_GroupByChannel ,data,num_chan*samps_per_chan,&read,NULL));

DAQmxErrChk(DAQmxCreateAIVoltageChan(taskHandle,"Dev1/ai0:77","",DAQmx_Val_RSE,-1.0,1.0,DAQmx_Val_Volts,NULL));

DAQmxErrChk(DAQmxCfgSampClkTiming(taskHandle,"",3200.0,DAQmx_Val_Rising,DAQmx_Val_ContSamps,num_chan*samps_per_chan));

 

0 Kudos
Message 1 of 4
(2,870 Views)

khan_khalil,

 

I need to clarify your question some. As I read your post, you are reading data on 78 lines, doing some software calculations on that data, and outputting a signal on one output line.  When you run your program, you are getting breaks in the analog output.  Is this correct?

 

A couple of points to look at.  First, if you are doing software calculations, you are inevitably going to get delays, as Windows is not a real-time operating system and there will be delays in determining what data you will output next.  How are you configuring your analog output task?  Finally, what hardware are you using to convert the output voltage to sound?

Seth B.
Principal Test Engineer | National Instruments
Certified LabVIEW Architect
Certified TestStand Architect
0 Kudos
Message 2 of 4
(2,856 Views)

thanks alot for taking interest;

i wanna make question even more simpler. i just want to take a 500Hz frequency input on a single channel, and wanna ply the sound in realtime using Visual C++,

as you say that windows can't perform in realtime due to processing time. but to cater that i have used sound buffers in my C++ code. the problem is that i hear breaks in sounds. the sound i played is not continous in time. 

Have you any C code for sound buffering and playing.....................

will be waiting for an early reply...........

0 Kudos
Message 3 of 4
(2,848 Views)
Currently, we do not have any Visual C++ code for sound buffers.  From the sound of your problem, you are attempting to output sound faster than you are able to bring in the 500 Hz data.  Your sound buffer will need to generate data to fill the gaps in your signal that are caused by this read/write speed difference.
Seth B.
Principal Test Engineer | National Instruments
Certified LabVIEW Architect
Certified TestStand Architect
0 Kudos
Message 4 of 4
(2,829 Views)