- A map of India. An email with an attachment (wav file). Very straightforward, we should convert the mess in the attachment into a voice file.
import base64, wave f = open("mess.txt") mess = f.read() f.close() f = open('voice.wav', 'wb') f.write(base64.decodestring(mess)) f.close()- Unfortunately, the output file just says "sorry".
- There are other tips, like "===============1295515792==", "Maybe my computer is out of order", "please", and so on... but still have no idea.
- Trying to google, someone said I should swap the bytes in each frame in the wav file!
- See also: https://docs.python.org/2/library/wave.html
voice = wave.open("voice.wav", "r") voice_frames = voice.readframes(voice.getnframes()) voice_new_frames = "" even = "" odd = "" for i in range(len(voice_frames)): if i%2 == 0: odd = str(voice_frames[i]) elif i%2 == 1: even = str(voice_frames[i]) voice_new_frames += even voice_new_frames += odd voice_new = wave.open('voice_new.wav', 'w') voice_new.setnchannels(1) voice_new.setframerate(voice.getframerate()) voice_new.setnframes(voice.getnframes()) voice_new.setsampwidth(voice.getsampwidth()) voice_new.writeframes(voice_new_frames) voice_new.close()- The output file was singing "You are an idiot ah ah ah ah ah ah ...." ... - The answer is "idiot", and click the link to the get to the next level!
沒有留言:
張貼留言