comnum.rds_receive#
- comnum.rds_receive(mpx, fs)#
The RDS of a multiplex: the biphase symbols demodulated from 57 kHz (Gardner clock recovery, Viterbi-Viterbi phase of the BPSK), differentially decoded, synchronised on the offset words, and the groups assembled into the station’s name, radiotext and clock (NRSC-4 / EN 50067 Sec. 1-3, the characters of Annex E, the date of Annex G).
- Parameters:
mpx (array_like) – the multiplex in hertz of deviation (
fm_discriminator()), at least 0.1 s.fs (float) – its sampling rate (Hz), a multiple of 2375 Hz of 120 kHz at least (228 kHz).
- Returns:
pi(int | None),pty(int | None),tp(bool | None),ps(str, 8 characters),radiotext(str),clock(dict withyear,month,day,hour,minutein UTC andoffset_half_hours, or None),group_types(dict"0A"→ count),complete_groups,valid_blocks,blocks, andgroups(a list of four information words each, None for a block whose checkword failed).- Return type:
- Raises:
ValueError – for an invalid rate or less than 0.1 s of multiplex.
Examples
>>> import comnum, numpy as np >>> ps = b"COMNUM " >>> groups = [comnum.rds_group_bits([0xF201, s, 0, ps[2 * s] << 8 | ps[2 * s + 1]]) for s in range(4)] >>> d = comnum.rds_differential_encode(np.tile(np.concatenate(groups), 4)) >>> silence = np.zeros(114_000) >>> m = comnum.fm_multiplex(silence, silence, 228e3, rds_bits=d) >>> r = comnum.rds_receive(m, 228e3) >>> hex(r["pi"]), r["ps"] ('0xf201', 'COMNUM ')