Modulate broadcast FM audio signal
System object™ pre-emphasizes an audio signal and modulates it onto a
baseband FM signal. For more information, see Algorithms.
To modulate a broadcast FM audio signal:
comm.FMBroadcastModulatorobject and set its properties.
Call the object with arguments, as if it were a function.
To learn more about how System objects work, see What Are System Objects?
creates a FM broadcast modulator System object.
fmbmodulator = comm.FMBroadcastModulator
sets properties using one or more name-value arguments. For example,
fmbmodulator = comm.FMBroadcastModulator(
'SampleRate',400e3 specifies a sample rate of 400 kHz.
sets properties based on configuration of the input
fmbmodulator = comm.FMBroadcastModulator(
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.
SampleRate — Sample rate
240e3 (default) | positive scalar
Sample rate of the output of the modulator in Hz, specified as a positive scalar.
The sample rate must be greater than twice the frequency deviation (that is,
SampleRate > 2×
FrequencyDeviation — Peak deviation of the output signal frequency
75e3 (default) | positive scalar
Peak deviation of the output signal frequency in Hz, specified a positive scalar.
The frequency deviation must be less than half the sample rate (that is,
The system bandwidth BT =
BM), where BM is the message
bandwidth in Hz. For more information, see Algorithms.
FM broadcast standards specify a value of 75 kHz in the United States and 50 kHz in Europe.
FilterTimeConstant — Pre-emphasis highpass filter time constant
7.5e-05 (default) | positive scalar
Pre-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.
AudioSampleRate — Sample rate of input audio signal
48000 (default) | positive scalar
Sample rate of the input audio signal in Hz, specified as a positive scalar.
Stereo — Option to enable stereo modulation
0 (default) |
Option to enable stereo modulation, specified as a logical
Set this property to
falsefor monophonic audio signals.
Set this property to
truefor stereophonic audio signals. The object modulates the audio input (L – R) in the 38 kHz band in addition to modulating the audio signal in the baseband (L + R).
For more information, see Multiplexed Stereo and RDS (or RBDS) FM Signal.
RBDS — Option to enable RDS (or RBDS) waveform modulation
0 (default) |
Option to enable RDS (or RBDS) waveform modulation, specified as a logical
true). If you set this property to
object accepts the baseband RDS (or RBDS) waveform as its second input and modulates the
RDS (or RBDS) signal at 57 kHz. For more information, see Multiplexed Stereo and RDS (or RBDS) FM Signal.
RBDSSamplesPerSymbol — Oversampling factor of RDS (or RBDS) input signal
10 (default) | positive integer
Oversampling factor of the RDS (or RBDS) input 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
To enable this property, set the
RBDS property to
audiosig — Audio signal
N-element column vector | M-by-N matrix
Audio signal, specified as one of these options.
N-element column vector for mono signals — If you set the
false, you must specify the audio signal as a column vector. N is the number of samples in the audio signal.
M-by-N matrix for stereo signals — M is the number of stereo channels. N is the number of samples in the audio signal per channel.
For information about signal length restrictions, see Limitations.
If you set the
Stereo property to
true, the audio signal must have at least two channels and the
System object performs stereo encoding after pre-emphasis filtering.
Complex Number Support: Yes
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
FM Broadcast Streaming Audio Signal
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.
audiofilereader = dsp.AudioFileReader('guitartune.wav', ... '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( ... 'AudioSampleRate',audiofilereader.SampleRate, ... 'SampleRate',240e3); fmbDemod = comm.FMBroadcastDemodulator( ... 'AudioSampleRate',audiofilereader.SampleRate, ... '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 (
while ~isDone(audiofilereader) audioData = audiofilereader(); modData = fmbMod(audioData); demodData = fmbDemod(modData); % Demodulate and play signal end
Modulate and Demodulate Streaming Audio Signals Using FM Broadcast Method
Modulate and demodulate an audio signal with the FM broadcast modulator and demodulator System objects. Plot the frequency responses to compare the input and demodulated audio signals.
Load the audio file
guitartune.wav by using an audio file reader System object™. Set the samples per frame to 44,100, which is large enough to include the entire audio file.
audiofilereader = dsp.AudioFileReader("guitartune.wav", ... SamplesPerFrame=44100); x = audiofilereader();
Create spectrum analyzer System objects to plot the spectra of the modulated and demodulated signals.
saFM = spectrumAnalyzer( ... SampleRate=152e3, ... Title="FM Broadcast Signal"); saAudio = spectrumAnalyzer( ... SampleRate=44100, ... ShowLegend=true, ... Title="Audio Signal", ... ChannelNames=["Input signal" "Demodulated signal"]);
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. Configure the demodulator to match the specified modulator.
fmbMod = comm.FMBroadcastModulator( ... AudioSampleRate=audiofilereader.SampleRate, ... SampleRate=200e3); fmbDemod = comm.FMBroadcastDemodulator(fmbMod)
fmbDemod = comm.FMBroadcastDemodulator with properties: SampleRate: 200000 FrequencyDeviation: 75000 FilterTimeConstant: 7.5000e-05 AudioSampleRate: 44100 PlaySound: false Stereo: false RBDS: false
The length of the sequence input to the object must be an integer multiple of the decimation factor. To determine the audio decimation factor of the filter in the modulator and demodulator, use the
info object function.
ans = struct with fields: AudioDecimationFactor: 441 AudioInterpolationFactor: 2000 RBDSDecimationFactor: 19 RBDSInterpolationFactor: 320
ans = struct with fields: AudioDecimationFactor: 50 AudioInterpolationFactor: 57 RBDSDecimationFactor: 50 RBDSInterpolationFactor: 57
The audio decimation factor of the modulator is a multiple of the audio frame length of 44,100. The audio decimation factor of the demodulator is an integer multiple of the 200,000 samples data sequence length of the modulator output.
Modulate the audio signal and plot the spectrum of the modulated signal.
y = fmbMod(x); saFM(y)
Demodulate the modulated audio signal and plot the resultant spectrum. Compare the input signal spectrum with the demodulated signal spectrum. The spectra are similar except that the demodulated signal has smaller high-frequency components.
z = fmbDemod(y); saAudio([x z])
FM Broadcast Modulate and Demodulate an RBDS Waveform
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
If you set the
true, both the audio and RDS (or RBDS) inputs must satisfy this equation.
The RDS (or RBDS) signal sample rate is
The length of the input RDS (or RBDS) signal,
rbdssig, must be an integer multiple of the
RBDSDecimationFactorproperty. The input length of the audio signal,
audiosig, must be an integer multiple of the
AudioDecimationFactorproperty. For more information on
AudioDecimationFactor, see the
System object includes the functionality of the
System object, plus de-emphasis filtering and the ability to receive stereophonic
FM amplifies high-frequency noise and degrades the overall signal-to-noise ratio. To compensate, FM broadcasters insert a pre-emphasis filter before FM modulation to amplify the high-frequency content. The FM receiver has a reciprocal de-emphasis filter after the FM demodulator to attenuate high-frequency noise and restore a flat signal spectrum. This figure shows the order of processing operations.
The pre-emphasis filter has a highpass characteristic transfer function given by
where τs is the filter time constant. The time constant is 75 μs in the United States and 50 μs in Europe. Similarly, the transfer function for the lowpass de-emphasis filter is given by
For an audio sample rate of 44.1 kHz, the de-emphasis filter has the response shown in this figure.
Multiplexed Stereo and RDS (or RBDS) FM Signal
FM broadcast supports stereophonic and monophonic operations. To support stereo transmission:
The Left+Right channel information is assigned to the mono portion of the spectrum (0 to 15 kHz).
The Left-Right channel information is amplitude modulated onto the 23 to 53 kHz region of the baseband spectrum using a 38 kHz subcarrier signal.
A pilot tone at 19 kHz in the multiplexed signal enables the FM receiver to coherently demodulate the stereo and RDS (or RBDS) signals.
This figure shows the spectrum of the multiplex baseband signal.
The multiplex message signal, m(t) is given by
where C0, C1, and C2 are gains. To generate the appropriate modulation level, these gains scale the amplitudes of the L(t)±R(t) signals, the 19 kHz pilot tone, and the RDS (or RBDS) subcarrier, respectively.
This figure shows the multiplexing (MPX) encoder block diagram of the FM broadcast modulator, which is used to generate the multiplex baseband signal. L(t) and R(t) are the left and right audio signal components of the time-domain waveforms. RBDS(t) is the time-domain waveform of the RDS (or RBDS) signal.
 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.
 Taub, H., and D. Schilling. Principles of Communication Systems. McGraw-Hill Series in Electrical Engineering. New York: McGraw-Hill, 1971, pp. 142–155.
 Der, Lawrence. "Frequency Modulation (FM) Tutorial". Silicon Laboratories Inc., pp. 4–8.
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Usage notes and limitations:
See System Objects in MATLAB Code Generation (MATLAB Coder).
Introduced in R2015a