Differrence in output of 'avg' and 'remix' channel merging

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi there!

I'm working on a PHP application that utilizes sox for the purpose of
converting multi channel RIFF WAVE wav files into a single mono file (with
the same format), and I'm currently updating all outdated packages including
sox. It seems that the old 'avg' effect had been deprecated, and the
recommended replacement is 'remix'. I've got a simple test to make sure that
the output of the script is reasonable, and the results are different from
the old avg version. The generated wav file has valid headers and file size
and both are exactly the same as they used to be in the old avg version, but
the file body does not seem to match with the old avg results.

The tests are:

(THIS TEST STEP IS THE SAME FOR BOTH AVG AND REMIX VERSIONS)
* I have a multi channel wav file with appropriate headers and a single
randomly generated chunk of data repeated over to fill in the file body.
{HEADER} + (( {RANDOM_CHUNK_OF_DATA} * {NUM_OF_CHUNKS_IN_A_CHANNEL} ) *
NUMBER_OF_CHANNELS ) - In this particular scenario this is a stereo file.
- PLEASE SEE BELOW TO SEE A BINARY DUMP OF THE TEST DATA GENERATED IN THAT
PARTICULAR SCENARIO -

(NEW REMIX SCENARIO)
* I use 'sox-14.4.2-r0' with a command of 'sox -t wav stereo -t wav mono
remix 1-2' to merge the channels and create a single mono file and I assert
that the content of the generated file equals to: 
{HEADER_MODIFIED_ACCORDINGLY} + {PREVIOUSLY_GENERATED_RANDOM_CUNK_OF_DATA} *
{NUM_OF_CHUNKS_IN_A_CHANNEL} - Fails, however there are no audible
differences between the old and the new test results
- PLEASE SEE BELOW TO SEE A BINARY DUMP OF THE TEST DATA GENERATED IN THAT
PARTICULAR SCENARIO -

(OLD AVG SCENARIO WAS)
* I use 'sox-12.18.1-1.el5_5.1' with a command of 'sox -t wav stereo -t wav
-c 1 mono avg 2>&1' to merge the channels and create a single mono file and
I assert that the content of the generated file equals to: 
{HEADER_MODIFIED_ACCORDINGLY} + {PREVIOUSLY_GENERATED_RANDOM_CUNK_OF_DATA} *
{NUM_OF_CHUNKS_IN_A_CHANNEL} - Passes, with the same size and headers as the
remix version, but here all chunks of data are identical where as the remix
version most of the chunks are correct, but some are strangely not.

The idea behind the test is that if you merge 2 identical channels into 1,
the generated channel should be the same as either of the test channels used
in the test data, as if you average 2 binary numbers where both numbers are
the same, you should get the same number as the original value that was used
to begin with. I'm not testing any actual scenarios where the each channel
is not identical before the merging would take place, as I'm not really
testing sox, but the application itself, to see if the returned data is not
corrupted in some way or another.

Could you please explain why does the new results are different from the old
avg one? Is this really a bug as I suspect it is?

*DUMP OF THE STEREO TEST DATA USED IN THIS PARTICULAR SCENARIO:*
00000000: 01010010 01001001 01000110 01000110 10110100 00000001  RIFF..
00000006: 00000000 00000000 01010111 01000001 01010110 01000101  ..WAVE
0000000c: 01100110 01101101 01110100 00100000 00010000 00000000  fmt ..
00000012: 00000000 00000000 00000001 00000000 00000010 00000000  ......
00000018: 01000100 10101100 00000000 00000000 00010000 10110001  D.....
0000001e: 00000010 00000000 00000100 00000000 00010000 00000000  ......
00000024: 01100100 01100001 01110100 01100001 10010000 00000001  data..
0000002a: 00000000 00000000 11001101 11110011 11001101 11110011  ......
00000030: 11001101 11110011 11001101 11110011 11001101 11110011  ......
00000036: 11001101 11110011 11001101 11110011 11001101 11110011  ......
0000003c: 11001101 11110011 11001101 11110011 11001101 11110011  ......
00000042: 11001101 11110011 11001101 11110011 11001101 11110011  ......
00000048: 11001101 11110011 11001101 11110011 11001101 11110011  ......
0000004e: 11001101 11110011 11001101 11110011 11001101 11110011  ......
00000054: 11001101 11110011 11001101 11110011 11001101 11110011  ......
0000005a: 11001101 11110011 11001101 11110011 11001101 11110011  ......
00000060: 11001101 11110011 11001101 11110011 11001101 11110011  ......
00000066: 11001101 11110011 11001101 11110011 11001101 11110011  ......
0000006c: 11001101 11110011 11001101 11110011 11001101 11110011  ......
00000072: 11001101 11110011 11001101 11110011 11001101 11110011  ......
00000078: 11001101 11110011 11001101 11110011 11001101 11110011  ......
0000007e: 11001101 11110011 11001101 11110011 11001101 11110011  ......
00000084: 11001101 11110011 11001101 11110011 11001101 11110011  ......
0000008a: 11001101 11110011 11001101 11110011 11001101 11110011  ......
00000090: 11001101 11110011 11001101 11110011 11001101 11110011  ......
00000096: 11001101 11110011 11001101 11110011 11001101 11110011  ......
0000009c: 11001101 11110011 11001101 11110011 11001101 11110011  ......
000000a2: 11001101 11110011 11001101 11110011 11001101 11110011  ......
000000a8: 11001101 11110011 11001101 11110011 11001101 11110011  ......
000000ae: 11001101 11110011 11001101 11110011 11001101 11110011  ......
000000b4: 11001101 11110011 11001101 11110011 11001101 11110011  ......
000000ba: 11001101 11110011 11001101 11110011 11001101 11110011  ......
000000c0: 11001101 11110011 11001101 11110011 11001101 11110011  ......
000000c6: 11001101 11110011 11001101 11110011 11001101 11110011  ......
000000cc: 11001101 11110011 11001101 11110011 11001101 11110011  ......
000000d2: 11001101 11110011 11001101 11110011 11001101 11110011  ......
000000d8: 11001101 11110011 11001101 11110011 11001101 11110011  ......
000000de: 11001101 11110011 11001101 11110011 11001101 11110011  ......
000000e4: 11001101 11110011 11001101 11110011 11001101 11110011  ......
000000ea: 11001101 11110011 11001101 11110011 11001101 11110011  ......
000000f0: 11001101 11110011 11001101 11110011 11001101 11110011  ......
000000f6: 11001101 11110011 11001101 11110011 11001101 11110011  ......
000000fc: 11001101 11110011 11001101 11110011 11001101 11110011  ......
00000102: 11001101 11110011 11001101 11110011 11001101 11110011  ......
00000108: 11001101 11110011 11001101 11110011 11001101 11110011  ......
0000010e: 11001101 11110011 11001101 11110011 11001101 11110011  ......
00000114: 11001101 11110011 11001101 11110011 11001101 11110011  ......
0000011a: 11001101 11110011 11001101 11110011 11001101 11110011  ......
00000120: 11001101 11110011 11001101 11110011 11001101 11110011  ......
00000126: 11001101 11110011 11001101 11110011 11001101 11110011  ......
0000012c: 11001101 11110011 11001101 11110011 11001101 11110011  ......
00000132: 11001101 11110011 11001101 11110011 11001101 11110011  ......
00000138: 11001101 11110011 11001101 11110011 11001101 11110011  ......
0000013e: 11001101 11110011 11001101 11110011 11001101 11110011  ......
00000144: 11001101 11110011 11001101 11110011 11001101 11110011  ......
0000014a: 11001101 11110011 11001101 11110011 11001101 11110011  ......
00000150: 11001101 11110011 11001101 11110011 11001101 11110011  ......
00000156: 11001101 11110011 11001101 11110011 11001101 11110011  ......
0000015c: 11001101 11110011 11001101 11110011 11001101 11110011  ......
00000162: 11001101 11110011 11001101 11110011 11001101 11110011  ......
00000168: 11001101 11110011 11001101 11110011 11001101 11110011  ......
0000016e: 11001101 11110011 11001101 11110011 11001101 11110011  ......
00000174: 11001101 11110011 11001101 11110011 11001101 11110011  ......
0000017a: 11001101 11110011 11001101 11110011 11001101 11110011  ......
00000180: 11001101 11110011 11001101 11110011 11001101 11110011  ......
00000186: 11001101 11110011 11001101 11110011 11001101 11110011  ......
0000018c: 11001101 11110011 11001101 11110011 11001101 11110011  ......
00000192: 11001101 11110011 11001101 11110011 11001101 11110011  ......
00000198: 11001101 11110011 11001101 11110011 11001101 11110011  ......
0000019e: 11001101 11110011 11001101 11110011 11001101 11110011  ......
000001a4: 11001101 11110011 11001101 11110011 11001101 11110011  ......
000001aa: 11001101 11110011 11001101 11110011 11001101 11110011  ......
000001b0: 11001101 11110011 11001101 11110011 11001101 11110011  ......
000001b6: 11001101 11110011 11001101 11110011 11001101 11110011  ......

*DUMP OF THE OLD AVG MERGE RESULT:*
00000000: 01010010 01001001 01000110 01000110 11101100 00000000  RIFF..
00000006: 00000000 00000000 01010111 01000001 01010110 01000101  ..WAVE
0000000c: 01100110 01101101 01110100 00100000 00010000 00000000  fmt ..
00000012: 00000000 00000000 00000001 00000000 00000001 00000000  ......
00000018: 01000100 10101100 00000000 00000000 10001000 01011000  D....X
0000001e: 00000001 00000000 00000010 00000000 00010000 00000000  ......
00000024: 01100100 01100001 01110100 01100001 11001000 00000000  data..
0000002a: 00000000 00000000 11001101 11110011 11001101 11110011  ......
00000030: 11001101 11110011 11001101 11110011 11001101 11110011  ......
00000036: 11001101 11110011 11001101 11110011 11001101 11110011  ......
0000003c: 11001101 11110011 11001101 11110011 11001101 11110011  ......
00000042: 11001101 11110011 11001101 11110011 11001101 11110011  ......
00000048: 11001101 11110011 11001101 11110011 11001101 11110011  ......
0000004e: 11001101 11110011 11001101 11110011 11001101 11110011  ......
00000054: 11001101 11110011 11001101 11110011 11001101 11110011  ......
0000005a: 11001101 11110011 11001101 11110011 11001101 11110011  ......
00000060: 11001101 11110011 11001101 11110011 11001101 11110011  ......
00000066: 11001101 11110011 11001101 11110011 11001101 11110011  ......
0000006c: 11001101 11110011 11001101 11110011 11001101 11110011  ......
00000072: 11001101 11110011 11001101 11110011 11001101 11110011  ......
00000078: 11001101 11110011 11001101 11110011 11001101 11110011  ......
0000007e: 11001101 11110011 11001101 11110011 11001101 11110011  ......
00000084: 11001101 11110011 11001101 11110011 11001101 11110011  ......
0000008a: 11001101 11110011 11001101 11110011 11001101 11110011  ......
00000090: 11001101 11110011 11001101 11110011 11001101 11110011  ......
00000096: 11001101 11110011 11001101 11110011 11001101 11110011  ......
0000009c: 11001101 11110011 11001101 11110011 11001101 11110011  ......
000000a2: 11001101 11110011 11001101 11110011 11001101 11110011  ......
000000a8: 11001101 11110011 11001101 11110011 11001101 11110011  ......
000000ae: 11001101 11110011 11001101 11110011 11001101 11110011  ......
000000b4: 11001101 11110011 11001101 11110011 11001101 11110011  ......
000000ba: 11001101 11110011 11001101 11110011 11001101 11110011  ......
000000c0: 11001101 11110011 11001101 11110011 11001101 11110011  ......
000000c6: 11001101 11110011 11001101 11110011 11001101 11110011  ......
000000cc: 11001101 11110011 11001101 11110011 11001101 11110011  ......
000000d2: 11001101 11110011 11001101 11110011 11001101 11110011  ......
000000d8: 11001101 11110011 11001101 11110011 11001101 11110011  ......
000000de: 11001101 11110011 11001101 11110011 11001101 11110011  ......
000000e4: 11001101 11110011 11001101 11110011 11001101 11110011  ......
000000ea: 11001101 11110011 11001101 11110011 11001101 11110011  ......
000000f0: 11001101 11110011 11001101 11110011                    ....

*DUMP OF THE NEW REMIX MERGE RESULT:*
00000000: 01010010 01001001 01000110 01000110 11101100 00000000  RIFF..
00000006: 00000000 00000000 01010111 01000001 01010110 01000101  ..WAVE
0000000c: 01100110 01101101 01110100 00100000 00010000 00000000  fmt ..
00000012: 00000000 00000000 00000001 00000000 00000001 00000000  ......
00000018: 01000100 10101100 00000000 00000000 10001000 01011000  D....X
0000001e: 00000001 00000000 00000010 00000000 00010000 00000000  ......
00000024: 01100100 01100001 01110100 01100001 11001000 00000000  data..
0000002a: 00000000 00000000 11001101 11110011 11001101 11110011  ......
00000030: 11001101 11110011 11001101 11110011 11001100 11110011  ......
00000036: 11001101 11110011 11001101 11110011 11001110 11110011  ......
0000003c: 11001101 11110011 11001101 11110011 11001100 11110011  ......
00000042: 11001101 11110011 11001101 11110011 11001101 11110011  ......
00000048: 11001101 11110011 11001101 11110011 11001101 11110011  ......
0000004e: 11001101 11110011 11001101 11110011 11001101 11110011  ......
00000054: 11001100 11110011 11001101 11110011 11001101 11110011  ......
0000005a: 11001100 11110011 11001101 11110011 11001101 11110011  ......
00000060: 11001101 11110011 11001101 11110011 11001101 11110011  ......
00000066: 11001101 11110011 11001110 11110011 11001101 11110011  ......
0000006c: 11001101 11110011 11001101 11110011 11001101 11110011  ......
00000072: 11001100 11110011 11001101 11110011 11001101 11110011  ......
00000078: 11001101 11110011 11001101 11110011 11001101 11110011  ......
0000007e: 11001101 11110011 11001101 11110011 11001101 11110011  ......
00000084: 11001101 11110011 11001101 11110011 11001101 11110011  ......
0000008a: 11001110 11110011 11001101 11110011 11001101 11110011  ......
00000090: 11001101 11110011 11001100 11110011 11001110 11110011  ......
00000096: 11001100 11110011 11001101 11110011 11001101 11110011  ......
0000009c: 11001101 11110011 11001101 11110011 11001101 11110011  ......
000000a2: 11001101 11110011 11001101 11110011 11001100 11110011  ......
000000a8: 11001101 11110011 11001101 11110011 11001101 11110011  ......
000000ae: 11001110 11110011 11001101 11110011 11001101 11110011  ......
000000b4: 11001110 11110011 11001101 11110011 11001110 11110011  ......
000000ba: 11001101 11110011 11001100 11110011 11001101 11110011  ......
000000c0: 11001101 11110011 11001101 11110011 11001100 11110011  ......
000000c6: 11001101 11110011 11001101 11110011 11001101 11110011  ......
000000cc: 11001101 11110011 11001101 11110011 11001101 11110011  ......
000000d2: 11001101 11110011 11001100 11110011 11001101 11110011  ......
000000d8: 11001101 11110011 11001100 11110011 11001110 11110011  ......
000000de: 11001110 11110011 11001101 11110011 11001101 11110011  ......
000000e4: 11001110 11110011 11001101 11110011 11001100 11110011  ......
000000ea: 11001101 11110011 11001100 11110011 11001101 11110011  ......
000000f0: 11001101 11110011 11001101 11110011                    ....

EASY TO SEE GRAPHICAL DIFF BETWEEN THE OLD AND THE NEW RESULT
<https://s31.postimg.org/ha9f81yzv/Screenshot_at_2016_07_25_14_14_48.png>  

Thanks;
Gyula



--
View this message in context: http://sox.10957.n7.nabble.com/Differrence-in-output-of-avg-and-remix-channel-merging-tp5731.html
Sent from the SoX mailing list archive at Nabble.com.

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports.http://sdm.link/zohodev2dev
_______________________________________________
Sox-users mailing list
Sox-users@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/sox-users



[Index of Archives]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux