MATLAB Answers

Requested 48000x48000 (17.2GB) array exceeds maximum array size preference. Creation of arrays greater than this limit may take a long time and cause MATLAB to become unresponsive. Error in dtw (line 16) d=(repmat(​t(:),1,M)-​repmat(r(:​)',N,1)).^​2; %t

4 views (last 30 days)
clc,clear, close all
warning off;
[dist,ix,iy] = dtw(audio,speech)
Jan on 1 Jun 2021
Correct. For the dtw() command, amatrix is created, which has the sizes of the inputs as side lengths. This means, that 2 huge signals create a huge^2 matrix. If this exhausts your memory, you need more memory or smaller inputs.There is no magic third way.

Sign in to comment.

Accepted Answer

Chidvi Modala
Chidvi Modala on 3 Jun 2021
This issue could be due to RAM limitations. You may try the following suggestions:
1.Go to MATLAB > Preferences > Workspace and ensure the Maximum array size limit is set to 100%.
Then execute 'memory' command in the Command Window and send the output. Ensure that the Maximum possible array size is larger than the memory required by the data.
2. Also, check that the Java Heap Memory is not set to a very large value because that might restrict the amount of memory available to perform computations.

More Answers (1)

Walter Roberson
Walter Roberson on 3 Jun 2021
This is the kind of reason why spectrograms and similar processes take windows into the data.
To prevent artifacts where the windows join, typically overlapping windows are used.
For some kinds of processes, 50% overlap is used -- so for example for [1 2 3 4 5 6], one window would be [1 2 3 4], then the second window would be [3 4 5 6].
For other kinds of processes, a 10% overlap is common.
For audio, instead of a fixed size of overlap, it sometimes make sense to calculate the overlap based upon a particular time. To make up a number, there might be certain cases where some kinds of distortions tend to become perceptible around 5 milliseconds, so the overlap might be chosen in terms of the number of samples that fit 5 milliseconds.
The size of the window, together with the sampling frequency, will determine the frequency resolution.
If you have 48000 samples, then you just might be working with one second of sound at 48000 samples per second. 48000 is one of the "magic numbers" in audio: 48000 samples per second gets used for some kinds of professional audio, such as DVDs, but 24000 samples per second is not nearly as likely to be used. Instead, near that range, 22050 samples per second is more likely, as that is CD quality.
At 48000 Hz, that is about 21 microseconds per sample. says that humans can detect timing differences of 30 microseconds. You just might be studying timing perception, so potentially you might not be able to window much at all.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!