Guest User

Untitled

a guest
Mar 6th, 2016
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.45 KB | None | 0 0
  1. def getBit(byteArray, bitNumber):
  2.     "This returns bit with bitNumber position from byteArray"
  3.     byte = byteArray[bitNumber // 8]
  4.     return (byte >> (bitNumber % 8)) & 1
  5.  
  6. while True:
  7.     multiChannelSample = inputFile.read(2)
  8.     if multiChannelSample == b'':
  9.         break
  10.    
  11.     for channel in range(0, 16):
  12.         singleChannelSample = '+1' if (getBit(multiChannelSample, channel)) else '-1'
  13.         outputFiles[channel].write(singleChannelSample + '\n')
  14.        
  15.     sampleCounter += 1
Advertisement
Add Comment
Please, Sign In to add comment