From 53a82724ae1ce3bc2ed92dd5f4ed9aea973c058e Mon Sep 17 00:00:00 2001 From: Alexander Treml Date: Fri, 20 Jun 2025 00:52:28 +0200 Subject: [PATCH] read and write .wav --- stegano/wav/wav.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/stegano/wav/wav.py b/stegano/wav/wav.py index 65caacd..b804944 100644 --- a/stegano/wav/wav.py +++ b/stegano/wav/wav.py @@ -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]]):