Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions apps/mobile/src/Stack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ import {
} from "./features/settings/ScheduledTaskPickerScreens";
import { SettingsKeyboardRouteScreen } from "./features/settings/SettingsKeyboardRouteScreen";
import { SettingsLegalRouteScreen } from "./features/settings/SettingsLegalRouteScreen";
import { SettingsSpeechRouteScreen } from "./features/settings/SettingsSpeechRouteScreen";
import { SettingsVoiceRouteScreen } from "./features/settings/SettingsVoiceRouteScreen";
import { SettingsVoiceModelsRouteScreen } from "./features/settings/SettingsVoiceModelsRouteScreen";
import {
Expand Down Expand Up @@ -278,6 +279,11 @@ const SETTINGS_SCREENS = {
linking: { path: "settings/voice", alias: ["settings/microphone"] },
options: settingsPage("Voice"),
}),
SettingsSpeech: createNativeStackScreen({
screen: SettingsSpeechRouteScreen,
linking: "settings/speech",
options: settingsPage("Speech"),
}),
SettingsVoiceModels: createNativeStackScreen({
screen: SettingsVoiceModelsRouteScreen,
options: SEARCH_SHEET_ROUTE,
Expand Down
9 changes: 9 additions & 0 deletions apps/mobile/src/components/ProviderIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@ export function ProviderIcon(props: ProviderIconProps) {
return <AcpRegistryProviderIcon color={mono} iconUrl={props.iconUrl} size={size} />;
}

if (props.provider === "elevenlabs") {
return (
<Svg width={size} height={size} viewBox="288 288 300 300" fill={mono}>
<Path d="M468 292H528V584H468V292Z" />
<Path d="M348 292H408V584H348V292Z" />
</Svg>
);
}

if (props.provider === "claudeAgent") {
return (
<Svg width={size} height={size} viewBox="0 0 256 257" fill="none">
Expand Down
4 changes: 4 additions & 0 deletions apps/mobile/src/components/ui/AppSymbol.android.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import IconVolume from "@tabler/icons-react-native/IconVolume";
import type { Icon } from "@tabler/icons-react-native/types";
/* Package-root imports eagerly register the entire Tabler icon set in Metro. */
import IconAdjustmentsHorizontal from "@tabler/icons-react-native/IconAdjustmentsHorizontal";
Expand Down Expand Up @@ -271,6 +272,9 @@ const ANDROID_ICON_BY_SF_SYMBOL = {
"star.fill": IconStarFilled,
"sun.max": IconSun,
"stop.fill": IconPlayerStopFilled,
"speaker.wave.2": IconVolume,
"pause.fill": IconPlayerPause,
"play.fill": IconPlayerPlay,
target: IconTarget,
terminal: IconTerminal2,
"text.alignleft": IconAlignLeft,
Expand Down
7 changes: 1 addition & 6 deletions apps/mobile/src/features/settings/CloudVoiceSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -285,12 +285,7 @@ function CloudChoices({ environment, active, onClose }: Props & { onClose: () =>
key={provider}
label={label}
leading={
<ProviderIcon
provider={
provider === "openai" ? "codex" : provider === "xai" ? "grok" : provider
}
size={20}
/>
<ProviderIcon provider={provider === "xai" ? "grok" : provider} size={20} />
}
selected={isActive}
separated={index > 0}
Expand Down
170 changes: 170 additions & 0 deletions apps/mobile/src/features/settings/LocalSpeechVoices.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
import { useState } from "react";
import { Linking, ScrollView, View } from "react-native";
import type { EnvironmentPresentation } from "../../state/environments";
import { AppText as Text } from "../../components/ui/AppText";
import { ListActionRow } from "../../components/ui/ListActionRow";
import { ListChoiceRow } from "../../components/ui/ListChoiceRow";
import { ListSection } from "../../components/ui/ListSection";
import { Progress } from "../../components/ui/Progress";
import { Sheet } from "../../components/ui/Sheet";
import { formatBytes } from "../../lib/formatBytes";
import { useSpeechVoiceCatalog } from "../voice-output/useSpeechVoiceCatalog";

export function LocalSpeechVoices({ environment }: { environment: EnvironmentPresentation }) {
const [open, setOpen] = useState(false);
return (
<>
<ListActionRow
label="Local voice"
description={
environment.serverConfig?.settings.speechOutput.piperVoiceId ||
"Choose language and voice"
}
onPress={() => setOpen(true)}
/>
{open ? <VoicePicker environment={environment} onClose={() => setOpen(false)} /> : null}
</>
);
}

function VoicePicker({
environment,
onClose,
}: {
environment: EnvironmentPresentation;
onClose: () => void;
}) {
const catalog = useSpeechVoiceCatalog(environment.environmentId);
const [choice, setChoice] = useState<{ language: string; voiceId: string } | null>(null);
const [choosingLanguage, setChoosingLanguage] = useState(false);
const languages = [
...new Map(catalog.voices.map((voice) => [voice.language, voice.languageName])).entries(),
].sort((a, b) => a[1].localeCompare(b[1]));
const active = catalog.voices.find((voice) => voice.active);
const language =
choice?.language ??
active?.language ??
languages.find(([code]) => code === Intl.DateTimeFormat().resolvedOptions().locale)?.[0] ??
languages[0]?.[0];
const options = catalog.voices.filter((voice) => voice.language === language);
const selected =
options.find((voice) => voice.id === choice?.voiceId) ??
options.find((voice) => voice.active) ??
options[0];
const disabled = !catalog.canManage || catalog.busy || catalog.downloading;
return (
<Sheet title={`Local voices · ${environment.label}`} onClose={onClose}>
<ScrollView
contentInsetAdjustmentBehavior="automatic"
contentContainerClassName="gap-3 p-4 pb-10"
>
<Text className="px-2 text-sm text-foreground-muted">
{active
? `Selected: ${active.name} · ${active.languageName}.`
: "Download a voice to start listening."}{" "}
Voices are stored on this environment.
</Text>
{catalog.error ? (
<ListSection footer={catalog.error}>
<ListActionRow label="Try again" onPress={() => void catalog.refresh()} />
</ListSection>
) : null}
{!catalog.connected ? (
<Text className="text-foreground-muted">
Connect to this environment to manage local voices.
</Text>
) : null}
{catalog.loading ? <Text className="text-foreground-muted">Loading voices…</Text> : null}
{catalog.transfer ? (
<ListSection
title={`${catalog.transfer.state === "verifying" ? "Verifying" : "Downloading"} ${catalog.transfer.name}`}
>
<View className="p-4">
<Progress
label="Voice download progress"
value={(catalog.transfer.downloaded ?? 0) / catalog.transfer.size}
/>
<Text className="mt-2 text-sm text-foreground-muted">
{formatBytes(catalog.transfer.downloaded ?? 0)} /{" "}
{formatBytes(catalog.transfer.size)}
</Text>
</View>
<ListActionRow
label="Cancel download"
disabled={
!catalog.canManage ||
catalog.busy ||
!["downloading", "verifying"].includes(catalog.transfer.state)
}
onPress={() => void catalog.run(catalog.transfer!.id, "cancel")}
/>
</ListSection>
) : null}
{selected ? (
<>
<ListSection title="Language">
<ListActionRow
label={languages.find(([code]) => code === language)?.[1] ?? "Choose language"}
onPress={() => setChoosingLanguage(!choosingLanguage)}
/>
{choosingLanguage
? languages.map(([code, name]) => (
<ListChoiceRow
key={code}
label={name}
selected={language === code}
separated
onPress={() => {
setChoice({ language: code, voiceId: "" });
setChoosingLanguage(false);
}}
/>
))
: null}
</ListSection>
<ListSection title="Voice">
{options.map((voice, index) => (
<ListChoiceRow
key={voice.id}
label={voice.name}
description={`${voice.quality} · ${formatBytes(voice.size)}${voice.state === "installed" ? " · Installed" : ""}`}
selected={selected.id === voice.id}
separated={index > 0}
onPress={() => setChoice({ language: voice.language, voiceId: voice.id })}
/>
))}
</ListSection>
<ListSection>
{selected.state === "installed" ? (
<>
<ListActionRow
label={selected.active ? "Selected" : "Use voice"}
disabled={disabled || selected.active}
onPress={() => void catalog.run(selected.id, "select")}
/>
<ListActionRow
label="Remove voice"
tone="danger"
disabled={disabled}
onPress={() => void catalog.run(selected.id, "remove")}
/>
</>
) : (
<ListActionRow
label="Download & use voice"
disabled={disabled}
loading={Boolean(catalog.transfer?.id === selected.id)}
onPress={() => void catalog.run(selected.id, "download")}
/>
)}
<ListActionRow
label="Voice license"
onPress={() => void Linking.openURL(selected.modelCardUrl)}
/>
</ListSection>
</>
) : null}
</ScrollView>
</Sheet>
);
}
1 change: 1 addition & 0 deletions apps/mobile/src/features/settings/SettingsRouteScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ function useSettingsIndexSections(): SettingsListSection[] {
: []),
page("SettingsKeyboard", "keyboard", gt("Keyboard")),
page("SettingsVoice", "mic", gt("Voice")),
page("SettingsSpeech", "speaker.wave.2", gt("Speech")),
],
},
{
Expand Down
23 changes: 23 additions & 0 deletions apps/mobile/src/features/settings/SettingsSpeechRouteScreen.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { ScreenScrollView } from "../../components/ui/ScreenScrollView";
import { useEnvironments } from "../../state/environments";
import { SettingsScreen } from "./components/SettingsScreen";
import { SpeechOutputSettings } from "./SpeechOutputSettings";

export function SettingsSpeechRouteScreen() {
const insets = useSafeAreaInsets();
const { environments } = useEnvironments();
return (
<SettingsScreen title="Speech">
<ScreenScrollView
contentInsetAdjustmentBehavior="automatic"
showsVerticalScrollIndicator={false}
className="flex-1"
contentContainerClassName="gap-3 px-5 pt-4"
contentContainerStyle={{ paddingBottom: Math.max(insets.bottom, 18) + 18 }}
>
<SpeechOutputSettings environments={environments} />
</ScreenScrollView>
</SettingsScreen>
);
}
Loading
Loading