Skip to main content
Topic: Long-time user, but with (possibly dumb) problem (regarding Time Sigs & Rests) (Read 10735 times) previous topic - next topic

Long-time user, but with (possibly dumb) problem (regarding Time Sigs & Rests)

I tried to search for the answer to this question but I'm simply out of time and frustrated and I'd just like an answer, because the answer is probably some simple thing that I'm overlooking:

I'm importing a MIDI file into Noteworthy.  Although the song itself is in 3/4 time, the import process brings it in at 4/4 time.  There are some rather large rests in some of the parts.
Whenever I try to switch the Time Signature to 3/4 time, all of the 4/4 rests that exist magically change into 3/4 rests... but that throws that entire track/staff out of whack.  While I AM indeed trying to change the Time Signature, I am attempting to re-align all of the notes, and don't want the Whole Rests to turn into Dotted Half Note rests, I want them to change into Whole Note Rests and then use Audit Bar Lines to move the bar lines to their appropriate spots.

So my question is: Can I change Time Signature without it messing up the Whole Rests?  I find this an incredibly annoying 'feature' and would love it if I can just disable it, but I cannot seem to find a toggle for it anywhere.

Re: Long-time user, but with (possibly dumb) problem (regarding Time Sigs & Rests)

Reply #1
My guess is that the MIDI file does not have a time signature.
If you like send me the file at btgraham@tpg.com.au
I'll add a time signature to the MIDI file.

Barry Graham

Re: Long-time user, but with (possibly dumb) problem (regarding Time Sigs & Rests)

Reply #2
See: Using MIDI files that lack Key and/or Time Signatures
So my question is: Can I change Time Signature without it messing up the Whole Rests?  I find this an incredibly annoying 'feature' and would love it if I can just disable it, but I cannot seem to find a toggle for it anywhere.
Short answer is no. IMO, this is not a bug. Understanding why I don't consider this a bug would require the long answer ...
Registered user since 1996

Re: Long-time user, but with (possibly dumb) problem (regarding Time Sigs & Rests)

Reply #3
Rick,
as I already explained in another thread, exactly like Jorge I find that behaviour very annoying.

Tired of having to adjust everything by hand, I was tempted to develop an user tool for that, then I finished modifying that score and my lazy temper prevailed...

Re: Long-time user, but with (possibly dumb) problem (regarding Time Sigs & Rests)

Reply #4
It should be up to the user, not up to the program, whether that behavior happens, though.
Something in the "Import Options" or something.  Something as easy as "Add/Change Time Signature".

I can edit the MIDI file as well, I just was hoping that I had just neglected an option on NWC2.

Re: Long-time user, but with (possibly dumb) problem (regarding Time Sigs & Rests)

Reply #5
I put this together from another page, save it with a name such as 1to4rest.htm then run it while NWC is open.  Select a staff, Cntl/X, paste it on the page, click Read, Cntl/C (or Cntl/X), and paste it back into the missing staff in NWC.
Code: [Select · Download]
<html>
<head>
<title>Replace whole rests with four quarter rest</title>
<script language="JavaScript">
function calculate() {
  
  var i, OutText = "";

    var cntNotes=0;
    var lines = new Array();
    lines = document.nwcform.OutputField.value.split("\n");
    for (i=0; i < lines.length; i++) {
  if (lines[i].slice(0,15) == "|Rest|Dur:Whole") {
   OutText += "|Rest|Dur:4th\n|Rest|Dur:4th\n|Rest|Dur:4th\n|Rest|Dur:4th\n"; }
 else
       { OutText += lines[i] + "\n"; }
     }

  document.nwcform.OutputField.value = OutText;

    document.nwcform.OutputField.select();
}
</script>
</head>
<body>
<form name="nwcform" onSubmit="calculate();return false;">
  <table width="782" height="350">
    <tr>
      <td colspan="4" width="1000" height="24">
        <b><big>Replace whole rests with four quarter rests</big></b>
      </td>

      <td height="27"  width="100"><input type="button" id="bClick2" value="Read" onclick="calculate(1)"></td>
      
    </tr>
    <tr>
    <td colspan=5 width="1044" height="200">
      <textarea name="OutputField" rows="16" cols="120"></textarea></td></tr>
  </table>
</form>
<br>
Copy the above to your clipboard and paste it into a song you have already open in <b>NoteWorthy Composer</b>.  If you have opened NWC
but haven't opened an existing song or created a new one, <b>Cntrl/Sh V</b>.&nbsp;

</body>
</html>

HTH
Since 1998

Re: Long-time user, but with (possibly dumb) problem (regarding Time Sigs & Rests)

Reply #6
Well, Warren, thank you.
It's not perfect but I think it covers an ample number of cases.

In my case, for example (https://forum.noteworthycomposer.com/?topic=7295.0), I had to change the time signature from 3/4 to 3/2 so I'd have needed a modified version which translate semibreve rests to 3 x 1/4 rests.
The good news is that the change to the code is very easy to do...

Re: Long-time user, but with (possibly dumb) problem (regarding Time Sigs & Rests)

Reply #7
You're welcome.  That web page was a "quick & dirty" done by taking a scalpel to my twelve-tone--still has an unneeded variable "cntNotes" which can be safely deleted.

About the only changes I have made to other user tools is to modify the literals in an echo command, but that assumes I have a script which does almost what I want it to do.  Having a working "if you find this, replace it with that" page might be helpful for a lot of users.
Since 1998

 

Re: Long-time user, but with (possibly dumb) problem (regarding Time Sigs & Rests)

Reply #8
Nice bit of code you've got there. :D
I need another one that does it for both rests and notes, as the tune happens to also have long running tying whole notes.

Thanks for this bit of code, much appreciated (though I still stress that the program shouldn't do this unless I wanted it to).

Re: Long-time user, but with (possibly dumb) problem (regarding Time Sigs & Rests)

Reply #9
Nice bit of code you've got there. :D
I need another one that does it for both rests and notes, as the tune happens to also have long running tying whole notes.
This version will change whole rests, notes, and chords.  It inserts ties on the objects it produces while only changing the duration of the original.
Replace the calculate function with the following:
Code: [Select · Download]
function calculate() {
  
  var i, j, OutText = "", tempstr, postab;
  var lines = new Array(), result = new Array();
  lines = document.nwcform.OutputField.value.split("\n");
  for (i=0; i < lines.length; i++) {
    lines[i] = lines[i].replace(/[\t\r\f\v]/g,"");   //So will run in IE
if (lines[i].slice(0,15) == "|Rest|Dur:Whole") {  //In case your browser puts extra characters at the end, slice ignores them.
 OutText += "|Rest|Dur:4th\n|Rest|Dur:4th\n|Rest|Dur:4th\n|Rest|Dur:4th\n"; } //Ends with \n.  This examples adds 4 lines.
else {
 result = lines[i].match(/^\|(Note|Chord)\|Dur:Whole(\|Pos:)(.*)$/)
//  result = lines[i].match(/^(\|Note\|Dur:)Whole(\|Pos:)(.*)$/)

 if (result != null) {
   postab = result[3];
postab = postab.replace(/,/g,"^,"); //Add a carat before each comma (if any--none for a note)
postab += "^";  // and at the end
postab = postab.replace(/\^\^/g,"^")  //Replace two carots with just one
        tempstr= "|" + result[1] + "|Dur:4th" + result[2] + postab + "\n";
for (j = 0; j < 3; j++) {  //Adds 1st three occurances with ties on all note(s)
 OutText += tempstr; }
OutText +=  "|" + result[1] + "|Dur:4th"  + result[2] + result[3] + "\n";  }  //Last note in set as is, only changing duration
 else {
OutText += lines[i];
   if ((i+1) < lines.length)    //No need to add a newline character to last line
     OutText += "\n";   }
  }
}
  document.nwcform.OutputField.value = OutText;  //Replaces original data with what was created in OutText
  document.nwcform.OutputField.select();   //Output is pre-selected, just Cntl/C to put on clipboard
}
Addendum: This assumes nothing has been done to any object since importing from midi: no slurs, colors, visibility, or any other attribute changes.
Since 1998

Re: Long-time user, but with (possibly dumb) problem (regarding Time Sigs & Rests)

Reply #10
Quote
//Add a carat before each comma

Quote
//Replace two carots with just one

Chomp, chomp... Eh, What's up, Doc? :-)

Re: Long-time user, but with (possibly dumb) problem (regarding Time Sigs & Rests)

Reply #11
When I save that chunk of code as a .htm file, it does not open well like the other version did. :(

Re: Long-time user, but with (possibly dumb) problem (regarding Time Sigs & Rests)

Reply #12
When I save that chunk of code as a .htm file, it does not open well like the other version did. :(
Did you start with my text in post 5 replacing the entire function with what I had in post 9?  There should be only one function calculate() and all { } (and brackets [] and parenthesis ()) must match.

You can also save it as a file type of .hta and starting it won't require all the baggage a browser brings.
Since 1998

Re: Long-time user, but with (possibly dumb) problem (regarding Time Sigs & Rests)

Reply #13
Ok, now I did it right.
Now I've got a little webpage that I can copy/paste the stuff into if I want it properly separated.  Thanks!

Re: Long-time user, but with (possibly dumb) problem (regarding Time Sigs & Rests)

Reply #14
You're welcome.  Glad you got it to work.
Since 1998