Hi there
I was wondering what kind of RDS Signal do I need for stereo Tool to accept it
if I am not mistaken I should create BPSK Modulated Signal 2.2khz wide on one half of 57khz then mirror that on the other half of 57khz to get 4khz wide RDS signal
IEC 62106:
http://downloads.dxing.si/download.php? ... /62106.pdf
mentiones RDS as being:
"
The subcarrier is amplitude-modulated by the shaped and biphase coded data signal (see 4.8).
The subcarrier is suppressed.
This method of modulation may alternatively be thought of as a
form of two-phase phase-shift-keying (psk) with a phase deviation of ±90º.
"
but BPSK is 180° out of phase so I am a bit confused here
here is my BPSK modulation code in C# if anyone wants it, it kinda works but doesn't produce anything close to RDS Physical layer
Code:
using NAudio.Wave;
using NAudio.Wave.SampleProviders;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace SineWaveGenerator
{
class Program
{
//static DeviceNumber = 1; //Virtual Audio Cable
static int DeviceNumber = 5; //Speakers
//BPSK Modulation
static int DATALENGTH = 1000;
static double carrierFrequency = 56e3; //carrier frequency (56khz)
static double amplitudeGain = 1; // amplitude gain of the carrier frequencyž
static double samplingRate = 192e3; // sampling rate of carrier generator (192khz)
static void Main(string[] args)
{
Program prg = new Program();
Random rnd = new Random();
int[] inputData = new int[DATALENGTH];
double[] outputData = new double[DATALENGTH];
for (int i = 0; i < DATALENGTH; i++)
{
inputData[i] = rnd.Next() % 2;
BPSK_mod(inputData, ref outputData, DATALENGTH);
}
//Send to sound card
byte[] BPSKArray = Tools.GetBytes(outputData);
using (var wo = new WaveOutEvent() { DeviceNumber = 1 }) //Virtual Audio Cable Line 1 Cable
//using (var wo = new WaveOutEvent()) //Default sound card
{
IWaveProvider provider = new RawSourceWaveStream(
new MemoryStream(BPSKArray), new WaveFormat());
wo.Init(provider);
wo.Play();
while (wo.PlaybackState == PlaybackState.Playing)
{
Thread.Sleep(500);
}
}
}
static void BPSK_mod(int[] input, ref double[] output, int size)
{
for (int i = 0; i < size; i++)
output[i] = amplitudeGain * Math.Sin(2 * Math.PI * ((carrierFrequency * i / samplingRate) + input[i]));
}
}
}
but its output looks horrible even if using 192khz Virtual Audio cable
not sure Hans how are you doing BPSK modulation? (if it even is BPSK)
Yea I want to write RDS encoder for exercise