Generate RDS/RBDS waveform
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.
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:
and set the properties of the object.
step to generate the
Alternatively, instead of using the
step method to perform the
operation defined by the System object, you can call the object with arguments, as if it were a function. For
y = step(obj,x) and
y = obj(x)
perform equivalent operations.
rbdsgen = comm.RBDSWaveformGenerator creates an RDS/RBDS waveform
rbdsgen, using the default
rbdsgen = comm.RBDSWaveformGenerator(Name,Value) specifies
additional properties using
Name,Value pairs. Unspecified properties
have default values.
rbdsgen = comm.RBDSWaveformGenerator( ... 'GroupsPerFrame',20,'SamplesPerSymbol',10, ... 'SendRadioTextPlus',true);
If a property is listed as tunable, then you can change its value even when the object is locked.
SamplesPerSymbol— Number of samples per symbol
10(default) | positive even integer
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.
GroupsPerFrame— Number of groups per output frame
10(default) | scalar integer
Number of groups per output frame, specified as a scalar integer. Each group is 104 symbols (bits) long.
RadioText— Long text conveyed with type 2A groups
'Long text'(default) | character vector
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.
ProgramServiceName— Label of the program service
'ShortTxt'(default) | character vector
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.
ProgramIdentificationCode— Program identification code
[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0](default) | 16-bit row vector
Program identification (PI) code, specified as a 16-bit row vector. In
North America, the PI code conveys the call letters of the station. Example
call letters include
To generate North American PI codes for a station's call letters, use the
ProgramType— Program type
'No program type or undefined'(default) | character vector
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 .
ProgramTypeName— Program type name
''(default) | character vector
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
SendDateTime— Option to advertise date and time
Option to advertise the date and time, specified as either
true. When you set this
true, one 4A group is periodically generated
every 685 groups (once a minute).
AlternativeFrequencies— Alternative frequencies
(default) | row vector
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.
SendRadioTextPlus— Option to send RT+ information
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
RadioTextType2, and the two RT+ substrings indexed
RadioTextIndices are conveyed with the open-format
type 11A group.
RadioTextType1— Content type of first RT+ substring
'Item.Artist'(default) | character vector
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 .
RadioTextType2— Content type of second RT+ substring
'Item.Title'(default) | character vector
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 .
RadioTextIndices— Start and end indices of RT+ substrings
[1 2; 3 4](default) | 2-by-2 matrix of positive integers
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.
|callLettersToPICode||Convert North-American call letters to binary PI code|
|registerODA||Register a custom encoding implementation for an ODA|
|reset||Reset states of RBDS waveform generator object|
|step||Generate RDS/RBDS waveform|
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,'YLimits',10^-2*[-1 1]);
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.
for idx = 1:7 input = afr(); % get current audio input rbdsWave = rbds(); % generate RBDS info at the same configured rate yFM = fmMod([input input], rbdsWave); % FM modulate stereo audio with RBDS info rcv = awgn(yFM, 40); % add noise [audioRcv, rbdsRcv] = fmDemod(rcv); % FM demodulate the audio and RBDS waveforms scope(rbdsRcv); end
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
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.step(); 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 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); scope = dsp.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 = [99.1 102.5]; % info sent in type 0A groups wave = rbds.step(); scope(wave)
comm.RBDSWaveformGenerator generates waveforms
according to the RDS/RBDS standard . The
RDS/RBDS standard consists of three layers: physical layer, data-link layer, and session
and application layer.
The physical layer (first layer) converts the data-link bits to an analog waveform by conducting differential encoding and biphase symbol encoding (Manchester encoding) and pulse-shaping filtering.
The data-link layer (second layer) performs (26,16) cyclic encoding shortened from (341,331) encoding . The second layer is responsible for error detection, error correction, and the establishment of group-level synchronization. Each group of RDS/RBDS frames contains four blocks of 26 bits (that is 104 bits) each. Each block contains an information word and a check word. Each information word contains 16 bits, and each check word contains 10 bits.
Here is the baseband coding structure for the RDS/RBDS waveform. For more details, see .
For each block, a unique offset word is modulo-2 added to the checkword bits. The added offset word provides a group and block synchronization system in the receiver (decoder). Because the addition of the offset is reversible in the decoder, the normal additive error-correcting and detecting properties of the basic code are unaffected.
The first block in every group contains a program identification (PI) code. The first four bits of the second block of every group are allocated to a four-bit code. This code specifies the application of the group. Groups are referred to as types 0–15 according to the binary weighting A3 = 8, A2 = 4, A1 = 2, A0 = 1. The fifth bit of the second block, B0, defines the version of the application. If B0 = 0, the version of the group is A. The PI code in this version is inserted into block 1 only. Example group types include 0A, 1A, 2A, 3A, and 4A.
The Program Type code and Traffic Program Identification (PI) occupy fixed locations in block 2 of every group.
 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.
 Westdeutscher Rundfunk WDR, Nokia, and Institut für Rundfunktechnik IRT. RadioText Plus (RT+) Specification, Version 2.1. 2006.
Usage notes and limitations:
See System Objects in MATLAB Code Generation (MATLAB Coder).
In addition, the following limitations apply when you generate code that contains this System object or when you use this object in a MATLAB function block.
The group type 4A cannot be transmitted in the generated code.
registerODA method is not
ProgramType property is not tunable.