miegl / PiFmAdv

Advanced Raspberry Pi FM transmitter with RDS encoding
GNU General Public License v3.0
487 stars 82 forks source link

Piping problem with cheap USB Sound card #49

Open StoneSet opened 5 years ago

StoneSet commented 5 years ago

Hello, I have some issue using a pipe with PiFmAdv, however I do not find this issue with PiFmRds. When I execute the command: sudo arecord -fS16_LE -r 44100 -Dplughw: 1.0 -c 2 - | sudo / home / pi / PiFmAdv / src / pi_fm_adv --freq 105.10 --audio - no error but the program cuts off just after starting it. image Same without pipe : sudo /home/pi/PiFmAdv/src/pi_fm_adv --freq 105.10 --audio /home/pi/cc.wav --ps ST-PIFM --rt 'St-PIFM RADIO' --mpx 70 --power 7 --gpio 4 --preemph 'eu'

Regards, Thanks

(In pifmrds : sudo arecord -fS16_LE -r 44100 -Dplughw:1,0 -c 2 - | sudo /home/pi/PiFmRds/src/pi_fm_rds -freq 105.10 -audio -)

ghost commented 5 years ago

The way pipes are handled is not good. If there is an under-run the pipe needs to be opened again by pifm, but it can't because the pipe is opened outside of the main loop. I'm currently working on some modifications to improve this, but I haven't got much spare time to do it.

Niall7459 commented 5 years ago

I'm also having a similar problem with the latest version. This also seems to be happening using standard wav files, such as: sudo ./pi_fm_adv --audio sound_22050.wav

Niall7459 commented 5 years ago

It has a random chance of working. 6/10 times it doesn't. For audio streams its more like a 1/10 it will even begin to work. But at some point it get cuts off.