Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • November 23, 2017, 03:19 AM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: IDEA: Play a sound when a color appears on screen  (Read 1850 times)

Seed

  • Participant
  • Joined in 2017
  • *
  • default avatar
  • Posts: 6
    • View Profile
    • Donate to Member
IDEA: Play a sound when a color appears on screen
« on: July 08, 2017, 02:05 PM »
I'm in need of a program that will immediately make a sound when a certain color appears on screen.  I'm willing to pay for the program if the price is not too crazy.  Everything I've found on this site and via Google looks at a particular pixel.  I'm looking for something to monitor a range of pixels.

I would like to be able to change what color triggers the alarm, as well as what sound is played so I can put in a custom sound (red alert from Star trek for example).

Feature wishlist, but not required:

*  I'm working with a multiple monitor set up, so ideally I could choose which monitor the program watches, but that's not essential.  It can watch them all at once if needed. 

* A reset, acknowledge, or pause button so I can mute the sound and tell the program when to start watching again.  Type of thing where the alarm goes off, I acknowledge it, and it tells me the next time the event happens instead of keep triggering off the same event.  May take a little while for the color to leave.  I can tell it when to start watching again, but trying to not have to close and reopen the program unless the program is super quick to start.

* It would be nice if I could have multiple programs running, or if the one program could watch for multiple colors and each have thier own sounds file.  For example, on screen one watch for red with sound a, and on screen two watch for green with sound b.

Here's hoping you folks will help me out!  Thanks for your time!
« Last Edit: July 08, 2017, 09:29 PM by Seed »

Ath

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 3,057
    • View Profile
    • Donate to Member
Re: IDEA: Play a sound when a color appears on screen
« Reply #1 on: July 09, 2017, 03:28 AM »
I seem to remember a very similar request has been posted here before, but I've so far been unable to locate it.
Have you requested this before?

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 37,617
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: IDEA: Play a sound when a color appears on screen
« Reply #2 on: July 09, 2017, 03:33 AM »
I remember a similar request and app as well.

Ath

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 3,057
    • View Profile
    • Donate to Member
Re: IDEA: Play a sound when a color appears on screen
« Reply #3 on: July 09, 2017, 03:38 AM »
Found it: http://www.donationc...x.html#PixelNotifier
PixelNotifier by skrommel  ;D

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 37,617
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: IDEA: Play a sound when a color appears on screen
« Reply #4 on: July 09, 2017, 03:39 AM »

Seed

  • Participant
  • Joined in 2017
  • *
  • default avatar
  • Posts: 6
    • View Profile
    • Donate to Member
Re: IDEA: Play a sound when a color appears on screen
« Reply #5 on: July 09, 2017, 08:27 AM »
I have not posted before and I've already tried pixelnotifier.  Pixel notifier watches one pixel - I'm looking for something that will watch several pixel at once - envision drawing a small box on your screen and if any of those pixels in that box hit the designated color, the alarm goes off.

p3lb0x

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 402
  • Beer, beer, beer, I'm going for a beer!
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: IDEA: Play a sound when a color appears on screen
« Reply #6 on: July 14, 2017, 06:54 PM »
I got the basic idea down, now I just need to wrap it in a UI.
bacon.pngIDEA: Play a sound when a color appears on screenwat.gifIDEA: Play a sound when a color appears on screen
(Disregard that I am hijacking the console window to draw the captured bitmap, this is just for testing)

I am not sure if I am handling this in the best way possible, I am basically taking a screenshot every X milliseconds, and running through the entire bitmap looking for a pixel with the color you want.
Stop mousering people so much - Mouser
« Last Edit: July 14, 2017, 07:11 PM by p3lb0x »

anandcoral

  • Honorary Member
  • Joined in 2009
  • **
  • Posts: 484
    • View Profile
    • App, to help you : Overlap Wallpaper, Park Cursor Aside, Stick A Note, Merge CSV and Text and many more.
    • Donate to Member
Re: IDEA: Play a sound when a color appears on screen
« Reply #7 on: July 15, 2017, 04:50 AM »
I am not sure if I am handling this in the best way possible, I am basically taking a screenshot every X milliseconds, and running through the entire bitmap looking for a pixel with the color you want.
You are doing good job. This is the only way, AFAIK. Only you may change X milliseconds, if it is affecting CPU load.

Regards,

Anand

p3lb0x

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 402
  • Beer, beer, beer, I'm going for a beer!
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: IDEA: Play a sound when a color appears on screen
« Reply #8 on: July 15, 2017, 07:48 AM »


I have made this, is this about what you wanted in its simplest form?

edit: At the moment it can only play wave files, but that can pretty easily be changed, multiple files or checks isn't possible with how I set it up and the program would have to be done very differently (Although that is entirely possible to do with the code I have, I am just not that great at UI programming)

edit edit: I haven't tested it with very large resolution squares. Only in the 250x250 area. I am fairly certain that it won't perform very well at larger resolutions as it is checking every single pixel for a value at a frequency of 20 times a second.

edit edit edit: I also haven't tested it with multiple monitors as the monitors I have at the moment are way too ancient to interface with my videocard. But I am confident that way I am doing things can be fixed to work with multiple screens without too much work if it doesn't already.

edit edit edit edit: Tried it in a fairly large (1000x800'ish) area and it ran with no problems on my machine, but I am running a fairly beefy older generation i7.
Stop mousering people so much - Mouser
« Last Edit: July 15, 2017, 08:15 AM by p3lb0x »

Seed

  • Participant
  • Joined in 2017
  • *
  • default avatar
  • Posts: 6
    • View Profile
    • Donate to Member
Re: IDEA: Play a sound when a color appears on screen
« Reply #9 on: July 15, 2017, 09:51 AM »
Awesome work - thanks!  I'm excited to try it out.

p3lb0x

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 402
  • Beer, beer, beer, I'm going for a beer!
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: IDEA: Play a sound when a color appears on screen
« Reply #10 on: July 15, 2017, 11:17 AM »
It's very rough, just as soon as I figure out how to actually package it, I'll put it up. Sourcecode as well (probably gonna do a bit of clean up first).

Here you go, binary is in the root of the rar and source code is in the directory. It IS made using C# and .NET v4.5.2. So you'll need to get the redistributable from Microsoft if you don't have it already. In case you're running Linux it would have to be ported to mono or something, and I don't have that installed at the moment (and I am using WPF, so UI would have to be redone).

Instructions:
Select a sound
Select a color (no color picker, wasn't as trivial to do as the other stuff)
Select retrigger delay (How long it will wait before triggering again, set it to 0 for only triggering once)
Select a rectangle to "look" in (Might be a bit fidgetry, I think I accidentally set the "drag" area on the border of the rectangle, which can be a bit hard to hit).
Then hit start.

Notes:
The retrigger delay is not timed perfectly, don't expect it to be.
I am not sure what bugs there are if any, if there are any they shouldn't be bad for your PC.
Only wave sound files can be played. I just used what was built into .NET, I saw that I might have been able to use some Windows Media Player dependent calls, but I didn't.

Improvements:
Most of the things you mentioned like multiple regions, different colors, sounds, etc
Better UI
Fix the dragging of the selection window (maybe add a cancel as well? At the moment you can only accept new areas if you accidentally hit the selection for it)
Tasks are probably being used inappropriately, as I haven't done any desktop application GUI work in ages and probably forgot a lot of things.
Change the sound player to something that can accept more sound types.
Maybe add tolerance for colors?

Put it through VirusTotal: https://www.virustot...analysis/1500138024/
Seems I am getting a false positive for git. And maybe because I am doing some pointer manipulation.
Stop mousering people so much - Mouser
« Last Edit: July 15, 2017, 01:05 PM by p3lb0x »

anandcoral

  • Honorary Member
  • Joined in 2009
  • **
  • Posts: 484
    • View Profile
    • App, to help you : Overlap Wallpaper, Park Cursor Aside, Stick A Note, Merge CSV and Text and many more.
    • Donate to Member
Re: IDEA: Play a sound when a color appears on screen
« Reply #11 on: July 15, 2017, 12:07 PM »
 :Thmbsup:

Regards,

Anand

Seed

  • Participant
  • Joined in 2017
  • *
  • default avatar
  • Posts: 6
    • View Profile
    • Donate to Member
Re: IDEA: Play a sound when a color appears on screen
« Reply #12 on: July 17, 2017, 05:05 PM »
Thank you VERY much p3lb0x!  :Thmbsup:

p3lb0x

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 402
  • Beer, beer, beer, I'm going for a beer!
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: IDEA: Play a sound when a color appears on screen
« Reply #13 on: July 17, 2017, 06:09 PM »
Do tell if any glaring bugs occur. I'll probably fix it if it isn't too time consuming. Feel free to drop a few bucks to DC or me using the donationcredits system if you feel like it (Though don't feel compelled or forced).
Stop mousering people so much - Mouser

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 37,617
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: IDEA: Play a sound when a color appears on screen
« Reply #14 on: July 17, 2017, 07:13 PM »
Just want to say how great it is to see when people rise to a challenge!  Nice work, p3lbox! Can't wait to see the reply of surprise from the person who requested this..  :Thmbsup:

Seed

  • Participant
  • Joined in 2017
  • *
  • default avatar
  • Posts: 6
    • View Profile
    • Donate to Member
Re: IDEA: Play a sound when a color appears on screen
« Reply #15 on: August 12, 2017, 11:21 PM »
Been using this program, and it's perfect.  Thanks so much again!  Just...wow...

p3lb0x

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 402
  • Beer, beer, beer, I'm going for a beer!
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: IDEA: Play a sound when a color appears on screen
« Reply #16 on: August 13, 2017, 02:57 PM »
Good to know! I have been wondering though, what is it used for? I am guessing either idle games or some sort of error notification.

Also any usability upgrades you can think of while you have been using it?
Stop mousering people so much - Mouser

Seed

  • Participant
  • Joined in 2017
  • *
  • default avatar
  • Posts: 6
    • View Profile
    • Donate to Member
Re: IDEA: Play a sound when a color appears on screen
« Reply #17 on: August 13, 2017, 06:34 PM »
I use it as an advanced warning system for a game I play to let me know when enemy players are inbound.  Type of thing to give me some piece of mind when I need to walk away from the computer for a few minutes or am concentrating on something in the game.

The only issue I've had so far is that the program only utilizes .wav files, which meant I couldn't use the audio file I had originally planned on using.  This was no problem though as I just had to select a different audio file.

Program works great and is super helpful!  Thanks for creating it!

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 4,833
    • View Profile
    • Donate to Member
Re: IDEA: Play a sound when a color appears on screen
« Reply #18 on: August 13, 2017, 06:44 PM »
The only issue I've had so far is that the program only utilizes .wav files, which meant I couldn't use the audio file I had originally planned on using.

There are a myriad of audio file converter apps out there that easily convert just about any audio filetype to any other audio filetype.  There are also many website-based options, too.  Here's but one:  http://media.io/

p3lb0x

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 402
  • Beer, beer, beer, I'm going for a beer!
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: IDEA: Play a sound when a color appears on screen
« Reply #19 on: August 15, 2017, 07:14 AM »
The only issue I've had so far is that the program only utilizes .wav files, which meant I couldn't use the audio file I had originally planned on using.  This was no problem though as I just had to select a different audio file.

I'll look at using NAudio to allow playback of files other than wave at some point in the foreseeable future.
Stop mousering people so much - Mouser

IainB

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 6,762
    • View Profile
    • Donate to Member
Re: IDEA: Play a sound when a color appears on screen
« Reply #20 on: August 16, 2017, 07:16 AM »
I'll look at using NAudio to allow playback of files other than wave at some point in the foreseeable future.
___________________________________

...but, the future is not foreseeable (except maybe for clairvoyants?)!    :o

p3lb0x

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 402
  • Beer, beer, beer, I'm going for a beer!
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: IDEA: Play a sound when a color appears on screen
« Reply #21 on: August 22, 2017, 06:02 AM »
Added Naudio to the project, should hopefully be able to play mp3 files now.

edit: Also stops sounds when you press the stop button

edit edit: Also just noticed that that killed the single shot playback. Hurh durh, give me a second

edit edit edit: Should be fixed now

edit edit edit edit: Added a small icon as well
Stop mousering people so much - Mouser
« Last Edit: August 22, 2017, 06:38 AM by p3lb0x »