title
Products            Buy            Support Forum            Professional            About            Codec Central
 

SSRC and SOX

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jacobacci

    • Dec 2014
    • 43

    SSRC and SOX

    I am aware that the request to add a SOX plugin has been raised several times. I would like to support this request with the following reasoning:
    The last version of SSRC (1.30) was published June 30, 2005. SOX is currently still being developed and the last version was 14.4.2, released on February 22, 2015.
    SOX is more flexible than SSRC. For example it allows to select the phase behaviour during the conversion, which SSRC does not. Our listening panel can definitely hear the difference between different phase behaviours and it is not always the same setting which is optimal to our ears. The difference is also visible in the time domain. This picture shows the result using different settings of SOX and has SSRC HP and SSRC at the bottom.
    Click image for larger version

Name:	rate-44k1-96k.png
Views:	1
Size:	7.0 KB
ID:	296953
    I would really appreciate it, if SOX could be made available as a plugin to dbpoweramp. I don't think anyone has anything to lose by this.
    I tried to get SOX to work by using the CLI encoder and CLI DSP functions, but could not get it to work. Maybe I simply missed something.

    On a sidenote. In the current user interface of the SSRC plugin 176000Hz is missing as a target samplerate.
    Thanks a lot for considering this request.
  • Spoon
    Administrator
    • Apr 2002
    • 44575

    #2
    Re: SSRC and SOX

    It should be possible with Run External DSP effect, you should select 'Before Conversion', which command line are you using?
    Spoon
    www.dbpoweramp.com

    Comment

    • jacobacci

      • Dec 2014
      • 43

      #3
      Re: SSRC and SOX

      I am trying to invoke it from Xiklone. The conversion task runs, but the file remains at 176.4kHz.
      I have attached the screenshot from the Xiklone command line. I am using
      [infile] --rate 44100
      Attached Files

      Comment

      • Spoon
        Administrator
        • Apr 2002
        • 44575

        #4
        Re: SSRC and SOX

        Without looking at sox command line, this would not work if there were spaces in the file name, at the least you would need

        "[infile]"

        and perhaps a command line option so specify it is the in file, does it need an out file setting also?
        Spoon
        www.dbpoweramp.com

        Comment

        • jacobacci

          • Dec 2014
          • 43

          #5
          Re: SSRC and SOX

          I have done the following:
          - Eliminated Xiklone as a source of error and gone to a plain conversion FLAC -> FLAC with Music Converter
          - tried all possible combinations of - (StdIn), infile, outfile

          - "[outfile]" --rate 44100
          "[infile]" "[outfile]" --rate 44100
          "[infile]" --rate 44100

          But the file comes out in 176400 every time

          Click image for larger version

Name:	SOX Conversion Command Line.jpg
Views:	1
Size:	94.0 KB
ID:	292915

          Comment

          • Spoon
            Administrator
            • Apr 2002
            • 44575

            #6
            Re: SSRC and SOX

            You have to first get working direct away from dBpoweramp, create a wave file then try to run sox from the command line to get it to reduce the frequency of the wave file.
            Spoon
            www.dbpoweramp.com

            Comment

            • jacobacci

              • Dec 2014
              • 43

              #7
              Re: SSRC and SOX

              Ok, results from next round of testing:
              Running SOX from a batch file (outside dbpoweramp) works without issues. This is the output windows of the conversion:

              Code:
              D:\RF My Music\My Music Utilities\Tools\SOX\sox>sox -V3 1.flac 2.flac rate -v 44100
              sox:      SoX v14.4.2
              sox INFO formats: detected file format type `flac'
              
              Input File     : '1.flac'
              Channels       : 2
              Sample Rate    : 176400
              Precision      : 24-bit
              Duration       : 00:14:50.05 = 157004042 samples ~ 66753.4 CDDA sectors
              File Size      : 532M
              Bit Rate       : 4.78M
              Sample Encoding: 24-bit FLAC
              Endian Type    : little
              Reverse Nibbles: no
              Reverse Bits   : no
              Comments       :
              Title=Piano Concerto No.3 in D minor, Op.30: 1. Allegro ma non tanto
              Album=++Janis, Byron
              Artist=Rachmaninov, Sergei
              Genre=Classical
              ALBUMARTIST=Rachmaninov, Sergei
              DATE=1991
              TRACKNUMBER=01
              
              sox INFO sox: Overwriting `2.flac'
              sox INFO flac: encoding at 24 bits per sample
              
              Output File    : '2.flac'
              Channels       : 2
              Sample Rate    : 44100
              Precision      : 24-bit
              Duration       : 00:14:50.05 = 39251010 samples = 66753.4 CDDA sectors
              Sample Encoding: 24-bit FLAC
              Endian Type    : little
              Reverse Nibbles: no
              Reverse Bits   : no
              Comments       :
              Title=Piano Concerto No.3 in D minor, Op.30: 1. Allegro ma non tanto
              Album=++Janis, Byron
              Artist=Rachmaninov, Sergei
              Genre=Classical
              ALBUMARTIST=Rachmaninov, Sergei
              DATE=1991
              TRACKNUMBER=01
              
              sox INFO sox: effects chain: input       176400Hz  2 channels
              sox INFO sox: effects chain: rate         44100Hz  2 channels
              sox INFO sox: effects chain: output       44100Hz  2 channels
              
              D:\RF My Music\My Music Utilities\Tools\SOX\sox>pause
              Press any key to continue . . .
              Note that SOX is able to directly decode and reencode FLAC.
              I noted that the syntax for the target sampling rate is "rate" and not "--rate".

              With this info, I tried again to use SOX as a DSP within Music Converter. The command line I used was:
              - rate -v 44100
              The file conversion ran, but the resulting wav file still had a samplerate of 176400.

              Then I remembered something Daren (the developer of Xiklone) had told me. I put the sample rate of the WAV converter to 44100 instead of auto. Now the target file has a samplerate of 44100.

              This is not useable for me, as I need to go FLAC -> resample -> FLAC. If I chose the FLAC converter, the target file remains at 176400. How do I solve this?
              Last edited by jacobacci; April 30, 2015, 07:57 PM.

              Comment

              • Spoon
                Administrator
                • Apr 2002
                • 44575

                #8
                Re: SSRC and SOX

                The issue is, you have to specify only 1 filename, [infile], the external component has to update this file, not create a 2nd file.

                Potentially you could do with a batch file, and pass the infile as a %1 variable into the batch file. The batch file would do the conversion with sox to 2nd file, then copy 2nd file over the first file.
                Spoon
                www.dbpoweramp.com

                Comment

                • jacobacci

                  • Dec 2014
                  • 43

                  #9
                  Re: SSRC and SOX

                  Thanks Spoon that clarifies how dbpoweramp handles external DSPs.
                  If I understand you correctly, the source file gets modified (resampled) by the external DSP (in this case SOX) and then this modified source file gets fed to the dbpoweramp internal encoder. Is this understanding correct?

                  If yes, this is not at all what I would like to do.
                  Using Xiklone, I would like to create a downsampled library version of my high resolution files in another folder, leaving the original high resolution files intact. For reasons outlined in my first post, I prefer using SOX to SSRC, mainly, because SSRC only has an extremely steep minimal phase filter which has a very high amount of pre ringing. I would rather not use that.

                  Another thought: Could SOX possibly be used as a CLI Encoder? It accepts input through StdIn and should behave like any other external encoder. Nice thing would be that I could easily build a user interface for the different parameters with encoder.txt
                  Last edited by jacobacci; May 01, 2015, 09:50 AM.

                  Comment

                  • Spoon
                    Administrator
                    • Apr 2002
                    • 44575

                    #10
                    Re: SSRC and SOX

                    dBpoweramp takes the source file, it creates a temporary wave file, this is passed to external dsp, it should be modified by the external DSP, this file is then fed into the encoder.
                    Spoon
                    www.dbpoweramp.com

                    Comment

                    • jacobacci

                      • Dec 2014
                      • 43

                      #11
                      Re: SSRC and SOX

                      That would be ok.
                      The problem is that the file ends up resampled only in one case:

                      It ends up as 176400 (samplerate of source file)
                      - passing to FLAC encoder
                      - passing to WAV encoder if samplerate is set to AUTO

                      It ends up as 44100
                      -passing to WAV encoder if samplerate of the WAV encoder is manually set to 44100

                      I have a sneaky feeling that in the last case it is the WAV encoder doing something to the file, not the external SOX DSP.
                      To check I have done a conversion with NO external DSP and the WAV encoder manually set to 44100 and the file ended up 44100 (source being 176400).

                      I must say, I am a bit stuck how to get this to work......

                      Comment

                      • Spoon
                        Administrator
                        • Apr 2002
                        • 44575

                        #12
                        Re: SSRC and SOX

                        >It ends up as 44100
                        >-passing to WAV encoder if samplerate of the WAV encoder is manually set to 44100

                        Yes...because dBpoweramp does the resampling when you manually set a frequency.
                        Spoon
                        www.dbpoweramp.com

                        Comment

                        • jacobacci

                          • Dec 2014
                          • 43

                          #13
                          Re: SSRC and SOX

                          Aha, that expains it.

                          Comment

                          • jacobacci

                            • Dec 2014
                            • 43

                            #14
                            Re: SSRC and SOX

                            I think I am getting closer to a solution.
                            I have now tried setting up SOX as an encoder and it seems to be working.

                            a quick encoder.txt for testing is as follows:

                            Code:
                            [codec]
                            .flac
                            sox.exe
                            
                            [clistring]
                            "[infile]" "[outfile]" rate -v 48000
                            Seems to do the job.
                            The conversion takes a 192kHz flac file as input and produces a 48kHz flac file as output.

                            The only thing a bit strange is the progress bar when the conversion runs.
                            For a few seconds it says "encoding" and the progress bar goes almost to the end.
                            Then for another few seconds it says "compressing audio with CLI encoder" until it reports "finished".

                            The resulting file seems to play ok.
                            Now I just need to build an encoder.txt with which to set the parameters for SOX.

                            Comment

                            • jacobacci

                              • Dec 2014
                              • 43

                              #15
                              Re: SSRC and SOX

                              I now have an encoder.txt file which has the relevant parameters for resampling with SOX and seems to work.

                              Code:
                              [codec]
                              .flac
                              sox.exe
                              
                              
                              [clistring]
                              "[infile]" "[outfile]" rate
                              
                              
                              [combo]
                              180
                              40
                              110
                              1
                              Quality
                              
                              normal
                              
                              VHQ
                               -v
                              
                              
                              [slider]
                              175
                              10
                              120
                              6
                              Phase: 0% (minimum)
                               -p 0
                              Phase: 5%
                               -p 5
                              Phase: 10%
                               -p 10
                              Phase: 15%
                               -p 15
                              Phase: 20%
                               -p 20
                              Phase: 25% (intermediate)
                               -p 25
                              Phase: 30%
                               -p 30
                              Phase: 35%
                               -p 35
                              Phase: 40%
                               -p 40
                              Phase: 45%
                               -p 45
                              Phase: 50% (linear)
                               -p 50
                              
                              
                              
                              [slider]
                              0
                              10
                              170
                              6
                              Passband: 90%
                               -b 90
                              Passband: 91%
                               -b 91
                              Passband: 92%
                               -b 92
                              Passband: 93%
                               -b 93
                              Passband: 94%
                               -b 94
                              Passband: 95%
                              
                              Passband: 95.5%
                               -b 95.5
                              Passband: 96.0%
                               -b 96
                              Passband: 96.5%
                               -b 96.5
                              Passband: 97.0%
                               -b 97
                              Passband: 97.5%
                               -b 97.5
                              Passband: 98.0%
                               -b 98
                              Passband: 98.2%
                               -b 98.2
                              Passband: 98.4%
                               -b 98.4
                              Passband: 98.6%
                               -b 98.6
                              Passband: 98.8%
                               -b 98.8
                              Passband: 99.0%
                               -b 99
                              Passband: 99.1%
                               -b 99.1
                              Passband: 99.2%
                               -b 99.2
                              Passband: 99.3%
                               -b 99.3
                              Passband: 99.4%
                               -b 99.4
                              Passband: 99.5%
                               -b 99.5
                              Passband: 99.6%
                               -b 99.6
                              Passband: 99.7%
                               -b 99.7
                              
                              
                              
                              [checkbox]
                              65
                              67
                              0
                              allow aliasing / imaging
                               -a
                              
                              
                              [combo]
                              55
                              40
                              110
                              1
                              Target Samplerate
                              
                              8'000
                               8000
                              11'050
                               11050
                              16'000
                               16000
                              22'500
                               22500
                              32'000
                               32000
                              44'100
                               44100
                              48'000
                               48000
                              88'200
                               88200
                              96'000
                               96000
                              176'400
                               176400
                              192'000
                               192000
                              352'800
                               352800
                              384'000
                               384000
                              So far it has not crashed on me. The progress bar still behaves a bit strange. I suspect this is because the source flac file get converted back and forth between flac and wav a few times. Maybe the experts can help with a way to eliminate this.
                              I have not attempted to make the encoding.txt accept different input file formats or produce different output file formats. It takes a flac file and generates a resampled flac file in the end.
                              I appreciate any feedback and improvement suggestions.
                              Thanks for bearing with me, Spoon.

                              Comment

                              Working...

                              ]]>