This repository has been archived by the owner on Mar 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
README
85 lines (61 loc) · 2.45 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
convert-samples
===============
The active repository is at https://codeberg.org/glv/convert-samples
convert-samples is a command-line program to convert samples received from
software defined radios from one format to another.
## Usage
convert-samples -f <fmt> -t <fmt> [-i <file>] [-o <file>] [-r <ratio>] [-s <shift>]
Options:
-f <fmt>
Format of input samples.
-t <fmt>
Format of output samples.
-i <file> [default: stdin]
Read input samples from 'file'.
-o <file> [default: stdout]
Write output samples to 'file'.
-r <ratio> [default: 1.0]
Resample using the given ratio.
-s <shift> [default: 0.0]
Shift frequencies, where 'shift' is the frequency shift in Hertz
divided by the sample rate.
Supported formats:
- s8: signed 8 bit integer
- u8: unsigned 8 bit integer
- s16: signed 16 bit integer
- u16: unsigned 16 bit integer
- s32: signed 32 bit integer
- u32: unsigned 32 bit integer
- f32: 32 bit float
- cs8: complex made of signed 8 bit integers
- cu8: complex made of unsigned 8 bit integers
- cs16: complex made of signed 16 bit integers
- cu16: complex made of unsigned 16 bit integers
- cs32: complex made of signed 32 bit integers
- cu32: complex made of unsigned 32 bit integers
- cf32: complex made of 32 bit floats
## Examples
Convert samples from the cf32 format used by GNU Radio to the cs8 format used
by HackRF:
convert-samples -f cf32 -t cs8 -i samples.cf32 -o samples.cs8
Convert samples from the cu8 format used by RTL-SDR to the cs16 format used
by BladeRF:
convert-samples -f cu8 -t cs16 -i samples.cu8 -o samples.cs16
Convert samples from the cf32 format to the cs8 format, and also double the
sample rate:
convert-samples -f cf32 -t cs8 -i samples.cf32 -o samples.cs8 -r 2.0
Let's suppose that we have samples in cu8 format at 2000000 S/s with a signal
of interest at 400 kHz having a 10 kHz bandwidth. We would like to have samples
in cf32 format with only the wanted signal. To do that we can shift the
frequencies by -400 kHz to put the signal in the center of the spectrum,
and reduce the sample rate to 25000 S/s:
- shift: -400000 / 2000000 = -0.2
- ratio: 25000 / 2000000 = 0.0125
convert-samples -f cu8 -t cf32 -i samples.cu8 -o signal.cf32 -r 0.0125 -s -0.2
## Compilation
convert-samples requires the following dependencies:
- libliquid (https://github.com/jgaeddert/liquid-dsp)
It can be compiled with the usual:
./autogen.sh
./configure
make