Ar4ikov commited on
Commit
54e01a8
·
verified ·
1 Parent(s): 332f360

Use datasets Audio(sampling_rate=) for resampling; note torchaudio and torchcodec

Browse files
Files changed (1) hide show
  1. README.md +13 -1
README.md CHANGED
@@ -53,7 +53,19 @@ RESD was recorded in a studio by **20 voice actors**. There was no script: the a
53
  | `emotion` | Emotion label of the recording |
54
 
55
  > [!IMPORTANT]
56
- > **The sample rate is not uniform.** In `train` 565 clips are 16000 Hz, 551 clips are 44100 Hz. Resample on load — `librosa.load(..., sr=16000)` — and do not tell a feature extractor the audio is 16 kHz when it is 44.1 kHz: that stretches time 2.8x and silently changes the answer instead of raising.
 
 
 
 
 
 
 
 
 
 
 
 
57
 
58
  ## Usage
59
 
 
53
  | `emotion` | Emotion label of the recording |
54
 
55
  > [!IMPORTANT]
56
+ > **The sample rate is not uniform.** In `train` 565 clips are 16000 Hz, 551 clips are 44100 Hz. Ask for one rate when you load, and do not tell a feature extractor the audio is 16 kHz when it is 44.1 kHz: that stretches time 2.8x and silently changes the answer instead of raising.
57
+
58
+ `datasets` does the resampling itself — declare the rate on the column and every clip arrives at it:
59
+
60
+ ```python
61
+ from datasets import load_dataset, Audio
62
+
63
+ ds = load_dataset("Aniemore/resd_annotated")
64
+ ds = ds.cast_column("speech", Audio(sampling_rate=16000))
65
+ wav = ds["train"][0]["speech"]["array"] # 16 kHz, float32
66
+ ```
67
+
68
+ If you are handling files yourself instead, any of these will do the same job: `librosa.load(path, sr=16000, mono=True)`, `torchaudio.load` followed by `torchaudio.transforms.Resample`, or `torchcodec.decoders.AudioDecoder` with a target rate.
69
 
70
  ## Usage
71