MultiChannel Recording/Multiple Channel processing
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello all,
I am trying to have 2 input channels both stereo style read in from my soundcard. What is the best method to get around to do this? For reference, I am locked with using MATLAB 2011b. My current approach works for 1 channel with L/R, but when I implement the second channel it ends up using the same data as the first channel. My current code uses a manually built simulink diagram built into a .m file.
load_system('dspwin32');
load_system('simulink');
sampleFreq = 44100;
SamplesPerFrame__ = sampleFreq;
simver(4.1);
System_Name = 'BlckDiagrm';
new_system(System_Name);
open_system(System_Name);
add_block('dspwin32/From Wave Device','BlckDiagrm/MicrophoneCh12');
set_param('BlckDiagrm/MicrophoneCh12','SampleRate','User-defined','UserRate',num2str(sampleFreq),'SampleWidth','16','SamplesPerFrame',...
num2str(SamplesPerFrame__),'Stereo','on','QueueDuration','1','useDefaultDevice','on', 'Position',[20,120,70,170]);
add_block('simulink/User-Defined Functions/MATLAB Fcn','BlckDiagrm/Function','Position',[120,120,170,170]);
set_param('BlckDiagrm/Function','MATLABFcn','simulink_general', 'OutputDimensions','[0]', 'OutputSignalType','auto', 'Output1D','on');
add_line('BlckDiagrm','MicrophoneCh12/1','Function/1');
The idea is that the data passes to a function which separates it into each channel, L/R components, and analysis them. My first thought for doing this is adding:
add_block('dspwin32/From Wave Device','BlckDiagrm/MicrophoneCh34');
set_param('BlckDiagrm/MicrophoneCh34','SampleRate','User-defined','UserRate',num2str(sampleFreq),'SampleWidth','16','SamplesPerFrame',...
num2str(SamplesPerFrame__),'Stereo','on','QueueDuration','1','useDefaultDevice','off','userDeviceID', xxx, 'Position',[20,20,70,70]);
add_block('simulink/User-Defined Functions/MATLAB Fcn','BlckDiagrm/2nd_Channel','Position',[120,20,170,70]);
set_param('BlckDiagrm/2nd_Channel','MATLABFcn','second_channel', 'OutputDimensions','[0]', 'OutputSignalType','auto', 'Output1D','on');
add_line('BlckDiagrm','MicrophoneCh34/1','2nd_Channel/1');
Where xxx is the ID of the second input device; and I of course would change the coding of the first code disable it from using the default device and have it fixed to the first desired input device ID. Thus far, this approach is failing.
So I guess my question is: what is the best way to read in 2 input devices both with L/R channels from 1 soundcard?
Cheers!
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Audio I/O and Waveform Generation dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!