Showsamples: A Detailed Example

Feb 15, 2011

The following is a detailed example of Showsamples. The test file used is:
  Stereo 24bit/48kHz Wave File
  Left Channel:   f = 1.31kHz   Amplitude = 4194304  (-6 dBfs)
  Right Channel:  f = 1.75 kHz  Amplitude = 2097152  (-12 dBfs)
Different steady tones with different amplitudes were synthesized in each channel.

Outputs from three invocations of Showsamples.exe are appended at the bottom of this page: The specific example used specified the range of samples to inspect from 1500 to 1550 (i.e. 51 samples). For comparison, the wave file was opened in binary mode in Visual C++ 6. The RIFF wave header section is shown in highlight below up to the beginning of the "data" chunk samples. The 4 bytes following the "data" characters is the length (little endian order) in bytes of the actual samples, 0x0057E400 or 5,760,000 bytes or 960,000 dual-channel (6 byte) samples, in agreement with the output of Showsamples below:



The image below shows the hex byte values for the range of the samples inspected and exact agreement with the output of Showsamples:



Next, Steinberg WaveLab6 was used to open this wave file and display the graphical samples for specified range. The display shows the two different tones with different amplitude in the two channels. Note that WaveLab6 always displays the vertical range normalized to a 16 bit range (hence the 32,767 range shown). Again close agreement with the output of Showsamples is observed:





Showsample.exe console output (which is identical to the file output, if selected) is shown below with results for decimal, hexadecimal and hexadecimal with little-endian ordered sample values (the same order as packed in the wave file samples).

C:\..... >Showsamples

Enter WAVE filename to view:  wav24_48_1310_1750.wav
Output file: Sam_wav24_48_1310_1750.txt

WAV header preview  [80 bytes]
52  49  46  46  3C  E4  57  00  57  41  56  45  66  6D  74  20
28  00  00  00  FE  FF  02  00  80  BB  00  00  00  65  04  00
06  00  18  00  16  00  18  00  03  00  00  00  01  00  00  00
00  00  10  00  80  00  00  AA  00  38  9B  71  64  61  74  61
00  E4  57  00  00  00  00  00  00  00  C1  EB  0A  35  44  07
"data"  [64 61 74 61]

Skipping 24 bytes in fmt chunk ..

This appears to be a valid RIFF WAV header

Sampling Frequency: 48000     Bits Per Sample:  24
Channels: 2    nBlockAlign: 6   wavdata size: 5760000 bytes
Duration: 20 sec      Samples: 960000    Time between samples: 0.0208 ms
Byte position at start of samples: 68 bytes  (0x44)


SHA-1 hash of the sample data chunk is:
93 0D 5A 6A 7F 7C 97 37 21 DD 8B 52 F2 46 15 CE 7C 72 5C 18

Enter start sample to display (1 to 960000):  1500
Enter final sample to display (1 to 960000):  1550
Time of chosen start sample: 31.229 ms
Time of chosen final sample: 32.271 ms

Display data on console?  y

24 bit max possible value is:  8388607  (0x7FFFFF)
24 bit min possible value is: -8388608  (0x800000)

Displaying samples in decimal

     Byte(hex)      Sample #        Left Channel       Right Channel
         2366          1500           -2242782            -1704663
         236C          1501           -1605090            -1937515
         2372          1502            -920316            -2069141
         2378          1503            -208546            -2092661
         237E          1504             509340            -2006849
         2384          1505            1212287            -1816186
         238A          1506            1879673            -1530635
         2390          1507            2491924            -1165115
         2396          1508            3031079             -738721
         239C          1509            3481323             -273733
         23A2          1510            3829450              205556
         23A8          1511            4065249              674107
         23AE          1512            4181801             1107438
         23B4          1513            4175689             1482910
         23BA          1514            4047092             1780906
         23C0          1515            3799782             1985856
         23C6          1516            3441013             2087053
         23CC          1517            2981309             2079210
         23D2          1518            2434154             1962736
         23D8          1519            1815599             1743718
         23DE          1520            1143786             1433596
         23E4          1521             438424             1048575
         23EA          1522            -279798              608771
         23F0          1523            -989814              137160
         23F6          1524           -1670796             -341616
         23FC          1525           -2302768             -802545
         2402          1526           -2867193            -1221544
         2408          1527           -3347516            -1576722
         240E          1528           -3729645            -1849522
         2414          1529           -4002374            -2025693
         241A          1530           -4157700            -2096029
         2420          1531           -4191070            -2056855
         2426          1532           -4101503            -1910219
         242C          1533           -3891627            -1663782
         2432          1534           -3567598            -1330419
         2438          1535           -3138921             -927546
         243E          1536           -2618170             -476213
         2444          1537           -2020621                   0
         244A          1538           -1363801              476213
         2450          1539            -666976              927546
         2456          1540              49411             1330419
         245C          1541             764351             1663782
         2462          1542            1456869             1910219
         2468          1543            2106654             2056855
         246E          1544            2694644             2096029
         2474          1545            3203592             2025693
         247A          1546            3618570             1849522
         2480          1547            3927404             1576722
         2486          1548            4121036             1221544
         248C          1549            4193786              802545
         2492          1550            4143520              341616
     Byte(hex)      Sample #        Left Channel       Right Channel

Left Channel Max:
Position: 248C          Sample: 1549          Value: 4193786    (0x3FFDFA)
Left Channel Min:
Position: 2420          Sample: 1531          Value: -4191070   (0xC00CA2)

Right Channel Max:
Position: 246E          Sample: 1544          Value: 2096029    (0x1FFB9D)
Right Channel Min:
Position: 241A          Sample: 1530          Value: -2096029   (0xE00463)

Write output to file?  y
Creating file with sample data ...



-----------------------------------------------------------------------------------------------------------------


C:\..... \Desktop>Showsamples h


Enter WAVE filename to view:  wav24_48_1310_1750.wav
Output file: Sam_wav24_48_1310_1750.txt

WAV header preview  [80 bytes]
52  49  46  46  3C  E4  57  00  57  41  56  45  66  6D  74  20
28  00  00  00  FE  FF  02  00  80  BB  00  00  00  65  04  00
06  00  18  00  16  00  18  00  03  00  00  00  01  00  00  00
00  00  10  00  80  00  00  AA  00  38  9B  71  64  61  74  61
00  E4  57  00  00  00  00  00  00  00  C1  EB  0A  35  44  07
"data"  [64 61 74 61]

Skipping 24 bytes in fmt chunk ..

This appears to be a valid RIFF WAV header

Sampling Frequency: 48000     Bits Per Sample:  24
Channels: 2    nBlockAlign: 6   wavdata size: 5760000 bytes
Duration: 20 sec      Samples: 960000    Time between samples: 0.0208 ms
Byte position at start of samples: 68 bytes  (0x44)


SHA-1 hash of the sample data chunk is:
93 0D 5A 6A 7F 7C 97 37 21 DD 8B 52 F2 46 15 CE 7C 72 5C 18

Enter start sample to display (1 to 960000):  1500
Enter final sample to display (1 to 960000):  1550
Time of chosen start sample: 31.229 ms
Time of chosen final sample: 32.271 ms

Display data on console?  y

24 bit max possible value is:  8388607  (0x7FFFFF)
24 bit min possible value is: -8388608  (0x800000)

Displaying samples in hex

     Byte(hex)      Sample #        Left Channel       Right Channel
         2366          1500             DDC722             E5FD29
         236C          1501             E7821E             E26F95
         2372          1502             F1F504             E06D6B
         2378          1503             FCD15E             E0118B
         237E          1504             07C59C             E160BF
         2384          1505             127F7F             E44986
         238A          1506             1CAE79             E8A4F5
         2390          1507             260614             EE38C5
         2396          1508             2E4027             F4BA5F
         239C          1509             351EEB             FBD2BB
         23A2          1510             3A6ECA             0322F4
         23A8          1511             3E07E1             0A493B
         23AE          1512             3FCF29             10E5EE
         23B4          1513             3FB749             16A09E
         23BA          1514             3DC0F4             1B2CAA

  ......
         2438          1535             D01A97             F1D8C6
         243E          1536             D80CC6             F8BBCB
         2444          1537             E12AF3             000000
         244A          1538             EB30A7             074435
         2450          1539             F5D2A0             0E273A
         2456          1540             00C103             144CF3
         245C          1541             0BA9BF             196326
         2462          1542             163AE5             1D25CB
         2468          1543             20251E             1F6297
         246E          1544             291DF4             1FFB9D
         2474          1545             30E208             1EE8DD
         247A          1546             37370A             1C38B2
         2480          1547             3BED6C             180F12
         2486          1548             3EE1CC             12A3A8
         248C          1549             3FFDFA             0C3EF1
         2492          1550             3F39A0             053670
     Byte(hex)      Sample #        Left Channel       Right Channel

Left Channel Max:
Position: 248C          Sample: 1549          Value: 4193786    (0x3FFDFA)
Left Channel Min:
Position: 2420          Sample: 1531          Value: -4191070   (0xC00CA2)

Right Channel Max:
Position: 246E          Sample: 1544          Value: 2096029    (0x1FFB9D)
Right Channel Min:
Position: 241A          Sample: 1530          Value: -2096029   (0xE00463)

Write output to file?  n


---------------------------------------------------------------------------------------------------------------------

C:\.....Desktop>Showsamples LX


Enter WAVE filename to view:  wav24_48_1310_1750.wav
Output file: Sam_wav24_48_1310_1750.txt

WAV header preview  [80 bytes]
52  49  46  46  3C  E4  57  00  57  41  56  45  66  6D  74  20
28  00  00  00  FE  FF  02  00  80  BB  00  00  00  65  04  00
06  00  18  00  16  00  18  00  03  00  00  00  01  00  00  00
00  00  10  00  80  00  00  AA  00  38  9B  71  64  61  74  61
00  E4  57  00  00  00  00  00  00  00  C1  EB  0A  35  44  07
"data"  [64 61 74 61]

Skipping 24 bytes in fmt chunk ..

This appears to be a valid RIFF WAV header

Sampling Frequency: 48000     Bits Per Sample:  24
Channels: 2    nBlockAlign: 6   wavdata size: 5760000 bytes
Duration: 20 sec      Samples: 960000    Time between samples: 0.0208 ms
Byte position at start of samples: 68 bytes  (0x44)


SHA-1 hash of the sample data chunk is:
93 0D 5A 6A 7F 7C 97 37 21 DD 8B 52 F2 46 15 CE 7C 72 5C 18

Enter start sample to display (1 to 960000):  1500
Enter final sample to display (1 to 960000):  1550
Time of chosen start sample: 31.229 ms
Time of chosen final sample: 32.271 ms

Display data on console?  y

24 bit max possible value is:  8388607  (0x7FFFFF)
24 bit min possible value is: -8388608  (0x800000)

Displaying samples in hex in little endian order (same order as in wave data)

     Byte(hex)      Sample #        Left Channel       Right Channel
         2366          1500             22C7DD             29FDE5
         236C          1501             1E82E7             956FE2
         2372          1502             04F5F1             6B6DE0
         2378          1503             5ED1FC             8B11E0
         237E          1504             9CC507             BF60E1
         2384          1505             7F7F12             8649E4
         238A          1506             79AE1C             F5A4E8
         2390          1507             140626             C538EE
         2396          1508             27402E             5FBAF4
         239C          1509             EB1E35             BBD2FB
         23A2          1510             CA6E3A             F42203
         23A8          1511             E1073E             3B490A
         23AE          1512             29CF3F             EEE510
         23B4          1513             49B73F             9EA016
  ..........
         244A          1538             A730EB             354407
         2450          1539             A0D2F5             3A270E
         2456          1540             03C100             F34C14
         245C          1541             BFA90B             266319
         2462          1542             E53A16             CB251D
         2468          1543             1E2520             97621F
         246E          1544             F41D29             9DFB1F
         2474          1545             08E230             DDE81E
         247A          1546             0A3737             B2381C
         2480          1547             6CED3B             120F18
         2486          1548             CCE13E             A8A312
         248C          1549             FAFD3F             F13E0C
         2492          1550             A0393F             703605
     Byte(hex)      Sample #        Left Channel       Right Channel

Left Channel Max:
Position: 248C          Sample: 1549          Value: 4193786    (0x3FFDFA)
Left Channel Min:
Position: 2420          Sample: 1531          Value: -4191070   (0xC00CA2)

Right Channel Max:
Position: 246E          Sample: 1544          Value: 2096029    (0x1FFB9D)
Right Channel Min:
Position: 241A          Sample: 1530          Value: -2096029   (0xE00463)

Write output to file?  n