ScottishHaze commited on
Commit
cffc479
·
verified ·
1 Parent(s): 97f6721

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +44 -79
README.md CHANGED
@@ -1,38 +1,30 @@
1
- ---
2
- license: cc-by-nc-sa-4.0
3
- language:
4
- - en
5
- pretty_name: r
6
- ---
7
- # Speaker Diarization and Identification Toolkit
8
 
9
- Welcome to the **Speaker Diarization and Identification Toolkit**, a suite of tools for audio processing and speaker analysis. This repository offers user-friendly Python scripts for extracting audio, performing speaker diarization, and interactively identifying specific speakers from multi-speaker recordings.
10
 
11
  ---
12
 
13
- ## 🌟 Features
14
 
15
- - **Speaker Diarization**: Automatically segment and label audio by speaker using the Hugging Face `pyannote.audio` pipeline.
16
- - **Audio Extraction**: Seamlessly extract audio tracks from video files and convert them to WAV format.
17
- - **Speaker Identification**: Interactively map speakers in multi-speaker environments using diarization data and audio playback.
18
- - **Rich User Interface**: Leveraging the `rich` library for visually appealing and intuitive prompts, error messages, and feedback.
19
 
20
  ---
21
 
22
- ## 🔧 Requirements
23
-
24
- To get started, ensure you have the following:
25
 
26
- - **Python**: Version 3.8 or later.
27
- - **Hugging Face Token**: A personal access token to use the `pyannote.audio` pipeline.
28
- - **System Tools**: `ffmpeg` installed on your system.
29
- - **Python Libraries**:
30
  - `rich`
31
  - `pandas`
32
  - `pyannote.audio`
33
  - `playsound`
34
 
35
- Install all dependencies with:
36
 
37
  ```bash
38
  pip install -r requirements.txt
@@ -40,57 +32,36 @@ pip install -r requirements.txt
40
 
41
  ---
42
 
43
- ## 🚀 Setup
44
-
45
- ### Step 1: Clone the Repository
46
-
47
- Clone this repository to your local machine:
48
-
49
- ```bash
50
- git clone https://huggingface.co/datasets/ScottishHaze/diarization-project
51
- cd diarization-project
52
- ```
53
-
54
- ### Step 2: Configure the Environment
55
-
56
- 1. **Install `ffmpeg`**:
57
- - **Linux**: `sudo apt install ffmpeg`
58
- - **MacOS**: `brew install ffmpeg`
59
- - **Windows**: Download from [ffmpeg.org](https://ffmpeg.org/).
60
-
61
- 2. **Set Up a Hugging Face Token**:
62
- - Create an account at [huggingface.co](https://huggingface.co/).
63
- - Generate a token from your account settings.
64
 
65
- 3. **Environment Configuration**:
66
- - Create an `.env` file in the project root and add:
67
-
68
- ```env
69
- HF_TOKEN=your_hugging_face_token
70
- ```
71
-
72
- ### Step 3: Organize Files
73
-
74
- Use the following directory structure or customize paths interactively when running the scripts:
75
 
76
  ```plaintext
77
  project/
78
- ├── diarization # JSON files will go here
79
- ├── extracted-audio # WAV files will go here
80
- ├── scripts
 
 
 
 
81
  │ ├── ffmpeg-extract-audio-from-video.py
82
  │ ├── diarization-extract-speaker-info-from-wav.py
83
- └── identify-single-speaker.py
84
- ├── miniconda # working program/dir, !!! may not appear on your system, and that's fine !!!
 
 
85
  ```
86
 
 
 
87
  ---
88
 
89
- ## 🎬 Usage
90
 
91
  ### 1. Extract Audio from Video
92
 
93
- Use `ffmpeg-extract-audio-from-video.py` to extract English audio tracks from video files:
94
 
95
  ```bash
96
  python ffmpeg-extract-audio-from-video.py
@@ -98,7 +69,7 @@ python ffmpeg-extract-audio-from-video.py
98
 
99
  ### 2. Perform Speaker Diarization
100
 
101
- Run `diarization-extract-speaker-info-from-wav.py` to analyze WAV files and generate speaker segmentation JSON files:
102
 
103
  ```bash
104
  python diarization-extract-speaker-info-from-wav.py
@@ -106,38 +77,32 @@ python diarization-extract-speaker-info-from-wav.py
106
 
107
  ### 3. Identify Target Speaker
108
 
109
- Use `identify-single-speaker.py` to interactively identify target speakers:
 
 
110
 
111
  ```bash
112
  python identify-single-speaker.py
113
  ```
114
- When doing series/multipart analysis, it is recommended you listen to a few sections before saying YES to a speaker.
115
-
116
- ---
117
 
118
- ## 🤝 Contributing
119
 
120
- Contributions are highly appreciated! To contribute:
121
 
122
- 1. Fork this repository.
123
- 2. Create a branch for your feature or bug fix.
124
- 3. Submit a pull request with a detailed description of changes.
125
 
126
  ---
127
 
128
- ## 📜 License
129
 
130
- This project is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) License. Refer to the [LICENSE](LICENSE) file for full details of the terms.
131
 
132
  ---
133
 
134
- ## 🌍 Acknowledgments
135
-
136
- Gratitude goes to:
137
 
138
- - [Hugging Face](https://huggingface.co/) for providing robust pre-trained models.
139
- - The creators of `rich`, `pyannote.audio`, and `ffmpeg` for their indispensable tools.
140
-
141
- ---
142
 
143
- Thank you for exploring this toolkit. If you encounter any issues or have suggestions, feel free to open an issue or contribute!
 
1
+ # Speaker Diarization and Identification Toolkit
 
 
 
 
 
 
2
 
3
+ Welcome to the **Speaker Diarization and Identification Toolkit**, a suite of tools for processing audio and identifying speakers. This repository offers Python scripts for extracting audio, performing speaker diarization, identifying speakers, and trimming segments of interest.
4
 
5
  ---
6
 
7
+ ## Features
8
 
9
+ - **Speaker Diarization**: Automatically segment and label audio by speaker.
10
+ - **Audio Extraction**: Extract audio tracks from video files.
11
+ - **Speaker Identification**: Interactively map speakers using diarization data.
12
+ - **Segment Trimming**: Extract and trim speaker-specific audio segments.
13
 
14
  ---
15
 
16
+ ## Requirements
 
 
17
 
18
+ - Python 3.8+
19
+ - Hugging Face token for `pyannote.audio`
20
+ - System dependency: `ffmpeg`
21
+ - Python libraries:
22
  - `rich`
23
  - `pandas`
24
  - `pyannote.audio`
25
  - `playsound`
26
 
27
+ Install dependencies with:
28
 
29
  ```bash
30
  pip install -r requirements.txt
 
32
 
33
  ---
34
 
35
+ ## Setup
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
 
37
+ ### Directory Structure
 
 
 
 
 
 
 
 
 
38
 
39
  ```plaintext
40
  project/
41
+ ├── input/
42
+ ├── video/ # Video files
43
+ ├── audio/ # WAV files from videos
44
+ ├── output/
45
+ │ ├── json/ # Diarization results
46
+ │ ├── audio/ # Cropped and trimmed speaker segments
47
+ ├── scripts/
48
  │ ├── ffmpeg-extract-audio-from-video.py
49
  │ ├── diarization-extract-speaker-info-from-wav.py
50
+ ├── identify-single-speaker.py
51
+ ├── speaker-crop-and-trim.py
52
+ ├── data/
53
+ │ └── mappings.csv # Speaker mappings
54
  ```
55
 
56
+ Ensure the directory structure matches the expected inputs and outputs for each script.
57
+
58
  ---
59
 
60
+ ## Usage
61
 
62
  ### 1. Extract Audio from Video
63
 
64
+ Run the `ffmpeg-extract-audio-from-video.py` script to extract audio tracks from video files:
65
 
66
  ```bash
67
  python ffmpeg-extract-audio-from-video.py
 
69
 
70
  ### 2. Perform Speaker Diarization
71
 
72
+ Run the `diarization-extract-speaker-info-from-wav.py` script to analyze WAV files and generate speaker segmentation JSON files:
73
 
74
  ```bash
75
  python diarization-extract-speaker-info-from-wav.py
 
77
 
78
  ### 3. Identify Target Speaker
79
 
80
+ Use the `identify-single-speaker.py` script to interactively identify and map target speakers. For multiple parts / TV series
81
+ it is recommended you listen to multiple segments of each speaker before identifying "Y". Sometimes after diarization, the targeted
82
+ speaker can be blended in with other speakers.
83
 
84
  ```bash
85
  python identify-single-speaker.py
86
  ```
 
 
 
87
 
88
+ ### 4. Crop and Trim Speaker Segments
89
 
90
+ Run the `speaker-crop-and-trim.py` script to extract, crop, and trim audio segments for identified speakers:
91
 
92
+ ```bash
93
+ python speaker-crop-and-trim.py
94
+ ```
95
 
96
  ---
97
 
98
+ ## License
99
 
100
+ This project is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0). Refer to the [LICENSE](LICENSE) file for details.
101
 
102
  ---
103
 
104
+ ## Acknowledgments
 
 
105
 
106
+ Gratitude to [Hugging Face](https://huggingface.co/) and the developers of `rich`, `pyannote.audio`, and `ffmpeg` for their invaluable tools.
 
 
 
107
 
108
+ Thank you for exploring this toolkit!