Python audioop.alaw2lin() Examples
The following are 24
code examples of audioop.alaw2lin().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
audioop
, or try the search function
.
Example #1
Source File: test_audioop.py From ironpython3 with Apache License 2.0 | 5 votes |
def test_wrongsize(self): data = b'abcdefgh' state = None for size in (-1, 0, 5, 1024): self.assertRaises(audioop.error, audioop.ulaw2lin, data, size) self.assertRaises(audioop.error, audioop.alaw2lin, data, size) self.assertRaises(audioop.error, audioop.adpcm2lin, data, size, state)
Example #2
Source File: test_audioop.py From CTFCrackTools with GNU General Public License v3.0 | 5 votes |
def test_wrongsize(self): data = b'abcdefgh' state = None for size in (-1, 0, 3, 5, 1024): self.assertRaises(audioop.error, audioop.ulaw2lin, data, size) self.assertRaises(audioop.error, audioop.alaw2lin, data, size) self.assertRaises(audioop.error, audioop.adpcm2lin, data, size, state)
Example #3
Source File: test_audioop.py From CTFCrackTools with GNU General Public License v3.0 | 5 votes |
def test_alaw2lin(self): encoded = b'\x00\x03\x24\x2a\x51\x54\x55\x58\x6b\x71\x7f'\ b'\x80\x83\xa4\xaa\xd1\xd4\xd5\xd8\xeb\xf1\xff' src = [-688, -720, -2240, -4032, -9, -3, -1, -27, -244, -82, -106, 688, 720, 2240, 4032, 9, 3, 1, 27, 244, 82, 106] for w in 1, 2, 4: self.assertEqual(audioop.alaw2lin(encoded, w), packs[w](*(x << (w * 8) >> 13 for x in src))) encoded = ''.join(chr(x) for x in xrange(256)) for w in 2, 4: decoded = audioop.alaw2lin(encoded, w) self.assertEqual(audioop.lin2alaw(decoded, w), encoded)
Example #4
Source File: aifc.py From android_universal with MIT License | 5 votes |
def _alaw2lin(self, data): import audioop return audioop.alaw2lin(data, 2)
Example #5
Source File: test_audioop.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def test_wrongsize(self): data = b'abcdefgh' state = None for size in (-1, 0, 3, 5, 1024): self.assertRaises(audioop.error, audioop.ulaw2lin, data, size) self.assertRaises(audioop.error, audioop.alaw2lin, data, size) self.assertRaises(audioop.error, audioop.adpcm2lin, data, size, state)
Example #6
Source File: test_audioop.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def test_alaw2lin(self): encoded = b'\x00\x03\x24\x2a\x51\x54\x55\x58\x6b\x71\x7f'\ b'\x80\x83\xa4\xaa\xd1\xd4\xd5\xd8\xeb\xf1\xff' src = [-688, -720, -2240, -4032, -9, -3, -1, -27, -244, -82, -106, 688, 720, 2240, 4032, 9, 3, 1, 27, 244, 82, 106] for w in 1, 2, 4: self.assertEqual(audioop.alaw2lin(encoded, w), packs[w](*(x << (w * 8) >> 13 for x in src))) encoded = ''.join(chr(x) for x in xrange(256)) for w in 2, 4: decoded = audioop.alaw2lin(encoded, w) self.assertEqual(audioop.lin2alaw(decoded, w), encoded)
Example #7
Source File: test_audioop.py From medicare-demo with Apache License 2.0 | 5 votes |
def testalaw2lin(data): if verbose: print 'alaw2lin' # Cursory d = audioop.lin2alaw(data[0], 1) if audioop.alaw2lin(d, 1) != data[0]: return 0 return 1
Example #8
Source File: test_audioop.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def test_wrongsize(self): data = b'abcdefgh' state = None for size in (-1, 0, 5, 1024): self.assertRaises(audioop.error, audioop.ulaw2lin, data, size) self.assertRaises(audioop.error, audioop.alaw2lin, data, size) self.assertRaises(audioop.error, audioop.adpcm2lin, data, size, state)
Example #9
Source File: test_audioop.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def test_alaw2lin(self): encoded = b'\x00\x03\x24\x2a\x51\x54\x55\x58\x6b\x71\x7f'\ b'\x80\x83\xa4\xaa\xd1\xd4\xd5\xd8\xeb\xf1\xff' src = [-688, -720, -2240, -4032, -9, -3, -1, -27, -244, -82, -106, 688, 720, 2240, 4032, 9, 3, 1, 27, 244, 82, 106] for w in 1, 2, 3, 4: decoded = packs[w](*(x << (w * 8) >> 13 for x in src)) self.assertEqual(audioop.alaw2lin(encoded, w), decoded) self.assertEqual(audioop.alaw2lin(bytearray(encoded), w), decoded) self.assertEqual(audioop.alaw2lin(memoryview(encoded), w), decoded) encoded = bytes(range(256)) for w in 2, 3, 4: decoded = audioop.alaw2lin(encoded, w) self.assertEqual(audioop.lin2alaw(decoded, w), encoded)
Example #10
Source File: aifc.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def _alaw2lin(self, data): import audioop return audioop.alaw2lin(data, 2)
Example #11
Source File: test_audioop.py From gcblue with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_wrongsize(self): data = b'abcdefgh' state = None for size in (-1, 0, 3, 5, 1024): self.assertRaises(audioop.error, audioop.ulaw2lin, data, size) self.assertRaises(audioop.error, audioop.alaw2lin, data, size) self.assertRaises(audioop.error, audioop.adpcm2lin, data, size, state)
Example #12
Source File: test_audioop.py From gcblue with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_alaw2lin(self): encoded = b'\x00\x03\x24\x2a\x51\x54\x55\x58\x6b\x71\x7f'\ b'\x80\x83\xa4\xaa\xd1\xd4\xd5\xd8\xeb\xf1\xff' src = [-688, -720, -2240, -4032, -9, -3, -1, -27, -244, -82, -106, 688, 720, 2240, 4032, 9, 3, 1, 27, 244, 82, 106] for w in 1, 2, 4: self.assertEqual(audioop.alaw2lin(encoded, w), packs[w](*(x << (w * 8) >> 13 for x in src))) encoded = ''.join(chr(x) for x in xrange(256)) for w in 2, 4: decoded = audioop.alaw2lin(encoded, w) self.assertEqual(audioop.lin2alaw(decoded, w), encoded)
Example #13
Source File: test_audioop.py From ironpython2 with Apache License 2.0 | 5 votes |
def test_alaw2lin(self): encoded = b'\x00\x03\x24\x2a\x51\x54\x55\x58\x6b\x71\x7f'\ b'\x80\x83\xa4\xaa\xd1\xd4\xd5\xd8\xeb\xf1\xff' src = [-688, -720, -2240, -4032, -9, -3, -1, -27, -244, -82, -106, 688, 720, 2240, 4032, 9, 3, 1, 27, 244, 82, 106] for w in 1, 2, 4: self.assertEqual(audioop.alaw2lin(encoded, w), packs[w](*(x << (w * 8) >> 13 for x in src))) encoded = ''.join(chr(x) for x in xrange(256)) for w in 2, 4: decoded = audioop.alaw2lin(encoded, w) self.assertEqual(audioop.lin2alaw(decoded, w), encoded)
Example #14
Source File: test_audioop.py From ironpython3 with Apache License 2.0 | 5 votes |
def test_alaw2lin(self): encoded = b'\x00\x03\x24\x2a\x51\x54\x55\x58\x6b\x71\x7f'\ b'\x80\x83\xa4\xaa\xd1\xd4\xd5\xd8\xeb\xf1\xff' src = [-688, -720, -2240, -4032, -9, -3, -1, -27, -244, -82, -106, 688, 720, 2240, 4032, 9, 3, 1, 27, 244, 82, 106] for w in 1, 2, 3, 4: decoded = packs[w](*(x << (w * 8) >> 13 for x in src)) self.assertEqual(audioop.alaw2lin(encoded, w), decoded) self.assertEqual(audioop.alaw2lin(bytearray(encoded), w), decoded) self.assertEqual(audioop.alaw2lin(memoryview(encoded), w), decoded) encoded = bytes(range(256)) for w in 2, 3, 4: decoded = audioop.alaw2lin(encoded, w) self.assertEqual(audioop.lin2alaw(decoded, w), encoded)
Example #15
Source File: aifc.py From ironpython3 with Apache License 2.0 | 5 votes |
def _alaw2lin(self, data): import audioop return audioop.alaw2lin(data, 2)
Example #16
Source File: aifc.py From Imogen with MIT License | 5 votes |
def _alaw2lin(self, data): import audioop return audioop.alaw2lin(data, 2)
Example #17
Source File: test_audioop.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def test_wrongsize(self): data = b'abcdefgh' state = None for size in (-1, 0, 5, 1024): self.assertRaises(audioop.error, audioop.ulaw2lin, data, size) self.assertRaises(audioop.error, audioop.alaw2lin, data, size) self.assertRaises(audioop.error, audioop.adpcm2lin, data, size, state)
Example #18
Source File: test_audioop.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def test_alaw2lin(self): encoded = b'\x00\x03\x24\x2a\x51\x54\x55\x58\x6b\x71\x7f'\ b'\x80\x83\xa4\xaa\xd1\xd4\xd5\xd8\xeb\xf1\xff' src = [-688, -720, -2240, -4032, -9, -3, -1, -27, -244, -82, -106, 688, 720, 2240, 4032, 9, 3, 1, 27, 244, 82, 106] for w in 1, 2, 3, 4: decoded = packs[w](*(x << (w * 8) >> 13 for x in src)) self.assertEqual(audioop.alaw2lin(encoded, w), decoded) self.assertEqual(audioop.alaw2lin(bytearray(encoded), w), decoded) self.assertEqual(audioop.alaw2lin(memoryview(encoded), w), decoded) encoded = bytes(range(256)) for w in 2, 3, 4: decoded = audioop.alaw2lin(encoded, w) self.assertEqual(audioop.lin2alaw(decoded, w), encoded)
Example #19
Source File: aifc.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def _alaw2lin(self, data): import audioop return audioop.alaw2lin(data, 2)
Example #20
Source File: test_audioop.py From oss-ftp with MIT License | 5 votes |
def test_wrongsize(self): data = b'abcdefgh' state = None for size in (-1, 0, 3, 5, 1024): self.assertRaises(audioop.error, audioop.ulaw2lin, data, size) self.assertRaises(audioop.error, audioop.alaw2lin, data, size) self.assertRaises(audioop.error, audioop.adpcm2lin, data, size, state)
Example #21
Source File: test_audioop.py From oss-ftp with MIT License | 5 votes |
def test_alaw2lin(self): encoded = b'\x00\x03\x24\x2a\x51\x54\x55\x58\x6b\x71\x7f'\ b'\x80\x83\xa4\xaa\xd1\xd4\xd5\xd8\xeb\xf1\xff' src = [-688, -720, -2240, -4032, -9, -3, -1, -27, -244, -82, -106, 688, 720, 2240, 4032, 9, 3, 1, 27, 244, 82, 106] for w in 1, 2, 4: self.assertEqual(audioop.alaw2lin(encoded, w), packs[w](*(x << (w * 8) >> 13 for x in src))) encoded = ''.join(chr(x) for x in xrange(256)) for w in 2, 4: decoded = audioop.alaw2lin(encoded, w) self.assertEqual(audioop.lin2alaw(decoded, w), encoded)
Example #22
Source File: test_audioop.py From BinderFilter with MIT License | 5 votes |
def test_wrongsize(self): data = b'abcdefgh' state = None for size in (-1, 0, 3, 5, 1024): self.assertRaises(audioop.error, audioop.ulaw2lin, data, size) self.assertRaises(audioop.error, audioop.alaw2lin, data, size) self.assertRaises(audioop.error, audioop.adpcm2lin, data, size, state)
Example #23
Source File: test_audioop.py From BinderFilter with MIT License | 5 votes |
def test_alaw2lin(self): encoded = b'\x00\x03\x24\x2a\x51\x54\x55\x58\x6b\x71\x7f'\ b'\x80\x83\xa4\xaa\xd1\xd4\xd5\xd8\xeb\xf1\xff' src = [-688, -720, -2240, -4032, -9, -3, -1, -27, -244, -82, -106, 688, 720, 2240, 4032, 9, 3, 1, 27, 244, 82, 106] for w in 1, 2, 4: self.assertEqual(audioop.alaw2lin(encoded, w), packs[w](*(x << (w * 8) >> 13 for x in src))) encoded = ''.join(chr(x) for x in xrange(256)) for w in 2, 4: decoded = audioop.alaw2lin(encoded, w) self.assertEqual(audioop.lin2alaw(decoded, w), encoded)
Example #24
Source File: test_audioop.py From ironpython2 with Apache License 2.0 | 5 votes |
def test_wrongsize(self): data = b'abcdefgh' state = None for size in (-1, 0, 3, 5, 1024): self.assertRaises(audioop.error, audioop.ulaw2lin, data, size) self.assertRaises(audioop.error, audioop.alaw2lin, data, size) self.assertRaises(audioop.error, audioop.adpcm2lin, data, size, state)