It is currently September 16th, 2019, 11:27 pm

chimes

Discuss the use of Lua in Script measures.
User avatar
steve62254
Posts: 15
Joined: June 8th, 2016, 5:15 am

chimes

steve62254 » June 8th, 2016, 5:20 am

is possible to have hourly,half hour and quarter hour chimes using .wav files?
if so how would you write it in a skin
thanks
steve
User avatar
balala
Rainmeter Sage
Posts: 8618
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: chimes

balala » June 8th, 2016, 7:18 am

steve62254 wrote:is possible to have hourly,half hour and quarter hour chimes using .wav files?
if so how would you write it in a skin
thanks
steve
Yes, it is, but for this you don't need a lua script:

Code: Select all

[MeasureMinutes]
Measure=Time
Format=%#M
IfCondition=((MeasureMinutes%15)=0)
IfTrueAction=[PLAY "#@#YourWAVFile.wav"]
This measure returns the number of minutes. If this number is divisible by 15, the appropriate wav file will be played.
User avatar
steve62254
Posts: 15
Joined: June 8th, 2016, 5:15 am

Re: chimes

steve62254 » June 8th, 2016, 12:55 pm

tried this didn't work
steve


[Rainmeter]
Update=1000

[MeasureTime]
Measure=Time
Format=%H:%M:%S

[MeasureDate]
Measure=Time
Format=%#d/%B/%Y

[MeterBackground]
Meter=Image
W=120
H=8
SolidColor=60,60,60,0

[MeterTime]
Meter=String
MeterStyle=TextStyle
MeasureName=MeasureTime
X=220
Y=80
FontSize=50

[MeterDate]
Meter=String
MeterStyle=TextStyle
MeasureName=MeasureDate
X=165
Y=0
FontSize=50

[MeasureMinutes]
Measure=Time
Format=%#M
IfCondition=((MeasureMinutes%15)=60)
IfTrueAction=[PLAY "#@#oh-ee-oh.wav.wav"]
User avatar
balala
Rainmeter Sage
Posts: 8618
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: chimes

balala » June 8th, 2016, 1:12 pm

steve62254 wrote:tried this didn't work
The IfCondition option of the [MeasureMinutes] measure is wrong. You have to check if the rest of the division is 0, not 60: IfCondition=((MeasureMinutes%15)=0). This rest can't even be equal with 60, its greatest value can be 14.
Also be sure you have the oh-ee-oh.wav.wav file in the @Resources folder.
User avatar
steve62254
Posts: 15
Joined: June 8th, 2016, 5:15 am

Re: chimes

steve62254 » June 8th, 2016, 2:16 pm

here is what i would like to do:
on the hour play chime 1
15 minutes after the hour play chime 2
30 minutes after the hour play chime 3
45 minutes after the hour play chime 4
steve
User avatar
jsmorley
Developer
Posts: 19456
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: chimes

jsmorley » June 8th, 2016, 2:22 pm

I'd be tempted to use:

Code: Select all

[MeasureMinutes]
Measure=Time
Format=%#M

[MeasureSeconds]
Measure=Time
Format=%#S

[MeasureChime]
Measure=Calc
Formula=1
IfCondition=(MeasureMinutes = 0) && (MeasureSeconds = 0)
IfTrueAction=[Play "#@#HourChime.wav"]
IfCondition2=(MeasureMinutes = 15) && (MeasureSeconds = 0)
IfTrueAction2=[Play "#@#QuarterAfterChime.wav"]
IfCondition3=(MeasureMinutes = 30) && (MeasureSeconds = 0)
IfTrueAction3=[Play "#@#HalfPastChime.wav"]
IfCondition4=(MeasureMinutes = 45) && (MeasureSeconds = 0)
IfTrueAction4=[Play "#@#QuarterTilChime.wav"]
While checking the seconds isn't absolutely necessary, since actions are only fired once when they become "true", it will protect you from having a slightly bogus chime if you refresh the skin, and I recommend it. In a perfect world you don't want it to chime any time it is 10:30, but exactly when it is 10:30. 10:30:27 is not 10:30, it's 10:30:27... This isn't horseshoes or hand-grenades, and close doesn't count.

Having the IfConditions in their own "host" measure isn't really needed either, but it just feels cleaner to me somehow. You might want to "pause" the chimes while you are playing a game or something...

Code: Select all

[MeasureMinutes]
Measure=Time
Format=%#M

[MeasureSeconds]
Measure=Time
Format=%#S

[MeasureChime]
Measure=Calc
Formula=1
IfCondition=(MeasureMinutes = 0) && (MeasureSeconds = 0)
IfTrueAction=[Play "#@#HourChime.wav"]
IfCondition2=(MeasureMinutes = 15) && (MeasureSeconds = 0)
IfTrueAction2=[Play "#@#QuarterAfterChime.wav"]
IfCondition3=(MeasureMinutes = 30) && (MeasureSeconds = 0)
IfTrueAction3=[Play "#@#HalfPastChime.wav"]
IfCondition4=(MeasureMinutes = 45) && (MeasureSeconds = 0)
IfTrueAction4=[Play "#@#QuarterTilChime.wav"]

[MeterPauseChime]
Meter=String
FontSize=11
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=Pause Chimes
LeftMouseUpAction=[!TogglePauseMeasure MeasureChime]
Having said all that, I predict that unless you spent a career listening to ship's bells while on dog watch on a destroyer at sea, you will be sick to death of this nagging, noisy skin within 24 hours... ;-)
User avatar
steve62254
Posts: 15
Joined: June 8th, 2016, 5:15 am

Re: chimes

steve62254 » June 8th, 2016, 3:36 pm

here is the skin:
[Rainmeter]
Update=1000

[MeasureTime]
Measure=Time
Format=%H:%M:%S

[MeasureDate]
Measure=Time
Format=%#d/%B/%Y

[MeterBackground]
Meter=Image
W=120
H=8
SolidColor=60,60,60,0

[MeterTime]
Meter=String
MeterStyle=TextStyle
MeasureName=MeasureTime
X=220
Y=80
FontSize=50

[MeterDate]
Meter=String
MeterStyle=TextStyle
MeasureName=MeasureDate
X=165
Y=0
FontSize=50

[MeasureMinutes]
Measure=Time
Format=%#M

[MeasureSeconds]
Measure=Time
Format=%#S

[MeasureChime]
Measure=Calc
Formula=1
IfCondition=(MeasureMinutes = 0) && (MeasureSeconds = 0)
IfTrueAction=[Play "#@#oh-ee-oh.wav"]
IfCondition2=(MeasureMinutes = 15) && (MeasureSeconds = 0)
IfTrueAction2=[Play "#@#all_in_good_time.wav"]
IfCondition3=(MeasureMinutes = 30) && (MeasureSeconds = 0)
IfTrueAction3=[Play "#@#my_pretty.wav"]
IfCondition4=(MeasureMinutes = 45) && (MeasureSeconds = 0)
IfTrueAction4=[Play "#@#lollipop_guild.wav"]
========================================================

the first one (IfCondition=(MeasureMinutes = 0) && (MeasureSeconds = 0)
IfTrueAction=[Play "#@#oh-ee-oh.wav"]) worked
the second (IfCondition2=(MeasureMinutes = 15) && (MeasureSeconds = 0)
IfTrueAction2=[Play "#@#all_in_good_time.wav"])one didn't
the .wav filed are located in the same place(C:\Users\6-22-54\Documents\Rainmeter\Skins\Tutorials\@Resources) and are working.
note: the computer does make a single chime on the rest of the IfConditions
steve
User avatar
jsmorley
Developer
Posts: 19456
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: chimes

jsmorley » June 8th, 2016, 3:42 pm

If you get a default Windows "bing" sound instead of your .wav file, then the issue is with the location or name of your wav files.

Make sure you fully understand how @Resources works.

https://docs.rainmeter.net/manual/skins/resources-folder/
User avatar
balala
Rainmeter Sage
Posts: 8618
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: chimes

balala » June 8th, 2016, 3:46 pm

steve62254 wrote:here is the skin:
the first one (IfCondition=(MeasureMinutes = 0) && (MeasureSeconds = 0)
IfTrueAction=[Play "#@#oh-ee-oh.wav"]) worked
the second (IfCondition2=(MeasureMinutes = 15) && (MeasureSeconds = 0)
IfTrueAction2=[Play "#@#all_in_good_time.wav"])one didn't
the .wav filed are located in the same place(C:\Users\6-22-54\Documents\Rainmeter\Skins\Tutorials\@Resources) and are working.
note: the computer does make a single chime on the rest of the IfConditions
steve
Please pack the whole Tutorials folder and post it here.
User avatar
steve62254
Posts: 15
Joined: June 8th, 2016, 5:15 am

Re: chimes

steve62254 » June 8th, 2016, 4:30 pm

C:\Users\6-22-54\Documents\Rainmeter\Skins\Tutorials
two folders in Tutorials:
1)@Resources\Sounds\.wav files
2)Clock\working on.ini
the system will not let me copy and paste the folder "Tutorials" here
steve