# Kontakt samples names by script ?



## Mika31sens (Jan 6, 2015)

For help please, Is it possible easily to display the name of each sample played?
(without enter all the names in the script)


----------



## mk282 (Jan 6, 2015)

Nope, there's no such function. Unless you use group_name(), and put just one sample in each group, and name the group exactly how the sample is called. Best would be entering the names in the script.


----------



## Mika31sens (Jan 6, 2015)

mk282 @ Tue Jan 06 said:


> Nope, there's no such function. Unless you use group_name(), and put just one sample in each group, and name the group exactly how the sample is called. Best would be entering the names in the script.


Thank you
Pity ! 
For example, for a library of sound effects, it would be very useful.


----------



## mk282 (Jan 7, 2015)

It's not that big a problem to put all the sample names in a string array, really...


----------



## Mika31sens (Jan 7, 2015)

It's not a problem. Too much time for me


----------



## mk282 (Jan 7, 2015)

What, 5 seconds? At least that's how much it takes me to print out a list of sample filenames and copy it out in the script, without the extension.


----------



## Mika31sens (Jan 7, 2015)

mk282 @ Wed Jan 07 said:


> What, 5 seconds? At least that's how much it takes me to print out a list of sample filenames and copy it out in the script, without the extension.



Sure! But I do not know how to do it.


----------



## mk282 (Jan 7, 2015)

A bit of Google helps ("copy list of filenames as text explorer/finder" (depending on your OS)).


----------



## Mika31sens (Jan 7, 2015)

mk282 @ Wed Jan 07 said:


> A bit of Google helps ("copy list of filenames as text explorer/finder" (depending on your OS)).



Very interesting this possibility. Thank you very much. o-[][]-o


----------



## lydianchromaticconcept (Jan 7, 2015)

whoah thats a cool trick mk282! thanks for that.


----------



## Mika31sens (Jan 7, 2015)

Below the code to display the sample name (until 88 notes), with options (all notes or only white keys)

_on init
message("")

{***** Parameters to change *****}
declare $FirstNote := 36 {First note must be a white key}
declare $WhiteNotesOnly := 1

declare !names[87]
!names[0] := "a"
!names[1] := "b"
!names[2] := "c"
!names[3] := "d"
!names[4] := "e"
!names[5] := "f"
!names[6] := "g"
!names[7] := "h"
!names[8] := "i"
!names[9] := "j"
!names[10] := "k"
!names[11] := "l"
!names[12] := "m"
!names[13] := "n"
!names[14] := "o"
!names[15] := "p"
!names[16] := "q"
!names[17] := "r"
!names[18] := "s"
!names[19] := "t"
!names[20] := "u"
!names[21] := "v"
!names[22] := "w"
!names[23] := "x"
!names[24] := "y"
!names[25] := "z"
{****************************}

declare !names2[87]
declare $Count1
declare $Count2
declare $Mod
declare %White[7]
declare %White1[7] := (0,2,4,5,7,9,11)
declare %White2[7] := (0,2,3,5,7,9,10)
declare %White3[7] := (0,1,3,5,7,8,10)
declare %White4[7] := (0,2,4,6,7,9,11)
declare %White5[7] := (0,2,4,5,7,9,10)
declare %White6[7] := (0,2,3,5,7,8,10)
declare %White7[7] := (0,1,3,5,6,8,10)

$Mod := $FirstNote mod 12

select ($Mod)
case 0
$Count1 := 0
while ($Count1 < 7)
%White[$Count1] := %White1[$Count1]
inc ($Count1)
end while
case 2
$Count1 := 0
while ($Count1 < 7)
%White[$Count1] := %White2[$Count1]
inc ($Count1)
end while
case 4
$Count1 := 0
while ($Count1 < 7)
%White[$Count1] := %White3[$Count1]
inc ($Count1)
end while
case 5
$Count1 := 0
while ($Count1 < 7)
%White[$Count1] := %White4[$Count1]
inc ($Count1)
end while
case 7
$Count1 := 0
while ($Count1 < 7)
%White[$Count1] := %White5[$Count1]
inc ($Count1)
end while
case 9
$Count1 := 0
while ($Count1 < 7)
%White[$Count1] := %White6[$Count1]
inc ($Count1)
end while
case 11
$Count1 := 0
while ($Count1 < 7)
%White[$Count1] := %White7[$Count1]
inc ($Count1)
end while
end select

if ( $WhiteNotesOnly = 1)
$Count2 := 0
while ($Count2 < 8 )	
$Count1 := 0
while ($Count1 < 7)
!names2[%White[$Count1]+($Count2 * 12)] := !names[$Count1+($Count2 * 7)]
inc ($Count1)
end while
inc ($Count2)
end while
else
$Count1 := 0
while ($Count1 < 88 )
!names2[$Count1] := !names[$Count1]
inc ($Count1)
end while
end if

end on

on note
message(!names2[($EVENT_NOTE -$FirstNote)]) 
end on
_


----------



## mk282 (Jan 8, 2015)

Why eight different "white" arrays?


----------



## Mika31sens (Jan 8, 2015)

Because the possibility of different first key : c,d,e,f,g,a,b (for white keys only)


----------



## mk282 (Jan 9, 2015)

I don't think you need so many different arrays for that case - you only need one, and then you just need to start from a different position in that array...


----------

