Cabbage Logo
Back to Cabbage Site

File analysis, file dropping, dynamic function table replacement and sizing, AAAGH HELP

Hi there
I am relatively new to csound and cabbage, but have been throwing myself to the wolves with it. Im taking the class for it at Berklee, and for part of my final, I set out to make a sampler that allows me to “re-time” a sample by giving it an original BPM and length in beats, and then using the host bpm and a new length in beats. The idea is to be able to set them all to wacky uneven lengths and create long looping polymetric textures.

in the current state, I have used sndwarp to allow for realtime change of the speed using a phasor as the time pointer, and then passing that on to a pvsanal-pvsynth combo for realtime pitch control, since it seems you can’t really do that with JUST sndwarp

the hurdle I’m running into is that I really would like to have drag and drop functionality, and I took the bit from the Rory Walsh live style sample for the mouse bounds condition, and in that same if statement I am sending it to file analysis with goto. The problem is that for whatever reason, no matter where I put the file string, it will not get past the init pass because the labeled section doesn’t have the file to analyze; I get the can’t open from file error

also just generally on top of this, I feel like I have a bad case of not knowing what I don’t know, and I imagine my overall solution to this project is not very elegant, especially with handling doing the function table for the sndwarp AND the soundfiler for just the display. I know its a lot of code to sift through, but I could REALLY use some guidance on this, as I’m kinda in too deep to switch to a totally new idea this late in the semester…

this csd is just the code for a single sampler, and I tried my hardest to document thoroughly. If anyone could help me out with this I would be forever grateful. I really really want this idea to work!

Polymetric Sampler V2.csd (5.8 KB)

I’m just looking through the code now. And one thing strikes me as odd. You’re testing the last file dropped in the sampler instrument, which only gets triggered when you play a note. File dropped logic should really go into an always on instrument. Can you try putting this code into the ‘play’ instrument? I’m pretty sure this is what I do in the live sampler example too. I think each ‘sampleSlot’ instrument is always on?

Do you think it would make more sense to use global varibles then? Cuz with my current setup I think I had it there because I needed to pass on iLength to all the other things, so I structured it so that its in the labeled section where it is

I do see my mistake in puting it in the same place that isn’t on UNTIL the play button is hit, thanks for that haha

What are your thoughts on everything else? I feel like I’m trying to shoehorn one solution when there might be better way. I particularly have a feeling that I’m handling the function table wrong/ could handle it more elegantly, idk

Thank you so much for your help, Rory!

The other things look Ok tbh. I don’t think you need any global variables. Try to get the waveform to display properly and work from there. Let me know if you get that far and still have issues :+1:

1 Like