File: estsigpr.md

package info (click to toggle)
speech-tools 1%3A2.5.0-5
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 9,848 kB
  • sloc: cpp: 67,350; ansic: 12,175; sh: 4,047; java: 3,748; makefile: 1,109; lisp: 711; perl: 501; awk: 85; xml: 9
file content (233 lines) | stat: -rw-r--r-- 9,474 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
Signal Processing {#estsigpr}
========================

The EST signal processing library provides a set of standard
signal processing tools designed specifically for speech
analysis. The library includes:

  - Windowing (creating frames from a continuous waveform)
  - Linear prediction and associated operations
  - Cepstral analysis, both via lpc and DFT.
  - Filterbank analysis
  - Frequency warping including mel-scaling
  - Pitch tracking
  - Energy and Power analysis
  - Spectrogram Generation
  - Fourier Transforms
  - Pitchmarking (of laryngograph signals)

# Overview {#estsigproverview}

## Design Issues {#estsigprdesign}

The signal processing library is designed specifically for speech
applications and hence all functions are written with that end
goal in mind.  The design of the library has centered around
building a set of commonly used easy to configure analysis
routines.

  - **Speed**: We have tried to make the functions as fast as
    possible. Signal processing can often be time critical, and
    so it will always be the case that if the code for a
    particular signal processing algroithm is written in a
    single function loop it will run faster than by using
    libraries.
    
    However, the signal processing routines in the EST library
    are in general very fast, and the fact that they use
    classes such as EST_Track and EST_FVector does not make
    them slower than they would be if `float *` etc was used.

  - **types**: The library makes heavy use of a small number of
    classes, specifically EST_Wave, EST_Track and EST_FVector. These 
    classes are basically arrays and matrices, but take care of 
    issues such as memory managment, error handling and file i/o. Using 
    these classes in the library helps facilitate clean and simple
    algorithm writing and use. It is strongly recommended that
    you gain familiarity with these classes before using this
    part of the library.
    
    At present, the issue of complex numbers in signal
    processing is somewhat fudged, in that a vector of complex
    numbers is represented by a vector of real parts and a
    vector of imaginary parts, rather than as a single vector
    of complex numbers. 

## Common Processing model {#estsigprcommonprocessing}

In speech, a large number of algorithms follow the same basic
model, in which a waveform is analysed by an algorithm and a
Track, containing a series of time aligned vectors is
produced. Regardless of the type of signal processing, the
basic model is as follows:

  1. Start with a waveform and a series of analysis positions, which 
     can be a fixed distance apart of specified by some other means.
  2. For each analysis position, define a small portion of the
     waveform around that position, Multiply this by a
     windowing function to produce a vector of speech samples.
  3. Pass this to a frame based signal processing 
     routine which outputs values in another vector.
  4. Add this vector to a position in an EST_Track
     which correponds to the analysis time position.

Given this model, the signal processing library breaks down into a
number of different types of function:

 - **Utterance based functions**:  Functions which operate on an entire waveform or
	 track. These break down into:
    - **Analysis Functions**: which take a waveform and produce a track
    - **Synthesis Functions**: which take a track and produce a waveform
    - **Filter Functions**: which take a waveform and produce a waveform
    - **Conversion Functions**: which take a track and produce a track
 - **Frames based functions**:  Functions which operate on a single frame of speech or
   vector coefficients.
 - **Windowing functions**: which create a windowed frame of speech from a portion
   of a waveform.

Nearly all functions in the signal processing library belong to
one of the above listed types. Quite often functions are
presented on both the utterance and frame level. For example,
there is a function called \ref sig2lpc which
takes a single frame of windowed speech and produces a set of
linear prediction coefficients. There is also a function called
\ref sig2coef which performs linear prediction
on a whole waveforn, returning the answer in a
Track. \ref sig2coef uses the common processing
model, and calls \ref sig2lpc as the algorithm
in the loop.

Partly for historical reasons some functions,
e.g. \ref pda are only available in the
utterance based form.

When writing signal processing code for this library, it is
often the case that all that needs to be written is the frame
based algorithm, as other algorithms can do the frame shifting
and windowing operations.

   
## Track Allocation, Frames, Channels and sub-tracks {#estsigprtrackalloc}

The signal processing library makes extensive use of the
advanced features of the track class, specifically the ability
to access single frames and channels.  

Given a standard multi-channel track, it is possible to make 
a FVector point to any single frame or channel - this is done
by an internal pointer mechanism in EST_FVector. Furthermore,
a track can be made to point to a selected number of channels
or frames in a main track.

For example, imagine we have a function that calculates the
covariance matrix for a multi-dimensional track of data.  But
the data we actually have contains energy, cepstra and delta
cepstra.  It is non-sensical to calculate convariance on
all of this, we just want the cepstra. To do this we use the
sub-track facility to set a temporary track to just the
cepstral coefficients and pass this into the covariance
function. The temporary track has smart pointers into the
original track and hence no data is copied.

Without this facility, either you would have to do a copy
(expensive) or else tell the covariance function which part of
the track to use (hacky).

Extensive documentation describing this process is found in \ref sigpr-example-frames,
\ref tr_example_access_multiple_frames and \ref tr_example_access_single_frames.

# Functions {#estsigprfunctions}

## Functions for Generating Frames {#est-sigpr-generating-frames}

The following set of functions perform either a signal
processing operation on a single frame of speech to produce a set of
coefficients, or a transformation on an existing set of coefficients
to produce a new set. In most cases, the first argument to the
function is the input, and the second is the output. It is assumed
that any input speech frame has already been windowed with an
appropriate windowing function (eg. Hamming) - see 
\ref "Windowing mechanisms" on how to produce such a frame. See also
\ref sigpr-track-func.

It is also assumed that the output vector is of the correct size. No
resizing is done in these functions as the incoming vectors may be
subvectors of whole tracks etc. In many cases (eg. lpc analysis), an
**order** parameter is required. This is usually derived from the size
of the input or output vectors, and hence is not passed explicitly.

  - \ref LinearPredictionfunctions
  - \ref Energyandpowerframefunctions
  - \ref FastFourierTransformfunctions
  - \ref Framebasedfilterbankandcepstralanalysis

## Functions for Generating Tracks {#sigpr-track-func}

Functions which operate on a whole waveform and generate coefficients
for a track.

  - \ref Functionsforusewithframebasedprocessing
  - \ref DeltaandAccelerationcoefficients
  - \ref PitchF0DetectionAlgorithmfunctions
  - \ref PitchmarkingFunctions
  - \ref Spectrogramgeneration

These functions are a nice set of stuff

## Functions for Windowing Frames of Waveforms   {#est_sigpr_windowing}

  - \ref EST_Window


## Filter functions {#sigpr-filter}

A filter modifies a waveform by changing its frequency
characteristics. The following types of filter are currently
supported:

  - **FIR filters**: FIR filters are general purpose finite impulse
    response filters which are useful for band-pass, low-pass and 
    high-pass filtering.
  - **Linear Prediction filters**:  are used to produce LP residuals
    from waveforms and viceversa.
  - **Pre Emphasis filters**: are simple filters for changing the 
    spectral tilt of a signal.
  - **Non linear filters**: Miscellaneous filters

  - \subpage FIRfilters
  - \subpage LinearPredictionfilters
  - \subpage PrePostEmphasisfilters
  - \subpage Miscellaneousfilters

## Filter design {#sigpr-filter-design}

  - \subpage FilterDesign

# Example
\subpage sigpr-example

# Programs {#sigpr-programs}

The following are exectutable programs which are used for signal
processing:

  - @ref sigfv_manual is used to provide produce a variety of feature vectors given a
    waveform.
  - @ref spectgen_manual is used to produce spectrograms from utterances.
  - @ref sigfilter_manual performs filtering operations on waveforms.
  - @ref pda_manual performs pitch detection on waveforms. While sig2fv can perform pitch
    detection also, pda offers more control over the operation.
  - @ref pitchmark_manual produces a set of pitchmarks, 
    specifying the instant of glottal close from laryngograph waveforms.

The following programs are also useful in signal processing:

  - @ref ch_wave_manual performs basic operations on waveforms, such as
    adding headers, resampling, rescaling, multi to single channel
    conversion etc.
  - @ref ch_track_manual performs basic operates on coefficient tracks,
    such as adding headers, resampling, rescaling, multi to single
    channel conversion etc.