Hi Jeremy and thanks for the quick answer (and sorry for the not very precise report)
- I'm on OSX Mojave 10.14.6
- sox has been installed through brew `brew install sox`
- `sox --version` gives `sox: SoX v`
- `brew info sox`gives
```sox: stable 14.4.2 (bottled)SOund eXchange: universal sound sample translator/usr/local/Cellar/sox/14.4.2_3 (23 files, 1.8MB) *Poured from bottle on 2019-05-17 at 16:19:01==> DependenciesBuild: pkg-config ✔Required: flac ✘, lame ✔, libpng ✔, libsndfile ✔, libvorbis ✔, mad ✔, opusfile ✘==> Analyticsinstall: 2,592 (30 days), 7,521 (90 days), 36,263 (365 days)install-on-request: 2,436 (30 days), 7,051 (90 days), 32,403 (365 days)build-error: 0 (30 days)```
- SOX_OPTS is empty when I `echo $SOX_OPTS`
If I launch
```
sox -V3 vocals.wav vocals-V3.mp3
```
I get
```sox: SoX v
sox INFO formats: detected file format type `wav'
Input File : 'vocals.wav'
Channels : 2
Sample Rate : 44100
Precision : 16-bit
Duration : 00:03:00.00 = 7938000 samples = 13500 CDDA sectors
File Size : 31.8M
Bit Rate : 1.41M
Sample Encoding: 16-bit Signed Integer PCM
Endian Type : little
Reverse Nibbles: no
Reverse Bits : no
sox INFO sox: Overwriting `vocals-V3.mp3'
sox INFO mp3: using MP3 encoding defaults
Output File : 'vocals-V3.mp3'
Channels : 2
Sample Rate : 44100
Precision : 24-bit
Duration : 00:03:00.00 = 7938000 samples = 13500 CDDA sectors
Sample Encoding: MPEG audio (layer I, II or III)
Comment : 'Processed by SoX'
sox INFO sox: effects chain: input 44100Hz 2 channels
sox INFO sox: effects chain: output 44100Hz 2 channels```
Which seems good but when I do
```soxi vocals-V3.mp3```
I still get a different number of samples and duration
```Input File : 'vocals-V3.mp3'Channels : 2Sample Rate : 44100Precision : 16-bitDuration : 00:03:00.04 = 7939544 samples = 13502.6 CDDA sectorsFile Size : 2.88MBit Rate : 128kSample Encoding: MPEG audio (layer I, II or III)```
I notice that the precision is different and if I launch
It ends up with the same result```sox -V3 vocals.wav -b 24 vocals-V3.mp3```
but```sox: SoX vsox INFO formats: detected file format type `wav'Input File : 'vocals.wav'Channels : 2Sample Rate : 44100Precision : 16-bitDuration : 00:03:00.00 = 7938000 samples = 13500 CDDA sectorsFile Size : 31.8MBit Rate : 1.41MSample Encoding: 16-bit Signed Integer PCMEndian Type : littleReverse Nibbles: noReverse Bits : nosox WARN formats: mp3 can't encode to 24-bitsox INFO mp3: using MP3 encoding defaultsOutput File : 'vocals-V3.mp3'Channels : 2Sample Rate : 44100Precision : 24-bitDuration : 00:03:00.00 = 7938000 samples = 13500 CDDA sectorsSample Encoding: MPEG audio (layer I, II or III)Comment : 'Processed by SoX'sox INFO sox: effects chain: input 44100Hz 2 channelssox INFO sox: effects chain: output 44100Hz 2 channels```
```soxi vocals-V3.mp3```
still gives
Here a try with V4 ```sox -V4 vocals.wav vocals-V4.mp3 && soxi vocals-V4.mp3``````Input File : 'vocals-V3.mp3'
Channels : 2
Sample Rate : 44100
Precision : 16-bit
Duration : 00:03:00.04 = 7939544 samples = 13502.6 CDDA sectors
File Size : 2.88M
Bit Rate : 128k
Sample Encoding: MPEG audio (layer I, II or III)```
```sox: SoX vtime: Jan 9 2019 13:31:37uname: Darwin MBP-de-Martin 18.7.0 Darwin Kernel Version 18.7.0: Tue Aug 20 16:57:14 PDT 2019; root:xnu-4903.271.2~2/RELEASE_X86_64 x86_64compiler: gcc 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.11.45.5)arch: 1288 48 88 Lsox INFO formats: detected file format type `wav'sox DBUG wav: Searching for 66 6d 74 20sox DBUG wav: WAV Chunk fmtsox DBUG wav: Searching for 64 61 74 61sox DBUG wav: WAV Chunk datasox DBUG wav: Reading Wave file: Microsoft PCM format, 2 channels, 44100 samp/secsox DBUG wav: 176400 byte/sec, 4 block align, 16 bits/samp, 31752000 data bytessox DBUG wav: 7938000 Samps/chanssox DBUG wav: Searching for 4c 49 53 54Input File : 'vocals.wav'Channels : 2Sample Rate : 44100Precision : 16-bitDuration : 00:03:00.00 = 7938000 samples = 13500 CDDA sectorsFile Size : 31.8MBit Rate : 1.41MSample Encoding: 16-bit Signed Integer PCMEndian Type : littleReverse Nibbles: noReverse Bits : nosox DBUG mp3: -C option is infsox INFO mp3: using MP3 encoding defaultsOutput File : 'vocals-V4.mp3'Channels : 2Sample Rate : 44100Precision : 24-bitDuration : 00:03:00.00 = 7938000 samples = 13500 CDDA sectorsSample Encoding: MPEG audio (layer I, II or III)Comment : 'Processed by SoX'sox INFO sox: effects chain: input 44100Hz 2 channels (multi) 16 bits 00:03:00.00sox INFO sox: effects chain: output 44100Hz 2 channels (multi) 24 bits 00:03:00.00sox DBUG sox: start-up time = 0.001929Input File : 'vocals-V4.mp3'Channels : 2Sample Rate : 44100Precision : 16-bitDuration : 00:03:00.04 = 7939544 samples = 13502.6 CDDA sectorsFile Size : 2.88MBit Rate : 128kSample Encoding: MPEG audio (layer I, II or III)```
And same with V5, V6 etc..
For the trimming
I noticed there are 1544 more samples in the resulting mp3 file, so I tried to trim them using this command```sox -V3 vocals.mp3 vocals-trimmed.mp3 trim 1544s && soxi vocals-trimmed.mp3```
which gives
```sox: SoX vInput File : 'vocals.mp3'Channels : 2Sample Rate : 44100Precision : 16-bitDuration : 00:03:00.04 = 7939544 samples = 13502.6 CDDA sectorsFile Size : 2.88MBit Rate : 128kSample Encoding: MPEG audio (layer I, II or III)sox INFO sox: Overwriting `vocals-trimmed.mp3'sox INFO mp3: using MP3 encoding defaultsOutput File : 'vocals-trimmed.mp3'Channels : 2Sample Rate : 44100Precision : 24-bitSample Encoding: MPEG audio (layer I, II or III)Comment : 'Processed by SoX'sox INFO sox: effects chain: input 44100Hz 2 channelssox INFO sox: effects chain: trim 44100Hz 2 channelssox INFO sox: effects chain: output 44100Hz 2 channelsInput File : 'vocals-trimmed.mp3'Channels : 2Sample Rate : 44100Precision : 16-bitDuration : 00:03:00.01 = 7938397 samples = 13500.7 CDDA sectorsFile Size : 2.88MBit Rate : 128kSample Encoding: MPEG audio (layer I, II or III)```
So "it does not work" means, the resulting file is not exactly trimmed of 1544s as expected because there are 1147 left
It takes approximately 3s
I hope the description is clearer
Let me know if I can give you more information
Thanks
-----------------------------------------------------------------------
Martin RATINAUD
-----------------------------------------------------------------------
Martin RATINAUD
-----------------------------------------------------------------------
On Wed, Dec 11, 2019 at 9:39 PM Jeremy Nicoll - ml sox users <jn.ml.sxu.88@xxxxxxxxxxxxxxxxxxxx> wrote:
On 2019-12-11 14:26, Martin Ratinaud wrote:
> Hi all,
>
> I'm converting a file called vocals.wav to vocals.mp3
> vocals.wav
> <https://drive.google.com/file/d/1he1eCJag1G8iGkgL932jy_mXuLT_khGM/view?usp=drive_web>
> For this I'm using this command
>
> ```
> sox vocals.wav vocals.mp3
> ```
> and here is the result of the corresponding files
>
> - original file
> ```
> soxi /Users/martin/Downloads/split-test/vocals.wav
>
> Input File : '/Users/martin/Downloads/split-test/vocals.wav'
> Channels : 2
> Sample Rate : 44100
> Precision : 16-bit
> Duration : 00:03:00.00 = 7938000 samples = 13500 CDDA sectors
> File Size : 31.8M
> Bit Rate : 1.41M
> Sample Encoding: 16-bit Signed Integer PCM
> ```
>
> - converted file
> ```
> soxi /Users/martin/Downloads/split-test/vocals.mp3
>
> Input File : '/Users/martin/Downloads/split-test/vocals.mp3'
> Channels : 2
> Sample Rate : 44100
> Precision : 16-bit
> Duration : 00:03:00.04 = 7939544 samples = 13502.6 CDDA sectors
> File Size : 2.88M
> Bit Rate : 128k
> Sample Encoding: MPEG audio (layer I, II or III)
> ```
>
> You can see that the duration is not the same which is weird and the
> number
> of samples also changed.
> In fact, 1544 samples have been added to the beginning of the file
Which version of sox, on what OS?
Did you build the sox binary yourself or download it from somewhere?
Although you say the command was just
sox vocals.wav vocals.mp3
sox can also incorporate values of environment variables. Is there any
chance that on your OS the command has included any other parameters?
See the 'SOX_OPTS' section of the manual.
If you reissue the command, as eg
sox -V3 vocals.wav vocals002.mp3
(or even -V4 or more) do any of the info messsages give any clues? Is
the
result file the same size as your one?
> If I try to launch `sox -V vocals.mp3 vocals-trimmed.mp3 trim 1544s` it
> does not work
You'll need to be more precise. What sort of "not work"? Does sox
run?
Does it produce any messages? Is there a result file? How long was it?
--
Jeremy Nicoll - my opinions are my own
_______________________________________________
Sox-users mailing list
Sox-users@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/sox-users
_______________________________________________ Sox-users mailing list Sox-users@xxxxxxxxxxxxxxxxxxxxx https://lists.sourceforge.net/lists/listinfo/sox-users