<html>
    <head>
      <base href="http://bugzilla.scilab.org/" />
    </head>
    <body><span class="vcard"><a class="email" href="mailto:maxime.keller@gmail.com" title="maxime.keller@gmail.com">maxime.keller@gmail.com</a>
</span> changed
              <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - savewave $ wavewrite both limited to 2^20 stereo samples: < 24 sec @ 44100 samp/sec"
   href="http://bugzilla.scilab.org/show_bug.cgi?id=13718">bug 13718</a>
                <br><br>
                ---------- Bug Summary ----------- <br>savewave $ wavewrite both limited to 2^20 stereo samples: < 24 sec @ 44100 samp/sec <br><br>

          <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">CC</td>
           <td>
                
           </td>
           <td>maxime.keller@gmail.com
           </td>
         </tr></table>
      <p>
        <div>

            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - savewave $ wavewrite both limited to 2^20 stereo samples: < 24 sec @ 44100 samp/sec"
   href="http://bugzilla.scilab.org/show_bug.cgi?id=13718#c2">Comment # 2</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - savewave $ wavewrite both limited to 2^20 stereo samples: < 24 sec @ 44100 samp/sec"
   href="http://bugzilla.scilab.org/show_bug.cgi?id=13718">bug 13718</a>
              from <span class="vcard"><a class="email" href="mailto:maxime.keller@gmail.com" title="maxime.keller@gmail.com">maxime.keller@gmail.com</a>
</span></b>
        <pre>Hello,

It seems that the bug comes from mput.
I've rewritten a wavwrite function (see bellow) which write the file block by block. The issue I have is that the writing of the wav takes a long
time. Any idea to speed it up ?


function monwritewav(u,Fe,fichier)
    Np=size(u,1);
    L=size(u,2);
    block=100000;
    Nchunck=Np*L/block;
    fNchunck=floor(Nchunck);
fd = mopen(fichier,'wb',0);
[err,msg] = merror(fd)
if (err <> 0) then 
  printf('Problem opening file:%s\n',msg);
else
    mputstr("RIFF",fd);                         //sGroupID = RIFF
    mput(L*Np*2+44-8,'ui',fd);                  //dwFileLength following WAVE = Data.dwChunkSize + 4 + 20 + 8 
    mputstr("WAVE",fd);                         //sRiffType
    //Format Chunk with a total size of 20 bytes
    mputstr("fmt ",fd);                         //sGroupID
    mput(16,'ui',fd);                           //ChunkSize  the size of what follows; so dwChunkSize and sGroupID don't contribute to this.
    mput(1,'us',fd);                            //wFormatTag
    mput(Np,'us',fd);                           //wChannels.  1= mono
    mput(Fe,'ui',fd);                           //dwSamplesPerSec.  CD audio of 44.1kHz
    mput(Fe*Np*2,'ui',fd);                      //dwAvgBytesPerSec = sampeRate * blockAlign
    mput(Np*2,'us',fd);                         //wBlockAlign = wChannels * (dwBitsPerSample/8)
    mput(16,'us',fd);                           //dwBitsPerSample . 
    //Data Chunk (size 8 bytes)
    mputstr("data",fd);                         //sGroupID
    mput(Np*L*2,'ui',fd);                       //dwChunkSize = number of elements in the sample data = dwSamplesPerSec * wChannels * duration of
audio in seconds
    scale = (32767);                  
    data=int(u*scale);
    //j=1;
    //while(j<=L)
      //      mput(int(u(:,j)*scale),'us',fd);
            //if (i/100000)==int(i/100000) then
            //    printf(".");  //to help me know the program is still running.
            //end
     //   j=j+1;
   // end
    j=0
    while(j<=fNchunck-1)
        mput(u(j*block+1:(j+1)*block),'us',fd);
        j=j+1;
        printf(".");  //to help me know the program is still running.
    end
if fNchunck<Nchunck then mput(int(u((j)*block+1:Np*L)*scale),'us',fd); end

end; //if fd
mclose(fd);

endfunction</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are watching all bug changes.</li>
      </ul>
    </body>
</html>