signavis 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/wasm-spectrogram.worker-oU-CQV61.js.map +1 -1
- package/dist/birdnet-player.css +1 -1
- package/dist/birdnet-player.esm.js +1541 -1162
- package/dist/birdnet-player.esm.js.map +1 -1
- package/dist/birdnet-player.iife.js +63 -29
- package/dist/birdnet-player.iife.js.map +1 -1
- package/dist/tokens.css +3 -0
- package/package.json +6 -4
- package/types/generated/app/BirdNETPlayer.d.ts +36 -7
- package/types/generated/app/PlayerState.d.ts +8 -1
- package/types/generated/app/ViewportManager.d.ts +20 -3
- package/types/generated/app/adopt-detection.d.ts +34 -0
- package/types/generated/app/annotation-sets.d.ts +9 -1
- package/types/generated/app/annotator-profile.d.ts +2 -0
- package/types/generated/app/domRefs.d.ts +7 -0
- package/types/generated/app/interactionState.d.ts +2 -0
- package/types/generated/app/labeling/app-context.d.ts +44 -0
- package/types/generated/app/labeling/dedupe-labels.d.ts +13 -0
- package/types/generated/app/labeling/features/annota-import.d.ts +14 -0
- package/types/generated/app/labeling/features/file-drop.d.ts +12 -0
- package/types/generated/app/labeling/features/mic-recording.d.ts +9 -0
- package/types/generated/app/labeling/features/raven-export.d.ts +6 -0
- package/types/generated/app/labeling/features/theme.d.ts +1 -0
- package/types/generated/app/labeling/features/xc-upload.d.ts +48 -0
- package/types/generated/app/labeling/help-menu.d.ts +37 -0
- package/types/generated/app/labeling/label-store.d.ts +59 -0
- package/types/generated/app/labeling/main.d.ts +0 -0
- package/types/generated/app/labeling/render-scheduler.d.ts +16 -0
- package/types/generated/app/labeling/sponsor-card.d.ts +11 -0
- package/types/generated/app/player/WaveformRenderer.d.ts +10 -0
- package/types/generated/app/recording-manager.d.ts +2 -0
- package/types/generated/app/similarBand.d.ts +11 -0
- package/types/generated/app/similarSpectrogram.d.ts +34 -0
- package/types/generated/app/suggest-similar.d.ts +56 -0
- package/types/generated/domain/annotations.d.ts +103 -4
- package/types/generated/domain/detector/birdboxStream.d.ts +142 -0
- package/types/generated/domain/detector/boxUnder.d.ts +17 -0
- package/types/generated/domain/detector/fusion.d.ts +50 -0
- package/types/generated/domain/detector/nearby.d.ts +47 -0
- package/types/generated/domain/detector/pacer.d.ts +45 -0
- package/types/generated/domain/labelBand.d.ts +12 -0
- package/types/generated/domain/similar/cluster.d.ts +40 -0
- package/types/generated/domain/similar/ncc.d.ts +144 -0
- package/types/generated/domain/snapToCall.d.ts +10 -0
- package/types/generated/domain/species-lists.d.ts +53 -0
- package/types/generated/domain/speciesLinks.d.ts +17 -0
- package/types/generated/infrastructure/audio/LiveRecorder.d.ts +2 -0
- package/types/generated/infrastructure/birdnetInference.d.ts +3 -0
- package/types/generated/infrastructure/detector/birdbox.worker.d.ts +1 -0
- package/types/generated/infrastructure/detector/birdboxDetector.d.ts +69 -0
- package/types/generated/infrastructure/detector/birdboxGraph.d.ts +53 -0
- package/types/generated/infrastructure/similar.worker.d.ts +1 -0
- package/types/generated/infrastructure/tauri/runtime.d.ts +8 -2
- package/types/generated/infrastructure/xeno-canto/annotaPayload.d.ts +2 -0
- package/types/generated/shared/constants.d.ts +2 -1
- package/types/generated/shared/events.d.ts +2 -0
- package/types/generated/ui/components/label-editor/LabelEditorModal.d.ts +7 -1
- package/types/generated/ui/components/label-template/template-tags.d.ts +18 -0
- package/types/generated/ui/components/onboarding/onboarding-wizard.d.ts +22 -0
- package/types/generated/ui/components/overview/overview-controller.d.ts +6 -1
- package/types/generated/ui/components/similar-review/group-review.d.ts +40 -0
- package/types/generated/ui/components/similar-review/similar-review.d.ts +62 -0
- package/types/generated/ui/components/taxonomy-ui/species-geo-cache.d.ts +28 -0
- package/types/generated/ui/components/taxonomy-ui/species-ranking.d.ts +51 -0
- package/types/generated/ui/components/taxonomy-ui/taxonomy-ui.d.ts +43 -26
- package/types/generated/ui/components/toast/undo-toast.d.ts +6 -1
- package/types/generated/ui/components/waveform/waveform.d.ts +4 -1
- package/types/generated/ui/components/xc-export-modal/xc-export-modal.d.ts +5 -0
- package/types/generated/ui/mobile/i18n.d.ts +133 -0
- package/types/generated/ui/mobile/mobile-app.d.ts +272 -0
- package/types/generated/ui/mobile/thumb.d.ts +11 -0
- package/types/generated/ui/panels/birdbox-panel.d.ts +75 -0
- package/types/generated/ui/panels/birdnet-panel.d.ts +36 -4
- package/types/generated/ui/panels/label-list.d.ts +14 -0
- package/types/generated/ui/panels/mode-tiles.d.ts +7 -0
- package/types/generated/ui/panels/model-picker.d.ts +11 -0
- package/types/generated/ui/panels/recording-explorer.d.ts +2 -0
- package/types/generated/ui/panels/sidebar.d.ts +11 -1
- package/types/generated/ui/panels/similar-panel.d.ts +29 -0
- package/types/generated/ui/panels/species-lists-panel.d.ts +58 -0
- package/types/generated/ui/panels/xc-panel.d.ts +10 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export declare const ROWS = 16, COLS = 24;
|
|
2
|
+
export declare const W_DUR = 0.3, W_FREQ = 1;
|
|
3
|
+
export declare const DEFAULT_CUT = 1;
|
|
4
|
+
export interface CallPatch {
|
|
5
|
+
/** dB above the floor, rows × cols, row-major (row 0 = lowest frequency). */
|
|
6
|
+
values: Float32Array;
|
|
7
|
+
rows: number;
|
|
8
|
+
cols: number;
|
|
9
|
+
duration: number;
|
|
10
|
+
centreHz: number;
|
|
11
|
+
}
|
|
12
|
+
export interface CallFeature {
|
|
13
|
+
v: Float32Array;
|
|
14
|
+
logDur: number;
|
|
15
|
+
logFreq: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Bilinear resample to ROWS × COLS, then zero mean and unit norm. Cells below the floor count as 0 dB,
|
|
19
|
+
* so background noise weighs less (Powdermill: same effort at the default cut, purer at finer cuts).
|
|
20
|
+
*/
|
|
21
|
+
export declare function callFeature(p: CallPatch): CallFeature;
|
|
22
|
+
export declare function pearson(a: CallFeature, b: CallFeature): number;
|
|
23
|
+
export declare function callDistance(a: CallFeature, b: CallFeature): number;
|
|
24
|
+
/**
|
|
25
|
+
* Average-linkage clustering of n items with distance d(i, j), cut at `cut` (like scipy fcluster 'distance').
|
|
26
|
+
* Returns a cluster index per item. Nearest-neighbour chain builds the full dendrogram in O(n²);
|
|
27
|
+
* average linkage has no inversions, so applying exactly the merges at height ≤ cut gives the cut.
|
|
28
|
+
*/
|
|
29
|
+
export declare function averageLinkage(n: number, d: (i: number, j: number) => number, cut: number): Int32Array;
|
|
30
|
+
export interface CallGroup {
|
|
31
|
+
/** Indices into the input, medoid first, then by similarity to it. */
|
|
32
|
+
members: number[];
|
|
33
|
+
/** Pearson r of each member's patch with the medoid's (same order). */
|
|
34
|
+
scores: number[];
|
|
35
|
+
}
|
|
36
|
+
/** Groups of at least `minSize` calls, largest first. */
|
|
37
|
+
export declare function groupCalls(features: CallFeature[], { cut, minSize }?: {
|
|
38
|
+
cut?: number;
|
|
39
|
+
minSize?: number;
|
|
40
|
+
}): CallGroup[];
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/** Band rows of a spectrogram, floor removed (dB above the row's median), row-major. */
|
|
2
|
+
export interface BandSpectrogram {
|
|
3
|
+
values: Float32Array;
|
|
4
|
+
rows: number;
|
|
5
|
+
frames: number;
|
|
6
|
+
/** Frequency (Hz) of row 0 and row spacing; time (s) of frame 0 and frame spacing. */
|
|
7
|
+
f0: number;
|
|
8
|
+
df: number;
|
|
9
|
+
t0: number;
|
|
10
|
+
dt: number;
|
|
11
|
+
}
|
|
12
|
+
export interface Box {
|
|
13
|
+
start: number;
|
|
14
|
+
end: number;
|
|
15
|
+
freqMin: number;
|
|
16
|
+
freqMax: number;
|
|
17
|
+
}
|
|
18
|
+
export interface SimilarHit extends Box {
|
|
19
|
+
score: number;
|
|
20
|
+
/** First frame and row shift of the match (for patches / re-ranking). */
|
|
21
|
+
frame?: number;
|
|
22
|
+
shift?: number;
|
|
23
|
+
}
|
|
24
|
+
export interface FindOptions {
|
|
25
|
+
/** Frequency shift tolerated, in rows (each way). */
|
|
26
|
+
shift?: number;
|
|
27
|
+
/** Rows added above and below the exemplar's band. */
|
|
28
|
+
margin?: number;
|
|
29
|
+
/** Lowest score kept. */
|
|
30
|
+
minScore?: number;
|
|
31
|
+
/** Most hits returned. */
|
|
32
|
+
max?: number;
|
|
33
|
+
/** Two hits are at least this share of the exemplar's duration apart. */
|
|
34
|
+
minGap?: number;
|
|
35
|
+
}
|
|
36
|
+
/** In-place radix-2 complex FFT; `inverse` scales by 1/n. */
|
|
37
|
+
export declare function fft(re: Float64Array, im: Float64Array, inverse?: boolean): void;
|
|
38
|
+
/**
|
|
39
|
+
* Normalised cross-correlation of rows [r0, r1) × frames [c0, c1) over every frame offset,
|
|
40
|
+
* best over row shifts −shift..shift. Returns score per offset (length frames − width + 1)
|
|
41
|
+
* and the shift that gave it.
|
|
42
|
+
*/
|
|
43
|
+
export declare function nccCurve(spec: BandSpectrogram, r0: number, r1: number, c0: number, c1: number, shift?: number): {
|
|
44
|
+
score: Float32Array;
|
|
45
|
+
shiftAt: Int8Array;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Normalised cross-correlation of patch P (R × T, any scale) placed at rows [r0, r0 + R) of `spec`,
|
|
49
|
+
* over every frame offset, best over row shifts −shift..shift.
|
|
50
|
+
*/
|
|
51
|
+
export declare function correlate(spec: BandSpectrogram, patch: Float32Array, R: number, T: number, r0: number, shift?: number): {
|
|
52
|
+
score: Float32Array;
|
|
53
|
+
shiftAt: Int8Array;
|
|
54
|
+
};
|
|
55
|
+
/** Local maxima, best first, at least `gap` frames apart (greedy non-maximum suppression). */
|
|
56
|
+
export declare function pickPeaks(score: Float32Array, gap: number, minScore: number, max: number): number[];
|
|
57
|
+
/** Time IoU of two boxes. */
|
|
58
|
+
export declare function timeIoU(a: Box, b: Box): number;
|
|
59
|
+
/** Repeats of `exemplar` in `spec`, best first; the exemplar itself is left out. */
|
|
60
|
+
/** Rows and frames of the exemplar's patch in `spec` (band plus margin). */
|
|
61
|
+
export declare function exemplarWindow(spec: BandSpectrogram, exemplar: Box, opts?: FindOptions): {
|
|
62
|
+
r0: number;
|
|
63
|
+
r1: number;
|
|
64
|
+
c0: number;
|
|
65
|
+
c1: number;
|
|
66
|
+
};
|
|
67
|
+
export declare function findSimilar(spec: BandSpectrogram, exemplar: Box, opts?: FindOptions): SimilarHit[];
|
|
68
|
+
export declare class Reranker {
|
|
69
|
+
private readonly spec;
|
|
70
|
+
private readonly win;
|
|
71
|
+
private readonly hits;
|
|
72
|
+
private readonly lambda;
|
|
73
|
+
private readonly R;
|
|
74
|
+
private readonly T;
|
|
75
|
+
private readonly areas;
|
|
76
|
+
private readonly cores;
|
|
77
|
+
private readonly pos;
|
|
78
|
+
private readonly neg;
|
|
79
|
+
private readonly open;
|
|
80
|
+
constructor(spec: BandSpectrogram, win: {
|
|
81
|
+
r0: number;
|
|
82
|
+
r1: number;
|
|
83
|
+
c0: number;
|
|
84
|
+
c1: number;
|
|
85
|
+
}, hits: SimilarHit[], lambda?: number);
|
|
86
|
+
/** Hit i's patch with ±PAD margins (rows clamped to the spectrogram, frames to the recording). */
|
|
87
|
+
private area;
|
|
88
|
+
/** Hit i's patch without margins, zero mean, unit norm. */
|
|
89
|
+
private core;
|
|
90
|
+
private move;
|
|
91
|
+
similarity(i: number, j: number): number;
|
|
92
|
+
/**
|
|
93
|
+
* Record a decision on hit i; returns the rank of every hit (decided ones: −Infinity).
|
|
94
|
+
* `moved`: the user corrected the box before deciding; its centre moved by `dt` seconds and
|
|
95
|
+
* `df` Hz, so hit i's patch is taken from there (the patch keeps the exemplar's size).
|
|
96
|
+
*/
|
|
97
|
+
decide(i: number, accepted: boolean, moved?: {
|
|
98
|
+
dt: number;
|
|
99
|
+
df: number;
|
|
100
|
+
}): Float64Array;
|
|
101
|
+
ranks(): Float64Array;
|
|
102
|
+
}
|
|
103
|
+
export interface SearchState {
|
|
104
|
+
hits: SimilarHit[];
|
|
105
|
+
reranker: Reranker;
|
|
106
|
+
}
|
|
107
|
+
/** findSimilar plus a Reranker over its hits. */
|
|
108
|
+
/** findSimilar (exemplar in this recording) or findWithTemplate (from another) plus a Reranker over the hits. */
|
|
109
|
+
export declare function createSearch(spec: BandSpectrogram, exemplar: Box | {
|
|
110
|
+
template: CallTemplate;
|
|
111
|
+
}, opts?: FindOptions & {
|
|
112
|
+
lambda?: number;
|
|
113
|
+
}): SearchState;
|
|
114
|
+
export interface CallTemplate {
|
|
115
|
+
values: Float32Array;
|
|
116
|
+
rows: number;
|
|
117
|
+
frames: number;
|
|
118
|
+
/** Frequency (Hz) of row 0 and row spacing, frame spacing (s). */
|
|
119
|
+
f0: number;
|
|
120
|
+
df: number;
|
|
121
|
+
dt: number;
|
|
122
|
+
/** The exemplar's box band (Hz), for the hit boxes. */
|
|
123
|
+
freqMin: number;
|
|
124
|
+
freqMax: number;
|
|
125
|
+
}
|
|
126
|
+
/** The exemplar's patch as a template (same window as findSimilar uses). */
|
|
127
|
+
export declare function templateFrom(spec: BandSpectrogram, exemplar: Box, opts?: FindOptions): CallTemplate | null;
|
|
128
|
+
/** `t` on the grid of `spec` (bilinear), with the row of `spec` its first row lands on. */
|
|
129
|
+
export declare function fitTemplate(t: CallTemplate, spec: BandSpectrogram): {
|
|
130
|
+
patch: Float32Array;
|
|
131
|
+
R: number;
|
|
132
|
+
T: number;
|
|
133
|
+
r0: number;
|
|
134
|
+
};
|
|
135
|
+
/** Repeats of a template (from this or another recording) in `spec`, best first. */
|
|
136
|
+
export declare function findWithTemplate(spec: BandSpectrogram, t: CallTemplate, opts?: FindOptions): {
|
|
137
|
+
hits: SimilarHit[];
|
|
138
|
+
win: {
|
|
139
|
+
r0: number;
|
|
140
|
+
r1: number;
|
|
141
|
+
c0: number;
|
|
142
|
+
c1: number;
|
|
143
|
+
};
|
|
144
|
+
};
|
|
@@ -29,6 +29,16 @@ export type SnapResult = {
|
|
|
29
29
|
ok: false;
|
|
30
30
|
reason: 'noise' | 'spread';
|
|
31
31
|
};
|
|
32
|
+
/**
|
|
33
|
+
* Boxes of a call detector (BirdBox) for Snap: the box under a click at confidence `conf`;
|
|
34
|
+
* `weaker`: no box at `conf`, but one below it. Null: no detector results for this recording.
|
|
35
|
+
*/
|
|
36
|
+
export type SnapBoxSource = (time: number, freq: number, conf: number) => {
|
|
37
|
+
box: SnapBox | null;
|
|
38
|
+
weaker: boolean;
|
|
39
|
+
} | null;
|
|
40
|
+
/** Start confidence for detector boxes (BirdBox default; see scripts/birdbox/snap-benchmark.mjs). */
|
|
41
|
+
export declare const SNAP_BOX_DEFAULT_CONF = 0.15;
|
|
32
42
|
export declare const SNAP_DEFAULT_SENSITIVITY = 0.75;
|
|
33
43
|
/** Seed must stand this far above the band floor. */
|
|
34
44
|
export declare const MIN_PEAK_DB = 10;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* User species lists — the SignaVis counterpart of BirdNET's `--slist` file.
|
|
3
|
+
* A list is a named set of scientific names; the active one restricts BirdNET
|
|
4
|
+
* detections. Pure helpers + a small localStorage-backed store.
|
|
5
|
+
*/
|
|
6
|
+
export interface SpeciesList {
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
/** Scientific names, unique, in insertion order. */
|
|
10
|
+
species: string[];
|
|
11
|
+
source?: 'manual' | 'location' | 'import' | 'labels';
|
|
12
|
+
updatedAt: number;
|
|
13
|
+
}
|
|
14
|
+
export interface SpeciesListState {
|
|
15
|
+
activeId: string | null;
|
|
16
|
+
lists: SpeciesList[];
|
|
17
|
+
}
|
|
18
|
+
export declare const STORAGE_KEY = "signavis.speciesLists.v1";
|
|
19
|
+
/**
|
|
20
|
+
* Parse a BirdNET species list file. Accepts `Genus species_Common name`
|
|
21
|
+
* (BirdNET labels format), plain scientific names and CSV/TSV rows whose first
|
|
22
|
+
* column is the scientific name. Blank lines and `#` comments are skipped.
|
|
23
|
+
*/
|
|
24
|
+
export declare function parseSpeciesListText(text: string): string[];
|
|
25
|
+
/** BirdNET `--slist` format: one `Scientific name_Common name` per line. */
|
|
26
|
+
export declare function serializeSpeciesList(species: string[], commonName?: (sci: string) => string): string;
|
|
27
|
+
/** Case-insensitive membership set for filtering. */
|
|
28
|
+
export declare function speciesFilterSet(list: SpeciesList | null | undefined): Set<string> | null;
|
|
29
|
+
/** Keep detections whose scientific name is in the set (null = no filter). */
|
|
30
|
+
export declare function filterBySpeciesList<T extends {
|
|
31
|
+
scientific?: string;
|
|
32
|
+
}>(dets: T[], set: Set<string> | null): T[];
|
|
33
|
+
export declare class SpeciesListStore {
|
|
34
|
+
state: SpeciesListState;
|
|
35
|
+
private listeners;
|
|
36
|
+
private storage;
|
|
37
|
+
constructor(storage?: Pick<Storage, 'getItem' | 'setItem'> | null);
|
|
38
|
+
private load;
|
|
39
|
+
private commit;
|
|
40
|
+
onChange(fn: () => void): () => boolean;
|
|
41
|
+
get lists(): SpeciesList[];
|
|
42
|
+
get(id: string | null): SpeciesList;
|
|
43
|
+
get active(): SpeciesList;
|
|
44
|
+
create(name: string, species?: string[], source?: SpeciesList['source']): SpeciesList;
|
|
45
|
+
rename(id: string, name: string): void;
|
|
46
|
+
add(id: string, sci: string[]): void;
|
|
47
|
+
remove(id: string, sci: string[]): void;
|
|
48
|
+
duplicate(id: string): SpeciesList;
|
|
49
|
+
delete(id: string): void;
|
|
50
|
+
/** null = all species (no filter). */
|
|
51
|
+
setActive(id: string | null): void;
|
|
52
|
+
private patch;
|
|
53
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External species references from a taxonomy record
|
|
3
|
+
* (fields `ebird`, `inat`, `xc` written by scripts/build-birdnet-taxonomy.js).
|
|
4
|
+
*/
|
|
5
|
+
export interface SpeciesLink {
|
|
6
|
+
label: string;
|
|
7
|
+
url: string;
|
|
8
|
+
}
|
|
9
|
+
/** Links to eBird and iNaturalist for a taxonomy record (empty if it has no IDs). */
|
|
10
|
+
export declare function speciesLinks(record: any): SpeciesLink[];
|
|
11
|
+
/**
|
|
12
|
+
* Names to query Xeno-canto with, in order: the taxonomy's own name first,
|
|
13
|
+
* then Xeno-canto's spelling as a fallback. The BirdNET taxonomy's xc_name is
|
|
14
|
+
* sometimes outdated or misspelled (e.g. "Falco longipennisr"), so it must not
|
|
15
|
+
* replace a name that already finds recordings.
|
|
16
|
+
*/
|
|
17
|
+
export declare function xcSearchNames(record: any, sciName: string): string[];
|
|
@@ -27,6 +27,8 @@ export declare class LiveRecorder extends EventTarget {
|
|
|
27
27
|
private startedAt;
|
|
28
28
|
private stopping;
|
|
29
29
|
analyser: AnalyserNode | null;
|
|
30
|
+
/** Called with each block of samples as it is kept (e.g. for live detection). */
|
|
31
|
+
ondata: ((chunk: Float32Array) => void) | null;
|
|
30
32
|
sampleRate: number;
|
|
31
33
|
constructor(opts?: LiveRecorderOptions);
|
|
32
34
|
static get supported(): boolean;
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
* (BirdNET Live layout). Runs on onnxruntime-web (WASM), 32 kHz, 3 s windows,
|
|
7
7
|
* optional geo-model (lat, lon, week 1–48).
|
|
8
8
|
* - BirdNET v2.4 (TF.js Layers): the folder contains `model.json` + `labels.json`
|
|
9
|
+
* (a TF.js graph model with the same input and output works too, e.g. AnuraPAM;
|
|
10
|
+
* it must run with synchronous predict(), i.e. contain no control-flow ops)
|
|
9
11
|
* and optionally the area model in `mdata/`. 48 kHz, 3 s windows.
|
|
10
12
|
*
|
|
11
13
|
* Runtimes (TF.js / onnxruntime-web) are loaded from CDN at runtime (vendored in Lite).
|
|
@@ -18,6 +20,7 @@
|
|
|
18
20
|
export declare const BIRDNET_MODEL_URL = "https://limitlessgreen.github.io/SignaVis/models/birdnet-v3.0/";
|
|
19
21
|
/** Legacy BirdNET v2.4 TF.js model on the GitHub Pages demo site. */
|
|
20
22
|
export declare const BIRDNET_V24_MODEL_URL = "https://limitlessgreen.github.io/SignaVis/models/birdnet-v2.4/";
|
|
23
|
+
export declare function resampleTo(channelData: Float32Array | number[], sourceSampleRate: number, TARGET_SR: number): Promise<Float32Array>;
|
|
21
24
|
export declare class BirdNETInference {
|
|
22
25
|
#private;
|
|
23
26
|
date: any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/** Like the BirdNET presets: relative to the demo page in the browser, the data protocol in Lite. */
|
|
2
|
+
export declare const BIRDBOX_MODEL_URL: string;
|
|
3
|
+
/** The run's confidence: the lowest the slider allows; fusion filters above it. */
|
|
4
|
+
export declare const BIRDBOX_RAW_CONF = 0.05;
|
|
5
|
+
export interface BirdBoxModelConfig {
|
|
6
|
+
name: string;
|
|
7
|
+
license: string;
|
|
8
|
+
defaultConf: number;
|
|
9
|
+
defaultPhraseGap: number;
|
|
10
|
+
classNames: Record<string, string>;
|
|
11
|
+
[key: string]: unknown;
|
|
12
|
+
}
|
|
13
|
+
/** Raw rows collected so far; `next` is the next window (its start: next × 1.5 s). */
|
|
14
|
+
export interface RawRows {
|
|
15
|
+
data: Float32Array;
|
|
16
|
+
rows: number;
|
|
17
|
+
next: number;
|
|
18
|
+
/** Seconds up to which every window that owns a box has been seen. */
|
|
19
|
+
analyzedTo: number;
|
|
20
|
+
done: boolean;
|
|
21
|
+
}
|
|
22
|
+
/** Earliest start of a box in rows still to come (fuseBoxes' `later`). */
|
|
23
|
+
export declare const laterOf: (raw: RawRows) => number;
|
|
24
|
+
declare class RowStore {
|
|
25
|
+
data: Float32Array<ArrayBuffer>;
|
|
26
|
+
rows: number;
|
|
27
|
+
append(chunk: Float32Array, rows: number): void;
|
|
28
|
+
}
|
|
29
|
+
export interface DetectOptions {
|
|
30
|
+
/** Called after every chunk of windows (feed it to a Pacer for even display). */
|
|
31
|
+
onRows?: (raw: RawRows) => void;
|
|
32
|
+
signal?: AbortSignal;
|
|
33
|
+
/** Windows per network run (1 = boxes appear soonest). */
|
|
34
|
+
step?: number;
|
|
35
|
+
/** Stop before this window (with detect's `from`: only a stretch of the recording). */
|
|
36
|
+
to?: number;
|
|
37
|
+
}
|
|
38
|
+
export declare class BirdBoxDetector {
|
|
39
|
+
private worker;
|
|
40
|
+
private nextId;
|
|
41
|
+
/** Requests in progress; each settles on its messages, or fails with the worker. */
|
|
42
|
+
private ops;
|
|
43
|
+
private ready;
|
|
44
|
+
private failLoad;
|
|
45
|
+
config: BirdBoxModelConfig | null;
|
|
46
|
+
/** Load the model into a worker (once). */
|
|
47
|
+
load(modelUrl?: string): Promise<BirdBoxModelConfig>;
|
|
48
|
+
/**
|
|
49
|
+
* Raw rows of a whole recording (32 kHz mono). With `from`, continues a run whose
|
|
50
|
+
* first `from` windows are in `store` (used when a live recording ends).
|
|
51
|
+
*/
|
|
52
|
+
detect(pcm: Float32Array, opts?: DetectOptions, from?: number, store?: RowStore): Promise<RawRows>;
|
|
53
|
+
/**
|
|
54
|
+
* A recording in progress. push() 32 kHz mono audio as it arrives; rows of every
|
|
55
|
+
* window are final as soon as the audio reaches its end. stop() runs the last
|
|
56
|
+
* windows as in the saved file and resolves with all rows (file end set). A failure
|
|
57
|
+
* of the detection is passed to `onError` and makes stop() reject.
|
|
58
|
+
*/
|
|
59
|
+
startLive(onRows?: (raw: RawRows) => void, onError?: (err: Error) => void): Promise<{
|
|
60
|
+
push: (pcm: Float32Array) => void;
|
|
61
|
+
/** The recording so far (32 kHz mono); kept for saving it and for stop(). */
|
|
62
|
+
readonly audio: Float32Array<ArrayBuffer>;
|
|
63
|
+
stop: (opts?: DetectOptions) => Promise<RawRows>;
|
|
64
|
+
}>;
|
|
65
|
+
/** Fail the load (if pending) and every request in progress. */
|
|
66
|
+
private failAll;
|
|
67
|
+
dispose(): void;
|
|
68
|
+
}
|
|
69
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { type SampleSource } from '../../domain/detector/birdboxStream.ts';
|
|
2
|
+
type Ort = any;
|
|
3
|
+
export interface BirdBoxConfig {
|
|
4
|
+
floorWindowSeconds: number;
|
|
5
|
+
frameOrigin: number;
|
|
6
|
+
}
|
|
7
|
+
export interface RowsChunk {
|
|
8
|
+
/** Raw rows, 9 columns each (see domain/detector/fusion.ts). */
|
|
9
|
+
data: Float32Array;
|
|
10
|
+
rows: number;
|
|
11
|
+
/** Windows done; a run given it as `from` continues there. */
|
|
12
|
+
next: number;
|
|
13
|
+
analyzedTo?: number;
|
|
14
|
+
}
|
|
15
|
+
export declare class BirdBoxGraph {
|
|
16
|
+
private readonly ort;
|
|
17
|
+
private readonly spectrogram;
|
|
18
|
+
private readonly detect;
|
|
19
|
+
private readonly grid;
|
|
20
|
+
private constructor();
|
|
21
|
+
static create(ort: Ort, models: {
|
|
22
|
+
spectrogram: Uint8Array | ArrayBuffer;
|
|
23
|
+
detect: Uint8Array | ArrayBuffer;
|
|
24
|
+
}, options: object, config: BirdBoxConfig): Promise<BirdBoxGraph>;
|
|
25
|
+
/**
|
|
26
|
+
* Compute frames up to `upTo` from the first n samples the graph sees (silence after the
|
|
27
|
+
* source's end), `block` frames at most per run. Afterwards the source may let go of the
|
|
28
|
+
* samples before the next frame.
|
|
29
|
+
*/
|
|
30
|
+
private frames;
|
|
31
|
+
/** Raw rows of windows w0 .. w0+count-1 (column 0 and 8 not yet set, see finishRows). */
|
|
32
|
+
private detectWindows;
|
|
33
|
+
/**
|
|
34
|
+
* A whole recording: yields rows after every `step` windows.
|
|
35
|
+
* @param samples mono audio at 32 kHz, or a source of it (BlockSource in a worker)
|
|
36
|
+
* @param conf run at the lowest confidence the sliders allow; fusion filters above it
|
|
37
|
+
* @param from windows already done
|
|
38
|
+
* @param to stop before this window (a stretch of the recording; its rows equal the whole run's)
|
|
39
|
+
*/
|
|
40
|
+
run(samples: Float32Array | SampleSource, conf: number, step: number, from?: number, to?: number): AsyncGenerator<RowsChunk>;
|
|
41
|
+
/**
|
|
42
|
+
* A recording in progress: push() its audio as it arrives, windows() gives the final
|
|
43
|
+
* rows of the next windows once they are ready (readyWindows of the samples pushed),
|
|
44
|
+
* with the file end (column 8) NO_END. Only new audio is turned into frames.
|
|
45
|
+
*/
|
|
46
|
+
live(): {
|
|
47
|
+
readonly length: number;
|
|
48
|
+
readonly ready: number;
|
|
49
|
+
push(pcm: Float32Array): void;
|
|
50
|
+
windows(conf: number, from: number, count: number): Promise<RowsChunk>;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -25,5 +25,11 @@ export declare function installExternalLinkHandler(): void;
|
|
|
25
25
|
* Outside Lite, `browserUrl` is returned unchanged.
|
|
26
26
|
*/
|
|
27
27
|
export declare function onDemandUrl(sitePath: string, browserUrl: string): string;
|
|
28
|
-
/**
|
|
29
|
-
export declare const
|
|
28
|
+
/** 480x320 WebP thumbnails served by the BirdNET taxonomy API. */
|
|
29
|
+
export declare const SPECIES_IMAGE_API = "https://birdnet.cornell.edu/taxonomy/api/image/";
|
|
30
|
+
/**
|
|
31
|
+
* URL of a species thumbnail. The web app loads it from the BirdNET taxonomy;
|
|
32
|
+
* Lite goes through its data cache, which fetches it there once and keeps it
|
|
33
|
+
* for offline use (src-tauri-lite/src/data_cache.rs).
|
|
34
|
+
*/
|
|
35
|
+
export declare function speciesImageUrl(scientificName: string): string;
|
|
@@ -56,6 +56,8 @@ export declare function buildAnnotaAnnotation(l: any, ctx: {
|
|
|
56
56
|
index?: number;
|
|
57
57
|
}): any;
|
|
58
58
|
/** Build an Annota-JSON Fv0 set payload. Labels without start/end are skipped. */
|
|
59
|
+
/** Labels the payload carries: those with a start and an end (others are left out). */
|
|
60
|
+
export declare function isAnnotaLabel(l: any): boolean;
|
|
59
61
|
export declare function buildAnnotaPayload(opts: AnnotaBuildOptions): {
|
|
60
62
|
set_source: string;
|
|
61
63
|
set_uri: string;
|
|
@@ -9,7 +9,8 @@ export declare const SEEK_FINE_SEC = 0.5;
|
|
|
9
9
|
export declare const SEEK_COARSE_SEC = 5;
|
|
10
10
|
export declare const SPECTROGRAM_HEIGHT = 160;
|
|
11
11
|
export declare const MAX_BASE_SPECTROGRAM_WIDTH = 24000;
|
|
12
|
-
|
|
12
|
+
/** Shortest overview window (seconds), whatever the recording length. */
|
|
13
|
+
export declare const MIN_WINDOW_SECONDS = 0.05;
|
|
13
14
|
export declare const WASM_TILE_MIN_DURATION_SEC: number;
|
|
14
15
|
export declare const WASM_PYRAMID_BLOCK_FRAMES = 6000;
|
|
15
16
|
export declare const PERCH_FRAME_RATE = 100;
|
|
@@ -117,6 +117,8 @@ export interface SpeciesBarItem {
|
|
|
117
117
|
name: string;
|
|
118
118
|
color: string;
|
|
119
119
|
scientificName: string;
|
|
120
|
+
/** Template tags; `name` is '' for a tags-only template. */
|
|
121
|
+
tags?: Record<string, string>;
|
|
120
122
|
}
|
|
121
123
|
export interface SpeciesBarChangeDetail {
|
|
122
124
|
selection: SpeciesBarItem | null;
|
|
@@ -10,6 +10,8 @@ export interface LabelEditResult {
|
|
|
10
10
|
scientificName: string;
|
|
11
11
|
tags: Record<string, string>;
|
|
12
12
|
changed: LabelEditChangeset;
|
|
13
|
+
/** "Keep for next labels" was ticked (only offered with `offerTemplate`). */
|
|
14
|
+
keepAsTemplate: boolean;
|
|
13
15
|
}
|
|
14
16
|
export declare class LabelEditorModal {
|
|
15
17
|
_player: any;
|
|
@@ -19,6 +21,8 @@ export declare class LabelEditorModal {
|
|
|
19
21
|
_title: any;
|
|
20
22
|
_existingLabels: any;
|
|
21
23
|
_onLayerEmit: any;
|
|
24
|
+
_offerTemplate: boolean;
|
|
25
|
+
_templateCheck: HTMLInputElement | null;
|
|
22
26
|
_initialValueTrim: any;
|
|
23
27
|
_initialStyleHex: any;
|
|
24
28
|
hex: any;
|
|
@@ -57,11 +61,13 @@ export declare class LabelEditorModal {
|
|
|
57
61
|
* @param {string | null} [opts.title]
|
|
58
62
|
* @param {Function} opts.onSubmit
|
|
59
63
|
* @param {Function | null} [opts.onDelete]
|
|
64
|
+
* @param {boolean} [opts.offerTemplate] - show "Keep for next labels" (result.keepAsTemplate)
|
|
60
65
|
* @param {((event: string, detail: object) => void) | null} [opts.onLayerEmit]
|
|
61
66
|
* Optional emit callback for layer-originating events (tagcustom*).
|
|
62
67
|
* When omitted, these events are silently dropped (no player dependency needed).
|
|
63
68
|
*/
|
|
64
|
-
constructor({ player, anchorEl, initialValue, initialColor, initialTags, existingLabels, initialScientificName, title, onSubmit, onDelete, onLayerEmit }: {
|
|
69
|
+
constructor({ player, anchorEl, initialValue, initialColor, initialTags, existingLabels, initialScientificName, title, onSubmit, onDelete, onLayerEmit, offerTemplate }: {
|
|
70
|
+
offerTemplate?: boolean;
|
|
65
71
|
player: any;
|
|
66
72
|
anchorEl?: any;
|
|
67
73
|
initialValue?: any;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface TagPreset {
|
|
2
|
+
key: string;
|
|
3
|
+
label?: string;
|
|
4
|
+
options: string[];
|
|
5
|
+
}
|
|
6
|
+
export interface TemplateTagsOptions {
|
|
7
|
+
getPresets: () => TagPreset[];
|
|
8
|
+
getTags: () => Record<string, string>;
|
|
9
|
+
onChange: (tags: Record<string, string>) => void;
|
|
10
|
+
}
|
|
11
|
+
/** Chip text: the tag values in preset order, then custom ones. */
|
|
12
|
+
export declare function templateTagsSummary(tags: Record<string, string>, presets: TagPreset[]): string;
|
|
13
|
+
export declare function createTemplateTags({ getPresets, getTags, onChange }: TemplateTagsOptions): {
|
|
14
|
+
el: HTMLButtonElement;
|
|
15
|
+
refresh: () => void;
|
|
16
|
+
close: () => void;
|
|
17
|
+
destroy(): void;
|
|
18
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface OnboardingProfile {
|
|
2
|
+
name: string;
|
|
3
|
+
xcUsername: string;
|
|
4
|
+
owner: string;
|
|
5
|
+
license: string;
|
|
6
|
+
update(u: Record<string, unknown>): void;
|
|
7
|
+
}
|
|
8
|
+
export interface OnboardingOptions {
|
|
9
|
+
profile: OnboardingProfile;
|
|
10
|
+
licenses: string[];
|
|
11
|
+
getApiKey: () => string;
|
|
12
|
+
saveApiKey: (key: string) => void;
|
|
13
|
+
/** Offer the project-folder step (web with File System Access only). */
|
|
14
|
+
storage?: {
|
|
15
|
+
recentName?: string | null;
|
|
16
|
+
} | null;
|
|
17
|
+
}
|
|
18
|
+
export interface OnboardingResult {
|
|
19
|
+
completed: boolean;
|
|
20
|
+
storage: 'folder' | 'browser' | null;
|
|
21
|
+
}
|
|
22
|
+
export declare function openOnboardingWizard(opts: OnboardingOptions): Promise<OnboardingResult>;
|
|
@@ -10,7 +10,12 @@ export interface OverviewHost {
|
|
|
10
10
|
};
|
|
11
11
|
blockOverviewClicks(ms: number): void;
|
|
12
12
|
};
|
|
13
|
-
_startOverviewDrag(side: 'left' | 'right' | 'move', x: number): void;
|
|
13
|
+
_startOverviewDrag(side: 'left' | 'right' | 'move', x: number, scale?: number): void;
|
|
14
|
+
readonly _viewport: {
|
|
15
|
+
lensActive: boolean;
|
|
16
|
+
lensStartNorm: number;
|
|
17
|
+
lensEndNorm: number;
|
|
18
|
+
};
|
|
14
19
|
_queueOverviewViewportApply(final: boolean): void;
|
|
15
20
|
_seekToTime(t: number, ui: boolean): void;
|
|
16
21
|
_toggleOverviewLabelSection(): void;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export interface GroupItem {
|
|
2
|
+
size: number;
|
|
3
|
+
}
|
|
4
|
+
export interface GroupReviewHandlers {
|
|
5
|
+
onShow: (index: number) => void;
|
|
6
|
+
onPlay: (index: number) => void;
|
|
7
|
+
onName: (index: number) => void;
|
|
8
|
+
onRegroup: (cut: number) => void;
|
|
9
|
+
onClose?: () => void;
|
|
10
|
+
anchor?: () => DOMRect | null;
|
|
11
|
+
}
|
|
12
|
+
export declare class GroupReview {
|
|
13
|
+
private readonly h;
|
|
14
|
+
private el;
|
|
15
|
+
private groups;
|
|
16
|
+
private done;
|
|
17
|
+
private pos;
|
|
18
|
+
private cut;
|
|
19
|
+
private suspended;
|
|
20
|
+
private readonly onKey;
|
|
21
|
+
private readonly onResize;
|
|
22
|
+
constructor(h: GroupReviewHandlers);
|
|
23
|
+
get isOpen(): boolean;
|
|
24
|
+
get index(): number;
|
|
25
|
+
/** Open (or refill after re-grouping) with groups largest first. */
|
|
26
|
+
open(groups: GroupItem[], cut: number): void;
|
|
27
|
+
close(): void;
|
|
28
|
+
/** Hide while the members are reviewed. */
|
|
29
|
+
suspend(): void;
|
|
30
|
+
/** Back after the member review; `named` marks the group done and moves on. */
|
|
31
|
+
resume(named: boolean): void;
|
|
32
|
+
private open_;
|
|
33
|
+
/** Next / previous open group; closes when none is left. */
|
|
34
|
+
private step;
|
|
35
|
+
private show;
|
|
36
|
+
private handleKey;
|
|
37
|
+
private build;
|
|
38
|
+
private place;
|
|
39
|
+
private render;
|
|
40
|
+
}
|