[Bugzilla] [Bug 13718] has changed cc

bugzilla.admin at scilab.org bugzilla.admin at scilab.org
Tue Apr 21 11:31:25 CEST 2015


http://bugzilla.scilab.org/show_bug.cgi?id=13718
--------- Bug Summary -----------
savewave $ wavewrite both limited to 2^20 stereo samples: < 24 sec @ 44100 samp/sec

---------- Changed by ------------
maxime.keller at gmail.com

---------- What changed ----------
cc


maxime.keller at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |maxime.keller at gmail.com

--- Comment #2 from maxime.keller at gmail.com ---
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

-- 
You are receiving this mail because:
You are watching all bug changes.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/bugzilla/attachments/20150421/eefba79e/attachment.htm>


More information about the Bugzilla mailing list