PDA

View Full Version : development: alarm tones overlaid on music? combine streams?


peterw
2008-08-29, 15:58
At home I've been working on that kitchen timer plugin that everyone's new hero, Caleb, asked about (in short: since the Boom is physically well-suited for kitchens, why not use it as a kitchen timer?). I'm still wrestling with how to audibly get the user's attention when an alarm goes off (visually is easy: make the onscreen text flash). My favorite idea for the audible alarm that I know I can pull off is an audible equivalent of the flashing screen -- make sure something is playing, and make the volume jump up and down enough steps to get & keep the user's attention. (I don't want to simply play an alarm playlist, esp. if the user happens to be listening to a "live" Internet Radio stream, which is often the case in my kitchen.)

What I'd like to do is something like
1) ask the Squeezebox to overlay some tones atop the music. This might be Boom-specific since it has a newer, more capable DSP. My plugin could drop the main music volume if needed and ask the SB/Boom to overlay tones at some reasonable volume until the user acknowledged the alarm.
or
2) ask the Squeezebox to merge two sources -- the current music source and an "alarm" source.

The second is probably too much trouble: server & player resources, DRM, direct vs. proxied HTTP streams, etc.

But how about the first? Is this possible now, or should I file an enhancement request?

dwilliams01
2008-08-29, 17:52
The first option sounds like the attention alert signal that will show up on the TV from time to time when there is severe weather. It is very noticeable. It would be best, in my opinion, if it could sound a few tones then auto "snooze" for a couple of minutes and then sound again. Our oven does it this way and it is very nice if you don't want to go deal with it right away but don't want to forget about it.

peterw
2008-08-29, 18:11
The first option sounds like the attention alert signal that will show up on the TV from time to time when there is severe weather. It is very noticeable. It would be best, in my opinion, if it could sound a few tones then auto "snooze" for a couple of minutes and then sound again. Our oven does it this way and it is very nice if you don't want to go deal with it right away but don't want to forget about it.

Basically, but imagine that tone playing with the regular TV soundtrack still running. Caleb, Felix, Max, is this possible now?

dwilliams01
2008-08-29, 19:00
I guess that I'm not sure that combining them is much of a benefit - just my opinion here. Makes it pretty noticable when the "normal" sound is dropped in place of the weather alert. Since it is only for a few seconds I don't mind missing a bit of the main soundtrack and I feel that I'd miss it anyway if the alarm tone was loud enough to make sure it was noticed...

peterw
2008-08-29, 20:52
I guess that I'm not sure that combining them is much of a benefit - just my opinion here. Makes it pretty noticable when the "normal" sound is dropped in place of the weather alert. Since it is only for a few seconds I don't mind missing a bit of the main soundtrack and I feel that I'd miss it anyway if the alarm tone was loud enough to make sure it was noticed...

It's not that combining is better, it's that pausing the music/stream playback is not acceptable. Perhaps dropping the music/stream volume *very* low (maybe even 0) would be good.

I guess this brings up a different part of my request -- the "tone" volume should be separate from the "stream" volume, as I'd definitely want the tone to seem significantly louder than the music. Might even want the tone to get louder & music to get quieter as more time elapsed.

Goodsounds
2008-08-29, 21:48
I can buy a kitchen timer for under $10....which is what I want to do, because I don't want to worry about using it when my hands are grungy, and I want to not worry about throwing it away and buying a new one.

Just my opinion, I don't think a feature like this is going to sell too many $299 Booms.

peterw
2008-08-29, 22:21
I can buy a kitchen timer for under $10....which is what I want to do, because I don't want to worry about using it when my hands are grungy, and I want to not worry about throwing it away and buying a new one.

Just my opinion, I don't think a feature like this is going to sell too many $299 Booms.

I keep my Boom remote in a "snack" sized Ziploc-style bag, stuck to the side of the refrigerator (you've read that it's magnetic, right?). The bag gets a little dirty, but the remote is fine.

As for selling units, I don't care. This meets a need that I and others have -- especially when I add the ability to save & name timers ("Lasagna: 2:31 To go") and display countdowns and/or alarms on multiple players (set the alarm in the kitchen, then go upstairs knowing I can check the timer there, and I'll be notified when the time's up.

ccrome2
2008-08-30, 00:44
The more I think about it, the more I like the idea of a simple
beep beep .... beep beep .... beep beep

alarm, overlaid on any playing music. There could be different patterns for
different alarams.

alarm 1: Beep ... beep ... beep ... beep
alarm 2: beep beep ... beep beep ... beep beep
alarm 3: beep beep beep ... beep beep beep ... beep beep beep

The idea here is to really get your attention, and give you the useful
information quickly. This isn't like waking to an alarm where you may enjoy
dozing for some time to music.

On boom, we can do it easily in the DSP. There wouldn't even be any DSP or
firmware changes needed (for 1kHz tone beep anyway).

On the other products, we might be able to do it, but I don't know. That
would take more work, and firmware changes.

When I get back, I can whip up some server code that you can put into your
plugin.

-Caleb

On 8/30/08, peterw <peterw.3exunn1220070302 (AT) no-mx (DOT) forums.slimdevices.com>
wrote:
>
>
> Goodsounds;334093 Wrote:
> > I can buy a kitchen timer for under $10....which is what I want to do,
> > because I don't want to worry about using it when my hands are grungy,
> > and I want to not worry about throwing it away and buying a new one.
> >
> > Just my opinion, I don't think a feature like this is going to sell too
> > many $299 Booms.
>
> I keep my Boom remote in a "snack" sized Ziploc-style bag, stuck to the
> side of the refrigerator (you've read that it's magnetic, right?). The
> bag gets a little dirty, but the remote is fine.
>
> As for selling units, I don't care. This meets a need that I and others
> have -- especially when I add the ability to save & name timers
> ("Lasagna: 2:31 To go") and display countdowns and/or alarms on
> multiple players (set the alarm in the kitchen, then go upstairs
> knowing I can check the timer there, and I'll be notified when the
> time's up.
>
>
> --
> peterw
>
> http://www.tux.org/~peterw/
> free plugins: http://www.tux.org/~peterw/#slim
> AllQuiet BlankSaver ContextMenu FuzzyTime PlayLog
> PowerCenter/BottleRocket
> SaverSwitcher SettingsManager SleepFade StatusFirst SyncOptions
> VolumeLock
> ------------------------------------------------------------------------
> peterw's Profile: http://forums.slimdevices.com/member.php?userid=2107
> View this thread: http://forums.slimdevices.com/showthread.php?t=51702
>
>

erland
2008-08-30, 02:27
alarm, overlaid on any playing music. There could be different patterns for
different alarams.

alarm 1: Beep ... beep ... beep ... beep
alarm 2: beep beep ... beep beep ... beep beep
alarm 3: beep beep beep ... beep beep beep ... beep beep beep

The idea here is to really get your attention, and give you the useful
information quickly.
Do we really need different beeps ?
To me it seems like a single beep type overlaid on the music in combination with showing "Lasagna: Ready" on the display would be good enough.

However, different beep types could be useful for other kind of notifications, like an e-mail notifier.

Would the sound be limited to simple beeps or can we accomplish other kind of sounds too ?

ccrome2
2008-08-30, 02:35
As of today, it's 1 khz beeps only. I can add other tone generation
capability to the DSP though as time allows.

For my use, I don't want to type in what the timer is for -- it takes too
long. I just want to hit alarm 1, turn the knob to the right time, then go
back to alarm 2, and turn the knob to set alarm 2.

If I had beeps for my email notifier, I think I would have a nervous
breakdown. I'm pretty tolerant of noise, but I get too many emails :-)

So, yes, I'll add more sophistocated tone generation in a future DSP load,
but I'm not sure when. There is a problem with the TI DSP software that I
want them to fix before I move to the newest rev that has the better tone
generators. So it may be a little while before we get multi-tone or
other-than-1khz-tone.


-C


On 8/30/08, erland <erland.3ey5zz1220085004 (AT) no-mx (DOT) forums.slimdevices.com>
wrote:
>
>
> ccrome2;334128 Wrote:
> >
> > alarm, overlaid on any playing music. There could be different
> > patterns for
> > different alarams.
> >
> > alarm 1: Beep ... beep ... beep ... beep
> > alarm 2: beep beep ... beep beep ... beep beep
> > alarm 3: beep beep beep ... beep beep beep ... beep beep beep
> >
> > The idea here is to really get your attention, and give you the useful
> > information quickly.
> Do we really need different beeps ?
> To me it seems like a single beep type overlaid on the music in
> combination with showing "Lasagna: Ready" on the display would be good
> enough.
>
> However, different beep types could be useful for other kind of
> notifications, like an e-mail notifier.
>
> Would the sound be limited to simple beeps or can we accomplish other
> kind of sounds too ?
>
>
> --
> erland
>
> Erland Isaksson
> 'My homepage' (http://erland.isaksson.info) 'My download page'
> (http://erland.isaksson.info/download)
> (Developer of 'TrackStat, SQLPlayList, DynamicPlayList, Custom Browse,
> Custom Scan, Custom Skip, Multi Library and Database Query plugins'
> (http://wiki.erland.isaksson.info/index.php/Category:SlimServer))
> ------------------------------------------------------------------------
> erland's Profile: http://forums.slimdevices.com/member.php?userid=3124
> View this thread: http://forums.slimdevices.com/showthread.php?t=51702
>
>

peterw
2008-08-30, 06:58
Caleb, your 1 kHz tone suggestion sounds great, and thanks for offering the code. Here's my current button/VFD UI plan. Basic use case for 2 timers:

Timer 1:
Extras > KT > shows Add a new timer, so tap the knob >
turn the knob to adjust the time > tap the knob > KT suggests a name based on the time, e.g. "5:00" for 5 minutes. tap the knob and you're in the countdown screen for timer 1

Timer 2:
Tap left > Tap right to get back to KT > tap right to add a new timer > turn the knob to adjust the time > tap the knob to start the timer > tap the knob to accept the default m:ss name and you're in the countdown screen for timer 2, and can scroll to switch between the screens for timers 1 & 2

I'd put a preview release up, but I haven't done the mode you enter by tapping the knob on the countdown screen -- that is, there's no way right now to cancel/remove a running timer.

dwilliams01
2008-08-30, 07:56
Just to be clear, I wasn't suggesting pausing the live stream either. I don't think that it is in any way necessary. I'd prefer cutting the volume to close to zero, though, while the beeps are occuring to make them stand out better instead of playing them over the top of the stream - as you've stated.

Looking forward to this!

peterw
2008-08-31, 21:53
I just uploaded "pre1", a preview release. The biggest missing items are
1) There's no audible alarm at all. KT will pop up on your screen with 2 minutes to go on any timer, or when any timer ends, but it won't make any noise. The soundAlarm() code needs to be fleshed out. I'm leaning toward forked code: if Boom, lower volume & use Caleb's 1 kHz tone; else, use Slim alarm API to ensure something plays (set a "current playlist" alarm) & then set timers to move the volume up & down. In either case, the volume should normalize/stabilize whenever the user cancels or pauses the last timer whose 0-second has passed.
2) no ability to name or save alarms.

pre1 has one bit not mentioned in the UI.txt outline -- ContextMenu support. If CM is installed, you'll have a KitchenTimer option when you hold arrow_right (unless, of course, you opt to disable that option in the CM settings Web page).

http://www.tux.org/~peterw/slim/slim7/KitchenTimer/

-Peter

ccrome2
2008-09-01, 05:46
Sweet! I'll check it out.

-C

On Sun, Aug 31, 2008 at 8:53 PM, peterw <
peterw.3f1iln1220241302 (AT) no-mx (DOT) forums.slimdevices.com> wrote:

>
> I just uploaded "pre1", a preview release. The biggest missing items are
>
> 1) There's no audible alarm at all. KT will pop up on your screen with
> 2 minutes to go on any timer, or when any timer ends, but it won't make
> any noise. The soundAlarm() code needs to be fleshed out. I'm leaning
> toward forked code: if Boom, lower volume & use Caleb's 1 kHz tone;
> else, use Slim alarm API to ensure something plays (set a "current
> playlist" alarm) & then set timers to move the volume up & down. In
> either case, the volume should normalize/stabilize whenever the user
> cancels or pauses the last timer whose 0-second has passed.
> 2) no ability to name or save alarms.
>
> pre1 has one bit not mentioned in the UI.txt outline -- ContextMenu
> support. If CM is installed, you'll have a KitchenTimer option when you
> hold arrow_right (unless, of course, you opt to disable that option in
> the CM settings Web page).
>
> http://www.tux.org/~peterw/slim/slim7/KitchenTimer/<http://www.tux.org/%7Epeterw/slim/slim7/KitchenTimer/>
>
> -Peter
>
>
> --
> peterw
>
> http://www.tux.org/~peterw/ <http://www.tux.org/%7Epeterw/>
> free plugins: http://www.tux.org/~peterw/#slim<http://www.tux.org/%7Epeterw/#slim>
> AllQuiet BlankSaver ContextMenu FuzzyTime PlayLog
> PowerCenter/BottleRocket
> SaverSwitcher SettingsManager SleepFade StatusFirst SyncOptions
> VolumeLock
> ------------------------------------------------------------------------
> peterw's Profile: http://forums.slimdevices.com/member.php?userid=2107
> View this thread: http://forums.slimdevices.com/showthread.php?t=51702
>
>

peterw
2008-09-01, 18:00
pre1 has one bit not mentioned in the UI.txt outline -- ContextMenu support. If CM is installed, you'll have a KitchenTimer option when you hold arrow_right (unless, of course, you opt to disable that option in the CM settings Web page).


Caveat: ContextMenu support has been giving me troubles in my Subversion copy of SC7.2 *if* I invoke CM and then KitchenTimer when the player is Off. I don't know if this is strictly a KitchenTimer problem or related to one of the multiple other plugins I have, or something with SC7.2 (or the Subversion rev I've been running). So if you want to use the ContextMenu shortcut, for now I'd suggest turning the player on first. (The problem is that SC7.2 has been changing my When Off screensaver to None after I invoke CM + KT when a player is Off. It's not a SaverSwitcher problem [happens when SS is not loaded], but I haven't tracked it down. I'll probably start developing agains the official 7.2 tarball to be safer.)

-Peter

peterw
2008-09-02, 22:11
I've posted "pre2". It still doesn't allow you to name/save timers, but at least now it's capable of making noise. I'm using a slightly modified copy of Max's nice new alarm class to handle the noisemaking (trusting Max's code with stuff like deciding what to play if there's no current playlist).

Now you'll get the "To go"/"Late !!!" countdown taking over your screen (no screensaver kickin, unless your screensaver has an insanely low timeout) *and* you'll get something playing, with the volume jumping up & down 8 steps every 5 seconds (in testing w/ a real unit, that doesn't seem like enough; I think it should be more like 12 steps every 3 seconds).

Caleb, if you want to try adding Boom code, just search in KitchenTimer/Plugin.pm for "kHz". There are two spots: one in soundAlarm() to start the racket, and another in reorderTimers() to return things to normal. (The TEST_PRETEND_BOOM env var reference is from my testing; SoftSqueeze doesn't pass the isa() Boom test even when using the Boom skin, so this hack lets me test the conditional line formatting [Boom strings are shorter if using the large 1-line font].)

The next three things I'd like to do, but which I probably won't have time to work on for at least a week, are
1) the ability to name & save (& delete saved) alarms: "lasagna", "cookies", "rice", "pecan pie", etc.
2) a proper screensaver that would show *all* alarms from all players (and possible sound audible alarms on other players). So my Bedroom SB3 could display the countdowns for my Kitchen timers, and maybe even give me an audible alert whenever a Kitchen timer hits 0.
3) minor UI tweak -- the "edit" screens (Pause, Cancel, Extend timer, Shorten timer) should show the name, current total running time, & time remaining on line1.

http://www.tux.org/~peterw/slim/slim7/KitchenTimer/

-Peter

max.spicer
2008-09-03, 03:00
I'm using a slightly modified copy of Max's nice new alarm class to handle the noisemaking (trusting Max's code with stuff like deciding what to play if there's no current playlist).

Bundling a copy of Slim::Utils::Alarm doesn't seem a good idea. Can you not extend the class to add the funcitionality you need and override existing bits?

Max

peterw
2008-09-03, 06:40
Bundling a copy of Slim::Utils::Alarm doesn't seem a good idea. Can you not extend the class to add the funcitionality you need and override existing bits?


I considered merely subclassing, but decided to bundle a repackaged copy for now. I intend to submit an enhancement request & patch to you -- I only really made two changes:

1) adding the ability to specify per-alarm screensavers (and the ability to specify "nosaver" to prevent the alarm code from pushing the user to any specific screensaver), and

2) making my version not send the "sound" notification (this part was a last-minute one-line hack; it's probably better addressed by adding a get() method that would allow PowerCenter to use the $self->{_id} reference from the notification to get an alarm object and then use comment() to determine whether it should act).

BTW, I was happy to see the sound() method -- I was nervous when I saw the note about alarms ignoring the seconds component of the specified time, but sound() allows me to fire the alarm at a precise time.

Thanks!

peterw
2008-09-03, 10:50
Bundling a copy of Slim::Utils::Alarm doesn't seem a good idea. Can you not extend the class to add the funcitionality you need and override existing bits?


On the ride in to work, I realized I probably can subclass something like:
alarmsEnabled() # make KT alarms fire even if normal alarms are disabled
pushAlarmScreensaver() # push to KT's saver, or do nothing
popAlarmScreensaver() # do nothing (make the user use the KT UI to pause or cancel the timer; pausing the music shouldn't suffice to pause all active/late timers)

For PowerCenter/coffeepot, KitchenTimer could use $alarm->id() to get the UUID and use a new, not-yet-written PowerCenter API to tell PowerCenter to ignore 'sound' events for that UUID.

It's not quite as nice as I'd like -- one side effect of the current setup, and this proposed setup, is that alarms set for KitchenTimer show up in the other interfaces as regular alarms for that client until the user pauses or cancels all active/late alarms. I'm not sure how to avoid that *except* by continuing to bundle a copy, and making more substantial changes to the copy (e.g. "save" the alarm in some other pref namespace so it's not displayed by the normal Alarm UIs) -- I cannot delete() an alarm right after calling sound(), as I really need/want to rely on stuff like _checkPlaying() to ensure there's something playing. Perhaps I could copy relevant prefs from the 'server' prefs to another namespace and override $prefs in my subclass.

Another note from quick testing this morning -- my current fluctuateVolume() approach isn't good enough. It's not noticeable enough, even dippping -15 and fluctuating every 2 seconds. I'm leaning toward using the 'mute' feature and toggling between normal alarm volume and muting; I think that should be good enough. The audible alert mechanism should be *much* nicer (more noticeable and effective) on Boom, where I could just do something like drop the volume by 20 points and play the 1 kHz tone until all "late" alarms are paused or canceled.

max.spicer
2008-09-03, 11:28
I considered merely subclassing, but decided to bundle a repackaged copy for now. I intend to submit an enhancement request & patch to you -- I only really made two changes:

Excellent - I'm happy to consider anything that allows the alarm to be extended in fairly generic ways.

1) adding the ability to specify per-alarm screensavers (and the ability to specify "nosaver" to prevent the alarm code from pushing the user to any specific screensaver),

You can stop it pushing a screensaver already by setting the alarm screensaver to null can't you? I haven't looked at the code, but I think that's how I wrote it.

BTW, I was happy to see the sound() method -- I was nervous when I saw the note about alarms ignoring the seconds component of the specified time, but sound() allows me to fire the alarm at a precise time.

I was thinking that it should be possible to specify a custom sound method for an alarm, thereby allowing it to act as a more generic timer. Did I do this already? ;-)

Max

peterw
2008-09-03, 14:03
You can stop it pushing a screensaver already by setting the alarm screensaver to null can't you? I haven't looked at the code, but I think that's how I wrote it.

I think that feature's only half-done. IIRC, the constructor creates instance properties for the screensaver (that default to the class' default saver), but 1) there isn't a getter/setter for that property and 2) some code refers to the class default instead of the instance property anyway.


I was thinking that it should be possible to specify a custom sound method for an alarm, thereby allowing it to act as a more generic timer. Did I do this already? ;-)


I don't think so. That wouldn't help me much, anyway -- it's the sound() method's logic for ensuring that something is playing (and the fallback helpers it uses in some cases) that I'm really interested in. I'm only instantiating alarm objects so I can call the nice sound() method you wrote. :-)

That could be a nice feature if the UIs were updated to deal with it. E.G., if there were a way to specify a custom sound() so that the web, Jive, and player UIs would display the comment rather than offer the playlist choices, I could see some uses for that -- e.g., PowerCenter could let users set up basic alarms for things like "turn on living room light" and users could use the Jive/web/player UIs to change the schedule for those "alarms". I don't know that I would actually get around to using such APIs, though.

max.spicer
2008-09-04, 00:56
I think that feature's only half-done. IIRC, the constructor creates instance properties for the screensaver (that default to the class' default saver), but 1) there isn't a getter/setter for that property and 2) some code refers to the class default instead of the instance property anyway.

=head2 alarmScreensaver( $modeName )

Gets/sets the screensaver mode name that is used during an active alarm. This mode will be pushed into at the start of an alarm
and will for the duration of the alarm override any other defined screensaver.

Setting $modeName to undef will disable the alarm screensaver.

=cut

I can't find code that refers to the default when it shouldn't do.

Max

peterw
2008-09-04, 06:06
=head2 alarmScreensaver( $modeName )

Gets/sets the screensaver mode name that is used during an active alarm.

True, but that looks like a class-scoped property, not instance. I can't call that without changing the screensaver for every alarm. I don't want to be responsible for resetting that.

max.spicer
2008-09-04, 11:28
True, but that looks like a class-scoped property, not instance. I can't call that without changing the screensaver for every alarm. I don't want to be responsible for resetting that.

Ah, got you. Yes sorry - I wasn't aiming to allow per-alarm screensavers.

Max

peterw
2008-09-04, 15:37
Ah, got you. Yes sorry - I wasn't aiming to allow per-alarm screensavers.


If you'd be interested, I could send you a patch, though I won't have much time in the coming week. (I think the default should be *not* to set an instance property, so any alarm would get the class default unless its creator had explicitly set it to something else, or to 'nosaver', for *that* one alarm.)

BTW, my "pre3" release subclasses your code. This takes care of the screensaver choice and the per-player pref for disabling all alarms, but it looks like I have another problem -- dealing with $prefs so I could set alarms that don't appear in the Web, Jive, and player UIs. I'd be interested in sending you a patch that splits things between $serverPrefs (read-only access to some prefs) and &alarmPrefs() if you'd consider it. Instead of referencing a simple scalar like the current $prefs for storing alarm preferences, I'd have Alarm.pm use an accessor method, e.g

# define the accessor
sub alarmPrefs { return preferences('server'); }

# then do stuff like
my $fooPrefForThisPlayer = &alarmPrefs()->client($client)->get('foo');

so that I could have my derived class specify a different namespace for its alarms by re-implementing/overriding alarmPrefs(). I tried simply redefining $prefs in my derived class, but that doesn't seem to override the definition in your class. I'm in new territory here with extending Perl code; other OO environments are much more familiar to me, so I might be a bit off-base. Plus I haven't had much time to really work on this. :-/