Roger Schneiter

Roger Schneiter

  • NA
  • 1
  • 1.8k

C# Audio Recording + Audio Comparing to Console.Beep()

Jan 21 2016 9:13 AM
Hei guys
 
I wrote a simple Console application that will convert any text you type in, into morse code and give it out as Console.Beep()'s. These sounds should be recorded by another C# Console application and compared to the Console.Beep()s. Then with that comparsion, I want to translate the morse code back to text. I hope anyone has an idea. Here is the full code:  
 
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
namespace HowToMurphy
{
class Program
{
static void Main(string[] args)
{
bool online = true;
do
{
Console.Clear();
Console.WriteLine("Geben Sie einen beliebigen Text ein [A-Z] / [1-9]:");
string letter = Console.ReadLine();
foreach (char c in letter.ToUpper())
{
Thread.Sleep(300);
switch (c)
{
case 'A':
Console.Beep(600, 100);
Console.Beep(600, 200);
break;
case 'B':
Console.Beep(600, 200);
Console.Beep(600, 100);
Console.Beep(600, 100);
Console.Beep(600, 100);
break;
case 'C':
Console.Beep(600, 200);
Console.Beep(600, 100);
Console.Beep(600, 200);
Console.Beep(600, 100);
break;
case 'D':
Console.Beep(600, 200);
Console.Beep(600, 100);
Console.Beep(600, 100);
break;
case 'E':
Console.Beep(600, 100);
break;
case 'F':
Console.Beep(600, 100);
Console.Beep(600, 100);
Console.Beep(600, 200);
Console.Beep(600, 100);
break;
case 'G':
Console.Beep(600, 200);
Console.Beep(600, 200);
Console.Beep(600, 100);
break;
case 'H':
Console.Beep(600, 100);
Console.Beep(600, 100);
Console.Beep(600, 100);
Console.Beep(600, 100);
break;
case 'I':
Console.Beep(600, 100);
Console.Beep(600, 100);
break;
case 'J':
Console.Beep(600, 100);
Console.Beep(600, 200);
Console.Beep(600, 200);
Console.Beep(600, 200);
break;
case 'K':
Console.Beep(600, 200);
Console.Beep(600, 100);
Console.Beep(600, 200);
break;
case 'L':
Console.Beep(600, 100);
Console.Beep(600, 200);
Console.Beep(600, 100);
Console.Beep(600, 100);
break;
case 'M':
Console.Beep(600, 200);
Console.Beep(600, 200);
break;
case 'N':
Console.Beep(600, 200);
Console.Beep(600, 100);
break;
case 'O':
Console.Beep(600, 200);
Console.Beep(600, 200);
Console.Beep(600, 200);
break;
case 'P':
Console.Beep(600, 100);
Console.Beep(600, 200);
Console.Beep(600, 200);
Console.Beep(600, 100);
break;
case 'Q':
Console.Beep(600, 200);
Console.Beep(600, 200);
Console.Beep(600, 100);
Console.Beep(600, 200);
break;
case 'R':
Console.Beep(600, 100);
Console.Beep(600, 200);
Console.Beep(600, 100);
break;
case 'S':
Console.Beep(600, 100);
Console.Beep(600, 100);
Console.Beep(600, 100);
break;
case 'T':
Console.Beep(600, 200);
break;
case 'U':
Console.Beep(600, 100);
Console.Beep(600, 100);
Console.Beep(600, 200);
break;
case 'V':
Console.Beep(600, 100);
Console.Beep(600, 100);
Console.Beep(600, 100);
Console.Beep(600, 200);
break;
case 'W':
Console.Beep(600, 100);
Console.Beep(600, 200);
Console.Beep(600, 200);
break;
case 'X':
Console.Beep(600, 200);
Console.Beep(600, 100);
Console.Beep(600, 100);
Console.Beep(600, 200);
break;
case 'Y':
Console.Beep(600, 200);
Console.Beep(600, 100);
Console.Beep(600, 200);
Console.Beep(600, 200);
break;
case 'Z':
Console.Beep(600, 200);
Console.Beep(600, 200);
Console.Beep(600, 100);
Console.Beep(600, 100);
break;
case '1':
Console.Beep(600, 100);
Console.Beep(600, 200);
Console.Beep(600, 200);
Console.Beep(600, 200);
Console.Beep(600, 200);
break;
case '2':
Console.Beep(600, 100);
Console.Beep(600, 100);
Console.Beep(600, 200);
Console.Beep(600, 200);
Console.Beep(600, 200);
break;
case '3':
Console.Beep(600, 100);
Console.Beep(600, 100);
Console.Beep(600, 100);
Console.Beep(600, 200);
Console.Beep(600, 200);
break;
case '4':
Console.Beep(600, 100);
Console.Beep(600, 100);
Console.Beep(600, 100);
Console.Beep(600, 100);
Console.Beep(600, 200);
break;
case '5':
Console.Beep(600, 100);
Console.Beep(600, 100);
Console.Beep(600, 100);
Console.Beep(600, 100);
Console.Beep(600, 100);
break;
case '6':
Console.Beep(600, 200);
Console.Beep(600, 100);
Console.Beep(600, 100);
Console.Beep(600, 100);
Console.Beep(600, 100);
break;
case '7':
Console.Beep(600, 200);
Console.Beep(600, 200);
Console.Beep(600, 100);
Console.Beep(600, 100);
Console.Beep(600, 100);
break;
case '8':
Console.Beep(600, 200);
Console.Beep(600, 200);
Console.Beep(600, 200);
Console.Beep(600, 100);
Console.Beep(600, 100);
break;
case '9':
Console.Beep(600, 200);
Console.Beep(600, 200);
Console.Beep(600, 200);
Console.Beep(600, 200);
Console.Beep(600, 100);
break;
case '0':
Console.Beep(600, 200);
Console.Beep(600, 200);
Console.Beep(600, 200);
Console.Beep(600, 200);
Console.Beep(600, 200);
break;
case ' ':
Thread.Sleep(300);
break;
default:
Console.WriteLine("Nur Buchstaben oder Zahlen erlaubt!");
Console.ReadKey();
Environment.Exit(0);
break;
}
}
}
while (online);
Console.ReadKey();
}
}
}