


Is there a way to set the TTS voice VOLUME?


Teknojnky wrote:I posted an updated version of tweakmonkey with a sheet for autoratesongs options.
I did not have time to make any changes to the autoratesongs script itself.
It should be relatively simple to add, simply check the mediamonkey ini for the variable and its value and set your variable in autoratesongs script.
screenshot
' ScriptName: \Scripts\AutoRateSongs.vbs
' Author: DiddeLeeDoo
' Made updating screen work: Steegy!
' Made Radio Announcer work: Steegy!
' Works like magic! He's my HERO!! :)
' Data File issues: onkel_enno & Steegy
' Ideas & beta testing: Roving Cowboy
' Ideas & Start Rate: Teknojnky
' 20. April 2006
' 24. April 2006 modified by Teknojnky to include ini support
'
'
' EXPLAINING THE SYSTEM
'"""""""""""""""""""""""""""""""""""""""""""
' This system is based on how many times you tolerate
' to listen to the same song in a set amount of time.
'
' 1 play = 3 stars (you tolerate it)
' 2 plays = 3.5 stars (you like it)
' 3 plays = 4 stars (really nice)
' 4 plays = 4.5 stars (love it!)
' 5 plays or more = 5 stars (wow!)
'
' If you set time to 24 hours, and listen to the same
' song 4 times over a 24 hours period, the song
' will automatically get rated 4.5 Star
'
' If you want to try out longer periods, like
' 7, 30 or 90 days, you want to take a look at the
' advanced parameters below the area you set Time.
'
' Then there is rating reduction. The script allow you
' to set a 'Hot Zone' of a song, starting after X seconds
' and stops XX percent into the song.
' If you skip the song in the 'Hot Zone' the song receive
' half a star reduction in rating (you may dislike the song)
' Skipped and not previously rated songs get 2.5 Star
'----------------------------------------------------
' HOW TO INSTALL
' --------------------------------------------------
' |
' |1. Exit MediaMonkey, add section below to the file
' | \Scripts\scripts.ini
' |
' | [AutoRateSongs]
' | FileName=AutoRateSongs.vbs
' | ProcName=AutoRateLastSongPlayed
' | Language=VBScript
' | ScriptType=2
' |
' |2. Save this script as \Scripts\AutoRateSongs.vbs
' |
' |3. Check the PARAMETERS below, and set to what
' | you feel is right for you. "Set and Forget"
' | and enjoy the ratings being taken care of!
' |
' --------------------------------------------------
'----------------------------------------------------
Sub AutoRateLastSongPlayed
'
dim ini
set ini = SDB.IniFile
'########### START OF PARAMETERS ###########
'
'Skip monitor start and stop timing section
'"""""""""""""""""""""""""""""""""""""""""""
' Set your skip 'Hot Zone'
'
SampleSeconds = ini.StringValue("AutoRateSongs", "SampleSeconds")
If SampleSeconds = "" Then
SampleSeconds = "10" 'reads value, if nothign there then set false as default
End If
' SampleSeconds = 10 'in seconds
' When should the skip monitor start?
' Allow you to sample songs without consider
' the song as a skip. Set as you like.
StopMonitorPercent = ini.StringValue("AutoRateSongs", "StopMonitorPercent")
If StopMonitorPercent = "" Then
StopMonitorPercent = "75" 'reads value, if nothign there then set false as default
End If
' StopMonitorPercent = 75 'percent(%)
'When should the skip monitor stop?
' If skipped after XX percent, it will
' not be considered a skip.
'
'Upgrade rating based on playcount over time
'"""""""""""""""""""""""""""""""""""""""""""
' Set time period to check for repeated plays.
'
CheckBackUnits = ini.StringValue("AutoRateSongs", "CheckBackUnits")
If CheckBackUnits = "True" Then
CheckBackUnits = "'d'" 'reads value, if nothign there then set default
Else CheckBackUnits = "'h'"
End If
' CheckBackUnits = "'d'" ' h=Hours, d=Days
CheckBackAmount = ini.StringValue("AutoRateSongs", "CheckBackAmount")
If CheckBackAmount = "" Then
CheckBackAmount = 7 'reads value, if nothign there then set default
End If
' CheckBackAmount = 7 ' How many units?
'
'
'Advanced parameters
'"""""""""""""""""""""""""""""""""""""""""""
'
' When reached X plays in period set, upgrade.
PlaysRate_3_0_Stars = ini.StringValue("AutoRateSongs", "PlaysRate_3_0_Stars")
If PlaysRate_3_0_Stars = "" Then
PlaysRate_3_0_Stars = 1 'reads value, if nothign there then set default
End If
' PlaysRate_3_0_Stars = 1 'default = 1 over 1 day
PlaysRate_3_5_Stars = ini.StringValue("AutoRateSongs", "PlaysRate_3_5_Stars")
If PlaysRate_3_5_Stars = "" Then
PlaysRate_3_5_Stars = 2 'reads value, if nothign there then set default
End If
' PlaysRate_3_5_Stars = 2 'default = 2 over 1 day
PlaysRate_4_0_Stars = ini.StringValue("AutoRateSongs", "PlaysRate_4_0_Stars")
If PlaysRate_4_0_Stars = "" Then
PlaysRate_4_0_Stars = 3 'reads value, if nothign there then set default
End If
' PlaysRate_4_0_Stars = 3 'default = 3 over 1 day
PlaysRate_4_5_Stars = ini.StringValue("AutoRateSongs", "PlaysRate_4_5_Stars")
If PlaysRate_4_5_Stars = "" Then
PlaysRate_4_5_Stars = 3 'reads value, if nothign there then set default
End If
'PlaysRate_4_5_Stars = 4 'default = 4 over 1 day
'
'This becomes a factor when you want this script
'to check several days back.
'
'ExamplePeriod = 7 Days
'PlaysRate_3_0_Stars = 1 (up to 1 play over last 7 days, 3.0 stars)
'PlaysRate_3_5_Stars = 2 (up to 2 plays over last 7 days, 3.5 stars)
'PlaysRate_4_0_Stars = 3 (up to 3 plays over last 7 days, 4.0 stars)
'PlaysRate_4_5_Stars = 5 (up to 5 plays over last 7 days, 4.5 stars)
' anything over 6 plays over last 7 days, 5.0 Stars.
'
' All this is individual. Just try to do what you think is right
' You can always come back here and fine tune it.
' This script is limited to how long you've had your MM Database.
'
'
'Take note of when the song get played
'"""""""""""""""""""""""""""""""""""""""""""
'
MakeNote = ini.StringValue("AutoRateSongs", "MakeNote")
If MakeNote = "True" Then
MakeNote = True
Else MakeNote = False
End If
' MakeNote = False
'
'Change this to True if you want a note about
'when a song received a playcount rate upgrade.
'The Custom2 field receive a note formatted like
'"WeekDay TimeOfDay Season"
'(time of day = morning, dinner, evening etc.)
'Can be used later to find popular songs
'in these time segments.
' If you live in the Southern Hemisphere please
' go to the end of the script and change
' NorthernHemisphere to False
'
' Announce who's playing next
'"""""""""""""""""""""""""""""""""""""""""""
'
Announce = ini.StringValue("AutoRateSongs", "Announce")
If Announce = "True" Then
Announce = True
Else Announce = False
End If
' Announce = False
'
' Again MAGIC from the WiZZ Steegy!
' Set announce to True if you want your personal
' radio announcer. Text To Speech. (SAPI5
' is needed). Comes default with WinXP.
' If you already have nice voices from places like
' http://www.cepstral.com/ this is a nice option.
' Default Microsoft Sam is a bit so so.
'
'########### END OF PARAMETERS ###########
'
'
' Parameter corrections and shortenings
If StopMonitorPercent > 95 Then StopMonitorPercent = 95
D_H = CheckBackUnits
CB_A = CheckBackAmount
'---------------------------------------------------
' DATA FILE STUFF
'---------------------------------------------------
'Thank you onkel_enno & Steegy!
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
DataFileLocation = SDB.ApplicationPath & "Scripts\AutoRateSongs.dat"
If Not fso.FileExists(DataFileLocation) Then
Call WriteCurrentSongData
Exit Sub
Else 'data exist, read it
Dim DataFile
Set DataFile = fso.OpenTextFile(DataFileLocation, 1)
arSong = DataFile.ReadLine
arSongID = Left(arSong,InStr(arSong,"@")-1)
arSong = Mid(arSong,InStr(arSong,"@")+1)
arSongPlayStart = Left(arSong,InStr(arSong,"@")-1)
arSong = Mid(arSong,InStr(arSong,"@")+1)
arSongSeconds = Left(arSong,InStr(arSong,"@")-1)
arSong = Mid(arSong,InStr(arSong,"@")+1)
arSongRating = Mid(arSong,1)
End If
'---------------------------------------------------
' SAMPLING SONGS?
'---------------------------------------------------
If DateDiff("s",Now,arSongPlayStart) >=-(SampleSeconds+1) Then
DataFile.close 'put here to save a millisecond
Call WriteCurrentSongData
Exit Sub
End If
DataFile.close 'put here to close after sampling check
'---------------------------------------------------
' WRITE A NEW DATA FILE NOW
'---------------------------------------------------
Call WriteCurrentSongData
'---------------------------------------------------
' HOW MUCH OF THE SONG ACTUALLY GOT PLAYED?
'---------------------------------------------------
' Find how much of the song actually played
arSongPercentPlayed = 100-Int(DateDiff("s",Now,DateAdd("s",_
+ arSongSeconds,arSongPlayStart))/arSongSeconds*100)
' Before checking skips and played check, prepare for doing
' modification to rating based on Songs.ID read from datafile
dbSongID = "AND Songs.ID=" & arSongID
Dim dbTable
Set dbTable = SDB.Database.QuerySongs(dbSongID)
Dim dbSong
Set dbSong = dbTable.Item
If (StopMonitorPercent - arSongPercentPlayed) >= 0 Then
'---------------------------------------------------
' SONG SKIPPED, DEGRADE OR NOT?
'---------------------------------------------------
If Int(arSongRating) < 0 Then
' Skipped and unrated = 2.5 Star
If Not dbTable.EOF Then
dbSong.Rating = 50
dbSong.UpdateDB
End If
ElseIf Int(arSongRating) >= 10 Then
' Previously rated, reduce 0.5 Star
If Not dbTable.EOF Then
dbSong.Rating = Int(arSongRating)-10
dbSong.UpdateDB
End If
End If
Else
'---------------------------------------------------
' SONG DID PLAY, DO PLAYCOUNT RATING UPGRADE?
'---------------------------------------------------
StrQuery = "SELECT Count(Played.IdSong) AS arNoP "_
+ "FROM Played "_
+ "WHERE (((DateDiff(" & D_H & ",Now(),[Played].[Playdate])>=-" & CB_A & ")=True)) "_
+ "GROUP BY Played.IdSong "_
+ "HAVING Count(Played.IdSong) >0 AND Played.IdSong=" & arSongID
Dim dbCustomTable
Set dbCustomTable = SDB.Database.OpenSQL(StrQuery)
If Not dbCustomTable.EOF Then
dbPlayCount = Int(dbCustomTable.StringByName("arNoP"))
' PlayCountRating based on # of plays
If dbPlayCount <= PlaysRate_3_0_Stars Then
PlayCountRating = 60
ElseIf dbPlayCount <= PlaysRate_3_5_Stars Then
PlayCountRating = 70
ElseIf dbPlayCount <= PlaysRate_4_0_Stars Then
PlayCountRating = 80
ElseIf dbPlayCount <= PlaysRate_4_5_Stars Then
PlayCountRating = 90
Else
PlayCountRating = 100
End If
' Compare CurrentRating with PlayCountRating and upgrade
' only if PlayCountRating is larger than CurrentRating
If Int(PlayCountRating) > Int(arSongRating) Then
If Not dbTable.EOF Then
dbSong.Rating = Int(PlayCountRating)
If MakeNote Then dbSong.Custom2 = wDay & " " & TimeOfDay & " " & Season
dbSong.UpdateDB
End If
End If
End If
End If
'---------------------------------------------------
' RADIO ANNOUNCER
'---------------------------------------------------
If Announce Then
Dim Itm
Set Itm = SDB.Player.CurrentSong
SayThis = Itm.ArtistName & ". " & Itm.Title
ttsSpeak SayThis, 0, False
End If
End Sub
'---------------------------------------------------
' ALL DONE
'---------------------------------------------------
Sub WriteCurrentSongData
'
' Get data from the song currently playing
Dim Itm
Set Itm = SDB.Player.CurrentSong
' Prepare for doing File Stuff
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
' Location of file
DataFileLocation = SDB.ApplicationPath & "Scripts\AutoRateSongs.dat"
' Create the datafile
Dim DataFile
Set DataFile = fso.CreateTextFile(DataFileLocation, True)
' Write current song data to the datafile and close the file
DataFile.WriteLine Itm.ID & "@" & Now & "@" & Int(Itm.SongLength/1000)& "@" & Itm.Rating
DataFile.close
End Sub
Function Season()
'
'############## HEMISPHERE #################
'
dim ini
set ini = SDB.IniFile
NorthernHemisphere = ini.StringValue("AutoRateSongs", "NorthernHemisphere")
If NorthernHemisphere = "True" Then
NorthernHemisphere = True
Else NorthernHemisphere = False
End If
' NorthernHemisphere = True
'
'If Northern set this to True
'If Southern set this to False
'################## END ####################
'
wwNow = Int(DatePart("ww",Now))
If wwNow < 12 Then
If NorthernHemisphere Then Season = "Winter" else Season = "Summer"
ElseIf wwNow < 25 Then
If NorthernHemisphere then Season = "Spring" else Season = "Autumn"
ElseIf wwNow < 38 Then
If NorthernHemisphere then Season = "Summer" else Season = "Winter"
ElseIf wwNow < 51 Then
If NorthernHemisphere then Season = "Autumn" else Season = "Spring"
Else 'for those two weeks at the end of the year
If NorthernHemisphere then Season = "Winter" else Season = "Summer"
End If
End Function
Function TimeOfDay()
tNow = DatePart("h",Now)
If tNow < 6 Then
TimeOfDay = "night"
ElseIf tNow < 9 Then
TimeOfDay = "morning"
ElseIf tNow < 17 Then
TimeOfDay = "daytime"
ElseIf tNow < 19 Then
TimeOfDay = "dinner"
ElseIf tNow < 24 Then
TimeOfDay = "evening"
End If
End Function
Function wDay()
wDay = WeekdayName(Weekday(Now))
End Function
'Here's an other Gem from Master Steegy.
'I just love this watch fine coding like this!!
Function ttsSpeak(Text, VoiceNumber, Asynchronous)
Dim tts, speechFlag
On Error Resume Next
Set tts = Nothing
Set tts = CreateObject("Sapi.SpVoice")
If Not tts Is Nothing Then
If (VoiceNumber - 1) < tts.GetVoices.Count Then
Err.Clear
If VoiceNumber <> 0 Then Set tts.Voice = tts.GetVoices.Item(VoiceNumber - 1)
If Err.Number = 0 Then
If Asynchronous Then
speechFlag = 1
Else
speechFlag = 0
End If
tts.Speak Text, speechFlag
End If
End If
End If
End Function
'PlaysRate_4_5_Stars = 4 'default = 4 over 1 day 

Users browsing this forum: rrfpacker and 24 guests