Opening random (sound) files
I've got an interesting idea for a granular synthesizer that works by taking random chunks of randomly selected sound files and altering the length of the chunks based on the pitch input (could be from midi or wherever)
The immediate problem I'm running into, though, is how do I go about opening random sound files?
Is there any ls type function to determine the contents of a directory without user intervention?
Ideally the synthesizer would work by having the user enter a base path where all of the soundfiles live (possibly in subdirectories) and a randomize button that selects random files from within that path.
Reading random parts of the files is trivial with buffer~, but locating files at random is the part I can't wrap my head around.
Anyone have any ideas?
something like this? (based on umenu)
2009/1/2 kevin :
>
> I've got an interesting idea for a granular synthesizer that works by taking random chunks of randomly selected sound files and altering the length of the chunks based on the pitch input (could be from midi or wherever)
>
> The immediate problem I'm running into, though, is how do I go about opening random sound files?
>
> Is there any ls type function to determine the contents of a directory without user intervention?
>
> Ideally the synthesizer would work by having the user enter a base path where all of the soundfiles live (possibly in subdirectories) and a randomize button that selects random files from within that path.
>
> Reading random parts of the files is trivial with buffer~, but locating files at random is the part I can't wrap my head around.
>
> Anyone have any ideas?
>
On Jan 2, 2009, at 1:29 AM, kevin wrote:
> The immediate problem I'm running into, though, is how do I go about
> opening random sound files?
>
> Is there any ls type function to determine the contents of a
> directory without user intervention?
Yes, [folder]
Chris Muir
cbm@well.com
http://www.xfade.com
thanks for these.
samuel's is closer to what i was after (at least in functionality, both look like they could be doing nearly the same thing)
i was planning to use mp3 as the type though so I could direct it at my itunes library. also, limiting it to mp3 as opposed to aiff, wav AND mp3 means i can just use a straight import with the buffer instead of determining which open instruction to use.
trouble now is, for some reason i can't get mp3 to stick in the types field.. it's adding a space and quotes because it wants four letters for file type... i also tried MPEG to no avail =
For anyone following this, let's must make sure that we mention that loading any of those mp3 files into a buffer isn't done with the standard "replace" message, but "import" - and that the file's size will be expanded on importation to resemble WAV/AIFF file sizes.
it doesn't look like max-fileformats.txt lists mp3 as a type.
you could try adding it to this file, by copying and pasting the entry for .mpg and changing to .mp3.
might work
yes, gregory is correct, hence this statement:
> also, limiting it to mp3 as opposed to aiff, wav AND mp3 means i can just use a straight import with the buffer instead of determining which open instruction to use.
i probably should have been more clear and put import in quotes, since it is a message.
thanks for helping to clarify.
rob, i'll give that a shot now. thanks.
since i got some fun stuff working, i figure i'd post a (very) rough working version..
drop a folder with aiff files into the drop box, click up the faders, select the midi interface of choice, and bang around.
the left lone fader at the bottom changes the playback rate of the grains as well as their size in an attempt to maintain a one-loop-length to one wavelength ratio.
it's super fugly right now, but considering school starts today and i probably won't fix it up for a while, i thought i'd share what you guys contributed to.
the button tied to randomize sends a new granule start point to every buffer, and the button before the delay reloads 4 new grain sources.
oh (too bad i can't edit my post), and if you want to use mp3s as source instead of aiff (right now its one or the other), disconnect the rightmost random object from the rightmost umenu, and connect the leftmost random object to the leftmost umenu.
i've been successfull with my whole itunes library (6000+ songs), but importing from mp3s is SUBSTANTIALLY slower than reading aiffs.
in fact, unless you're on a fancy mac pro, max will probably hang while it's importing. be patient, it won't crash.