-
Notifications
You must be signed in to change notification settings - Fork 10
Advanced use
Every time you perform a command, we obtain either a graphic on a new window, or the display of a single value directly in Matlab's Command Window. It is also possible to get the actual numerical results in a Matlab structure (an array, for instance).
For instance, if the result of the analysis is stored in a variable:
a = sig.spectrum('test.wav')
Then we can use the following syntax to output the actual results in Matlab:
v = sig.getdata(a);
Alternatively, this can be written
v = a.getdata;
To access other fields stored in your output object, use the get
method.
get(...,'Srate')
returns the sampling rate.
get(...,'Sdata')
returns the sampling positions.
get(...,'Frate')
returns the frame rate.
get(...,'Flength')
returns the frame length.
get(...,'Fstarts')
returns the temporal position of the start of each successive frame.
get(...,'Fends')
returns the temporal position of the end of each successive frame.
get(...,'Xdata')
returns the successive positions stored in the 'element'
dimension.
get(...,'Xname')
describes the type of the values stored in the 'element'
dimension.
get(...,'Ydata')
returns the actual data in Matlab format.
More to come...
For instance, you can get the phase data from sig.spectrum
by using the following syntax:
s = sig.spectrum('ragtime.wav')
p = get(s,'Phase')
When extracting peaks:
p = sig.peaks(e)
you can get the position of each peak:
get(p,'PeakPos')
and the value associated to each peak:
get(p,'PeakVal')
The list of available fields are indicated at the end of the documentation of each operator in a section called "Accessible output". For the previous example, this is documented here.
The Mining Suite features a very particular architecture that enables to easily design complex pipelines by writing a simple succession of operators, for instance:
a = sig.signal('ragtime.wav','Sampling',11025);
b = sig.spectrum(a,'Max',5000);
c = sig.centroid(b)
It should be noted however that the output variables (here a
, b
and c
) are not actual data, but merely the description of the analytical process itself (they are instances of sig.design
class). As such, each time one of this variable is called and the result displayed, the whole process is performed once again. For instance, if we add an additional operation:
d = aud.mfcc(c)
The operations indicated in a
, b
and c
are performed once again. This is due to technical optimisations, and in particular an optimised use of memory consumption.
It is possible to force one operation to be performed once for good, by using the eval
method. For instance:
b = b.eval
The eval
method outputs a cell array. The main data is the first element of this array, which can be obtained by using the following syntax:
b = b{1}
Let's suppose we compute a series of operations such as the following:
f = sig.filterbank('test.wav','CutOff',[-Inf,1000,5000]);
e = sig.envelope(f);
s = sig.sum(e);
p = sig.peaks(s);
Then it is possible to see again the series of operations, with detailed information about all the parameters, by using the .show
command:
p.show
You can import in the MiningSuite any data you have already computed in Matlab. For instance let's say we generate an array using this Matlab command:
c = rand(100,1)
Then we can import this array as values of sig.signal
. Here you need to know that sig.signal
actually outputs a Matlab object of class sig.Signal
. So to create your own object, use the sig.Signal
method:
sig.Signal(c)
You can specify the sampling rate:
sig.Signal(c,'Srate',100)
There is no proper documentation of those classes for the moment.