I’m having difficulty receiving on two channels simultaneously, using the SoapySDR Python API.
The code used for data capture is shown below. When I capture a single channel and decode the FM broadcast channel at that frequency, I get clear and crisp audio. If I capture two channels, and try to decode one, I get recognizable audio, but very noisy, garbled, and sampled at the wrong rate. Any suggestions would be most appreciated!
import SoapySDR
from SoapySDR import *
import numpy as np
import pickle
import sys
output_file = sys.argv[1]
num_channels = int(sys.argv[2])
# Configure receiver parameters
sample_rate = 10e6
center_freq = 92.5e6
antenna = 'LNAL'
bandwidth = 4e6
gain = 40.
n_samples = int(sample_rate * 3)
sdr = SoapySDR.Device( {'driver':'lime'} )
channel_list = []
buffer_list = []
for channel in range(num_channels):
channel_list.append(channel)
buffer_list.append(np.array([0]*n_samples, np.complex64))
sdr.setSampleRate(SOAPY_SDR_RX, channel, sample_rate)
sdr.setFrequency(SOAPY_SDR_RX, channel, "RF", center_freq)
sdr.setFrequency(SOAPY_SDR_RX, channel, "BB", 0)
sdr.setAntenna(SOAPY_SDR_RX, channel, antenna)
sdr.setBandwidth(SOAPY_SDR_RX, channel, bandwidth)
sdr.setGain(SOAPY_SDR_RX, channel, gain)
# Initialize the stream
rxStream = sdr.setupStream(SOAPY_SDR_RX, SOAPY_SDR_CF32,channel_list)
status = sdr.activateStream(rxStream) #start streaming
if( status != 0 ):
print('** activateStream error: ',status)
mtu_size = sdr.getStreamMTU(rxStream)
# Read some short buffers to flush the pipeline
for i in range(4):
sr = sdr.readStream(rxStream, buffer_list, mtu_size)
if(sr.ret!=mtu_size):
print('** Read error %d '%sr.ret)
# Now read a block of data to keep
sr = sdr.readStream(rxStream, buffer_list, n_samples)
if(sr.ret!=n_samples):
print('** Read error %d '%sr.ret)
data = {'sample_rate':sample_rate, 'center_freq':center_freq, 'antenna':antenna, 'buffers':buffer_list}
with open(output_file,'wb') as fd:
pickle.dump( data, fd )
sdr.deactivateStream(rxStream)
sdr.closeStream(rxStream)