Menu

Sample truncation & looping - possible bug?

Help
2008-08-22
2013-04-15
  • Dave Lindsay

    Dave Lindsay - 2008-08-22

    I've been testing the windows version of RC quite a bit and have noticed a few quirks that could be bugs or user error on my part for not fully understanding how they operate.

    I'm attempting to clip a 30s file into any duration less than 30s. The two parameters that purport to do that don't seem to function the way I believed they would:

    -spt: This parameter always clips duration to 5 seconds/5000ms for positive or negative values that are equal to or less than the actual input file duration. When the sampleplaytime is longer than the input source, no truncation is applied (which is correct) but for any value equal to or less than the input duration, the sample is ALWAYS truncated to 5 seconds, not the desired input value

    -sof: similar error when using sample offset parameter. vales in ms below the input duration are clipped to 5 seconds no matter what -- or below

    However, sample loop time does accomplish the truncation or looping I'm after:

    -slt: this function DOES in fact clip the input to match the output duration if the input is longer than the desired output and loops samples to fill output duration - perfect!

     
    • Till Toenshoff

      Till Toenshoff - 2008-08-24

      Thanks for trying RetroCode!

      ---****---
      -spt: This parameter always clips duration to 5 seconds/5000ms for positive or negative values that are equal to or less than the actual input file duration.
      When the sampleplaytime is longer than the input source, no truncation is applied (which is correct) but for any value equal to or less than the input duration, the sample is ALWAYS truncated to 5 seconds, not the desired input value
      ---****---

      Tested that with a two minute MP3, cutting it to ten seconds by running the following:
      > code test.mp3 out.wav -spt 10000
      The result was a 10second WAVE, just as expected. Please give some more hints on 1. input data format, size or playtime and 2. complete commandline used

      ---****---
      -sof: similar error when using sample offset parameter. vales in ms below the input duration are clipped to 5 seconds no matter what -- or below
      ---****---
      > code test.mp3 out.wav -sof 10000
      The result was a WAVE file that starts after 10seconds of the original sample. BUT, there really seems to be a problem, the resulting playtime was only about 3 seconds long. That is a bug!
      I located the problem in code/Crop.cpp line 83, there were some missing brackets and the fixed line would be:
      --snip--
      unsigned long int nTimePerData=(unsigned long int)(((LONGLONG)nSourceSize*1000)/((m_nSampleRate*(m_nBitsPerSample>>3))*m_nChannels));
      --snap--
      That bug has been fixed on CVS. As I am currently still trying to get autotools to process everything properly, new windows binaries will have a wait a little.

       
    • Dave Lindsay

      Dave Lindsay - 2008-08-24

      Thanks for this quick response, Till. I tested again with a different WAV file (couldn't get MP3s to work -- "unknown source file format/ERROR: failed to read source file")

      I've tried operating on a different, longer WAV file using the simple command + parameters as you suggested, desiring truncation at 30 seconds [code ringer.wav out.wav -spt 30000]. All appeared to process properly, but instead of cutting at 5 seconds, as before, truncation occurred at 10 seconds, but still not at 30. A second attempt with the same WAV with truncation set for 60 seconds yielded the same 10s truncated output [code ringer.wav out.wav -spt 60000].

      I've decoded a different MP3 to WAV to give me a fresh file to work with and still got a truncation at 10s for the -spt parameter. Could you try on your end with a clip time greater than 10000ms? I will post a link to the WAV I am using (privately) so you can attempt to replicate.

      Here is the output from the command line window. Take note -- the playtime of 30000 is correct but the destination filesize is 1785697 -- 1/3 as large as it shoud be. A 30s 2ch wav at 1411kbps should be  roughly 5292104 bytes.

      C:\Program Files\MMSGURU\RetroCode>code ringer.wav out.wav -spt 30000
      using default title: out

      reading ringer.wav...
      file format identified as: Wave
      sample size: 31850492
      bits per sample: 16, sample rate: 44100Hz, channels: 2, file data: 31850536 byte
      , PCM data: 31850492 byte

      metadata:
      title out

      cutting sample down - offset: 0ms, playtime: 30000ms...

      really cropping...
      destination size: 1785697 bytes
      creating destination file out.wav...
      Wave encoded and written successfully
      bits per sample: 16, sample rate: 44100Hz, channels: 2, file data: 1785765 byte,
      PCM data: 1785697 byte

      RetroCode Processing Status: OK
      /////////////////////////////////
      Successfully converted files: 1, Files that failed conversion: 0

       
    • Till Toenshoff

      Till Toenshoff - 2008-08-31

      CVS fixes: truncation (spt and sof) fixed, MP3 (ID3V2.2) recognition fixed
      CVS addon: optional rendering of the fact-chunk for Wave-files

      New binaries coming soon.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.