1 2# Sfront, a SAOL to C translator 3# This file: Makefile for an sfront example 4# 5# Copyright (c) 2000-2006, Regents of the University of California 6# All rights reserved. 7# 8# Redistribution and use in source and binary forms, with or without 9# modification, are permitted provided that the following conditions are 10# met: 11# 12# Redistributions of source code must retain the above copyright 13# notice, this list of conditions and the following disclaimer. 14# 15# Redistributions in binary form must reproduce the above copyright 16# notice, this list of conditions and the following disclaimer in the 17# documentation and/or other materials provided with the distribution. 18# 19# Neither the name of the University of California, Berkeley nor the 20# names of its contributors may be used to endorse or promote products 21# derived from this software without specific prior written permission. 22# 23# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 26# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 27# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 29# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 30# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 31# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 32# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34# 35# Maintainer: John Lazzaro, lazzaro@cs.berkeley.edu 36 37 38## 39## this example demonstrates how to use the input_bus to read in an 40## audio stream, do signal processing, and write it out. the example 41## also shows how to do signal processing by reading a sample into 42## a wavetable. the task is cleaning up linus torvalds' voice. 43## 44 45FILENAME = torvalds 46 47SAOLFILE = $(FILENAME).saol 48MP4FILE = $(FILENAME).mp4 49 50INFILE = english.wav 51OUTFILE = output.wav 52 53## 54## Compiler optimization and debug options. Mac OS X users 55## should replace "gcc" with "cc". 56## 57 58CC = gcc 59OPT = -O3 60CFLAGS = $(OPT) 61 62SFRONT = sfront 63PLAYER = play 64CMP = cmp 65 66OUTMODE = -aout $(OUTFILE) 67INMODE = -ain $(INFILE) 68 69## for INFILE/OUTFILE selections that need libraries 70 71IOLINK = 72 73## for INFILE/OUTFILE std selection: > foo < bar 74 75REDIRECT = 76 77## 78## makes a raw 16-bit signed integer audio file 79## 80 81$(OUTFILE): $(SAOLFILE) 82 $(SFRONT) $(OUTMODE) $(INMODE) -orc $(SAOLFILE) 83 $(CC) $(CFLAGS) sa.c -lm $(IOLINK) -o sa 84 ./sa $(REDIRECT) 85 86## tests bitstream creation code, by creating an MP4 file, decoding 87## it, and comparing audio out with audio created by original ASCII 88## files. doesn't work with stdin/stdout. 89 90mp4test : $(OUTFILE) 91 rm -rf $(MP4FILE) sa.c 92 mv $(OUTFILE) safe 93 $(SFRONT) -orc $(SAOLFILE) -bitout $(MP4FILE) 94 $(SFRONT) $(OUTMODE) $(INMODE) -bit $(MP4FILE) 95 $(CC) $(CFLAGS) sa.c -lm $(IOLINK) -o sa 96 ./sa $(REDIRECT) 97 $(CMP) $(OUTFILE) safe 98 99## tests a new sfront against an old one. assume safe is the audio 100## created by old sfront. 101 102compare : $(OUTFILE) 103 $(CMP) $(OUTFILE) safe 104 105safe : $(OUTFILE) 106 cp $(OUTFILE) safe 107 108## for performance testing 109## 110 111timing : 112 /usr/bin/time -p ./sa $(REDIRECT) 113 114## 115## 116## 117 118## play the wav file 119 120play : $(OUTFILE) 121 $(PLAYER) $(OUTFILE) 122 123clean: 124 rm -rf sa.c sa audio a*.wav $(MP4FILE) $(OUTFILE) *.info *~ safe 125 126 127 128