Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support recording audio from a headless beebjit #48

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ojwb
Copy link

@ojwb ojwb commented Dec 4, 2022

If -opt sound:dev is specified, it's taken to be a filename to save audio data too.

The format is 16 bit unsigned raw audio data, with a default sample rate of 48kHz.

@ojwb
Copy link
Author

ojwb commented Dec 4, 2022

This seems to work in a simple test - I can run:

./beebjit -terminal -headless -opt sound:dev=audio.raw

And then play the resulting audio.raw file with:

play --encoding unsigned-integer --bits 16 --rate 48000 audio.raw

However, this doesn't seem to work when I hook it up to the bot - I just seem to get an empty audio.raw created.

I'm suspecting something special is needed to handle -fast but I don't really know where to start with that.

@ojwb
Copy link
Author

ojwb commented Dec 4, 2022

I just tried pruning options from the beebjit command the bot uses and it seems I can either remove -fast or -accurate and then I get some audio data written out (though different amounts for some reason).

Even if this was working, we'd ideally want a way to only start saving audio data after a certain number of cycles (to match video:paint-start-cycles). Without that we'd need to save way too much audio data and then ignore most of it. For a 30 second run that's not too bad, but for a 3 hour one it's more than 16MB of unwanted raw audio data if my calculation is right.

If -opt sound:dev is specified, it's taken to be a filename to save
audio data too.

The format is 16 bit unsigned raw audio data, with a default sample
rate of 48kHz.
@ojwb
Copy link
Author

ojwb commented Jan 24, 2025

Updated on to current master and repeated the manual test from my comment above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant