wav-pipe-test.sh 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/bin/bash
  2. source test-common.sh
  3. IN_WAV=wav-pipe-test.wav
  4. OUT1_WAV=wav-pipe-test-out1.wav
  5. OUT2_WAV=wav-pipe-test-out2.wav
  6. OUT3_WAV=wav-pipe-test-out3.wav
  7. for BITS in 16 24
  8. do
  9. audiowmark test-gen-noise --bits $BITS $IN_WAV 200 44100
  10. [ "x$BITS" == "x$(audiowmark test-info $IN_WAV bit_depth)" ] || die "generated input bit depth is not correct"
  11. cat $IN_WAV | audiowmark_add --test-key 1 --test-no-limiter --format wav-pipe - - $TEST_MSG > $OUT1_WAV || die "watermark from pipe failed"
  12. cat $OUT1_WAV | audiowmark_add --test-key 2 --test-no-limiter --format wav-pipe - - $TEST_MSG > $OUT2_WAV || die "watermark from pipe failed"
  13. cat $OUT2_WAV | audiowmark_add --test-key 3 --test-no-limiter --format wav-pipe - - $TEST_MSG > $OUT3_WAV || die "watermark from pipe failed"
  14. check_length $IN_WAV $OUT1_WAV
  15. check_length $IN_WAV $OUT2_WAV
  16. check_length $IN_WAV $OUT3_WAV
  17. check_snr $IN_WAV $OUT1_WAV 32
  18. check_snr $IN_WAV $OUT2_WAV 29
  19. check_snr $IN_WAV $OUT3_WAV 27
  20. audiowmark_cmp --expect-matches 0 $OUT3_WAV $TEST_MSG
  21. audiowmark_cmp --expect-matches 5 --test-key 1 $OUT3_WAV $TEST_MSG
  22. audiowmark_cmp --expect-matches 5 --test-key 2 $OUT3_WAV $TEST_MSG
  23. audiowmark_cmp --expect-matches 5 --test-key 3 $OUT3_WAV $TEST_MSG
  24. # for wav-pipe format: 16 bit input should produce 16 bit output; 24 bit input should produce 32 bit output
  25. BTEST=$BITS:$(audiowmark test-info $OUT3_WAV bit_depth)
  26. [[ "$BTEST" =~ ^(16:16|24:32)$ ]] || die "unexpected input/output bit depth $BTEST"
  27. rm $IN_WAV $OUT1_WAV $OUT2_WAV $OUT3_WAV
  28. done
  29. exit 0