1#!/bin/sh -e 2 3# FLAC - Free Lossless Audio Codec 4# Copyright (C) 2012-2023 Xiph.Org Foundation 5# 6# This file is part the FLAC project. FLAC is comprised of several 7# components distributed under different licenses. The codec libraries 8# are distributed under Xiph.Org's BSD-like license (see the file 9# COPYING.Xiph in this distribution). All other programs, libraries, and 10# plugins are distributed under the GPL (see COPYING.GPL). The documentation 11# is distributed under the Gnu FDL (see COPYING.FDL). Each file in the 12# FLAC distribution contains at the top the terms under which it may be 13# distributed. 14# 15# Since this particular file is relevant to all components of FLAC, 16# it may be distributed under the Xiph.Org license, which is the least 17# restrictive of those mentioned above. See the file COPYING.Xiph in this 18# distribution. 19 20. ./common.sh 21 22PATH="$(pwd)/../src/flac:$PATH" 23 24printf "Using FLAC binary : %s\n" "$(which flac)" 25 26date="$(date "+%Y%m%dT%H%M%S")" 27fname="comp${date}.flac" 28 29last_k=0 30last_size=$(wc -c < noisy-sine.wav) 31 32echo "Original file size ${last_size} bytes." 33 34for k in 0 1 2 3 4 5 6 7 8 ; do 35 flac${EXE} -${k} --silent noisy-sine.wav -o ${fname} 36 size=$(wc -c < ${fname}) 37 echo "Compression level ${k}, file size ${size} bytes." 38 if test ${last_size} -lt ${size} ; then 39 echo "Error : Compression ${last_k} size ${last_size} >= compression ${k} size ${size}." 40 exit 1 41 fi 42 # Need this because OSX's 'wc -c' returns a number with leading whitespace. 43 last_size=$((size+10)) 44 last_k=${k} 45 rm -f ${fname} 46 done 47