Raspberry PiFM Example

View previous topic View next topic Go down

Raspberry PiFM Example

Post by jamied_uk on 16th September 2016, 01:46

Code:
Setup guide:

mkdir fm
cd fm
wget www.daveconroy.com/SampleCode/Pifm.tar.gz

tar -zxvf Pifm.tar.gz


Run script:

sudo ./pifm sound.wav 102.2


To copy a file from B to A while logged into B:
scp /path/to/file username@a:/path/to/destination

To copy a file from B to A while logged into A:
scp jay@jnet:/home/jay/scripts/PYTHON/RPI_FM/il_remember_you.mp3 ~/fm


transfer


scp jay@jnet:/jay/scripts/PYTHON/RPI_FM/il_remember_you.mp3 ~/fm

wav sound should be mono 1600 kh

sudo ~/fm/pifm ~/fm/sound.wav 102.2



to make an alias:

alias fm='sudo ~/fm/pifm ~/fm/sound.wav 102.2'

fm






~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

send files via ssh

   

Install sshfs:

sudo apt-get install sshfs

create a empty dir

mkdir /home/user/testdir

"link" or "mount" the two directories

sshfs user@server.com:/remote/dir /home/user/test

"unlink" the dirs

fusermount -u /home/youruser/remotecomp


















sudo ./pifm il_remember_you.wav 102.2



Stereo

New! Now with stereo

Code:
sudo ./pifm left_right.wav 102.2 22050 stereo



# Example command lines
# play an MP3
Code:
ffmpeg -i input.mp3 -f s16le -ar 22.05k -ac 1 - | sudo ./pifm -



# Broadcast from a usb microphone (see arecord manual page for config)
Code:
arecord -d0 -c2 -f S16_LE -r 22050 -twav -D copy | sudo ./pifm -





icrobotics.co.uk/wiki/index.php/Turning_the_Raspberry_Pi_Into_an_FM_Transmitter

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Broadcast tracks

You can play other audio files as well, but they must be 16-bit 22050 Hz mono and in the WAV format only. That might seem like a real limitation but it really isn’t. All you need is the SoX sound exchange audio editor which will process your MP3 file and convert it into the WAV file on-the-fly.

Install the audio editor and its dependencies with:

Code:
sudo apt-get install -y sox libsox-fmt-all



When it’s done, type in the following command, substituting “SomeSong.mp3” with the name of the MP3 file you wish to play:

Code:
sox -t mp3 il_remember_you.mp3 -t wav -r 22050 -c 1 - | sudo ./pifm - 102.2






this works

Code:
sox -t mp3 il_remember_you.mp3 -t wav -r 22050 -c 1 - | sudo ./pifm - 102.2



maketecheasier.com/run-radio-station-with-raspberry-pi
avatar
jamied_uk
Admin

Posts : 1986
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

Re: Raspberry PiFM Example

Post by jamied_uk on 16th September 2016, 01:57

Broadcast Podcast / Streams



You can do some wonderful things with SoX. You can, for example, use it to broadcast your favourite streams live from the Internet.

To broadcast the Linux Voice podcast:

Code:
sox -t mp3 http://www.linuxvoice.com/episodes/lv_s02e01.mp3 -t wav -r 22050 -c 1 - | sudo ./pifm - 102.2



The only difference between this command and the previous example is that instead of pointing to a local MP3, you are now pointing to one that resides online.

You can similarly broadcast an online radio station. Many stations publish a M3U file and you can point to it:
Code:

sox -t mp3 http://www.ndr.de/resources/metadaten/audio/m3u/ndrloop5.m3u -t wav -r 22050 -c 1 - | sudo ./pifm - 102.2
avatar
jamied_uk
Admin

Posts : 1986
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum