Is it possible to make an Audio Spectrum Analyzer in th blender game engine? Thank you!
EDIT: sorry for the briefness but im pressed for time.
You can bake an static IPO curve from an audio file.
If you want a dynamic FFT then you can try to use numpy.fft.
Here a Pygame sample code. I don’t tested it in Blender.
You must install Pygame and Numpy to get the code work. Instade of Pygame you can try to change the code to run with the Blender Audaspace library (aud) http://www.blender.org/documentation/blender_python_api_2_60_release/aud.html
import pygame
import pygame.mixer
import pygame.sndarray
import numpy
from numpy.fft import fft
# Initialize mixer
pygame.mixer.init()
# Load a sound
sound = pygame.mixer.Sound("/sound/sound.wav")
# Put it in an array
a = pygame.sndarray.array(s)
a = numpy.array(a)
left = a[:,0]
right = a[:,1]
# Get playback frequency
nu_play, format, stereo = pygame.mixer.get_init()
# Time resolution of frequency analysis (s)
sample_length = 0.1
sample_num = int(sample_length*nu_play)
# n to frequency
frequency = numpy.arange(sample_num/2)/sample_length
# Get first bin, left channel
spectrum = fft(left[:sample_num])
positive = spectrum[1:1+sample_num/2]
power = (positive*positive.conj()).real
thank you!, i’ll try it out when i get back, thank you!