When using the trim command with sample parameters, the trim is done according to the input sample rate. It would be nice to have the option to trim after resampling.
e.g.
sox.exe in_32k.wav -L -r 44.1k -b 16 out.wav trim 0 100s
results in an output file 135 samples long, rather than 100 samples.
Even though the resampling effect by default is inserted at the end (if there is a mismatch between the sample rate at that point and the desired output rate), you can manually put it wherever you like. This should do what you want: