Page MenuHomeFreeBSD

beep(1): Add support for rendering text and numbers as audio.
Needs ReviewPublic

Authored by hselasky on Jul 11 2022, 12:36 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Nov 19, 8:08 PM
Unknown Object (File)
Wed, Nov 13, 6:39 AM
Unknown Object (File)
Mon, Nov 4, 4:22 AM
Unknown Object (File)
Oct 21 2024, 7:31 AM
Unknown Object (File)
Oct 21 2024, 6:29 AM
Unknown Object (File)
Oct 17 2024, 5:35 AM
Unknown Object (File)
Oct 16 2024, 8:21 PM
Unknown Object (File)
Oct 16 2024, 8:21 PM

Details

Reviewers
oskar.holmlund_ohdata.se
Group Reviewers
Accessibility
Summary

Refer to the manual page bits for details.

Test Plan

beep -t "Hi"
beep -t "ERROR" -D 50
beep -F 110 -t "Hi, this is a test." -D 50
beep -n 0
beep -n 1
beep -n 2

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

Technically you could render two different strings at the same time, if using different frequencies!

Manual page itself LGTM, but I would make it use Unicode (or whichever encoding) units, not bytes. With bytes, LSB-first breaks down in the presence of UTF-8, for instance (and all the 1 bits in the first byte would only make it worse). Consider, for instance, beep -t "Ψωμί! Παιδειά! Και όχι επαιτειά!"

Would it work if the intermediate format was UTF-8, but all characters would be output as 16-bit unicode?

Beware that Unicode itself can go beyond 16-bit. I think the kernel supports 21-bit unicode, so should we print everything like 21 bits?

Any opinions?

Would it work if the intermediate format was UTF-8, but all characters would be output as 16-bit unicode?

I'm not sure, but leaning toward "no" because there are enough scripts in common use in the SMP (Hanifi Rohingya comes to mind), SIP (CJK), and TIP (CJK) to require 2 UTF16 codepoints very often.

Beware that Unicode itself can go beyond 16-bit. I think the kernel supports 21-bit unicode, so should we print everything like 21 bits?

21 bits? Oh right, plane 16. Hmm. Maybe stop (or start, depending on output order) at the most significant nonzero byte of the UCS4 codepoint? That's probably lossy, but I'm not sure it matters except for airgap-bridging use cases.

hselasky retitled this revision from beep(1): Add support for rendering text as audio to beep(1): Add support for rendering text and numbers as audio..
hselasky edited the summary of this revision. (Show Details)

Can you test this updated patch, now with full UTF-8 support.

It was 22-bits max for UTF-8 to unicode conversion.

Can you test this updated patch, now with full UTF-8 support.

No bare metal to run 14 on, but if it would work in a VirtualBox VM, I can try in a few days.

usr.bin/beep/beep.1
68

Tried to optimize audio rendering to save time.

I am interested to take/continue this feature. Are others already working?

I am interested to take/continue this feature. Are others already working?

I think no one has worked on this still, so feel free to take this. You can add me as a reviewer if you want.