topbanner_forum
  *

avatar image

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

Login with username, password and session length
  • Tuesday March 19, 2024, 12:06 am
  • Proudly celebrating 15+ 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

Last post Author Topic: DONE: RandomPlayer - play a mp3 file at (almost) random intervals  (Read 41958 times)

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,260
    • View Profile
    • Donate to Member
Hi,

I'm looking for a simple program to play a mp3 file at almost random intervals throughout the day. Couldn't find something like that with Google.

'Nice to have' options would be:
- daily start time and end time (limiting the 'operating hours')
- minimum time (in minutes) that needs to pass before it plays the file again
- maximum time

So if I'd set "min" to 10 minutes and "max" to 30 minutes, it might play the file again after 14 minutes, then again after 11, and then again after 25. Etc.

Bonus options I'd like:
- an option to set the volume
- ability to have it play more than one file (in ABC order or randomly)
- an optional toaster or tray area bubble notification that announces that it will play the/a mp3 in x seconds (the amount of seconds being customizable)

Oh, and a low CPU usage is much appreciated!
« Last Edit: January 29, 2011, 04:16 AM by brotherS »

Ath

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 3,610
    • View Profile
    • Donate to Member
Re: IDEA: play a mp3 file at (almost) random intervals
« Reply #1 on: January 23, 2011, 01:12 PM »
Doesn't WinAmp have a Shuffle option?

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,260
    • View Profile
    • Donate to Member
Re: IDEA: play a mp3 file at (almost) random intervals
« Reply #2 on: January 23, 2011, 01:43 PM »
It probably does (no idea, Winamp just won't run on this computer for some reason), but does it support the randomly long silence I need and described above? Never saw it in a regular player.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: IDEA: play a mp3 file at (almost) random intervals
« Reply #3 on: January 23, 2011, 03:46 PM »
i'm curious about how you would use such a program -- what's the point of it?

wr975

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 369
    • View Profile
    • Donate to Member
Re: IDEA: play a mp3 file at (almost) random intervals
« Reply #4 on: January 23, 2011, 05:24 PM »
I don't know what you're doing with it, but it sounds fun.

Here's a little AHK script doing most of the things you want. Perhaps you'll find it useful until someone provides a better solution or enhances this basic script. It works fine on my system. The sound file is just started and sent to the registered sound player. On my system it's Winamp. It communicates via the Tray.


> So if I'd set "min" to 10 minutes and "max" to 30 minutes

Done

> an option to set the volume

Sorry, no.

> ability to have it play more than one file

Done. Edit the file "randomplayer_songlist.txt" and add with full path song files. Sample entries provided.

>  (in ABC order or randomly)

Randomly. The script kinda remembers the tracks played in a file called "played.txt" and won't repeat until all files in songlist.txt have been played.

> an optional toaster

Sorry, no. Install http://www.cdartdisplay.com/ for toasters.

> or tray area bubble notification that announces that it will play the/a mp3 in x seconds

Done.

> (the amount of seconds being customizable)

Done. Load the script in notepad. There're some parameters to configure.

> low CPU usage is much appreciated!

Guess it's done... but this isn't really my doing. AHK power... ;-)


EDIT: Download moved to my last post in this thread
« Last Edit: February 17, 2011, 03:58 AM by wr975 »

timns

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 1,211
    • View Profile
    • Donate to Member
Re: IDEA: play a mp3 file at (almost) random intervals
« Reply #5 on: January 23, 2011, 06:36 PM »
Go on - now tell us why you want it?  :tellme:

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,260
    • View Profile
    • Donate to Member
Re: IDEA: play a mp3 file at (almost) random intervals
« Reply #6 on: January 24, 2011, 07:09 AM »
I don't know what you're doing with it, but it sounds fun.

Yes. :-) It's a 'mind hack' experiment, I'm using this to guide my attention in a direction I like (so as not to be on automatic 24/7).


Here's a little AHK script doing most of the things you want. Perhaps you'll find it useful until someone provides a better solution or enhances this basic script. It works fine on my system. The sound file is just started and sent to the registered sound player. On my system it's Winamp. It communicates via the Tray.

RandomPlayer! I like the name. :-)

Sending it to the registered player won't work for me (because of the way things are set up here), could you change that to AHK's own SoundPlay command please?


>  (in ABC order or randomly)

Randomly. The script kinda remembers the tracks played in a file called "played.txt" and won't repeat until all files in songlist.txt have been played.

Very nice!

I'd prefer *not* to receive bubble notifications about in how many minutes the next file will be played. Could you remove that please or add an on/off switch for that? And by the way, the "x seconds" warnings before a file is launched only seem to work here once after the script is started...weird.

An idea I forgot to mention before: it would be nice if one could specify a list of programs that - if running - would make RandomPlayer *not* launch a file, for example Skype.exe.

Thanks for your work so far!

wr975

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 369
    • View Profile
    • Donate to Member
Re: IDEA: play a mp3 file at (almost) random intervals
« Reply #7 on: January 24, 2011, 02:05 PM »

I've updated my first post with the new file.


> could you change that to AHK's own SoundPlay command please?

Easy. Done.

Now as AHK is playing the song, there's of course no toaster or song information. AHK's progress function could be used to generate some song information on the desktop, but that's really too much work for me.

So, as a "better than nothing" feature: If you're hovering the mouse cursor over the trayicon it'll display a infotip, telling you what the script is currently doing (waiting, song file name, couldn't play because of a blacklisted process).


> I'd prefer *not* to receive bubble notifications about in how many minutes the next file will be playe

Done. See the script for another parameter.

> And by the way, the "x seconds" warnings before a file is

Totally works here (Win7x64). I see it everytime. So sorry, if I can't see what's wrong, I can't fix it.

> nice if one could specify a list of programs that

Done. See the script.

> Thanks for your work so far!

You're welcome.

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,260
    • View Profile
    • Donate to Member
Re: IDEA: play a mp3 file at (almost) random intervals
« Reply #8 on: January 24, 2011, 02:53 PM »
Sounds great, thanks! I'll play around with the new version. :)

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,260
    • View Profile
    • Donate to Member
Re: IDEA: play a mp3 file at (almost) random intervals
« Reply #9 on: January 25, 2011, 03:19 AM »
I created an icon: http://www.filefacto...h/n/RandomPlayer.ico

If you like it, add it to your archive above and add this line under the Splitpath line:
Menu, Tray, Icon, RandomPlayer.ico

Maybe there's a better way to do it, but this works. :)
« Last Edit: January 25, 2011, 03:21 AM by brotherS »

app103

  • That scary taskbar girl
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 5,884
    • View Profile
    • Donate to Member
Re: IDEA: play a mp3 file at (almost) random intervals
« Reply #10 on: January 25, 2011, 03:45 AM »
'Nice to have' options would be:
- daily start time and end time (limiting the 'operating hours')

This would still be nice to have. Since I run my PC 24/7, I wouldn't want the music to start playing during sleeping hours.

I don't know what you're doing with it, but it sounds fun.

Yes. :-) It's a 'mind hack' experiment, I'm using this to guide my attention in a direction I like (so as not to be on automatic 24/7).

Great idea. I might use it myself to ensure I maintain a more cheerful mood throughout the day.

wr975

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 369
    • View Profile
    • Donate to Member
Re: IDEA: play a mp3 file at (almost) random intervals
« Reply #11 on: January 26, 2011, 02:41 AM »
Thanks for the icon. :Thmbsup:

> wouldn't want the music to start playing during sleeping hours

Ops. Forgot... I'll play with the script later and add this function.

wr975

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 369
    • View Profile
    • Donate to Member
Re: IDEA: play a mp3 file at (almost) random intervals
« Reply #12 on: January 27, 2011, 12:23 AM »
New version uploaded. See my first post.

I modified the script a bit. Now there's an ini file for the settings, the requested time mode and some more error checking. I've spent some time testing it, but if you find a bug please tell me.
« Last Edit: January 27, 2011, 02:40 AM by wr975 »

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,260
    • View Profile
    • Donate to Member
Re: IDEA: RandomPlayer - play a mp3 file at (almost) random intervals
« Reply #13 on: January 27, 2011, 03:34 AM »
I modified the script a bit. Now there's an ini file for the settings

Thanks: Wow! :o I thought about requesting/suggesting that yesterday... excellent, thanks!

Suggestion: include a (.url) link file (linking to this thread) in the archive.

Missing feature: I can't right-click the tray icon anymore to reload the script.

Bug: RandomPlayer says something about a blacklisted process (and isn't playing anything) - what's happening?

wr975

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 369
    • View Profile
    • Donate to Member
Re: IDEA: RandomPlayer - play a mp3 file at (almost) random intervals
« Reply #14 on: January 27, 2011, 10:07 AM »
Hi there, new version uploaded.

Right-click tray menu added.

About the blacklisted process... the default.ini had Skype.exe blacklisted. Perhaps it was active? The default.ini now comes with an empty blacklist.

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,260
    • View Profile
    • Donate to Member
Re: IDEA: RandomPlayer - play a mp3 file at (almost) random intervals
« Reply #15 on: January 27, 2011, 03:13 PM »
Hi there, new version uploaded.

Great! The only bug I can find in this version is that the "next song in X minutes" info (when you hover over the tray icon) is not updated as time passes... it always (for example) says 15 minutes, even a minute before the file is then correctly being played.

And how about adding info (when you hover over the tray icon) when RandomPlayer is in 'sleep mode'?


Right-click tray menu added.

Nice, could you please also (re-)add a menu item to pause the script? :)

And how about using the default system editor instead of Editor for songlist ("songList" = typo?) and configuration?


About the blacklisted process... the default.ini had Skype.exe blacklisted. Perhaps it was active? The default.ini now comes with an empty blacklist.

Hmm.... maybe it was running in the background. I suggest you rephrase that bubble error message. I had NO IDEA what it meant... and I requested that feature!  ;D  Maybe change it to something like this?

No sound because blacklisted process
is active; see configuration.
« Last Edit: January 27, 2011, 04:57 PM by brotherS »

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,260
    • View Profile
    • Donate to Member
Re: IDEA: RandomPlayer - play a mp3 file at (almost) random intervals
« Reply #16 on: January 28, 2011, 03:27 AM »
Also, I'd like an option to have RandomPlayer announce only *that* it's about to play something, but not *what*... some surprise factor. :)

wr975

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 369
    • View Profile
    • Donate to Member
Re: IDEA: RandomPlayer - play a mp3 file at (almost) random intervals
« Reply #17 on: January 28, 2011, 01:09 PM »
> next song in X minutes

It was originally meant to be one time only task tray tip, but then it got into an infotip ... which doesn't auto-update, of course. You're right.

I have no time to work on this script this weekend, but expect an update next week.  

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,260
    • View Profile
    • Donate to Member
Re: DONE: RandomPlayer - play a mp3 file at (almost) random intervals
« Reply #18 on: January 29, 2011, 08:25 AM »
Ok. :)

Another idea (in addition to the sleep mode) would be an option to be able to set the PC idle time in minutes (I used A_TimeIdlePhysical for that in the past) after which RandomPlayer stops playing stuff too, even outside of the set sleep times.

So when you sleep longer on a Saturday or Sunday (with the PC running), RandomPlayer won't start to play something before you get up.

Have a good weekend!

wr975

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 369
    • View Profile
    • Donate to Member
Re: DONE: RandomPlayer - play a mp3 file at (almost) random intervals
« Reply #19 on: February 03, 2011, 09:02 AM »
A new version is online... see my first post.

> "next song in X minutes" info

Messing around with date and time values is always a task for me. But I think I got it. :-) Trying to keep it simple, X minutes will never be more than 59.


> And how about adding info when RandomPlayer is in 'sleep mode'?
> Nice, could you please also (re-)add a menu item to pause the script?
> And how about using the default system editor instead of Editor
> No sound because blacklisted process
> an option to be able to set the PC idle time in minutes

Done 5x

See the .ini file to activate/deactivate settings.

I've tested it quite some time, but there's a lot to test already. So I hope there're no bugs.

Enjoy!  :Thmbsup:

Paul Keith

  • Member
  • Joined in 2008
  • **
  • Posts: 1,989
    • View Profile
    • Donate to Member
Re: DONE: RandomPlayer - play a mp3 file at (almost) random intervals
« Reply #20 on: February 03, 2011, 09:09 AM »
Slightly OT but I'm looking for something similar but it instead plays video files when the computer is idle sort of like a screensaver but one where it plays random specified video files.

app103

  • That scary taskbar girl
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 5,884
    • View Profile
    • Donate to Member
Re: DONE: RandomPlayer - play a mp3 file at (almost) random intervals
« Reply #21 on: February 03, 2011, 10:29 AM »
Slightly OT but I'm looking for something similar but it instead plays video files when the computer is idle sort of like a screensaver but one where it plays random specified video files.

Set up your default video player software to how you want it (random, full screen, etc) then make a playlist of the videos you want it to pick from and save it as a playlist file.

Launch your playlist file with my IdleStart app. It allows one to run apps after a specified length of user idle time (no keyboard or mouse input). It does not run apps as screensavers, but time the launching of apps with a more screensaver-like behavior.

Keep in mind that it will not close the video player when the PC is not idle. You will have to do that yourself or run the risk of multiple instances of your player running when you become idle again.

Paul Keith

  • Member
  • Joined in 2008
  • **
  • Posts: 1,989
    • View Profile
    • Donate to Member
Re: DONE: RandomPlayer - play a mp3 file at (almost) random intervals
« Reply #22 on: February 03, 2011, 11:32 AM »
Thanks. I've forgotten about your apps, app.

The multiple instances kind of scares me but still thanks a lot, I thought it would be a lot more complicated to get a feature like this.

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,260
    • View Profile
    • Donate to Member
Re: DONE: RandomPlayer - play a mp3 file at (almost) random intervals
« Reply #23 on: February 04, 2011, 01:43 PM »
A new version is online... see my first post.

I've tested it quite some time, but there's a lot to test already. So I hope there're no bugs.

Thank you! So far it's running very smoothly here... possibly bug-free! :)

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,260
    • View Profile
    • Donate to Member
Re: DONE: RandomPlayer - play a mp3 file at (almost) random intervals
« Reply #24 on: February 05, 2011, 04:55 PM »
RandomPlayer seems to ignore the sleep times, it played something after 23:30 - these are my settings:

[NOSOUNDS]
no_sounds_enable = 1   
         ; 0 or 1
no_sounds_start = 2330
         ; HHMM 24h     
no_sounds_end   = 0820
         ; HHMM 24h