Skip to main content
Topic: Create chords from a single note. (Read 51229 times) previous topic - next topic

Create chords from a single note.

G'day all,
I have attached a pair of user tools that have been designed to create chord structures from single notes. 

First a small caveat:
I haven't written line of code of any kind for, oh easily 15 years, and even then it was 4gl stuff - Database specific mainly, aside from the odd batch file that is, so I do not consider myself a programmer of _ANY_ kind.  OK?  In fact I've never even looked at VB or WScript before so this has been something of a "crash course" - and me a network integrator too!  Thus there are probably some very naive constructs that the real programmers out there may frown upon.  Please feel free to educate me.

These tools do not understand what clef or key signature you are using, they are a purely interval oriented thing.

They have been "growing" in the NG for a couple of weeks and there are many refinements courtesy of RickG, but note that any and all mistakes are mine, not his :). - Thanks mate.

The scripts are heavily commented, primarily for my own benefit so they may not be very pretty.  I've tried to format them a little but as I've been reminded, different editors and different font selections in the editor may make them look pretty crook.  I created them in notepad using Arial and with word wrap turned off.  Do this and you'll see 'em as I do.

The tools  are:
MakeChord-SpecifyAccidental-LP.vbs and MakeChord-AdditiveAccidental-LP.vbs.


These scripts will allow you to create chords from a "source" note(s).  You specify the intervals and optional accidentals on the command line.  Best to use a PROMPTed invocation. - examples to come.  Like all user tools, they work on your selection, or if you haven't made a selection then they'll work on the entire staff.

The tools will construct chords, using slighty different rules, from the information provided thus:

Both tools will take interval information and create a chord from it.  A '3' argument will add a 3rd to the original note.  A '3 5' will create a triad from the original note - the key signature or preceding accidentals will define Maj/min.

A '3 5 7' will create a 7th chord &etc..

Negative intervals will give inversions.  A '-4 3' would give a first inversion triad, '-6 -4' will give you a second inversion.

An accidental can also be passed 'b3 5' for a minor, '-4 b3' for a 1st inversion minor, accidentals and minus signs can be used together; 'b-4 b3' for a 1st inversion diminished:

v = Double Flat
b = Flat
n = Natural
# = Sharp
x = Double Sharp

A 'help' argument will remind you of them.  As these symbols are defined in NWC I saw no reason to change 'em

The scripts do NOT take into account any existing clef or key signatures.  They have no idea what a note is, they simply take the numeric value of a notes' position on the staff and add or subtract to calculate the new chord members' numeric position value.   They are not intended to be some magical 'make all my chords for me' tool, but I do believe they can create a useful starting point.  Your ears are the best guide to whether the results are any good or not!


MakeChord-SpecifyAccidental-LP.vbs

This version will ignore any accidental on the original note and apply the accidental specified on the command line.


MakeChord-AdditiveAccidental-LP.vbs

This version will use any accidental on the original note and 'add' the accidental specified on the command line.  The script limits the maximum accidental to double flat and double sharp, so if you have a double flat starting note, and want to add a flat to the 3rd, it will still only be a double flat, not a 'triple' <g> one.

To try and take it further than that and figure out a new note to take into account a 'triple' flat or sharp is waaay beyond the skills I've learned in the last few days.  Also, I imagine that it would be so rare as to be not worth the effort.


Both versions will give you an "Octave chord" if used with no arguments.


Command lines for NWC2 tools dialogue:

  • 1) Copy the attachments to the "C:\Program Files\Noteworthy Composer 2\Scripts" directory
  • 2) Change their names to have a ".vbs" extension instead of ".txt"
  • 3) Create a new tool in the <Alt-F8> dialogue:
  • a) Open or create a song file
  • b) Press <Alt-F8>
  • c) Click "New.."
  • d) Give it a name:
  •    d1) MakeChord-SpecifyAccidental-LP
  •    d2) MakeChord-AdditiveAccidental-LP
  • e) Define the command (important spaces exist after "wscript" and ".vbs"):
  •    e1) wscript Scripts\MakeChord-SpecifyAccidental-LP.vbs <PROMPT:Enter intervals with opt. acc.'s, space delimited (use help):=*>
  •    e2) wscript Scripts\MakeChord-AdditiveAccidental-LP.vbs <PROMPT:Enter intervals with opt. acc.'s, space delimited (use help):=*>
  • f) Click "OK"
  • e) voila - ready to use
Note that lines e1) and e2) may have wrapped, be sure you put a space between ".vbs" and the "<PROMPT:" bits. when you copy and paste it.



This has been an interesting exercise and is no doubt not finished yet.  As usual, comments welcome, nay, sought!  Any comments on the usefulness of these scripts is also solicited.

Bug reports are also welcome, but I may limited in my ability to fix 'em.  I will try though.

I plays 'Bones, crumpets, coronets, floosgals, youfonymums 'n tubies.

Re: Create chords from a single note.

Reply #1
G'day all,
I notice that this page has now been viewed 1111 times.  I like palindromes...

I also notice that there's been around 102 downloads of one version of the tool and was it 84 or 89 downloads of the other version.

Given that there's been no comments I assume that they are either working fine for those who got 'em or they weren't what you were expecting.

Thus I'm curious - has anyone used either of them to advantage or am I simply the beneficiary of an exercise in learning some elementary VBScript?
I plays 'Bones, crumpets, coronets, floosgals, youfonymums 'n tubies.

Re: Create chords from a single note.

Reply #2
I mainly use NWC2 to clean up music. All the notes are in front of me, I just have to get them in the right place to make it all playable. I can enter 3 or 4 notes faster than I can figure out the intervals.

I've written ~30 tools, but regularly use only about 5. I use To Notepad the most. Some of the others feed keystrokes at NWC2 and won't work reliably on anything but Win98, so you won't see them here. But it never hurts to learn a new language ...
Registered user since 1996

Re: Create chords from a single note.

Reply #3
How do Lawrie;
   Have been playing with your scripts trying to find approbriate chords for My Sweet Alyce. I must say it is an interesting experiance, and also a great learning one. Thanks for the great tool.

Regards
Keith
------------------------------

Illigitimi Non Carborundum
Illigitimi Non Carborundum

Re: Create chords from a single note.

Reply #4
If "Nil carborundum!" means "Don't let them grind you down",
the meaning of your last sentence can be left tot the readers? ;-)

Re: Create chords from a single note.

Reply #5
Good Evening Rob;
   You have hit the nail right upon the head as usual. As the Lutheran pastor who gave that to me years ago put it; "Those things always sound better in Latin!"

Regards
Keith
Illigitimi Non Carborundum

Re: Create chords from a single note.

Reply #6
Thanks for the feedback Keith.  It depends on what I'm doing whether I use these tools much.  But when I do they get a real workout.

Actually, it's when I use a tool like these that I most miss not being able to select notes "here and there" rather than in contiguous blocks...
I plays 'Bones, crumpets, coronets, floosgals, youfonymums 'n tubies.

Re: Create chords from a single note.

Reply #7
Howdie lawrie;
   I concur on that. It is pretty standard windows convention to be able to use <Ctrl>click to select non-contiguous entities.

Regards
Keith
Illigitimi Non Carborundum

Re: Create chords from a single note.

Reply #8
It is pretty standard windows convention to be able to use <Ctrl>click to select non-contiguous entities.
And a nightmare for User Tools. NWC2 could not tell which part of STDOUT belonged to which "non-contiguous entity". Better to have a non-shifted HotKey to run the last User Tool. Then one could simply select, hotkey, select, hotkey, ...

The only Recorder Macro I still use, maps F11 to Alt+F8 <enter>
Registered user since 1996

Re: Create chords from a single note.

Reply #9
G'day Rick,
And a nightmare for User Tools. NWC2 could not tell which part of STDOUT belonged to which "non-contiguous entity". Better to have a non-shifted HotKey to run the last User Tool. Then one could simply select, hotkey, select, hotkey, ...

Please enlighten me...  How does the user tool facility work now?  Does it read each element as a separate entity, the user tool then reads it from STDIN, processes it and sends it to STDOUT to replace the current element?  Or does it load the entire selection as an array and work on the entire thing before writing stuff back out?

The former should, I think, be OK with non-contiguous elements...  (Warning, warning, danger Will Robinson - Lawrie's thinking again <bg>)

The latter wouldn't be OK I don't think, unless it was able to keep track of some kind of pointer perhaps...

Quote
The only Recorder Macro I still use, maps F11 to Alt+F8 <enter>

I finally got around to digging out an old copy of WFW and extracting these files - I too now have an F11 macro - 'tis a great idea.  Thanks mate.
I plays 'Bones, crumpets, coronets, floosgals, youfonymums 'n tubies.

Re: Create chords from a single note.

Reply #10
It invokes the user tool once, with the entire selection as STDIN
I think that multiple invocations, one for each scrap, could create a timing timing problem if sent all at once. Waiting until a scrap was processed before sending the next scrap might work, but some tools take a while to complete. Invoking such a tool with several scraps would look to the User as a non-responsive program. I have some ideas on this, but they involve sending nwctxt (instead of the clip). I am not ready to expound on sending nwctxt.

Recorder is available from the Scripto.
Registered user since 1996

Re: Create chords from a single note.

Reply #11
Thanks mate, I understand a little better now...
I plays 'Bones, crumpets, coronets, floosgals, youfonymums 'n tubies.

Re: Create chords from a single note.

Reply #12
I needed something to add an octave to the note or top note of the chord and this tool did the trick--many thanks.  Also thank Rick G for his input on this thread.
Since 1998

Re: Create chords from a single note.

Reply #13
-_-., all it does is add 3rd 5th or 7th to a tonic note.  I thought it can actually generate chords based on the highlighted melodies.  Can you make another script that can read a set of melodies and tell you what scale and key it is in?

Re: Create chords from a single note.

Reply #14
-_-., all it does is add 3rd 5th or 7th to a tonic note.  I thought it can actually generate chords based on the highlighted melodies. 
Umm, that's what I said in the (rather lengthy) introductory post.  YOU decide what intervals you need for the chord and the user tool will create a chord by adding notes on those intervals to the original note:

BTW, just to be clear, they will add the intervals you choose, you are not limited to 3, 5 and 7.  E.G. you could easily add a 4, 6, 8, 9, #11, b13 or anything that makes sense in the context...  It's just that you must read the context.

If you are only creating one or two chords it's just as easy to do them manually (<Ctrl+Enter>) but when you have the same pattern appearing regularly (E.G. 7th chord, or triad, or particular inversion triad) then the tools really start to save you time.  There are occasions where I transcribe piano stuff that has a lot of chords in one hand or the other and these chord shapes are repeated.  Just make a selection where, say, a triad appears; run the tool with the required parameters; select the next note(s) that have the same chord shape and press <Ctrl+Alt+F8> to rerun the tool using the same parameters.

To make that a little clearer, I transcribe the music and only enter the lowest note in each chord, then run the user tool after I've entered a complete section, or maybe the whole work (it depends on the size of the work and what mood I'm in).  Used in this fashion it can save quite a bit of time (it becomes quite easy to recognose the most common patterns and know the intervals that need to be specified - I even have several particular invocations set up in my user tools to just "do it"  E.G. triad and 1st inversion triad)

<snip>

These tools do not understand what clef or key signature you are using, they are a purely interval oriented thing.

<snip>

These scripts will allow you to create chords from a "source" note(s).  You specify the intervals and optional accidentals on the command line.

<snip>

The scripts do NOT take into account any existing clef or key signatures.  They have no idea what a note is, they simply take the numeric value of a notes' position on the staff and add or subtract to calculate the new chord members' numeric position value.   They are not intended to be some magical 'make all my chords for me' tool, but I do believe they can create a useful starting point.  Your ears are the best guide to whether the results are any good or not!

<snip>


Can you make another script that can read a set of melodies and tell you what scale and key it is in?
While I'm sure that particular task could be accomplished (to an extent) I do not have sufficient skills or time to do it these days.
I plays 'Bones, crumpets, coronets, floosgals, youfonymums 'n tubies.

 

Re: Create chords from a single note.

Reply #15
-_-., all it does is add 3rd 5th or 7th to a tonic note.  I thought it can actually generate chords based on the highlighted melodies.  Can you make another script that can read a set of melodies and tell you what scale and key it is in?
I agree with Lawrie on this one.  The people who write tools/scripts in this forum are doing it as a hobby and what they do depends on their time, interest in the problem, and their expertise.

I have a script that can read a note and know where it is, but the notes must be in the treble clef and have either naturals or sharps and its output is the same.  Since I don't play the piano I don't know nearly as much about chords as I would like.

If you would like to tackle the problem this.txt can get you started.  Replace diy.txt with nwc.htm in the URL to check out "Guitar" and "Twelve Tone Row" which both have note tables.  The site: www.codecademy.com is a good place to learn.  Happy coding!
Since 1998