모르스_부호_변환기
차이
문서의 선택한 두 판 사이의 차이를 보여줍니다.
| 양쪽 이전 판이전 판 | |||
| 모르스_부호_변환기 [2026/09/05 09:25] – akpil | 모르스_부호_변환기 [2026/09/05 09:28] (현재) – akpil | ||
|---|---|---|---|
| 줄 8: | 줄 8: | ||
| < | < | ||
| - | |||
| # 2026.09.05 | # 2026.09.05 | ||
| # morse-letter to morse ver 0.7 | # morse-letter to morse ver 0.7 | ||
| 줄 77: | 줄 76: | ||
| function playBeep(symbol) { | function playBeep(symbol) { | ||
| if (symbol === ' ' || symbol === '/' | if (symbol === ' ' || symbol === '/' | ||
| - | | + | |
| 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 = ' | oscillator.type = ' | ||
| oscillator.frequency.setValueAtTime(600, | oscillator.frequency.setValueAtTime(600, | ||
| - | | + | |
| const duration = (symbol === ' | const duration = (symbol === ' | ||
| gainNode.gain.setValueAtTime(0.1, | gainNode.gain.setValueAtTime(0.1, | ||
| - | | + | |
| oscillator.start(); | oscillator.start(); | ||
| oscillator.stop(audioCtx.currentTime + duration); | oscillator.stop(audioCtx.currentTime + duration); | ||
| - | | + | |
| return duration; // 재생된 시간 반환 | return duration; // 재생된 시간 반환 | ||
| } | } | ||
| 줄 102: | 줄 101: | ||
| unit.innerHTML = `<span class=" | unit.innerHTML = `<span class=" | ||
| 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 === '/' | if (symbol === '/' | ||
| // 스페이스 기호가 나오면 0.3초(300ms) 동안 대기 | // 스페이스 기호가 나오면 0.3초(300ms) 동안 대기 | ||
| 줄 137: | 줄 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({ | ||
| 줄 144: | 줄 143: | ||
| ' | ' | ||
| }) | }) | ||
| - | | + | |
| return render_template_string(HTML_TEMPLATE, | return render_template_string(HTML_TEMPLATE, | ||
모르스_부호_변환기.txt · 마지막으로 수정됨: 저자 akpil
