-
Notifications
You must be signed in to change notification settings - Fork 297
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed issue #59
- Loading branch information
Showing
12 changed files
with
147 additions
and
239 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
*.o | ||
*.swp | ||
fm_transmitter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,47 @@ | ||
# fm_transmitter | ||
|
||
Use Raspberry Pi as FM transmitter. Works on any RPi board. | ||
Use Raspberry Pi as FM transmitter. Works on any Raspberry Pi board. | ||
|
||
This project uses the general clock output to produce frequency modulated radio communication. It is based on idea originaly posted here: [http://icrobotics.co.uk/wiki/index.php/Turning_the_Raspberry_Pi_Into_an_FM_Transmitter](http://icrobotics.co.uk/wiki/index.php/Turning_the_Raspberry_Pi_Into_an_FM_Transmitter), but does not use DMA controller in order to distribute samples to output (clock generator), so sound quality is worse as in PiFm project and only mono transmition is available but this makes possible to run it on all kind of boards. | ||
|
||
## How to use it | ||
|
||
To compile this project use commands below: | ||
To use this project You will have to buid it. First, clone this repository, then use "make" command as shown below: | ||
``` | ||
sudo apt-get install make gcc g++ | ||
git clone https://github.com/markondej/fm_transmitter | ||
cd fm_transmitter | ||
make | ||
``` | ||
|
||
Then you can use it by typing: | ||
After successful build You can start transmitting by typing: | ||
``` | ||
sudo ./fm_transmitter [-f frequency] [-r] filename | ||
sudo ./fm_transmitter -f 102.0 acoustic_guitar_duet.wav | ||
``` | ||
where: | ||
* -f frequency - Specifies the frequency in MHz, default is 100.0 | ||
* -r - Loops the file | ||
* filename - WAVE file name | ||
Where: | ||
* -f 102.0 - Specifies the frequency in MHz, if not passed default is 100.0 | ||
* acoustic_guitar_duet.wav - Sample WAVE file, You can use your own | ||
|
||
### WAVE Files | ||
You can open uncompressed WAVE (.wav) files or read audio data from stdin, eg.: | ||
### Supported audio files | ||
You can transmitt uncompressed WAVE (.wav) files directly or read audio data from stdin, eg.: | ||
``` | ||
sox star_wars.wav -r 22050 -c 1 -b 16 -t wav - | sudo ./fm_transmitter -f 100.6 - | ||
``` | ||
|
||
Notice only uncompressed WAVE files are supported. If You expire "corrupted data" error try converting file, eg. by using SoX: | ||
``` | ||
sox my-audio.mp3 -r 22050 -c 1 -b 16 -t wav my-converted-audio.wav | ||
sudo ./fm_transmitter -f 100.6 my-converted-audio.wav | ||
``` | ||
### USB microphone | ||
To use a USB sound card microphone input use arecord, eg.: | ||
``` | ||
arecord -D hw:1,0 -c1 -d 0 -r 22050 -f S16_LE | sudo ./fm_transmitter -f 100.6 - | ||
``` | ||
In case of performance dropdown use ```plughw:1,0``` instead of ```hw:1,0```. | ||
In case of performance drop down use ```plughw:1,0``` instead of ```hw:1,0```. | ||
|
||
## Legal note | ||
Please keep in mind that transmitting on certain frequencies without special permissions may be illegal in your country. | ||
|
||
## New features | ||
* works on RPi 1, 2 and 3 | ||
* works on any Raspberry Pi model | ||
* reads mono and stereo files | ||
* reads data from stdin | ||
* based on threads | ||
|
||
Included sample audio was created by [graham_makes](https://freesound.org/people/graham_makes/sounds/449409/) and published on [freesound.org](https://freesound.org/) |
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,24 @@ | ||
CFLAGS += -Wall -fexceptions -pthread -lm -O3 -fpermissive -fno-strict-aliasing | ||
FLAGS = -Wall -fexceptions -pthread -O3 -fpermissive -fno-strict-aliasing | ||
INCLUDES = -I/opt/vc/include -L/opt/vc/lib | ||
LIBS = -lm -lbcm_host | ||
TARGET = fm_transmitter | ||
|
||
CPP=$(CCPREFIX)g++ | ||
|
||
all: main.o error_reporter.o wave_reader.o transmitter.o | ||
$(CPP) $(CFLAGS) -o $(TARGET) main.o error_reporter.o wave_reader.o transmitter.o | ||
$(CPP) $(FLAGS) $(INCLUDES) $(LIBS) -o $(TARGET) main.o error_reporter.o wave_reader.o transmitter.o | ||
|
||
wave_reader.o: wave_reader.cpp wave_reader.h | ||
$(CPP) $(CFLAGS) -c wave_reader.cpp | ||
$(CPP) $(FLAGS) $(INCLUDES) $(LIBS) -c wave_reader.cpp | ||
|
||
error_reporter.o: error_reporter.cpp error_reporter.h | ||
$(CPP) $(CFLAGS) -c error_reporter.cpp | ||
$(CPP) $(FLAGS) $(INCLUDES) $(LIBS) -c error_reporter.cpp | ||
|
||
transmitter.o: transmitter.cpp transmitter.h | ||
$(CPP) $(CFLAGS) -c transmitter.cpp | ||
$(CPP) $(FLAGS) $(INCLUDES) $(LIBS) -c transmitter.cpp | ||
|
||
main.o: main.cpp | ||
$(CPP) $(CFLAGS) -c main.cpp | ||
$(CPP) $(FLAGS) $(INCLUDES) $(LIBS) -c main.cpp | ||
|
||
clean: | ||
rm *.o |
Binary file not shown.
Oops, something went wrong.