TKL Instruments...

Suggestions Should Be Posted in Their Respective Categories

Moderators: Moderator, Developer, DM

User avatar
Ambaryerno
Posts: 467
Joined: Tue Jun 15, 2010 1:32 am

Re: TKL Instruments...

Unread post by Ambaryerno »

FYI, I heard back from Brock Fanning, and according to him there should be no problem with extending the range, so long as the sounds exist.

So.... \m/ ^_^ \m/
Julia "la Belle" - Duelist, singer, and shameless flirt. Currently deciding whether she wants to fight you or @$%& you.
Julia's Songbook

Lucia Kayla - If her parents find out she left the Island she'll likely be grounded until she's 500.
User avatar
Ambaryerno
Posts: 467
Joined: Tue Jun 15, 2010 1:32 am

Re: TKL Instruments...

Unread post by Ambaryerno »

Doing some more poking around. Here are the current instrument ranges in Performer vs. their actual pitches. I'm correcting my previous remarks as I realized I was transposing everything down an octave. :-P

C1 = C3
C2 = C4 (Middle C)
C3 = C5

Anything below C2 starts to get really muddy and difficult to make out cleanly, so I won't go that low. Also, the lowest note on a traditional 8-course lute is D2, so I'll probably just go down a single octave, which should cover enough of the lower range for the vast majority of music. That would mean:

C1 = C2
C2 = C3
C3 = C4 (Middle C)
C4 = C5
C5 = C6
C6 = C7

So existing songs could be fixed by simply transposing them up one octave. However I am considering numbering the pitches correctly, (easier on us music folks or exporting from MIDI) so the range would start at C2, instead. In which case, you need to transpose the written pitches up TWO octaves.

Still reviewing the scripts to try to find where the sounds are defined, and how to unlock anything above the current C3 (while there are SOUNDS that go up to Bb3, I tested in game and you get an error that pitches above the C are not allowed).
Julia "la Belle" - Duelist, singer, and shameless flirt. Currently deciding whether she wants to fight you or @$%& you.
Julia's Songbook

Lucia Kayla - If her parents find out she left the Island she'll likely be grounded until she's 500.
User avatar
Planehopper
Posts: 2287
Joined: Sun Oct 09, 2011 4:50 pm

Re: TKL Instruments...

Unread post by Planehopper »

So existing songs could be fixed by simply transposing them up one octave. However I am considering numbering the pitches correctly, (easier on us music folks or exporting from MIDI) so the range would start at C2, instead. In which case, you need to transpose the written pitches up TWO octaves.
I'll send over the stack of scores for you to get started on fixing, once this is in game.

:?

It sounds like a fun upgrade, if you can figure it out, but fixing everything it breaks sounds like a gigantic headache.
User avatar
Ambaryerno
Posts: 467
Joined: Tue Jun 15, 2010 1:32 am

Re: TKL Instruments...

Unread post by Ambaryerno »

Planehopper wrote: Fri Jun 12, 2020 11:22 am
So existing songs could be fixed by simply transposing them up one octave. However I am considering numbering the pitches correctly, (easier on us music folks or exporting from MIDI) so the range would start at C2, instead. In which case, you need to transpose the written pitches up TWO octaves.
I'll send over the stack of scores for you to get started on fixing, once this is in game.

:?

It sounds like a fun upgrade, if you can figure it out, but fixing everything it breaks sounds like a gigantic headache.
TBH, the only thing it really ought to "break" is pitching everything down an octave or two. I won't be touching percussion, only the pitches for the lute (which has the largest range and is most restricted) and possibly the flute (the standard concert flute range is C4 to C7) under the WRITE functionality, so you can manually write out the notes.

Now, there's a couple ways I can do it. I can leave the numbers of the "stock" sounds alone and simply extend the octaves (say, Octave 0 and Octaves 3-6). However renumbering the notes is, IMO, important. Especially for us musical people. Sight transposing is NOT fun (I know; I'm a saxophonist IRL). It's ALSO important for the MIDI import process PaMango posted earlier in the thread, since MIDI uses those pitch numbers.

Right now, I'm just trying to GET the sounds put together, and then find where to define it in the scripts.
Julia "la Belle" - Duelist, singer, and shameless flirt. Currently deciding whether she wants to fight you or @$%& you.
Julia's Songbook

Lucia Kayla - If her parents find out she left the Island she'll likely be grounded until she's 500.
User avatar
Ambaryerno
Posts: 467
Joined: Tue Jun 15, 2010 1:32 am

Re: TKL Instruments...

Unread post by Ambaryerno »

Another addendum:

I'm playing around a bit with the sound files. A real lute doesn't have single strings like a guitar. Rather, it has paired strings called courses. While these strings COULD be played individually, usually they were played together.

The tuning of the lute was that the first half of the courses were generally tuned in octaves (say, one string in the course tuned to C3, the other tuned to C4). The upper courses were tuned in unison.

I'm going through and doing that. So on the lute, the first half of the range (I'm doing this as an 8-course tenor lute, so C2 through A3) will have the sound of two strings an octave apart (so C2 also plays C3, and A3 also plays A4).

(I WILL have regular sounds of individual strings, as well).
Julia "la Belle" - Duelist, singer, and shameless flirt. Currently deciding whether she wants to fight you or @$%& you.
Julia's Songbook

Lucia Kayla - If her parents find out she left the Island she'll likely be grounded until she's 500.
User avatar
Ambaryerno
Posts: 467
Joined: Tue Jun 15, 2010 1:32 am

Re: TKL Instruments...

Unread post by Ambaryerno »

Some minor headway. I THINK I'm tracking down bits and pieces of how the instruments work in the script.

First, all sounds are in the format tkl_performer_###.

I also found this snippet in one script:

Code: Select all

switch (iPitch)
{
case 1: return sInstrument + "C1";
case 2: return sInstrument + "Db1";
case 3: return sInstrument + "D1";
case 4: return sInstrument + "Eb1";
case 5: return sInstrument + "E1";
case 6: return sInstrument + "F1";
case 7: return sInstrument + "Gb1";
case 8: return sInstrument + "G1";
case 9: return sInstrument + "Ab1";
case 10:return sInstrument + "A1";
case 11:return sInstrument + "Bb1";
case 12:return sInstrument + "B1";
case 13:return sInstrument + "C2";
case 14:return sInstrument + "Db2";
case 15:return sInstrument + "D2";
case 16:return sInstrument + "Eb2";
case 17:return sInstrument + "E2";
case 18:return sInstrument + "F2";
case 19:return sInstrument + "Gb2";
case 20:return sInstrument + "G2";
case 21:return sInstrument + "Ab2";
case 22:return sInstrument + "A2";
case 23:return sInstrument + "Bb2";
case 24:return sInstrument + "B2";
case 25:return sInstrument + "C3";
case 26:return sInstrument + "Db3";
case 27:return sInstrument + "D3";
case 28:return sInstrument + "Eb3";
case 29:return sInstrument + "E3";
case 30:return sInstrument + "F3";
case 31:return sInstrument + "Gb3";
case 32:return sInstrument + "G3";
case 33:return sInstrument + "Ab3";
case 34:return sInstrument + "A3";
case 35:return sInstrument + "Bb3";
case 36:return sInstrument + "B3";
}
So, I THINK that is where I can specify what my pitches are.

Now, on the other script I noticed a conditional statement for variant pitches which subtracts 50 from the pitch. This appears to be to specify whether it's a long and short pitches for lute and flute.

I took a closer look at the sound files themselves. The Lute has sounds from 1-36 for long notes, then 51-86 for short notes. Chords begin at 101-136 and 151-186. The flute runs from 201-236 and 251-286. Percussion works differently. It runs from 301-397, with no gaps.

SO. That tells me two things that would need to be adjusted:

First, the extra pitches need to be added to that list above. I can also define the pitch names there (presumably that's how it knows C1 uses one sound, vs. B2 being another, etc.). There are a total of 61 pitches on the extended range for the lute (C2 - C7).

Now, because the number of pitches now exceeds 50, the other statement will need to be modified as well. So probably the best option there would be to subtract 100 instead. This would make the lute run from 1-61, 101-161, 201-61, and 301-361. The flute wouldn't have as big of a range, but would start at 401 and 501, respectively. Percussion then begins at 601.

However this ALSO means I'll need to find what tag defines the starting ranges for the flute and drums and adjust THOSE, as well. There's also a flag that blocks you from manually writing pitches from D2 - B3 even though the sounds are there and called in the script.
Julia "la Belle" - Duelist, singer, and shameless flirt. Currently deciding whether she wants to fight you or @$%& you.
Julia's Songbook

Lucia Kayla - If her parents find out she left the Island she'll likely be grounded until she's 500.
User avatar
Ambaryerno
Posts: 467
Joined: Tue Jun 15, 2010 1:32 am

Re: TKL Instruments...

Unread post by Ambaryerno »

More tinkering.

First of all, I may revisit how I'm doing the instrument ranges. As you approach notes towards the top of the 5th octave (C5-B5) on the lute, the notes get extremely short. This is realistic, of course; on a stringed instrument the note only sounds so long as the string vibrates, and in the case of a plucked instrument like the lute the shorter the string gets as you move your fingers along the fretboard, the less elastic and willing to vibrate it is. While theoretically you can get extremely high pitches, those pitches also won't sound long enough to be useful for much.

Looking at the three instruments we have my thinking is to give the two sounded instruments their own range:

The lute would be presented as an 8-course tenor lute, pitched from C2 to E5. For the flute, which isn't limited as badly by note duration (I can tweak the length of the audio files as I adjust the pitch) I was thinking of using a typical Renaissance flute range of D4 to A6. That gives the lute a range of three octaves and a third, and the flute two octaves and a fifth (the flute is less hampered by the limited range than the lute). There's some overlap between the upper range of the lute and the lower range of the flute, but otherwise gives each instrument a unique range.

That will ALSO allow me to fit both instruments in under 50 pitches so I don't need to massively rewrite the code or rename files.

Also, upon digging into the script (I'm currently bookmarking what looks important so I can find it later) I think it should be relatively easy to add additional instruments.

Code: Select all

if (iPitch < 100 || (iPitch > 200 && iPitch < 300) || (iPitch > 323 && iPitch < 350) || (iPitch > 373 && iPitch < 400))
	{
		if (iPitch < 100)
		{
			sInstrument = "Lute Note: ";
			if (iPitch > 50)
				iPitch -= 50;
		}
		else if (iPitch > 200 && iPitch < 300)
		{
			sInstrument = "Flute Note: ";
			if (iPitch > 250)
				iPitch -= 50;
			iPitch -= 200;
		}
		else if ((iPitch > 323 && iPitch < 350) || (iPitch > 373 && iPitch < 400))
		{
			sInstrument = "Drum Note: ";
			if (iPitch > 373)
				iPitch -= 50;
			iPitch -= 323;
		}
Note this little snippet here. It defines the sound file range for the three instruments. The next segment of that code is this:

Code: Select all

switch (iPitch)
		{
			case 1:	return sInstrument + "C1";
			case 2:	return sInstrument + "Db1";
			case 3:	return sInstrument + "D1";
			case 4:	return sInstrument + "Eb1";
			case 5:	return sInstrument + "E1";
			case 6:	return sInstrument + "F1";
			case 7:	return sInstrument + "Gb1";
			case 8:	return sInstrument + "G1";
			case 9:	return sInstrument + "Ab1";
			case 10:return sInstrument + "A1";
			case 11:return sInstrument + "Bb1";
			case 12:return sInstrument + "B1";
			case 13:return sInstrument + "C2";
			case 14:return sInstrument + "Db2";
			case 15:return sInstrument + "D2";
			case 16:return sInstrument + "Eb2";
			case 17:return sInstrument + "E2";
			case 18:return sInstrument + "F2";
			case 19:return sInstrument + "Gb2";
			case 20:return sInstrument + "G2";
			case 21:return sInstrument + "Ab2";
			case 22:return sInstrument + "A2";
			case 23:return sInstrument + "Bb2";
			case 24:return sInstrument + "B2";
			case 25:return sInstrument + "C3";
			case 26:return sInstrument + "Db3";
			case 27:return sInstrument + "D3";
			case 28:return sInstrument + "Eb3";
			case 29:return sInstrument + "E3";
			case 30:return sInstrument + "F3";
			case 31:return sInstrument + "Gb3";
			case 32:return sInstrument + "G3";
			case 33:return sInstrument + "Ab3";
			case 34:return sInstrument + "A3";
			case 35:return sInstrument + "Bb3";
			case 36:return sInstrument + "B3";
		}
	}
	
	// or is this a chord?
	else if (iPitch < 200)
	{
		sInstrument = "Lute Chord: ";
		if (iPitch > 150)
			iPitch -= 50;
		switch (iPitch)
		{
			case 101:return sInstrument + "C Major";
			case 102:return sInstrument + "Db Major";
			case 103:return sInstrument + "D Major";
			case 104:return sInstrument + "Eb Major";
			case 105:return sInstrument + "E Major";
			case 106:return sInstrument + "F Major";
			case 107:return sInstrument + "Gb Major";
			case 108:return sInstrument + "G Major";
			case 109:return sInstrument + "Ab Major";
			case 110:return sInstrument + "A Major";
			case 111:return sInstrument + "Bb Major";
			case 112:return sInstrument + "B Major";
			case 113:return sInstrument + "C minor";
			case 114:return sInstrument + "Db minor";
			case 115:return sInstrument + "D minor";
			case 116:return sInstrument + "Eb minor";
			case 117:return sInstrument + "E minor";
			case 118:return sInstrument + "F minor";
			case 119:return sInstrument + "Gb minor";
			case 120:return sInstrument + "G minor";
			case 121:return sInstrument + "Ab minor";
			case 122:return sInstrument + "A minor";
			case 123:return sInstrument + "Bb minor";
			case 124:return sInstrument + "B minor";
			case 125:return sInstrument + "C half-diminished";
			case 126:return sInstrument + "Db half-diminished";
			case 127:return sInstrument + "D half-diminished";
			case 128:return sInstrument + "Eb half-diminished";
			case 129:return sInstrument + "E half-diminished";
			case 130:return sInstrument + "F half-diminished";
			case 131:return sInstrument + "Gb half-diminished";
			case 132:return sInstrument + "G half-diminished";
			case 133:return sInstrument + "Ab half-diminished";
			case 134:return sInstrument + "A half-diminished";
			case 135:return sInstrument + "Bb half-diminished";
			case 136:return sInstrument + "B half-diminished";	
		}
	}
	// or is this a percussion sound?
	else
	{
		sInstrument = "Percussion Hit: ";
		if (iPitch > 350)
			iPitch -= 50;
		switch (iPitch)
		{
			case 301: return sInstrument + "Cow Bell (a1)";
			case 302: return sInstrument + "Taiko (b1)";
			case 303: return sInstrument + "Triangle (c1)";
			case 304: return sInstrument + "Guiro (d1)";
			case 305: return sInstrument + "Frame Drum (e1)";
			case 306: return sInstrument + "Open Snare (f1)";
			case 307: return sInstrument + "Closed Snare (g1)";
			case 308: return sInstrument + "Tabla (h1)";
			case 309: return sInstrument + "Tambourine (i1)";
			case 310: return sInstrument + "Anvil (j1)";
			case 311: return sInstrument + "Cow Bell (a2)";
			case 312: return sInstrument + "Taiko (b2)";
			case 313: return sInstrument + "Triangle (c2)";
			case 314: return sInstrument + "Guiro (d2)";
			case 315: return sInstrument + "Frame Drum (e2)";
			case 316: return sInstrument + "Open Snare (f2)";
			case 317: return sInstrument + "Closed Snare (g2)";
			case 318: return sInstrument + "Tabla (h2)";
			case 319: return sInstrument + "Tambourine (i2)";
			case 320: return sInstrument + "Anvil (j2)";
		}
	}
	return "Unrecognized Pitch";
This associates the sound files with the names. Another bit of script further up defines Melody Note, Chord Note, and Percussion Hit.

Using this section here it should be possible to add additional instruments, AND provide each instrument (Lute, Flute, etc.) with its own range and still keep the number of pitches within 50. This opens up additional strings like violins, (or lutes in different ranges, like alto or bass) more wind instruments, pitched percussion (xylophone) etc. All that would be needed is sound samples and models (I'm already tempted to add a "voice" instrument. It wouldn't allow a true vocal track with lyrics, but would at least provide a clear reference for, "This is where the lyrics GO"). All you would need to do in the script is make the Melody Notes conditional based on the numerical range.

Second, does anyone actually use the short lute notes? If not, I had a thought to give some flexibility to the sound by using the short notes instead to represent the course strings being plucked individually, rather than in pairs. TBH the short notes aren't all THAT much shorter to begin with. The main difference I can hear is that the normal pitches seem to have a more pronounced attack.
Julia "la Belle" - Duelist, singer, and shameless flirt. Currently deciding whether she wants to fight you or @$%& you.
Julia's Songbook

Lucia Kayla - If her parents find out she left the Island she'll likely be grounded until she's 500.
User avatar
Endelyon
Posts: 3606
Joined: Sun Jul 06, 2014 4:24 am

Re: TKL Instruments...

Unread post by Endelyon »

If you're looking to tweak these scripts you might want to start with 2.0 as a base since I believe it has some added functionality over the original:

https://neverwintervault.org/project/nw ... bards-tool

I think we have version 1 on the server, but maybe we did have version 2, it's been long enough now that I can't remember.
User avatar
Ambaryerno
Posts: 467
Joined: Tue Jun 15, 2010 1:32 am

Re: TKL Instruments...

Unread post by Ambaryerno »

Endelyon wrote: Sat Jun 13, 2020 11:38 am If you're looking to tweak these scripts you might want to start with 2.0 as a base since I believe it has some added functionality over the original:

https://neverwintervault.org/project/nw ... bards-tool

I think we have version 1 on the server, but maybe we did have version 2, it's been long enough now that I can't remember.
I THINK it's V.1, but I'm not entirely sure. However the link you posted is the one I downloaded and am looking at.
Julia "la Belle" - Duelist, singer, and shameless flirt. Currently deciding whether she wants to fight you or @$%& you.
Julia's Songbook

Lucia Kayla - If her parents find out she left the Island she'll likely be grounded until she's 500.
User avatar
Ambaryerno
Posts: 467
Joined: Tue Jun 15, 2010 1:32 am

Re: TKL Instruments...

Unread post by Ambaryerno »

Ok, I've been through the INCLUDE file, and I think I've seen everything there I need to. I've located the trigger that restricts the instrument range, and I think I should be able to modify that for the new range. Looking it over, I should be able to do a check for the instrument type so I can even set range based on the instrument, with an appropriate response when you apply a note out of the new ranges.

Bear in mind, this is JUST going to be for the "WRITE" function.

I've not looked at the actual script yet, but so far it looks like everything I need to change would just be in the INCLUDE script. I'll start with that and try the module offline, first.
Julia "la Belle" - Duelist, singer, and shameless flirt. Currently deciding whether she wants to fight you or @$%& you.
Julia's Songbook

Lucia Kayla - If her parents find out she left the Island she'll likely be grounded until she's 500.
narcaleptic
Posts: 204
Joined: Tue Sep 06, 2011 11:22 pm

Re: TKL Instruments...

Unread post by narcaleptic »

PiaMango wrote: Wed Jun 10, 2020 6:14 pm I have followed this guide here for importing midi files into the performer: https://www.youtube.com/watch?v=gagFe09vQac

It's far from perfect and does not handle complex songs well, chords sometimes get out of sync in game and sound wonky. But I have successfully imported a few songs thanks to it :D
this is the best known method as of the moment to work songs into the game. it is a bit hard at first to learn but once you get familiar with the tools it becomes very easy to do. I as hymly can import a new tune into nwn2 in about 30 minutes or less, and this would be a complete full song simply without lyrics. once you understand the limitations of having two octaves and only 4 tracks total it becomes easy to know what song is going to sound good and which ones are not. I personally find that country music and old piano tunes work the best for importing and ajusting to hit good notes from beginning to end, as most those type of songs or tunes have a set beat from beginning until end unlike say rock music or heavy metal that push a wide variety of octaves and instrument solos. using this method here i've created many songs that sound just great ingame, and often spend 90% of the song writing process just trying to come up with lyrics for the tunes. so it is nice to cut out a larger portion of the process as the tkl tool can be very time consuming.

as far as writing originals its also very easy to do on these programs, if your familiar with notes and music sheets you can actually write a music sheet that only uses 2 octaves(I find that octaves 3 and 4 match the game the best) and convert it over into a midi.file setup, then import it into nabtabber for testing and ajusting before running it through notepad ++ and the converter program to get it loaded in game. I have three songs i've written this way and imported into the game and they are all completely original and sounded almost exactly the way I intended for them to sound.

One thing to note and understand is that the tkl, even if upgraded has its limitations, certain keys will cut other keys short when they should not, keep that in mind when writing as you cannot import drifts or electric guitar notes in game, they simply just will not play anything close to the way they should.
Buurk Gers: OH! BIG DOGGIE, MEBZ PET! *runs off chasing a boar*
Henry: Gold is the source of all life mate, not blood.
Ole'grum: Yer mothers a tavern Wench!
Xilo Villa: Your gold or your life.
User avatar
Lockonnow
Posts: 3123
Joined: Fri Oct 15, 2010 12:10 pm

Re: TKL Instruments...

Unread post by Lockonnow »

well it could be great if you could do the fluke as well couse lute and fluke could go in hand in hand maybe the drum as well
User avatar
Ambaryerno
Posts: 467
Joined: Tue Jun 15, 2010 1:32 am

Re: TKL Instruments...

Unread post by Ambaryerno »

Right now I don't see a need to do much with the Percussion instrument. Expanding the ranges for the lute and flute in the Write function first are my priority.
Julia "la Belle" - Duelist, singer, and shameless flirt. Currently deciding whether she wants to fight you or @$%& you.
Julia's Songbook

Lucia Kayla - If her parents find out she left the Island she'll likely be grounded until she's 500.
User avatar
Ambaryerno
Posts: 467
Joined: Tue Jun 15, 2010 1:32 am

Re: TKL Instruments...

Unread post by Ambaryerno »

Ok. I've got the INCLUDE script updated to set the Lute range from C2 to E5, and the Flute from D4 to A6. There's also going to be an alert for each instrument if you write out of its range. Notes will be written using the actual pitch notation to better facilitate importing MIDI tabs. As long as the song fits the range there will be no need to transpose it.

As far as the sounds themselves, the Flute actually had all of the pitches I needed; the original sound files go from C4 to B6 (including the extra 12 pitches that are included but unused) so I just needed to tweak the range in the script.

I'm still working on sounds for the lute. So far I have the standard sounds done. As I noted previously, C2 through A3 plays two notes in octaves of one another. There's a slight delay to simulate how the fingers would strum the course strings. Bb3 through B4 have two notes played in unison, with the same delay on the second note. I've reduced the volume on the second note as well so it's less pronounced. The effect is pretty cool. C5 through E5 play a single note. This is to simulate how the paired strings of an actual lute work (typically, in an eight-course lute like I'm using the paired string on the first four courses were tuned at an octave apart, the next three in unison, and the eighth was a single string).

I'm still trying to decide whether or not to use the Muted lute sounds as they were originally created, (so identical to the regular sounds, just with a less pronounced attack) or to allow playing the course strings individually across the entire range (which was also possible on the lute). Additionally, there's some missing sounds under the current setup that would be on an actual lute (for my source tuning, unison courses from D3 to A3, and single notes from E4 to B4). I might be able to work in the missing unison notes without having to drastically rewrite any code (It would bring the total of lute notes up to 49). If I use the alternate pitches for the lute as single strings that would automatically cover the single notes (I'm leaning this direction).

I may modify the sounds for the chords to use my modified versions, so the chords will also play using the course strings.
Julia "la Belle" - Duelist, singer, and shameless flirt. Currently deciding whether she wants to fight you or @$%& you.
Julia's Songbook

Lucia Kayla - If her parents find out she left the Island she'll likely be grounded until she's 500.
User avatar
Ambaryerno
Posts: 467
Joined: Tue Jun 15, 2010 1:32 am

Re: TKL Instruments...

Unread post by Ambaryerno »

*SIGH* All right, I had to have missed something SOMEWHERE.

I just tested out the modified script in-game. The GUI loads as normal, I can go into the Song and Track menus, but the only menu options that respond are Load, Save, and Improvise (however nothing in the Improvise menu itself works). I didn't make any changes to the GUI, but there must be something I overlooked.
Julia "la Belle" - Duelist, singer, and shameless flirt. Currently deciding whether she wants to fight you or @$%& you.
Julia's Songbook

Lucia Kayla - If her parents find out she left the Island she'll likely be grounded until she's 500.

Return to “Suggestions and Discussion”