21abc12audio-spike-sorting: benchmark framework for audio event detection and classificationJeremy Magland 1/**
2 * The built-in baseline algorithms. Their sources ship with the app and
3 * can be reset to these originals after editing; user-added algorithms
4 * live only in the store.
5 */
6import type { AlgorithmDef } from '../bench/types.ts';
7import matchedFilterSrc from './template_matched_filter.m?raw';
8import onsetKnnSrc from './onset_knn.m?raw';
9import naiveSrc from './naive_threshold.m?raw';
11export const BUILTIN_ALGORITHMS: AlgorithmDef[] = [
12 {
13 id: 'builtin:template_matched_filter',
14 name: 'template_matched_filter',
15 source: matchedFilterSrc,
16 enabled: true,
17 builtin: true,
18 },
19 {
20 id: 'builtin:onset_knn',
21 name: 'onset_knn',
22 source: onsetKnnSrc,
23 enabled: true,
24 builtin: true,
25 },
26 {
27 id: 'builtin:naive_threshold',
28 name: 'naive_threshold',
29 source: naiveSrc,
30 enabled: true,
31 builtin: true,
32 },
33];
35export const NEW_ALGORITHM_TEMPLATE = `function [times, labels] = my_sorter(x, fs, training)
36% x recording, column vector at fs Hz
37% training struct: snips {1 x nTypes} cell of [snipLen x nSnips] matrices
38% (columns are snippets), names {1 x nTypes}, pre (samples
39% before the event onset within each snippet)
40% Return event times in seconds and 1-based type labels.
41times = zeros(0, 1);
42labels = zeros(0, 1);
43end
44`;