Exemplo n.º 1
0
        // modulate and play, save & demodulate
        public static void Test3()
        {
            Console.WriteLine("Starting test {0}", 3);

            ax25.Packet            packet;
            ax25.AFSK1200Modulator mod;
            float[] samples;
            ax25.AFSK1200Demodulator dem;

            mod           = new ax25.AFSK1200Modulator(44100);
            mod.txDelayMs = 500;
            dem           = new ax25.AFSK1200Demodulator(44100, 1, 0, new TestConsole("T3>> {0}"));
            //ax25.AFSK1200Demodulator dem = new ax25.Afsk1200Demodulator(44100, 1, 6, new Packet2Console("MO>> {0}"));

            packet = new ax25.Packet(
                "APRS", "TESTER", new String[] { "WIDE1-1", "WIDE2-2" },
                ax25.Packet.AX25_CONTROL_APRS, ax25.Packet.AX25_PROTOCOL_NO_LAYER_3,
                System.Text.Encoding.ASCII.GetBytes(@"=5533.00N\03733.00Ek000/000 /A=00010 AFSK Test")
                );

            mod.GetSamples(packet, out samples);
            dem.AddSamples(samples, samples.Length);

            // PLAY
            WaveStream.PlaySamples(44100, samples, false);

            // SAVE
            WaveStream.SaveWav16BitMono(@"test3.wav", 44100, samples);

            Console.WriteLine("Test {0} done", 3);
        }
Exemplo n.º 2
0
        internal void FromTCP(string[] lines)
        {
            foreach (string line in lines)
            {
                if (line.IndexOf("# logresp") == 0)
                {
                    Console.WriteLine(line);
                }

                if (line.IndexOf("#") == 0)
                {
                    continue;
                }

                Console.WriteLine("TCP{0}> {1}", writeAudioDeviceNo, line);
            }
            ;

            if (writeAir)
            {
                List <ax25.Packet> packets = new List <ax25.Packet>();
                foreach (string line in lines)
                {
                    if (line.IndexOf("#") == 0)
                    {
                        continue;
                    }

                    string      from   = line.Substring(0, line.IndexOf(">"));
                    string      pckt   = line.Substring(line.IndexOf(":") + 1);
                    ax25.Packet packet = new ax25.Packet(
                        "APRS", from, new string[] { "AFSKMD" },
                        ax25.Packet.AX25_CONTROL_APRS, ax25.Packet.AX25_PROTOCOL_NO_LAYER_3,
                        System.Text.Encoding.ASCII.GetBytes(pckt)
                        );
                    packets.Add(packet);
                }
                ;

                if (packets.Count > 0)
                {
                    double[] _samples;
                    mod.GetSamples(packets.ToArray(), out _samples);
                    ReadWave.WavePlayer wp = new ReadWave.WavePlayer(writeAudioDeviceNo, writeAudioVolume);
                    wp.PlaySamples(44100, _samples, false);
                    //ReadWave.WaveStream.PlaySamples(44100, _samples, false);
                }
                ;
            }
            ;
        }
Exemplo n.º 3
0
        // modulate -> demodulate
        public static void Test1()
        {
            Console.WriteLine("Starting test {0}", 1);

            ax25.AFSK1200Modulator mod = new ax25.AFSK1200Modulator(44100);
            mod.txDelayMs = 500;
            ax25.AFSK1200Demodulator dem = new ax25.AFSK1200Demodulator(44100, 1, 0, new TestConsole("T1>> {0}"));

            ax25.Packet packet1 = new ax25.Packet(
                "APRS", "TESTER1", new String[] { "WIDE1-1", "WIDE2-2" },
                ax25.Packet.AX25_CONTROL_APRS, ax25.Packet.AX25_PROTOCOL_NO_LAYER_3,
                System.Text.Encoding.ASCII.GetBytes(@"=5533.00N\03733.00Ek000/000 /A=00010 AFSK Test 1")
                );

            ax25.Packet packet2 = new ax25.Packet(
                "APRS", "TESTER2", new String[] { "WIDE1-1", "WIDE2-2" },
                ax25.Packet.AX25_CONTROL_APRS, ax25.Packet.AX25_PROTOCOL_NO_LAYER_3,
                System.Text.Encoding.ASCII.GetBytes(@">Currently testing...")
                );


            ax25.Packet packet3 = new ax25.Packet(
                "APRS", "TESTER3", new String[] { "WIDE1-1", "WIDE2-2" },
                ax25.Packet.AX25_CONTROL_APRS, ax25.Packet.AX25_PROTOCOL_NO_LAYER_3,
                System.Text.Encoding.ASCII.GetBytes(@"=4802.37N/03934.12E0")
                );

            float[] samples;

            mod.GetSamples(packet1, out samples);
            dem.AddSamples(samples, samples.Length);

            mod.GetSamples(new ax25.Packet[] { packet2, packet3 }, out samples);
            dem.AddSamples(samples, samples.Length);

            Console.WriteLine("Test {0} done", 1);
        }