forked from expertsleepersltd/distingEX_tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbliss2_to_ex.py
35 lines (27 loc) · 916 Bytes
/
bliss2_to_ex.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import glob, os, math
subtitutions = []
velocity_switches = 3
start = 0
step = math.floor( 0.5 + 128/velocity_switches )
for i in range(velocity_switches):
end = min( 127, start + step - 1 )
subtitutions.append( [ '_%d_%d' % (start,end), '_V%d' % (i+1) ] )
start = end + 1
notes = [ chr(ord('A')+i) for i in range(7) ]
octaves = range(10)
for octave in octaves:
for note in notes:
if note not in [ 'E', 'B' ]:
subtitutions.append( [ "_"+note+"#"+str(octave)+"_"+note+"#"+str(octave), "" ] )
subtitutions.append( [ "_"+note+str(octave)+"_"+note+str(octave), "" ] )
print( subtitutions )
files = glob.glob( "*.wav" )
for file in files:
new_name = file
for s in subtitutions:
new_name = new_name.replace( s[0], s[1] )
bits0 = new_name.split( '_' )
bits1 = bits0[0].split( ' ' )
new_name = bits1[0] + '_' + '_'.join( bits0[1:] )
print( file + "\t-> " + new_name )
os.rename( file, new_name )