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