Welcome! Log In Create A New Profile

Advanced

VoiceRecording issues

Posted by mattiadelgrosso 
VoiceRecording issues
May 24, 2023 06:08AM
Hi,
we need to make a 9-hours voice recording through monkeylogic software, and until now we performed it with a cheap USB microphone but with a poor audio quality. To improve our system, we use an USB-connected external audio interface to be able to record stereo audio in high quality and we encountered the problem below, followed by the lack of the saving of the .mat output:

Error using analoginput/getdata
Requested 2x1555282176 (23.2Gcool smiley array exceeds maximum array size preferenze (15.7Gcool smiley. This might cause MATLAB to become unresponsive

This error seems strange to us because a 9 hour recording of 2 channels at 22050 sample frequency should be a 2x714.420.000 matrix (9 hours x 60 minutes x 60 seconds x 22050 sample/s) and not 2x1555282176 which seems to be the double of the expected matrix. When we tried with short recordings, they works and the matrix length resulted of the correct dimensions (hours x minutes x seconds x Sample frequency). Maybe by fixing this incongruency we may be able to not exceed the maximum array value and not lose our audio recordings.
Do you have some tips to get to our goal? Are there other things that we can do?

I list below the characteristic of the PC, audio interface and ML settings we are using:
Windows 11
RAM: 16 GB
Audio Engine: XAudio2
Audio interface: behringer umc404hd
Sample Rate 22050
Stereo recording

Thanks to anyone who can help us
Attachments:
open | download - Errore Matlab audio.png (39.8 KB)
Re: VoiceRecording issues
May 24, 2023 11:18AM
Your sound card is recording at 48 kHz. Not every sound card supports the format you choose. If the chosen sample frequency is not supported, NIMH ML resamples the recorded data before saving them to the disk. Go to the Sound control panel and see which format is supported by your device. Actually 22050 Hz is not that popular these days, so NIMH ML scans only for higher frequencies. I can include 22050 Hz in the next version.



The Audio Engine menu is for sound play. The voice recording is always performed with WASAPI. Even if your device supports 22050 Hz, the format may not be used if you do not check on the exclusive mode.

A simple solution is just to add more RAM or split the recording into a few trials so that the system do not need to create a large matrix. If you turn on the ITI recording, there is no sample that will be missing between trials.You can put together the split pieces later.
Attachments:
open | download - Sound control panel.png (25.1 KB)
Re: VoiceRecording issues
May 24, 2023 11:01PM
I added 22050 Hz. To check all the supported recording formats, type daqhwinfo('wasapi') on the MATLAB command window. The daqtoolbox directory of NIMH ML should be in the MATLAB path.
>> info = daqhwinfo('wasapi')

info = 

  struct with fields:

              AdaptorName: 'wasapi'
               BoardNames: {'Microphone (2- USB PnP Sound Device)'}
        InstalledBoardIds: {'0'}
    ObjectConstructorName: {'analoginput('wasapi','0')'  ''  ''}
          SupportedFormat: {{3×1 cell}}

>> info.SupportedFormat{1}

ans =

  3×1 cell array

    {'1 Ch, 16 bits, 44100 Hz, 3 ms'       }
    {'1 Ch, 16 bits, 48000 Hz, 3 ms'       }
    {'1 Ch, Float, 48000 Hz, 10 ms, Shared'}
As shown above, this device of mine does not support 22050 Hz. 'Shared' is the format used when the exclusive mode is not selected.
Re: VoiceRecording issues
May 30, 2023 05:54AM
Hi Jaewon,

I'm a collaborator of Mattiadelgrosso in this project, thank you for your fast reply on our issue!

We managed to fix this RAM problem by using part of our PC SSD as a Virtual RAM. In the tests that we made there was no more issue with the maximum array size, but we are facing a problem in saving of the matrix. So by our interpretation the RAM issue is solved and probably this have to do with the writing of the matrix from the RAM to the SSD.

MATLAB error:
<<< MonkeyLogic >>> Out of memory. (analoginput.getdata, Line 293)
Out of memory.

Error in analoginput/getdata (line 293)
		varargout{1} = data';

Error in mldaq/getdata (line 596)
			case {1,3,6,7}, obj.Data{m,l} = getdata(obj.DAQ{m},varargin{:});

Error in ML_sleep_runtime/end_trial (line 1521)
getdata(DAQ);

Error in ML_sleep_runtime (line 2043)
end_trial();

Error in run_trial (line 130)
		runtime(MLConfig,TrialRecord,TaskObject,TrialData);

Error in monkeylogic/UIcallback (line 900)
		result = run_trial(MLconfig,datafile);

Related documentation

Error while evaluating UIControl Callback

We had a similar problem in saving the audio matrix with a previous USB microphone recording at 44100 Hz and without using the Virtual RAM, so we thought that the Virtual RAM isn't the issue. The solution we had at that time was to downsample to 22050 Hz in the MonkeyLogic audio settings, but by upgrading our setup we would prefer to record at 44100 Hz and not lose any frequencies in our recordings.
Unfortunately as Mattia said we can't subdivide the task in trials as we are doing overnight unsupervised recordings and we need to keep in sync other equipment that we use in the data acquisition via MonkeyLogic.

Is there something that may cause this issue? Do you have any suggestions on how to avoid or fix this?

Thank you again for your kind and efficient support!
Lucas
Re: VoiceRecording issues
May 30, 2023 02:33PM
It is still the same problem. Increase the memory size.

The National Institute of Mental Health (NIMH) is part of the National Institutes of Health (NIH), a component of the U.S. Department of Health and Human Services.