Main Content

comm.RBDSWaveformGenerator

Generate RDS/RBDS waveform

Description

The comm.RBDSWaveformGenerator System object™ generates configurable standard-compliant baseband RDS/RBDS waveforms in MATLAB®. RDS/RBDS waveforms supplement FM radio stations with additional textual information, such as song title, artist name, and station description. The RDS/RBDS signal lies in the 57 kHz band of the baseband FM radio signal.

You can use this object to generate a waveform containing RadioText Plus (RT+) information and register a custom encoding implementation for an open data application (ODA). You can also specify the time, data, and the program type. The object supports short, scrolling 8-character text and longer 32-character or 64-character text.

To generate baseband RDS/RBDS waveforms:

  1. Create the comm.RBDSWaveformGenerator object and set its properties.

  2. Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects?

Creation

Description

rbdsgen = comm.RBDSWaveformGenerator creates an RDS/RBDS waveform generator object, rbdsgen, using the default properties.

example

rbdsgen = comm.RBDSWaveformGenerator(Name=Value) specifies additional properties using name-value arguments. For example, comm.RBDSWaveformGenerator(GroupsPerFrame="20",SamplesPerSymbol="10") creates an RDS/RBDS waveform generator that expects 20 groups per output frame and 10 samples per symbol.

example

Properties

expand all

Unless otherwise indicated, properties are nontunable, which means you cannot change their values after calling the object. Objects lock when you call them, and the release function unlocks them.

If a property is tunable, you can change its value at any time.

For more information on changing property values, see System Design in MATLAB Using System Objects.

If a property is listed as tunable, then you can change its value even when the object is locked.

Number of samples per symbol (bit), specified as a positive even integer. Half of the samples represent one amplitude level of Manchester coding. The other half of the samples represent the opposite level.

Number of groups per output frame, specified as a scalar integer. Each group is 104 symbols (bits) long.

Radio text conveyed with type 2A groups, specified as a character vector that is up to 64 characters long. The object transmits the specified text four characters at a time, using type 2A groups.

Tunable: Yes

Label of the program service, specified as a character vector that is up to eight characters long. This information is conveyed as a short text with type 0A groups, two characters at a time.

Tunable: Yes

Program identification (PI) code, specified as a 16-bit row vector. In North America, the PI code conveys the call letters of the station.

To generate North American PI codes for the call letters of a radio station, use the callLettersToPICode object function.

Example: Example call letters include 'WLIR' and 'KPOA'.

Program type, specified as a character vector containing one of the 31 values allowed by the RDS/RBDS standard. For a list of program types that the RDS/RBDS standard allows in North America, see [1].

Tunable: Yes

Program type name, specified as a character vector that is up to eight characters long. This text further characterizes the program type, such as 'Football' for the program type 'Sports'. The object conveys the program type name using type 10A groups. If this property is empty, then no 10A groups are generated.

Tunable: Yes

Option to advertise the date and time, specified as a logical false (0) or true (1). When you set this property to true, one 4A group is periodically generated every 685 groups (once a minute).

Alternative frequencies, specified as a row vector in MHz. This information is conveyed with type 0A groups. It indicates other transmitters broadcasting the same program in the same or adjacent reception areas. With this information, receivers can switch to a different frequency with better reception.

Option to transmit RadioText Plus (RT+) information, specified as a scalar logical. When you set this property to true, the RT+ ODA information is advertised with type 3A groups. In addition, the RT+ content types, specified in RadioTextType1, RadioTextType2, and the two RT+ substrings indexed by RadioTextIndices are conveyed with the open-format type 11A group.

Content type of the first RT+ substring, specified as a character vector. Allowed values are the class names specified in the RT+ standard. For more details, see [2].

Tunable: Yes

Content type of the second RT+ substring, specified as a character vector. Allowed values are the class names specified in the RT+ standard. For more details, see [2].

Tunable: Yes

Start and end indices of RT+ substrings, specified as a 2-by-2 matrix of positive integers. The first column indexes the beginning of each RT+ substring. The second column indexes the end of each substring.

Tunable: Yes

Usage

Description

Y = rbdsgen outputs a frame of the baseband RDS/RBDS waveform in column vector Y. The waveform contains the number of 104-bit groups, specified in the GroupsPerFrame property of the object. The object oversamples each symbol according to the SamplesPerSymbol property. The object uses an internal scheduler to determine the order and frequency of the transmitted group types.

Output Arguments

expand all

Output signal, returned as a column vector. The returned vector contains a (SamplesPerSymbol × 104 × GroupsPerFrame) sample frame of the baseband RDS/RBDS waveform. The waveform contains the number of (104-bit) groups specified in the GroupsPerFrame property. Each symbol is oversampled according to the SamplesPerSymbol property. The object uses a scheduler to determine the order and frequency of the generated group types.

Object Functions

To use an object function, specify the System object as the first input argument. For example, to release system resources of a System object named obj, use this syntax:

release(obj)

expand all

callLettersToPICodeConvert North American call letters to binary PI code
registerODARegister custom encoding implementation for ODA
stepRun System object algorithm
releaseRelease resources and allow changes to System object property values and input characteristics
resetReset internal states of System object

Examples

collapse all

Generate a basic RBDS waveform, FM-modulate the waveform with an audio signal, and then demodulate the waveform.

Each frame of the RBDS waveform contains 19 groups, with a group length of 104 bits (symbols) each. Set the number of samples per RBDS symbol to 10. Therefore, the number of samples in each frame of RBDS waveform is 104 x 10 x 19 = 19,760. According to the RBDS standard, the bit rate is 1187.5 Hz. So, the RBDS sample rate = 1187.5 x samples per RBDS symbol. Set the audio frame rate to 40 x 1187.5 = 47,500.

groupLen = 104;
sps = 10;
groupsPerFrame = 19;
rbdsFrameLen = groupLen*sps*groupsPerFrame;
afrRate = 40*1187.5;
rbdsRate = 1187.5*sps;
outRate = 4*57000;

afr = dsp.AudioFileReader( ...
    "rbds_capture_47500.wav", ...
    SamplesPerFrame=rbdsFrameLen*afrRate/rbdsRate);
rbds = comm.RBDSWaveformGenerator( ...
    GroupsPerFrame=groupsPerFrame, ...
    SamplesPerSymbol=sps);

fmMod = comm.FMBroadcastModulator( ...
    AudioSampleRate=afr.SampleRate, ...
    SampleRate=outRate,...
    Stereo=true, ...
    RBDS=true, ...
    RBDSSamplesPerSymbol=sps);
fmDemod = comm.FMBroadcastDemodulator( ...
    SampleRate=outRate,...
    Stereo=true, ...
    RBDS=true, ...
    PlaySound=true);
scope = timescope( ...
    SampleRate=outRate, ...
    TimeSpanSource="Property", ...
    TimeSpan=0.002, ...
    TimeDisplayOffset=0.5, ...
    YLimits=10^-3*[-5 5]);

Get the audio input and generate the RBDS waveform. FM-modulate the stereo audio with the RBDS waveform, add noise, and FM-demodulate the audio and RBDS waveforms. View the demodulated RBDS waveform in the time scope to show the differential Manchester encoded pulses.

for idx = 1:7
    % Get current audio input
    input = afr();              
    % Generate RBDS info at the same configured rate
    rbdsWave = rbds();
    % FM-modulate stereo audio with RBDS info
    yFM = fmMod( ...
        [input input], ...
        rbdsWave);
    % Add noise
    rcv = awgn(yFM, 40);
    % FM-demodulate the audio and RBDS waveforms
    [audioRcv, rbdsRcv] = fmDemod(rcv);
    scope(rbdsRcv);
end
release(scope)

Create a comm.RBDSWaveformGenerator System object™ with 20 groups per frame and 10 samples per symbol. Add the Radio Text plus (RT+) information, such as artist name and song title to the waveform. Indicate the start and end of the RT+ substrings by using the RadioTextIndices property.

rbds = comm.RBDSWaveformGenerator( ...
    GroupsPerFrame=20, ...
    SamplesPerSymbol=10, ...
    SendRadioTextPlus=true);
rbds.RadioText = 'MyArtist - MySongTitle';
rbds.RadioTextType1 = 'Item.Artist';
rbds.RadioTextType2 = 'Item.Title';
rbds.RadioTextIndices = [1 8; 12 22]; 
for idx = 1:10
    rbds();
end

Register a custom encoding implementation for an open data application (ODA) by using the registerODA method of the comm.RBDSWaveformGenerator System object™. Set the ODA ID to 'CD46', which is the ID for the traffic message channel. The allocated group type is 8A.

rbds = comm.RBDSWaveformGenerator();
odaID = 'CD46';
allocatedGroupType = '8A';

This example uses the following templates as a starting point for custom encoding implementation.

mainProcessingFcn = @CustomODAEncodingMain;
fcn3A             = @CustomODAEncoding3A;
registerODA(rbds,odaID,allocatedGroupType,mainProcessingFcn,fcn3A);
s = info(rbds);
s.ODAMap
ans=2×1 struct array with fields:
    ID
    GroupType
    FunctionMain
    Function3A

Generate an RBDS waveform with date and time information, the program type, and alternative frequencies. The comm.RBDSWaveformGenerator object uses type 4A groups for date and time information, type 10A groups for the program type information, and type 0A groups for alternative frequencies. View the waveform in a spectrum analyzer.

rbds = comm.RBDSWaveformGenerator( ...
    GroupsPerFrame=1000);
sa = spectrumAnalyzer( ...
    SampleRate=1187.5*rbds.SamplesPerSymbol, ...
    YLimits=[-140 20]);
rbds.SendDateTime = true;          % Send type 4A groups
rbds.ProgramType = "Sports";
rbds.ProgramTypeName = "Football"; % Send type 10A groups
rbds.AlternativeFrequencies = ...  % Send info in type 0A groups
    [99.1 102.5];
wave = rbds();
sa(wave)
release(sa)

Algorithms

expand all

The comm.RBDSWaveformGenerator System object generates waveforms according to the RDS/RBDS standard [1]. The RDS/RBDS standard consists of three layers: physical layer, data link layer, and session and application layer.

References

[1] National Radio Systems Committee. United States RBDS Standard: Specification of the radio broadcast data system (RBDS). Electronic Industries Association and National Association of Broadcasters. April 9, 1998.

[2] Westdeutscher Rundfunk WDR, Nokia, and Institut für Rundfunktechnik IRT. RadioText Plus (RT+) Specification, Version 2.1. 2006.

Extended Capabilities

Version History

Introduced in R2017a