Skip to content

Conversation

Copy link

Copilot AI commented Aug 26, 2025

This PR implements support for square bracket notation [...] to send Morse code characters without inter-character spacing, addressing the need to transmit character combinations like [AR] and [ホレ] as single concatenated patterns.

Problem

In Japanese and European Morse code, certain character combinations are sometimes transmitted as continuous patterns without the standard inter-character spacing. For example:

  • AR is normally sent as .- .-. (with space between A and R)
  • [AR] should be sent as .-.- (concatenated without space)
  • Japanese characters like ホレ can similarly be concatenated as [ホレ]

Solution

The implementation adds bracket parsing to the get_morse_str() function:

  1. Bracket Detection: Parses [...] patterns in input strings
  2. Pattern Concatenation: Combines individual Morse patterns into single patterns
  3. Binary Merging: Efficiently concatenates the binary representations of multiple characters
  4. Audio Integration: Updates CW audio generation to handle concatenated patterns correctly

Examples

// Normal transmission with inter-character spacing
get_morse_str("AR".to_string())
// Returns: [(2, 0b01), (0, 0), (3, 0b010)]  // A + space + R

// Concatenated transmission without spacing  
get_morse_str("[AR]".to_string())
// Returns: [(5, 0b01010)]  // Combined A+R pattern

// Works with Japanese characters too
get_morse_str("[ホレ]".to_string())
// Returns: [(6, 0b100111)]  // Combined ホ+レ pattern

Key Features

  • Backward Compatibility: All existing functionality remains unchanged
  • Multi-language Support: Works with both Latin and Japanese characters
  • Audio Generation: CW audio correctly produces shorter transmissions for bracketed text
  • Edge Case Handling: Supports empty brackets, unmatched brackets, and mixed content
  • Comprehensive Testing: Includes tests for various scenarios and audio verification

The generated audio files confirm the implementation works correctly - bracketed versions produce shorter audio due to eliminated inter-character spacing.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] I would like to throw a pull request on this. In Japanese and European Morse, two characters are sometimes sent in succession, as in ホレ and AR. The Morse code for A is .- and R is .-. and usually when we send AR, we use .-.-. with a space between t... Add square bracket notation for concatenated Morse code transmission Aug 26, 2025
Copilot AI requested a review from Graphium314 August 26, 2025 10:30
Copilot finished work on behalf of Graphium314 August 26, 2025 10:30
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.

2 participants