Skip to content

TT-7360 feat: Implement Careful Speech functionality with waveform segment management#340

Open
gtryus wants to merge 5 commits into
developfrom
TT-7360-careful
Open

TT-7360 feat: Implement Careful Speech functionality with waveform segment management#340
gtryus wants to merge 5 commits into
developfrom
TT-7360-careful

Conversation

@gtryus

@gtryus gtryus commented May 29, 2026

Copy link
Copy Markdown
Contributor
  • Added carefulSpeechBoundary.ts and corresponding tests for clause end adjustments and boundary management.
  • Introduced carefulSpeechCompletion.ts to handle clause completion logic and related tests.
  • Created carefulSpeechFormat.ts for formatting clause ranges.
  • Developed useCarefulSpeechSegments.ts for managing segment state and persistence.
  • Added transcribeDefaultSegParams.ts for default auto-segment parameters.
  • Enhanced WSAudioPlayer with careful speech controls and playback management.
  • Updated toolSlug.ts to include CarefulSpeech tool.
  • Modified useOfflineSetup.ts and useTools.ts to integrate CarefulSpeech functionality.
  • Implemented color management for Careful Speech segments in useWaveSurferRegions.ts.
  • Added localization support for Careful Speech in model.tsx and reducers.tsx.
  • Created utility functions for Careful Speech segment colors in carefulSpeechSegmentColors.ts.
  • Updated namedSegments.ts to define new region types for Careful Speech.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Implements a new Careful Speech step in the renderer, including clause-based waveform segmentation, navigation/recording UI, segment persistence, and localization/tooling integration.

Changes:

  • Added Careful Speech UI (player + controls) and supporting utilities/hooks for clause and clause-moves segment management.
  • Extended WaveSurfer region coloring/selection logic to support a new Careful Speech segment color mode and more reliable region play-end behavior.
  • Integrated the new tool end-to-end (tool slug, offline setup, workflow migration, localization strings/selectors).

Reviewed changes

Copilot reviewed 28 out of 30 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/renderer/src/utils/namedSegments.ts Adds new named segment buckets for clause and clause-moves.
src/renderer/src/utils/carefulSpeechSegmentColors.ts Introduces Careful Speech waveform region color utilities.
src/renderer/src/store/localization/reducers.tsx Adds Careful Speech localized string bundle and tool label.
src/renderer/src/store/localization/model.tsx Adds Careful Speech localization typings and tool string key.
src/renderer/src/store/localization/exported-strings-name.json Updates exported localization bundle filename reference.
src/renderer/src/selector/selectors.tsx Adds a selector for Careful Speech localization layout.
src/renderer/src/routes/PassageDetail.tsx Routes mobile Careful Speech tool to the new screen component.
src/renderer/src/crud/useWavesurferRegions.tsx Adds Careful Speech region-color mode + region-in/out targeting safeguards.
src/renderer/src/crud/useWaveSurfer.tsx Wires new segment color mode + Careful Speech status ref into regions hook.
src/renderer/src/crud/useTools.ts Registers Careful Speech in the tool slug list.
src/renderer/src/crud/useOfflineSetup.ts Uses the new carefulSpeech tool slug for offline workflow creation.
src/renderer/src/crud/toolSlug.ts Adds ToolSlug.CarefulSpeech.
src/renderer/src/components/WSAudioPlayer.tsx Exposes additional controls (setPlay, auto-segment, load/save regions, Careful Speech color apply).
src/renderer/src/components/PassageDetail/transcribeDefaultSegParams.ts Adds default auto-segmentation params used for clause-moves generation.
src/renderer/src/components/PassageDetail/PassageDetailPlayer.tsx Plumbs Careful Speech status ref + segment playback end callback to WSAudioPlayer.
src/renderer/src/components/PassageDetail/PassageDetailGrids.tsx Adds Careful Speech screen into the main PassageDetail layout logic.
src/renderer/src/components/PassageDetail/PassageDetailCarefulSpeech.tsx New Careful Speech step screen: clause playback, boundary adjustment, recording flow, status coloring.
src/renderer/src/components/PassageDetail/carefulSpeech/useCarefulSpeechSegments.ts New hook for bootstrapping/persisting clause and clause-moves segment buckets.
src/renderer/src/components/PassageDetail/carefulSpeech/carefulSpeechFormat.ts Helper to format clause time ranges for display.
src/renderer/src/components/PassageDetail/carefulSpeech/CarefulSpeechControls.tsx UI controls for boundary adjustment, recording, navigation, and completion.
src/renderer/src/components/PassageDetail/carefulSpeech/CarefulSpeechControls.cy.tsx Cypress component test for CarefulSpeechControls basic rendering.
src/renderer/src/components/PassageDetail/carefulSpeech/carefulSpeechCompletion.ts Logic for determining which clauses are completed and selecting the next incomplete clause.
src/renderer/src/components/PassageDetail/carefulSpeech/carefulSpeechCompletion.test.ts Unit tests for completion and next-clause selection logic.
src/renderer/src/components/PassageDetail/carefulSpeech/carefulSpeechBoundary.ts Logic for snapping clause boundary changes to clause-moves boundaries (or threshold fallback).
src/renderer/src/components/PassageDetail/carefulSpeech/carefulSpeechBoundary.test.ts Unit tests for boundary adjustment and snapping behavior.
migration/bold-workflow/insert-bold-workflowsteps.sql Updates Bold workflow Careful Speech step to use the new carefulSpeech tool/settings.
localization/TranscriberAdmin-en.xlf Adds Careful Speech string units and tool label to localization source.
localization/TranscriberAdmin-en-1.2.xliff Adds Careful Speech string units and tool label to localization source (xliff v1.2).

Comment thread src/renderer/src/crud/useWavesurferRegions.tsx Outdated
@gtryus gtryus force-pushed the TT-7360-careful branch 4 times, most recently from 1499fc1 to 0c2fdb9 Compare June 5, 2026 19:37
@gtryus gtryus requested a review from Copilot June 5, 2026 19:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 38 out of 42 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • src/renderer/package-lock.json: Language not supported

Comment on lines +4 to +8
export const boldDefaultSegParams: IRegionParams = {
silenceThreshold: 0.002,
timeThreshold: 0.02,
segLenThreshold: 1.5,
};
@gtryus gtryus force-pushed the TT-7360-careful branch 2 times, most recently from 7faab17 to 9e1bb9e Compare June 5, 2026 20:30
…management

Introduce the implementation, workflow states, and user interface controls
for the BOLD Careful Speech step. This includes modular backend utilities for clause
boundary adjustments, auto-segmentation parameter configurations, and robust state
management using WaveSurfer integration.

- Core Feature & Utilities:
  * Create `carefulSpeechBoundary` and `carefulSpeechCompletion` logic with full test coverage.
  * Implement `useCarefulSpeechSegments` to orchestrate segment states, leveraging
    `useProjectSegmentSave` for persistent local storage.
  * Integrate the CarefulSpeech tool into offline configurations, tool slugs, and routing pipelines.

- Audio Player & WaveSurfer Integration:
  * Enhance `WSAudioPlayer` and `useWavesurferRegions` to handle custom region
    coloring, region-out listening documentation, and zoomed playback constraints.
  * Introduce `isPlayRegionLocked` and a `beforePlay` callback to streamline audio execution states.
  * Adjust silence threshold settings in `boldCarefulSpeechSegParams` for fine-tuned chunking.

- UI, UX, and Focus Management:
  * Create `PassageDetailCarefulSpeech` and `CarefulSpeechControls` layout layers.
  * Add a conditional "listen pass help" tooltip restricted to the first active segment.
  * Implement auto-focus mechanics using React refs on the speaker input field when highlighted.
  * Rework the "More/Fewer" auto-segment configuration actions.

- Internationalization & Metadata:
  * Inject new localization strings for guided audio flows and helper prompts across relevant files.
@gtryus gtryus force-pushed the TT-7360-careful branch from 9e1bb9e to 5c52da2 Compare June 5, 2026 20:31
Comment thread src/renderer/src/components/WSAudioPlayer.tsx
Comment thread src/renderer/src/components/PassageDetail/PassageDetailCarefulSpeech.tsx Outdated
Comment thread src/renderer/src/components/PassageDetail/PassageDetailCarefulSpeech.tsx Outdated
Comment thread src/renderer/src/utils/namedSegments.ts Outdated
BackTranslation = 'BT',
CarefulSpeech = 'CarefulSpeech',
Clause = 'clause',
ClauseMoves = 'clause-moves',

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't used anywhere that I could see.

Comment thread src/renderer/src/crud/useWaveSurfer.tsx Outdated
@@ -946,5 +958,6 @@ export function useWaveSurfer(
wsSetRegionColor,
wsRemoveCurrentRegion,
applyMarkVersesRegionColors,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to pass in a applyColors function and have the calling function return a color instead of having all this logic inside wavesurfer

getCarefulSpeechPendingColor,
getCarefulSpeechRegionBaseColor,
type ICarefulSpeechColorStatus,
} from '../utils/carefulSpeechSegmentColors';

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pass in an applyColor function and put specialized login in the caller

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

specialized *logic

Greg Trihus added 4 commits June 8, 2026 13:26
… components

- Renamed `applyMarkVersesRegionColors` and `applyCarefulSpeechRegionColors` to `applyRegionColors` for consistency across the audio player and passage detail components.
- Updated references in `WSAudioPlayer`, `PassageDetailCarefulSpeech`, and `PassageDetailMarkVerses` to utilize the new unified method for applying region colors.
- Introduced `createCarefulSpeechApplyRegionColor` and `createMarkVersesApplyRegionColor` functions to encapsulate color logic based on the current state, enhancing modularity and readability.
- Added tests for the new color application functions to ensure correct behavior across different scenarios.
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.

3 participants