from nesstools import guitar stringCount = 2 #________________________________________ #_____CREATE THE INSTRUMENT FILE_________ # create a string instrument object my_guitar = guitar.StringInstrument(stringCount) my_guitar.defaultGuitar() # set our two strings to default E and A # print the tension of our single string. # note that the array index is 0, not 1 for the first string - we start counting at zero. print(my_guitar.strings[0].tension) print(my_guitar.strings[1].tension) # 1st string settings my_guitar.strings[0].tension = 9.5 # less tension my_guitar.strings[0].length = 1.0 # longer string (1 metre) my_guitar.strings[0].radius = 0.0004 # twice as thick # 2nd string settings my_guitar.strings[1].tension = 20.5 # more tension my_guitar.strings[1].length = 0.5 # short string (1 metre) my_guitar.strings[1].radius = 0.0001 # thinner # export the file as a format compatible instrument file for the NESS model my_guitar.write("ness_files_to_process/inst_4_instrument.m") #________________________________________ #_____CREATE THE SCORE FILE______________
# Create a score object, specifying the total duration (T) and the string count (numberOfStrings) my_score = guitar.GuitarScore(T, numberOfStrings) # Here we use the playFret function to assign a finger to a fret at a particular time # The finger is placed slightly behind the actual fret # string num, time, fret_num my_score.playFret (1, 0.2, 2) # this says to move a finger on string 1 to fret 2 at 1 second my_score.playFret (1, 0.5, 7) # this says to move a finger on string 1 to fret 7 at 3 seconds #add another pluck with some extra parameters for glide time and finger force # string num, time (s), fret_num glide time (s) finger force (Newtons - onto string) my_score.playFret (1, 2, 4, 0.1, 0.5) my_score.playFret (1, 3, 2, 1.9, 8) # explort the score as a NESS-compatible score file my_score.write("ness_files_to_process/gtr_score_3.m") #________________________________________ #_____CREATE THE INSTRUMENT FILE_________ # create a string instrument object with 6 strings my_guitar = guitar.StringInstrument(numberOfStrings) my_guitar.defaultGuitar() # export the file as a format compatible instrument file for the NESS model my_guitar.write("ness_files_to_process/gtr_instrument_3.m")
from nesstools import guitar stringCount = 6 #________________________________________ #_____CREATE THE INSTRUMENT FILE_________ # create a string instrument object my_guitar = guitar.StringInstrument() my_guitar.defaultGuitar() # a 4 string bass: EADG my_guitar.tuneString(1, "D2") my_guitar.tuneString(2, "G2") my_guitar.tuneString(3, "D3") my_guitar.tuneString(4, "G3") my_guitar.tuneString(5, "C4") my_guitar.tuneString(6, "E4") # export the file as a format compatible instrument file for the NESS model my_guitar.write("ness_files_to_process/inst_3_tunedGuitar.m") #________________________________________ #_____CREATE THE SCORE FILE______________ # in order to test our instrument file, we create a quick score file that will play all the strings from 1 to [stringCount] T = 9 # how long should the piece be (in seconds)? # Create a score object, specifying the total duration (T) and the string count (numberOfStrings) my_score = guitar.GuitarScore(T, stringCount) # here we create a plucking sequence where each string is plucked in turn, until we are 4 seconds from the end of the score