SDRPLAY linux commandline tools?

Add useful snippets of code or links to entire SDR projects.
vsboost
Posts: 23
Joined: Mon Oct 26, 2015 8:06 am

Re: SDRPLAY linux commandline tools?

Postby vsboost » Thu Mar 10, 2016 6:02 am

Cool

Now i need to learn hot to integrate it with other projects.
Last edited by vsboost on Thu Jan 01, 1970 12:00 am, edited 0 times in total.
Reason: No reason

IW2DHW
Posts: 58
Joined: Wed Sep 23, 2015 7:33 pm

Re: SDRPLAY linux commandline tools?

Postby IW2DHW » Thu Mar 10, 2016 8:16 pm

I am testing play_sdr code with csdr utility

In csdr there is a command file csdr-fm [freq] [gain]

Using this with an RTL-SDR on a 89.3 MHz I get corretly a local FM station. Audio is not so good but there is reception.

Simply changing rtl_sdr command with play_sdr I get only noise.

What I am missing?

Regards
Franco Spinelli
IW2DHW
Last edited by IW2DHW on Thu Jan 01, 1970 12:00 am, edited 0 times in total.
Reason: No reason

sdrplay
Posts: 542
Joined: Wed Jan 07, 2015 7:58 am

Re: SDRPLAY linux commandline tools?

Postby sdrplay » Thu Mar 10, 2016 9:19 pm

What gain (or gain reduction in the RSP's case) are you using?

Let me know where to get csdr from and what command line you are using and I'll check out the code.

Best regards,

SDRplay Support
Last edited by sdrplay on Thu Jan 01, 1970 12:00 am, edited 0 times in total.
Reason: No reason

0815
Posts: 45
Joined: Sat Jan 30, 2016 3:07 pm

Re: SDRPLAY linux commandline tools?

Postby 0815 » Fri Mar 11, 2016 11:16 am

hi,

sdrplay, please tell me how to change this for RSP:

#define DEFAULT_ASYNC_BUF_NUMBER 12
#define DEFAULT_BUF_LENGTH (16 * 16384)

rtlsdr_read_async(dev, rtlsdr_callback, (void *)(NULL),
DEFAULT_ASYNC_BUF_NUMBER,
DEFAULT_BUF_LENGTH);

what i tried is:

#define DEFAULT_ASYNC_BUF_NUMBER 12
#define DEFAULT_BUF_LENGTH (336 * 2) // (16 * 16384)

r = mir_sdr_ReadPacket(ibuf, qbuf, &firstSample, &grChanged, &rfChanged,
&fsChanged),(void *)(NULL),
DEFAULT_ASYNC_BUF_NUMBER,
DEFAULT_BUF_LENGTH;

i can compile but it wont work....

please let me know, it regarding to rtl_adsb.c

thanks!

regards
Last edited by 0815 on Thu Jan 01, 1970 12:00 am, edited 0 times in total.
Reason: No reason

IW2DHW
Posts: 58
Joined: Wed Sep 23, 2015 7:33 pm

Re: SDRPLAY linux commandline tools?

Postby IW2DHW » Fri Mar 11, 2016 11:53 am

csdr library can downloaded from

https://github.com/simonyiszk/csdr

It is same library used in OpenWebRX

http://sdr.hu/openwebrx

In library there is a command csdr-fm. It is a simple shell script with a chain of commands
Used as is, with only a frequency in MHz, it is working with an RTS-SDR device
Simply changing rtl_sdr with play_sdr give only noise.
Gain have a default of 30 but changing this parameter there is no change

Regards

Franco Spinelli
IW2DHW
Last edited by IW2DHW on Thu Jan 01, 1970 12:00 am, edited 0 times in total.
Reason: No reason

0815
Posts: 45
Joined: Sat Jan 30, 2016 3:07 pm

Re: SDRPLAY linux commandline tools?

Postby 0815 » Fri Mar 11, 2016 1:19 pm

@IW2DHW,

try this one:

http://wikisend.com/download/380816/rawIQ

rename it to play_sdr and give it a try - compiled with ubuntu 14.04.1

i guess the is no need for change in code as it uses rtl_sdr only:

"rtl_sdr -s 2400000 -f `python -c "print int($1*1e6)"` -g $GAIN -"

regards
Last edited by 0815 on Thu Jan 01, 1970 12:00 am, edited 0 times in total.
Reason: No reason

sdrplay
Posts: 542
Joined: Wed Jan 07, 2015 7:58 am

Re: SDRPLAY linux commandline tools?

Postby sdrplay » Fri Mar 11, 2016 1:51 pm

I have tested out csdr and there is a csdr-fm script.

I edited it, changed rtl_sdr to play_sdr...

playsdr-fm 89.1 40

works fine for me. Do you have a specific case that doesn't work? Have you tried that test script?

Best regards,

SDRplay Support
Last edited by sdrplay on Thu Jan 01, 1970 12:00 am, edited 0 times in total.
Reason: No reason

IW2DHW
Posts: 58
Joined: Wed Sep 23, 2015 7:33 pm

Re: SDRPLAY linux commandline tools?

Postby IW2DHW » Fri Mar 11, 2016 3:58 pm

I have downloaded your code from your GitHub
https://github.com/SDRplay/examples
as per your message of 9 Mar, compiled it on Ubuntu 14.04/64 bit and tested using a modified version of csdr-fm. The only change was replacing rtl_sdr with play_sdr previously compiled. This test result in only noise.

When I return to home I will try your code from wikisend and reply here with results.

Regards
Franco Spinelli
IW2DHW
Last edited by IW2DHW on Thu Jan 01, 1970 12:00 am, edited 0 times in total.
Reason: No reason

IW2DHW
Posts: 58
Joined: Wed Sep 23, 2015 7:33 pm

Re: SDRPLAY linux commandline tools?

Postby IW2DHW » Fri Mar 11, 2016 6:02 pm

Downloaded your code but no success.

This is my test:
spin@franco:~/Scaricati/ham/csdr$ csdr-fm 89.3
fir_decimate_cc: taps_length = 79
deemphasis_wfm_ff: tau = 5e-05, sample_rate = 48000
fractional_decimator_ff: window = HAMMING
fractional_decimator_ff: taps_length = 133
Found 1 device(s):
0: Realtek, RTL2838UHIDIR, SN: 00000001

Using device 0: Lifeview LV5TDeluxe
MPlayer2 2.0-701-gd4c5b7f-2ubuntu2 (C) 2000-2012 MPlayer Team

Playing -.
Detached kernel driver
Reading from stdin...
Cache size set to 1024 KiB
Cache fill: 0.00% (0 bytes) Found Fitipower FC0012 tuner
Sampling at 2400000 S/s.
Tuned to 89300000 Hz.
Cache fill: 0.00% (0 bytes) Tuner gain set to 19.20 dB.
Tuner error set to -28 ppm.
Reading samples in async mode...
Cache fill: 18.75% (196608 bytes)

Detected file format: rawaudio
Load subtitles in .
Cache not responding!
Selected audio codec: Uncompressed PCM [pcm]
AUDIO: 48000 Hz, 1 ch, s16le, 768.0 kbit/100.00% (ratio: 96000->96000)
AO: [pulse] 48000Hz 1ch s16le (2 bytes per sample)
Video: no video
Starting playback...
^C


MPlayer interrupted by signal 2 in module: unknown
Signal caught, exiting!

User cancel, exiting...

Exiting... (Quit)
Reattached kernel driver


After this test with RTL dongle i test SDRPlay:

spin@franco:~/Scaricati/ham/csdr$ ./csdr-fm-sdrplay 89.3 40
fir_decimate_cc: taps_length = 79
fractional_decimator_ff: window = HAMMING
fractional_decimator_ff: taps_length = 133
deemphasis_wfm_ff: tau = 5e-05, sample_rate = 48000
MPlayer2 2.0-701-gd4c5b7f-2ubuntu2 (C) 2000-2012 MPlayer Team

Playing -.
Reading from stdin...
Cache size set to 1024 KiB
Cache fill: 0.00% (0 bytes) Writing samples...
Cache fill: 19.14% (200704 bytes)

Detected file format: rawaudio
Load subtitles in .
Cache not responding!
Selected audio codec: Uncompressed PCM [pcm]
AUDIO: 48000 Hz, 1 ch, s16le, 768.0 kbit/100.00% (ratio: 96000->96000)
AO: [pulse] 48000Hz 1ch s16le (2 bytes per sample)
Video: no video
Starting playback...
^CSignal caught, exiting!



MPlayer interrupted by signal 2 in module: enable_cache

MPlayer interrupted by signal 2 in module: unknown

Exiting... (Quit)


^CSignal caught, exiting!
^CSignal caught, exiting!
^C


No sound, only noise and program don't exit with ^C. I have killed (kill -9) from another terminal window

This is relevant code from csdr-fm-sdrplay

Code: Select all

/home/spin/Scaricati/ham/sdrplay/rawIQ/rawIQ -s 2400000 -f `python -c "print int($1*1e6)"` -g $GAIN - | csdr convert_u8_f | csdr fir_decimate_cc 10 0.05 HAMMING | csdr fmdemod_quadri_cf | csdr fractional_decimator_ff 5 | csdr deemphasis_wfm_ff 48000 50e-6 | csdr convert_f_i16 | mplayer -cache 1024 -quiet -rawaudio samplesize=2:channels=1:rate=48000 -demuxer rawaudio -


Regard

Franco Spinelli
IW2DHW
Last edited by IW2DHW on Thu Jan 01, 1970 12:00 am, edited 0 times in total.
Reason: No reason

IW2DHW
Posts: 58
Joined: Wed Sep 23, 2015 7:33 pm

Re: SDRPLAY linux commandline tools?

Postby IW2DHW » Fri Mar 11, 2016 6:40 pm

Update after some more test.

Using a value of gain of 40 and greater produce only noise
A value of 10 20 or 30 produce a correct decoding, with audio better than RTL dongle

So the problem is in using correct gain reduction.
What correlation is used in your code? Is gain value a gain or a gain reduction?

Regards

Franco Spinelli
IW2DHW
Last edited by IW2DHW on Thu Jan 01, 1970 12:00 am, edited 0 times in total.
Reason: No reason


Return to “Code Corner”

Who is online

Users browsing this forum: No registered users and 1 guest