Capture overrun: errno=-32 (Broken pipe)
Show older comments
I deployed the following code on Rpi using wireless network connection:

function mic_test() %#codegen
rpi=raspi()
n1 = 0;
t = 1;
h = 5;
dose_ts=zeros(1,h);
annoyence_ts=zeros(1,h);
capObj = audiocapture(rpi,'plughw:2,0');
for i = 1:1:h
input = capture(capObj);
d =input(:,1:1);
fs = double(8000);
fs_leq = double(200);
t_leq = double(1/200);
SPL = splMeter('FrequencyWeighting','A-weighting', 'SampleRate',8000,'TimeInterval', t_leq);
[Lt,Leq,Lpeak,Lmax] = SPL(double(d));
s = acum60(Leq, fs_leq,t);
do = dose(s,t);
v=0;
for j=1:1:length(dose_ts)
v=dose_ts(j)+v;
end
v=v+do;
dose_ts(i)=v;
a = annoyence(d, fs);
annoyence_ts(i) = a;
end
s = dose_ts(end) % final value of noise dose accumulated
function n = acum60(leq, fs,t)
k = 10.^(leq/10);
n = sum(k)/(fs*t);
n = 10*log10(n);
end
function s1 = accumh(s, n,i)
k =(i-1)*(10^(s/10)) + 10^(n/10) ;
s1 = 10*log10(k/i);
end
function d = dose(n,t)
n = 2.^((85-n)./3);
d = t./(28800.*n);
end
function a = annoyence(audioIn, Fs)
loudness =double(acousticLoudness(double(audioIn),double(Fs)));
[~,~,perc] = acousticLoudness(double(audioIn),double(Fs),'SoundField','diffuse','TimeVarying',true);
Sharpness = acousticSharpness(double(audioIn),double(Fs));
[vacil, spec, fMod] = acousticFluctuation(double(audioIn),double(Fs));
[asper, specR, fModR] = acousticRoughness(double(audioIn),double(Fs));
N5 = perc(2);
f = mean(vacil(1:end,1));
r = mean(asper(1:end,1));
a = N5 * (1 + abs(2.18/(N5^.4)*(.4*f+.6*r))) ;
end
end
I ran this script using the ssh terminal & got this on the terminal:

I am not able to understand why this error is coming and what's the workaround.
I tried this but it didn't work:- Matlab support for Raspberry Pi pitch shift example error
Please help.
Answers (0)
Categories
Find more on Application Deployment in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!