channelAudio2 = Channel.Channel(codedAudio2, errorRate) # print("codedAudio1 : ") # print(codedAudio1) decodedHammingAudioBinary = [] # we get the 7 bits corrupted values from channelAudio1,2 corruptedHamMsg1 = channelAudio1.getCorruptedMessage() corruptedHamMsg2 = channelAudio2.getCorruptedMessage() # print("corruptedHamMsg1 : ") # print(corruptedHamMsg1) # we go through all corrupted messages and decode them for i in range(len(corruptedHamMsg1)): half1 = Hamming.decodeHamming7_4(corruptedHamMsg1[i]) half2 = Hamming.decodeHamming7_4(corruptedHamMsg2[i]) decodedWord = half1 + half2 decodedHammingAudioBinary.append(decodedWord) # decodedHammingAudioBinary contains all corrected word # we can now convert it back to int, plot it and listen to it. # translation of the corrupted msg from bits to integers # translation from bit to integers for i in range(len(decodedHammingAudioBinary)): decodedHammingAudioBinary[i] = int(decodedHammingAudioBinary[i], 2) # print("decodedHammingAudioBinary : ") # print(decodedHammingAudioBinary)