From: Dennis S. <sy...@yo...> - 2005-03-07 19:50:31
|
Heya everyone. I wrote the first version of the new VisAudio API proposal. It's going to be a complete overhaul, and thus should be done right. PLEASE read this document, and comment upon it! Please confirm if it's good or not. there are some open questions, discuss these. I want to set this in stone, so we can start on it :) Cheers, Dennis The document: ==================================================================================== This document describes the initial VisAudio overhaul design. Version 0.1 Dennis Smit <sy...@yo...> Libvisual project leader _____________________________________________________________________________________ Goals: Ability to mix channels. Audio energy registration, calculation (already done). normalized spectrum (logified). Internally, use floats to represent audio. (from 0.0 to 1.0 or -1.0 to 1.0 ?) Use floats to represent the spectrum (from 0.0 to 1.0) Have conversion code to go from short audio to float. Basic conversion for the frequency (hz) of the input. BPM detection: http://www.gamedev.net/reference/programming/features/beatdetection/page2.asp Provide 6 vars to directly detect hits on the six bands. Open questions: How do we want to do the number of samples ? (aka the length of the buffer) How to handle multiple channels, channel mixing, how to handle 5.1, 7.1, 9.1 etc ? Internal audio representation: In floats. Fixed frequency ? (I personally prefer this) How large do we want our buffers ? API: enum { VISUAL_AUDIO_FROM_SIGNED_96000 VISUAL_AUDIO_FROM_SIGNED_48000 VISUAL_AUDIO_FROM_SIGNED_44100 VISUAL_AUDIO_FROM_SIGNED_32000 VISUAL_AUDIO_FROM_SIGNED_22500 VISUAL_AUDIO_FROM_SIGNED_11250 VISUAL_AUDIO_FROM_SIGNED_8000 VISUAL_AUDIO_FROM_UNSIGNED_96000 VISUAL_AUDIO_FROM_UNSIGNED_48000 VISUAL_AUDIO_FROM_UNSIGNED_44100 VISUAL_AUDIO_FROM_UNSIGNED_32000 VISUAL_AUDIO_FROM_UNSIGNED_22500 VISUAL_AUDIO_FROM_UNSIGNED_11250 VISUAL_AUDIO_FROM_UNSIGNED_8000 } VisAudioSoundImportType; VisAudio { VisObject object; float sound[3][2048]; float spectrum[3][256]; float spectrum_normalized[3][256] float energy; VisFFTState *fft_state; VisAudioBeat *bpm; }; VisAudioBeat { VisObject object; ... history[1024][6]; ... energy[6]; int bpm; int beat; int beat_channels[6]; // Set the specific channel on a beat int active_channel; float accuracy; }; /* Prototypes */ VisAudio *visual_audio_new (void); int visual_audio_analyze (VisAudio *audio); int visual_audio_sound_import (VisAudio *audio, VisAudioSoundImportType type, void *sound_buffer, int buffer_length); VisAudioBeat *visual_audio_beat_new (void); int visual_audio_beat_analyse (VisAudio *audio); |