home

# THIS IS A WIP :) buffer-gen is a sort of long-term project of mine. Previous to this i haven't ever really tried to program anything from scratch. I've done a little bit of coding in the past but it was mostly very small scripts for larger projects, usually in max.
for this, I'm using Rust, which i am learning allong side my progress on this project. I am also a beinner coder so my code will by no means be good. I'm using the scope of this project as a tool for myself to be motivated to learn something challenging, which is the Rust programming language, as well as just coding concepts in general.

my aim is to create some software that can process and synthesize audio using non-realtime methods by freely passing buffers between modules. Ideally, the interface would present some sort of module node-based workflow, which would then be converted (somehow... havent figured that much out yet) into a network of modules passing buffers between each other, which would then synthesize/process audio according to the indicated signal flow. The important bit is that it's non-realtime.
an example use case would be to like... idk. generate a bunch of kick samples in bulk. You could establish some network of modules that generates a kick sample, and attach that network to a module that renders whatever network is above it in the chain multiple times. if you included a random source in that repeated network, you could generatively synthesize a bunch of kick samples in bulk.
or maybe you wanna normalize a bunch of samples at the same time, or do some wild convolution or feedback shit that isn't feasable with realtime audio.. idk. that's the goal. as i'm writing this i have the structure for the way modules interact with eachother to allow for (within reason) infinite inputs, outputs, and instances of modules, although i haven't gotten much past that. I'm uploading devlogs to an alternate youtube channel, here' sthe url to that channel:
alt youtube channel w/ devlogs

oh also here's a github repository if this ever gets to a point where it's actually usable (or if you just wanna look at my bad code)


update 12/12/24 ~2:00 am

ok so i just got a pseudo preset file working! very veyr very happy about this. my code, of course, is quite ass, but i'm honestly not too worried about that at the moment. I've got it able to load toml files formatted in a particular way as a preset, and parse that, then run the code and generate the audio. which is fucking. yes. it feels so real; liek i'm actually at the point where it's a real thing that is maybe useful.

here's the toml i've been testing everything with. It generates exactly half a second of +0.5 DC offset :3
I think the next things I wanna do would be to implement the sin function (probably just pasting the dsp code from previous iterations that were structured a lto differently), implement audio file imports, and have a way to do everything in bulk.

my thinking is that this "everything in bulk" idea would just take form as a singular module that take whanever chain exists above it and runs it multiple times while incrementing some value passed to each of the param modules it contains each time it runs. I'm not sure how this would work with the contents of the buffer cache since id want to be able to both overwrite shit and add new entries dynamically per iteration. it presents a challenge. I'm pretty sure I have something in place to facilitate the passing of some incremental value between module instances, so that shouldn't be an issue. OH as i'mw riting this i'm also thinking it would be a good idea to have a param_rand module that just generates a random value between two extremes. ill maybe do this tomorrow to get into the zone or whatever and then i'll get to it. actualy maybe this is harder than i think if i want the random value to be static and not change with each sample. hmm. ok well its 2 am and i need to sleep. gonna merge the branch i created for this particular feature and then sleep. it snowed tonight and i wanna get up somewhat early tomorrow morning and go for a walk before all the snow gets messiedup by peoples footprints.

oh also one more thing i may have already mentioned; he fact that i have an actual file *external* of the code means that trying to make a frontend for this is going to be a little bit more straightforward than I was initially thinking. I was expecting to have to be passing the module cache back and forth between a bunch of shit which would have been a nightmare with the borrow checker. since here the module cache is immutable it makes all of that soo much easier. nayways time to sleep good night meow meow


update 12/14/24 12:35 AM

ok so not as much progress as the last update but i am thinking about it so i'm just gonna write a quick one.

I got a sin function working and also the module that is able to do whatever exists above it in bulk. its called repeat. im pretty happy with it. using this I can generate say, 150 audio files, each containing a sine whos frequency increents by 50 hz for each consecutive audio file. it generates all of this reasonably quickly, so im excited to see how far i can optimize the code. to run as efficient as possible. or maybe not. idk. maybe that shouldnt be my main goal rn. but whatever, it works! I also implemented a noise module that just outputs white noise, a scale_static module that does the same thing as the scale module but with f32s as inputs instead of 4 extra signals to take from, and of course the param_rep module, which will return an incrementally larger number for each repetetion (or rep, as i'm calling it) thats invoked by the previously mentioned repeat module.

my next big task is to make a system that enables me to work with time-based stuff way more efficiently. with my current setup, say I wanted to have a ridiculously simple low pass filter. this requires a single-sample delay, which means I need to request two samples from the above module instead of just one, doubling the amt of work that has to be done by whatever modules exist above this hypothetical simple lpf.
ive gotta be able to memoize stuff on a per-module basis, which is difficult for me to figure out how to do since the module, because of the fact that the entire module chain is recursvie, has to go out of scope in order for another sample to be requested from it, which i think(???) means that i cant easily store values in an instance of the module. my idea earlier today was to instead store the input buffer information in an instance of a class that also defines the input parameters, but this is kinda ughhh icky maybe. idk. but yeah i really wwant to implement this memoization system before i try and do any seriously time-based processing so that i dont have to rewrite a bunch of code once i decide to optimize stuff. idk. still learning still learning still learning.

oh also i came up with a list of modules i want to implement at some point; some way more difficult than others. i'll probably start on all these way later on in the process but for now here's a list of all the shit i at some point wanna do (and feel liek i probably could do most of these with my current skill, maybe):