Searching Of Instruments

In an ideal world, we’d all be using a meta-tagged filesystem (or at least in combination with the traditional folder system). The benefits are massive - instant categorization and retrieval of files.

Since we don’t live in that ideal world, the next best thing is for programs to indirectly support the feature. Often, I’ll find that I can’t find the name of a particular instrument. The problem is exacerbated if you have hundreds or even thousands of instruments. What’s the solution?

Tags of course. I could give an instrument subjective words like bass, crunchy, short, echoey, sharp, noisy etc. However, despite Renoise’s ability to search for continuous strings. it won’t let you search for words which might appear in a different order.

Sure, extending the filename with extra keywords is a bit of a kludge, but it does work for now. My plea is for the next version of Renoise to allow any order of words to be allowed. For example, searching for “crunchy bass” could filter through an instrument that’s really called “Fatbass - bass percussive crunchy”, along with other instruments with those keywords. Think of Google, or a media player like Winamp, iTunes or MediaMonkey. They operate very similar.

The amount of code/time that would be needed to implement this is minimal at this stage. It would just require the search algorithm to be more flexible. At a later stage, the Renoise team could externalize the tags from the filename, but that’s no worry for now.

What do others think?

It’s called “fuzzy search” and it’s not that trivial to implement.
I am sure, there are some libraries out there which take care of the logic, but it’s always a question of compatibility, speed and memory usage.

(yes - i am a software developer, no - i am not involved in the development of renoise… so i can’t say more about this topic than that… sorry)

good idea nonetheless.

Marv.

Hmm… not quite sure if it’s as advanced as fuzzy. It’s only searching for each space separated word in the string.

With my example:

“crunchy bass”

It would just check to see if “crunchy” is inside: “Fatbass - bass percussive crunchy” AND also if the word “bass” is inside it too. If so, then it’s a match. Couldn’t be simpler (at least for now).

I have a very efficient and short C function (takes two strings and returns true or false) which I would more than happily donate to save the coders time on adding this, though it is quite easy to make. I’m just desperate to see it added because I can then start organizing my instrs properly. There’s no UI adding/rearranging stuff or datatype changing - it’s simply changing the existing search function to go that little bit further.

Pseudo code (working code) in the language everyone loves to hate, except me.

  
  
<?php <br />  
$mySearch = 'crunchy bass';  
$myDir = '/Users/dac514/Music/Instruments';  
  
// \w means alphanumeric characters.  
// Usually, non-English letters and numbers are included.  
// \W is the negated version of \w  
// mb_ is multibyte (i.e. utf)  
  
$results = array();  
$search = mb_split("\W", trim($mySearch));   
$matches = count($search);  
$files = scandir($myDir);  
  
foreach ($files as $file) {  
 $count = 0;  
 foreach ($search as $keyword) {  
 if (mb_stripos($file, $keyword) !== false) {  
 ++$count;  
 continue; // Possibly redundant  
 }  
 }  
 if ($count == $matches) $results[] = $file;  
}  
  
print_r($results); // Return this array  
  
?>  
  
  

Edit: minor fixes, annotated.

Yup that’s one way of doing it. The C code isn’t actually all that much longer either.

(I happen to love and hate PHP simultaneously ;) )