lyrics-transcriber 0.68.0__py3-none-any.whl → 0.69.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,210 @@
1
+ Please read this doc to understand the "Replace All" modal we implemented in a previous chat: @REPLACE_ALL_FUNCTIONALITY.md
2
+
3
+ The primary code for the new modal is here: @ReplaceAllLyricsModal.tsx
4
+ but the manual sync functionality relies heavily on @EditTimelineSection.tsx, @useManualSync.ts and @EditActionBar.tsx
5
+
6
+ The functionality mostly works but we need to continue refining it and fixing issues until it is good enough for me and other users to use. Please let me know once you've reviewed the above and you're ready for me to explain the first issue.
7
+
8
+ # Replace All Lyrics Functionality
9
+
10
+ ## Overview
11
+
12
+ The "Replace All Lyrics" functionality provides a complete solution for replacing transcribed lyrics when the original transcription quality is too poor to edit word-by-word. This feature allows users to start fresh with clipboard content and manually sync timing for the entire song.
13
+
14
+ ## Key Components
15
+
16
+ ### 1. ReplaceAllLyricsModal.tsx
17
+ - **Location**: `src/components/ReplaceAllLyricsModal.tsx`
18
+ - **Purpose**: Standalone modal for replacing all lyrics with clipboard content
19
+ - **Design**: Separate from EditModal.tsx to maintain clean separation of concerns
20
+
21
+ ### 2. Integration Points
22
+ - **useManualSync Hook**: Reuses existing manual sync functionality
23
+ - **AudioPlayer Integration**: Leverages global audio controls and duration
24
+ - **Types**: Uses existing LyricsSegment and Word types
25
+
26
+ ## User Workflow
27
+
28
+ ### Phase 1: Input
29
+ 1. **Open Modal**: Access via "Replace All Lyrics" button/action
30
+ 2. **Paste Content**: Large textarea for pasting lyrics from clipboard
31
+ 3. **Real-time Feedback**:
32
+ - Line count display
33
+ - Word count display
34
+ - Preview of how content will be parsed
35
+ 4. **Validation**: Ensures content is not empty before proceeding
36
+
37
+ ### Phase 2: Manual Sync
38
+ 1. **Automatic Conversion**: Each line becomes a LyricsSegment, each word becomes a Word object
39
+ 2. **Timeline View**:
40
+ - Fixed 30-second zoom window
41
+ - Shows entire song duration (0 to audio duration)
42
+ - Visual indicators for word positions
43
+ 3. **Manual Timing**:
44
+ - Spacebar to mark word timings during playback
45
+ - Pause/resume functionality for corrections
46
+ - Real-time progress tracking
47
+ 4. **Progress Panel**:
48
+ - Shows all segments with sync status
49
+ - Active segment highlighting (blue)
50
+ - Completed segments (green) with timing display
51
+ - Progress indicators (X/Y words synced)
52
+ - Auto-scroll to follow playback
53
+
54
+ ## Technical Implementation
55
+
56
+ ### Data Structure
57
+ ```typescript
58
+ // Each line becomes a LyricsSegment
59
+ {
60
+ id: string,
61
+ text: string, // Full line text
62
+ start_time: number | null,
63
+ end_time: number | null,
64
+ words: Word[] // Each word in the line
65
+ }
66
+
67
+ // Each word becomes a Word object
68
+ {
69
+ id: string,
70
+ text: string, // Individual word
71
+ start_time: number | null,
72
+ end_time: number | null,
73
+ confidence: number // Set to 1.0 for manual entries
74
+ }
75
+ ```
76
+
77
+ ### Modal Layout
78
+ - **Full Browser Width**: Uses `maxWidth={false}` and viewport-based calculations
79
+ - **Split Layout**:
80
+ - Timeline Section: 2/3 width
81
+ - Progress Panel: 1/3 width
82
+ - **Responsive Design**: Adapts to different screen sizes
83
+
84
+ ### Audio Integration
85
+ - **Duration Detection**: Uses `window.getAudioDuration()` for accurate song length
86
+ - **Playback Control**: Integrates with existing audio controls
87
+ - **Auto-cleanup**: Stops audio when canceling sync
88
+
89
+ ## Key Features Implemented
90
+
91
+ ### 1. Stable Timeline View
92
+ - **Fixed Zoom**: Always shows 30-second window
93
+ - **Full Song Range**: Timeline spans 0 to full audio duration
94
+ - **Prevents Zoom Changes**: Disabled during manual sync to maintain consistency
95
+
96
+ ### 2. Manual Sync Enhancement
97
+ - **Spacebar Timing**: Press spacebar to mark word timings
98
+ - **Pause/Resume**: Alt+P to pause/resume for corrections
99
+ - **Visual Feedback**:
100
+ - Current word highlighting
101
+ - Spacebar press indication
102
+ - Progress tracking
103
+
104
+ ### 3. Progress Tracking
105
+ - **Segment Status**: Visual indicators for sync progress
106
+ - **Real-time Updates**: Timing updates as words are synced
107
+ - **Auto-scroll**: Follows active segment during sync
108
+ - **Completion Status**: Clear visual feedback for completed segments
109
+
110
+ ### 4. Error Prevention
111
+ - **Input Validation**: Ensures content exists before proceeding
112
+ - **Safe Navigation**: Proper cleanup when canceling
113
+ - **State Management**: Prevents conflicts with existing edit modals
114
+
115
+ ## Bug Fixes Implemented
116
+
117
+ ### 1. Manual Sync Issues
118
+ - **Problem**: Sync stopping after first spacebar press
119
+ - **Solution**: Fixed infinite re-renders in useEffect dependencies
120
+ - **Result**: Stable manual sync throughout entire song
121
+
122
+ ### 2. Timeline Zoom Problems
123
+ - **Problem**: Timeline zooming to single word duration after sync
124
+ - **Solution**: Fixed timeRange calculation to always use full song duration
125
+ - **Result**: Consistent 30-second view regardless of sync progress
126
+
127
+ ### 3. Audio Duration
128
+ - **Problem**: Hardcoded duration fallbacks causing inaccurate timelines
129
+ - **Solution**: Integration with real audio duration from AudioPlayer
130
+ - **Result**: Accurate timeline representation of song length
131
+
132
+ ### 4. Keyboard Conflicts
133
+ - **Problem**: Multiple keyboard handlers causing conflicts
134
+ - **Solution**: Proper handler cleanup and event management
135
+ - **Result**: Clean keyboard interaction without conflicts
136
+
137
+ ## User Experience Improvements
138
+
139
+ ### 1. Visual Feedback
140
+ - **Real-time Counts**: Live word/line counting during input
141
+ - **Progress Indicators**: Clear visual feedback on sync progress
142
+ - **Color Coding**: Blue for active, green for completed segments
143
+
144
+ ### 2. Navigation
145
+ - **Auto-scroll**: Automatically follows playback position
146
+ - **Manual Navigation**: Can manually scroll through segments
147
+ - **Status Preservation**: Maintains state during navigation
148
+
149
+ ### 3. Error Recovery
150
+ - **Pause/Resume**: Ability to pause and correct timing
151
+ - **Cancel Support**: Safe cancellation with proper cleanup
152
+ - **State Reset**: Clean state management between sessions
153
+
154
+ ## Integration with Existing Codebase
155
+
156
+ ### 1. Reused Components
157
+ - **useManualSync**: Leverages existing manual sync logic
158
+ - **Timeline Components**: Reuses timeline visualization
159
+ - **Audio Controls**: Integrates with existing audio system
160
+
161
+ ### 2. Type Safety
162
+ - **TypeScript**: Fully typed implementation
163
+ - **Consistent Interfaces**: Uses existing type definitions
164
+ - **Validation**: Runtime validation for data integrity
165
+
166
+ ### 3. State Management
167
+ - **Isolated State**: Doesn't interfere with existing edit functionality
168
+ - **Clean Separation**: Separate modal for replace vs. edit operations
169
+ - **Proper Cleanup**: Ensures no state leakage between modals
170
+
171
+ ## Performance Considerations
172
+
173
+ ### 1. Rendering Optimization
174
+ - **Memoization**: Strategic use of React.memo and useCallback
175
+ - **Efficient Updates**: Minimal re-renders during sync
176
+ - **Progressive Loading**: Handles large lyric sets efficiently
177
+
178
+ ### 2. Memory Management
179
+ - **Cleanup**: Proper cleanup of event listeners and timers
180
+ - **State Reset**: Clean state management between sessions
181
+ - **Audio Integration**: Efficient audio control integration
182
+
183
+ ## Future Enhancement Opportunities
184
+
185
+ ### 1. Batch Operations
186
+ - **Multi-line Selection**: Select and sync multiple segments at once
187
+ - **Timing Adjustment**: Bulk timing adjustments
188
+ - **Smart Defaults**: AI-suggested timing based on audio analysis
189
+
190
+ ### 2. Import/Export
191
+ - **Format Support**: Support for various lyric file formats
192
+ - **Backup/Restore**: Save and restore sync sessions
193
+ - **Templates**: Predefined timing templates
194
+
195
+ ### 3. Advanced Sync
196
+ - **Beat Detection**: Automatic beat-based timing suggestions
197
+ - **Voice Activity**: Audio analysis for timing hints
198
+ - **Collaborative Sync**: Multi-user timing collaboration
199
+
200
+ ## Summary
201
+
202
+ The "Replace All Lyrics" functionality provides a comprehensive solution for handling poor-quality transcriptions by:
203
+
204
+ 1. **Complete Replacement**: Replaces all existing lyrics with fresh clipboard content
205
+ 2. **Manual Control**: Gives users full control over timing through manual sync
206
+ 3. **Visual Feedback**: Provides clear progress tracking and status indicators
207
+ 4. **Stable Interface**: Maintains consistent timeline view throughout the process
208
+ 5. **Clean Integration**: Works seamlessly with existing audio and editing systems
209
+
210
+ This implementation significantly improves the user experience for cases where starting fresh is more efficient than editing individual words, while maintaining the high-quality timing precision needed for karaoke applications.
@@ -2,7 +2,7 @@
2
2
  "name": "lyrics-transcriber-frontend",
3
3
  "private": true,
4
4
  "homepage": "https://nomadkaraoke.github.io/lyrics-transcriber-frontend",
5
- "version": "0.68.0",
5
+ "version": "0.69.0",
6
6
  "type": "module",
7
7
  "scripts": {
8
8
  "dev": "vite",
@@ -109,7 +109,7 @@ export default function AudioPlayer({ apiClient, onTimeUpdate, audioHash }: Audi
109
109
  setIsPlaying(!isPlaying)
110
110
  }, [isPlaying])
111
111
 
112
- // Expose both methods globally
112
+ // Expose methods and duration globally
113
113
  useEffect(() => {
114
114
  if (!apiClient) return
115
115
 
@@ -117,12 +117,14 @@ export default function AudioPlayer({ apiClient, onTimeUpdate, audioHash }: Audi
117
117
  const win = window as any
118
118
  win.seekAndPlayAudio = seekAndPlay
119
119
  win.toggleAudioPlayback = togglePlayback
120
+ win.getAudioDuration = () => duration
120
121
 
121
122
  return () => {
122
123
  delete win.seekAndPlayAudio
123
124
  delete win.toggleAudioPlayback
125
+ delete win.getAudioDuration
124
126
  }
125
- }, [apiClient, togglePlayback])
127
+ }, [apiClient, togglePlayback, duration])
126
128
 
127
129
  if (!apiClient) return null
128
130