Go to:
Title Page               Chapter 1           Appendix A   Appendix J
Copyright                Chapter 2           Appendix B   Appendix K
Abstract                 Chapter 3           Appendix C   Appendix L
Acknowledgements         Chapter 4           Appendix D   References
Table of Contents        Chapter 5           Appendix E
List of Figure           Conclusions/        Appendix F
List of Tables           Future Directions   Appendix G
List of Audio Examples                       Appendix H
List of Programs                             Appendix I


Appendix E

C++ source code for programs used in Chapter 4



I. General description and usage

spectral_enhance is a program that uses wavelet extrapolation to predict higher frequency components of a low-sample-rate audio file. The program adds higher frequency content by increasing the sampling rate of the input file. In essence, the increase in sampling rate provides some "spectral headroom" which is then filled by a guess based on the exponential decay property of wavelet analyses discussed in Chapter 4.

Type spectral_enhance at the command line to see the usage message:

AIFF wavelet spectral enhancer.

written by Corey Cheng, Spring, 1996.

Usage: spectral_enhance /input_file/ /output_file/ /enhancement iterations/ /iterations to perform in wavelet analysis/ /window_size/

This program works with an AIFF audio file of arbitrary sample rate, number of channels, and sample bit-width. However, since the output file will have a sampling/playback rate higher than the original input file, the user is responsible for ensuring that the final output file has a sample/playback rate which is compatible with the intended playback sound hardware.

The input and output files are the filenames of AIFF files of the source and destination files. If the destination file already exists, it is erased and replaced with the output of the enhancement process.

The "enhancement iterations" parameter specifies how many levels of wavelet coefficients to guess at. For each enhancement iteration, the bandwidth of the output is increased by a factor of 2, the sampling rate is doubled, and the file size is doubled. Typically, this value is either 1 or 2, which results in a doubling or quadrupling of the bandwidth, sampling rate, and size of the output file. Therefore, typical samples rates for the input fall are 8 kHz, 11.025 kHz, and 22 kHz.

window_size refers to how many frames of audio (one frame of audio is one sample per channel per time interval; for example, there are two samples in one stereo frame) should be used in the wavelet analysis window. This parameter is linked with the "iterations to perform in wavelet analysis" parameter, which dictates how many iterations of the forward transform to perform on each window of sound data. The window size should be an exact power of two, and should be equal to at least 2iterations+2. Typically, the higher the number of iterations, the more levels of wavelet coefficients are available that describe lower-frequency spectral components. However, the larger the number of iterations, the larger the window will have to be to accommodate the larger number of wavelet coefficients.

II. Compiling the program

This program was written in C++ with the GNU G++ dialect, version 2.6.2. The user must have the normal_wavelet_transforms.h, ac.h, ac2.h, ac.cc, and ac.error.cc files in the same directory as the main source file, spectral_enhance.cc to compile the program properly. The audio libraries libaudio.a and libaudiofile.a, available in standard releases of the Irix operating system, are required for compilation. No Makefile is provided, as all compilation can be done with the following command:

g++ -O3 -mips2 -mcpu=r4000 -o spectral_enhance

spectral_enhance.cc ac.cc ac.error.cc -lm -laudio

-laudiofile


Go to:
Title Page               Chapter 1           Appendix A   Appendix J
Copyright                Chapter 2           Appendix B   Appendix K
Abstract                 Chapter 3           Appendix C   Appendix L
Acknowledgements         Chapter 4           Appendix D   References
Table of Contents        Chapter 5           Appendix E
List of Figure           Conclusions/        Appendix F
List of Tables           Future Directions   Appendix G
List of Audio Examples                       Appendix H
List of Programs                             Appendix I