Application Center - Maplesoft

App Preview:

Analysis and synthesis of sound samples

You can switch back to the summary page by clicking here.

Learn about Maple
Download Application


 

Signal Processing with Maple 6

Analyzing and Synthesizing Digital Sound Samples
with Maple 6

Paul Goossens
Copyright 2000 Waterloo Maple Inc.

Download SoundSamples.mws
Download code for SigGen package
Download code for WAV package

Contents



Introduction

In earlier worksheets: "The Mathematics of Synthesizers", "Creating Sound Files (.wav) with Maple 6", and "Spectral Analysis with Maple 6", we explored some of the basics of sound generation and analysis, as well as developed tools to allow us to hear the results through any standard multimedia player. This worksheet brings all these elements together in a way that allows us to explore the nature of a real sound from a musical instrument and extract the necessary data from it in order to synthesize this natural sound.

However, the primary objective of this worksheet is to demonstrate the enhanced numerical power of Maple 6. With its improved floating-point handling and programming constructs, we are able to create an application that would not have even been considered in earlier versions of the package.

The worksheet will take you through importing a sound sample as a large data set into the Maple 6 Worksheet environment, analyzing the frequency spectrum of the sound, extracting the dominant frequencies, and their amplitudes, from the spectrum data and constructing a synthesized sound, based on these components. It ends with a look at different ways of visualizing the frequency spectrum, through animations, waterfall plots and spectrographs.

It is intended for anyone interested in a basic, fun way of learning about sound analysis and synthesis, as well as the analyst that is considering the use of Maple 6 for large numerical computations.


Initialization and Function Declarations

Before we begin, we need to set up the appropriate file paths and load the required Maple 6 packages. The WAV package contains the sound file import/export functions and the SigGen package contains the sound generation tools, documented in "The Mathematics of Synthesizers".

Note: Before you can execute this worksheet in Maple 6, you will need to download WAV and SigGen, store them in separate directories and modify the following paths to point to where you have stored them.

> restart:libname:="c:/mylib/wav","c:/mylib/siggen",libname;

libname :=

> with(SigGen); with(WAV);with(plots):

 

[ASD, Attack, Decay, FM_Signal, FM_Sine, Integer2By...
[ASD, Attack, Decay, FM_Signal, FM_Sine, Integer2By...

[ReadWAV, WriteWAV]

Warning, the name changecoords has been redefined

Numeric Magnitude and Phase functions, given real and imaginary parts of a complex number...
>
mag:=proc(RealPart, ImagPart)
sqrt(RealPart^2+ImagPart^2):
end:

phase:=proc(RealPart, ImagPart)
if (ImagPart<>0) then
evalhf(arctan(RealPart/ImagPart)):
else
evalhf(Pi/2):
end if:
end:


Next Section