maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Maemo 5 / Fremantle (https://talk.maemo.org/forumdisplay.php?f=40)
-   -   Fm transmitter + play music at specified time? (https://talk.maemo.org/showthread.php?t=48227)

ToJa92 2010-03-24 18:58

Fm transmitter + play music at specified time?
 
Is that combo possible?

It's because I got a Philips Wake-up light, which has a FM receiver, and it plays the alarm sound(in this case a FM signal) a half hour before it gets to the max volume. Which means if I use the normal alarm it would shut off way before the time the alarm is at the max level.

festivalnut 2010-03-24 19:04

Re: Fm transmitter + play music at specified time?
 
its a combo i've been tring to work out too, but alas i'm a noob, any experts got a trick to make this happen please?

MohammadAG 2010-03-24 19:09

Re: Fm transmitter + play music at specified time?
 
You could make a script that turns on the FM transmitter and plays a sound, and open terminal and type sleep <time> && sh <script filename>
pseudo code:
#!/bin/sh
dbus command to activate FMTX
play-sound <soundfile>

qwerty12 2010-03-24 19:12

Re: Fm transmitter + play music at specified time?
 
Quote:

Originally Posted by MohammadAG (Post 580834)
dbus command to activate FMTX

fmtx_client -p1

Patola 2010-03-24 19:13

Re: Fm transmitter + play music at specified time?
 
Yes. Schedule with fcron, use play-sound to play the file and turn the transmitter on/off with the lines I added to the Phone control page.

festivalnut 2010-03-24 19:22

Re: Fm transmitter + play music at specified time?
 
wow, quick response, thanks guys! but before i go getting annoyed at my command line ineptitude... <time> is this referring to wake up time, time from now til wake up, and what format would i use? i assume <script filename> is the name of whatever script i'm apparently compiling using the pseudo code? and i'm also guessing i dont need super user for this? sorry if i'm a bit slow still new to linux and n900

MohammadAG 2010-03-24 19:23

Re: Fm transmitter + play music at specified time?
 
Code:

#!/bin/sh
fmtx_client -p1
play-sound /usr/share/sounds/ui-wrong_charger.wav

Save it as alarm.sh
Change the sound to whatever file you want
Chmod +x it:
Code:

chmod +x alarm.sh
Then run it as root
Code:

sleep <time-in-seconds> && sh alarm.sh
Edit: took a look at fxtx_client
You can change the code to fmtx_client -p1 -f(frequency) to something you know won't be covered by another radio station, that way you don't have to set the FMTX every time you go to bed, and you don't have to set the clock each time.

You can also install fm-boost and make it boost
.
Code:

#!/bin/sh
fmtx_client -p1
fm-boost
# sleep is to make sure boost works
sleep 3
play-sound /usr/share/sounds/ui-wrong_charger.wav

Edit 2: you owe qwerty12 a thanks :)

festivalnut 2010-03-24 19:38

Re: Fm transmitter + play music at specified time?
 
thanks sent! now i'm gonna boldly dive into xterm like a 14 year old virgin and hope i dont end up embarrasing myself! :D

ToJa92 2010-03-24 19:39

Re: Fm transmitter + play music at specified time?
 
Now, can I play a whole album? I guess I just set several play-sound's? Or can I set a playlist? Also, is cron available in maemo?

festivalnut 2010-03-24 20:25

Re: Fm transmitter + play music at specified time?
 
okay i seem to be halfway there, compiled script, chmod'd it (whatever the hell that is!) ran it, fm transmitter comes on but i get an error message along the lines of Home directory /home/user not ours. i noticed your code has the sound file under usr/share... do i have to copy my sounds to that location rather than MyDocs? and if so is that a good idea? or if not wtf have i done wrong?

ToJa92 2010-03-24 20:52

Re: Fm transmitter + play music at specified time?
 
Quote:

Originally Posted by festivalnut (Post 580950)
okay i seem to be halfway there, compiled script, chmod'd it (whatever the hell that is!) ran it, fm transmitter comes on but i get an error message along the lines of Home directory /home/user not ours. i noticed your code has the sound file under usr/share... do i have to copy my sounds to that location rather than MyDocs? and if so is that a good idea? or if not wtf have i done wrong?

Point to a sound file in /home/user, that should do the trick. Assuming you have them there.

festivalnut 2010-03-24 21:58

Re: Fm transmitter + play music at specified time?
 
yeah still getting the "home directory home/user not ours" error. anyway timer sorted. script for turning on transmitter sorted. gonna get a bit more practice with xterm cos from what i can see i'm pointing it in the right direction, prob a little thing like a capital letter or space out of place. i'll be back crying for help tomorrow if i spend all night failing! thanks again guys!

ToJa92 2010-03-24 22:08

Re: Fm transmitter + play music at specified time?
 
Well capitalization is important. If the extension is .MP3 then you can't write .mp3.

rash.m2k 2010-03-24 22:16

Re: Fm transmitter + play music at specified time?
 
theres a reason I like Linux/maemo so much!

in less than a day we have helped this guy acheive what would probably take months if it was using another OS - becuase he'd have to wait for an app to be made and approved!

Tablet series rocks!

festivalnut 2010-03-25 00:35

Re: Fm transmitter + play music at specified time?
 
actually could the script be amended to kick in the media player and autoplay a playlist or artist, instead of just playing one file? i'm gonna keep hammering away n hopefully get a hang of this, while i'm here any links to a quick learn xterm guide?

teh 2010-03-25 13:32

Re: Fm transmitter + play music at specified time?
 
I'm quite tempted by all this cron jobbing xterminal typing to start writing some automated processes on my device now!

For example I might do a timed connection to the internet to do updates (Windows Update Style!) and reboots, that kinda thing.

Nice one for bringing this up, might come in handy one day.

MohammadAG 2010-03-25 19:57

Re: Fm transmitter + play music at specified time?
 
Playlists should be possible, but you need mplayer (MAFW is still something I don't know much about).
Use this instead of the play-sound line.
mplayer -playlist <playlistfile>
BUT, play-sound overrides volumes, mplayer doesn't, meaning you'd have to set the volume to 100 before going to bed (unless there's a command for changing volume, but I'm not sure about that)

ToJa92 2010-03-26 14:31

Re: Fm transmitter + play music at specified time?
 
Quote:

Originally Posted by MohammadAG (Post 582367)
Playlists should be possible, but you need mplayer (MAFW is still something I don't know much about).
Use this instead of the play-sound line.
mplayer -playlist <playlistfile>
BUT, play-sound overrides volumes, mplayer doesn't, meaning you'd have to set the volume to 100 before going to bed (unless there's a command for changing volume, but I'm not sure about that)

Great! Now all that is missing is cron, then I'm set :p

EDIT: Can you install the package "debianutils" to get cron?

EDIT#2: Just read this if you need cron: http://wiki.maemo.org/Fcron

twaelti 2010-04-02 20:26

Re: Fm transmitter + play music at specified time?
 
For anybody interested: there is now a "mafw-play-list" command in extras-devel (I've compiled a special version of the mafw-renderer-example.c). You can use that to launch a playlist playing from the command line ("mafw-play-list nameOfMyList").


All times are GMT. The time now is 14:43.

vBulletin® Version 3.8.8