Created
February 14, 2024 02:05
-
-
Save linkviii/3d12c04c5b05c3bdd8927292bce6c9ba to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Based on https://forum.cockos.com/showpost.php?p=1389356&postcount=612 | |
// Rename selected tracks based on their channel number and GM1 instrument name. | |
GM_map = 1; | |
GM_map[0]="Acoustic Grand Piano"; | |
GM_map[1]="Bright Acoustic Piano"; | |
GM_map[2]="Electric Grand Piano"; | |
GM_map[3]="Honky-tonk Piano"; | |
GM_map[4]="Electric Piano 1"; | |
GM_map[5]="Electric Piano 2"; | |
GM_map[6]="Harpsichord"; | |
GM_map[7]="Clavinet"; | |
GM_map[8]="Celesta"; | |
GM_map[9]="Glockenspiel"; | |
GM_map[10]="Music Box"; | |
GM_map[11]="Vibraphone"; | |
GM_map[12]="Marimba"; | |
GM_map[13]="Xylophone"; | |
GM_map[14]="Tubular Bells"; | |
GM_map[15]="Dulcimer"; | |
GM_map[16]="Drawbar Organ"; | |
GM_map[17]="Percussive Organ"; | |
GM_map[18]="Rock Organ"; | |
GM_map[19]="Church Organ"; | |
GM_map[20]="Reed Organ"; | |
GM_map[21]="Accordion"; | |
GM_map[22]="Harmonica"; | |
GM_map[23]="Tango Accordion"; | |
GM_map[24]="Acoustic Guitar (nylon)"; | |
GM_map[25]="Acoustic Guitar (steel)"; | |
GM_map[26]="Electric Guitar (jazz)"; | |
GM_map[27]="Electric Guitar (clean)"; | |
GM_map[28]="Electric Guitar (muted)"; | |
GM_map[29]="Overdriven Guitar"; | |
GM_map[30]="Distortion Guitar"; | |
GM_map[31]="Guitar Harmonics"; | |
GM_map[32]="Acoustic Bass"; | |
GM_map[33]="Electric Bass (finger)"; | |
GM_map[34]="Electric Bass (pick)"; | |
GM_map[35]="Fretless Bass"; | |
GM_map[36]="Slap Bass 1"; | |
GM_map[37]="Slap Bass 2"; | |
GM_map[38]="Synth Bass 1"; | |
GM_map[39]="Synth Bass 2"; | |
GM_map[40]="Violin"; | |
GM_map[41]="Viola"; | |
GM_map[42]="Cello"; | |
GM_map[43]="Contrabass"; | |
GM_map[44]="Tremolo Strings"; | |
GM_map[45]="Pizzicato Strings"; | |
GM_map[46]="Orchestral Harp"; | |
GM_map[47]="Timpani"; | |
GM_map[48]="String Ensemble 1"; | |
GM_map[49]="String Ensemble 2"; | |
GM_map[50]="Synth Strings 1"; | |
GM_map[51]="Synth Strings 2"; | |
GM_map[52]="Choir Aahs"; | |
GM_map[53]="Voice Oohs"; | |
GM_map[54]="Synth Choir"; | |
GM_map[55]="Orchestra Hit"; | |
GM_map[56]="Trumpet"; | |
GM_map[57]="Trombone"; | |
GM_map[58]="Tuba"; | |
GM_map[59]="Muted Trumpet"; | |
GM_map[60]="French Horn"; | |
GM_map[61]="Brass Section"; | |
GM_map[62]="Synth Brass 1"; | |
GM_map[63]="Synth Brass 2"; | |
GM_map[64]="Soprano Sax"; | |
GM_map[65]="Alto Sax"; | |
GM_map[66]="Tenor Sax"; | |
GM_map[67]="Baritone Sax"; | |
GM_map[68]="Oboe"; | |
GM_map[69]="English Horn"; | |
GM_map[70]="Bassoon"; | |
GM_map[71]="Clarinet"; | |
GM_map[72]="Piccolo"; | |
GM_map[73]="Flute"; | |
GM_map[74]="Recorder"; | |
GM_map[75]="Pan Flute"; | |
GM_map[76]="Blown bottle"; | |
GM_map[77]="Shakuhachi"; | |
GM_map[78]="Whistle"; | |
GM_map[79]="Ocarina"; | |
GM_map[80]="Lead 1 (square)"; | |
GM_map[81]="Lead 2 (sawtooth)"; | |
GM_map[82]="Lead 3 (calliope)"; | |
GM_map[83]="Lead 4 chiff"; | |
GM_map[84]="Lead 5 (charang)"; | |
GM_map[85]="Lead 6 (voice)"; | |
GM_map[86]="Lead 7 (fifths)"; | |
GM_map[87]="Lead 8 (bass + lead)"; | |
GM_map[88]="Pad 1 (new age)"; | |
GM_map[89]="Pad 2 (warm)"; | |
GM_map[90]="Pad 3 (polysynth)"; | |
GM_map[91]="Pad 4 (choir)"; | |
GM_map[92]="Pad 5 (bowed)"; | |
GM_map[93]="Pad 6 (metallic)"; | |
GM_map[94]="Pad 7 (halo)"; | |
GM_map[95]="Pad 8 (sweep)"; | |
GM_map[96]="FX 1 (rain)"; | |
GM_map[97]="FX 2 (soundtrack)"; | |
GM_map[98]="FX 3 (crystal)"; | |
GM_map[99]="FX 4 (atmosphere)"; | |
GM_map[100]="FX 5 (brightness)"; | |
GM_map[101]="FX 6 (goblins)"; | |
GM_map[102]="FX 7 (echoes)"; | |
GM_map[103]="FX 8 (sci-fi)"; | |
GM_map[104]="Sitar"; | |
GM_map[105]="Banjo"; | |
GM_map[106]="Shamisen"; | |
GM_map[107]="Koto"; | |
GM_map[108]="Kalimba"; | |
GM_map[109]="Bagpipe"; | |
GM_map[110]="Fiddle"; | |
GM_map[111]="Shanai"; | |
GM_map[112]="Tinkle Bell"; | |
GM_map[113]="Agogo"; | |
GM_map[114]="Steel Drums"; | |
GM_map[115]="Woodblock"; | |
GM_map[116]="Taiko Drum"; | |
GM_map[117]="Melodic Tom"; | |
GM_map[118]="Synth Drum"; | |
GM_map[119]="Reverse Cymbal"; | |
GM_map[120]="Guitar Fret Noise"; | |
GM_map[121]="Breath Noise"; | |
GM_map[122]="Seashore"; | |
GM_map[123]="Bird Tweet"; | |
GM_map[124]="Telephone Ring"; | |
GM_map[125]="Helicopter"; | |
GM_map[126]="Applause"; | |
GM_map[127]="Gunshot"; | |
function rename_tracks() local(item, take, track, i, j, cc_cnt, pc_found, chanmsgOut, chanOut, msg2Out) | |
( | |
i = 0; | |
loop(CountSelectedMediaItems(0), | |
(item = GetSelectedMediaItem(0, i)) ? ( | |
(take = GetActiveTake(item)) ? ( | |
(track = GetMediaitem_track(item)) ? ( | |
MIDI_CountEvts(take, 0, cc_cnt, 0); | |
j = 0; | |
pc_found = 0; | |
while(pc_found == 0 && j < cc_cnt) ( | |
MIDI_GetCC(take, j, 0, 0, 0, chanmsgOut, chanOut, msg2Out, 0); | |
chanmsgOut == 192 ? ( | |
pc_found = 1; | |
chanOut == 9 ? ( | |
sprintf(#new_name, "%d - Drums", chanOut + 1); | |
) : ( | |
sprintf(#new_name, "%d - %s", chanOut + 1, GM_map[msg2Out]); | |
); | |
GetSetMediaTrackInfo_String(track, "P_NAME", #new_name, 1); | |
); | |
j += 1; | |
); | |
chanOut == 9 && pc_found == 0 ? ( | |
sprintf(#new_name, "%d - Drums", chanOut + 1); | |
GetSetMediaTrackInfo_String(track, "P_NAME", #new_name, 1); | |
); | |
); | |
); | |
); | |
i += 1; | |
); | |
TrackList_AdjustWindows(0); | |
); | |
rename_tracks(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment