mirror of
https://github.com/cedricbonhomme/Stegano.git
synced 2025-06-27 19:06:12 +02:00
read and write .wav
This commit is contained in:
parent
35d03bc0c6
commit
53a82724ae
1 changed files with 14 additions and 2 deletions
|
@ -41,8 +41,20 @@ def hide(input_file: Union[str, IO[bytes]], message: str, output_file: Union[str
|
|||
|
||||
output = wave.open(output_file, "wb")
|
||||
with wave.open(input_file, "rb") as input:
|
||||
pass
|
||||
# TODO
|
||||
nchannels, sampwidth, framerate, nframes, comptype, _ = input.getparams()
|
||||
assert comptype == "NONE", "only uncompressed files are supported"
|
||||
|
||||
nsamples = nchannels * nframes
|
||||
|
||||
# TODO get message bits and check length
|
||||
|
||||
output.setnchannels(nchannels)
|
||||
output.setsampwidth(sampwidth)
|
||||
output.setframerate(framerate)
|
||||
|
||||
# TODO encode message length + message
|
||||
frames = input.readframes(nframes * nchannels)
|
||||
output.writeframes(frames)
|
||||
|
||||
|
||||
def reveal(input_file: Union[str, IO[bytes]]):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue