1function [B, Sync, Vcount] = Datalogger4ChConverter_ErrInsensitiveSound(Name_tmp)
 2%Ku = [101 11 101 11];    %for sound recorder
 3%Coef = single(2000./Ku/2048);  %in mV
 4fid = fopen(Name_tmp, 'r');
 5A = fread(fid,Inf,'uint8=>uint8');
 6fclose(fid);
 7FSize = size(A,1);
 8V = NaN(ceil(FSize/6),2); Vcount = 0;%Af = []; V = [];
 9Error = false;
10StartPos = 1; 
11CurrentPos = 2;
12FSize_3 = FSize-3;
13while CurrentPos<FSize_3  %FSize-4 -> FSize-3
14   b12 = bitand(A(CurrentPos),128); %with synchronization! rem +1 ->  1.4391s
15   b34 = bitand(A(CurrentPos+3),136);
16   if (b12~=0) && (b34==0)     %1.5198s; (b12==0) && (b34==0):1.7629s/1e7iter; (b12|b34)==0:1.7461s %no error  
17     CurrentPos = CurrentPos+6;
18     if Error 
19       StartPos = CurrentPos-1;         
20     end  
21     Error = false;
22   else             %error
23     if ~Error 
24       Vcount = Vcount+1;
25       V(Vcount,:) = [StartPos CurrentPos-2];
26       Error = true;
27     end;    
28     CurrentPos = CurrentPos+1;  
29   end;    
30end;
31if ~Error
32  Vcount = Vcount+1;
33  V(Vcount,1:2) = [StartPos CurrentPos-2]; %was -1
34end;
35V((Vcount+1):end,:) = [];
36%here we have to collect the array indeed!!!
37L = V(:,2)-V(:,1)+1;
38Af_length = sum(L);
39Af = zeros(Af_length,1,'uint8');
40Counter = 0;
41for I_t =1:size(V,1)
42  Af(Counter+(1:L(I_t))) = A(V(I_t,1):V(I_t,2));
43  Counter = Counter+L(I_t);
44end
45A = Af;
46Af = []; %clear Af 
47Am = rem(size(A,1),6)-1;
48if (Am>-1)
49  A((size(A,1)-Am):size(A,1),:) = [];
50end;    
51A = reshape(A,6,size(A,1)/6)';
52B = zeros(size(A,1),4, 'single');
53B(:,1) = bitshift(uint16(bitand(A(:,2),112)),4)+uint16(A(:,1));  
54B(:,2) = bitshift(uint16(bitand(A(:,2),7)),8)+uint16(A(:,3));
55B(:,3) = bitshift(uint16(bitand(A(:,2+3),112)),4)+uint16(A(:,1+3));  
56B(:,4) = bitshift(uint16(bitand(A(:,2+3),7)),8)+uint16(A(:,3+3));
57Sync = bitshift(bitand(A(:,2),8),-3);