maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   All about SleepAnalyser (https://talk.maemo.org/showthread.php?t=57419)

Mentalist Traceur 2011-04-18 22:57

Re: All about SleepAnalyser
 
Quote:

Originally Posted by caco3 (Post 991445)
It uses now mplayer to play the lucid dream and wake up music. I switched to it because I did not want to open the maemo mediaplayer to play the music.
If you find a way to play a song with the built in mediaplay WITHOUT having to open an extra window, please let me know
You can go and ask Nokia to add cli support for medaplayer :)

I also tried to use gstreamer which would be the even better solution. How ever after many wasted and frustrating hours I switched back to mplayer. (gstreamer made SleepAnalyser crash and eat all CPU. It might be due the (not correct) way of using it, but I was not able to fix it).

That's fine, I just don't think it need to be an explicit dependency - you could just say in the startup screen somewhere that you have to install mplayer to use Lucid Dream and Wake Up music?

Also, you can ask MohammadAG - he's working on a replacement Media Player for the CSSU; or one of the other non-stock media players' devs, for help with the gstreamer bit? I would love to help with gstreamer but honestly, that is so far beyond my skill level it's not even remotely feasible I'd be of use there.

Edit: Thank you for the explanation either way. I can't really blame you for making that decision.

caco3 2011-04-18 23:05

Re: All about SleepAnalyser
 
well, I belief if users have to install it manually, it gets complicater once again. i want to keep it simple and working for novice users!
I do not really se a problem to have another 20MB in /opt ! I have many many apps installed but still plenty of space.
So you dont have to use it if you dont want to...
And beliefe me, i was very happy when I finally gor gstreamer working. Because of that my frustrations where huge when I realised that the glibc functions make the rest of SleepAnalyser work properly :(
Once there is a way of using the maemo media player without apening a new window (or additionally keep it in the backround) I am happy to switch back.

x-lette 2011-04-19 11:35

Re: All about SleepAnalyser
 
Hi caco3,
today I let me wake up with a song that played very well the last days, but today I wanted to stop it before it was played to end. I pressed the top button of the N900 to get the slide-to-activate screen and immediately the song stopped.
Is that behaviour by design or went something wrong this morning? In logfile I can't find any useful hint. It just says "Stop music player".

caco3 2011-04-19 14:38

Re: All about SleepAnalyser
 
Are you sure the song was not just over at that moment? That would mean that the alarm would have raised in the next seconds as well.
The only way to stop a song is its and and pushing the stop button at the left bottom corner!

x-lette 2011-04-19 17:41

Re: All about SleepAnalyser
 
Quote:

Originally Posted by caco3 (Post 991834)
Are you sure the song was not just over at that moment? That would mean that the alarm would have raised in the next seconds as well.
The only way to stop a song is its and and pushing the stop button at the left bottom corner!

Definitely not. It was about the middle of the song and I guess somehow the player crashed when I pressed that button. In Sleepanalyser the stop button was still visible. Does it change or hide when the song is stopped?

caco3 2011-04-19 20:30

Re: All about SleepAnalyser
 
Yes, SleepAnalyser knows how long the song goes and will disable the button at the end. Currently there is no feedback from the player. So if it (mplayer) crashed, SleepAnalyser has no way of figuring it out.

I just got a new idea of how we could use gstreamer; instead including it into SleepAnalyser (which made it malfunctioning/crashing) I could run it as a separate process. With a pipe it would be possible for them to communicate. I have to think a bit deeper into it, so please be patient.

x-lette 2011-04-20 10:30

Re: All about SleepAnalyser
 
Today I selected another song for wakeup (in fact let Sleepanalyser choose the song from a directory) and when pressing that button this morning the song stopped for a second and then played further. I let it play to end and the usual alarm went off.

caco3 2011-04-20 11:32

Re: All about SleepAnalyser
 
That sounds very odd.
Are you sure the song interruption was caused by your button press? Sometimes mplayer stops for a moment when to much cpu time for other processes are needed.
Also, was the button disabled afterwards?
It really looks like as if mplayer is not the best solution, how ever I don't know any other way except using again the maemo media player :(

x-lette 2011-04-20 13:33

Re: All about SleepAnalyser
 
I'm not speaking of the button in sleepanalyser but of the hardware button on top of device. Sorry. So it may be caused by cpu consumption of device waking up and drawing slide-screen. I don't think that mplayer is a bad choice as it has a wide range of supported codecs so user could select nearly any soundfile. How is codec support in gstreamer?

caco3 2011-04-20 15:27

Re: All about SleepAnalyser
 
Quote:

Originally Posted by x-lette (Post 992519)
I'm not speaking of the button in sleepanalyser but of the hardware button on top of device.

Well, then there is no issue with SleepAnalyser :)

I am just uploading a new version which uses gstreamer instead mplayer. Now it doesnt use gstreamer in SleepAnalyser itself but runs it as a separate process.
It might still be buggy!
In case it does not work as expected, please have a close look in the log file (/home/user/MyDocs/SleepAnalyser/SleepAnalyser.log). It will contain a lot of information!

Sin 2011-04-22 21:51

Re: All about SleepAnalyser
 
Hello, didn't read whole topic but, found a "diagnosis" command and checked it to see what's wrong. My guess is my localization causes crash. It starts, at the loading screen it crashes and turn back to my desktop. Here is the output btw,

Code:

Nokia-N900:~# python /opt/SleepAnalyser/main.py
Saturday 04/23/11 00:42:46
SleepAnalyser Version: 2.1-55
Traceback (most recent call last):
  File "/opt/SleepAnalyser/main.py", line 112, in <module>
    import i18n #load language file
  File "/opt/SleepAnalyser/i18n.py", line 43, in <module>
    lc, encoding = locale.getdefaultlocale()
  File "/usr/lib/python2.5/locale.py", line 443, in getdefaultlocale
    return _parse_localename(localename)
  File "/usr/lib/python2.5/locale.py", line 375, in _parse_localename
    raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: tr_CY


willem43 2011-04-24 12:45

Re: All about SleepAnalyser
 
Hello, nice, great application !
Is it possible to implement the registration of the sound of snoring into the sleep analyzer ? It would be interesting to know about one's snoring behaviour, and about speaking-during-sleep.
see:
http://itunes.apple.com/us/app/snore...394886870?mt=8

Snoring registration would become even more useful if it could recognise sleep apnea.
( http://en.wikipedia.org/wiki/Sleep_apnea )
Sleep-apnea is distinguishable from normal snoring: it is an exceptionally loud snore after a period of interrupted breathing.

willem43 2011-04-24 13:05

Re: All about SleepAnalyser
 
map your nap:

http://www.switched.com/2009/12/27/m...ng-iphone-app/

on this site:

The new app, developed by Finnish telemedicine provider Remote Analysis, Ltd., compares your bedmate's snoring to a library of pre-recorded snores to detect any potential irregularities -- namely, to determine if he or she might be susceptible to sleep apnea, a condition whereby people take long pauses between breaths while asleep, depriving themselves of oxygen. Sounds like a roaring good idea to us, and a great way to keep track of your loved one's health every time you hit the sack -- or, more likely, every time you hit the couch, doubtless in front of a late-night movie.

As i do not consider changing to Iphone, such an app for n900 would be really great.

caco3 2011-04-26 00:33

Re: All about SleepAnalyser
 
@ Sin: I will fix this in the next version. Until then you can use Sleepanalyser by running the following command in XTerm:
python /opt/Sleepanalyser/main.py --language en

@ willem43: I am not going to add sound detection in the near future. This would be a huge task and it would be very difficult to interpret the data.
To record the snoring would be interesting, how ever I do not have the time to implement more huge functions into Sleepanalyser. I spend already far to much time for it :(

rexii23 2011-04-26 01:01

Re: All about SleepAnalyser
 
Hi caco3,

I'm wondering if you had the time to look into improving the lucid dream function?

I've been testing it on and off lately and haven't gotten any results. Most likely due to the fact it only plays at the start and not somewhere in the latter half of the night's sleep. I think you said it was difficult to add the ability to trigger the lucid music in the middle.

I was thinking maybe its possible to use a combination of the normal alarm function and wakeup music function as a substitute? For example if the alarm is set to say 5am with a 30min window, and my movement moves above the trigger level(eg. at 5.15am) then the wakeup music will play followed by the alarm. Instead of playing the wakeup music& alarm straight away, implement a delay that is customisable. So if I had a delay of 60min, in theory it should act like the following:

5.15am - movement above trigger, delay activated
6.15am - wakeup music plays (i'll use lucid music in this case)

All i have to do is to give the alarm a blank sound file so that an alarm wont wake me up. I guess I could also make this work right now by making a custom music file that have 60min of blank at the start, but it's not very elegant.

It would still be awesome if a proper function can be added for better triggering of lucid music in the latter half of the night, but if not it would still be good to see if my suggestion works.

Thanks!:)

caco3 2011-04-26 11:26

Re: All about SleepAnalyser
 
Hi rexii32

I do not completely understand your examples. Could you check/correct the times in your post? I believe some of them are wrong/dont make sense.

About the lucid dream function:
Do you want to be able to set a second delay, like it only can start x hours sleeping and and (then) y minutes in deep/light sleep?
That would not be too hard to implement.

About the wake up music:
as I understand it, you want to delay the music for another while after you triggered the alarm?
Why do you need that?
Why not keeping it the way you do it now?

To be honest, I want to lower my time investment for SleepAnalyser for a while. I invested a lot of time the last few months, but now I have to move my priorities a bit. I still will do bug fixes and so on, but dont want to implement big features for a while.

rexii23 2011-04-26 11:51

Re: All about SleepAnalyser
 
1 Attachment(s)
Quote:

Originally Posted by caco3 (Post 995503)

Do you want to be able to set a second delay, like it only can start x hours sleeping and and (then) y minutes in deep/light sleep?
That would not be too hard to implement.

I think I made the example more complicated than it really is. What you described in the quote is exactly what I would like to see.

I'll try to give another example with an attached chart and hope it's easier to understand.

In this example I started sleep at just before 11pm. I want to set a delay where it can only start 3hrs into my sleep (so start just before 2am). It will see that period of light sleep (2.35am-2.55am) and recognise it as the transition between sleep cycles. 2.55am would be the start of a new sleep cycle. It would then count 60minutes and play the lucid dream music.

Hope that's clearer.

sil 2011-04-26 13:22

Re: All about SleepAnalyser
 
this app sounds great ... but i can't install because libpcre3 and libspeex1 packages are missing ...

PR1.3 is installed

apt-get install libpcre3 doesn't work ... what am I missing? thx

caco3 2011-04-26 13:29

Re: All about SleepAnalyser
 
Quote:

Originally Posted by Sin (Post 993905)
Hello, didn't read whole topic but, found a "diagnosis" command and checked it to see what's wrong. My guess is my localization causes crash. It starts, at the loading screen it crashes and turn back to my desktop. Here is the output btw,

Code:

Nokia-N900:~# python /opt/SleepAnalyser/main.py
Saturday 04/23/11 00:42:46
SleepAnalyser Version: 2.1-55
Traceback (most recent call last):
  File "/opt/SleepAnalyser/main.py", line 112, in <module>
    import i18n #load language file
  File "/opt/SleepAnalyser/i18n.py", line 43, in <module>
    lc, encoding = locale.getdefaultlocale()
  File "/usr/lib/python2.5/locale.py", line 443, in getdefaultlocale
    return _parse_localename(localename)
  File "/usr/lib/python2.5/locale.py", line 375, in _parse_localename
    raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: tr_CY



Hi Sin

I tried to reproduce this error, but can't.
It looks like to me that your locale files are broken. Which language/region are you using on your phone?
Please also check the latest version of sleepanalyser and let me know if it still doesnt work.

caco3 2011-04-26 14:06

Re: All about SleepAnalyser
 
Quote:

Originally Posted by sil (Post 995554)
this app sounds great ... but i can't install because libpcre3 and libspeex1 packages are missing ...

PR1.3 is installed

apt-get install libpcre3 doesn't work ... what am I missing? thx

You are missing some repositories. The mentioned files are available in the Nokia and SSU repositories!

See here: http://maemo.org/packages/view/libpcre3/

You might have to add this to your sources list:
deb https://downloads.maemo.nokia.com/fremantle/ssu/mr0 ./

Please also check the forum for other threads!

sil 2011-04-26 18:24

Re: All about SleepAnalyser
 
already checked the repositories via appmanager -> catalogues ...

https://downloads.maemo.nokia.com/fremantle/ssu/mr0 ./ => enabled
https://downloads.maemo.nokia.com/fremantle/ssu/apps ./ => enabled

still not found via apt-get ...

maybe i'm too stupid for it :D

caco3 2011-04-26 22:49

Re: All about SleepAnalyser
 
Quote:

Originally Posted by sil (Post 995701)
still not found via apt-get ...

I had the same issue myself and could fix it by adding the repositories. It might be that you cant install the missing packages with apt-get, but it should work by installing SleepAnalyser. (As the repos are from Nokia, the access might be somehow restricted).


If it still doesnt work out, you can search the packages with tpe package search: http://maemo.org/packages/
Then download the SDK version (Fremantle SDK free armel) and install it with dpkg:
dpkg -i PACKAGENAME.deb

willem43 2011-04-27 06:36

Re: All about SleepAnalyser
 
hallo caco3:
ok, no sounds ! What you did already, is great. thanks.

sil 2011-04-27 07:14

Re: All about SleepAnalyser
 
Quote:

Originally Posted by caco3 (Post 995855)
I had the same issue myself and could fix it by adding the repositories. It might be that you cant install the missing packages with apt-get, but it should work by installing SleepAnalyser. (As the repos are from Nokia, the access might be somehow restricted).

havent tried installing SleepAnalyser via apt-get

Quote:

Originally Posted by caco3 (Post 995855)
If it still doesnt work out, you can search the packages with tpe package search: http://maemo.org/packages/
Then download the SDK version (Fremantle SDK free armel) and install it with dpkg:
dpkg -i PACKAGENAME.deb

that worked ... downloaded libpcre3 and libspeex1 and installed with dpkg ... SleepAnalyser installed!

Thnx for the help

Sin 2011-04-28 01:05

Re: All about SleepAnalyser
 
Hello caco3,

just updated SleepAnalyser and checked if it is ok now, it works! :) Thanks :) using Turkish localization btw.

Another question, I put my phone on my chair and sleep after that. So my phone is far from me, about 50centimeters. How to calibrate it for this situation? I tried to calibrate it but I failed more than three times :(

caco3 2011-04-28 17:25

Re: All about SleepAnalyser
 
Hi SIn

Did you read the documentation to SleepAnalyser (Menu Help)?
SleepAnalyser is recording your movements. Thats not possible if it lies on a chair! It has to be on your mattress. The best is when it is under your pillow.

x-lette 2011-04-28 19:14

Re: All about SleepAnalyser
 
As you're mentioning it again: how does lying under the pillow affect the temperature of the device? I fear that it will overheat and damage. Can anyone tell how far the temp raises when it lays under the pillow?
I always lay it beside the pillow, about 10-20cm away so I also won't accidently give it a "header shot" ;)

Sin 2011-04-29 01:45

Re: All about SleepAnalyser
 
Ouch, seems I missed a "huge" point.

I thought it was sound sensitive, that's why I put it on chair :) well, I'm afraid of putting something near me which I can accidently hit or break while I'm asleep. Subject is my beloved N900 ! Must find an alternative way :)

thank you for your efforts by the way, there is huge work on this app which must be appriciated. :)

jimmybonsaville 2011-04-29 02:48

Re: All about SleepAnalyser
 
1st thing 1st...i dont really know why i downloaded this app...BUT honestly this is the most intriguing piece or software ive ever seen on a phone lol Im still not sure how to use it properly but im blown away so far. I googled a little about lucid dreams and ive experienced them before...so now this app can help maybe induce them...im amazed. Does anyone have any tips for certain music to use for the lucid dreams? Also..embarrassing as it may sound...i sometimes talk in my sleep...wonder if there can be a sound volume trigger to record? ha

Once again AMAZING piece of software and once i get a dispute sorted with paypal..ill be donating

caco3 2011-05-04 11:41

Re: All about SleepAnalyser
 
Hi all

I started a wiki page about SleepAnalyser, as many people over and over again ask the same questions.
Please help and contribute your tipps for SleepAnalyser here: http://wiki.maemo.org/SleepAnalyser

Especially if you know good lucid dream music and so on, please list it in the wiki.

Devrim 2011-05-10 13:05

Re: All about SleepAnalyser
 
@caco3

Are you interested in a Turkish translation file for SleepAnalyser? If you are I can try to translate it (My Turkish is not 100% but I'll do my best)


Also:
I recorded my sleep for the first time and I noticed I was in Light sleep around 7:00 till around 7:10 after that I was in deep sleep and I woke up really late. If I get the same result again and again is it better to set my alarm at 7:00 so I will get up more easily? (I have issues getting up no matter how early/late I sleep)

caco3 2011-05-10 18:20

Re: All about SleepAnalyser
 
1 Attachment(s)
Hi Devrim

I would like to see a Turkish version. So if you are willing to translate it, that would be great. It only takes you around 15..30 minutes and is quite easy.
Please have a look at the explanations here: http://talk.maemo.org/showpost.php?p...&postcount=258

Attached to this post is the latest language file.

Thank you for your help!

Devrim 2011-05-10 21:49

Re: All about SleepAnalyser
 
My Turkish isn't as good as I expected so I need to make sure the translations are correct. It will take me longer to finish it (I expect it to be finished in a week)

x-lette 2011-06-02 09:50

Re: All about SleepAnalyser
 
Hi, several updates of SleepAnalyser in repo but no word about in here?
(just wanna push this thread again ;) )

caco3 2011-06-02 21:05

Re: All about SleepAnalyser
 
You are right :)
I havent been very present in the forum recently.

The latest version I moved into extras is mainly a bug fix and some small addings.
How ever the version which is now in testing has many new features and should be very stable. So please test it and vote for it at http://maemo.org/packages/package_in...nalyser/2.2-4/

x-lette 2011-06-08 08:11

Re: All about SleepAnalyser
 
I'd love to vote for 2.2-4 but I just discovered a strange behaviour:
When setting an alarm with wakeup music and then stopping music and logging before regular alarm starts, the alarm is still active in alarmqueue. It just gets deleted when closing SleepAnalyser.

Example: Alarm time 9.00, frame 30 min, music duration 5 min. Music gets triggered at 8.40, would run til 8.45 and then alarm would go off. Entry in alarmqueue is now set to 8.45 (easily visible via nextalarm widget). Now stopping music and logging at 8.43, but not closing SleepAnalyser! I.e. app shows either statistics or start window. This stops music but doesn't clear the alarm from alarmqueue. When closing the app the alarm gets deleted.

Is that behaviour by design? Or do you accidentally clear alarmqueue only when closing app? In my opinion it should be done when logging stops and I guess it is done correctly when stopping logging before music starts.

I think most of the time this has no effect on user but thinking about a quite long running wakeup music (some ten minutes for example) the alarm could get triggered when user is already up and away from phone.

This in turn leads to a small request: could you add the option to only play music without an alarm afterwards? That would be nice as the alarm sound is quite nasty after some smooth wakeup music :rolleyes:

caco3 2011-06-08 11:39

Re: All about SleepAnalyser
 
Quote:

Originally Posted by x-lette (Post 1024812)
I'd love to vote for 2.2-4 but I just discovered a strange behaviour:
When setting an alarm with wakeup music and then stopping music and logging before regular alarm starts, the alarm is still active in alarmqueue. It just gets deleted when closing SleepAnalyser.

Example: Alarm time 9.00, frame 30 min, music duration 5 min. Music gets triggered at 8.40, would run til 8.45 and then alarm would go off. Entry in alarmqueue is now set to 8.45 (easily visible via nextalarm widget). Now stopping music and logging at 8.43, but not closing SleepAnalyser! I.e. app shows either statistics or start window. This stops music but doesn't clear the alarm from alarmqueue. When closing the app the alarm gets deleted.

Is that behaviour by design? Or do you accidentally clear alarmqueue only when closing app? In my opinion it should be done when logging stops and I guess it is done correctly when stopping logging before music starts.

I think most of the time this has no effect on user but thinking about a quite long running wakeup music (some ten minutes for example) the alarm could get triggered when user is already up and away from phone.

You are right, this behaviour is on purpose!
On one hand is a safety, in case SleepAnalyser goes mad (which should not happen any more with the latest version).
On the other hand I thought its useful in case somebody acknowledges the alarm and then continues sleeping.

The mentioned (2nd) alarm will come at the set time, as you figured out. How ever it has nothing to do with the wake up music. It will get removed when you close SleepAnalyser. As you at that time still could be in bed, I thought its ok to keep the alarm active. At least for me, I always close SleepAnalyser when I get up, as I at the same time anyway quickly check my emails and calendar.

Quote:

Originally Posted by x-lette (Post 1024812)
This in turn leads to a small request: could you add the option to only play music without an alarm afterwards? That would be nice as the alarm sound is quite nasty after some smooth wakeup music :rolleyes:

I was thinking about that myself. But then decided that that would be dangerous. One could stop the music and then continue sleeping. (You might not even realise doing it as you might still be partially asleep). The nasty sound keeps me reminded of having to get up. Usually I try to get up before the alarm goes off :)

x-lette 2011-06-08 13:13

Re: All about SleepAnalyser
 
I understand your point but I think it's some steps beyond the scope of such an app. First goal should be to smoothly wake up the user. In addition to the analyse of sleep this can be done by playing some suitable music in the morning but in the end this is the user's choice if and what kind of music he wants to hear in the morning.
But when I select music to wake me up I usually choose one that is able to make me awake. If I'm such a deep sleeper or if I know that I have only few hours to sleep and urgently need to get up by time I always can choose evilalarm as external program. Or I can script a wakeup procedure by myself like first playing a smooth song then calling evilalarm.
Second argument: when a user already stopped music and logging he could be considered to be awake. So there'd be no need to let the alarm in queue.

To make it short: my opinion is that I'd like to have the choice to get up by music or alarm or anything else. So I would appreciate if alarm gets deleted from queue when user stops current logging. And additionally it would be fine to have the choice to enable or disable alarm at all.

But as this point is now cleared (e.g.: by design) I can now vote for current version! :D

caco3 2011-06-09 08:58

Re: All about SleepAnalyser
 
I was thinking a bit about your requests.
I really do not want to delete the 2nd alarm, as it is a protection in case something goes wrong.
How ever, if you do not want to have an alarm, I found an easy solution for you: Just use an external alarm, which doesn't do anything, i.e. the command "true". This way, you will not get any alarm except the wake up music.

x-lette 2011-06-10 14:21

Re: All about SleepAnalyser
 
Quote:

Originally Posted by caco3 (Post 1025635)
I was thinking a bit about your requests.
I really do not want to delete the 2nd alarm, as it is a protection in case something goes wrong.
How ever, if you do not want to have an alarm, I found an easy solution for you: Just use an external alarm, which doesn't do anything, i.e. the command "true". This way, you will not get any alarm except the wake up music.

Allright, I can understand your point. Your 'workaround' is a really great one, very linux-ish :D. I just didn't test wether music and alternate alarm work together and thought, alternate alarm would disable wakeup music too. But this way it's a great solution to first have music and then nothing or more music or whatever! Thanks!


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

vBulletin® Version 3.8.8