Page 1 of 6

Silence Between Songs v3.0 [MM3] updated 2010-12-26

Posted: Wed Sep 16, 2009 9:20 pm
by Eyal
Silence Between Songs v2.2 [MM3]

This script will add a silence gap between songs when playing through MediaMonkey's built-in player.
It does not modify files in any way. It can be enabled or disabled, and gap length can be set from 1 to 15 seconds.

When enabled, it disables crossfade and saves its state.
When disabled, crossfade state is restored.

Use the Play menu to enable/disable:

Image


Use Tools|Options|Player to configure:

Image

-> To prevent songs from ending prematurely, disable "Remove silence" in MM Output plugin:
  • - Tools > Options > Player > Output Plugins -> MediaMonkey DirectSound output > Configure
    - Disable: [ ] "Remove silence at beginning / end of track"
(Ref.: http://mediamonkey.com/forum/viewtopic.php?f=1&t=53973 )


Note to owner of MediaMonkey 4.x :
Apply the bug fix listed here: viewtopic.php?p=330768#p330768


________________________________________________________________
New in version 3.0 - Automatic skip for tracks that should not be delayed :

How it works:
  • Info specifying "Gapless Track" must previously be entered (in one of 5 Custom Fields) for each track you don't want a delay at the end.
  • You set in the options which Custom Field and what value to use.
  • The value can be anything you like (minimum 1 character/digit) and can be position anywhere in the field. For example, you could append it to the end of Custom3 field, and still use TiedSongsGroups script (which also uses Custom3) without needing to use an additional custom field.
  • The script checks this info when track starts playing, to minimize processing time when the track ends.
Tagging the gapless tracks should be easy and straightforward to do. Select all tracks (except last one) of a gapless album and set Properties at once.

-> Useful script to append/prepend data to any field: viewtopic.php?f=2&t=36013
________________________________________________________________


System Requirement: V1.0 of the script requires MM 3.1.0.1218 or newer to work. V2.x requires MM 3.1.2 or newer.

Download the script installation package below, then run the .mmip file to install it in MediaMonkey.
Vista/Win7 users need to install it with administrative rights (see here).

History:
-----------
2010-12-26 - v3.0 *NEW* - Now can automatically skip the delay on gapless tracks.
2010-05-01 - v2.2 by Eyal. Tweak to stop playing after Shuffle has played all tracks when Repeat is off.
2010-04-29 - v2.1 by Onno Tabak. Code enhanced to take care of Repeat and Shuffle. If pressed PLAY during the gap, next song is started immediately.
2010-04-21 - v2.0 by Onno Tabak, with a small part of Gap.vbs by Soren Werk. Code use StopAfterCurrent and triggers a silence gap.
2009-09-17 - v1.0 by Eyal. Code uses loops to pause after playing song.

-------------------
Download
2010-12-26 - V3.0
Via MediaFire : http://www.mediafire.com/file/31ljlya6f ... ngs30.mmip
Via FileFactory: http://www.filefactory.com/file/b4d4f60 ... ngs30.mmip

2010-05-01 - V2.2
Via MediaFire : http://www.mediafire.com/file/ziemzaj5z ... ngs22.mmip
Via DataFileHost: http://www.datafilehost.com/download-645fd006.html

2009-09-16 - V1.0
Via MediaFire : http://www.mediafire.com/file/nmzjb2zym ... ngs10.mmip



Eyal :~)

Re: Silence Between Songs v1.0 [MM3]

Posted: Wed Sep 16, 2009 11:07 pm
by dypsis
Thanks mate...

By the way. What skin is that?

Re: Silence Between Songs v1.0 [MM3]

Posted: Thu Sep 17, 2009 5:11 am
by Eyal
It's Helium BL.

Re: Silence Between Songs v1.0 [MM3]

Posted: Wed Nov 18, 2009 10:39 am
by HRF
Just what I needed. Thanks.

Re: Silence Between Songs v1.0 [MM3]

Posted: Wed Nov 18, 2009 12:42 pm
by Bex
Nice and clean script. Well done, Eyal! :)

Re: Silence Between Songs v1.0 [MM3]

Posted: Thu Nov 19, 2009 5:38 pm
by Eyal
Thank you! :)

Re: Silence Between Songs v1.0 [MM3]

Posted: Sat Dec 26, 2009 10:22 am
by btbuz
It took me a while to get back to the forum and find your gift. It's the best Christmas present I received. Thank you so much for your script. One suggestion, for dummies like me you might include instructions for installation. I had to do a search to find out what to do with the file. But I found it and it worked like a champ.
God Bless you, :D :D :D

Re: Silence Between Songs v1.0 [MM3]

Posted: Mon Jan 11, 2010 1:14 pm
by yacoubean
Perfect dude, just what I was looking for.

Re: Silence Between Songs v1.0 [MM3]

Posted: Sat Jan 23, 2010 5:53 pm
by lindsaydbarron
Great stuff, many thanks, Lindsay

Re: Silence Between Songs v1.0 [MM3]

Posted: Mon Jan 25, 2010 6:40 am
by marcela
i just saw this page and i want to download silencebetweensongs but i press the link and nothing happens, please help

Re: Silence Between Songs v1.0 [MM3]

Posted: Mon Jan 25, 2010 4:27 pm
by Eyal
I added a link to DataFileHost, in case you can't download the file from MediaFire.
Please see first post.

Thanks.

Re: Silence Between Songs v1.0 [MM3]

Posted: Tue Jan 26, 2010 4:56 am
by marcela
Thank you so much. I am studying language and in the audio words i need time between them to repeat them and learn. I was so anxious to find something like this. This is just perfect. THANK YOU!!!! :D

Re: Silence Between Songs v1.0 [MM3]

Posted: Wed Apr 21, 2010 4:59 pm
by onnotabak
The first solution I found was gap.vbs at http://www.mediamonkey.com/forum/viewto ... 4&start=15
After a an almost complete rewrite of that script I found this one with configurable options.

It ran into the same problems I had while testing and rewriting the other script. At the start of the next song a couple of seconds was repeated.
Probably a problem with the buffer. Other output plugins didn't help. So I started merging the two scripts.
I found the solution in making sure that the song was stopped at the end, which triggered a silence gap before starting the next song.
I hope this is usefull to somebody.

Code: Select all

' Gap / Silence Between Songs script v2.0
' By Eyal, 2009.09.16
' By Onno Tabak 2010-04-21 with a small part of Gap.vbs by Soren Werk
'
' This script adds an entry in Play menu that let you
' enable/disable a silence time between playing songs.
' Delay time is configurable through Options|Player|SBS.
' Requires MediaMonkey 3.1.0.1218 or newer.
'
' Location: MediaMonkey\Scripts\Auto\SilenceBetweenSongs.vbs
'------------------
Option Explicit

'Set Silence Time in seconds (default = 5):
Dim SilenceTime : SilenceTime = 5
Dim SilenceEnabled : SilenceEnabled = True
Dim GapProgress
Dim GapTimer

Dim AppTitle : AppTitle = "SilenceBetweenSongs"
Dim Version : Version = "2.0"
Dim MenuItem

'------------------
Sub OnStartup
  InitButton
  SilenceBetweenSongs
  InitTimer
End Sub  

Sub InitButton()  
	SDB.IniFile.StringValue(AppTitle,"Version") = Version   '"2.0"

    If Not SDB.IniFile.ValueExists(AppTitle,"Enabled") Then
    	SDB.IniFile.BoolValue(AppTitle,"Enabled") = SilenceEnabled
    End If

    If Not SDB.IniFile.ValueExists(AppTitle,"SilenceTime") Then
    	SDB.IniFile.StringValue(AppTitle,"SilenceTime") = SilenceTime
    End If

    If Not SDB.IniFile.ValueExists(AppTitle,"CrossfadeState") Then
    	SDB.IniFile.BoolValue(AppTitle,"CrossfadeState") = SDB.Player.IsCrossfade
    End If

    SilenceTime = SDB.IniFile.StringValue(AppTitle,"SilenceTime")
    SilenceEnabled = SDB.IniFile.BoolValue(AppTitle,"Enabled")

	Set MenuItem = SDB.UI.AddMenuItem(SDB.UI.Menu_Play,4,2)
    MenuItem.Caption = "Silence between songs"
	Script.RegisterEvent MenuItem, "OnClick", "ToggleSilence"
    MenuItem.Visible = True
	MenuItem.Checked = SilenceEnabled
	
    ' Child of [Player] in the options:
    SDB.UI.AddOptionSheet "Silence between songs", Script.ScriptPath, "InitSheet", "SaveSheet", -2
End Sub

'------------------
Sub ToggleSilence(p)
    SilenceEnabled = Not SilenceEnabled
    MenuItem.Checked = SilenceEnabled
    SDB.IniFile.BoolValue(AppTitle,"Enabled") = SilenceEnabled

    If SilenceEnabled then
        SDB.IniFile.BoolValue(AppTitle,"CrossfadeState") = SDB.Player.IsCrossfade
        SDB.Player.IsCrossfade = False
    Else
        SDB.Player.IsCrossfade = SDB.IniFile.BoolValue(AppTitle,"CrossfadeState")
    End If
    SilenceBetweenSongs    
End Sub

Sub SilenceBetweenSongs
    If SilenceEnabled Then
       Script.RegisterEvent SDB, "OnPlay", "PlayerOnPlay" 
       Script.RegisterEvent SDB, "OnTrackEnd", "PlayerTrackEnd"
    Else
        Script.UnregisterEvents SDB
        SDB.Player.StopAfterCurrent = False
    End If
End Sub

'------------------
Sub InitTimer()
  Set GapTimer = SDB.CreateTimer(1000)
  GapTimer.Enabled = False
  Script.RegisterEvent GapTimer, "OnTimer", "GapOnTimer"
End Sub

'------------------
Sub PlayerOnPlay()
  If SilenceEnabled Then
    SDB.Player.StopAfterCurrent = True
  End If
  If  GapTimer.Enabled = True Then  
    GapTimer.Enabled = False
    Set GapProgress = Nothing
  End If
End Sub

'-----------------------
Sub PlayerTrackEnd()
  If SilenceEnabled and SDB.Player.CurrentSongIndex+1 < SDB.Player.PlayListCount Then
    Set GapProgress = SDB.Progress
    GapProgress.MaxValue = SilenceTime
    GapProgress.Text="Gap " & SilenceTime & " seconds."
    GapTimer.Enabled = True
  Else
    GapTimer.Enabled = False
    Set GapProgress = Nothing
  End If
End Sub

Sub GapOnTimer(Timer)
  If GapTimer.Enabled = True Then
    GapProgress.Increase
    GapProgress.Text="Gap " & SilenceTime - GapProgress.Value & " seconds."
  End If
  If GapProgress.Value >= GapProgress.MaxValue Then
    SDB.Player.Next
    SDB.Player.Play  
    GapTimer.Enabled = False
    Set GapProgress = Nothing
  End If
End Sub

'---------------------
Sub InitSheet(Sheet)
	Dim oPanel1, oCheck1, oSpin1

	With SDB.UI.NewLabel(Sheet)
		.Common.Left = 460
		.Common.Top = 5
		.Caption = "v" & Version
	End With
	
	With SDB.UI.NewLabel(Sheet)
		.Alignment = 2    'Center
		.Common.SetRect 100,30,100,40
		.Caption = "Adds silence between playing songs." & vbcrlf & _
                   "Can also be enabled/disabled through Play menu."
	End With

	Set oPanel1 = SDB.UI.NewGroupBox(Sheet)
	oPanel1.Common.SetRect 100,80,240,100
	oPanel1.Caption = "Delay between songs"

	Set oCheck1 = SDB.UI.NewCheckBox(oPanel1)
	With oCheck1
        .Caption = "Enable"
    	.Common.Left = 25
    	.Common.Top = 25
    	.Common.ControlName = "ChEnable"
        .Checked = SilenceEnabled
    End With
    
     Set oSpin1 = SDB.UI.NewSpinEdit(oPanel1)
     With oSpin1
         .Common.Left = 25
         .Common.Top = 55
         .Common.Width = 45
         .MinValue = 1
         .MaxValue = 15
         .Common.ControlName = "EdLength"
         .Value = SilenceTime
     End With

    With SDB.UI.NewLabel(oPanel1)
        .caption = "second(s)"
        .Common.Left = 80
        .Common.Top = 58
    End With
    
End Sub


'---------------------
Sub SaveSheet(Sheet)
 	Dim v

    Set v = Sheet.Common.ChildControl("ChEnable")
    If v.Checked <> SilenceEnabled then
        ToggleSilence 0
    End If

    'SDB.IniFile.BoolValue(AppTitle,"Enabled") = SilenceEnabled         'Not necessary
    SilenceTime = Sheet.Common.ChildControl("EdLength").Value
    SDB.IniFile.StringValue(AppTitle,"SilenceTime") = SilenceTime
End Sub

Re: Silence Between Songs v1.0 [MM3]

Posted: Sat Apr 24, 2010 12:49 pm
by Eyal
Thank you onnotabak, it's working.

The only drawback is that this code doesn't take into consideration when Shuffle and/or Repeat is ON.
It stops playing after last track of NowPlaying list has been played.
onnotabak wrote:At the start of the next song a couple of seconds was repeated.
I'm not sure about it, but I think it's caused by some DSPs buffer.
Further investigation...

:~)

Re: Silence Between Songs v1.0 [MM3]

Posted: Tue Apr 27, 2010 12:20 pm
by dsgoen
I get an Product Installation Error with this script. MediaMonkey Version 3.2.0.1294.

It does show up in the Extensions pane, but nothing displays in the Options pane.

Any suggestions? I really need this function for classical music.

David