MATLAB: How to Record audio and save it into two different hz simultaneously in matlab

MATLAB

i want to record using audio recorder and record only one audio with two different Hz I used this code and instead of recording only one audio it records 2 please help
recObj = audiorecorder(8000,8,1) recObj2 = audiorecorder(1000,8,1) disp('Start speaking.') recordblocking(recObj2, 5); recordblocking(recObj, 5); disp('End of Recording.'); play(recObj2);
sorry for the bad english

Best Answer

When you record audio using audiorecorder, only the intensities are recorded. The timestamps of each sample are not recorded. The recorded values are assumed to be a consistent sample time apart, and that holds for all of the channels for the same recorder.
It is therefore not possible to record at two different frequencies at the same time using the same recorder.
You also cannot put the two different recordings into the same sound file because sound files expect all channels to be the same frequency.
Some sound file formats in theory permit you to store multiple versions of the same data with different frequencies, but MATLAB does not support that.
In order to record at two different frequencies into the same data file, you would need to use the Data Acquisition Toolbox, and configure different frequencies for different channels, and configure data logging. The data log would timestamp all of the samples and information about which channel it was.
I have to wonder whether you really need to record at different frequencies? The recording at 1000 hz should be the same as every 8th sample of the 8000 hz
Related Question