kazuyamaa/multi-language-messages-01 huggingface dataset:
Task: Fusc sequence
Go: package main

import (
    "fmt"
    "strconv"
)

func fusc(n int) []int {
    if n <= 0 {
        return []int{}
    }
    if n == 1 {
        return []int{0}
    }    
    res := make([]int, n)
    res[0] = 0
    res[1] = 1
    for i := 2; i < n; i++ {
        if i%2 == 0 {
            res[i] = res[i/2]
        } else {
            res[i] = res[(i-1)/2] + res[(i+1)/2]
        }
    }
    return res
}

func fuscMaxLen(n int) [][2]int {
    maxLen := -1
    maxFusc := -1
    f := fusc(n)
    var res [][2]int
    for i := 0; i < n; i++ {
        if f[i] <= maxFusc {
            continue 
        }
        maxFusc = f[i]
        le := len(strconv.Itoa(f[i]))
        if le > maxLen {
            res = append(res, [2]int{i, f[i]})
            maxLen = le
        }
    }
    return res
}

func commatize(n int) string {
    s := fmt.Sprintf("%d", n)
    if n < 0 {
        s = s[1:]
    }
    le := len(s)
    for i := le - 3; i >= 1; i -= 3 {
        s = s[0:i] + "," + s[i:]
    }
    if n >= 0 {
        return s
    }
    return "-" + s
}

func main() {
    fmt.Println("The first 61 fusc numbers are:")
    fmt.Println(fusc(61))
    fmt.Println("\nThe fusc numbers whose length > any previous fusc number length are:")
    res := fuscMaxLen(20000000)  
    for i := 0; i < len(res); i++ {
        fmt.Printf("%7s (index %10s)\n", commatize(res[i][1]), commatize(res[i][0]))
    }
}

Java: public class FuscSequence {

    public static void main(String[] args) {
        System.out.println("Show the first 61 fusc numbers (starting at zero) in a horizontal format");
        for ( int n = 0 ; n < 61 ; n++ ) {
            System.out.printf("%,d ", fusc[n]);
        }
        
        System.out.printf("%n%nShow the fusc number (and its index) whose length is greater than any previous fusc number length.%n");
        int start = 0;
        for (int i = 0 ; i <= 5 ; i++ ) {
            int val = i != 0 ? (int) Math.pow(10, i) : -1;
            for ( int j = start ; j < FUSC_MAX ; j++ ) {
                if ( fusc[j] > val ) {
                    System.out.printf("fusc[%,d] = %,d%n", j, fusc[j] );
                    start = j;
                    break;
                }
            }
        }
    }
    
    private static final int FUSC_MAX = 30000000;
    private static int[] fusc = new int[FUSC_MAX];

    static {
        fusc[0] = 0;
        fusc[1] = 1;
        for ( int n = 2 ; n < FUSC_MAX ; n++ ) {
            fusc[n] = (n % 2 == 0 ? fusc[n/2] : fusc[(n-1)/2] + fusc[(n+1)/2]);
        }
    }
}
Task: Fusc sequence
Java: public class FuscSequence {

    public static void main(String[] args) {
        System.out.println("Show the first 61 fusc numbers (starting at zero) in a horizontal format");
        for ( int n = 0 ; n < 61 ; n++ ) {
            System.out.printf("%,d ", fusc[n]);
        }
        
        System.out.printf("%n%nShow the fusc number (and its index) whose length is greater than any previous fusc number length.%n");
        int start = 0;
        for (int i = 0 ; i <= 5 ; i++ ) {
            int val = i != 0 ? (int) Math.pow(10, i) : -1;
            for ( int j = start ; j < FUSC_MAX ; j++ ) {
                if ( fusc[j] > val ) {
                    System.out.printf("fusc[%,d] = %,d%n", j, fusc[j] );
                    start = j;
                    break;
                }
            }
        }
    }
    
    private static final int FUSC_MAX = 30000000;
    private static int[] fusc = new int[FUSC_MAX];

    static {
        fusc[0] = 0;
        fusc[1] = 1;
        for ( int n = 2 ; n < FUSC_MAX ; n++ ) {
            fusc[n] = (n % 2 == 0 ? fusc[n/2] : fusc[(n-1)/2] + fusc[(n+1)/2]);
        }
    }
}

Python: from collections import deque
from itertools import islice, count


def fusc():
    q = deque([1])
    yield 0
    yield 1

    while True:
        x = q.popleft()
        q.append(x)
        yield x

        x += q[0]
        q.append(x)
        yield x


def longest_fusc():
    sofar = 0
    for i, f in zip(count(), fusc()):
        if f >= sofar:
            yield(i, f)
            sofar = 10 * sofar or 10


print('First 61:')
print(list(islice(fusc(), 61)))

print('\nLength records:')
for i, f in islice(longest_fusc(), 6):
    print(f'fusc({i}) = {f}')
Task: Fusc sequence
Go: package main

import (
    "fmt"
    "strconv"
)

func fusc(n int) []int {
    if n <= 0 {
        return []int{}
    }
    if n == 1 {
        return []int{0}
    }    
    res := make([]int, n)
    res[0] = 0
    res[1] = 1
    for i := 2; i < n; i++ {
        if i%2 == 0 {
            res[i] = res[i/2]
        } else {
            res[i] = res[(i-1)/2] + res[(i+1)/2]
        }
    }
    return res
}

func fuscMaxLen(n int) [][2]int {
    maxLen := -1
    maxFusc := -1
    f := fusc(n)
    var res [][2]int
    for i := 0; i < n; i++ {
        if f[i] <= maxFusc {
            continue 
        }
        maxFusc = f[i]
        le := len(strconv.Itoa(f[i]))
        if le > maxLen {
            res = append(res, [2]int{i, f[i]})
            maxLen = le
        }
    }
    return res
}

func commatize(n int) string {
    s := fmt.Sprintf("%d", n)
    if n < 0 {
        s = s[1:]
    }
    le := len(s)
    for i := le - 3; i >= 1; i -= 3 {
        s = s[0:i] + "," + s[i:]
    }
    if n >= 0 {
        return s
    }
    return "-" + s
}

func main() {
    fmt.Println("The first 61 fusc numbers are:")
    fmt.Println(fusc(61))
    fmt.Println("\nThe fusc numbers whose length > any previous fusc number length are:")
    res := fuscMaxLen(20000000)  
    for i := 0; i < len(res); i++ {
        fmt.Printf("%7s (index %10s)\n", commatize(res[i][1]), commatize(res[i][0]))
    }
}

Python: from collections import deque
from itertools import islice, count


def fusc():
    q = deque([1])
    yield 0
    yield 1

    while True:
        x = q.popleft()
        q.append(x)
        yield x

        x += q[0]
        q.append(x)
        yield x


def longest_fusc():
    sofar = 0
    for i, f in zip(count(), fusc()):
        if f >= sofar:
            yield(i, f)
            sofar = 10 * sofar or 10


print('First 61:')
print(list(islice(fusc(), 61)))

print('\nLength records:')
for i, f in islice(longest_fusc(), 6):
    print(f'fusc({i}) = {f}')
Task: Fusc sequence
Go: package main

import (
    "fmt"
    "strconv"
)

func fusc(n int) []int {
    if n <= 0 {
        return []int{}
    }
    if n == 1 {
        return []int{0}
    }    
    res := make([]int, n)
    res[0] = 0
    res[1] = 1
    for i := 2; i < n; i++ {
        if i%2 == 0 {
            res[i] = res[i/2]
        } else {
            res[i] = res[(i-1)/2] + res[(i+1)/2]
        }
    }
    return res
}

func fuscMaxLen(n int) [][2]int {
    maxLen := -1
    maxFusc := -1
    f := fusc(n)
    var res [][2]int
    for i := 0; i < n; i++ {
        if f[i] <= maxFusc {
            continue 
        }
        maxFusc = f[i]
        le := len(strconv.Itoa(f[i]))
        if le > maxLen {
            res = append(res, [2]int{i, f[i]})
            maxLen = le
        }
    }
    return res
}

func commatize(n int) string {
    s := fmt.Sprintf("%d", n)
    if n < 0 {
        s = s[1:]
    }
    le := len(s)
    for i := le - 3; i >= 1; i -= 3 {
        s = s[0:i] + "," + s[i:]
    }
    if n >= 0 {
        return s
    }
    return "-" + s
}

func main() {
    fmt.Println("The first 61 fusc numbers are:")
    fmt.Println(fusc(61))
    fmt.Println("\nThe fusc numbers whose length > any previous fusc number length are:")
    res := fuscMaxLen(20000000)  
    for i := 0; i < len(res); i++ {
        fmt.Printf("%7s (index %10s)\n", commatize(res[i][1]), commatize(res[i][0]))
    }
}

VB: Module Module1

    Dim n As Integer = 61, l As List(Of Integer) = {0, 1}.ToList

    Function fusc(n As Integer) As Integer
        If n < l.Count Then Return l(n)
        fusc = If((n And 1) = 0, l(n >> 1), l((n - 1) >> 1) + l((n + 1) >> 1))
        l.Add(fusc)
    End Function

    Sub Main(args As String())
        Dim lst As Boolean = True, w As Integer = -1, c As Integer = 0,
            fs As String = "{0,11:n0}  {1,-9:n0}", res As String = ""
        Console.WriteLine("First {0} numbers in the fusc sequence:", n)
        For i As Integer = 0 To Integer.MaxValue
            Dim f As Integer = fusc(i)
            If lst Then
                If i < 61 Then
                    Console.Write("{0} ", f)
                Else
                    lst = False
                    Console.WriteLine()
                    Console.WriteLine("Points in the sequence where an item has more digits than any previous items:")
                    Console.WriteLine(fs, "Index\", "/Value") : Console.WriteLine(res) : res = ""
                End If
            End If
            Dim t As Integer = f.ToString.Length
            If t > w Then
                w = t
                res &= If(res = "", "", vbLf) & String.Format(fs, i, f)
                If Not lst Then Console.WriteLine(res) : res = ""
                c += 1 : If c > 5 Then Exit For
            End If
        Next : l.Clear()
    End Sub
End Module
Task: Fusc sequence
Python: from collections import deque
from itertools import islice, count


def fusc():
    q = deque([1])
    yield 0
    yield 1

    while True:
        x = q.popleft()
        q.append(x)
        yield x

        x += q[0]
        q.append(x)
        yield x


def longest_fusc():
    sofar = 0
    for i, f in zip(count(), fusc()):
        if f >= sofar:
            yield(i, f)
            sofar = 10 * sofar or 10


print('First 61:')
print(list(islice(fusc(), 61)))

print('\nLength records:')
for i, f in islice(longest_fusc(), 6):
    print(f'fusc({i}) = {f}')

VB: Module Module1

    Dim n As Integer = 61, l As List(Of Integer) = {0, 1}.ToList

    Function fusc(n As Integer) As Integer
        If n < l.Count Then Return l(n)
        fusc = If((n And 1) = 0, l(n >> 1), l((n - 1) >> 1) + l((n + 1) >> 1))
        l.Add(fusc)
    End Function

    Sub Main(args As String())
        Dim lst As Boolean = True, w As Integer = -1, c As Integer = 0,
            fs As String = "{0,11:n0}  {1,-9:n0}", res As String = ""
        Console.WriteLine("First {0} numbers in the fusc sequence:", n)
        For i As Integer = 0 To Integer.MaxValue
            Dim f As Integer = fusc(i)
            If lst Then
                If i < 61 Then
                    Console.Write("{0} ", f)
                Else
                    lst = False
                    Console.WriteLine()
                    Console.WriteLine("Points in the sequence where an item has more digits than any previous items:")
                    Console.WriteLine(fs, "Index\", "/Value") : Console.WriteLine(res) : res = ""
                End If
            End If
            Dim t As Integer = f.ToString.Length
            If t > w Then
                w = t
                res &= If(res = "", "", vbLf) & String.Format(fs, i, f)
                If Not lst Then Console.WriteLine(res) : res = ""
                c += 1 : If c > 5 Then Exit For
            End If
        Next : l.Clear()
    End Sub
End Module
Task: Fusc sequence
C#: using System;
using System.Collections.Generic;

static class program
{
    static int n = 61;
    static List<int> l = new List<int>() { 0, 1 };

    static int fusc(int n)
    {
        if (n < l.Count) return l[n];
        int f = (n & 1) == 0 ? l[n >> 1] : l[(n - 1) >> 1] + l[(n + 1) >> 1];
        l.Add(f); return f;
    }

    static void Main(string[] args)
    {
        bool lst = true; int w = -1, c = 0, t;
        string fs = "{0,11:n0}  {1,-9:n0}", res = "";
        Console.WriteLine("First {0} numbers in the fusc sequence:", n);
        for (int i = 0; i < int.MaxValue; i++)
        {
            int f = fusc(i); if (lst)
            {
                if (i < 61) Console.Write("{0} ", f);
                else
                {
                    lst = false;
                    Console.WriteLine();
                    Console.WriteLine("Points in the sequence where an item has more digits than any previous items:");
                    Console.WriteLine(fs, "Index\\", "/Value"); Console.WriteLine(res); res = "";
                }
            }
            if ((t = f.ToString().Length) > w)
            {
                w = t; res += (res == "" ? "" : "\n") + string.Format(fs, i, f);
                if (!lst) { Console.WriteLine(res); res = ""; } if (++c > 5) break;
            }
        }
        l.Clear();
    }
}

VB: Module Module1

    Dim n As Integer = 61, l As List(Of Integer) = {0, 1}.ToList

    Function fusc(n As Integer) As Integer
        If n < l.Count Then Return l(n)
        fusc = If((n And 1) = 0, l(n >> 1), l((n - 1) >> 1) + l((n + 1) >> 1))
        l.Add(fusc)
    End Function

    Sub Main(args As String())
        Dim lst As Boolean = True, w As Integer = -1, c As Integer = 0,
            fs As String = "{0,11:n0}  {1,-9:n0}", res As String = ""
        Console.WriteLine("First {0} numbers in the fusc sequence:", n)
        For i As Integer = 0 To Integer.MaxValue
            Dim f As Integer = fusc(i)
            If lst Then
                If i < 61 Then
                    Console.Write("{0} ", f)
                Else
                    lst = False
                    Console.WriteLine()
                    Console.WriteLine("Points in the sequence where an item has more digits than any previous items:")
                    Console.WriteLine(fs, "Index\", "/Value") : Console.WriteLine(res) : res = ""
                End If
            End If
            Dim t As Integer = f.ToString.Length
            If t > w Then
                w = t
                res &= If(res = "", "", vbLf) & String.Format(fs, i, f)
                If Not lst Then Console.WriteLine(res) : res = ""
                c += 1 : If c > 5 Then Exit For
            End If
        Next : l.Clear()
    End Sub
End Module
Task: Fusc sequence
Java: public class FuscSequence {

    public static void main(String[] args) {
        System.out.println("Show the first 61 fusc numbers (starting at zero) in a horizontal format");
        for ( int n = 0 ; n < 61 ; n++ ) {
            System.out.printf("%,d ", fusc[n]);
        }
        
        System.out.printf("%n%nShow the fusc number (and its index) whose length is greater than any previous fusc number length.%n");
        int start = 0;
        for (int i = 0 ; i <= 5 ; i++ ) {
            int val = i != 0 ? (int) Math.pow(10, i) : -1;
            for ( int j = start ; j < FUSC_MAX ; j++ ) {
                if ( fusc[j] > val ) {
                    System.out.printf("fusc[%,d] = %,d%n", j, fusc[j] );
                    start = j;
                    break;
                }
            }
        }
    }
    
    private static final int FUSC_MAX = 30000000;
    private static int[] fusc = new int[FUSC_MAX];

    static {
        fusc[0] = 0;
        fusc[1] = 1;
        for ( int n = 2 ; n < FUSC_MAX ; n++ ) {
            fusc[n] = (n % 2 == 0 ? fusc[n/2] : fusc[(n-1)/2] + fusc[(n+1)/2]);
        }
    }
}

VB: Module Module1

    Dim n As Integer = 61, l As List(Of Integer) = {0, 1}.ToList

    Function fusc(n As Integer) As Integer
        If n < l.Count Then Return l(n)
        fusc = If((n And 1) = 0, l(n >> 1), l((n - 1) >> 1) + l((n + 1) >> 1))
        l.Add(fusc)
    End Function

    Sub Main(args As String())
        Dim lst As Boolean = True, w As Integer = -1, c As Integer = 0,
            fs As String = "{0,11:n0}  {1,-9:n0}", res As String = ""
        Console.WriteLine("First {0} numbers in the fusc sequence:", n)
        For i As Integer = 0 To Integer.MaxValue
            Dim f As Integer = fusc(i)
            If lst Then
                If i < 61 Then
                    Console.Write("{0} ", f)
                Else
                    lst = False
                    Console.WriteLine()
                    Console.WriteLine("Points in the sequence where an item has more digits than any previous items:")
                    Console.WriteLine(fs, "Index\", "/Value") : Console.WriteLine(res) : res = ""
                End If
            End If
            Dim t As Integer = f.ToString.Length
            If t > w Then
                w = t
                res &= If(res = "", "", vbLf) & String.Format(fs, i, f)
                If Not lst Then Console.WriteLine(res) : res = ""
                c += 1 : If c > 5 Then Exit For
            End If
        Next : l.Clear()
    End Sub
End Module
Task: Speech synthesis
C: #include <sys/wait.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

void talk(const char *s)
{
	pid_t pid;
	int status;

	pid = fork();
	if (pid < 0) {
		perror("fork");
		exit(1);
	}

	if (pid == 0) {
		execlp("espeak", "espeak", s, (void*)0);
		perror("espeak");
		_exit(1);
	}

	waitpid(pid, &status, 0);
	if (!WIFEXITED(status) || WEXITSTATUS(status) != 0)
		exit(1);
}

int main()
{
	talk("This is an example of speech synthesis.");
	return 0;
}

C#: using SpeechLib;

namespace Speaking_Computer
{
  public class Program
  {
    private static void Main()
    {
      var voice = new SpVoice();
      voice.Speak("This is an example of speech synthesis.");
    }
  }
}
Task: Speech synthesis
C: #include <sys/wait.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

void talk(const char *s)
{
	pid_t pid;
	int status;

	pid = fork();
	if (pid < 0) {
		perror("fork");
		exit(1);
	}

	if (pid == 0) {
		execlp("espeak", "espeak", s, (void*)0);
		perror("espeak");
		_exit(1);
	}

	waitpid(pid, &status, 0);
	if (!WIFEXITED(status) || WEXITSTATUS(status) != 0)
		exit(1);
}

int main()
{
	talk("This is an example of speech synthesis.");
	return 0;
}

Python: import pyttsx

engine = pyttsx.init()
engine.say("It was all a dream.")
engine.runAndWait()
Task: Speech synthesis
C#: using SpeechLib;

namespace Speaking_Computer
{
  public class Program
  {
    private static void Main()
    {
      var voice = new SpVoice();
      voice.Speak("This is an example of speech synthesis.");
    }
  }
}

Go: package main

import (
    "go/build"
    "log"
    "path/filepath"

    "github.com/unixpickle/gospeech"
    "github.com/unixpickle/wav"
)

const pkgPath = "github.com/unixpickle/gospeech"
const input = "This is an example of speech synthesis."

func main() {
    p, err := build.Import(pkgPath, ".", build.FindOnly)
    if err != nil {
        log.Fatal(err)
    }
    d := filepath.Join(p.Dir, "dict/cmudict-IPA.txt")
    dict, err := gospeech.LoadDictionary(d)
    if err != nil {
        log.Fatal(err)
    }
    phonetics := dict.TranslateToIPA(input)
    synthesized := gospeech.DefaultVoice.Synthesize(phonetics)
    wav.WriteFile(synthesized, "output.wav")
}
Task: Speech synthesis
C#: using SpeechLib;

namespace Speaking_Computer
{
  public class Program
  {
    private static void Main()
    {
      var voice = new SpVoice();
      voice.Speak("This is an example of speech synthesis.");
    }
  }
}

Python: import pyttsx

engine = pyttsx.init()
engine.say("It was all a dream.")
engine.runAndWait()
Task: Speech synthesis
Go: package main

import (
    "go/build"
    "log"
    "path/filepath"

    "github.com/unixpickle/gospeech"
    "github.com/unixpickle/wav"
)

const pkgPath = "github.com/unixpickle/gospeech"
const input = "This is an example of speech synthesis."

func main() {
    p, err := build.Import(pkgPath, ".", build.FindOnly)
    if err != nil {
        log.Fatal(err)
    }
    d := filepath.Join(p.Dir, "dict/cmudict-IPA.txt")
    dict, err := gospeech.LoadDictionary(d)
    if err != nil {
        log.Fatal(err)
    }
    phonetics := dict.TranslateToIPA(input)
    synthesized := gospeech.DefaultVoice.Synthesize(phonetics)
    wav.WriteFile(synthesized, "output.wav")
}

Python: import pyttsx

engine = pyttsx.init()
engine.say("It was all a dream.")
engine.runAndWait()
Task: Speech synthesis
C: #include <sys/wait.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

void talk(const char *s)
{
	pid_t pid;
	int status;

	pid = fork();
	if (pid < 0) {
		perror("fork");
		exit(1);
	}

	if (pid == 0) {
		execlp("espeak", "espeak", s, (void*)0);
		perror("espeak");
		_exit(1);
	}

	waitpid(pid, &status, 0);
	if (!WIFEXITED(status) || WEXITSTATUS(status) != 0)
		exit(1);
}

int main()
{
	talk("This is an example of speech synthesis.");
	return 0;
}

Go: package main

import (
    "go/build"
    "log"
    "path/filepath"

    "github.com/unixpickle/gospeech"
    "github.com/unixpickle/wav"
)

const pkgPath = "github.com/unixpickle/gospeech"
const input = "This is an example of speech synthesis."

func main() {
    p, err := build.Import(pkgPath, ".", build.FindOnly)
    if err != nil {
        log.Fatal(err)
    }
    d := filepath.Join(p.Dir, "dict/cmudict-IPA.txt")
    dict, err := gospeech.LoadDictionary(d)
    if err != nil {
        log.Fatal(err)
    }
    phonetics := dict.TranslateToIPA(input)
    synthesized := gospeech.DefaultVoice.Synthesize(phonetics)
    wav.WriteFile(synthesized, "output.wav")
}
Task: Speech synthesis
C: #include <sys/wait.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

void talk(const char *s)
{
	pid_t pid;
	int status;

	pid = fork();
	if (pid < 0) {
		perror("fork");
		exit(1);
	}

	if (pid == 0) {
		execlp("espeak", "espeak", s, (void*)0);
		perror("espeak");
		_exit(1);
	}

	waitpid(pid, &status, 0);
	if (!WIFEXITED(status) || WEXITSTATUS(status) != 0)
		exit(1);
}

int main()
{
	talk("This is an example of speech synthesis.");
	return 0;
}

PHP: <?php
<?php











$mac_use_espeak = false;





$voice = "espeak";
$statement = 'Hello World!';
$save_file_args = '-w HelloWorld.wav'; // eSpeak args


$OS = strtoupper(substr(PHP_OS, 0, 3));

elseif($OS === 'DAR' && $mac_use_espeak == false) { 
    $voice = "say -v 'Victoria'";
    $save_file_args = '-o HelloWorld.wav'; // say args
}

exec("$voice '$statement'");

exec("$voice '$statement' $save_file_args");
Task: Speech synthesis
C#: using SpeechLib;

namespace Speaking_Computer
{
  public class Program
  {
    private static void Main()
    {
      var voice = new SpVoice();
      voice.Speak("This is an example of speech synthesis.");
    }
  }
}

PHP: <?php
<?php











$mac_use_espeak = false;





$voice = "espeak";
$statement = 'Hello World!';
$save_file_args = '-w HelloWorld.wav'; // eSpeak args


$OS = strtoupper(substr(PHP_OS, 0, 3));

elseif($OS === 'DAR' && $mac_use_espeak == false) { 
    $voice = "say -v 'Victoria'";
    $save_file_args = '-o HelloWorld.wav'; // say args
}

exec("$voice '$statement'");

exec("$voice '$statement' $save_file_args");
Task: Speech synthesis
Go: package main

import (
    "go/build"
    "log"
    "path/filepath"

    "github.com/unixpickle/gospeech"
    "github.com/unixpickle/wav"
)

const pkgPath = "github.com/unixpickle/gospeech"
const input = "This is an example of speech synthesis."

func main() {
    p, err := build.Import(pkgPath, ".", build.FindOnly)
    if err != nil {
        log.Fatal(err)
    }
    d := filepath.Join(p.Dir, "dict/cmudict-IPA.txt")
    dict, err := gospeech.LoadDictionary(d)
    if err != nil {
        log.Fatal(err)
    }
    phonetics := dict.TranslateToIPA(input)
    synthesized := gospeech.DefaultVoice.Synthesize(phonetics)
    wav.WriteFile(synthesized, "output.wav")
}

PHP: <?php
<?php











$mac_use_espeak = false;





$voice = "espeak";
$statement = 'Hello World!';
$save_file_args = '-w HelloWorld.wav'; // eSpeak args


$OS = strtoupper(substr(PHP_OS, 0, 3));

elseif($OS === 'DAR' && $mac_use_espeak == false) { 
    $voice = "say -v 'Victoria'";
    $save_file_args = '-o HelloWorld.wav'; // say args
}

exec("$voice '$statement'");

exec("$voice '$statement' $save_file_args");
Task: Speech synthesis
Python: import pyttsx

engine = pyttsx.init()
engine.say("It was all a dream.")
engine.runAndWait()

PHP: <?php
<?php











$mac_use_espeak = false;





$voice = "espeak";
$statement = 'Hello World!';
$save_file_args = '-w HelloWorld.wav'; // eSpeak args


$OS = strtoupper(substr(PHP_OS, 0, 3));

elseif($OS === 'DAR' && $mac_use_espeak == false) { 
    $voice = "say -v 'Victoria'";
    $save_file_args = '-o HelloWorld.wav'; // say args
}

exec("$voice '$statement'");

exec("$voice '$statement' $save_file_args");