schrum2 / MM-NEATv2

MM-NEAT version 2.0 is no longer supported. Please get MM-NEAT 3+ from https://github.com/schrum2/MM-NEAT
Other
11 stars 5 forks source link

Sound remixing version of breedesizer #316

Closed schrum2 closed 7 years ago

schrum2 commented 7 years ago

I'm not sure if this should be a separate task or an option we can turn on/off for breedesizer. However, we should create a way of taking a sound file and remixing it. I can think of two ways of doing this, and both should be toyed with using randomly generated CPPNs to start.

One way is to have the amplitude value from a wave file be a CPPN input in addition to the bias, time, and sin(time).

Another way, which could be combined with the first, is to interpret the output of the CPPN not as an amplitude wave itself, but as an offset to the amplitude of the original sound file, so you would loop through the length of the input sound's amplitude wave and add the offset from the CPPN at every time step.

twerisa commented 7 years ago

If current approach does not work, then consider taking WaveFile class from this link: https://stackoverflow.com/questions/39313634/extract-amplitude-array-from-a-wav-file-using-java

twerisa commented 7 years ago

Figured out that the Remixbreeder only worked not just for 16 bit, mono files, but also only for files with a sample/frame frate of 44100 Hz. This turned out to be an issue with the formatting of the SourceDataLine, because in PlayDoubleArray it was initialized at a constant format of 44100 Hz, 16 bit, and mono channel. Created a public method that sets the format of the line to the format of the file specified in the parameters of Remixbreeder. This fixed the issue for files with a sample/frame rate other than 44100 Hz, but the code still doesn't work for 8 bit WAV files. The next (and maybe last?) steps in this issue are to figure out how to play ALL possible formats of WAV files, add a button on the screen that can play the original sound, and comment/clean up/generalize code.

schrum2 commented 7 years ago

Successful completion of this issue depends on the completion of #340 since we need to be able to load and playback the original sound properly.

Also, I'm still a little suspicious about how sounds are currently fed into the CPPNs. I suspect that the sample rate may not be set right. It should probably be an argument sent to the CPPN playing methods.

schrum2 commented 7 years ago

Even though the results are not what we want, I think that what you have created does technically resolve the outstanding issues with this task. If we have a flash of insight on how to improve the sound remixer, then we can try again, but for now I am closing this issue.