Skip to main content

Topics

This section allows you to view all Topics made by this member. Note that you can only see Topics made in areas you currently have access to.

Topics - jdorocak

1
General Discussion / In a repeated section, how can I make Sop. & Alto sound first time & T,B 2nd?
Dear NWC Forum,

I have a song i am helping my choir with. In a repeated section, the publisher made a note saying, first time through Sop. & Alto sing, 2nd time through, T & B. Here is the form of the staves:

S: <begin><MasterRtpOpen>S<1stOnly>S<AllVoicesSingCommonHere><MasterRtpClose><MoreSong>
A: <begin><MasterRepOpen>A<1stOnly>A<AllVoicesSingCommonHere><MasterRtpClose><MoreSong>
T: <begin><MasterRepOpen>T<2ndOnly>T<AllVoicesSingCommonHere><MasterRtpClose><MoreSong>
B: <begin><MasterRptOpen>B<2ndOnly>B<AllVoicesSingCommonHere><MasterRtpClose><MoreSong>

I have made many attempts using special endings. No luck.

I'd like to keep the publisher's measure numbers intact so my choir can tell me if I made any mistakes.

Does anyone have any ideas?

Thanks for the help in advance.

Love and peace,

Joe
 
2
User Tools / Python NWC tool to reverse selected notes in a staff.
Here’s the python code. Enjoy. :)

This code needs to import  nwctxt.py see https://github.com/nwsw/nwc2ut-python

Love and peace,
Joe

Code: [Select · Download]
"""joeSelReverse.py Reverses the Notes that are selected in a NoteWorthy Composer staff
 
see:
    https://github.com/nwsw/nwc2ut-python    
"""
 
import sys
# import joeNWCtxtInPythonNew as nwctxt
import nwctxt # see https://github.com/nwsw/nwc2ut-python
import logging
logging.basicConfig(filename='joeNWC_PY.log',level=logging.DEBUG)  # DEBUG => print ALL msgs
 
clip = nwctxt.NWC2Clip()
PlayContext = nwctxt.NWC2PlayContext()
txtItemL = clip.Items
clipItemL = [nwctxt.NWC2ClipItem(txtItem) for txtItem in txtItemL]
first2 = clipItemL[:2]
reversedClipItemL = first2 + list(reversed(clipItemL[2:]))
reversedTextItemL = [item.ReconstructClipText() for item in reversedClipItemL]
 
print clip.GetClipHeader()
for textItem in reversedTextItemL[2:]:
    #print "clipItem.GetObjType()= %s, type(clipItem.GetObjType())= %s, "%(clipItem.GetObjType(), type(clipItem.GetObjType()))
    print textItem
print clip.GetClipFooter()
 
 
# TO DEBUG uncomment below to report to NWC STDOUT DIALOG & to CAUSE NO STAFF MODIFICATION
# sys.exit(nwctxt.NWC2RC_REPORT)
3
User Tools / May I please have some help with creating a Python NWC User Tool?
Dear NWC Forum,

Thanks for being a great place to share info. I am trying to write my first User Tool. It will be in Python. It is very simple. It copies a clip to a file.

I am using NWC 2.5.5 & have installed version 2.5 of the NWC2 User Tool Starter Kit.
Here's some system info from About Starter Kit:
System => Windows NT cmptrName 5.1 build 2600 (Windows XP Professional Service Pack 3) i586
Build Date => Sep 17 2009 19:13:11
Compiler => MSVC9 (Visual C++ 2008)
Architecture => x86
Configure Command => cscript /nologo configure.js  "--disable-all" "--enable-cli" "--enable-zlib"
Server API => Command Line Interface


Here is my simple Python program to copy a clip to a file:
import sys
instr = sys.stdin.read()
f = open('joesFirstTestOut.txt', 'w'); f.write(instr); f.close()


When I run it from a windows prompt, it works :
C:\...Scripts>python joesFirst.py<joesFirstTestIn.txt


When I run it from a NWC User Tool, there is NO CHANGE in joesFirstTestOut.txt.

My User Tool Description Dialog has been set with 2 alternatives with the same results as above:
Alt-1
group: joe
name: joesFirst.py
command: python scripts\joesFirst.py
input type: clip text
options:
    compress input:         [ ]
    returns file text:      [ ]
    long task handling:     [ ]
    prompts for user input: [ ]

Alt-2
group: joe
name: joesFirst.py
command: python scripts\joesFirst.py
input type: clip text
options:
    compress input:         [ ]
    returns file text:      [ ]
    long task handling:     [X]
    prompts for user input: [ ]

        
Does anyone have any suggestions?
Thanks in advance.
Love and peace,
Joe
4
Instrument Trees / Using Instrument Trees
Dear NWC Forum,

I am using NWC 2.5.5.

Recently i was trying to get a staff to sound like a harp. Because of my dyslexia, i missed seeing the predefined instrument Orchestral Harp in the String section of the Default Instrument Tree. So i clicked Change List and looked in the Classic Instrument Tree.

I didn't see harp in the General MIDI section. Neither did i see it in the Roland GS section. Finally I found Harp-1 in the MT-32 section and chose it as the Instrument for the staff. However, when i played the notes on the staff they sounded like a trumpet.

Here's my question. What else do i have to do to get the staff to sound like a harp using the Harp-1 voice in the MT-32 section of the Classic Instrument Tree? [I have already discovered and used the Orchestral Harp in the String section of the Default Instrument Tree, but I want to know what the steps are to enable the MT-32 voices and other voices in other Instrument Trees.]

Thanks in advance.

Love and peace,

Joe
5
User Tools / Convert (from nwctxt to xml) and back (from xml to nwctxt)
I have written two Python 3 programs:
  1. nwctxt2xml.py  - Converts nwctxt into XML
  2. xml2nwctxt.py  - Converts XML into nwctxt

I have done about a dozen "round trip" tests. All results ran OK. Here is a round trip test:
  1. nwctxt2xml.py converts mySong.nwctxt to mySong.xml
  2. xml2nwctxt.py converts mySong.xml to mySong-out.nwctxt
  3. If fileCompare (mySong.nwctxt, mySong-out.nwctxt) = "files are identical"  -> OK

Having said that, these programs are distributed in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. They are subject to the GNU General Public License 3. See each source code listing.

You can download a zip distribution file at https://sourceforge.net/projects/rtcnwctxt-xml/

The zip distribution contains 4 files:
  0. readme.txt    
  1. nwctxt2xml.py  - Converts nwctxt into XML - Python 3.1 source code
  2. xml2nwctxt.py  - Converts XML into nwctxt - Python 3.1 source code
  4. GPL-3.txt         - GNU GENERAL PUBLIC LICENSE Version 3 details

Contact me at JoeCodeswell@gmail.com

All the best,

Joe

PROGRAM DOC BRIEFS

1. nwctxt2xml.py

  Copyright © 2009 Joe Dorocak (JoeCodeswell@gmail.com)
  Subject to GNU General Public License 3 (see source code listing)
  
nwctxt2xml.py converts nwctxt into XML

Requires: Python 3.1+
Usage:   nwctxt2xml.py infile.nwctxt outfile.xml
Example: nwctxt2xml.py mySong.nwctxt mySong.xml


nwctxt2xml.py Converts
  From: nwctxt format
  To:   Joe Dorocak's xml format. See below for XML structure:
    <jNoteWorthyComposer>
      <SongInfo></SongInfo>
      <PgSetup></PgSetup>
      <jFonts><Font></Font></jFonts>
      <PgMargins></PgMargins>
      <jStaves>
        <jStaff>
          <AddStaff></AddStaff>
          <StaffProperties></StaffProperties>
          <StaffInstrument></StaffInstrument>
          <Clef></Clef>  
          <Key></Key>
          <Tempo></Tempo>    
          <Note></Note>    
          <Chord></Chord>    
          <Bar></Bar>            
        </jStaff>            
      </jStaves>
    </jNoteWorthyComposer>
  
  Note: The xml elements <jFonts>, <jStaves> and <jStaff> were added to those
          elements directly derived from the nwctxt format.

      
2. xml2nwctxt.py

  Copyright © 2009 Joe Dorocak (JoeCodeswell@gmail.com)
  Subject to GNU General Public License 3 (see source code listing)

xml2nwctxt.py converts XML into nwctxt

Requires: Python 3.1+
Usage:   xml2nwctxt.py infile.xml outfile.nwctxt
Example: xml2nwctxt.py mySong.xml mySong.nwctxt


xml2nwctxt.py Converts
  To:     nwctxt format
  From:   Joe Dorocak's xml format. See below for XML structure:
    <jNoteWorthyComposer>
      <SongInfo></SongInfo>
      <PgSetup></PgSetup>
      <jFonts><Font></Font></jFonts>
      <PgMargins></PgMargins>
      <jStaves>
        <jStaff>
          <AddStaff></AddStaff>
          <StaffProperties></StaffProperties>
          <StaffInstrument></StaffInstrument>
          <Clef></Clef>  
          <Key></Key>
          <Tempo></Tempo>    
          <Note></Note>    
          <Chord></Chord>    
          <Bar></Bar>            
        </jStaff>            
      </jStaves>
    </jNoteWorthyComposer>

    Note: The xml elements <jFonts>, <jStaves> and <jStaff> were added to those
            elements directly derived from the nwctxt format.

6
User Tools / What is the character encoding of .nwctxt files?
Hi Folks,

I'm trying to make a Python based nwctxt2xml.py & xml2nwctxt.py set of programs for NWC2. I have been reasonably successful so far, but in doing more extensive round trip testing, I see problems with characters like 'é' and 'ä'. So what is the character encoding for .nwctxt files? Is it UTF-8, UTF-16, iso8859-1, iso8859-2, ..., ? Thanks for the help in advance.

All the best.

Joe :)
7
User Tools / nwcPythonTxt to xml converter
Here is a Python script I wrote after reading NWC Virtuoso, kahman's post:
Python NWCTXT parser - https://forum.noteworthycomposer.com/?topic=6097.0
My script converts kahman's Python List/Dictionary output to XML. I did it so that I could study the structure of an nwctxt file using a data folding text editor. The XML structure is my own home grown version based on what I inferred from kahman's Python Data Structure. I have done minimal testing so use it with caution. Please let me know what you think. Please post any additions here. You can use this script as you like. Here is the code:

Code: [Select · Download]
"""
nwcPy2nwcXml.py Translates
FROM: nwcPythonListDictFormat (kahman's nwctxt to python converter pyNWC-a output)
TO: jdorocak's homegrown xml (So I can use data folding in a text editor.) :)

Usage:   nwcPy2nwcXml.py infileName  outfileName
Example: nwcPy2nwcXml.py mySong.py   mySong.xml
Author:  Joe Dorocak
License: Use this as you please. :)
         Use with caution - I have done minimal testing. No warranty is implied. :)
"""

class ConvertToXML():
    """
    Converts
        FROM: nwcPythonListDictFormat (NWC Virtuoso kahman's nwctxt to python converter pyNWC-a output)
        TO: jdorocak's homegrown xml (So I can use data folding in a text editor.) :)
    rs == resultString; il == indentationLevel; aprs(il,str) == appendToResultString(indentationLevel,strToAppend)
    data == string output of kahman's nwctxt to python converter
    ix == index of current pythonListDict item;
    joe's xml syntax for nwctxtPy files inferred from analysis of data (i added elements named j*):

    <jNwctxtPy>
        <SongInfo count=1></SongInfo>
        <PgSetup count=1></PgSetup>
        <jFonts><Font count=12></Font></jFonts>
        <PgMargins count=1></PgMargins>
        <jStaves>
            <jStaff>
                <AddStaff count=1></AddStaff>
                <StaffProperties count=2></StaffProperties>
                <StaffInstrument count=1></StaffInstrument>
                <Clef count=n></Clef> 
                <Key count=n></Key>
                <Tempo count=n></Tempo>
                <Note count=n></Note>
                <Chord count=n></Chord>
                <Bar count=n></Bar>
            </jStaff>
    </jStaves>
    </jNwctxtPy>
    """
    def __init__(self, indata):
        """
        data == data to be converted.  FROM: nwcPythonListDictFormat (kahman's nwctxt to python converter pyNWC-a output)
        rs == resultString; converted data jdorocak's homegrown xml (So I can use data folding in a text editor.) :)
        """
        self.data = eval(indata)
        self.data.append(['End', {'Joe': 'End', 'Pos': 'Whatever'}])
        self.rs = ''         

    def toxml(self):
        self.aprs(0,'<jNwctxtPy>')


        #SongInfo
        self.aprs(1,'<SongInfo count=1>')
        ix = 0
        print len(self.data)
        for k,v in self.data[ix][1].iteritems():
            self.aprs (2,'<' + k + '>' + str(v) + '</' + k + '>')
        self.aprs (1,'</SongInfo>')

        #PgSetup
        self.aprs (1,'<PgSetup count=1>')
        ix = 1
        for k,v in self.data[ix][1].iteritems():
            self.aprs (2,'<' + k + '>' + str(v) + '</' + k + '>'   )
        self.aprs (1,'</PgSetup>')

        #Fonts
        self.aprs (1,'<jFonts>')
        for ix in range(2,14):
            self.aprs (2,'<Font count=12>')
            for k,v in self.data[ix][1].iteritems():
                self.aprs (3,'<' + k + '>' + str(v) + '</' + k + '>'   )
            self.aprs (2,'</Font>')
        self.aprs (1,'</jFonts>')

        #PgMargins
        self.aprs (1,'<PgSetup count=1>')
        ix = 15
        for k,v in self.data[ix][1].iteritems():
            self.aprs (2,'<' + k + '>' + str(v) + '</' + k + '>'   )
        self.aprs (1,'</PgSetup>')



        self.aprs (1,'<jStaves>')
        self.aprs (2,'<jStaff>')
        #AddStaff
        ix = 16
        for ix in range(ix,len(self.data)-1):
            #if self.data[ix+1][0] == 'AddStaff': self.aprs (2,'<jStaff>')    #ix+1 needed to add ['End',{'Joe':'whatever'}]
            self.aprs (3,'<'+ self.data[ix][0] +'>')
            for k,v in self.data[ix][1].iteritems():
                self.aprs (4,'<' + k + '>' + str(v) + '</' + k + '>'   )
            self.aprs (3,'</'+ self.data[ix][0] +'>')
            if self.data[ix+1][0] == 'AddStaff': #ix+1 needed to add ['End',{'Joe':'whatever'}]
                self.aprs (2,'</jStaff>')  
                self.aprs (2,'<jStaff>')

        self.aprs (2,'</jStaff>')
        self.aprs (1,'</jStaves>')


        self.aprs(0,'</jNwctxtPy>')
        return self.rs

    def aprs(self, il, strToAppend):
        """aprs(il,str) == appendToResultString(indentationLevel,strToAppend)"""
        self.rs = ''.join([self.rs, il*2*' '+strToAppend+'\n'])
        #print il*2*' '+strToAppend
   

import sys

N_ARGS = 2 

def main(argv=None):
    if argv == None: argv=sys.argv
    args = argv[1:]  #NOTE: args[0] != argv[0] == <full path to example.py>
    if len(args) != N_ARGS or "-h" in args or "--help" in args:
        print __doc__
        sys.exit(2)

    f = open(args[0], 'r'); s = f.read(); f.close()          # get the input file into s
    cx = ConvertToXML(s)                                     # make a new converter for s
    sXml = cx.toxml()                                        # translate s into sXml
    f = open(args[1], 'w'); f.write(sXml); f.close()    # write str(s2) into the output file
    print 'Translated ' + str(args[0]) + ' yielding ' + str(args[1])


if __name__ == '__main__':
    sys.exit(main())


I have posted the addition I did to kahman's code to save his output in a file, at his post: https://forum.noteworthycomposer.com/?topic=6097.0


All the best. :)
Joe
8
User Tools / Must a User Tool act only on a single staff?
I'm a newbie to NWC User Tools. I'd like to know if I can write a User Tool to do things to more than one staff. For example, I have used VB and SendKeys to copy a set of bars in NWC Window-1, and append it to all the staves in Window-2.

Is the entire NWC object model (Windows, Stave collection, MIDI settings, etc.) exposed to the User Tools interface? Thanks in advance.

Joe D
:)