On 19/03/2025 11:14, Alexandros Drymonitis wrote:
I'm further developing [neuralnet] to include variational autoencoders. Trying to train it on audio, I want to be able to read audio files without using Pd's [readsf~]. I have managed to read unsigned 16-bit WAV files inside the object, but when I'm trying to store the values to the object as a training dataset, Pd crashes, and I think this is related to memory reallocation.
i haven't checked the code, but three things that come to my mind are:
- learn (basic) usage of a debugger. the simplest one os of course the printf-debugger, but it only gets you so far. otoh "gdb" is a mighty beast, but for getting a basic backtrace of a crashed program you only need to learn 3 or so commands.
- for memory issues, learn to use valgrind. it will tell you all kinds of memory problems in your code (and in libraries used, so there might be a number of false positives, but the output is readable enough to quickly find any problems related to *your* code)
needless to say, that you shouldn't only *learn* how to use these tools, but also actually *use* them (in the case of valgrind, I would say there's practically no need to "learn", as usage is dead simple; you just run "valgrind pd" instead of "pd"). i exclusively use these tools from the cmdline, but there might be graphical front-ends, idk.
- finally, i honestly believe you are suffering from NIH-syndrome. you really should rethink your design: rather than spending time on debugging what went wrong with reading unsigned 16bit WAV files, you could just use tables pre-populated by [soundfiler] - and hey, you would get support for SND, AIFF, CAF and even text files *for free*, and not only 16bit but also 24bit and 32bit. and with the use of 3rd party externals, there would be FLAC And mp3 and ogg and whatnot support.
gfmdsar IOhannes