File size: 2,499 Bytes
d01bc8a
 
 
 
 
 
 
 
 
 
 
 
22a75d9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
---
title: Phonological Vector
emoji: 🚀
colorFrom: pink
colorTo: pink
sdk: gradio
sdk_version: 6.10.0
app_file: app.py
pinned: false
license: mit
---

# Phonological vector-based speech editing

Interactive demo for **[b]=[d]−[t]+[p]: Self-supervised Speech Models Discover Phonological Vector Arithmetic** ([arXiv:2602.18899](https://arxiv.org/abs/2602.18899)).

You can load an audio file, pick a time span and a learned phonological vector within WavLM representation, and hear how adding that vector changes the resynthesized audio, alongside spectrograms for before and after.

| Resource | Link |
|----------|------|
| Full codebase | [github.com/juice500ml/phonetic-arithmetic](https://github.com/juice500ml/phonetic-arithmetic) |
| Example audio / alignments | [LDC93S1](https://catalog.ldc.upenn.edu/LDC93S1W) (TIMIT single-utterance sample from LDC) |

## Phonological vectors

The UI exposes three vector families (for TIMIT and VoxAngeles):

| Preset | Idea |
|--------|------|
| **Original** | Directions from the paper’s setup. |
| **Unconstrained** | Center pooling only; no separate consonant/vowel subspaces. |
| **Extended** | Unconstrained pooling, with positive and negative poles modeled as separate vectors. |

## Run locally

From this directory (`demos/phonological-vector`):

```bash
pip install -r requirements.txt
GRADIO_TEMP_DIR=$PWD/.gradio_tmp python app.py
```

Gradio will start a local URL; paths assume the working directory is the folder that contains `examples/` and `app.py`.

## Reproducing phonological vectors

Run from the **repository root** (`phonetic-arithmetic`), after you have the feature pickles and `dump_vectors.py` wired to your data. Replace `timit` with `voxangeles` if you want the other corpus.

```bash
dataset=timit

python3 dump_vectors.py \
  --feat-path feats/timit-wavlm-large-24-featslice.pkl \
  --output-path demos/phonological-vector/examples/original-${dataset}.pkl \
  --vector-type original --vector phn

python3 dump_vectors.py \
  --feat-path feats/timit-wavlm-large-24-center-featslice.pkl \
  --output-path demos/phonological-vector/examples/unconstrained-${dataset}.pkl \
  --vector-type full --vector phn

python3 dump_vectors.py \
  --feat-path feats/timit-wavlm-large-24-center-featslice.pkl \
  --output-path demos/phonological-vector/examples/extended-${dataset}.pkl \
  --vector-type extended --vector phn
```

Feature paths above match the naming used in this project; adjust `--feat-path` if your files differ.