Skip to main content
Topic: Sforzando Implementation (Read 5783 times) previous topic - next topic

Sforzando Implementation

Code: [Select · Download]
Option Explicit
Dim StdErr, StdIn, StdOut, LineIn, Look, Matches, Match, Head

'Name:    Insert Sforzando
'Command: wscript scripts\Sforzando.vbs

Set StdErr = WScript.StdErr
Set StdIn = WScript.StdIn
Set StdOut = WScript.StdOut
Set Look = New RegExp
Look.Global = True
Look.IgnoreCase = True

While Not StdIn.AtEndOfStream
  LineIn = StdIn.ReadLine
  Look.Pattern = "^\|Note|^\|Chord|^\|RestChord"
  If Look.Test(LineIn) Then
    StdOut.WriteLine "|Marker|Target:Articulation|Visibility:Never"
    StdOut.WriteLine "|DynamicVariance|Style:Sforzando|Justify:Center|Placement:AtNextNote"
    If Instr(LineIn, "Accent") = 0 Then
      Look.Pattern = "(Dur[^\|]+)"
      Set Matches = Look.Execute(LineIn)
      Set Match = Matches.Item(Matches.Count - 1) 'the last one
      Head = Match.FirstIndex + Match.Length
      LineIn = Left(LineIn, Head) & ",Accent" & Right(LineIn, Len(LineIn) - Head)
    End If
  End If
  StdOut.WriteLine LineIn
Wend

This inserts a sforzando mark and accents the note and hides the accent with an invisible marker.

There's one problem though. If you manually insert a dynamic variance it inherits visibility and position from the previous one. Inserting one with a user tool doesn't.

Re: Sforzando Implementation

Reply #1
Hi everybody,

I'm afraid I have a stupid question to ask: can you tell me where I can find a description HOW to install user tools like the the one above?
I have been looking now for quite a time, and I'm afraid I'm not smart enough to figure out how it works...

I suppose I'll have to copy the programming code above - but where should I paste it? I would the glad to get some help... :-)



Re: Sforzando Implementation

Reply #3
Thanks for the links! :-)

Re: Sforzando Implementation

Reply #4
I'm sorry to have to ask again - but I still don't get it.

I downloaded the User Tool Starter Kit, and I understand now how to install new user tools based on a php-file. So far, thanks for the links! Unfortunately I did not learn from them what to do with the code presented above.

I tried to paste it into the command line when creating a new user tool, but that didn't work (I wasn't able to paste the code, all that appeared was: "Option explecit")

Can someone tll me what I do wrong? Thanks in advance...

 

Re: Sforzando Implementation

Reply #5
I did not learn from them what to do with the code presented above.
I tried to paste it into the command line when creating a new user tool, but that didn't work
Copy the code.
Paste it into NotePad.
Save the NotePad contents as a file to your Scripts folder as: Sforzando.vbs
Registered user since 1996