Skip to content

Latest commit

ย 

History

20 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽ“ LecTrans - Real-time Korean โ†’ Chinese Lecture Translator


๐Ÿ‡ฌ๐Ÿ‡ง English

Overview

LecTrans is a desktop translation tool built for Chinese students studying in South Korea. It captures lecture audio in real time, transcribes Korean speech, translates it into Chinese with Xiaomi MiMo, and shows both languages side by side. After class it generates structured notes, saves recordings, and exports Markdown.

Developed with the help of MiMo Code, it targets four pain points:

  • ๐ŸŽง Language barrier: Korean lectures are hard to follow in real time
  • ๐Ÿ“ Note-taking: manual translation cannot keep up with the lecture
  • ๐Ÿ”‡ Classroom etiquette: fully silent, dark UI, no disturbance
  • ๐Ÿ“š Review: bilingual records and structured summaries are saved automatically

Features

Feature Description
Dual ASR engines Local faster-whisper (offline, adaptive energy VAD) or Azure Speech (cloud)
Context-aware translation Recent N bilingual pairs are sent as context for term/pronoun consistency
Term glossary Built-in Koreanโ€“Chinese CS glossary injected into the prompt
Single audio pipeline One microphone stream feeds both ASR and recording (no device contention)
Recording archive Streams WAV to disk while recording; converts to MP3 on stop (falls back to WAV)
One-click summary Structured notes: key concepts / knowledge points / assignments / open questions
History manager Session list, bilingual review, playback, reveal in folder, delete, Markdown export
Silent mode Apple-inspired dark UI, no audio output

Roadmap

  • MiMo TTS speech playback: synthesize translations to speech and play quietly through earphones
  • Streaming translation output (currently sentence-based)
  • PDF / Word export
  • More language pairs (English, Japanese)

Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ AudioRecorderโ”‚โ”€โ”€โ–ถโ”‚ ASR                โ”‚โ”€โ”€โ–ถโ”‚ Translation  โ”‚โ”€โ”€โ–ถโ”‚ UI (2 cols)โ”‚
โ”‚ single streamโ”‚   โ”‚ faster-whisper/Azureโ”‚  โ”‚ MiMo+context โ”‚   โ”‚ tkinter    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜
       โ”‚ streams WAV to disk                                          โ”‚
       โ–ผ                                                             โ–ผ
   MP3 archive โ—€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€  SessionManager
                                                             (JSON + Markdown)

See docs/ARCHITECTURE.md for details.

Quick Start

Requirements: Python 3.11+, microphone access, a MiMo API key (Azure key only for the Azure engine).

pip install -r requirements.txt
python main.py

On first launch the settings dialog opens automatically: enter your MiMo API key and choose local (faster-whisper, downloads the model on first run) or azure (Azure Speech key required).

Configuration options:

  1. In-app settings (recommended) โ€” keys are stored in the system keyring when available
  2. Environment variables โ€” see .env.example (LECTRANS_* overrides)
  3. Config file โ€” ~/.lectrans/config.json (only used when keyring is unavailable)

Build Windows EXE

build.bat

Produces dist\LecTrans.exe from a portable LecTrans.spec (no hard-coded paths). Note: the exe bundles the Azure engine only; use the source install for offline faster-whisper. See BUILD_GUIDE.md.

Testing

pip install -r requirements-dev.txt
python -m unittest discover -s tests -t . -v   # or pytest
python -m ruff check .

CI (GitHub Actions) runs unit tests, compile checks and ruff on Windows.

Project Layout

lectrans/
โ”œโ”€โ”€ main.py                  # entry point (dotenv โ†’ logging โ†’ UI)
โ”œโ”€โ”€ config.py                # JSON + keyring + env overrides
โ”œโ”€โ”€ core/                    # audio pipeline, recognizers, translator, sessions, logging
โ”œโ”€โ”€ ui/                      # tkinter UI (design system, main window, dialogs)
โ”œโ”€โ”€ prompts/templates.py     # translation / summary prompts and glossary
โ”œโ”€โ”€ tests/                   # unittest suite (optional deps auto-skipped)
โ”œโ”€โ”€ docs/                    # PRD / architecture / UI spec
โ””โ”€โ”€ LecTrans.spec            # portable PyInstaller config

Data Directory

Path Content
~/.lectrans/config.json Settings (LECTRANS_HOME overrides the root)
~/.lectrans/sessions/ Session JSON files
~/.lectrans/recordings/ Lecture recordings (WAV/MP3)
~/.lectrans/lectrans.log Rotating log (1MB ร— 3)

License

MIT License, see LICENSE.


๐Ÿ‡จ๐Ÿ‡ณ ็ฎ€ไฝ“ไธญๆ–‡

้กน็›ฎ็ฎ€ไป‹

LecTrans ๆ˜ฏไธ€ๆฌพไธ“ไธบๅœจ้Ÿฉไธญๅ›ฝ็•™ๅญฆ็”Ÿๆ‰“้€ ็š„ๅฎžๆ—ถ่ฏพๅ ‚็ฟป่ฏ‘ๆกŒ้ขๅทฅๅ…ท๏ผš่ฏพๅ ‚ไธŠ้‡‡้›†ๆ•™ๆŽˆ่ฏญ้Ÿณ๏ผŒ ่ฏ†ๅˆซไธบ้Ÿฉ่ฏญๆ–‡ๆœฌๅŽ่ฐƒ็”จๅฐ็ฑณ MiMo ๅคงๆจกๅž‹็ฟป่ฏ‘ๆˆไธญๆ–‡๏ผŒๅŒๆ ๅฏน็…งๅฑ•็คบ๏ผ›่ฏพๅŽ่‡ชๅŠจไฟๅญ˜ๅฝ•้ŸณไธŽ ไผš่ฏ๏ผŒ็”Ÿๆˆ็ป“ๆž„ๅŒ–็ฌ”่ฎฐๅนถๅฏผๅ‡บ Markdownใ€‚

้กน็›ฎๅœจ MiMo Code ๅๅŠฉไธ‹ๅฎŒๆˆๅผ€ๅ‘๏ผŒไธป่ฆ่งฃๅ†ณๅ››ไธช็—›็‚น๏ผš

  • ๐ŸŽง ่ฏญ่จ€้šœ็ข๏ผš้Ÿฉ่ฏญๆŽˆ่ฏพๅฎžๆ—ถๅฌไธๆ‡‚
  • ๐Ÿ“ ็ฌ”่ฎฐๆ•ˆ็އ๏ผšๆ‰‹ๅŠจ็ฟป่ฏ‘่ทŸไธไธŠ่ฏพๅ ‚่Š‚ๅฅ
  • ๐Ÿ”‡ ่ฏพๅ ‚็คผไปช๏ผšๅ…จ็จ‹้™้Ÿณใ€ๆš—่‰ฒ็•Œ้ข๏ผŒไธๆ‰“ๆ‰ฐไป–ไบบ
  • ๐Ÿ“š ่ฏพๅŽๅคไน ๏ผš่‡ชๅŠจไฟๅญ˜ๅŒ่ฏญ่ฎฐๅฝ•ไธŽ่ฏพๅ ‚ๆ€ป็ป“

ๅŠŸ่ƒฝ็‰นๆ€ง

ๅŠŸ่ƒฝ ่ฏดๆ˜Ž
ๅŒ ASR ๅผ•ๆ“Ž ๆœฌๅœฐ faster-whisper๏ผˆ็ฆป็บฟใ€่‡ช้€‚ๅบ”่ƒฝ้‡ VAD๏ผ‰ๆˆ– Azure Speech๏ผˆไบ‘็ซฏ๏ผ‰
ไธŠไธ‹ๆ–‡็ฟป่ฏ‘ ็ฟป่ฏ‘ๆ—ถๆบๅธฆๆœ€่ฟ‘ N ๆกๅŒ่ฏญๅฏน็…ง๏ผŒๆœฏ่ฏญไธŽๆŒ‡ไปฃๆ›ด่ฟž่ดฏ
ๆœฏ่ฏญๅขžๅผบ ๅ†…็ฝฎ่ฎก็ฎ—ๆœบ้Ÿฉไธญๆœฏ่ฏญ่กจ๏ผŒPrompt ่‡ชๅŠจๆณจๅ…ฅ
ๅ•่ทฏ้Ÿณ้ข‘็ฎก็บฟ ไธ€ๆฌก้‡‡้›†ๅŒๆ—ถ็”จไบŽ่ฏ†ๅˆซไธŽๅฝ•้Ÿณ๏ผŒ้ฟๅ…่ฎพๅค‡ไบ‰ๆŠข
ๅฝ•้Ÿณๅญ˜ๆกฃ ่พนๅฝ•่พนๅ†™ WAV๏ผŒๅœๆญขๅŽ่ฝฌ MP3๏ผˆ็ผบ ffmpeg ่‡ชๅŠจๅ›ž้€€ WAV๏ผ‰
ไธ€้”ฎๆ€ป็ป“ ็”Ÿๆˆใ€Œๆ ธๅฟƒๆฆ‚ๅฟต / ้‡่ฆ็Ÿฅ่ฏ†็‚น / ไฝœไธš่€ƒ่ฏ• / ๅพ…็กฎ่ฎค้—ฎ้ข˜ใ€็ป“ๆž„ๅŒ–็ฌ”่ฎฐ
ๅކๅฒ็ฎก็† ไผš่ฏๅˆ—่กจใ€ๅŒ่ฏญๅ›ž็œ‹ใ€ๅฝ•้Ÿณๆ’ญๆ”พใ€ๅฎšไฝๆ–‡ไปถใ€ๅˆ ้™คใ€ๅฏผๅ‡บ Markdown
ๅฎ‰้™ๆจกๅผ Apple ้ฃŽๆ ผๆทฑ่‰ฒ UI๏ผŒๆ— ไปปไฝ•ๅฃฐ้Ÿณ่พ“ๅ‡บ

่ทฏ็บฟๅ›พ

  • MiMo TTS ่ฏญ้Ÿณๆ’ญๆŠฅ๏ผšๅฐ†่ฏ‘ๆ–‡ๅฎžๆ—ถๅˆๆˆไธบ่ฏญ้Ÿณ๏ผŒ้€š่ฟ‡่€ณๆœบไฝŽ้Ÿณ้‡ๆ’ญๆ”พ๏ผŒ่ฟ›ไธ€ๆญฅ่ทจ่ถŠ่ฏญ่จ€้šœ็ข
  • ็ฟป่ฏ‘ๆตๅผ่พ“ๅ‡บ๏ผˆๅฝ“ๅ‰ไธบๆ•ดๅฅ่ฟ”ๅ›ž๏ผ‰
  • ๅฏผๅ‡บ PDF / Word
  • ๅคš่ฏญ่จ€ๅฏนๆ‰ฉๅฑ•๏ผˆ่‹ฑ่ฏญใ€ๆ—ฅ่ฏญ๏ผ‰

ๆžถๆž„

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ AudioRecorderโ”‚โ”€โ”€โ–ถโ”‚ ASR                โ”‚โ”€โ”€โ–ถโ”‚ ็ฟป่ฏ‘ Worker   โ”‚โ”€โ”€โ–ถโ”‚ UI ๅŒๆ ๅฑ•็คบ โ”‚
โ”‚ ๅ•่ทฏ้‡‡้›†      โ”‚   โ”‚ faster-whisper/Azureโ”‚  โ”‚ MiMo + ไธŠไธ‹ๆ–‡ โ”‚   โ”‚ tkinter    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜
       โ”‚ ่พนๅฝ•่พนๅ†™ WAV                                                โ”‚
       โ–ผ                                                             โ–ผ
   MP3 ๅญ˜ๆกฃ โ—€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€  SessionManager
                                                              (JSON + Markdown)

่ฏฆ็ป†่ฎพ่ฎก่ง docs/ARCHITECTURE.mdใ€‚

ๅฟซ้€Ÿๅผ€ๅง‹

็Žฏๅขƒ่ฆๆฑ‚๏ผšPython 3.11+ใ€้บฆๅ…‹้ฃŽๆƒ้™ใ€MiMo API Key๏ผˆไป… Azure ๅผ•ๆ“Ž้œ€่ฆ Azure Key๏ผ‰ใ€‚

pip install -r requirements.txt
python main.py

้ฆ–ๆฌกๅฏๅŠจไผš่‡ชๅŠจๅผนๅ‡บ่ฎพ็ฝฎ็ช—ๅฃ๏ผšๅกซๅ…ฅ MiMo API Key๏ผŒๅนถ้€‰ๆ‹ฉ local๏ผˆๆœฌๅœฐ faster-whisper๏ผŒ ้ฆ–ๆฌก่ฟ่กŒ่‡ชๅŠจไธ‹่ฝฝๆจกๅž‹๏ผ‰ๆˆ– azure๏ผˆ้œ€่ฆ Azure Speech Key๏ผ‰ใ€‚

้…็ฝฎๆ–นๅผ๏ผš

  1. ๅบ”็”จๅ†…่ฎพ็ฝฎ๏ผˆๆŽจ่๏ผ‰๏ผšๅฏ†้’ฅไผ˜ๅ…ˆๅ†™ๅ…ฅ็ณป็ปŸ้’ฅๅŒ™ไธฒ
  2. ็Žฏๅขƒๅ˜้‡่ฆ†็›–๏ผš่ง .env.example๏ผŒๆ”ฏๆŒ LECTRANS_* ๅ˜้‡
  3. ้…็ฝฎๆ–‡ไปถ๏ผš~/.lectrans/config.json๏ผˆkeyring ไธๅฏ็”จๆ—ถๅฏ†้’ฅๆ‰่ฝ็›˜๏ผ‰

ๆ‰“ๅŒ… Windows EXE

build.bat

ไบง็‰ฉไธบ dist\LecTrans.exe๏ผˆๅŸบไบŽๅฏ็งปๆค็š„ LecTrans.spec๏ผŒๆ— ็กฌ็ผ–็ ่ทฏๅพ„๏ผ‰ใ€‚ ๆณจ๏ผšexe ๅ†…็ฝฎ Azure ๅผ•ๆ“Ž๏ผ›้œ€่ฆๆœฌๅœฐ faster-whisper ็ฆป็บฟ่ฏ†ๅˆซๆ—ถ่ฏท็”จๆบ็ ่ฟ่กŒใ€‚ ่ฏฆ่ง BUILD_GUIDE.mdใ€‚

ๆต‹่ฏ•

pip install -r requirements-dev.txt
python -m unittest discover -s tests -t . -v   # ๆˆ– pytest
python -m ruff check .

CI๏ผˆGitHub Actions๏ผ‰ๅœจ Windows ไธŠ่ฟ่กŒๅ•ๅ…ƒๆต‹่ฏ•ใ€็ผ–่ฏ‘ๆฃ€ๆŸฅไธŽ ruff ๆฃ€ๆŸฅใ€‚

็›ฎๅฝ•็ป“ๆž„

lectrans/
โ”œโ”€โ”€ main.py                  # ๅ…ฅๅฃ๏ผˆๅŠ ่ฝฝ .envใ€ๅˆๅง‹ๅŒ–ๆ—ฅๅฟ—ใ€ๅฏๅŠจ UI๏ผ‰
โ”œโ”€โ”€ config.py                # ้…็ฝฎ๏ผšJSON + keyring + ็Žฏๅขƒๅ˜้‡่ฆ†็›–
โ”œโ”€โ”€ core/                    # ้Ÿณ้ข‘็ฎก็บฟใ€่ฏ†ๅˆซๅ™จใ€็ฟป่ฏ‘ใ€ไผš่ฏใ€ๆ—ฅๅฟ—
โ”œโ”€โ”€ ui/                      # tkinter ็•Œ้ข๏ผˆ่ฎพ่ฎก็ณป็ปŸใ€ไธป็ช—ใ€ๅฏน่ฏๆก†๏ผ‰
โ”œโ”€โ”€ prompts/templates.py     # ็ฟป่ฏ‘/ๆ€ป็ป“ Prompt ไธŽๆœฏ่ฏญ่กจ
โ”œโ”€โ”€ tests/                   # unittest ๆต‹่ฏ•๏ผˆๅฏ้€‰ไพ่ต–่‡ชๅŠจ่ทณ่ฟ‡๏ผ‰
โ”œโ”€โ”€ docs/                    # PRD / ๆžถๆž„ / UI ่ง„่Œƒ
โ””โ”€โ”€ LecTrans.spec            # ๅฏ็งปๆค PyInstaller ้…็ฝฎ

ๆ•ฐๆฎ็›ฎๅฝ•

่ทฏๅพ„ ๅ†…ๅฎน
~/.lectrans/config.json ้…็ฝฎ๏ผˆๅฏ็”จ LECTRANS_HOME ่ฆ†็›–ๆ น็›ฎๅฝ•๏ผ‰
~/.lectrans/sessions/ ไผš่ฏ JSON
~/.lectrans/recordings/ ่ฏพๅ ‚ๅฝ•้Ÿณ๏ผˆWAV/MP3๏ผ‰
~/.lectrans/lectrans.log ่ฟ่กŒๆ—ฅๅฟ—๏ผˆๆปšๅŠจ 1MB ร— 3๏ผ‰

License

MIT License๏ผŒ่ฏฆ่ง LICENSEใ€‚


Made with โค๏ธ for international students in South Korea ยท Built with MiMo Code

About

๐ŸŽ“ LecTrans - Real-time Korean-to-Chinese lecture translation tool for international students. Uses MiMo API for ASR and translation.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages