File size: 1,731 Bytes
52f2fae
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64

---<!DOCTYPE html>
<html lang="ha">
<head>
    <meta charset="UTF-8">
    <title>Mai Karanta Rubutun Hausa</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f5f5f5;
            text-align: center;
            padding: 20px;
        }
        textarea {
            width: 90%;
            height: 200px;
            font-size: 18px;
            padding: 10px;
        }
        button {
            font-size: 18px;
            margin: 10px;
            padding: 10px 20px;
            cursor: pointer;
            border-radius: 10px;
        }
        #playBtn {
            background-color: green;
            color: white;
        }
    </style>
</head>
<body>
    <h1>Mai Karanta Rubutun Hausa</h1>
    <textarea id="rubutu" placeholder="Shigar da rubutun Hausa anan..."></textarea><br>
    <button id="playBtn" onclick="karantaRubutu()">Karanta da Murya</button>

    <script>
        function karantaRubutu() {
            const rubutu = document.getElementById("rubutu").value;
            if (!rubutu.trim()) {
                alert("Da farko shigar da rubutun Hausa.");
                return;
            }

            const msg = new SpeechSynthesisUtterance(rubutu);
            msg.lang = 'ha'; // Hausa language code
            msg.rate = 1;
            msg.pitch = 1;

            // Fall-back: idan browser baya goyan bayan Hausa sosai
            const supportedVoices = speechSynthesis.getVoices();
            const hausaVoice = supportedVoices.find(v => v.lang.startsWith('ha'));
            if (hausaVoice) {
                msg.voice = hausaVoice;
            }

            speechSynthesis.speak(msg);
        }
    </script>
</body>
</html>