Skip to content

Commit c10172a

Browse files
committed
Update readme for v0.0.7
1 parent aefd78c commit c10172a

File tree

1 file changed

+36
-2
lines changed

1 file changed

+36
-2
lines changed

README.md

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,42 @@ return (
7272
|`transparent`|`boolean`|`false`|Use rgba values for spectrogram image.|
7373
|`dark`|`boolean`|`false`|Use dark mode theme.|
7474

75+
### Annotations
76+
77+
You can annotate intervals (e.g. words or phones) below the spectrogram.
78+
79+
1. First create your annotations as a `(string | number)[][]` object.
80+
- Column 1: Start time in seconds
81+
- Column 2: End time in seconds
82+
- Column 3: Annotation as a string
83+
84+
```js
85+
const word_intervals = [
86+
[0.54, 0.84, "this"],
87+
[0.84, 1.1, "little"],
88+
[ 1.1, 1.4, "work"],
89+
...
90+
]
91+
```
92+
93+
2. Pass the annotations object to the `annotations` prop.
94+
95+
Note: You can use the `annotations2` prop for an additional set of annotations. For example if you want to display both words and phones.
96+
97+
```jsx
98+
return (
99+
<SpectrogramPlayer
100+
src={src}
101+
sxx={sxx}
102+
specHeight={200}
103+
navHeight={50}
104+
annotations={word_intervals}
105+
annotations2={phone_intervals}
106+
/>
107+
)
108+
```
109+
75110
## Future Updates
76111

77112
- Calculate spectrogram with javascript when no `sxx` prop is supplied.
78-
- Better touch screen compatibility.
79-
- Develop Jupyter widget using this component.
113+
- Better touch screen compatibility.

0 commit comments

Comments
 (0)