projekte:iqmod:start
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen RevisionVorhergehende ÜberarbeitungNächste Überarbeitung | Vorhergehende Überarbeitung | ||
projekte:iqmod:start [2014/02/17 12:22] – thasti | projekte:iqmod:start [2022/08/04 10:37] (aktuell) – Link war Scam yc | ||
---|---|---|---|
Zeile 19: | Zeile 19: | ||
* LO-Buffer: 10..500MHz | * LO-Buffer: 10..500MHz | ||
* Mischer: 140..1000MHz | * Mischer: 140..1000MHz | ||
- | * Frequenzbereich BB: 0..80MHz -> auch für (D)ATV geeignet: [[http:// | + | * Frequenzbereich BB: 0..80MHz -> auch für (D)ATV geeignet: [[https:// |
* Ausgangsleistung: | * Ausgangsleistung: | ||
==== LO-Filter ==== | ==== LO-Filter ==== | ||
Zeile 380: | Zeile 380: | ||
===== Ansteuerung ===== | ===== Ansteuerung ===== | ||
- | Um normale Audio-Dateien FM-moduliert als I/Q-Signale mit einer Soundkarte ausgeben zu können, gibt es folgendes kleines Tool: **fmmod** | + | Um normale Audio-Dateien FM-moduliert als I/Q-Signale mit einer Soundkarte ausgeben zu können, gibt es folgendes kleines Tool: **fmmod**. |
- | + | ||
- | <file c fmmod.c> | + | |
- | /* complex frequency modulator for i/q signal processing | + | |
- | * Sebastian Weiss < | + | |
- | * Di 4. Feb 16:10:01 CET 2014 | + | |
- | */ | + | |
- | + | ||
- | #include < | + | |
- | #include < | + | |
- | #include < | + | |
- | #include < | + | |
- | + | ||
- | #define BUFFER_LEN | + | |
- | + | ||
- | void usage(void) | + | |
- | { | + | |
- | printf(" | + | |
- | inputfile: path to input file(needs to be single channel)\n \ | + | |
- | outputfile: path to output file\n \ | + | |
- | carrier: carrier frequency in Hz(standard: | + | |
- | freqdev: frequency deviation in Hz(standard: | + | |
- | } | + | |
- | + | ||
- | void process_data(double *data, int count, int fs, double fc, double freqdev) | + | |
- | { | + | |
- | static double old_phase = 0.0; | + | |
- | double cumsum[BUFFER_LEN]; | + | |
- | double phase; | + | |
- | int i; | + | |
- | + | ||
- | if (count == 0) | + | |
- | return; | + | |
- | + | ||
- | cumsum[0] = data[0]/fs; | + | |
- | for (i = 1; i < count; i++) { | + | |
- | cumsum[i] = cumsum[i-1] + data[i]/fs; | + | |
- | } | + | |
- | + | ||
- | for (i=0; i < count; i++) { | + | |
- | phase = 2*M_PI*fc/ | + | |
- | data[2*i] = cos(phase); | + | |
- | data[2*i + 1] = -sin(phase); | + | |
- | } | + | |
- | + | ||
- | old_phase = fmod(phase, 2*M_PI); | + | |
- | return; | + | |
- | } | + | |
- | + | ||
- | int main(int argc, char *argv[]) | + | |
- | { | + | |
- | static double data[2*BUFFER_LEN]; | + | |
- | SNDFILE *infile, *outfile; | + | |
- | SF_INFO sfinfo; | + | |
- | int readcount; | + | |
- | double carrier; | + | |
- | double freqdev; | + | |
- | + | ||
- | if ((argc > 5) || (argc < 3)) { | + | |
- | usage(); | + | |
- | return 1; | + | |
- | } | + | |
- | + | ||
- | freqdev = (argc == 5) ? atof(argv[4]) : 3000.0; | + | |
- | carrier = (argc > 3) ? atof(argv[3]) : 0.0; | + | |
- | + | ||
- | infile = sf_open(argv[1], | + | |
- | if (!infile) { | + | |
- | printf(" | + | |
- | sf_perror(NULL); | + | |
- | return 1; | + | |
- | } | + | |
- | + | ||
- | if (sfinfo.channels > 1) { | + | |
- | printf(" | + | |
- | return 1; | + | |
- | } | + | |
- | + | ||
- | sfinfo.channels = 2; | + | |
- | + | ||
- | outfile = sf_open(argv[2], | + | |
- | if (!outfile) { | + | |
- | printf(" | + | |
- | sf_perror(NULL); | + | |
- | return 1; | + | |
- | } | + | |
- | + | ||
- | while ((readcount = sf_read_double(infile, | + | |
- | process_data(data, | + | |
- | sf_write_double(outfile, | + | |
- | } | + | |
- | + | ||
- | sf_close(infile); | + | |
- | sf_write_sync(outfile); | + | |
- | sf_close(outfile); | + | |
- | + | ||
- | return 0; | + | |
- | } | + | |
- | + | ||
- | </ | + |
projekte/iqmod/start.txt · Zuletzt geändert: 2022/08/04 10:37 von yc