Giter VIP home page Giter VIP logo

pifmrds's Introduction

Pi-FM-RDS

FM-RDS transmitter using the Raspberry Pi

This program generates an FM modulation, with RDS (Radio Data System) data generated in real time. It can include monophonic or stereophonic audio.

It is based on the FM transmitter created by Oliver Mattos and Oskar Weigl, and later adapted to using DMA by Richard Hirst. Christophe Jacquet adapted it and added the RDS data generator and modulator. The transmitter uses the Raspberry Pi's PWM generator to produce VHF signals.

It is compatible with both the Raspberry Pi 1 (the original one) and the Raspberry Pi 2, 3 and 4.

PiFmRds has been developed for experimentation only. It is not a media center, it is not intended to broadcast music to your stereo system. See the legal warning.

How to use it?

Pi-FM-RDS, depends on the sndfile library. To install this library on Debian-like distributions, for instance Raspbian, run sudo apt install libsndfile1-dev.

Pi-FM-RDS also depends on the Linux rpi-mailbox driver, so you need a recent Linux kernel. The Raspbian releases have this starting from August 2015.

Important. The binaries compiled for the Raspberry Pi 1 are not compatible with the Raspberry Pi 2/3, and conversely. Always re-compile when switching models, so do not skip the make clean step in the instructions below!

Clone the source repository and run make in the src directory:

git clone https://github.com/ChristopheJacquet/PiFmRds.git
cd PiFmRds/src
make clean
make

Important. If make reports any error, then no pi_fm_rds executable file is generated (and vice versa). So any error must be fixed before you can proceed to the next steps. make may fail if any required library is missing (see above), or it could be a bug on a specific/newer distribution. In this case, please file a bug.

If make reports no error (i.e. the pi_fm_rds executable gets generated), you can then simply run:

sudo ./pi_fm_rds

This will generate an FM transmission on 107.9 MHz, with default station name (PS), radiotext (RT) and PI-code, without audio. The radiofrequency signal is emitted on GPIO 4 (pin 7 on header P1).

You can add monophonic or stereophonic audio by referencing an audio file as follows:

sudo ./pi_fm_rds -audio sound.wav

To test stereophonic audio, you can try the file stereo_44100.wav provided.

The more general syntax for running Pi-FM-RDS is as follows:

pi_fm_rds [-freq freq] [-audio file] [-ppm ppm_error] [-pi pi_code] [-ps ps_text] [-rt rt_text]

All arguments are optional:

  • -freq specifies the carrier frequency (in MHz). Example: -freq 107.9.
  • -audio specifies an audio file to play as audio. The sample rate does not matter: Pi-FM-RDS will resample and filter it. If a stereo file is provided, Pi-FM-RDS will produce an FM-Stereo signal. Example: -audio sound.wav. The supported formats depend on libsndfile. This includes WAV and Ogg/Vorbis (among others) but not MP3. Specify - as the file name to read audio data on standard input (useful for piping audio into Pi-FM-RDS, see below).
  • -pi specifies the PI-code of the RDS broadcast. 4 hexadecimal digits. Example: -pi FFFF.
  • -ps specifies the station name (Program Service name, PS) of the RDS broadcast. Limit: 8 characters. Example: -ps RASP-PI.
  • -rt specifies the radiotext (RT) to be transmitted. Limit: 64 characters. Example: -rt 'Hello, world!'.
  • -ctl specifies a named pipe (FIFO) to use as a control channel to change PS and RT at run-time (see below).
  • -ppm specifies your Raspberry Pi's oscillator error in parts per million (ppm), see below.

By default the PS changes back and forth between Pi-FmRds and a sequence number, starting at 00000000. The PS changes around one time per second.

Clock calibration (only if experiencing difficulties)

The RDS standards states that the error for the 57 kHz subcarrier must be less than ± 6 Hz, i.e. less than 105 ppm (parts per million). The Raspberry Pi's oscillator error may be above this figure. That is where the -ppm parameter comes into play: you specify your Pi's error and Pi-FM-RDS adjusts the clock dividers accordingly.

In practice, I found that Pi-FM-RDS works okay even without using the -ppm parameter. I suppose the receivers are more tolerant than stated in the RDS spec.

One way to measure the ppm error is to play the pulses.wav file: it will play a pulse for precisely 1 second, then play a 1-second silence, and so on. Record the audio output from a radio with a good audio card. Say you sample at 44.1 kHz. Measure 10 intervals. Using Audacity for example determine the number of samples of these 10 intervals: in the absence of clock error, it should be 441,000 samples. With my Pi, I found 441,132 samples. Therefore, my ppm error is (441132-441000)/441000 * 1e6 = 299 ppm, assuming that my sampling device (audio card) has no clock error...

Piping audio into Pi-FM-RDS

If you use the argument -audio -, Pi-FM-RDS reads audio data on standard input. This allows you to pipe the output of a program into Pi-FM-RDS. For instance, this can be used to read MP3 files using Sox:

sox -t mp3 http://www.linuxvoice.com/episodes/lv_s02e01.mp3 -t wav -  | sudo ./pi_fm_rds -audio -

Or to pipe the AUX input of a sound card into Pi-FM-RDS:

sudo arecord -fS16_LE -r 44100 -Dplughw:1,0 -c 2 -  | sudo ./pi_fm_rds -audio -

Changing PS, RT and TA at run-time

You can control PS, RT and TA (Traffic Announcement flag) at run-time using a named pipe (FIFO). For this run Pi-FM-RDS with the -ctl argument.

Example:

mkfifo rds_ctl
sudo ./pi_fm_rds -ctl rds_ctl

At this point, Pi-FM-RDS waits until another program opens the named pipe in write mode (for example cat >rds_ctl in the example below) before it starts transmitting.

You can use the named pipe to send “commands” to change PS, RT and TA. For instance, in another terminal:

cat >rds_ctl
PS MyText
RT A text to be sent as radiotext
TA ON
PS OtherTxt
TA OFF
...

Tip

The program that opens the named pipe in write mode can be started after Pi-FM-RDS (like above) or before (in which case Pi-FM-RDS does not have to wait at startup).

Every line must start with either PS, RT or TA, followed by one space character, and the desired value. Any other line format is silently ignored. TA ON switches the Traffic Announcement flag to on, any other value switches it to off.

Non-ASCII characters

You can use the full range of characters supported by the RDS protocol. Pi-FM-RDS decodes the input strings based on the system's locale variables. As of early 2024, Raspberry Pi OS uses by default UTF-8 and the LANG variable is set to en_GB.UTF-8. With this setup, it should work out of the box.

If it does not work, look at the first message that Pi-FM-RDS prints out. It should be something sensible, like:

Locale set to en_GB.UTF-8.

If it is not consistent with your setup, or if the locale appears to be set to (null), then your locale variables are not set correctly and Pi-FM-RDS is incapable of working with non-ASCII characters.

Warning and Disclaimer

PiFmRds is an experimental program, designed only for experimentation. It is in no way intended to become a personal media center or a tool to operate a radio station, or even broadcast sound to one's own stereo system.

In most countries, transmitting radio waves without a state-issued licence specific to the transmission modalities (frequency, power, bandwidth, etc.) is illegal.

Therefore, always connect a shielded transmission line from the RaspberryPi directly to a radio receiver, so as not to emit radio waves. Never use an antenna.

Even if you are a licensed amateur radio operator, using PiFmRds to transmit radio waves on ham frequencies without any filtering between the RaspberryPi and an antenna is most probably illegal because the square-wave carrier is very rich in harmonics, so the bandwidth requirements are likely not met.

I could not be held liable for any misuse of your own Raspberry Pi. Any experiment is made under your own responsibility.

Tests

Pi-FM-RDS was successfully tested with all my RDS-able devices, namely:

  • a Sony ICF-C20RDS alarm clock from 1995,
  • a Sangean PR-D1 portable receiver from 1998, and an ATS-305 from 1999,
  • a Samsung Galaxy S2 mobile phone from 2011,
  • a Philips MBD7020 hifi system from 2012,
  • a Silicon Labs USBFMRADIO-RD USB stick, employing an Si4701 chip, and using my RDS Surveyor program,
  • a “PCear Fm Radio”, a Chinese clone of the above, again using RDS Surveyor.

Reception works perfectly with all the devices above. RDS Surveyor reports no group errors.

CPU Usage

CPU usage is as follows:

  • without audio: 9%
  • with mono audio: 33%
  • with stereo audio: 40%

CPU usage increases dramatically when adding audio because the program has to upsample the (unspecified) sample rate of the input audio file to 228 kHz, its internal operating sample rate. Doing so, it has to apply an FIR filter, which is costly.

Design

The RDS data generator lies in the rds.c file.

The RDS data generator generates cyclically four 0A groups (for transmitting PS), and one 2A group (for transmitting RT). In addition, every minute, it inserts a 4A group (for transmitting CT, clock time). get_rds_group generates one group, and uses crc for computing the CRC.

To get samples of RDS data, call get_rds_samples. It calls get_rds_group, differentially encodes the signal and generates a shaped biphase symbol. Successive biphase symbols overlap: the samples are added so that the result is equivalent to applying the shaping filter (a root-raised-cosine (RRC) filter specified in the RDS standard) to a sequence of Manchester-encoded pulses.

The shaped biphase symbol is generated once and for all by a Python program called generate_waveforms.py that uses Pydemod, one of my other software radio projects. This Python program generates an array called waveform_biphase that results from the application of the RRC filter to a positive-negative impulse pair. Note that the output of generate_waveforms.py, two files named waveforms.c and waveforms.h, are included in the Git repository, so you don't need to run the Python script yourself to compile Pi-FM-RDS.

Internally, the program samples all signals at 228 kHz, four times the RDS subcarrier's 57 kHz.

The FM multiplex signal (baseband signal) is generated by fm_mpx.c. This file handles the upsampling of the input audio file to 228 kHz, and the generation of the multiplex: unmodulated left+right signal (limited to 15 kHz), possibly the stereo pilot at 19 kHz, possibly the left-right signal, amplitude-modulated on 38 kHz (suppressed carrier) and RDS signal from rds.c. Upsampling is performed using a zero-order hold followed by an FIR low-pass filter of order 60. The filter is a sampled sinc windowed by a Hamming window. The filter coefficients are generated at startup so that the filter cuts frequencies above the minimum of:

  • the Nyquist frequency of the input audio file (half the sample rate) to avoid aliasing,
  • 15 kHz, the bandpass of the left+right and left-right channels, as per the FM broadcasting standards.

The samples are played by pi_fm_rds.c that is adapted from Richard Hirst's PiFmDma. The program was changed to support a sample rate of precisely 228 kHz.

References

History

  • 2015-09-05: support for the Raspberry Pi 2 and later models
  • 2014-11-01: support for toggling the Traffic Announcement (TA) flag at run-time
  • 2014-10-19: bugfix (cleanly stop the DMA engine when the specified file does not exist, or it's not possible to read from stdin)
  • 2014-08-04: bugfix (ppm now uses floats)
  • 2014-06-22: generate CT (clock time) signals, bugfixes
  • 2014-05-04: possibility to change PS and RT at run-time
  • 2014-04-28: support piping audio file data to Pi-FM-RDS' standard input
  • 2014-04-14: new release that supports any sample rate for the audio input, and that can generate a proper FM-Stereo signal if a stereophonic input file is provided
  • 2014-04-06: initial release, which only supported 228 kHz monophonic audio input files

© Christophe Jacquet (F8FTK), 2014-2024. Released under the GNU GPL v3.

pifmrds's People

Contributors

christophejacquet avatar ffontaine avatar limpens avatar markondej avatar martchus avatar olika120 avatar skylarmt avatar stealthii avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pifmrds's Issues

Mpd pipe problem

hi, I'm having trouble setting a pipe pifm_rds mpd, this is the configuration I'm using

audio_output {
type "pipe"
name "FM_fifo"
#path "/tmp/mpd.fifo"
#command "/root/pifm/pifm - 88.2 44100 2"
command "/root/pifm/pi_fm_rds -freq 88.3 -ps PiFM -rt Hola -audio -"
format "44100:16:2"
}

Using first command works ok, but second command hangs the PI.
i dont know if i'm doing something wrong.

Sorry my english

Could not allocate memory.

When I try to run the program, I get these four messages in the command line and then it just terminates:

Using local mbox device file with major 249.
Allocating physical memory: size = 3403776 ioctl_set_msg failed:-1
Could not allocate memory.
Terminating: cleanly deactivated the DMA engine and killed the carrier.

Obviously the issue is that it can't allocate the needed memory, but I can't figure out why.
Any help is appreciated.

Pipe using

Hello, it's possible to use with pipe ?

an example

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

Pipe all RPi2 audio to PiFmRds?

Trying to pipe all audio that would output on HDMI or Composit through to PiFMRds, how would one go about doing this? Looking to setup a daemon to run in the background with kodi so I can listen to music and such through my home stereo wirelessly.

Thanks!

Pi_Fm_Rds won't compile on Raspberry Pi 2

Hi,

I'm unable to compile Pi_Fm_Rds on a Raspberry Pi 2.

There is no error message after the "make" command but the pi_fm_rds executable is not created even though other items are.

If I try and compile pi_fm_rds.c separately a number of errors occur:

root@pi-web-vpn:/home/pi/PiFmRds/src# make pi_fm_rds
gcc pi_fm_rds.o -o pi_fm_rds
pi_fm_rds.o: In function terminate': /home/pi/PiFmRds/src/pi_fm_rds.c:208: undefined reference tofm_mpx_close'
/home/pi/PiFmRds/src/pi_fm_rds.c:209: undefined reference to close_control_pipe' pi_fm_rds.o: In functiontx':
/home/pi/PiFmRds/src/pi_fm_rds.c:424: undefined reference to fm_mpx_open' /home/pi/PiFmRds/src/pi_fm_rds.c:428: undefined reference toset_rds_pi'
/home/pi/PiFmRds/src/pi_fm_rds.c:429: undefined reference to set_rds_rt' /home/pi/PiFmRds/src/pi_fm_rds.c:435: undefined reference toset_rds_ps'
/home/pi/PiFmRds/src/pi_fm_rds.c:445: undefined reference to open_control_pipe' /home/pi/PiFmRds/src/pi_fm_rds.c:471: undefined reference topoll_control_pipe'
/home/pi/PiFmRds/src/pi_fm_rds.c:499: undefined reference to floorf' /home/pi/PiFmRds/src/pi_fm_rds.c:488: undefined reference tofm_mpx_get_samples'
/home/pi/PiFmRds/src/pi_fm_rds.c:465: undefined reference to set_rds_ps' /home/pi/PiFmRds/src/pi_fm_rds.c:461: undefined reference toset_rds_ps'
collect2: ld returned 1 exit status
: recipe for target 'pi_fm_rds' failed
make: *** [pi_fm_rds] Error 1

Any advice gratefully received.

BB

Audio play slowly

Hi!
I found another problem with PiFmRds.
Play some mp3 file with mpg123 on the built-in audio output (jack) of Raspi then stop playback (mpg123).
Then start PiFmRds and no stereo no rds signal, and the audio play slowly.

Only Raspi reboot solve this problem.

If first start PiFmRds (after reboot) everything is ok.
If I quit from PiFmRds and then play mp3 with mpg123 on built-in audio, the same problem occur. The audio play slowly.

If You have free time, please test it.
Thanks.
Peppi

PS: Sorry my pour english.

Program stops after a few hours

I know this has come up before, but it still does not seem to be fixed.... basically, when running this, it will turn itself off after a few hours and stop sending RDS and audio, it will however keep the signal occupied. Is there any reason why it stops sending audio and RDS after a few hours? Also, is it possible for this to work 24/7 (for as long as the Sox incoming audio feed lasts)?
The pi does not shut down and after a few hours it behaves like it would if you were to terminate by pressing CTRL + C. I simply restart it by pressing UP then ENTER but I don't wish to run it like this.

SOX Error

Hi,
When I use this, I get an error when using Sox, I get:
sudo: sox: command not found
Error: could not open stdin for audio input.
Terminating: cleanly deactivated the DMA engine.
What does this mean? I am using the code provided and have not done anything that is not in the instructions.
Many Thanks in advance.

background noise during playback

testing with simple piece of cable (20cm) and the stereo wave file i got an annoing noise on the background.
Only my case or other got same issue?

thanks

Raspberry pi2 problem

Hello

I ve got a problem

following your tutorial, then:
root@raspberrypi2:/home/pi/PiFmRds/src# ./pi_fm_rds
I get , on my raspi 2:
Can't open device file: mbox
Try creating a device file with: sudo mknod mbox c 100 0
just discovering git hub
too difficult for me to understand the problem

TY

//--------------------------------------------------------------
bonjour,
J'ai un soucis lors du lancement du programme

en suivant tes explications puis :
root@raspberrypi2:/home/pi/PiFmRds/src# ./pi_fm_rds
j obtiens:
Can't open device file: mbox
Try creating a device file with: sudo mknod mbox c 100 0

Pure MPX input (192kHz) from external audio processor

Hi!

Is it possible to input 192kHz mono audio to the PiFmRds to use external processing (stereo + RDS)? This is how it's done in "real" FM transmitters, so it essentially would be simulating that operation, thus bypassing any internal stereo or RDS generation.

swap GPIO pin ?

Don't know if this is possible at all, but I'd like to move the pin which is used
for transmitting to another GPIO pin, is it doable at all ?

GPIO4/pin 7 is usually used by the RTC module addon (it uses pin 1-3-5-7-9),
hence the need of moving the FM-pin ;)

thank you in advance

pi_fm_rds.c:100:21 fatal error: sndfile.h no such file or directory

hello, i execute the command make and give that output:

gcc -Wall -std=gnu99 -c -g -O3 -march=armv6 -mtune=arm1176jzf-s -mfloat-abi=hard -mfpu=vfp -ffast-math rds.c
gcc -Wall -std=gnu99 -c -g -O3 -march=armv6 -mtune=arm1176jzf-s -mfloat-abi=hard -mfpu=vfp -ffast-math waveforms.c
gcc -Wall -std=gnu99 -c -g -O3 -march=armv6 -mtune=arm1176jzf-s -mfloat-abi=hard -mfpu=vfp -ffast-math pi_fm_rds.c
pi_fm_rds.c:100:21: fatal error: sndfile.h: No such file or directory
compilation terminated.
Makefile:31: recipe for target 'pi_fm_rds.o' failed
make: *** [pi_fm_rds.o] Error 1

Is there any reason for that?

Make Magazine's - improve quality patch

Make-Magazine/PirateRadio@484e189

I am trying to make the same changes to your code and am having some trouble locating the right place.

src/fm_mpx.c
@@ -244,7 +244,7 @@ int fm_mpx_get_samples(float *mpx_buffer) {
         if(channels>1) {
             mpx_buffer[i] +=
                 4.05 * carrier_38[phase_38] * out_stereo + // Stereo difference
-                .9*carrier_19[phase_19];                  // Stereo pilot tone
+                .83*carrier_19[phase_19];                  // Stereo pilot tone

             phase_19++;
             phase_38++;

I am pretty sure that was correct for one change. I do not see a multiplication by .1 but I do see two divisions by 10.
pi_fm_rds.c: float dval = data[data_index] * (DEVIATION / 10.);
rds_wav.c: mpx_buffer[i] /= 10.;

I expect the one I would want to change is the one that references mpx_buffer in rds_wav.c. Does that look right?

MPX output to soundcard

Hi!
I woluld like to use PiFmRds with a 192kHz capable sound card. Is there any chance to do it?
I need only the MPX signal on the sound card output.

Thanks.
Peppi

Consider using a socket connection

Hello,

like other folks around, we use the mpd backend to manage the playlist queue.
I wonder if there is a way to keep the PiFmRds process always active, and to swap the piped in audio stream?

I wonder if having PiFmRds listening to data on a socket, and another program to swap the content sent to that socket would do the trick.

It would enable more complex pipelines while keeping PiFmRds approach similarly solid.

Catastrophic failure when reading from fifo

Please forgive the vague issue report, as I have little information available, however here's what happened:

mkfifo audio.wav
./pi_fm_rds -freq 87.9 -audio audio.wav

In another terminal:

sox file.mp3 audio.wav

The first file played correctly, however when I attempted to play a second file with "sox file2.mp3 audio.wav", nothing happened. I switched back to the terminal that was running pi_fm_rds, hit control-C and the Pi screen (HDMI out) flashed blue for about a second and then the Pi shut down. The Pi will not power on. I don't know if the bootloader is damaged or if the entire CPU is dead.

Pipe audio in via Aux lead

Would it be possible to pipe audio in via Aux lead? I feel the reason the program quits after several hours may be due to a network drop out.

Program not compiled on Raspberry 2

Hi,
After a clone of repository, I have this error when i compiled :
pi@raspberrypi:/PiFmRds/src$ make clean
rm .o
rm: cannot remove `
.o': No such file or directory
Makefile:51: recipe for target 'clean' failed
make: *** [clean] Error 1
pi@raspberrypi::
/PiFmRds/src$ make
gcc -Wall -std=gnu99 -c -g -O3 -march=armv7-a -mtune=arm1176jzf-s -mfloat-abi=hard -mfpu=vfp -ffast-math -DRASPI=2 rds.c
gcc -Wall -std=gnu99 -c -g -O3 -march=armv7-a -mtune=arm1176jzf-s -mfloat-abi=hard -mfpu=vfp -ffast-math -DRASPI=2 waveforms.c
gcc -Wall -std=gnu99 -c -g -O3 -march=armv7-a -mtune=arm1176jzf-s -mfloat-abi=hard -mfpu=vfp -ffast-math -DRASPI=2 pi_fm_rds.c
pi_fm_rds.c:105:21: fatal error: sndfile.h: No such file or directory
compilation terminated.
Makefile:42: recipe for target 'pi_fm_rds.o' failed
make: *** [pi_fm_rds.o] Error 1

Seems not to kill carrier-frequency on exit

I have an issue with a freshly (today) installed version on my raspberry pi.
When I end the transmission (with ctrl+c) the carrier signal still seems to be broadcasted as the noise (which is normally coming from my radio on the specified frequency) does not come back.
I am able to restart a transmission on a different frequency, so that the "noise" on the first frequency comes back. Unfortunately I have the problem on the new frequency then.

The only way to stop broadcasting is to reboot the raspberry.

I have testet pifrmrds some month ago and didn't have this problem.

What can I do? Is this a bug?

Raspbian GNU/Linux 7
PiFmRds from github 2014-12-05

Thank you!

Could not get audio to input

Error Dump:
Using mbox device /dev/vcio.
Allocating physical memory: size = 3403776 mem_ref = 3 bus_addr = fe625000 virt_addr = 0x7690f000
ppm corr is 0.0000, divider is 1096.4912 (1096 + 2012*2^-12) [nominal 1096.4912].
Error: could not open stdin for audio input.
Terminating: cleanly deactivated the DMA engine and killed the carrier.

Noob question about harmonics

Hello. As far as I understand harmonics are created because of the square waves that raspberry produce. What if we use dac in the output?

Program quit after 3-4 hours

Hi!

I use PiFmRds with piping audio.
My command is: mpg123 --loop -1 --buffer 1024 --no-icy-meta -s http://streamURL:8000 | sox -t raw -b 16 -e signed -c 2 -r 44100 - -t wav - equalizer 11800 0.7q 20 | sudo ./pi_fm_rds -freq 92.5 -audio -
Everything works perfectly for 3-4 hours, then the program quit with this message: "Could not rewind in audio file, terminating"
I tested it with mp3 stream and local mp3 too, and the result is the same.

If You have free time, please test it.
Thanks.
Peppi

preamphasis is missing

In order to get a decent audio quality, you really have to amplify the high frequencies.

currently i am decoding all my files, then applying an equaliser and then rendering those files back to mp3, before i use them with PiFM RDS. A rather complicated way.

I also tried using alsaequal, but because i am using loopdevices i can't get it to work, no matter what i do. (PiFm listens on Loopback,1,0; standard audio output is Loopback,0,0)

A preamphasis really should be implemented right into PiFm

are there any plans on implementing something like that? Is PiFm even still being developed?

Audio file looping endlessly

I am trying to play a directory full of audio files, and I wrote a bash script to play them all and shuffle between them. However, when the audio file ends, it loops to the beginning of the file instead of playing the next song. My script works flawlessly with another audio program. Please advise on how to solve this issue.

Ability to use TA?

Hi, I love playing with this, is there any TA trigger coming to this?

PiFmRDS on Raspberry Pi B+ Compile Error VFP register

gcc -o pi_fm_rds rds.o waveforms.o pi_fm_rds.o fm_mpx.o control_pipe.o -lm -lsndfile
/usr/lib/gcc/armv6j-softfp-linux-gnueabi/4.8.4/../../../../armv6j-softfp-linux-gnueabi/bin/ld: error: rds.o uses VFP register arguments, pi_fm_rds does not
/usr/lib/gcc/armv6j-softfp-linux-gnueabi/4.8.4/../../../../armv6j-softfp-linux-gnueabi/bin/ld: failed to merge target specific data of file rds.o
/usr/lib/gcc/armv6j-softfp-linux-gnueabi/4.8.4/../../../../armv6j-softfp-linux-gnueabi/bin/ld: error: waveforms.o uses VFP register arguments, pi_fm_rds does not
/usr/lib/gcc/armv6j-softfp-linux-gnueabi/4.8.4/../../../../armv6j-softfp-linux-gnueabi/bin/ld: failed to merge target specific data of file waveforms.o
/usr/lib/gcc/armv6j-softfp-linux-gnueabi/4.8.4/../../../../armv6j-softfp-linux-gnueabi/bin/ld: error: pi_fm_rds.o uses VFP register arguments, pi_fm_rds does not
/usr/lib/gcc/armv6j-softfp-linux-gnueabi/4.8.4/../../../../armv6j-softfp-linux-gnueabi/bin/ld: failed to merge target specific data of file pi_fm_rds.o
/usr/lib/gcc/armv6j-softfp-linux-gnueabi/4.8.4/../../../../armv6j-softfp-linux-gnueabi/bin/ld: error: fm_mpx.o uses VFP register arguments, pi_fm_rds does not
/usr/lib/gcc/armv6j-softfp-linux-gnueabi/4.8.4/../../../../armv6j-softfp-linux-gnueabi/bin/ld: failed to merge target specific data of file fm_mpx.o
/usr/lib/gcc/armv6j-softfp-linux-gnueabi/4.8.4/../../../../armv6j-softfp-linux-gnueabi/bin/ld: error: control_pipe.o uses VFP register arguments, pi_fm_rds does not
/usr/lib/gcc/armv6j-softfp-linux-gnueabi/4.8.4/../../../../armv6j-softfp-linux-gnueabi/bin/ld: failed to merge target specific data of file control_pipe.o
collect2: error: ld returned 1 exit status
Makefile:11: recipe for target 'app' failed
make: *** [app] Error 1

Compile fails with this error. If it helps, here is the gcc version and specs output:

localhost src # gcc -v --dumpspecs 
Using built-in specs.
COLLECT_GCC=/usr/armv6j-softfp-linux-gnueabi/gcc-bin/4.8.4/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/armv6j-softfp-linux-gnueabi/4.8.4/lto-wrapper
gcc: error: unrecognized command line option '--dumpspecs'
Target: armv6j-softfp-linux-gnueabi
Configured with: /var/tmp/portage/sys-devel/gcc-4.8.4/work/gcc-4.8.4/configure --host=armv6j-softfp-linux-gnueabi --build=armv6j-softfp-linux-gnueabi --prefix=/usr --bindir=/usr/armv6j-softfp-linux-gnueabi/gcc-bin/4.8.4 --includedir=/usr/lib/gcc/armv6j-softfp-linux-gnueabi/4.8.4/include --datadir=/usr/share/gcc-data/armv6j-softfp-linux-gnueabi/4.8.4 --mandir=/usr/share/gcc-data/armv6j-softfp-linux-gnueabi/4.8.4/man --infodir=/usr/share/gcc-data/armv6j-softfp-linux-gnueabi/4.8.4/info --with-gxx-include-dir=/usr/lib/gcc/armv6j-softfp-linux-gnueabi/4.8.4/include/g++-v4 --with-python-dir=/share/gcc-data/armv6j-softfp-linux-gnueabi/4.8.4/python --enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --enable-nls --without-included-gettext --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.8.4 p1.5, pie-0.6.1' --enable-libstdcxx-time --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --disable-multilib --disable-altivec --disable-fixed-point --with-float=softfp --with-arch=armv6j --disable-libgcj --enable-libgomp --disable-libmudflap --disable-libssp --enable-lto --without-cloog --disable-libsanitizer
Thread model: posix
gcc version 4.8.4 (Gentoo 4.8.4 p1.5, pie-0.6.1) 

Broadcast Computer's Audio

Hi
I was wondering if it's possible to broadcast the computer's audio over fm radio / how would it be done?
by computer's audio I mean what would be playing out of the speakers?
Thanks heaps
James

Possible to send RDS signals without Audio?

Would it be possible to send RDS signals out and if no audio is inserted not to send any? Basically, use this alongside another transmitter, one for audio and this for RDS? Currently when you launch this without specifying audio it sends out blank audio on the frequency I want to send no audio over the frequency just RDS text, RT, PS, TA etc.

Failed to open control pipe

pifmrds

-ctl xxxx parameter fails each time i try to open the control pipe!

Any hints on what might be the problem?
Where can i gather more data about it in order to better understand the issue?

Props!

Launching at startup results Xorg at 100%

This is my instruction in a sh file (lauching with a cron instruction) :
sox -t mp3 http://radioserver3.profesionalhosting.com:10078/listen.pls -t wav - | sudo /home/pi/PiFmRds/src/pi_fm_rds -freq 90.0 -pi 1234 -ps Navas -rt ‘Transmisiones experiemtales’ -ctl /home/pi/PiFmRds/src/rds_ctl -audio -

I have too a laucher file in /etc/init.d but i have the same problem.

When i launch manual not have this problem.

What i can do?

** Sorry but i'dont speak english so well i want.

Tip for streaming any content

Hi there, thank you for your wonderful software!

In your examples, you talk about sox to stream non-wav data to PiFmRds. Unfortunately, some protocols (like HTTP Live Streaming, or extracting audio from video) are not supported with sox.

To play nearly everything to FM, you can use LibAV (http://libav.org) or FFMPEG (http://ffmpeg.org but not availble out-of-the-box on Raspbian) but it has some delay before outputing the result on stdout, resulting on PiFmRds stopping because it can't immediately read stdin.

Here is a workaround that may be useful for some fellows. Launch on 2 separate terminals or background the first process :

$ sudo avconv -re -i http://url.of.the/file-or-stream -vn -sn -f mp3 udp://127.0.0.1:8080
$ nc -l -u 8080 | sox -t mp3 - -t wav - | sudo ./pi_fm_rds -audio -

Stuttering playback

So pi_fm_rds seems to work great for me except that audio tends to stutter a little from time to time. It's about a half second blip every couple of minutes.

I'm running it on a pi 1, would using a pi 2 help with the issue?

Won't compile on Raspberry Pi B+

Hey there. PiFmRDS doesn't seem to want to compile on my Raspberry Pi B+ and it keeps spitting out this error. Any ideas?

pi@raspberrypi ~/projects/PiFmRds-master/src $ make

gcc -Wall -std=gnu99 -c -g -O3 -march=armv6 -mtune=arm1176jzf-s -mfloat-abi=hard -mfpu=vfp -ffast-math pi_fm_rds.c
pi_fm_rds.c:100:21: fatal error: sndfile.h: No such file or directory
compilation terminated.
Makefile:31: recipe for target 'pi_fm_rds.o' failed
make: *** [pi_fm_rds.o] Error 1

RDS CT PTY and pre-emphasis

Hi!

PiFmRDS is a great project.
What I miss: pre-emphasis and RDS functions (CT, PTY).
It would be good if they can be included in future versions of these.

Many thanks to dev !

PS: Sorry my pour english.

Generation time of the RDS messages

This is not really an issue, it is more a doubt about the program but I think that it is an interesting question and I couldn't find a better way of asking it.

I'm using your program in my MSc Thesis. I'm basically using the RDS as a control channel in a wireless mesh sensor network. The thing is, the default rate at which the RDS messages are being generated in this program is too slow for my needs. I was able to increase that rate by changing the usleep period (line 475 of the pi_fm_rds.c file). Using a usleep of 1 in that cycle, I was able to increase the message generation rate to 1 RDS message from type 0A every 150 ms approximately (I have also done some modifications to only generate 0A messages). This increased rate is achieved at the cost of range and error rate.

What I wanted to know is why we need this sleep and why it has to bee so long if we want the RDS transmission to be reliable and have a large range. If I got it right, you use this sleep between getting the samples but I would like to know more technical details. Moreover, according to my research, the physical limit for the bitrate of the Radio data System is 1187,5 bits per second. (as stated in this article http://www.iaeng.org/publication/WCECS2013/WCECS2013_pp431-436.pdf). With your program, the bit rates that we can achieve are much lower. Is this due to a limitation of the PWM generator of the Raspberry Pi?

To summarize, I just wanted to have an explanation of why the RDS generation has to be so slow in order to be reliable.

Thank you very much in advance. This is a limitation of the RDS that I would like to address in my MSc Thesis.

Best regards.

Interference

Just a question, what harmonics does this let out? Does this program let out anything else other than the MhZ FM signal?
Is there anyway to filter what does come out?
Regards

Noob issues with Getting rds to work

Im pretty new to radio on any device, so getting the pi to transmit is quite hard work. I have installed everything correctly, yet when broadcasting it, no text appears what so ever on my radio or on my phone. I thought it wa my rx fault but then i realised it showed up other radio stations ps names.
If anyone could help that would be great.

ps (i know im a noob and i dont know what im talking about. I have had other experience on the raspberry pi though so plz dont be patronising

use of a SDR chipset to avoid noise of the GPIO output

hello.
I'm experimenting with this code, transmitting Stereo audio and RDS over the GPIO, but the result was not so exciting.

I was wondering ... why do not use a SDR chipset over usb bus to transmit audio on the air?
RTL2832U could be a nice candidate ..... any chance to add SDR support to PiFMRds?

Thanks,

Federico

Could not rewind in audio file. Terminating

Hi, is there a way to get an icecast stream to pick itself up again after this error so I don't have to keep picking it up every few hours, it's a very disappointing bug. Thanks in advance

Static and Very Low Sound Quality on Raspberry pi 2

I've tried messing with the ppm, and that took care of the low pitch audio. However there is a static in all of the signals, I have tried various sound files on different frequencies. Also I think the audio output it always mono, and the output also sounds like I'm listening to music on my walki talki (very muffled). Is this a Raspberry pi 2 specific thing? I remember reading a few months back that there was super clear FM (almost station quality) for the raspberry pi do none of these work for the 2?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.