charmbracelet / vhs

Your CLI home video recorder 📼
MIT License
14.78k stars 248 forks source link

Add support for playing audio in video outputs #65

Open mktip opened 1 year ago

mktip commented 1 year ago

This request might be out of scope for the project overall, and if that's the case please ignore it.

I was wondering if its possible to add a feature where one would be able to start playing a specific audio file after a specific point in the script (for example after displaying a specific command). This might be helpful in cases where one would like to make some educational material or even for documentation purposes, or onboardings.

Constructs to play the audio and to concurrently play or await for the audio once played might be useful to serve the above purposes. "ID" constructs might be added to also micro control the awaiting, to specify for which audio should the player wait if multiple ones where playing at the same time.

Adding such feature might be used as follows if one was to edit them into the sample in the readme:


# Where should we write the GIF?
Output demo.mp4

...

# Pause for dramatic effect...
Sleep 500ms

## plays the specified audio file
PlayAudio two-Inception-style-BRAAMS-followed-in-succession.wav

## awaits for the played audio to finish before continuing with the demo
AwaitAudio 

# Run the command by pressing enter.
Enter

...

Is this feature making the project into a declarative sort of term video editing tool? Yeah kinda, but I was thinking maybe its simple enough that it could serve a specific niche, as using full blown video editors for simple tool demos or documentation purposes can be really frustrating and an overkill.

mmp-schmitt commented 1 year ago

Interesting, ... this leads to another idea. Would it be possible to add keyboard sounds whenever keyboard input is simulated? With some random delays between keyboard inputs it would look like a human typed it.

adriens commented 1 year ago

Interesting, ... this leads to another idea. Would it be possible to add keyboard sounds whenever keyboard input is simulated? With some random delays between keyboard inputs it would look like a human typed it.

Exactly... I was just thinking of that to make the illusion even better :smile: