Readme updated, mp3 usage example added

pull/157/head
Marcin Kondej 2021-08-23 00:15:18 +02:00
rodzic c54fc2fcca
commit 24590903b9
2 zmienionych plików z 17 dodań i 18 usunięć

Wyświetl plik

@ -46,21 +46,21 @@ echo "performance"| sudo tee /sys/devices/system/cpu/cpu0/cpufreq/scaling_govern
``` ```
3. Using lower FM broadcasting frequencies (below 93 MHz) when transmitting. 3. Using lower FM broadcasting frequencies (below 93 MHz) when transmitting.
### Supported audio formats ### Supported audio formats
You can transmitt uncompressed WAV (.wav) files directly or read audio data from stdin, eg.: You can transmitt uncompressed WAV (.wav) files directly or read audio data from stdin, eg. using MP3 file:
```
sudo apt-get install sox
sox acoustic_guitar_duet.wav -r 22050 -c 1 -b 16 -t wav - | sudo ./fm_transmitter -f 100.6 -
```
Please note only uncompressed WAV files are supported. If you receive the "corrupted data" error try converting the file, eg. by using FFMPEG:
```
ffmpeg -i not_wav_song.webm -f wav -bitexact -acodec pcm_s16le -ar 22050 -ac 1 song.wav
sudo ./fm_transmitter -f 100.6 song.wav
```
Or you could also use SoX:
``` ```
sudo apt-get install sox libsox-fmt-mp3 sudo apt-get install sox libsox-fmt-mp3
sox my-audio.mp3 -r 22050 -c 1 -b 16 -t wav my-converted-audio.wav sox example.mp3 -r 22050 -c 1 -b 16 -t wav - | sudo ./fm_transmitter -f 100.6 -
sudo ./fm_transmitter -f 100.6 my-converted-audio.wav ```
Please note only uncompressed WAV files are supported. If you receive the "corrupted data" error try converting the file, eg. by using SoX:
```
sudo apt-get install sox libsox-fmt-mp3
sox example.mp3 -r 22050 -c 1 -b 16 -t wav converted-example.wav
sudo ./fm_transmitter -f 100.6 converted-example.wav
```
Or you could also use FFMPEG:
```
ffmpeg -i example.webm -f wav -bitexact -acodec pcm_s16le -ar 22050 -ac 1 converted-example.wav
sudo ./fm_transmitter -f 100.6 converted-example.wav
``` ```
### Microphone support ### Microphone support
In order to use a microphone live input use the `arecord` command, eg.: In order to use a microphone live input use the `arecord` command, eg.:

Wyświetl plik

@ -32,9 +32,8 @@
*/ */
#include "transmitter.hpp" #include "transmitter.hpp"
#include <cstdlib>
#include <csignal>
#include <iostream> #include <iostream>
#include <csignal>
#include <unistd.h> #include <unistd.h>
bool stop = false; bool stop = false;
@ -62,13 +61,13 @@ int main(int argc, char** argv)
loop = true; loop = true;
break; break;
case 'f': case 'f':
frequency = ::atof(optarg); frequency = std::stof(optarg);
break; break;
case 'd': case 'd':
dmaChannel = ::atof(optarg); dmaChannel = std::stoi(optarg);
break; break;
case 'b': case 'b':
bandwidth = ::atof(optarg); bandwidth = std::stof(optarg);
break; break;
case 'v': case 'v':
std::cout << EXECUTABLE << " version: " << VERSION << std::endl; std::cout << EXECUTABLE << " version: " << VERSION << std::endl;