File:Demo of mu-law compression.svg

From Vigyanwiki

Original file(SVG file, nominally 810 × 810 pixels, file size: 55 KB)

This file is from Wikimedia Commons and may be used by other projects. The description on its file description page there is shown below.

Summary

Description
English: Demo of mu-law compression: the input signal (top), a simple sine wave with a linearly increasing amplitude, is compressed in its dynamic range by μ-law (bottom).
Date
Source Own work
Author Morn
SVG genesis
InfoField
 The SVG code is valid.
 This plot was created with Matplotlib
Source code
InfoField

Python code

Source code
from pylab import *

def sgn(v):
    if v >= 0:
        return 1
    else:
        return -1

def ff(x):
    "Forward mu-law"
    return sgn(x) * log(1 + 255 * abs(x)) / log(256)

figure(figsize = (9, 9))

X = arange(0, 1.002, .002)
ORIG = [x * sin(12 * pi * x) for x in X]
MULAW = [ff(y) for y in ORIG]

subplot(211)
plot(X, ORIG)
title ("Original signal")
axis((0, 1, -1, 1))
grid()

subplot(212)
plot(X, MULAW)
title ("Compressed signal (μ-law)")
axis((0, 1, -1, 1))
grid()

savefig("mu-law-demo.svg")

show()

Licensing

I, the copyright holder of this work, hereby publish it under the following licence:
Creative Commons CC-Zero This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighbouring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

Captions

Add a one-line explanation of what this file represents

Items portrayed in this file

depicts

2 May 2022

image/svg+xml

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current22:31, 2 May 2022Thumbnail for version as of 22:31, 2 May 2022810 × 810 (55 KB)wikimediacommons>MornUploaded own work with UploadWizard

The following page uses this file:

Metadata