Hi Theodric,
no, these values that appear on stdout are already audio samples (PCM
to be specific).
That is the "job" of rtl_fm:
It takes the complex time-domain baseband samples from the hardware,
detects FM (which implies detecting a frequency deviation) and convert
that to audio amplitude values.
The `aplay` command barely takes these samples and hands them over to
the sound card (after resampling to fit possible sampling rates, I
guess, as 120 kHz isn't something that sound systems usually operate
at).
The `rtl_fm` command takes a couple of parameters. In your case, `-M
wbfm` means that it's demodulating FM in a way compatible to broadcast
FM; that implies fixed parameters for deviation, emphasis etc.
What you want is really not `rtl_fm`, which primarily is a demo
program, not meant to be a flexible do-it-all solution.
What you want, showing deviation of a station, does very much sound
like a spectrum visualization. Wouldn't a waterfall or even just an
instantaneous spectrum visualization be what you want?
Best regards,
Marcus
On Wed, 2018-03-14 at 15:57 -0400, Theodric Young wrote:
> Hi,
>
> I'm new to SDR and I have a question about the data values that are
> generated by the rtl_fm program.
>
> I got rtl_fm running on my system (cygwin running on Windows 7). It is
> sending a stream of 16-bit signed integer values to stdout which I can
> redirect to a file or pipe to an audio playback system, such as sox. So
> when I do this:
>
> rtl_fm -f 88.1M -M wbfm -s 240k -r120k -g 30 | play -t raw -r 120k -b
> 16 -c 1 -e s -V1 -
>
> I hear sweet, sweet music! Hurray!
>
> But how do these 16-bit integers relate to the modulation level of the
> carrier? I'm assuming that the values are directly proportional to the
> instantaneous frequency deviation of the transmitted signal. Is that
> right? If so, how do I determine that ratio? I'm hoping to use this to
> build a device that shows total modulation (as a percentage of the
> maximum modulation of +/- 75kHz) for an FM radio station.
>
> Also, I'm assuming that the sample-rate of the output data stream needs
> to be at least 120kHz because the baseband signal includes the stereo
> pilot (19kHz), the stereo subcarrier (38kHz) and an RBDS subcarrier (57
> kHz).
>
> Any insight would be appreciated. Thanks in advance,
>
> Theodric Young
by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id w2EJvsmv004135
(version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT)
for <osmocom-sdr(a)lists.osmocom.org>; Wed, 14 Mar 2018 15:57:55 -0400
To: osmocom-sdr(a)lists.osmocom.org
From: Theodric Young <theodric(a)mit.edu>
Subject: Meaning of rtl_fm output values
Message-ID: <d96cc71b-6d81-d786-ccd1-708c84eba0ff(a)mit.edu>
Date: Wed, 14 Mar 2018 15:57:55 -0400
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Brightmail-Tracker:
H4sIAAAAAAAAA+NgFjrPIsWRmVeSWpSXmKPExsUixCmqrHusbmWUwc1tLBb7Jl9hcWD0WHXa
I4AxissmJTUnsyy1SN8ugSvjx87tbAX7OSv2bJ/G3sC4lr2LkZNDQsBEYvqcdSxdjFwcQgKL
mSQWnj/DCuFcZZSY37eNDcKZxizRv/4YI0iLiICixOTf24FaODjYBNQlJv6zAQkLC2hIrL91
jwXE5hWwkvh96Q0TiM0ioCrxdtsWZhBbVCBGomXJB0aIGkGJkzOfgNUzC5hJzNv8kBnClpfY
/nYO8wRG3llIymYhKZuFpGwBI/MqRtmU3Crd3MTMnOLUZN3i5MS8vNQiXRO93MwSvdSU0k2M
4FCS5N/BOKfB+xCjAAejEg+vgdrKKCHWxLLiytxDjJIcTEqivPunrIgS4kvKT6nMSCzOiC8q
zUktPsQowcGsJMJ7vxConDclsbIqtSgfJiXNwaIkzutuoh0lJJCeWJKanZpakFoEk5Xh4FCS
4D1cC9QoWJSanlqRlplTgpBm4uAEGc4DNFyuDmR4cUFibnFmOkT+FKMxx5+HL9uYOW68eN3G
LMSSl5+XKiXO+x5knABIaUZpHtw0UDq4yHbi3CtGcaDnhHkFQAbyAFMJ3LxXQKuYgFZlblsB
sqokESEl1cAYvC/tgHRlS0bd5jnmP/RrNsU/5J6oKV7p8ixCsX/y/3f1+69NufA6bvK/ZD3H
9ONOL50fx7tsVejkM1b7PVkywsPsRnRig7Vbm3R4CnNom/9rs3aJA/Oas4WZ3H7tupb8N8np
Qy/bcu5Nib3zr84VOPDxw2mnkitF08Nv2O89u0UxJ+n8wa9KLMUZiYZazEXFiQCH7MfT4gIA
AA==
X-BeenThere: osmocom-sdr(a)lists.osmocom.org
X-Mailman-Version: 2.1.26
Precedence: list
List-Id: "Discussion on Osmocom SDR projects \(OsmoSDR,
rtl-sdr\)" <osmocom-sdr.lists.osmocom.org>
List-Unsubscribe: <https://lists.osmocom.org/mailman/options/osmocom-sdr>,
<mailto:osmocom-sdr-request@lists.osmocom.org?subject=unsubscribe>
List-Archive: <http://lists.osmocom.org/pipermail/osmocom-sdr/>
List-Post: <mailto:osmocom-sdr@lists.osmocom.org>
List-Help: <mailto:osmocom-sdr-request@lists.osmocom.org?subject=help>
List-Subscribe: <https://lists.osmocom.org/mailman/listinfo/osmocom-sdr>,
<mailto:osmocom-sdr-request@lists.osmocom.org?subject=subscribe>
X-List-Received-Date: Wed, 14 Mar 2018 19:57:59 -0000
Hi,
I'm new to SDR and I have a question about the data values that are
generated by the rtl_fm program.
I got rtl_fm running on my system (cygwin running on Windows 7). It is
sending a stream of 16-bit signed integer values to stdout which I can
redirect to a file or pipe to an audio playback system, such as sox. So
when I do this:
rtl_fm -f 88.1M -M wbfm -s 240k -r120k -g 30 | play -t raw -r 120k -b
16 -c 1 -e s -V1 -
I hear sweet, sweet music! Hurray!
But how do these 16-bit integers relate to the modulation level of the
carrier? I'm assuming that the values are directly proportional to the
instantaneous frequency deviation of the transmitted signal. Is that
right? If so, how do I determine that ratio? I'm hoping to use this to
build a device that shows total modulation (as a percentage of the
maximum modulation of +/- 75kHz) for an FM radio station.
Also, I'm assuming that the sample-rate of the output data stream needs
to be at least 120kHz because the baseband signal includes the stereo
pilot (19kHz), the stereo subcarrier (38kHz) and an RBDS subcarrier (57
kHz).
Any insight would be appreciated. Thanks in advance,
Theodric Young
Hi --
I'm trying to understand the sampling and decimation structure of the
RTL-SDR dongle, to work out the effective number of bits after decimation.
From Google and looking at the librtlsdr code (which is beyond my
programming depth), I think I've figured out the following. I'd much
appreciate verification/correction/amplification.
1. Actual ADC in the RTL-2832U is a single-bit sigma-delta running at
some very high rate.
2. This is converted to 28.8 msps at 8 bit depth.
3. 28.8 msps is downsampled to the rate requested by the user and sent
over the USB bus as 8 bit unsigned IQ pairs.
Based on that, I *think*:
a. Any processing gain in the downsample from 28.8 msps/8 bits within
the chip is lost because the wire samples are limited to 8 bits. The
output is 8 bits dynamic range regardless of the sample rate set.
b. THEREFORE... for best dynamic range one wants to set the RTL-2832U
to the highest sample rate that avoids lost samples, and do further
decimation in the host processor, where the added bits aren't lost on
the wire.
I'd appreciate any verification or correction of that analysis.
Thanks,
John