Spaces:
Sleeping
Sleeping
Update README.md
Browse files
README.md
CHANGED
@@ -11,4 +11,93 @@ license: apache-2.0
|
|
11 |
short_description: Converts text to morse code and tunes
|
12 |
---
|
13 |
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
short_description: Converts text to morse code and tunes
|
12 |
---
|
13 |
|
14 |
+
# morse-tunes
|
15 |
+
|
16 |
+
**MorseTunes** is a Python library and Gradio-based app that lets you convert text to Morse code and optionally play the Morse code as audio. Use it as a Python library, command-line tool, or through a web-based Gradio interface.
|
17 |
+
|
18 |
+
## Features
|
19 |
+
|
20 |
+
- **Text to Morse Code Conversion:** Converts any text into the equivalent Morse code.
|
21 |
+
- **Audio Playback:** Plays Morse code as audio tunes (dot and dash sounds).
|
22 |
+
- **Interactive Web App:** Use a Gradio interface for a user-friendly experience.
|
23 |
+
- **Simple to Use:** Works as a standalone Python library or through a Gradio app.
|
24 |
+
|
25 |
+
## Installation
|
26 |
+
|
27 |
+
1. Clone the repository:
|
28 |
+
|
29 |
+
```bash
|
30 |
+
git clone https://github.com/wisalkhanmv/morsetunes.git
|
31 |
+
cd morsetunes
|
32 |
+
```
|
33 |
+
|
34 |
+
2. Install the dependencies:
|
35 |
+
```bash
|
36 |
+
pip install -r requirements.txt
|
37 |
+
```
|
38 |
+
|
39 |
+
## Usage
|
40 |
+
|
41 |
+
### Gradio Web App
|
42 |
+
|
43 |
+
Run the Gradio app to interact with **MorseTunes** in your browser:
|
44 |
+
|
45 |
+
```bash
|
46 |
+
python main.py
|
47 |
+
```
|
48 |
+
|
49 |
+
Open the provided link in your browser (default is `http://127.0.0.1:7860`) to use the app. Enter text to convert it into Morse code and optionally play the audio.
|
50 |
+
|
51 |
+
### Python Code Integration
|
52 |
+
|
53 |
+
Use **MorseTunes** as a Python library in your projects.
|
54 |
+
|
55 |
+
#### Example: Convert Text to Morse Code
|
56 |
+
|
57 |
+
```python
|
58 |
+
from morse_tunes.morse import text_to_morse
|
59 |
+
|
60 |
+
text = "Hello World"
|
61 |
+
morse_code = text_to_morse(text)
|
62 |
+
print(f"Morse Code: {morse_code}")
|
63 |
+
```
|
64 |
+
|
65 |
+
#### Example: Play Morse Code as Audio
|
66 |
+
|
67 |
+
```python
|
68 |
+
from morse_tunes.audio import play_morse
|
69 |
+
|
70 |
+
morse_code = "... --- ..."
|
71 |
+
play_morse(morse_code)
|
72 |
+
```
|
73 |
+
|
74 |
+
### Command Line Tool
|
75 |
+
|
76 |
+
If you want a command-line interface, you can use the `main.py` file as a simple script:
|
77 |
+
|
78 |
+
```bash
|
79 |
+
python main.py
|
80 |
+
```
|
81 |
+
|
82 |
+
## How It Works
|
83 |
+
|
84 |
+
1. **Text Conversion:** The library converts each letter in your text to its Morse code equivalent using a predefined dictionary.
|
85 |
+
2. **Audio Playback:** The library generates sounds using `winsound` (Windows). Each dot (`.`) is a short beep, and each dash (`-`) is a longer beep.
|
86 |
+
3. **Gradio App:** The interactive interface uses the Gradio library to make it easy to use in a web browser.
|
87 |
+
|
88 |
+
## Development
|
89 |
+
|
90 |
+
Feel free to contribute! Clone the repository and make your changes.
|
91 |
+
|
92 |
+
```bash
|
93 |
+
git clone https://github.com/yourusername/morsetunes.git
|
94 |
+
cd morsetunes
|
95 |
+
```
|
96 |
+
|
97 |
+
## License
|
98 |
+
|
99 |
+
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
|
100 |
+
|
101 |
+
---
|
102 |
+
|
103 |
+
Enjoy coding and learning with MorseTunes!
|