maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   Radio buffer / timeshift (https://talk.maemo.org/showthread.php?t=91948)

vkthor 2013-12-04 18:20

Radio buffer / timeshift
 
Hi there,
I was thinking about buying something like this, a radio which has a delay function so you can do "timeshift" with it (with this, I can delay / pause the sound for a couple of seconds so I can watch any sports on TV synced with the FM radio commentary)...
...and then I thought of my beloved N900 which has saved me so many times before doing things my Android phone can't.
Would it be possible to write the FM radio output to a buffer or something like that, effectively "pausing" the radio stream so I can listen to it a couple of seconds "behind" live streaming? I know it's possible to do this with live stations on the web, but they're already too much delayed, so I need this done with the FM receiver.
Any thoughts?
And of course, thank you as always! :)

Oblomow 2013-12-04 18:52

Re: Radio buffer / timeshift
 
Quote:

Originally Posted by vkthor (Post 1392621)
Hi there,
I was thinking about buying something like this, a radio which has a delay function so you can do "timeshift" with it (with this, I can delay / pause the sound for a couple of seconds so I can watch any sports on TV synced with the FM radio commentary)

I think the recaller widget has the possibility to record the fm radio output to a file, there is some kind of "monitor-source" in pulse audio that does that.

Code:

gst-launch pulsesrc device=sink.hw0.monitor
gives you the source for a gst pipeline, and look into this post how to add a delay. Pitfall is, it's still putting the original audio on the speaker/headphones. But you can stream it over network to another device.

vkthor 2013-12-04 19:33

Re: Radio buffer / timeshift
 
Thank you very much for the answer, but I want to avoid streaming as it would induce a delay of a couple of seconds already, and anyway, I suppose I could do what you're telling me in an easier way with the phonestreamer app and then delay the incoming on the other device.
I'm looking for a solution in the phone, with just the phone. If I had two devices I could always just connect a jack between the N900 and the other thing and then delay the audio with VLC, which is what I already do when I'm at home, so as I'm telling you, what I'm looking for is a solution using only the N900.
Anyway, thank you again!

AapoRantalainen 2013-12-04 20:58

Re: Radio buffer / timeshift
 
Quote:

Originally Posted by vkthor (Post 1392621)
Would it be possible to write the FM radio output to a buffer or something like that, effectively "pausing" the radio stream so I can listen to it a couple of seconds "behind" live streaming?

a)
I tested what comes first to my mind (warning: it is not yet working)

Connect headset for antenna, start qradio and start playing.
Then on terminal:
Code:

gst-launch autoaudiosrc device=hw:1 ! audioconvert !  queue min-threshold-time=1000000000  !  autoaudiosink
(take audio which is going to out, delay it one second and forward it back)

-> You will hear audio two times and it has bad snapping (not even smooth echo).
I don't know how to continue with that.

b) modify code of e.g. qradio. I already fetched the code, but didn't understand how it works.
Couple of other radio application listed on wiki:
http://maemo.org/packages/view/cfmradio/
http://maemo.org/packages/view/fmradio/

c) Compile gstplugin: v4l2radio e.g. from harmattan:
Code:

git clone git@gitorious.org:harmattan-projects/gst-plugins-good.git
(Source-deb would be better. Link please?)
Harmattan use newer gstreamer, so plugin might need code modifications and then it could work.


And use it: http://harmattan-dev.nokia.com/docs/...v4l2radio.html

I'm not sure would it then just work. There are example for Ubuntu where audio comes from mic and goes to speaker:
http://ubuntuforums.org/showthread.php?t=1189559

vkthor 2013-12-04 21:31

Re: Radio buffer / timeshift
 
Thank you VERY much, I think this is great progress.
I'm not a developer (I just know basics of C and little else), but I'll look into the code and try to see if anything comes to my mind.
:)

javispedro 2013-12-04 23:08

Re: Radio buffer / timeshift
 
In cfmradio, just change cfmradio.c:430 to

Code:

g_object_set(G_OBJECT(radio), "output", CFM_RADIO_OUTPUT_MUTE, NULL);
to disable the builtin loop that copies audio to speakers. That way you can launch an external gstreamer loop that does whatever processing/delay you want, as suggested in the above post, method (a).

It would not be very hard to add a fixed delay to cfmradio itself (you just need to buffer up the raw audio data before forwarding to speakers), but you will indeed need some C and basic audio processing knowledge.

vkthor 2013-12-21 22:37

Re: Radio buffer / timeshift
 
Noob alert: I've had some free time but I've not been able to compile cfmradio for the N900 :(. I tried compiling the (modified) source using make, after installing build-essential-tools, but no luck.
Could you perhaps point me in the right direction here?
Thank you very much :)

javispedro 2013-12-21 23:00

Re: Radio buffer / timeshift
 
Quote:

Originally Posted by vkthor (Post 1399538)
Noob alert: I've had some free time but I've not been able to compile cfmradio for the N900 :(. I tried compiling the (modified) source using make, after installing build-essential-tools, but no luck.
Could you perhaps point me in the right direction here?
Thank you very much :)

Are you using scratchbox (the Maemo SDK)? If not, you may want to read any of the Maemo SDK guides, e.g. http://wiki.maemo.org/Documentation/...ment/Maemo_SDK.

If you are already using scratchbox, then you should install maemo-sdk-dev before continuing.


All times are GMT. The time now is 21:47.

vBulletin® Version 3.8.8