![File:Ulaw alaw db.svg](http://upload.wikimedia.org/wikipedia/commons/thumb/e/e8/Ulaw_alaw_db.svg/800px-Ulaw_alaw_db.svg.png)
Size of this PNG preview of this SVG file: 800 × 600 pixels. Other resolutions: 320 × 240 pixels | 640 × 480 pixels | 1,024 × 768 pixels | 1,280 × 960 pixels | 2,560 × 1,920 pixels.
Original file (SVG file, nominally 800 × 600 pixels, file size: 63 KB)
![]() | This is a file from the Wikimedia Commons. Information from its description page there is shown below. Commons is a freely licensed media file repository. You can help. |
Summary
DescriptionUlaw alaw db.svg |
English: Plot of μ-Law and A-Law companding on a Decibel scale |
Date | |
Source | Own work |
Author | Ozhiker |
Other versions | Non vector version at File:Ulaw_alaw.png |
SVG development InfoField | |
Source code InfoField | Gnuplot code# Plot of u-Law and A-Law companding on a Decibel scale
# Works with GNUPlot 4.2 PatchLevel 6
# Open SVG file
set terminal svg noenhanced size 800 600 fname "DejaVu Sans" fsize 16
set output 'Ulaw_alaw_db.svg'
#Set background colour
set obj 1 rectangle behind from graph 0,0 to graph 1,1
set obj 1 fillstyle solid 1.0 fillcolor rgb "#C0C0C0"
#Set plot style
set border
set key left bottom
set style line 1 linewidth 2 linecolor rgb "#0F0"
set style line 2 linewidth 2 linecolor rgb "#00F"
set style line 3 linewidth 2 linecolor rgb "#7F7FFF"
set style line 4 linewidth 2 linecolor rgb "#F00"
set style line 5 linewidth 2 linecolor rgb "#FF7F7F"
set xrange [10:-80]
set yrange [-60:0]
set xlabel "Linear Signal (dBm0)"
set ylabel "Encoded Signal (dBFS)"
set pointsize 0.001
set bars 0.5
set grid
# Define functions
decibel(x) = 20*log10(x)
alaw(x) = (abs(x)<1/87.7)? sgn(x)*87.7*abs(x)/(1+log(87.7)) : (abs(x)<1)? sgn(x)*(1+log(87.7*abs(x)))/(1+log(87.7)) : 1/0
ulaw(x) = sgn( x )*( log(1 + 255 * abs( x ) ) / log(256) )
decibel_inv(x) = 10**(x/20)
# Do the Plot
plot x title "No Companding" ls 1, \
decibel( alaw( decibel_inv(x - 3.17) ) ) title "A-Law" ls 2, \
'-' using (decibel(abs($4)/4096)) + 3.14: (decibel(abs((($6) >128)? 127-($6):($6))/128)) : (decibel(abs($3)/4096)) + 3.14 : (decibel(abs($5)/4096)) + 3.14 with xerrorbars title "A-Law Quantized" ls 3, \
decibel( ulaw( decibel_inv(x - 3.17) ) ) title "μ-Law" ls 4, \
'-' using (decibel(abs($4)/8192)) + 3.17: (decibel(abs((($7) >128)? 255-($7):($7)-128)/128)) : (decibel(abs($3)/8192)) + 3.17 : (decibel(abs($5)/8192)) + 3.17 with xerrorbars title "μ-Law Quantized" ls 5
Data# A-Law Plot Data
#
#"Interval Num" "Interval Size" "Interval Top" "Interval Centre" "Interval Bottom" "Encoder Output"
15 128 4095 4031.5 3968 127
14 128 3967 3903.5 3840 126
13 128 3839 3775.5 3712 125
12 128 3711 3647.5 3584 124
11 128 3583 3519.5 3456 123
10 128 3455 3391.5 3328 122
9 128 3327 3263.5 3200 121
8 128 3199 3135.5 3072 120
7 128 3071 3007.5 2944 119
6 128 2943 2879.5 2816 118
5 128 2815 2751.5 2688 117
4 128 2687 2623.5 2560 116
3 128 2559 2495.5 2432 115
2 128 2431 2367.5 2304 114
1 128 2303 2239.5 2176 113
0 128 2175 2111.5 2048 112
15 64 2047 2015.5 1984 111
14 64 1983 1951.5 1920 110
13 64 1919 1887.5 1856 109
12 64 1855 1823.5 1792 108
11 64 1791 1759.5 1728 107
10 64 1727 1695.5 1664 106
9 64 1663 1631.5 1600 105
8 64 1599 1567.5 1536 104
7 64 1535 1503.5 1472 103
6 64 1471 1439.5 1408 102
5 64 1407 1375.5 1344 101
4 64 1343 1311.5 1280 100
3 64 1279 1247.5 1216 99
2 64 1215 1183.5 1152 98
1 64 1151 1119.5 1088 97
0 64 1087 1055.5 1024 96
15 32 1023 1007.5 992 95
14 32 991 975.5 960 94
13 32 959 943.5 928 93
12 32 927 911.5 896 92
11 32 895 879.5 864 91
10 32 863 847.5 832 90
9 32 831 815.5 800 89
8 32 799 783.5 768 88
7 32 767 751.5 736 87
6 32 735 719.5 704 86
5 32 703 687.5 672 85
4 32 671 655.5 640 84
3 32 639 623.5 608 83
2 32 607 591.5 576 82
1 32 575 559.5 544 81
0 32 543 527.5 512 80
15 16 511 503.5 496 79
14 16 495 487.5 480 78
13 16 479 471.5 464 77
12 16 463 455.5 448 76
11 16 447 439.5 432 75
10 16 431 423.5 416 74
9 16 415 407.5 400 73
8 16 399 391.5 384 72
7 16 383 375.5 368 71
6 16 367 359.5 352 70
5 16 351 343.5 336 69
4 16 335 327.5 320 68
3 16 319 311.5 304 67
2 16 303 295.5 288 66
1 16 287 279.5 272 65
0 16 271 263.5 256 64
15 8 255 251.5 248 63
14 8 247 243.5 240 62
13 8 239 235.5 232 61
12 8 231 227.5 224 60
11 8 223 219.5 216 59
10 8 215 211.5 208 58
9 8 207 203.5 200 57
8 8 199 195.5 192 56
7 8 191 187.5 184 55
6 8 183 179.5 176 54
5 8 175 171.5 168 53
4 8 167 163.5 160 52
3 8 159 155.5 152 51
2 8 151 147.5 144 50
1 8 143 139.5 136 49
0 8 135 131.5 128 48
15 4 127 125.5 124 47
14 4 123 121.5 120 46
13 4 119 117.5 116 45
12 4 115 113.5 112 44
11 4 111 109.5 108 43
10 4 107 105.5 104 42
9 4 103 101.5 100 41
8 4 99 97.5 96 40
7 4 95 93.5 92 39
6 4 91 89.5 88 38
5 4 87 85.5 84 37
4 4 83 81.5 80 36
3 4 79 77.5 76 35
2 4 75 73.5 72 34
1 4 71 69.5 68 33
0 4 67 65.5 64 32
15 2 63 62.5 62 31
14 2 61 60.5 60 30
13 2 59 58.5 58 29
12 2 57 56.5 56 28
11 2 55 54.5 54 27
10 2 53 52.5 52 26
9 2 51 50.5 50 25
8 2 49 48.5 48 24
7 2 47 46.5 46 23
6 2 45 44.5 44 22
5 2 43 42.5 42 21
4 2 41 40.5 40 20
3 2 39 38.5 38 19
2 2 37 36.5 36 18
1 2 35 34.5 34 17
0 2 33 32.5 32 16
15 2 31 30.5 30 15
14 2 29 28.5 28 14
13 2 27 26.5 26 13
12 2 25 24.5 24 12
11 2 23 22.5 22 11
10 2 21 20.5 20 10
9 2 19 18.5 18 9
8 2 17 16.5 16 8
7 2 15 14.5 14 7
6 2 13 12.5 12 6
5 2 11 10.5 10 5
4 2 9 8.5 8 4
3 2 7 6.5 6 3
2 2 5 4.5 4 2
1 2 3 2.5 2 1
0 2 1 0.5 0 0
e
# u-Law Plot Data
#
#Interval Num Interval Size Interval Top Interval Centre Interval Bottom Base Code Output Code
0 256 8158 8030.5 7903 128 128
1 256 7902 7774.5 7647 128 129
2 256 7646 7518.5 7391 128 130
3 256 7390 7262.5 7135 128 131
4 256 7134 7006.5 6879 128 132
5 256 6878 6750.5 6623 128 133
6 256 6622 6494.5 6367 128 134
7 256 6366 6238.5 6111 128 135
8 256 6110 5982.5 5855 128 136
9 256 5854 5726.5 5599 128 137
10 256 5598 5470.5 5343 128 138
11 256 5342 5214.5 5087 128 139
12 256 5086 4958.5 4831 128 140
13 256 4830 4702.5 4575 128 141
14 256 4574 4446.5 4319 128 142
15 256 4318 4190.5 4063 128 143
0 128 4062 3998.5 3935 144 144
1 128 3934 3870.5 3807 144 145
2 128 3806 3742.5 3679 144 146
3 128 3678 3614.5 3551 144 147
4 128 3550 3486.5 3423 144 148
5 128 3422 3358.5 3295 144 149
6 128 3294 3230.5 3167 144 150
7 128 3166 3102.5 3039 144 151
8 128 3038 2974.5 2911 144 152
9 128 2910 2846.5 2783 144 153
10 128 2782 2718.5 2655 144 154
11 128 2654 2590.5 2527 144 155
12 128 2526 2462.5 2399 144 156
13 128 2398 2334.5 2271 144 157
14 128 2270 2206.5 2143 144 158
15 128 2142 2078.5 2015 144 159
0 64 2014 1982.5 1951 160 160
1 64 1950 1918.5 1887 160 161
2 64 1886 1854.5 1823 160 162
3 64 1822 1790.5 1759 160 163
4 64 1758 1726.5 1695 160 164
5 64 1694 1662.5 1631 160 165
6 64 1630 1598.5 1567 160 166
7 64 1566 1534.5 1503 160 167
8 64 1502 1470.5 1439 160 168
9 64 1438 1406.5 1375 160 169
10 64 1374 1342.5 1311 160 170
11 64 1310 1278.5 1247 160 171
12 64 1246 1214.5 1183 160 172
13 64 1182 1150.5 1119 160 173
14 64 1118 1086.5 1055 160 174
15 64 1054 1022.5 991 160 175
0 32 990 974.5 959 176 176
1 32 958 942.5 927 176 177
2 32 926 910.5 895 176 178
3 32 894 878.5 863 176 179
4 32 862 846.5 831 176 180
5 32 830 814.5 799 176 181
6 32 798 782.5 767 176 182
7 32 766 750.5 735 176 183
8 32 734 718.5 703 176 184
9 32 702 686.5 671 176 185
10 32 670 654.5 639 176 186
11 32 638 622.5 607 176 187
12 32 606 590.5 575 176 188
13 32 574 558.5 543 176 189
14 32 542 526.5 511 176 190
15 32 510 494.5 479 176 191
0 16 478 470.5 463 192 192
1 16 462 454.5 447 192 193
2 16 446 438.5 431 192 194
3 16 430 422.5 415 192 195
4 16 414 406.5 399 192 196
5 16 398 390.5 383 192 197
6 16 382 374.5 367 192 198
7 16 366 358.5 351 192 199
8 16 350 342.5 335 192 200
9 16 334 326.5 319 192 201
10 16 318 310.5 303 192 202
11 16 302 294.5 287 192 203
12 16 286 278.5 271 192 204
13 16 270 262.5 255 192 205
14 16 254 246.5 239 192 206
15 16 238 230.5 223 192 207
0 8 222 218.5 215 208 208
1 8 214 210.5 207 208 209
2 8 206 202.5 199 208 210
3 8 198 194.5 191 208 211
4 8 190 186.5 183 208 212
5 8 182 178.5 175 208 213
6 8 174 170.5 167 208 214
7 8 166 162.5 159 208 215
8 8 158 154.5 151 208 216
9 8 150 146.5 143 208 217
10 8 142 138.5 135 208 218
11 8 134 130.5 127 208 219
12 8 126 122.5 119 208 220
13 8 118 114.5 111 208 221
14 8 110 106.5 103 208 222
15 8 102 98.5 95 208 223
0 4 94 92.5 91 224 224
1 4 90 88.5 87 224 225
2 4 86 84.5 83 224 226
3 4 82 80.5 79 224 227
4 4 78 76.5 75 224 228
5 4 74 72.5 71 224 229
6 4 70 68.5 67 224 230
7 4 66 64.5 63 224 231
8 4 62 60.5 59 224 232
9 4 58 56.5 55 224 233
10 4 54 52.5 51 224 234
11 4 50 48.5 47 224 235
12 4 46 44.5 43 224 236
13 4 42 40.5 39 224 237
14 4 38 36.5 35 224 238
15 4 34 32.5 31 224 239
0 2 30 29.5 29 240 240
1 2 28 27.5 27 240 241
2 2 26 25.5 25 240 242
3 2 24 23.5 23 240 243
4 2 22 21.5 21 240 244
5 2 20 19.5 19 240 245
6 2 18 17.5 17 240 246
7 2 16 15.5 15 240 247
8 2 14 13.5 13 240 248
9 2 12 11.5 11 240 249
10 2 10 9.5 9 240 250
11 2 8 7.5 7 240 251
12 2 6 5.5 5 240 252
13 2 4 3.5 3 240 253
14 2 2 1.5 1 240 254
15 1 0 0 0 240 255
e
# Close SVG File
unset output
ExplanationGenerated entirely with [[:w:Gnuplot|Gnuplot]] using the following script (tables of data were calculated from scratch using [[:w:G.711|G.711]] standard)
|
Licensing
I, the copyright holder of this work, hereby publish it under the following licenses:
![w:en:Creative Commons](https://upload.wikimedia.org/wikipedia/commons/thumb/7/79/CC_some_rights_reserved.svg/90px-CC_some_rights_reserved.svg.png)
![attribution](https://upload.wikimedia.org/wikipedia/commons/thumb/1/11/Cc-by_new_white.svg/24px-Cc-by_new_white.svg.png)
![share alike](https://upload.wikimedia.org/wikipedia/commons/thumb/d/df/Cc-sa_white.svg/24px-Cc-sa_white.svg.png)
This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license.
- You are free:
- to share – to copy, distribute and transmit the work
- to remix – to adapt the work
- Under the following conditions:
- attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
- share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
![]() |
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled GNU Free Documentation License.http://www.gnu.org/copyleft/fdl.htmlGFDLGNU Free Documentation Licensetruetrue |
You may select the license of your choice.
Captions
Add a one-line explanation of what this file represents
Items portrayed in this file
depicts
23 October 2009
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 00:09, 9 January 2022 | ![]() | 800 × 600 (63 KB) | Sollyucko | improve key label order and color choice |
12:22, 24 October 2009 | ![]() | 800 × 600 (55 KB) | Ozhiker | Try with DejaVu Sans font | |
06:40, 24 October 2009 | ![]() | 800 × 600 (55 KB) | Ozhiker | Try version without specific font to try to fix mediawiki rendering problem | |
21:28, 23 October 2009 | ![]() | 800 × 600 (55 KB) | Ozhiker | {{Information |Description={{en|1=Plot of μ-Law and A-Law companding on a Decibel scale}} |Source={{own}} {{gnuplot}} |Author=Ozhiker |Date=2009-10-23 |Permission= |other_versions=Non vector version at en:File:Ulaw_alaw.png }} {{en |
File usage
The following pages on the English Wikipedia use this file (pages on other projects are not listed):
Global file usage
The following other wikis use this file:
- Usage on de.wikipedia.org
- Usage on es.wikipedia.org
- Usage on ko.wikipedia.org
- Usage on sr.wikipedia.org
- Usage on vi.wikipedia.org
Metadata
This file contains additional information, probably added from the digital camera or scanner used to create or digitize it.
If the file has been modified from its original state, some details may not fully reflect the modified file.
Short title | Gnuplot |
---|---|
Image title | Produced by GNUPLOT 4.6 patchlevel 3 |
Width | 800 |
Height | 600 |
Retrieved from "https://en.wikipedia.org/wiki/File:Ulaw_alaw_db.svg"