Loading resources in gen~


Thanks, this looks good as a starting point.

Hey @undefined,

I think I’ve got it to load WAVs, but it sounds like samples are played at very low frequency. Could you update the patch to make it play samples at native sampling rate? Not sure what’s the best way for that, but it might be something that you’ve used with previous patches that played hardcoded sample data.

If you’d like to test it yourself, currently it can only be used if you build patches offline. If you’re not familiar with that process or don’t want to deal with setting up compiler, it shouldn’t take too long to get this available for patches in public library. I just need to make sure that it sounds like it works at the very least.

Nice I’ll check it out, hopefully standalone patch compilation and upload isn’t that hard, don’t know if I have the time to set it up.
The patch I shared is meant to use the lich module knobs to increase and invert the sample playback. Maybe that works already. Otherwise I can make a hardcoded phasor frequency that plays the data contents in gen~.

Yes, hardcoded phasor speed that plays data as is would be perfect. If I can confirm that it works, we probably can have this in web patcher soon enough.

I was testing this with Genius that sets parameters to 0 by default, so it was not making any sound initially. When I’ve set one of them to maximum, sub-bass sounds was audible. I think that something is off with how it’s been playing, but something definitely was loaded.

ive uploaded a basic setup . Also threw in a [samplerate 44100] object for good measure. Using a phasor with a 0.35 rate to playback a sample thats about 124 thousand samples long (3 seconds)

I’ve opened a PR for Martin to review, but so far it seems to work for me.

The [samplerate] object doesn’t seem to do anything useful (I don’t see 44100 in exported code) and we can’t neither change patch’s samplerate nor support resampling in C++. But that’s not important here.

I suppose it should be possible to get the number of samples in a file and adjust phasor’s rate accordingly, because otherwise you get wrong playback speed for a different sample. I.e. for a short sample that I’ve used I had to change 0.35 to 5-6 to have reasonable playback speed.

wow exciting! Can’t wait to try it, will check how to set that stuff up locally!

@antisvin hiya well i spent the entire day trying to compile locally but it seems super difficult on windows. Is it really simple if you use linux and follow the instructions on the gitpage or are there a lot of gotchas? i made a topic about the troubles and now reading the tickets.

** i made some progress but Lich is erroring out after the patch send.
I assumed i need to upload a file called samplzz.wav that is formatted as 32bit raw. I used the webuploader for that - hopefully it isn’t autoconverting to raw. Will try that after I am sure my patch loads from local compiler are fine.

You have to use OwlProgram version from my branch to test. Or you could just replace the 2 files edited in that PR (GenSource/genlib.cpp and LibSource/WavFile.h)

Resource file should be named just samplzz - I understand that don’t can’t be used in gen~, but using extension in file name is not mandatory. Raw can mean different things, but we actually load normal WAV files. Also, you don’t have to change format to 32 bit, it can be in the most common 16 bit format or 8 bit too.

yep I am using your branch of course.

OK i thought I had to convert to RAW as stated in one of the posts before.