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

Add speaker device #693

Merged
merged 4 commits into from
Oct 24, 2024
Merged

Add speaker device #693

merged 4 commits into from
Oct 24, 2024

Conversation

vinc
Copy link
Owner

@vinc vinc commented Oct 22, 2024

This PR will add /dev/speaker allowing the beep command to interact with the PC Speaker from usermode.

Writing a (big endian) bytes representation of a 64 bit float to this device will start to play a sound at the given frequency or stop it if the frequency is zero.

@vinc
Copy link
Owner Author

vinc commented Oct 22, 2024

If we write the frequency to the device using a string instead of a float we can use the shell more easily to play sound:

speaker

And the beep command could be a simple script that uses print to write the frequency to the device, then sleep to wait for the sound to play, then print again to stop the sound:

print $1 => /dev/speaker
sleep $2
print 0 => /dev/speaker

@vinc vinc changed the title Add speaker device for the beep command Add speaker device Oct 22, 2024
@vinc
Copy link
Owner Author

vinc commented Oct 22, 2024

The beep command can now become a regular userspace program.

@vinc vinc marked this pull request as ready for review October 24, 2024 16:22
@vinc vinc merged commit 08f7de9 into trunk Oct 24, 2024
1 check passed
@vinc vinc deleted the feature/beep branch October 24, 2024 16:24
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