Demodulate broadcast FM audio signal

## Description

The comm.FMBroadcastDemodulator System object™ demodulates a complex broadcast FM-modulated signal and filters the signal with a de-emphasis filter to produce an audio signal. For more details, see the Algorithms section.

To demodulate a broadcast FM audio signal:

1. Create the comm.FMBroadcastDemodulator 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

fmbdemodulator = comm.FMBroadcastDemodulator creates an FM broadcast demodulator System object.

example

fmbdemodulator = comm.FMBroadcastDemodulator(Name,Value) sets properties using one or more name-value arguments. For example, 'SampleRate',400e3 specifies a sample rate of 400 kHz.

fmbdemodulator = comm.FMBroadcastDemodulator(fmbmodulator) sets properties based on the configuration of the input comm.FMBroadcastModulator System object, fmbmodulator.

## 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.

Sample rate of the input of the demodulator in Hz, specified as a positive scalar. The sample rate must be greater than twice the frequency deviation (that is, SampleRate > 2×FrequencyDeviation).

Data Types: double

Peak deviation of the input signal frequency in Hz, specified a positive scalar. The frequency deviation must be less than half the sample rate (that is, FrequencyDeviation < SampleRate/2).

The system bandwidth BT = 2×(FrequencyDeviation + BM), where BM is the message bandwidth in Hz. For more information, see the Algorithms section.

FM broadcast standards specify a value of 75 kHz in the United States and 50 kHz in Europe.

Data Types: double

De-emphasis highpass filter time constant in seconds, specified as a positive scalar. FM broadcast standards specify a value of 75 μs in the United States and 50 μs in Europe.

Data Types: double

Option to enable stereo demodulation, specified as a logical 0 (false) or 1 (true).

• false — The output is mono audio.

• true — The object performs stereo decoding and outputs stereo audio.

For more information, see the Algorithms section.

Data Types: logical

Option to enable audio playback, specified as a logical 0 (false) or 1 (true). To playback the output signal on the default audio device connected to the computer, set this property to true.

Data Types: logical

Sample rate of the output audio signal in Hz, specified as a positive scalar.

Data Types: double

Size of the buffer in samples, specified as a positive integer. This property specifies the size of the buffer used by the System object for communication with the audio device.

#### Dependencies

To enable this property, set the PlaySound property to true.

Data Types: double

Option to enable RDS (or RBDS) waveform demodulation, specified as a logical 0 (false) or 1 (true). If you set this property set to true, the object demodulates the RDS (or RBDS) waveform. For more information, see the Algorithms section.

Data Types: logical

Oversampling factor of the RDS (or RBDS) output signal, specified as a positive integer. The sample rate of RDS (or RBDS) broadcast data is 1187.5 Hz. The RDS (or RBDS) signal sample rate is RBDSSamplesPerSymbol × 1187.5 Hz.

#### Dependencies

To enable this property, set the RBDS property to true.

Data Types: double

Option to recover phase of the RDS (or RBDS) signal, specified as a logical 0 (false) or 1 (true).

To recover the phase of the RDS (or RBDS) signal by using a Costas loop, set this property to true. For radio stations that do not lock the 57 kHz RDS (or RBDS) signal in phase with the third harmonic of the 19 kHz pilot tone, a Costas loop helps recover the phase of the RDS (or RBDS) signal.

#### Dependencies

To enable this property, set the RBDS property to true.

Data Types: logical

## Usage

### Description

example

audiosig = fmbdemodulator(insig) demodulates an FM-modulated baseband audio signal and filters this signal with a de-emphasis filter to produce an audio signal.

example

[audiosig,rbdssig] = fmbdemodulator(insig) also modulates a baseband RBDS signal at 57 kHz. To enable this syntax, set the RBDS property to true.

### Input Arguments

expand all

FM-modulated baseband audio signal, specified as a column vector. For information about signal length restrictions, see Limitations.

Data Types: double | single
Complex Number Support: Yes

### Output Arguments

expand all

Audio signal, returned as a column vector or an M-by-N matrix. M is the number of stereo channels. N is the number of samples in the audio signal per channel. The output has the same data type as the input signal, insig.

If you set the Stereo property to true, the audio signal must have at least two channels and the System object performs stereo encoding before de-emphasis filtering. The length of the output is .

RBDS signal, returned as a column vector with the same data type as the input signal.

Data Types: double | single
Complex Number Support: Yes

## 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

 info Information about FM broadcast modulator or demodulator
 step Run System object algorithm release Release resources and allow changes to System object property values and input characteristics reset Reset internal states of System object

## Examples

collapse all

Play back an audio file after applying FM broadcast modulation and demodulation using System objects to process the data in streaming mode.

Load the audio file guitartune.wav by using an audio file reader System object™ with the samples per frame set to 4410.

'SamplesPerFrame',4410);

Create FM broadcast modulator and demodulator objects. Set the sample rate of the output audio signal to match the sample rate of the input audio signal. Set the sample rate of the demodulator to match the specified sample rate of the modulator. Enable audio playback for the broadcast demodulator.

fmbMod = comm.FMBroadcastModulator( ...
'SampleRate',240e3);
fmbDemod = comm.FMBroadcastDemodulator( ...
'SampleRate',240e3,'PlaySound',true);

Read the audio data in frames of length 4410, apply FM broadcast modulation, demodulate the FM signal, and play back the demodulated signal (demodData).

modData = fmbMod(audioData);
demodData = fmbDemod(modData); % Demodulate and play signal
end

Generate an RBDS waveform, FM broadcast modulate the RBDS waveform with an audio signal, and FM broadcast demodulate the FM signal.

Specify parameters for an RBDS waveform with 19 groups per frame and 10 samples per symbol. The sample rate of the RBDS waveform is given by 1187.5 x 10. Set the audio sample rate to 1187.5 x 40.

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

Load the audio file guitartune.wav by using an audio file reader System object™ while setting the samples per frame. Create RBDS waveform generator, FM broadcast modulator, FM broadcast demodulator, and time scope System objects. Configure the modulator and demodulator objects to process a stereo audio file and an RBDS waveform.

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]);

Read the audio signal. Generate RBDS information at the same configured rate as audio. FM broadcast modulate the stereo audio signal with RBDS information. Add additive white Gaussian noise. FM-demodulate the audio signal and RBDS waveforms. View the waveforms in a time scope.

for idx = 1:7
input = afr();
rbdsWave = rbds();
yFM = fmMod([input input],rbdsWave);
rcv = awgn(yFM,40);
[audioRcv, rbdsRcv] = fmDemod(rcv);
scope(rbdsRcv);
end

## Limitations

The length of the input signal, insig, must be an integer multiple of the AudioDecimationFactor property. If you set the RBDS property to true, the length of the input signal, insig, also must be an integer multiple of RBDSDecimationFactor. For more information on the AudioDecimationFactor and RBDSDecimationFactor properties, see the info object function.

## Algorithms

expand all

The FM Broadcast demodulator includes the functionality of the baseband FM demodulator, de-emphasis filtering, and the ability to receive stereophonic signals. For more information about the algorithms used for basic FM modulation and demodulation, see the comm.FMDemodulator System object.

## References

[1] Hatai, I., and I. Chakrabarti. “A New High-Performance Digital FM Modulator and Demodulator for Software-Defined Radio and Its FPGA Implementation.” International Journal of Reconfigurable Computing (December 25, 2011): 1-10. https://doi.org/10.1155/2011/342532.

[2] Taub, H., and D. Schilling. Principles of Communication Systems. McGraw-Hill Series in Electrical Engineering. New York: McGraw-Hill, 1971, pp. 142–155.

[3] Der, Lawrence. "Frequency Modulation (FM) Tutorial". Silicon Laboratories Inc., pp. 4–8.

## Version History

Introduced in R2015a