daily pastebin goal
21%
SHARE
TWEET

Untitled

a guest Jan 18th, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function f = block(v, N, M)
  2. %   N = 30 msec (600 samples)
  3. %   M = 10 msec (200 samples)
  4.  
  5. n = length(v);
  6. maxblockstart = n - N + 1;
  7. lastblockstart = maxblockstart - mod(maxblockstart-1 , M);
  8.  
  9. % Remove the semicolon to see the number of blocks
  10. % numblocks = (lastblockstart-1)/M + 1
  11.   numblocks = (lastblockstart-1)/M + 1;
  12.  
  13. f = zeros(numblocks,N);
  14.  
  15. for i = 1:numblocks
  16.  for j = 1:N
  17.    f(i,j) = v((i-1)*M+j);
  18. end
  19. end
  20.    
  21. vector< vector<double> > Audio::something(vector<double>& theData, int N, int M)
  22. {
  23. int n = theData.size();
  24. int maxblockstart = n - N;
  25. int lastblockstart = maxblockstart - (maxblockstart % M);
  26.  
  27. int numblocks = (lastblockstart)/M + 1;
  28. vector< vector<double> > subBlock;
  29. vector<double> temp;
  30. this->width = N;
  31. this->height = numblocks;
  32.  
  33. subBlock.resize(600*187);
  34. for(int i=0; (i < 600); i++)
  35. {
  36.     subBlock.push_back(vector<double>());
  37.     for(int j=0; (j < 187); j++)
  38.     {  
  39.         subBlock[i].push_back(theData[i*N+j]);
  40.     }
  41. }    
  42. return subBlock;
  43.    
  44. len = length(blocks);
  45. n = sum(size(blocks)) - len;
  46. min = n+1;
  47. max = 0;
  48.  
  49. for i = 1:n
  50.   currsum = abs(blocks(i,1:len));
  51. end
  52. f = currsum;
  53.    
  54. vector<double>     Audio::filter(vector<iniMatrix>&blocks, double sumThres, double ZeroThres)
  55. {
  56. int n = this->height;
  57.  
  58. int min = n+1;
  59. int max = 0;
  60. int length = blocks.size();
  61. double currsum = 0;
  62.  
  63. for(int i=0; (i < 600); i++)
  64. {
  65.     for(int j=0; (j < 187); j++)
  66.     {
  67.         currsum += abs(blocks[j][i]);
  68.         //currsum = currsum / 600;
  69.         //cout << abs(blocks[0][j]) << endl;
  70.         //cout << currsum << endl;
  71.     }
  72. }
  73. cout << currsum;
  74.    
  75. Columns 1 through 10
  76.  
  77.     0.0013    0.0011    0.0010    0.0009    0.0012    0.0012    0.0012    0.0014    0.0016    
  78.     0.0016
  79.  
  80.   Columns 11 through 20
  81.  
  82.     0.0017    0.0019    0.0018    0.0014    0.0011    0.0011    0.0012    0.0010    0.0010    
  83.     0.0011
  84.  
  85.   Columns 21 through 30
  86.  
  87.     0.0011    0.0010    0.0009    0.0006    0.0005    0.0002    0.0003    0.0007    0.0008    
  88.     0.0009
  89.    
  90. f = sum(sum(abs(blocks)));
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top