Continuous playback

Discussions about active development projects
pavel
Posts: 790
Joined: Sat May 23, 2015 5:22 pm

Re: Continuous playback

Post by pavel » Wed Apr 14, 2021 10:14 am

I didn't know that the operating system on your computer is Windows.

GNU Radio for Windows doesn't work with wideband SDR transceiver.

pavel
Posts: 790
Joined: Sat May 23, 2015 5:22 pm

Re: Continuous playback

Post by pavel » Wed Apr 14, 2021 1:03 pm

I've just added two Python scripts that can be used to record and playback the spectrum without GNU Radio:
https://github.com/pavel-demin/red-pita ... ide/client

hermy_sf
Posts: 14
Joined: Sun Mar 28, 2021 8:04 am

Re: Continuous playback

Post by hermy_sf » Wed Apr 14, 2021 7:40 pm

Many thanks, I will try that.

hermy_sf
Posts: 14
Joined: Sun Mar 28, 2021 8:04 am

Re: Continuous playback

Post by hermy_sf » Thu Apr 15, 2021 7:09 am

Hi Pavel,
Trying to get started with with your py-scripts. Now I am uncertain if I should use the normal RP ecosystem or an SD-card with the image zip file 'red-pitaya-alpine-3.12-armv7-20210326'. When I try the latter, it seems that there is no operating system starting when powering up the RP and I expect that an OS is always required. I have used a new SD card formatted with exFAT. You mentioned FAT32 in one of your last posts, so might that be the reason ? What is the right installation procedure ?

hermy_sf
Posts: 14
Joined: Sun Mar 28, 2021 8:04 am

Re: Continuous playback

Post by hermy_sf » Thu Apr 15, 2021 12:18 pm

Hi Pavel,
Forget my previous mail, I just copied the sources to the classical RP ecosystem as usual, compiled them and could start the sdr-wideband-transceiver. I could also start your py-scripts successfully.

One question: The max. sampling rate in the record.py seems to be 2.5 MS/s. Could that one be easily increased to something like 4MS/s or 5MS/s ?
Best
Hermann

pavel
Posts: 790
Joined: Sat May 23, 2015 5:22 pm

Re: Continuous playback

Post by pavel » Thu Apr 15, 2021 1:55 pm

Could that one be easily increased to something like 4MS/s or 5MS/s ?
Not easily.

2.5 MS/s is the sample rate of I/Q samples. The usable bandwidth in this case is 2 MHz. It's more than 1.5 MHz that you had with rpsa_client. Do you really need a bandwidth of 4-5 MHz?

hermy_sf
Posts: 14
Joined: Sun Mar 28, 2021 8:04 am

Re: Continuous playback

Post by hermy_sf » Thu Apr 15, 2021 4:23 pm

Hi Pavel,
pavel wrote:
Thu Apr 15, 2021 1:55 pm
2.5 MS/s is the sample rate of I/Q samples. The usable bandwidth in this case is 2 MHz.
Sorry for asking stupid questions. Obviously I have not yet understood very well the SDR principle. Does that mean that Nyquist is fulfilled up to 2 MHz even with an IQ-Samplingrate of 2.5 MS/s ? Is this because the CIC yields up to 5 MS/s and I do not have to care about the FIR downsampling ? This then would of course solve my problem, in fact I need no more than 1.7 MHz bandwidth.
pavel wrote:
Thu Apr 15, 2021 1:55 pm
It's more than 1.5 MHz that you had with rpsa_client.
This puzzles me a bit . When I run the streamingserver on the RP and receive the data with the rpsa_client.exe from the command line, then I can definitely sample with 5MS/s and even more (maybe with a small fraction of lost data, but that does not matter so much because the AM-band signals are lousy anyway). When analyzing the spectrum of the records with MATLAB everything is correct up to 2.5 MHz and I could also demodulate individual broadcasting stations up to 1.7 MHz without problems. The only limitation I have is the 4GB file size.

However, when I play back these recordings with your 'dac_player', then frequencies above 900MHz are not reproduced any more. So do you refer to the 'dac_player' when mentioning the 1.5 MS/s ?

Your remarks lead me to another (maybe stupid) question: 'record.py' and 'playback.py' expect as input the parameter 'freq' which I set to 0 at the moment. When I want to record another RF band centered at say 4 MHz with an analog bandwidth of say 1 MHz could I then set freq=4000000, rate=2500000 and also correctly reproduce the signal ? In other words is 'freq' just the local oscillator frequency of the synchronous demodulator ?

Thanks for your help and best regards

Hermann

pavel
Posts: 790
Joined: Sat May 23, 2015 5:22 pm

Re: Continuous playback

Post by pavel » Thu Apr 15, 2021 4:56 pm

The 2.5 MSPS is sample rate of the I and Q samples separately. The total sample rate (I sample rate + Q sample rate) is 5 MSPS.
So do you refer to the 'dac_player' when mentioning the 1.5 MS/s ?
No. I refer to your very first comment in this thread.
In other words is 'freq' just the local oscillator frequency of the synchronous demodulator ?
The 'freq' parameter is the local oscillator frequency. There is no synchronization. All the elements of the signal processing chain are shown in the diagram in my notes at this link.

I'd suggest setting the 'freq' parameter to the center of the frequency range you want to record, not to zero.

For example, if you want to record the frequency range from 500 to 1500 kHz, the center frequency should be set to 1000 kHz and the sample rate should be set to 1250 kSPS.

hermy_sf
Posts: 14
Joined: Sun Mar 28, 2021 8:04 am

Re: Continuous playback

Post by hermy_sf » Sat Apr 17, 2021 8:59 am

Hi Pavel,

You are a GENIUS ! Yesterday I could record a 30' dataset with the full mediumwave-band when setting LO to 1MS/s and Rate to 1,25 MS/s. I can perfectly play back the full spectrum and tune through it with my AM-radio. The signal quality is perfect! Thank you, you have solved a 10 years old problem of mine. :D

Just one remaining question: The file for 30' recording is nearly 18 GB. I guess that rate=1,25 MS/s produce effectively 2,5 MS/s data, then this filesize would result from writing 4 B per data point (i.e. int32), because of 2,5*4*60*30=18000. Is there a reason for using int32 because of writing complex data or just because this is the Python standard ? If int16 would also suffice, could one change that easily in the python script so as to save file size ?

Best regards and many thanks

Hermann

pavel
Posts: 790
Joined: Sat May 23, 2015 5:22 pm

Re: Continuous playback

Post by pavel » Sat Apr 17, 2021 10:56 am

I'm glad that the solution with the wideband SDR transceiver works well for you.

Since I/Q samples are complex values, the data type is 64-bit complex (a pair of 32-bit floating point values). This representation of complex numbers is used in C, FORTRAN and probably some other languages and libraries. In Python, 32-bit floating point values can be converted to 16-bit integer values using numpy:

Code: Select all

import numpy as np
data = np.empty(1024, dtype = np.float32)
size = data_sock.recv_into(data)
while size > 0 and not interrupted:
  f.write((data[0:size//4] * 32767).astype(np.int16))
  size = data_sock.recv_into(data)

Code: Select all

import numpy as np
data = np.empty(1024, dtype = np.int16)
size = f.readinto(data)
while size > 0 and not interrupted:
  data_sock.send(data[0:size//2].astype(np.float32) / 32767)
  size = f.readinto(data)

Post Reply
jadalnie klasyczne ekskluzywne meble wypoczynkowe do salonu ekskluzywne meble tapicerowane ekskluzywne meble do sypialni ekskluzywne meble włoskie

Who is online

Users browsing this forum: No registered users and 24 guests