Midi note name.wav to midi note number.wav converter

N
Netanel posted Jun 16, 21:02:

Hello everyone :),

While converting sample libraries to the samplerbox-format I grew increasingly agitated to do it by hand.
Every time I downloaded a patch in sfz format for example, the file were usually given a name like this:
Cello_A3.wav

so to convert it, I had to check the midi note number value for A3, and convert it to the appropriate number. And unless I'm writing a definition file, I also had to delete the "Cello_" part.. Very annoying when you have a lot of files!
So I wrote a python script to do it for me. it doesn't support flat notes. such as "Bb4" only sharps. also it doesn't work for sensitivity layered instruments. I'm also not nearly smart enough to write an algorithm for the conversion, so I did it with a standard python dictionary. I know, It's primitive. But it does the job.

To use, simply copy the script to the folder where you have the .wav files, and run it.
The script is in github. Maybe someone can make it better

R
remi posted Jun 17, 14:36:

Hi thanks for the script!
it seems that since joseph makes the Grand Piano samples, you can either use midi note or ... (I don't know the name) A3/A#3 etc...

N
Netanel posted Jun 17, 16:16:

Oh man. I feel really stupid now. Its just that since there's no official change log I never know when Joseph implements new features. Maybe because there's so many haha.
Does it work if the name contain something other than the note, like this?:
Example-c4_example.wav
I'm on a trip currently so I'm far away from my pi and can't check...
BTW, this form of notation: A3/G#5 etc, is called scientific pitch notation. A bit of a mouthful lol.

J
joseph posted Jun 17, 16:32:

Hi!
Yes I should do a changelog! ;)
If your files are Example-c4_example.wav, Example-d#2_example.wav, etc., here is how your definition.txt file will look like:

Example-%notename_example.wav

But still, your Python script will be useful @Netanel when we sometimes want to rename filenames! Thanks for sharing it on Github!

...

  (not published)
  I want to post as guest
 

Post