This weekend I was able to refactor my code so it included greater amounts of detail in terms of frequency information being taken from the given audio source. Up until now, I was working with 512 samples divided into eight frequency bands which were looped through to edit the vertices on the mesh seen in prior videos. Now, I refactored the code to give me eight times the frequency information, a total of 4,096 samples divided into 8 sets of 8 arrays (or 64 arrays in total). The reason for maintaining the sets of 8 instead of going with a plain collection of 64 is to reuse much of the spectrum organization from the prior code as possible.
For example, the first set of eight arrays of frequency bands will represent the first 16 of 4,096 samples, while the eighth array will be the last 2,048 of 4,096 samples, so the higher frequencies, which our ears can perceive in greater detail, are represented accordingly.
The above code is the organization of the aforementioned changes. For the sake of this example, one tile is still in the scene, and an option called 'Band Selection' is listed at the bottom right of the image at the very bottom of the Unity Editor's Inspector column. This band allows the editor to select which band to use from the 8 sets created. For example, 0 is the first set, and only the very lowest frequencies analyzed in the given audio source will warp the mesh in the scene. In the following video, you can see the results of selecting different sets of frequency bands. Keep in mind, buffering will not affect this new code until I hook it up (next steps), hence the video demonstrates sharper changes as seen in much earlier videos.
Bình luận