-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcommands
More file actions
62 lines (41 loc) · 3.4 KB
/
commands
File metadata and controls
62 lines (41 loc) · 3.4 KB
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
to generate a signal and save it to a file
./ofdm filenameNoExtension
generates a file called filenameNoExtension.wav with the audio that plays
ofdmDecoder takes samples directly from stdin, so arecord can pull samples from the microphone like this
./ofdm filename; arecord -c 1 -r 44100 -f S32_LE | ./ofdmDecoder
This helps cut out the first second of audio while alsa actually prepares the mic amplifier
arecord -r 44100 -c 1 -f S32_LE -d 1 > /dev/null; ./ofdm test & arecord -c 1 -r 44100 -f S32_LE | ./ofdmDecoder
arecord -r 44100 -c 1 -f S32_LE -d 1 > /dev/null; ../build/ofdm test & arecord -c 1 -r 44100 -f S32_LE | ../build/ofdmDecoder
or, you can pipe samples directly stdout | stdin if you pass '-' as the filename to ofdm
./ofdm - | ./ofdmDecoder
You could playback a wav file generated by ofdm, shoving the samples directly to ofdmDecoder using ffmpeg to read the file
ffmpeg -i 16QAM.wav -c copy -f s32le pipe:1 | ../build/ofdmDecoder
you can adjust the gain for raw files so it doesn't overwhelm the reciever
ffmpeg -i test.wav -filter:a "volume=0.25" -f s32le pipe:1 | ../build/ofdmDecoder
or record a sound from speaker -> microphone for later playback using the above command
./ofdm bpsk_window32 & arecord -c 1 -r 44100 -f S32_LE bpsk_window32_recorded.wav
compare the synthesized signal to the one picked up on the microphone
arecord -c 1 -r 44100 -f S32_LE -d 1 /dev/null; ./ofdm synthesizedSignal & arecord -c 1 -r 44100 -f S32_LE -d 2 recorededSignal.wav
record both the original synthesized waveform and the recorded resulting waveform along with running the decoder on it
arecord -r 44100 -c 1 -f S32_LE -d 1 > /dev/null; ../build/ofdm synthesizedSignal_multiModulation_60s & arecord -c 1 -r 44100 -f S32_LE -d 60 recordedSignal_multiModulation_60s.wav;
audacity is a great program to sanity check the waveforms and recordings.
Big problem I just figured out was that the gain on my microphone was way too high, and it's not adjusted automatically, I have to manually adjust it with
wpctl set-volume ## 0.25
to something that matches the environment. Not sure how to automate that yet
But the performance is much better with the mic gain lower. The waveforms don't clip nearly as much.
debugging with gdb
make a fifo
mkfifo testFifo
ffmpeg -i test.wav -f s32le pipe:1 > testFifo
then in gdb in another terminal (or with & at end of las command), run with input from the fifo
(gdb) r < testFifo
it allows you to make a nice pipeline
this command uses ffmpeg to resample the result output of ofdm and saves a couple files before passing the resampled version off to ofdmDecoder
../build/ofdm - | ffmpeg -f s32le -r 44100 -i pipe:0 test.wav -filter:a aresample=osr=192000 test2.wav -y -filter:a aresample=osr=192000 -f s32le pipe:1 | ../build/ofdmDecoder
for testing the resampler
Generally how I do a transmission and record, decoding offline
arecord -r 44100 -c 1 -f S32_LE -d 1 > /dev/null; ../build/ofdm - | ffmpeg -f s32le -r 44100 -i pipe:0 -y test.wav -f s32le pipe:1 | aplay -f S32_LE -c1 -r 44100 & arecord -c 1 -r 44100 -f S32_LE -d 120 test2.wav
then
ffmpeg -i test2.wav -filter aresample=osr=192000 -f s32le pipe:1 | ../build/ofdmDecoder
or from file instead of gen
arecord -r 44100 -c 1 -f S32_LE -d 1 > /dev/null; aplay synthesizedSignal_pilotPitch_100_seed_1.wav & arecord -c 1 -r 44100 -f S32_LE -d 120 recordedSignal_pilotPitch_100_seed_1_fading.wav