I'm new in this forum. I'm Italian, so sorry for my english.
This post is to announce that I just started to work on London Philarmonia Orchestra samples to create a new Open Orchestra optimized for Linux.
I wrote a script in python to automatically create the sfz files. I used ffmpeg to convert mp3 files to wav. You can download zip packages with mp3 samples from the website above selecting ONLY the instrument and clicking on the link at the top of the table; put them in a new directory, unzip and launch the script.
I can control 'velocity', 'lokey', 'hikey' and 'pitch_keycenter'. I'm going to control also the 'tune' option using aubio.
Ihave to say, I'm not very expert with sfz files, so I would ask you all to help me on some points.
1) Is it possible to use multiple sample per note in one sfz files? for example, I have 4 sample of the note e4. Can I insert all them in a sfz to play simultaneously all the samples?
2)what options would you use to create this orchestra from London Philarmonia samples?
3)Do you want help me?
Here the script I wrote in python:
Code: Select all
#! /usr/bin/env python
#
#
#Copyright 2012
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#any later version.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details, <http://www.gnu.org/licenses/gpl.txt>.
import os
import re
import subprocess
articulation={'1': 'normal', '2': 'legato', '3': 'nonlegato', '4': 'staccato', '5': 'staccatissimo', '6': 'tongued_slur', '7': 'tenuto', '8': 'double_tonguing', '9': 'triple_tonguing', '10': 'fluttertonguing', '11': 'vibrato', '12': 'glissando', '13': 'harmonic', '14': 'major_trill', '15': 'minor_trill', '16': 'tremolo', '17': 'subtone', '18': 'multiphonic', '19': 'air_note', '20': 'slap_tongue', '21': 'key_click', '22': 'growl', '23': 'mute', '24': 'phrase', '25': 'breath_attacks', '26': 'bucket mute', '27': 'cup mute', '28': 'harmon mute', '29': 'waa-waa mute', '30': 'plunger mute', '31': 'wooden mute', '32': 'metal_mute', '33': 'scraped', '34': 'rubbed', '35': 'squeezed', '36': 'blown', '37': 'bowed', '38': 'with_snares', '39': 'without_snares', '40': 'struck_together', '41': 'struck_singly', '42': 'shaken', '43': 'hummed', '44': 'plucked', '45': 'damped', '46': 'undamped', '47': 'clean', '48': 'effect', '49': 'roll', '50': 'flam', '51': 'rhythm', '52': 'rimshot', '53': 'centre', '54': 'muffled', '55': 'ruff', '56': 'body_of_instrument', '57': 'mouth', '58': 'brushes', '59': 'hotrods', '60': 'rute', '61': 'snare_sticks', '62': 'hard_mallet', '63': 'vibe_mallet_damped', '64': 'vibe_mallet_undamped', '65': 'soft_sticks', '66': 'medium_sticks', '67': 'soft_beaters', '68': 'hard_beaters', '69': 'sticks', '70': 'vibe', '71': 'bass_drum_mallet', '72': 'vibe_mallets', '73': 'body', '74': 'hand', '75': 'hard_sticks', '76': 'pres de la table', '77': 'bisbigliando', '78': 'harmonics', '79': 'strumming', '80': 'struck_body', '81': 'struck_strings', '82': 'pizzicato', '83': 'snap', '84': 'rasguardo', '85': 'trill', '86': 'with_couplers', '87': 'arco_major_trill', '88': 'arco_minor_trill', '89': 'arco_glissando', '90': 'arco_harmonic', '91': 'arco_normal', '92': 'arco_au_talon', '93': 'arco_punta_darco', '94': 'arco_col_legno_tratto', '95': 'arco_col_legno_battuto', '96': 'arco_sul_ponticello', '97': 'arco_sul_tasto', '98': 'arco_detache', '99': 'arco_legato', '100': 'arco_tenuto', '101': 'arco_portato', '102': 'arco_staccato', '103': 'arco_spiccato', '104': 'arco_martele', '105': 'arco_ricochet', '106': 'arco_tremolo', '107': 'pizz_normal', '108': 'snap_pizz', '109': 'pizz_tremolo', '110': 'pizz_quasi_guitar', '111': 'molto_vibrato', '112': 'non_vibrato', '113': 'pizz_glissando', '114': 'harmonic_glissando', '115': 'con_sord', '116': 'natural_harmonic', '117': 'artificial_harmonic', '118': 'behind_bridge', '119': 'on_bridge', '120': 'tailpiece', '121': 'striking_strings', '122': 'chord' }
def CreateSfz(directory):
#"Main function to create sfz files in london philarmonia instrument directory"
name=directory[13:-16]
os.mkdir(name)
for art in articulation.keys(): #selecting articulation
v=0 #number of different velocity for articulation
samples=[] #this is the list of tuples wich will contain (velocity, 'note', 'file'), see line 25
notes=[]
for vel in range(5,11): #selecting velocity
flag=0
regex=re.compile('.*_[^7]_%d_'%vel+art+'.mp3') #this '7' corresponds to "phrase"...
for FILE in os.listdir(directory):
if regex.match(FILE):
flag=1
ffmpeg=['ffmpeg', '-i', directory+'/'+FILE, name+'/'+FILE[:-3]+'wav']
print 'Converting '+FILE+' to wav...\r',
p=subprocess.Popen(ffmpeg, stdout=subprocess.PIPE, stderr=subprocess.STDOUT).communicate()[0]
samples.append(FILE[:-4]+'.wav')
notes.append((vel, FILE.split('_')[2]))
#selecting files corresponding to articulation and velocity, saving with (velocity, 'note', 'file')
if flag==1: v+=1
if v!= 0:
OrchestraSfz(samples, notes, v, art, name) #notes is sorted using the first element of tuples, in this case velocity
# SoloSfz(notes, v, art, directory)
def OrchestraSfz(samples, notes, v, art, name):
#"Create sfz for solo instrument, choicing a pseudo-casual sample to use"
out_file=open(name+'-'+articulation[art]+'.sfz', 'w') #directory[13:-16] is the instrument name
old_vel=''
hivel=0
t=0
j=0
samples.sort
notemap=sorted(set(notes))
print '\nCreating '+out_file.name+'...'
for a in notemap: #taking parameters to print the sfz file
note=int(a[1])
vel=a[0]
if vel != old_vel: #velocity!
j+=1
lovel=hivel+1
hivel=(127/v)*j
if j==v: hivel=127
out_file.write('<group>\nlovel=%d\nhivel=%d\n\n'%(lovel, hivel))
old_vel=vel
last=0
if last==0: #lokey and hikey
lownote=0
else:
n=(note-last)/2
if ((note-last)%2)==0: n-=1
lownote=note-n
i=notemap.index(a)
if i != (len(notemap)-1):
Next=int(notemap[i+1][1])
n=(Next-note)/2
highnote=note+n
if notemap[i+1][0] != vel:
highnote=127
else:
highnote=127
regex=re.compile('.*%d_.?_%d_'%(note, vel)+art+'.wav') #sample file name
for b in samples:
if regex.match(b):
# smpl=os.path.abspath(name)+'/'+b[2]
smpl=os.path.relpath(name)+'/'+b #use this for relative path name
out_file.write('<region>\nsample=%s\nlokey=%d\nhikey=%d\npitch_keycenter=%d\n\n'%(smpl, lownote, highnote, note))
last=note
i+=1
out_file.close()
LIST=os.listdir('.')
for i in LIST:
if i[-4:]=='.zip':
continue
# os.chdir(i)
CreateSfz(i)
# os.chdir('..')