NI LabVIEW,CVI,数据采集等产品讨论区

取消
显示结果 
搜索替代 
您的意思是: 

Sound acquire

I have to acquire a signal from the sound card in LabWindows, simulating a voltmeter. How can I do


Thank you
Luigi
0 项奖励
1 条消息(共 3 条)
4,227 次查看

There are two functions, StartPCsound and StopPCsound, in the Programmer's toolbox that allow you to pick a frequency, output sound, and then stop it after a specified duration. These functions use the Inp() and Outp() functions, so under Windows NT the CVI Device Driver is required.

Other options would be to use the Windows SDK functions for accessing a Sound Card. See the example on this topic from the NI Developer Zone (linked below).

Developer Zone Example: Play .wav Files Using Windows SDK Functions

0 项奖励
2 条消息(共 3 条)
4,198 次查看

Hi,
my problem is to send 2 signals to the sound card  and later captured. Sending a signal to turn the sound card and using a jack male male I can acqusirli. Here are the two functions used

int AudioOut(int samples, short int wave[]) 

{
 HWAVEOUT handle;
 WAVEFORMATEX formato;
 WAVEHDR BufferSuono;
 
 char ErrorString[200];
 
 formato.wFormatTag = WAVE_FORMAT_PCM;
 formato.nChannels = 1;
 formato.nSamplesPerSec = sampling;
 formato.wBitsPerSample = 16;
 formato.nBlockAlign = formato.nChannels * formato.wBitsPerSample / 8;
 formato.nAvgBytesPerSec = formato.nSamplesPerSec * formato.nBlockAlign;
 formato.cbSize = 0;
 
 errore = waveOutOpen(&handle, WAVE_MAPPER, &formato, 0, 0, CALLBACK_NULL);
 if (errore)
     waveOutGetErrorText(errore, ErrorString, 500);
 
 BufferSuono.lpData = (LPSTR)wave;
 BufferSuono.dwBufferLength = samples * 2;
 BufferSuono.dwFlags = 0;
 
 errore = waveOutPrepareHeader(handle, &BufferSuono, sizeof(WAVEHDR));
 if (errore)
     waveOutGetErrorText(errore, ErrorString, 500);
 
 errore = waveOutWrite(handle, &BufferSuono, sizeof(WAVEHDR));
 if (errore)
     waveOutGetErrorText(errore, ErrorString, 500);
 
 while (!(BufferSuono.dwFlags & WHDR_DONE));
 
 errore = waveOutReset(handle);
 if (errore)
     waveOutGetErrorText(errore, ErrorString, 500);
    
 errore = waveOutClose(handle);
 if (errore)
     waveOutGetErrorText(errore, ErrorString, 500);
    
 return (0);
}

nt AudioInAndReturn(int samples, short int wave[])


{
 WAVEFORMATEX formato;
 
 char ErrorString[200];

 formato.wFormatTag = WAVE_FORMAT_PCM;
 formato.nChannels = 1;
 formato.nSamplesPerSec = sampling;
 formato.wBitsPerSample = 16;
 formato.nBlockAlign = formato.nChannels * formato.wBitsPerSample / 8;
 formato.nAvgBytesPerSec = formato.nSamplesPerSec * formato.nBlockAlign;
 formato.cbSize = 0;
 
 errore = waveInOpen(&handle, WAVE_MAPPER, &formato, 0, 0, CALLBACK_NULL);
 if (errore)
     waveInGetErrorText(errore, ErrorString, 500);
 
 BufferSuono.lpData = (LPSTR)wave;
 BufferSuono.dwBufferLength = samples * 2;
 BufferSuono.dwFlags = 0;
 
 errore = waveInPrepareHeader(handle, &BufferSuono, sizeof(WAVEHDR));
 if (errore)
     waveInGetErrorText(errore, ErrorString, 500);
 
 errore = waveInAddBuffer(handle, &BufferSuono, sizeof(WAVEHDR));
 if (errore)
     waveInGetErrorText(errore, ErrorString, 500);
 
 errore = waveInStart(handle);
 if (errore)
     waveInGetErrorText(errore, ErrorString, 500);

 return(0);
}

My problem is to send 2 signals simultaneously,with a stereo transmission,and then acquire them.
Help me. I do not know how to do

0 项奖励
3 条消息(共 3 条)
4,032 次查看