Home  |  Overview  |  Documentation |  Download |  MATLAB API |  HowTo... |  FAQ |  Feedback

MATLAB Support

Overview

The SFS MATLAB API allows MATLAB programmers access to the rich data structures of SFS files and through them to the acquisition, signal processing, editing and display functions of SFS. The SFS MATLAB API allows scripts to be written in MATLAB to list the contents of SFS files, to read, write and create data sets. A utility program matlabex allows MATLAB functions to be called from the command line in the same way as other SFS programs.

Download and Installation

Version 2 supports 32-bit and 64-bit MATLAB!

Version 2.00 of the SFS MATLAB API can be downloaded from:

To install:

API Functions

The following functions are available in SFS MATLAB API:

FunctionDescription
sfsfile Performs file-level operations on SFS files. Test existence of SFS file, create new file, empty file, get list of file contents.
sfsgetitem Reads the contents of an SFS item into MATLAB. sfsgetitem returns the item header in a MATLAB structure and the data set as a MATLAB array. Information about the size, structure and provenenance of the item is present in the header structure.
sfsnewitem Creates a new empty SFS item consisting of a header structure and a data set in a form compatible with sfsputitem().
sfsputitem Writes the contents of a supplied header structure and data set to an SFS file as a new item.

Type help sfsgetitem etc at the MATLAB prompt to get more information about function use. There is a separate documentation file for the MATLABEX program.

API Example

Here is an example of the SFS MATLAB API being used


function sfsfilter(fname,item,hertz,ftype)
% SFSFILTER Applies a filter to a speech signal
%
%   SFSFILTER(fname,item,hertz,ftype) applies an 8th-order
%   Butterworth filter to the speech signal 'item' in the SFS
%   file fname.  The hertz parameter gives the cut-off frequency
%   (or frequencies) in hertz.  The ftype parameter selects the
%   filter type from: 'low'=low-pass, 'high'=high-pass, 'band'=
%   band-pass, 'stop'=band-stop.  The filtered speech is saved
%   back into the SFS file.
%
%   For example:
%      sfsfilter('file.sfs','1.01',1000,'low');
%      sfsfilter('file.sfs','sp',[1000 2000],'band');

%
% get item from SFS file (h=header, d=data set)
%
[h,d]=sfsgetitem(fname,item);
%
% make filter (uses butter() design from signal-processing toolbox)
%
if strcmp(ftype,'low') | strcmp(ftype,'band')
    [b,a]=butter(8,2*hertz*h.frameduration);
else
    [b,a]=butter(8,2*hertz*h.frameduration,ftype);
end;
%
% make a new item header as copy of input item header
%
oh=sfsnewitem(h.datatype,h.frameduration,h.offset,h.framesize,h.numframes);
%
% create a suitable processing history string
%
if (length(hertz)==2)
    oh.history=sprintf('matlab/SP(%d.%02d;script=signalfilter,hertz=%g:%g,ftype=%s)',...
    	h.datatype,h.subtype,hertz(1),hertz(2),ftype);
else
    oh.history=sprintf('matlab/SP(%d.%02d;script=signalfilter,hertz=%g,ftype=%s)',...
    	h.datatype,h.subtype,hertz,ftype);
end;
%
% apply filter to input signal
%
od=filter(b,a,d);
%
% save filtered signal to file
%
sfsputitem(fname,oh,od);

Feedback

Please send suggestions for improvements and reports of program faults to sfs@pals.ucl.ac.uk.

Please note that we are unable to provide help with the use of this software. <


Some other pages on our site you may enjoy:

ESECTION - Speech signal cross-sections

ESection is a free program for calculating and displaying spectral and other related analyses of sections of a speech signal. It can be used to demonstrate the different spectral properties of elements of speech. It can also calculate an LPC spectrum, autocorrelation and cepstrum analyses, and can display the signal as a waveform or as a spectrogram. It automatically finds formant and fundamental frequency values. More information.

BROWSE - Simple tool for browsing audio files

BROWSE is a program for browsing audio recordings. With BROWSE you can drag and drop audio files in a range of formats onto the display to see and hear their contents. BROWSE allows you to zoom, scroll and save the audio files to other formats. More information.