M2K Signal class
Kris West (kw@cmp.uea.ac.uk)
Contents
- Overview
- Data storage
- Access methods
- Editing methods
- Time Stamps
Overview
The M2K Signal class was designed to encapsulate any signal, from a
monophone waveform to an N-dimensional signal, such as a set of MFCCs calculated
from a waveform. Meta-data storage is provided in the form a HashMap,
allowing data to be stored in a variety formats. Keys to meta-data are standardised
(both key name and value data type) and a list of the current standards is output
by the metadataStandards() method.
top
Data storage
- The Signal data is stored in the column-major data variable
(data[columns][rows]).
- Meta-data about the Signal is stored in a java.util.HashMap
top
Access methods
Data matrix
- The getData() method returns a reference to the data matrix and
can be used to access the main data matrix. Any cell can be directly referenced in the following
format: getData()[column][row].
- A single row of data can be returned with the getDataRow(int row)
method.
Meta-data
- getMetadata(java.lang.String key) Returns the metadata value
corresponding to the supplied key, as a java.lang.Object
- Other access methods are provided which cast data returned by getMetadata()
into a particular format. These are :-
double[] getDoubleArrayMetadata(java.lang.String key),
double getDoubleMetadata(java.lang.String key),
int[] getIntArrayMetadata(java.lang.String key),
int getIntMetadata(java.lang.String key),
String[] getStringArrayMetadata(java.lang.String key) and
String getStringMetadata(java.lang.String key)
- The current list of Meta-data standards can be returned as a String with the metadataStandards() method
top
Editing methods
Data matrix
- The appendColumn(double[] column, java.lang.String columnLabel)
method adds the column of data, passed as a parameter, to the data matrix, expanding it to accomodate the additional data. The column label is added to the
column label meta-data.
- The appendMatrix(double[][] column, java.lang.String[] columnLabels)
method adds the matrix of data, passed as a parameter, to the data matrix, expanding it to accomodate the additional data. The column labels are added to the
column label meta-data.
- The deleteColumn(int col) method removes the specified column from the data matrix
and the corresponding label from the column label meta-data.
- The deleteData() method removes the data matrix from the Signal object
and the labels from the column label meta-data.
Meta-data
- The setMetadata(java.lang.String key, java.lang.Object value) method
adds the specified object to the Meta-data HashMap, storing it under the specified key.
top
Time Stamps
A time-stamp for a particular row of data in the Signal can be calculated with the getTimeStamp(int rowNumber)
method, which requires the "sampleRate" meta-data to be set. If the "frameSize" and "overlapSize"
are set they are used in the time stamp calculation, allowing the same method to be used for both waveform data and spectral data.
top