Sending and receiving audio from the my sound card simaltainously
Show older comments
Hi im trying to use matlab to do some analysis on some speakers. i am trying to send a chirp out of the speakers and then record it back in at the same time can any one help?.
I am pretty new to mat-lab but so far i have tried the function 'soundsc' and also setting up a an in and out, i can do them separately but not together.
i have Standard Toolboxes with MAT LAB + Data Acquisition + Parallel Computing
This is how far ive got...
Cheers
f0 = 100; %Frequency at t0
f1 = 20000;
duration = 2; %time duration
A = 2; %Amplitude
Pha = 0; %Phase
Fsampling = 48000;%sample rate
ts = 1/Fsampling; % Interval Between samples
t = 0:ts:duration; %time vector with steps of (ts)
AO = analogoutput('winsound', 0);
addchannel (AO, 1);
set(AO, 'SampleRate', Fsampling);
set(AO, 'TriggerType', 'Immediate');
AI = analoginput('winsound', 0);
addchannel(AI, 1);
set(AI, 'SampleRate', Fsampling);
set(AI, 'SamplesPerTrigger',Fsampling*duration);
testSig = chirp(t,f0,duration,f1,'logarithmic');
putdata(AO, [testSig']);
matlabpool open 2
parfor i = 1:2
if i == 1;
start(AO);
wait(AO,5);
delete(AO);
else
start(AI);
msment = getdata(AI);
delete(AI);
wavwrite(msment,Fsampling,'newsample');
end
end
i get this error when i run the code
MATLAB:dispatcher:loadLibrary Can't load 'C:\Program Files (x86)\MATLAB\R2012a Student\bin\win32\pctcustomattr.dll': The specified procedure could not be found.
. Caught MathWorks::System::FatalException
1 Comment
Edric Ellis
on 12 Apr 2013
Does this happen with all PARFOR loops, or just that one? The error that you're getting is fairly weird, it looks perhaps as if your installation is somewhat broken.
Answers (1)
Jack
on 12 Apr 2013
0 votes
Categories
Find more on Audio I/O and Waveform Generation in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!