Update README.md
Browse files
README.md
CHANGED
@@ -189,6 +189,34 @@ plt.legend()
|
|
189 |
plt.show()
|
190 |
```
|
191 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
192 |
## Dataset Details
|
193 |
The dataset contains three subsets:
|
194 |
- **Treble10-RIR-mono**: This subset contains mono room impulse responses (RIRs). In each room, RIRs are available between 5 sound sources and several receivers. The receivers are placed along horizontal receiver grids with 0.5 m resolution at three heights (0.5 m, 1.0 m, 1.5 m). The validity of all source and receiver positions is checked to ensure that none of them intersects with the room geometry or furniture.
|
|
|
189 |
plt.show()
|
190 |
```
|
191 |
|
192 |
+
## Example: Read a HOA8 RIR from Treble10
|
193 |
+
```python
|
194 |
+
from datasets import load_dataset, Audio
|
195 |
+
import io, soundfile as sf
|
196 |
+
|
197 |
+
# Load dataset in streaming mode
|
198 |
+
ds = load_dataset("treble-technologies/Treble10-RIR", split="rir_hoa8", streaming=True)
|
199 |
+
|
200 |
+
# Disable automatic decoding (we'll do it manually)
|
201 |
+
ds = ds.cast_column("audio", Audio(decode=False))
|
202 |
+
|
203 |
+
# Get one sample from the iterator
|
204 |
+
sample = next(iter(ds))
|
205 |
+
|
206 |
+
# Fetch raw audio bytes
|
207 |
+
audio_bytes = sample["audio"]["bytes"]
|
208 |
+
|
209 |
+
# Some older datasets may not have "bytes", so fall back to reading from the file
|
210 |
+
if audio_bytes is None:
|
211 |
+
# Use huggingface's file object directly
|
212 |
+
with sample["audio"]["path"].open("rb") as f:
|
213 |
+
audio_bytes = f.read()
|
214 |
+
|
215 |
+
# Decode the HOA audio directly from memory
|
216 |
+
rir_hoa, sr = sf.read(io.BytesIO(audio_bytes))
|
217 |
+
print(f"Loaded HOA RIR: shape={rir_hoa.shape}, sr={sr}")
|
218 |
+
```
|
219 |
+
|
220 |
## Dataset Details
|
221 |
The dataset contains three subsets:
|
222 |
- **Treble10-RIR-mono**: This subset contains mono room impulse responses (RIRs). In each room, RIRs are available between 5 sound sources and several receivers. The receivers are placed along horizontal receiver grids with 0.5 m resolution at three heights (0.5 m, 1.0 m, 1.5 m). The validity of all source and receiver positions is checked to ensure that none of them intersects with the room geometry or furniture.
|