사용자 도구

사이트 도구


모르스_부호_변환기

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판이전 판
다음 판
이전 판
모르스_부호_변환기 [2026/09/05 08:30] akpil모르스_부호_변환기 [2026/09/05 09:28] (현재) akpil
줄 8: 줄 8:
  
 <code> <code>
 +# 2026.09.05 
 +# morse-letter to morse ver 0.7
 +# written by 6K2LSV
 +# python3 에서 작동
 +# pip3 install flask jamo 
 +# port number 3040
  
-# 2026.03.18 # morse-letter to morse ver 0.4 # written by 6K2LSV (SeungWoon Lee) # python3 에서 작동 # pip3 install flask jamo # port number 3040 
 from flask import Flask, request, render_template_string from flask import Flask, request, render_template_string
 import json import json
줄 22: 줄 27:
     'ㅍ': '---.', 'ㅎ': '.---.', 'ㄺ' : '.-....-', 'ㄻ' : '.-..--', 'ㄼ' : '.-.....-',      'ㅍ': '---.', 'ㅎ': '.---.', 'ㄺ' : '.-....-', 'ㄻ' : '.-..--', 'ㄼ' : '.-.....-', 
     'ㄿ' : '.-....-.', 'ㅀ' : '.-..--..', 'ㄽ' : '..--...', 'ㄲ': '.-...-..',      'ㄿ' : '.-....-.', 'ㅀ' : '.-..--..', 'ㄽ' : '..--...', 'ㄲ': '.-...-..', 
-    'ㄳ' : '--....', 'ntz' : '.---.', 'ㄶ' : '.--...--.', 'ㄸ' : '..--', 'ㅃ' : '..--..', +    'ㄳ' : '--....', '' : '.---.', 'ㄶ' : '.--...--.', 'ㄸ' : '..--', 'ㅃ' : '..--..', 
     'ㅆ' : '......', 'ㅄ' : '---.--.-', 'ㅉ' : '..-...-.',     'ㅆ' : '......', 'ㅄ' : '---.--.-', 'ㅉ' : '..-...-.',
     'ㅏ' : '.', '야' : '..', 'ㅓ' : '-', 'ㅕ' : '...', 'ㅗ' : '.-', 'ㅛ' : '-.',      'ㅏ' : '.', '야' : '..', 'ㅓ' : '-', 'ㅕ' : '...', 'ㅗ' : '.-', 'ㅛ' : '-.', 
줄 71: 줄 76:
             function playBeep(symbol) {             function playBeep(symbol) {
                 if (symbol === ' ' || symbol === '/') return 0; // 공백일 때는 비프음 소요 시간 0 반환                 if (symbol === ' ' || symbol === '/') return 0; // 공백일 때는 비프음 소요 시간 0 반환
-                +
                 const oscillator = audioCtx.createOscillator();                 const oscillator = audioCtx.createOscillator();
                 const gainNode = audioCtx.createGain();                 const gainNode = audioCtx.createGain();
-                +
                 oscillator.connect(gainNode);                 oscillator.connect(gainNode);
                 gainNode.connect(audioCtx.destination);                 gainNode.connect(audioCtx.destination);
                 oscillator.type = 'sine';                 oscillator.type = 'sine';
                 oscillator.frequency.setValueAtTime(600, audioCtx.currentTime);                 oscillator.frequency.setValueAtTime(600, audioCtx.currentTime);
-                +
                 const duration = (symbol === '-') ? 0.2 : 0.07;                 const duration = (symbol === '-') ? 0.2 : 0.07;
                 gainNode.gain.setValueAtTime(0.1, audioCtx.currentTime);                 gainNode.gain.setValueAtTime(0.1, audioCtx.currentTime);
-                +
                 oscillator.start();                 oscillator.start();
                 oscillator.stop(audioCtx.currentTime + duration);                 oscillator.stop(audioCtx.currentTime + duration);
-                +
                 return duration; // 재생된 시간 반환                 return duration; // 재생된 시간 반환
             }             }
줄 96: 줄 101:
                     unit.innerHTML = `<span class="char">${item.char === ' ' ? '공백' : item.char}</span><span class="morse" id="m-${item.id}"></span>`;                     unit.innerHTML = `<span class="char">${item.char === ' ' ? '공백' : item.char}</span><span class="morse" id="m-${item.id}"></span>`;
                     displayArea.appendChild(unit);                     displayArea.appendChild(unit);
-                    +
                     const morseSpan = document.getElementById(`m-${item.id}`);                     const morseSpan = document.getElementById(`m-${item.id}`);
-                    +
                     // 해당 문자의 모르스 부호를 한 기호씩 출력                     // 해당 문자의 모르스 부호를 한 기호씩 출력
                     for (const symbol of item.morse) {                     for (const symbol of item.morse) {
                         morseSpan.innerText += symbol;                         morseSpan.innerText += symbol;
-                        +
                         if (symbol === '/' || symbol === ' ') {                         if (symbol === '/' || symbol === ' ') {
                             // 스페이스 기호가 나오면 0.3초(300ms) 동안 대기                             // 스페이스 기호가 나오면 0.3초(300ms) 동안 대기
줄 131: 줄 136:
         # 자모 분리 및 대문자화         # 자모 분리 및 대문자화
         processed_chars = list(j2hcj(h2j(input_text.upper())))         processed_chars = list(j2hcj(h2j(input_text.upper())))
-        +
         for i, char in enumerate(processed_chars):         for i, char in enumerate(processed_chars):
             pair_data.append({             pair_data.append({
줄 138: 줄 143:
                 'morse': MORSE_DICT.get(char, char)                 'morse': MORSE_DICT.get(char, char)
             })             })
-            +
     return render_template_string(HTML_TEMPLATE, pair_data=pair_data, input_text=input_text)     return render_template_string(HTML_TEMPLATE, pair_data=pair_data, input_text=input_text)
  
 if __name__ == '__main__': if __name__ == '__main__':
-    app.run(host='0.0.0.0', port=8080, debug=False)+    app.run(host='0.0.0.0', port=3040, debug=False)
  
  
모르스_부호_변환기.1788597016.txt.gz · 마지막으로 수정됨: 저자 akpil

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki