Source
rpps.source ¶
Signal sources and sinks: files, radios and memory (on pysdrlib), sockets, SigMF recordings, WAV, channels in shared
memory (ShmSink; received with Device("shm@...")); and packets: pcapng for Wireshark, live or in a file (PcapSink,
read back with Pcap), and a Linux TUN/TAP interface both ways (Tun)
Modules:
| Name | Description |
|---|---|
formats |
Sample file formats, as pysdrlib names them: a complex format is named by the bits of its I (or Q) alone, as in SigMF |
net |
Samples from the network: raw IQ over UDP or TCP, in any pysdrlib format |
pcap |
Packets to Wireshark: pcapng written to a file, a FIFO, stdout or a Windows named pipe, live ( |
shm |
Channels in shared memory: one process channelizes, others receive their channel (pysdrlib's |
sigmf |
SigMF recordings: the samples and what they were recorded with (sigmf.org, the core namespace) |
source |
Sources and sinks of signal blocks |
transmit |
Transmitting with a radio: blocks of samples out of a pysdrlib device ( |
tun |
A Linux TUN/TAP interface, both ways: decoded packets onto it, packets written to it out to transmit |
wav |
WAV files in and out (the stdlib |
formats ¶
Sample file formats, as pysdrlib names them: a complex format is named by the bits of its I (or Q) alone, as in SigMF
ci8t ci16t ci32t complex two's complement integers (8, 16 and 32 bit I and Q)
cf16 cf32 cf64 complex floats (cf32 is two float32: numpy's complex64; cf64 is complex128)
i8t.. ui8.. f32.. real samples
rp.source.formats.ls() lists them.
Functions:
| Name | Description |
|---|---|
pysdrlib |
The pysdrlib module, refused (ImportError) when it is older than NEED |
ls |
The format names pysdrlib knows |
get |
A pysdrlib Formats member from its name (or a member) |
pysdrlib ¶
The pysdrlib module, refused (ImportError) when it is older than NEED
Source code in src/rpps/source/formats.py
ls ¶
get ¶
A pysdrlib Formats member from its name (or a member)
Source code in src/rpps/source/formats.py
net ¶
Samples from the network: raw IQ over UDP or TCP, in any pysdrlib format
src = rp.source.Socket("cf32", "udp://0.0.0.0:5004", Fs=2e6, cf=100e6) # listen for datagrams
src = rp.source.Socket("cui8", "tcp://10.0.0.5:1234", Fs=2.4e6) # connect and read a byte stream
for out in src(16384) + rx:
...
The bytes are cut into whole samples whatever the datagrams or reads hold (a sample split across two keeps its first
part until the rest comes), so the blocks are the same however the network delivers them. TCP ends when the far side
closes (the last block flushes the stream); UDP when timeout seconds pass with nothing received (None: never).
Classes:
| Name | Description |
|---|---|
Socket |
Raw samples from |
Socket ¶
Bases: Source
Raw samples from url: udp://host:port (bound and listened on) or tcp://host:port (connected to)
fmt: pysdrlib format of the samples; scale: integer formats become floats in [-1, 1), as File's do. timeout: seconds of silence that end a UDP stream (None: wait for ever); a TCP stream ends when it is closed
Methods:
| Name | Description |
|---|---|
decode |
Whole samples of |
Source code in src/rpps/source/net.py
decode ¶
Whole samples of raw bytes (as an array) and the bytes left over
Source code in src/rpps/source/net.py
pcap ¶
Packets to Wireshark: pcapng written to a file, a FIFO, stdout or a Windows named pipe, live (PcapSink); and read back
(Pcap)
rx, caps = p.rx(), p.capture # a profile's capture rules (rpps.link.capture)
with rp.source.PcapSink("-") as sink: # rpps rx ... --pcap - | wireshark -k -i -
for block in src(65536):
rx(block)
caps.packets(rx.take_messages()) >> sink # (a list of Packets: each written)
Targets: a path (a file, or a FIFO made with mkfifo: opening waits for Wireshark), "-" for stdout, a file object, or
"pipe:\\.\pipe\<name>, that waits for wireshark -k -i \\.\pipe\<name>.
Every packet is flushed as it is written, so a live view keeps up.
Each (profile, kind, link type) is an interface of its own (named rpps:<profile>:<kind>, described with its link type
and frequency), so Wireshark's interface column and filters tell them apart. Each packet's comment says what it was
(frame.comment contains "FAILED"): profile and kind, the check and its verdict, frequency, quality, sample, fields; a
failed check also sets the packet's CRC-error flag (frame.packet_flags_crc_error == 1).
rpps: every packet wrapped in RPPS's own header on LINKTYPE_USER0, which tools/wireshark/rpps.lua shows as fields to
filter on (rpps.crc_ok == 0, rpps.profile == "ble/adv", rpps.field.type) before handing the packet to its link
type's dissector. clock: "message" stamps a packet with its message's time (the source's, else seconds from the start
of the stream), "wall" with the time it is written.
Classes:
| Name | Description |
|---|---|
PcapSink |
Write packets (rpps.link.capture.Packet) as pcapng: |
Record |
A packet read from a capture: dlt (its link type's number), data, time (seconds), comment, flags, interface |
Pcap |
Packets of a pcapng or pcap capture, in order: |
Functions:
| Name | Description |
|---|---|
rpps_header |
RPPS's header for a Packet: TLVs (type 1 byte, length 2 bytes big endian), then the packet's bytes |
PcapSink ¶
Write packets (rpps.link.capture.Packet) as pcapng: packets >> sink, packet >> sink, sink.write(...)
target: a path or FIFO, "-" (stdout), a file object, or "pipe:
Methods:
| Name | Description |
|---|---|
write |
Write a Packet or an iterable of them (None items skipped); returns the sink |
Source code in src/rpps/source/pcap.py
write ¶
Write a Packet or an iterable of them (None items skipped); returns the sink
Source code in src/rpps/source/pcap.py
Record ¶
A packet read from a capture: dlt (its link type's number), data, time (seconds), comment, flags, interface
Source code in src/rpps/source/pcap.py
Pcap ¶
Packets of a pcapng or pcap capture, in order: for rec in rp.source.Pcap(path) (Records). source: a path, bytes,
or a file object. A FIFO is read as it is written. interfaces: [(dlt, name)] of a pcapng's interfaces seen so far
Source code in src/rpps/source/pcap.py
rpps_header ¶
RPPS's header for a Packet: TLVs (type 1 byte, length 2 bytes big endian), then the packet's bytes
Source code in src/rpps/source/pcap.py
shm ¶
Channels in shared memory: one process channelizes, others receive their channel (pysdrlib's shm streams)
wide = rp.source.Device("hackrf", cf=915e6, Fs=20e6)(65536)
wide + rp.signal.filters.Channelizer(8) >> rp.source.ShmSink([f"ch{k}" for k in range(8)]) # one process
for blk in rp.source.Device("shm@rpps.ch3")(8192) + rx: ... # any other
A process that runs several demodulators does the wideband work once and publishes each channel; each demodulator is a
process of its own, receiving at its own pace (the GIL is not shared, a crash is its own). Any number of receivers can
take one channel: a decoder and a live view (pyspecan) alike, and pysdrlib.find() lists them.
The streams, their rings and manifests are pysdrlib's (pysdrlib.shm.ShmStream, which owns the format): a channel is
received as a pysdrlib device, rp.source.Device("shm@<namespace>.<name>"), with positions true to time (a gap upstream
is a gap there, a receiver that falls behind counts what it missed in stream.dropped), a retune starting the stream
over, and the end of the publisher ending the blocks.
Classes:
| Name | Description |
|---|---|
ShmSink |
Publish blocks to shared memory, for other processes: |
ShmSink ¶
Publish blocks to shared memory, for other processes: block >> sink, blocks >> sink
name: the channel's name, or one per column of a channelized block (Channelizer output, (time, M)): column k is the
channel centred on cf + k Fs (above half the channels, the negative frequencies), at the block's rate. Each is
published as <namespace>.<name> (namespace None: the bare name). capacity: samples a ring holds (None: pysdrlib's
default, a second); a receiver more than that behind is moved on. labels: {name: text} for a view; profile: the
profile that decodes these, if any; bw: a channel's usable width [Hz] (None: its rate; a critically sampled
channelizer's flat passband is a little under it). directory: where the manifests go (pysdrlib's default:
$PYSDRLIB_SHM_DIR). Close it (or use with) to end the streams.
A block's meta.pos is where it goes in its stream, so a gap upstream stays a gap. A change of rate or centre, or a
stream that starts over, is a retune: a new generation, which receivers follow.
Source code in src/rpps/source/shm.py
sigmf ¶
SigMF recordings: the samples and what they were recorded with (sigmf.org, the core namespace)
src = rp.source.SigMF("capture.sigmf-meta") # or the .sigmf-data path: Fs, cf and the format from the metadata
for out in src(65536) + rx: ...
src.annotations # [{"core:sample_start": ..., "core:label": ...}, ...]
with rp.source.SigMFSink("out", Fs=2e6, cf=915e6, datatype="cf32_le") as sink:
blocks >> sink # out.sigmf-data, and out.sigmf-meta when it is closed
Datatypes: complex or real, float (f32, f64) or integer (i8, i16, i32, u8, u16, u32), little or big endian
("cf32_le", "ci16_be", "ri8"). Integers are scaled to [-1, 1) as File's are. Blocks start at the recording's
core:sample_start of its first capture; a capture's core:frequency sets cf (the first; later captures are listed in
captures). numpy and json only: no sigmf package needed. How the radio received (pysdrlib's pysdrlib:rx: the chain
and its LO, whether it inverts, the reference) is the source's context (see rp.source.Source: an inverting chain is
undone as the samples are read).
Classes:
| Name | Description |
|---|---|
SigMF |
A SigMF recording (the -meta or -data path, or their stem): Fs, cf and the datatype from its metadata |
SigMFSink |
Blocks written as a SigMF recording: |
Functions:
| Name | Description |
|---|---|
dtype_of |
numpy dtype of the real components, and whether samples are complex, from a SigMF core:datatype |
SigMF ¶
Bases: Source
A SigMF recording (the -meta or -data path, or their stem): Fs, cf and the datatype from its metadata
The data file stays memory mapped until close() (or the end of a with block): close it before the file is deleted
or overwritten, which Windows refuses while it is mapped
Methods:
| Name | Description |
|---|---|
close |
Unmap the data file. Windows can't delete or replace a file while it is mapped; reading again maps it again |
Attributes:
| Name | Type | Description |
|---|---|---|
data |
The recording's raw values, memory mapped (mapped again if the source was closed) |
Source code in src/rpps/source/sigmf.py
SigMFSink ¶
SigMFSink(path, Fs=None, cf=None, datatype='cf32_le', description=None, annotations=(), context=None)
Blocks written as a SigMF recording: path.sigmf-data as they come, path.sigmf-meta when closed
datatype: the SigMF core:datatype written ("cf32_le" default; integer types are scaled from [-1, 1) and clipped).
Fs, cf: the recording's; else the first block's. annotations: added to the metadata. context: how the samples were
received (a pysdrlib RxContext, kept as pysdrlib:rx); else the first block's stream's (stream.rx), marked undone
when its source conjugated them
Source code in src/rpps/source/sigmf.py
dtype_of ¶
numpy dtype of the real components, and whether samples are complex, from a SigMF core:datatype
Source code in src/rpps/source/sigmf.py
source ¶
Sources and sinks of signal blocks
src = rp.source.File("ci16t", "capture.cs16", Fs=2e6, cf=100e6)
for out in src(4096) + (lpf + dec): # blocks flow through the pipeline, its state carried along
...
src(4096) + (lpf + dec) >> rp.source.Sink("cf32", "out.iq") # or straight into a sink
Threads: .threaded() puts everything before it in its own thread, and .pipelined(pipe) gives every stage of a
pipeline its own, connected by bounded queues. Stages overlap where they release the GIL (numpy, the rpps._native
kernels), and a radio is drained while the stages work:
src(16384).threaded(drop=True).pipelined(agc + timing + carrier) >> sink
Classes:
| Name | Description |
|---|---|
Blocks |
Blocks of a stream. The operators apply to every block as it is produced, with state carried between them |
Source |
Parent of the things that produce blocks. Call it with a block length for the blocks |
File |
Samples from a file, in blocks (a short last block is delivered, flushing the stream) |
Memory |
Samples held in memory, in blocks (a short last block flushes the stream): what was captured from a device, for |
Device |
Samples from a pysdrlib device (RTL-SDR, HackRF, ..., "sim", or "remote"): blocks until the loop is left. A device |
Sink |
Write blocks to a file with pysdrlib's FileSink: |
Blocks ¶
Blocks of a stream. The operators apply to every block as it is produced, with state carried between them
blocks + stage # DSP stage or pipeline (also blocks * pipe, blocks / pipe)
blocks >> sink # write every block; returns the sink
blocks.threaded() # everything so far runs in a thread of its own
blocks.pipelined(a + b + c) # a, b and c each in a thread of their own
A stage that splits a block (rp.sync.Burst: a list of bursts) gives its pieces one by one: what follows runs on each.
Methods:
| Name | Description |
|---|---|
threaded |
Run everything before this point (the source, the stages applied so far) in its own thread |
pipelined |
blocks + pipe, with every top-level stage of the pipe in its own thread (and the source in another). A |
collect |
All the output joined into one array |
threaded ¶
Run everything before this point (the source, the stages applied so far) in its own thread
depth: blocks the queue to the next thread holds.
drop: when the queue is full, discard the block and count it in stream.dropped (source samples) instead of
waiting. Use for a radio, which overruns anyway when it isn't read; the stream then has gaps: the stages
carry on, and the positions of what follows count the block (meta.pos stays true to time).
An exception in the thread is raised where the blocks are read; leaving the loop stops the thread (and
closes the source).
Source code in src/rpps/source/source.py
pipelined ¶
blocks + pipe, with every top-level stage of the pipe in its own thread (and the source in another). A
profile's receiver that branches runs its trunk in one and its branches in another (pipelined_parts)
Source code in src/rpps/source/source.py
collect ¶
All the output joined into one array
Source ¶
Parent of the things that produce blocks. Call it with a block length for the blocks
REP: the representation its blocks are (SAMPLES; a demodulator's ring of timed symbols is SYMBOLS), and APPLIED the
sync it has done already ({"timing"}): profile.rx(source=src) skips the steps before and those (rpps.base, Contracts).
ppm: how far the radio's reference is off (+15: its clock runs 15 ppm fast). The sample rate and the tuned frequency
both come from it, so blocks carry Fs and cf times (1 + ppm 1e-6): what was actually sampled, and where.
context: how the samples were received (a pysdrlib RxContext: Device.get_rx_context(), a SigMF recording's
pysdrlib:rx; give one for a file that doesn't say), kept as stream.rx. A chain whose LO is above the signal
(context.inverted: mirrored, and not undone by whoever wrote the samples) mirrors the spectrum: with
correct (the default) the samples are conjugated here, every block and peek, so cf + f is over the air at f
(conjugated; stream.rx_conjugated: put right, here or before). An inversion found later (rp.sync.Inversion)
is then the transmitter's or a transponder's, not ours.
Methods:
| Name | Description |
|---|---|
set_context |
How the samples are received (see the class): a new one when the radio retunes or the chain changes |
restart |
Start the stream over: the stages that ran on it forget their state |
peek |
The first |
Attributes:
| Name | Type | Description |
|---|---|---|
conjugated |
The samples come conjugated, putting right a chain that inverts the spectrum |
Source code in src/rpps/source/source.py
conjugated
property
¶
The samples come conjugated, putting right a chain that inverts the spectrum
set_context ¶
How the samples are received (see the class): a new one when the radio retunes or the chain changes
Source code in src/rpps/source/source.py
restart ¶
peek ¶
The first count samples as an array (not a block), without using them up: a File keeps its place
File ¶
Bases: Source
Samples from a file, in blocks (a short last block is delivered, flushing the stream)
fmt: pysdrlib format name (see rp.source.formats.ls())
Fs, cf, sps: what the capture was recorded with
scale: integer formats become floats in [-1, 1), as a device's samples are
context, correct: how it was received (a pysdrlib RxContext) and whether to undo an inverting chain (see Source)
Methods:
| Name | Description |
|---|---|
peek |
|
read |
The next |
Attributes:
| Name | Type | Description |
|---|---|---|
percent |
Fraction of the file read [0, 1] |
Source code in src/rpps/source/source.py
peek ¶
count samples from sample start (fewer near the end) as an array, leaving the read position where it was
Source code in src/rpps/source/source.py
Memory ¶
Bases: Source
Samples held in memory, in blocks (a short last block flushes the stream): what was captured from a device, for
analysis that runs slower than the device does (Memory.capture), or an array made some other way
Methods:
| Name | Description |
|---|---|
peek |
|
capture |
The next |
Source code in src/rpps/source/source.py
peek ¶
count samples from sample start (fewer near the end), as an array
capture
classmethod
¶
The next count samples of a source (a Device), held: blocks as they come, then nothing more is read. The
rate and centre are what the source settled on; dropped samples during the capture are in .dropped.
skip: samples to read and throw away first (a radio just tuned can still deliver the old frequency for a while)
Source code in src/rpps/source/source.py
Device ¶
Bases: Source
Samples from a pysdrlib device (RTL-SDR, HackRF, ..., "sim", or "remote"): blocks until the loop is left. A device that is open already (pysdrlib.connect gives one) stays open; one this opens is closed when the blocks end
for blk in rp.source.Device("hackrf", cf=100e6, Fs=10e6)(8192) + rx: ...
Positions and time come from the radio: samples it lost (an overrun) are counted in meta.pos, so a block after a
gap starts further on and the stages carry the gap into theirs (one inside a block shows at the next block), and
stream.dropped adds them up. The radio's get_rx_context() (its chain, reference, gains) is stream.rx; a chain that
inverts the spectrum is undone here unless correct=False (see Source). stream.t0 is the radio's clock (hw_time) where it timestamps its samples, else
the host's time.monotonic() at the first sample, so meta.time_of(k) dates any item.
When the device's frequency or rate changes while it streams (a "freq" / "rate" event: another program retuned it, a
shared-memory publisher retuned), the block is cut there and the stream starts over (restart) at the new setting,
positions counting from the change. When the device is lost (unplugged, a publisher that stopped: pysdrlib's
err.Lost), the blocks end, the last one flushing, and lost says why.
device: a pysdrlib driver name ("hackrf"), a target string ("hackrf@SERIAL", "shm@rpps.ch3",
"radiohost/hackrf-0": opened here by pysdrlib.open, closed by close() or when it is lost), or a device you made
(rp.source.Device(pysdrlib.device("sim", realtime=False))). rx_gain: the receive gain as a fraction 0-1 of the
device's range (the same on any radio), or a {stage: fraction} dict
Methods:
| Name | Description |
|---|---|
peek |
The first |
close |
Close a device this opened from a target string (one opened by name is closed when its blocks end) |
Source code in src/rpps/source/source.py
peek ¶
The first count samples from the device, as an array. A device can't rewind: these are not in the blocks
that follow (rp.analysis.survey keeps them in Survey.head)
Source code in src/rpps/source/source.py
close ¶
Close a device this opened from a target string (one opened by name is closed when its blocks end)
Sink ¶
Write blocks to a file with pysdrlib's FileSink: block >> sink or blocks >> sink
The file is opened when the sink is made. Use it as a context manager (or close()) to finish the file.
scale: samples in [-1, 1) are stored at the format's full scale (FileSink's scale, the inverse of File's)
clip: saturate what is out of range instead of failing (FileSink counts it in clipped and warns when closed)
Attributes:
| Name | Type | Description |
|---|---|---|
clipped |
Samples that were saturated |
Source code in src/rpps/source/source.py
transmit ¶
Transmitting with a radio: blocks of samples out of a pysdrlib device (DeviceSink)
with rp.source.DeviceSink("hackrf", cf=433.92e6, Fs=2e6, tx_gain=0.3) as radio:
enc.packet(pkt) >> radio # rp.profile.Encoder: a packet's samples
The device starts transmitting when the sink is made and stops when it is closed; write queues samples (complex, full
scale +-1) and blocks while the device's queue is full. A block's rate must be the sink's (be explicit: resample first,
or make the sink at the block's rate). Receive with rp.source.Device.
Classes:
| Name | Description |
|---|---|
DeviceSink |
Transmit blocks with a pysdrlib device: |
DeviceSink ¶
Transmit blocks with a pysdrlib device: block >> sink, blocks >> sink
device: a pysdrlib driver name ("hackrf"), a target string ("hackrf@SERIAL", "radiohost/hackrf-0": opened here, closed
by close()), or a device you made (left open). cf, Fs: the transmit frequency and rate (None: the device's own).
tx_gain: the transmit gain as a fraction 0-1 of the device's range. channel: the transmit channel. scale: multiplies
the samples (headroom: clipping at +-1 is the radio's). count: samples queued
Methods:
| Name | Description |
|---|---|
write |
Queue a block (rp.Data at the sink's rate, or an array) for transmission; returns the sink |
Source code in src/rpps/source/transmit.py
write ¶
Queue a block (rp.Data at the sink's rate, or an array) for transmission; returns the sink
Source code in src/rpps/source/transmit.py
tun ¶
A Linux TUN/TAP interface, both ways: decoded packets onto it, packets written to it out to transmit
tun = rp.source.Tun("rpps0") # raw IP (a TUN): IPv4 and IPv6 packets
tun = rp.source.Tun("rpps1", linktype="ieee802_15_4_nofcs") # a TUN of another link type (TUNSETLINK)
tun = rp.source.Tun("rpps2", mode="tap") # Ethernet frames (a TAP)
p.capture.packets(rx.take_messages()) >> tun # receive: each packet of its link type
for pkt in tun.packets(timeout=1.0): ... # transmit: what the system sends on it
Wireshark (or tcpdump) on the interface sees the packets as the system does, of the interface's link type. A TUN is raw
IP; on Linux it can take another link type (Linux's ARPHRD: 802.11, 802.11 with radiotap, 802.15.4 without FCS, AX.25
with its KISS byte), set while the interface is down, and then each packet carries packet information (its protocol,
the link type's proto) since the kernel takes a TUN's packets without it for IP only. A TAP is Ethernet. A packet of
a link type that is the interface's with transforms (config/linktype "from": 802.15.4 with its FCS on an 802.15.4
interface, which has none; AX.25 on Linux's AX.25 with its KISS byte) is converted; other packets are not written
(counted in skipped): a pcapng stream (rpps.source.PcapSink) carries any link type, and what each packet was.
Making the interface needs CAP_NET_ADMIN once; a persistent interface owned by the user is opened without it:
sudo ip tuntap add dev rpps0 mode tun user $USER # (mode tap for a TAP)
sudo ip link set rpps0 up # (after the link type is set: Tun sets it while it is down)
up: bring the interface up when opened (True: or fail; None: try, and leave it to ip link set up without the right
to). Linux only: on Windows and macOS use a pcapng pipe (PcapSink("pipe:<name>"), a FIFO, or stdout).
Classes:
| Name | Description |
|---|---|
Tun |
A TUN or TAP interface (see module). name: the interface; mode: "tun" or "tap"; linktype: a TUN's link type |
Tun ¶
A TUN or TAP interface (see module). name: the interface; mode: "tun" or "tap"; linktype: a TUN's link type
(config/linktype: "raw" by default; one with an arphrd), a TAP's is "ethernet". count: packets written; skipped:
packets of another link type, by its name
Methods:
| Name | Description |
|---|---|
set_up |
Bring the interface up (or down); needs CAP_NET_ADMIN |
write |
Write a Packet (rpps.link.capture), bytes (of the interface's link type), or an iterable of them; returns self |
packets |
The packets the system sends on the interface, as bytes of its link type, until |
Source code in src/rpps/source/tun.py
set_up ¶
Bring the interface up (or down); needs CAP_NET_ADMIN
Source code in src/rpps/source/tun.py
write ¶
Write a Packet (rpps.link.capture), bytes (of the interface's link type), or an iterable of them; returns self
Source code in src/rpps/source/tun.py
packets ¶
The packets the system sends on the interface, as bytes of its link type, until timeout seconds pass with none
(None: for ever) or it is closed
Source code in src/rpps/source/tun.py
wav ¶
WAV files in and out (the stdlib wave module: no dependency)
rp.source.write_wav("out.wav", audio, 48000, peak=0.8) # an array at once, scaled so its peak is 0.8 of full scale blocks + demod >> rp.source.WavSink("out.wav") # a stream, at the blocks' own rate for blk in rp.source.Wav("sdr.wav", iq=True)(4096): ... # in: 8/16/32-bit PCM; a 2-channel IQ recording as samples
Classes:
| Name | Description |
|---|---|
WavSink |
A 16-bit WAV file written block by block: |
Wav |
A PCM WAV file as a source, scaled to [-1, 1): one channel gives real samples (audio); two give I and Q |
Functions:
| Name | Description |
|---|---|
write_wav |
Write audio (frames, or (frames, channels)) as a 16-bit WAV at |
WavSink ¶
A 16-bit WAV file written block by block: block >> sink or blocks >> sink. Samples in [-1, 1) (clipped).
rate: Hz, else the first block's Fs. channels: 1, or 2 for blocks of (frames, 2). Close it (or use with) to finish
Source code in src/rpps/source/wav.py
Wav ¶
Bases: Source
A PCM WAV file as a source, scaled to [-1, 1): one channel gives real samples (audio); two give I and Q
(iq=True: an SDR's IQ recording) or, with iq=False, the first channel. Fs is the file's rate
Source code in src/rpps/source/wav.py
write_wav ¶
Write audio (frames, or (frames, channels)) as a 16-bit WAV at rate Hz. peak: normalise to that fraction of full scale