zaibihassan commited on
Commit
74a3447
Β·
verified Β·
1 Parent(s): add8e69

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +114 -111
README.md CHANGED
@@ -28,132 +28,109 @@ tags:
28
  <p align="center">
29
  <img src="https://img.shields.io/badge/Audio%20Format-Opus%20(16kHz,%2032kbps)-emerald?style=for-the-badge&logo=opus" alt="Opus Format">
30
  <img src="https://img.shields.io/badge/Total%20Reciters-34-blue?style=for-the-badge" alt="Total Reciters">
31
- <img src="https://img.shields.io/badge/Data%20Formats-JSON%20%7C%20Protobuf-violet?style=for-the-badge" alt="Formats">
32
- <img src="https://img.shields.io/badge/License-Apache%202.0-orange?style=for-the-badge" alt="License">
 
33
  </p>
34
 
35
  ---
36
 
37
  ## 🌟 Overview
38
 
39
- **Quranic Recitation Dataset (Word-by-Word Sync)** is a highly optimized, production-ready dataset containing high-quality audio recitations of the Holy Quran synchronized perfectly at the **word-by-word** level.
40
 
41
- This dataset features **34 world-renowned reciters**, with every single Surah (114 chapters) mapped precisely to millisecond-accurate word timestamps. It is designed to empower developers and researchers building modern Islamic mobile and web applications, offering exceptional performance, tiny file footprints, and beautiful visual alignment possibilities.
42
 
43
  ---
44
 
45
  ## πŸš€ Key Features
46
 
47
- * **Massive Scope**: Includes **34 distinct reciters** covering all 114 Surahs each, totaling **3,876 unique audio files** and timing map pairs.
48
- * **Highly Optimized Audio**: All audio is converted to **mono-channel, 16000Hz, 32kbps `.opus`** format. This ensures exceptional vocal clarity while remaining ultra-lightweight for low-bandwidth mobile and web streaming.
49
- * **Dual-Format Timestamps**:
50
- * **`.json`**: Standard, easy-to-parse nested JSON timing data.
51
- * **`.pb` (Protocol Buffers)**: A **33% smaller**, binary-encoded format ideal for high-performance applications with strict memory and bandwidth constraints.
52
- * **Word-Level Accuracy**: Timestamps map directly to standard Uthmani script word indices (both 0-based and 1-based arrays), allowing for beautiful karaoke-style highlighting in apps.
53
 
54
  ---
55
 
56
- ## πŸ“‘ CDN Implementation (Cloudflare)
57
 
58
- This dataset is designed for **instant, scalable fetching over a globally distributed CDN** without needing to download the entire 17GB repository locally.
59
 
60
- You can use Hugging Face's Cloudflare CDN to fetch `.opus` audio and `.pb` / `.json` timing data directly into your frontend or mobile app.
61
-
62
- ### Fetching a File via CDN URL
63
- Format your endpoint URL as follows:
64
- ```text
65
- https://huggingface.co/datasets/zaibihassan/Quranic-Recitation-Data/resolve/main/{Reciter Name}/{Surah Number}/{File}
66
  ```
67
 
68
- > [!NOTE]
69
- > Ensure folder names and reciter names are URL-encoded in your request (e.g. spaces replaced with `%20`).
70
-
71
- ### πŸ’» Code Examples
72
 
73
- <details>
74
- <summary><b>1. Loading Protobuf Timings in JavaScript</b></summary>
 
 
75
 
76
- ```javascript
77
- // Example: Fetching Alijon Qari's Surah Al-Fatihah timings
78
- const cdnUrl = "https://huggingface.co/datasets/zaibihassan/Quranic-Recitation-Data/resolve/main/Alijon%20Qari/001/001.pb";
79
 
80
- async function loadRecitationTimings() {
81
- const response = await fetch(cdnUrl);
82
- const arrayBuffer = await response.arrayBuffer();
83
- const uint8Array = new Uint8Array(arrayBuffer);
84
-
85
- // Decode the binary payload using protobuf.js
86
- const message = SurahTimestamps.decode(uint8Array);
87
- const timingData = SurahTimestamps.toObject(message);
88
-
89
- console.log("Loaded High-Performance Timings:", timingData);
90
- }
91
  ```
92
- </details>
93
-
94
- <details>
95
- <summary><b>2. Streaming Audio Natively in HTML</b></summary>
96
 
97
- ```html
98
- <!-- Example: Streaming highly optimized Opus audio -->
99
- <audio controls>
100
- <source src="https://huggingface.co/datasets/zaibihassan/Quranic-Recitation-Data/resolve/main/Alijon%20Qari/001/001.opus" type="audio/ogg; codecs=opus">
101
- </audio>
 
 
 
 
 
 
102
  ```
103
- </details>
 
 
 
104
 
105
  ---
106
 
107
  ## πŸ“‚ Dataset Structure
108
 
109
- The dataset is organized hierarchically by **Reciter Name** $\rightarrow$ **Surah Number (001-114)**.
110
 
111
- Inside each Surah folder, you will find three standard files:
112
- 1. `[SurahNumber].opus` - The highly compressed audio file.
113
- 2. `[SurahNumber].json` - The human-readable timestamp mappings.
114
- 3. `[SurahNumber].pb` - The binary Protocol Buffer timestamp mappings.
115
 
116
- ```text
117
  Quranic-Recitation-Data/
118
  β”œβ”€β”€ Abdul Basit Abdul Samad (Mujawwad – Hafs)/
119
  β”‚ β”œβ”€β”€ 001/
120
- β”‚ β”‚ β”œβ”€β”€ 001.opus
121
- β”‚ β”‚ β”œβ”€β”€ 001.json
122
- β”‚ β”‚ └── 001.pb
123
  β”‚ β”œβ”€β”€ 002/
124
- β”‚ ...
125
- β”œβ”€β”€ Alijon Qari/
 
126
  β”œβ”€β”€ Mishari Rashid Al Afasy (Murattal – Hafs)/
127
- ...
 
128
  ```
129
 
130
  ---
131
 
132
- ## ⏱️ Timing Data Schema
133
-
134
- The timing data maps a specific Verse (Ayah) ID to an array of word segments.
135
- Each segment contains 4 values:
136
- 1. `word_index_0_based`: The word index starting from 0.
137
- 2. `word_index_1_based`: The word index starting from 1.
138
- 3. `timestamp_from`: The start time of the word in milliseconds.
139
- 4. `timestamp_to`: The end time of the word in milliseconds.
140
-
141
- ### JSON Example (`001.json`):
142
- ```json
143
- {
144
- "1:1": {
145
- "segments": [
146
- [0, 1, 9410, 10050],
147
- [1, 2, 10130, 11030],
148
- [2, 3, 11070, 12580],
149
- [3, 4, 12660, 15360]
150
- ]
151
- }
152
- }
153
- ```
154
 
155
- ### Protocol Buffer Schema (`recitation.proto`):
156
- For strict typing and parsing of the `.pb` files natively inside your application, compile or load the following schema:
 
157
  ```protobuf
158
  syntax = "proto3";
159
  package recitation;
@@ -161,8 +138,8 @@ package recitation;
161
  message WordSegment {
162
  int32 word_index_0_based = 1;
163
  int32 word_index_1_based = 2;
164
- int32 timestamp_from = 3;
165
- int32 timestamp_to = 4;
166
  }
167
 
168
  message VerseSegments {
@@ -170,35 +147,61 @@ message VerseSegments {
170
  }
171
 
172
  message SurahTimestamps {
173
- map<string, VerseSegments> verses = 1;
174
  }
175
  ```
176
 
 
 
 
 
 
 
 
 
 
177
  ---
178
 
179
- ## πŸŽ™οΈ Included Reciters
180
-
181
- This dataset encompasses a diverse range of recitation styles (Murattal, Mujawwad) from 34 prominent reciters:
182
-
183
- | # | Reciter Name & Style | # | Reciter Name & Style |
184
- |---|---|---|---|
185
- | 1 | Abdul Basit Abdul Samad (Mujawwad – Hafs) | 18 | Maher Al Muaiqly (Murattal – Hafs) |
186
- | 2 | Abdul Basit Abdul Samad (Murattal – Hafs) | 19 | Mahmoud Khalil Al Husary (Mujawwad – Hafs) |
187
- | 3 | Abdul Rahman Al Sudais (Murattal – Hafs) | 20 | Mahmoud Khalil Al Husary (Murattal – Hafs) |
188
- | 4 | Abdullah Hamad Abu Sharida | 21 | Mahmoud Khalil Al Husary (Murattal – Hafs – V2) |
189
- | 5 | Abu Bakr Al Shatri (Murattal – Hafs) | 22 | Mishari Rashid Al Afasy (Murattal – Hafs) |
190
- | 6 | Ahmed ibn Ali Al Ajmy | 23 | Mohamed Al Tablawi (Murattal – Hafs) |
191
- | 7 | Alijon Qari | 24 | Muhammad Al Luhaidan |
192
- | 8 | Alnufais | 25 | Muhammad Siddiq Al Minshawi (Kids) |
193
- | 9 | Alzain Mohammad Ahmad | 26 | Muhammad Siddiq Al Minshawi (Murattal – Hafs) |
194
- | 10 | Ayman Suwaid (Muallim) | 27 | Nabil Ar Rifai |
195
- | 11 | Badr Al Turki | 28 | Noreen Siddiq (Duri β€˜an Abu Amr) |
196
- | 12 | Bandar Baleela | 29 | Raad Mohammad Al Kurdi |
197
- | 13 | Fatih Seferagic | 30 | Saad Al Ghamdi (Murattal – Hafs) |
198
- | 14 | Hani Ar Rifai (Murattal – Hafs) | 31 | Saud Al Shuraim (Murattal – Hafs) |
199
- | 15 | Idris Abkar | 32 | Surah Recitation – Hady Toure |
200
- | 16 | Khalid Al Jalil (Murattal – Hafs) | 33 | Tawfeeq bin Saeed As Sawaaigh |
201
- | 17 | Khalifa Al Tunaiji (Murattal – Hafs) | 34 | Yasser Al Dosari (Murattal – Hafs) |
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
 
203
  ---
204
 
@@ -206,7 +209,7 @@ This dataset encompasses a diverse range of recitation styles (Murattal, Mujawwa
206
 
207
  **License:** `Apache-2.0`
208
 
209
- This dataset is completely free and open-source for personal, educational, and commercial projects under the **Apache License 2.0**. You are highly encouraged to integrate this directly into mobile apps (Flutter, React Native, iOS, Android) and web platforms without any restrictive encumbrances.
210
 
211
  **Attribution:**
212
  While not strictly required by the license, we appreciate attribution linking back to this dataset to support the ongoing development of open-source Islamic infrastructure.
 
28
  <p align="center">
29
  <img src="https://img.shields.io/badge/Audio%20Format-Opus%20(16kHz,%2032kbps)-emerald?style=for-the-badge&logo=opus" alt="Opus Format">
30
  <img src="https://img.shields.io/badge/Total%20Reciters-34-blue?style=for-the-badge" alt="Total Reciters">
31
+ <img src="https://img.shields.io/badge/Timing%20Format-Protocol%20Buffers-violet?style=for-the-badge" alt="Protobuf">
32
+ <img src="https://img.shields.io/badge/CDN-Cloudflare%20Edge-orange?style=for-the-badge&logo=cloudflare" alt="Cloudflare CDN">
33
+ <img src="https://img.shields.io/badge/License-Apache%202.0-green?style=for-the-badge" alt="License">
34
  </p>
35
 
36
  ---
37
 
38
  ## 🌟 Overview
39
 
40
+ **Quranic Recitation Dataset (Word-by-Word Sync)** is a highly optimized, production-ready dataset containing high-quality audio recitations of the Holy Quran synchronized at the **word-by-word** level.
41
 
42
+ This dataset features **34 world-renowned reciters**, with every Surah (114 chapters) mapped precisely to millisecond-accurate word timestamps. It is designed for modern Islamic mobile and web applications β€” served via a **Cloudflare Edge CDN** with native range-request support for instant audio streaming and seeking.
43
 
44
  ---
45
 
46
  ## πŸš€ Key Features
47
 
48
+ * **34 Reciters Γ— 114 Surahs** β€” totaling **3,876 audio files** with matching timing data.
49
+ * **Optimized Audio** β€” Mono-channel, 16kHz, 32kbps `.opus` format. Exceptional clarity at ultra-low bandwidth.
50
+ * **Per-Surah Architecture** β€” Each surah is a single `.opus` file. Seek to any ayah using the timing data β€” no need to download individual ayah files.
51
+ * **Protocol Buffer Timing** β€” Binary `.pb` timing files are ~33% smaller than JSON and parse instantly in any language.
52
+ * **Cloudflare Edge CDN** β€” Files are served from `recitation-cdn.mughalistian.workers.dev` with edge caching, CORS, and native HTTP `206 Partial Content` for mobile audio seeking.
53
+ * **Word-Level Accuracy** β€” Timestamps map to standard Uthmani script word indices, enabling karaoke-style highlighting.
54
 
55
  ---
56
 
57
+ ## πŸ“‘ CDN Access
58
 
59
+ This dataset is served via a **Cloudflare Worker** that proxies HuggingFace with aggressive edge caching. You never need to download the 17GB repository locally.
60
 
61
+ ### Base URL
62
+ ```
63
+ https://recitation-cdn.mughalistian.workers.dev
 
 
 
64
  ```
65
 
66
+ ### URL Format
67
+ ```
68
+ {BASE_URL}/{slug}/{surah_number}.{opus|pb}
69
+ ```
70
 
71
+ ### Quick Examples
72
+ ```bash
73
+ # Audio β€” Mishari Rashid Al-Afasy, Surah Al-Fatihah
74
+ curl https://recitation-cdn.mughalistian.workers.dev/mishari-rashid-al-afasy-murattal-hafs/001.opus
75
 
76
+ # Timing β€” Same reciter, same surah (Protocol Buffer)
77
+ curl https://recitation-cdn.mughalistian.workers.dev/mishari-rashid-al-afasy-murattal-hafs/001.pb
 
78
 
79
+ # Range Request (for mobile seeking)
80
+ curl -H "Range: bytes=0-1024" \
81
+ https://recitation-cdn.mughalistian.workers.dev/mishari-rashid-al-afasy-murattal-hafs/001.opus
82
+ # β†’ 206 Partial Content βœ…
 
 
 
 
 
 
 
83
  ```
 
 
 
 
84
 
85
+ ### CDN Features
86
+ | Feature | Details |
87
+ |---|---|
88
+ | **Edge Caching** | `max-age=31536000, immutable` (1 year) |
89
+ | **Range Requests** | Native `206 Partial Content` support |
90
+ | **CORS** | `Access-Control-Allow-Origin: *` |
91
+ | **Stale Fallback** | `stale-if-error=604800` (7 days) |
92
+ | **Fallback Origin** | Direct HuggingFace if CDN cache misses |
93
+
94
+ ### Direct HuggingFace Fallback
95
+ If the CDN is unavailable, you can fetch directly from HuggingFace:
96
  ```
97
+ https://huggingface.co/datasets/zaibihassan/Quranic-Recitation-Data/resolve/main/{Folder Name}/{Surah}/{File}
98
+ ```
99
+
100
+ > **Note:** Folder names on HuggingFace contain spaces and special characters (e.g., `Mishari Rashid Al Afasy (Murattal – Hafs)`). The CDN slug mapping handles this automatically.
101
 
102
  ---
103
 
104
  ## πŸ“‚ Dataset Structure
105
 
106
+ The dataset is organized by **Reciter Folder** β†’ **Surah Number (001–114)**.
107
 
108
+ Each surah folder contains two files:
109
+ 1. `{surah}.opus` β€” Per-surah audio file (full surah in one file)
110
+ 2. `{surah}.pb` β€” Protocol Buffer word-by-word timing data
 
111
 
112
+ ```
113
  Quranic-Recitation-Data/
114
  β”œβ”€β”€ Abdul Basit Abdul Samad (Mujawwad – Hafs)/
115
  β”‚ β”œβ”€β”€ 001/
116
+ β”‚ β”‚ β”œβ”€β”€ 001.opus (Full Surah Al-Fatihah audio)
117
+ β”‚ β”‚ └── 001.pb (Word timestamps for all ayahs)
 
118
  β”‚ β”œβ”€β”€ 002/
119
+ β”‚ β”‚ β”œβ”€β”€ 002.opus
120
+ β”‚ β”‚ └── 002.pb
121
+ β”‚ └── ...
122
  β”œβ”€β”€ Mishari Rashid Al Afasy (Murattal – Hafs)/
123
+ β”œβ”€β”€ Alijon Qari/
124
+ └── ...
125
  ```
126
 
127
  ---
128
 
129
+ ## ⏱️ Timing Data Schema (Protocol Buffers)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
 
131
+ The `.pb` timing files map every verse in a surah to word-level timestamps.
132
+
133
+ ### Protocol Buffer Schema (`recitation.proto`)
134
  ```protobuf
135
  syntax = "proto3";
136
  package recitation;
 
138
  message WordSegment {
139
  int32 word_index_0_based = 1;
140
  int32 word_index_1_based = 2;
141
+ int32 timestamp_from = 3; // milliseconds from start of surah
142
+ int32 timestamp_to = 4; // milliseconds from start of surah
143
  }
144
 
145
  message VerseSegments {
 
147
  }
148
 
149
  message SurahTimestamps {
150
+ map<string, VerseSegments> verses = 1; // key = "surah:ayah" (e.g., "1:1")
151
  }
152
  ```
153
 
154
+ ### How It Works
155
+
156
+ Each `.pb` file contains a `SurahTimestamps` message with all verses of that surah. The timestamps are **relative to the start of the surah audio file**, so you can:
157
+
158
+ 1. Load the surah `.opus` audio
159
+ 2. Decode the `.pb` timing data
160
+ 3. To play a specific ayah, seek the audio to `verses["1:3"].segments[0].timestamp_from` milliseconds
161
+ 4. Highlight words in real-time as `currentTimeMs` falls between each segment's `timestamp_from` and `timestamp_to`
162
+
163
  ---
164
 
165
+ ## πŸ”— CDN Slug Map
166
+
167
+ The CDN uses URL-friendly slugs that map to the actual folder names on HuggingFace:
168
+
169
+ | # | CDN Slug | Folder Name |
170
+ |---|---|---|
171
+ | 1 | `abdul-basit-abdul-samad-mujawwad-hafs-949` | Abdul Basit Abdul Samad (Mujawwad – Hafs) |
172
+ | 2 | `abdul-basit-abdul-samad-murattal-hafs-962` | Abdul Basit Abdul Samad (Murattal – Hafs) |
173
+ | 3 | `abdul-rahman-al-sudais-murattal-hafs` | Abdul Rahman Al Sudais (Murattal – Hafs) |
174
+ | 4 | `abdullah-hamad-abu-sharida` | Abdullah Hamad Abu Sharida |
175
+ | 5 | `abu-bakr-al-shatri-murattal-hafs` | Abu Bakr Al Shatri (Murattal – Hafs) |
176
+ | 6 | `ahmed-ibn-ali-al-ajmy` | Ahmed ibn Ali Al Ajmy |
177
+ | 7 | `alijon-qari` | Alijon Qari |
178
+ | 8 | `alnufais` | Alnufais |
179
+ | 9 | `alzain-mohammad-ahmad` | Alzain Mohammad Ahmad |
180
+ | 10 | `ayman-suwaid-muallim` | Ayman Suwaid (Muallim) |
181
+ | 11 | `badr-al-turki` | Badr Al Turki |
182
+ | 12 | `bandar-baleela` | Bandar Baleela |
183
+ | 13 | `fatih-seferagic` | Fatih Seferagic |
184
+ | 14 | `hani-ar-rifai-murattal-hafs` | Hani Ar Rifai (Murattal – Hafs) |
185
+ | 15 | `idris-abkar` | Idris Abkar |
186
+ | 16 | `khalid-al-jalil-murattal-hafs` | Khalid Al Jalil (Murattal – Hafs) |
187
+ | 17 | `khalifa-al-tunaiji-murattal-hafs` | Khalifa Al Tunaiji (Murattal – Hafs) |
188
+ | 18 | `maher-al-muaiqly-murattal-hafs` | Maher Al Muaiqly (Murattal – Hafs) |
189
+ | 19 | `mahmoud-khalil-al-husary-mujawwad-hafs` | Mahmoud Khalil Al Husary (Mujawwad – Hafs) |
190
+ | 20 | `mahmoud-khalil-al-husary-murattal-hafs` | Mahmoud Khalil Al Husary (Murattal – Hafs) |
191
+ | 21 | `mahmoud-khalil-al-husary-murattal-hafs-v2` | Mahmoud Khalil Al Husary (Murattal – Hafs – V2) |
192
+ | 22 | `mishari-rashid-al-afasy-murattal-hafs` | Mishari Rashid Al Afasy (Murattal – Hafs) |
193
+ | 23 | `mohamed-al-tablawi-murattal-hafs` | Mohamed Al Tablawi (Murattal – Hafs) |
194
+ | 24 | `muhammad-al-luhaidan` | Muhammad Al Luhaidan |
195
+ | 25 | `muhammad-siddiq-al-minshawi-kids` | Muhammad Siddiq Al Minshawi (Kids) |
196
+ | 26 | `muhammad-siddiq-al-minshawi-murattal-hafs` | Muhammad Siddiq Al Minshawi (Murattal – Hafs) |
197
+ | 27 | `nabil-ar-rifai` | Nabil Ar Rifai |
198
+ | 28 | `noreen-siddiq-duri-an-abu-amr` | Noreen Siddiq (Duri 'an Abu Amr) |
199
+ | 29 | `raad-mohammad-al-kurdi` | Raad Mohammad Al Kurdi |
200
+ | 30 | `saad-al-ghamdi-murattal-hafs` | Saad Al Ghamdi (Murattal – Hafs) |
201
+ | 31 | `saud-al-shuraim-murattal-hafs` | Saud Al Shuraim (Murattal – Hafs) |
202
+ | 32 | `surah-recitation-hady-toure` | Surah Recitation – Hady Toure |
203
+ | 33 | `tawfeeq-bin-saeed-as-sawaaigh` | Tawfeeq bin Saeed As Sawaaigh |
204
+ | 34 | `yasser-al-dosari-murattal-hafs` | Yasser Al Dosari (Murattal – Hafs) |
205
 
206
  ---
207
 
 
209
 
210
  **License:** `Apache-2.0`
211
 
212
+ This dataset is completely free and open-source for personal, educational, and commercial projects under the **Apache License 2.0**. You are encouraged to integrate this directly into mobile apps (Flutter, React Native, iOS, Android) and web platforms.
213
 
214
  **Attribution:**
215
  While not strictly required by the license, we appreciate attribution linking back to this dataset to support the ongoing development of open-source Islamic infrastructure.