using the command line below I can hear messages from my motorola t80 using channel 7 (446.08125M), sub-code 120
rtl_fm -f 446.08125M -M fm -s 12k -g 19.2 -l 50 | play -r 12k -t raw -e s -b 16 -c 1 -V1 -
but when i try to do the same using pyrtlsdr I get nothing
import numpy as np
import sounddevice as sd
from rtlsdr import RtlSdr
FREQ_HZ = 446.08125e6 # 446.08125 MHz
SAMPLE_RATE = 12e3 # 12 kHz (same as -s 12k)
GAIN = 40 # Gain setting (same as -g 40)
SQUELCH_LEVEL = 50 # Squelch level (same as -l 50)
BUFFER_SIZE = 1024 # Number of samples per batch
sdr = RtlSdr()
sdr.sample_rate = SAMPLE_RATE
sdr.center_freq = FREQ_HZ
sdr.gain = GAIN
def fm_demodulate(iq_samples):
phase = np.angle(iq_samples)
unwrapped_phase = np.unwrap(phase)
return np.diff(unwrapped_phase)
def process_audio():
print(f"Listening on {FREQ_HZ/1e6} MHz...")
while True:
iq_samples = sdr.read_samples(BUFFER_SIZE)
fm_audio = fm_demodulate(iq_samples)
fm_audio = np.clip(fm_audio * 10000, -1, 1)
if np.max(np.abs(fm_audio)) < SQUELCH_LEVEL / 100:
fm_audio[:] = 0
sd.play(fm_audio, 44100)
sd.wait()
try:
process_audio()
except KeyboardInterrupt:
print("Stopping SDR...")
sdr.close()
my setup:
- raspberry pi 5
- DVB-T / DAB / FM / SDR USB Stick mit RTL2832U Chipsatz
- motorola t80
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744244228a4564849.html
评论列表(0条)