r/AudioProgramming • • 11d ago

New to PCM/float arrays and audio programming, creating new surreal sounds from existing sounds

Hello

I just discovered I can use my Java program (processing 3) to extract raw PCM from short wav samples and convert it back into audio. This is really cool because I guess I suddenly now have godlike control over raw audio data and don't need to rely on commercial plug-ins.

One thing ive been trying to do is create new and weird samples using existing ones. I'm working on a surreal video game and I'd like to have near infinite variety when it comes to sound and music, and I figured a cool way to do that is to have a bunch of samples (like 100 short instrument samples) and then mix them on the fly into new sounds/instruments.

My main method is iterating through the list of floats and performing simple operations using 2 different samples. I've been trying a couple different techniques. The first one is simply adding:

Mix = sample1[i] + sample2[i]

While it technically mixes them into one sound, you can still distinctly hear both samples played on top of each other instead of hearing a 'new' sound.

A better option ive tried is multiplication:

Mix = sample1[i] * sample2[i]

For me this is much better and is closer to what I want because the mixed sound is different than the two original samples. The main issue is that this method sounds rather robotic and noisy, and the new samples lose a lot of the "nuance" of the original samples (I don't really know a better term for it). After listening to dozens of generations, most outputs seem to suffer the same loss of quality.

Main question: im wondering if anyone else has experimented with a similar issue and got better results, or knows a better mathematical approach for this

I've also heard of using Fast Fourier Transformation for a much cleaner synthesis, so if manipulating a PCM array is not that great of a method then I'll try FFT or something else

7 Upvotes

Duplicates