File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -195,6 +195,30 @@ feedback:
195195 pos : [0, -2]
196196` ` `
197197
198+ ### Converting Text Stimuli to Voice
199+
200+ ` StimBank` can transform text-based stimuli into spoken audio using the
201+ `edge-tts` package. Two helper methods handle the heavy lifting for you :
202+
203+ - **`convert_to_voice()`** – Take one or more already registered text stimuli and
204+ generate an MP3 file for each. The sounds are stored in an `assets/` folder and
205+ new `Sound` stimuli with the suffix `_voice` are automatically registered.
206+ - **`add_voice()`** – Synthesize arbitrary text and register it immediately as a
207+ new voice stimulus.
208+
209+ ` ` ` python
210+ # Convert existing text stimuli to speech
211+ stim_bank.convert_to_voice(["instructions", "feedback"], voice="en-US-AriaNeural")
212+
213+ # Create a brand new voice stimulus
214+ stim_bank.add_voice(
215+ "welcome_voice",
216+ "Welcome to the experiment. Press space to start.",
217+ voice="en-US-AriaNeural",
218+ )
219+ ` ` `
220+
221+
198222# ## 3. Retrieving Stimuli
199223
200224# ### Getting Individual Stimuli
You can’t perform that action at this time.
0 commit comments