function [result, context] = compute(event, parameter, context)

% CLIP - compute

%--
% make sure output directory exists
%--

[root, created] = create_dir(parameter.output);

%--
% write clip to file
%--

file = [root, filesep, event.userdata, '_', int2str(event.id), '.', parameter.format{1}];

sound_file_write(file, event.samples, event.rate);

%--
% output result
%--

result.file = file;