forked from Blendman974/faceclaw
Merge branch 'main' of https://github.com/jimrandomh/faceclaw
This commit is contained in:
commit
c162c8e633
24 files changed
+486
-154
No files matched your search
@@ -1045,20 +1045,16 @@ export const wakeWordActionSetting = new ConfigSettingEnum<WakeWordAction>({
|
||||
description: "What saying \"Hey Even\" does: start voice input, just turn the screen on, or nothing.",
|
||||
});
|
||||
|
||||
export const saveTranscribeAudioSetting = new ConfigSettingBoolean({
|
||||
id: "save-transcribe-audio",
|
||||
label: "Save Transcribe audio",
|
||||
storageKey: "voice.saveTranscribeAudio",
|
||||
defaultValue: true,
|
||||
description: "Record each Transcribe session's audio as a WAV file in Downloads (about 2 MB per minute), named like its transcript. Recordings are kept until you delete them.",
|
||||
});
|
||||
|
||||
export const saveVoiceRecordingsSetting = new ConfigSettingBoolean({
|
||||
id: "save-voice-recordings",
|
||||
label: "Save voice recordings",
|
||||
storageKey: "developer.saveVoiceRecordings",
|
||||
/**
|
||||
* Toggled from the Transcribe and Translate apps' menus. One setting for
|
||||
* both: they share the mic stream, so its audio is either being saved or not.
|
||||
*/
|
||||
export const saveRecordingSetting = new ConfigSettingBoolean({
|
||||
id: "save-recording",
|
||||
label: "Save Recording",
|
||||
storageKey: "voice.saveRecording",
|
||||
defaultValue: false,
|
||||
description: "Keep a copy of captured voice audio on the phone, for debugging transcription problems.",
|
||||
description: "Record the audio of Transcribe and Translate sessions as WAV files in Downloads (about 2 MB per minute), named after the app and the session's start time. Recordings are kept until you delete them.",
|
||||
});
|
||||
|
||||
export const assistantSkipConfirmationSetting = new ConfigSettingBoolean({
|
||||
|
||||
@@ -70,7 +70,6 @@ import {
|
||||
ringConnectionModeSetting,
|
||||
glassesTypeSetting,
|
||||
sonioxApiKeySetting,
|
||||
saveTranscribeAudioSetting,
|
||||
whisperServerApiKeySetting,
|
||||
whisperServerLanguageSetting,
|
||||
whisperServerModelSetting,
|
||||
@@ -81,7 +80,6 @@ import {
|
||||
lockScreenEnabledSetting,
|
||||
menuAnimationSetting,
|
||||
newNotificationDisplaySetting,
|
||||
saveVoiceRecordingsSetting,
|
||||
showBleBandwidthSetting,
|
||||
suspendEvenHubWhenScreenOffSetting,
|
||||
temperatureUnitSetting,
|
||||
@@ -250,7 +248,6 @@ function settingsSections(): SettingsSection[] {
|
||||
// Whether and how the phone opens its own BLE link to the R1 ring.
|
||||
// Applied at connect time.
|
||||
ringConnectionMenuItem(),
|
||||
toggleSettingMenuItem(saveVoiceRecordingsSetting),
|
||||
toggleSettingMenuItem(firmwareDebugFlagsSetting),
|
||||
toggleSettingMenuItem(suspendEvenHubWhenScreenOffSetting),
|
||||
toggleSettingMenuItem(useMicControlSetting),
|
||||
@@ -297,7 +294,7 @@ function settingsSections(): SettingsSection[] {
|
||||
toggleSettingMenuItem(showBleBandwidthSetting)] };
|
||||
// No downloadable on-device models: iOS's on-device option is Apple's recognizer.
|
||||
if (section.label === "Voice") return { label: "Voice", items: [enumSettingMenuItem(wakeWordActionSetting),
|
||||
enumSettingMenuItem(voiceProviderSetting), toggleSettingMenuItem(saveTranscribeAudioSetting), ...whisperServerMenuItems()] };
|
||||
enumSettingMenuItem(voiceProviderSetting), ...whisperServerMenuItems()] };
|
||||
if (section.label === "Display") return { ...section, items: section.items.filter(item =>
|
||||
item.label !== screenTimeoutSetting.label) };
|
||||
return section;
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ export type TextSettingsEditToggle = {
|
||||
|
||||
/** A continuous-capture client's needs (see LayerActions.startContinuousVoiceCapture). */
|
||||
export type ContinuousCaptureOptions = {
|
||||
/** Names a WAV of the captured audio in Downloads (iOS, when Save Transcribe audio is on). */
|
||||
/** Names a WAV of the captured audio in Downloads, written while Save Recording is on. */
|
||||
recordAs?: string;
|
||||
/**
|
||||
* Transcribe with this provider, expecting this spoken language (ISO 639-1,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { type GrayImage, type UiFont } from "../graphics/image";
|
||||
import { GrayImage, imageFromAsciiArt, type UiFont } from "../graphics/image";
|
||||
import { truncateText } from "../graphics/textwrap";
|
||||
import { voiceControlBridge } from "../native/voice-control";
|
||||
import { lineStep } from "./metrics";
|
||||
@@ -11,6 +11,10 @@ const SEGMENTS = 8;
|
||||
const SEGMENT_WIDTH = 4;
|
||||
const SEGMENT_GAP = 2;
|
||||
const METER_GAP = 10;
|
||||
/** Between the recording circle and the meter. */
|
||||
const RECORDING_ICON_GAP = 4;
|
||||
/** Between a tray icon and its recording circle: tight, so they read as one item in the bar. */
|
||||
const TRAY_RECORDING_ICON_GAP = 2;
|
||||
const LIT_GRAY = 200;
|
||||
const UNLIT_GRAY = 45;
|
||||
/** How often the meter may ask for a repaint (each one is a frame over BLE). */
|
||||
@@ -18,6 +22,38 @@ const TICK_MS = 200;
|
||||
/** Per tick, the shown level falls to this fraction without louder audio (~1 s to empty). */
|
||||
const DECAY = 0.5;
|
||||
|
||||
/** The listening views' status while Save Recording is on but its file could not be created. */
|
||||
export const RECORDING_FAILED_NOTICE = "Recording failed (check file access).";
|
||||
|
||||
/**
|
||||
* 9x9 filled circle: the mic's audio is being saved (Save Recording, in the
|
||||
* Transcribe and Translate menus). Shown beside the mic level meter and the
|
||||
* mic tray icon, and on Glanceboard's system card.
|
||||
*/
|
||||
export const RECORDING_ICON = imageFromAsciiArt(
|
||||
[
|
||||
" ### ",
|
||||
" ####### ",
|
||||
" ####### ",
|
||||
"#########",
|
||||
"#########",
|
||||
"#########",
|
||||
" ####### ",
|
||||
" ####### ",
|
||||
" ### ",
|
||||
],
|
||||
{ "#": 220 },
|
||||
);
|
||||
|
||||
/** `icon` with the recording circle to its right: a tray icon while its app's audio is saved. */
|
||||
export function withRecordingIcon(icon: GrayImage): GrayImage {
|
||||
const circleX = icon.width + TRAY_RECORDING_ICON_GAP;
|
||||
const image = new GrayImage(circleX + RECORDING_ICON.width, Math.max(icon.height, RECORDING_ICON.height), 0);
|
||||
image.bitBlt(icon, 0, (image.height - icon.height) >> 1);
|
||||
image.bitBlt(RECORDING_ICON, circleX, (image.height - RECORDING_ICON.height) >> 1);
|
||||
return image;
|
||||
}
|
||||
|
||||
/**
|
||||
* A compact segmented mic-level meter for listening views. Levels arrive per
|
||||
* 50 ms audio chunk; the meter holds their peak and, at most every 200 ms,
|
||||
@@ -65,8 +101,9 @@ export class MicLevelMeter {
|
||||
/**
|
||||
* The one-line header of the listening views (Transcribe, Translate):
|
||||
* "Title · status", the status truncated to fit, then the mic level meter at
|
||||
* the line's end when one is given (while listening). It spans the image
|
||||
* inside `padding`, the padding suggested for the window's edges
|
||||
* the line's end when one is given (while listening), with the recording
|
||||
* circle before it while the audio it shows is being saved. It spans the
|
||||
* image inside `padding`, the padding suggested for the window's edges
|
||||
* (viewport.ts). Returns the y at which the view's body starts.
|
||||
*/
|
||||
export function paintListeningHeader(
|
||||
@@ -76,14 +113,23 @@ export function paintListeningHeader(
|
||||
status: string,
|
||||
meter: MicLevelMeter | null,
|
||||
padding: Edges<number>,
|
||||
recording = false,
|
||||
): number {
|
||||
const x = padding.left, y = padding.top;
|
||||
let textRight = image.width - padding.right;
|
||||
if (meter) {
|
||||
const meterX = textRight - meter.width;
|
||||
// Roughly cap height, sitting on the text's baseline.
|
||||
meter.paint(image, meterX, y + font.ascent, Math.max(4, Math.round(font.ascent * 0.6)));
|
||||
const baseline = y + font.ascent;
|
||||
const meterHeight = Math.max(4, Math.round(font.ascent * 0.6));
|
||||
meter.paint(image, meterX, baseline, meterHeight);
|
||||
textRight = meterX - METER_GAP;
|
||||
if (recording) {
|
||||
const iconX = meterX - RECORDING_ICON_GAP - RECORDING_ICON.width;
|
||||
// Centred on the meter's height.
|
||||
image.drawImage(RECORDING_ICON, iconX, Math.round(baseline - (meterHeight + RECORDING_ICON.height) / 2));
|
||||
textRight = iconX - METER_GAP;
|
||||
}
|
||||
}
|
||||
image.drawText(font, x, y, title, TITLE_GRAY);
|
||||
if (status) {
|
||||
|
||||
Reference in new issue
Block a user