I was trying to make a virtual instrument patch playable via midi and that uses wav samples of each note of a real instrument.
Normally each sample would be called C1.wav C#1.wav D1.wav and so on, I've made a patch to transform from midi note number to note file name so it could fit into a message going to soundfiler like "read -resize $1 array1" where $1 is the name of the corresponding wav file.
It seems to be working, with the only flaw that it doesn't sound as immidiate, I think loading the file in the moment of the note being pressed creates a delay.
As workaround I was wondering if there was a more efficient way of managing the samples?
As I'm writing I've just thought I could load a really long array that stores all the notes wav files in consecutive order, and then just use math to play the segment that corresponds to the note. Would that imply it'll be monophonic though?
A last resort would be copying and paste the single voice with the soundfiler 36 times, one for each sample, and have them preload on start. But I'm sure there's a more elegant solution!
Thank you in advance, I feel both blessed and damned now that I've put myself into this puredata rabbithole