Main Content

comm.FMBroadcastModulator

Modulate broadcast FM audio signal

Description

The comm.FMBroadcastModulator 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:

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

fmbmodulator = comm.FMBroadcastModulator creates a FM broadcast modulator System object.

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

example

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

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

Data Types: double

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, FrequencyDeviation < SampleRate/2).

The system bandwidth BT = 2×(FrequencyDeviation + 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.

Data Types: double

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.

Data Types: double

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

Data Types: double

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

  • Set this property to false for monophonic audio signals.

  • Set this property to true for stereophonic audio signals. The object modulates the audio input (LR) 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.

Data Types: logical

Option to enable RDS (or RBDS) waveform modulation, specified as a logical 0 (false) or 1 (true). If you set this property to true, the 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.

Data Types: logical

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 RBDSSamplesPerSymbol × 1187.5 Hz.

Dependencies

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

Data Types: double

Usage

Description

outsig = fmbmodulator(audiosig) pre-emphasizes the input audio signal and modulates the pre-emphasized signal onto an FM-modulated baseband audio signal.

example

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

example

Input Arguments

expand all

Audio signal, specified as one of these options.

  • N-element column vector for mono signals — If you set the Stereo property to 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.

Data Types: double | single
Complex Number Support: Yes

RBDS signal, specified as a column vector. For information about RBDS signal length restrictions, see Limitations.

To generate the RBDS signal, use the comm.RBDSWaveformGenerator System object.

Data Types: double | single
Complex Number Support: Yes

Output Arguments

expand all

FM-modulated baseband signal, returned as a column vector of complex values of the same data type as the input signal, audiosig. The length of this output is length(audiosig) × (SampleRate/AudioSampleRate).

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

infoInformation about FM broadcast modulator or demodulator
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

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 (demodData).

while ~isDone(audiofilereader)
    audioData = audiofilereader();
    modData = fmbMod(audioData);
    demodData = fmbDemod(modData); % Demodulate and play signal
end

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.

info(fmbMod)
ans = struct with fields:
       AudioDecimationFactor: 441
    AudioInterpolationFactor: 2000
        RBDSDecimationFactor: 19
     RBDSInterpolationFactor: 320

info(fmbDemod)
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])

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

  • If you set the RBDS to true, both the audio and RDS (or RBDS) inputs must satisfy this equation.

    audioLengthaudioSampleRate=RBDSLengthRBDSSampleRate

  • The RDS (or RBDS) signal sample rate is RBDSSamplesPerSymbol × 1187.5 Hz.

  • The length of the input RDS (or RBDS) signal, rbdssig, must be an integer multiple of the RBDSDecimationFactor property. The input length of the audio signal,audiosig, must be an integer multiple of the AudioDecimationFactor property. For more information on RBDSDecimationFactor and AudioDecimationFactor, see the info object function.

Algorithms

expand all

The comm.FMBroadcastModulator System object includes the functionality of the comm.FMModulator System object, plus de-emphasis filtering and the ability to receive stereophonic signals.

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, 142–55. New York: McGraw-Hill, 1971.

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

Extended Capabilities

Version History

Introduced in R2015a