Datasets:
Tasks:
Automatic Speech Recognition
Formats:
parquet
Languages:
English
Size:
1K - 10K
ArXiv:
DOI:
License:
Update README.md
Browse files
README.md
CHANGED
|
@@ -106,18 +106,29 @@ plt.show()
|
|
| 106 |
## Example: Accessing a reverberant speech file encoded to 8th-order Ambisonics
|
| 107 |
```python
|
| 108 |
from datasets import load_dataset, Audio
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
#
|
| 115 |
-
ds = ds.cast_column("audio", Audio())
|
| 116 |
-
|
| 117 |
-
#
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
```
|
| 122 |
|
| 123 |
## Example: Accessing a reverberant speech file at the microphones of a 6-channel device
|
|
|
|
| 106 |
## Example: Accessing a reverberant speech file encoded to 8th-order Ambisonics
|
| 107 |
```python
|
| 108 |
from datasets import load_dataset, Audio
|
| 109 |
+
import io, soundfile as sf
|
| 110 |
+
|
| 111 |
+
# Load dataset in streaming mode
|
| 112 |
+
ds = load_dataset("treble-technologies/Treble10-Speech", split="speech_hoa8", streaming=True)
|
| 113 |
+
|
| 114 |
+
# Disable automatic decoding (we'll do it manually)
|
| 115 |
+
ds = ds.cast_column("audio", Audio(decode=False))
|
| 116 |
+
|
| 117 |
+
# Get one sample from the iterator
|
| 118 |
+
sample = next(iter(ds))
|
| 119 |
+
|
| 120 |
+
# Fetch raw audio bytes
|
| 121 |
+
audio_bytes = sample["audio"]["bytes"]
|
| 122 |
+
|
| 123 |
+
# Some older datasets may not have "bytes", so fall back to reading from the file
|
| 124 |
+
if audio_bytes is None:
|
| 125 |
+
# Use huggingface's file object directly
|
| 126 |
+
with sample["audio"]["path"].open("rb") as f:
|
| 127 |
+
audio_bytes = f.read()
|
| 128 |
+
|
| 129 |
+
# Decode the HOA audio directly from memory
|
| 130 |
+
rir_hoa, sr = sf.read(io.BytesIO(audio_bytes))
|
| 131 |
+
print(f"Loaded HOA audio: shape={rir_hoa.shape}, sr={sr}")
|
| 132 |
```
|
| 133 |
|
| 134 |
## Example: Accessing a reverberant speech file at the microphones of a 6-channel device
|