Audio replay of SAC seismograms



This is code I wrote for teaching purposes which audibly plays SAC seismograms. Since the ear is an excellent spectral analysis tool, listening to seismograms expands appreciation of the underlying phenomena. I intend using the programs to demonstrate surface wave dispersion, the different frequency content of P and S waves, and attenuation effects.

The code is a Fortran main program that produces a PCM or an AIFF file that may be played through various audio plug-ins on modern computer operating systems. You have the option of playing the sound through the computer's speaker or through headphones. Headphones give much better sound quality, I'd recommend using them. Alternatively, take the audio line out of your workstation and plug it into external speakers. Workstation or laptop speaker quality is generally poor.

The code is a Unix shell archive. Copy the Web page containing it into an empty directory and make the `sh' command read it, e.g. `sh sacpcm.shar'. It will deposit four files,


sacpcm.make       sacpcm.f      falloc.c       tokens.f

in the directory. You will need a Fortran and a C compiler, and the SAC I/O library. Edit the makefile called sacpcm.make according to the instructions you find in it, and then type `make -f sacpcm.make'. Take your favorite seismogram in a SAC file, say `/tmp/earthquake.bhz', and build an input file for the program, for example one called `sacpcm.in':

/tmp/earthquake.bhz 1.0

which instructs the file to be played at maximum volume (the number can range from 0 to 1).

sacpcm -bit 16 -srm 400 -form aiff -out /tmp/earthquake.aiff  < sacpcm.in

will build an AIFF file and put it in the output file /tmp/earthquake.aiff. Open that file with a browser or audio application and listen to the result. Unless you analyze normal modes, the file will play disappointingly fast, so repeatedly list it many times in `sacpcm.in' to fully savor its spectral content:

/tmp/earthquake.bhz 1.0
/tmp/earthquake.bhz 1.0
/tmp/earthquake.bhz 1.0
/tmp/earthquake.bhz 1.0
/tmp/earthquake.bhz 1.0
/tmp/earthquake.bhz 1.0
/tmp/earthquake.bhz 1.0
/tmp/earthquake.bhz 1.0
/tmp/earthquake.bhz 1.0
/tmp/earthquake.bhz 1.0

You can use SAC's decimate command to do an anti-aliased data downsampling to bring lower frequencies into the audio range. 10 sps data decimated by 5 puts 1 Hz seismic at 4 kHz audio, which makes the surface wave dispersion obvious. P waves sound like bongo drums, however.

An older version of this system that plays seismograms through workstation speakers directly is available on request.


Comments, bug fixes, extensions or complaints to
George Helffrich (last updated 16 June 2012)