.png)
En la imagen se ve el Spectum Analyzer en azul, y sobre la consola otro proyecto con fin ilustrativo)
Recordé que el proyecto Delphamp (que es un Winamp v1~ escrito en Delphi) tiene dicha visualización sin realizar por si mismo ninguna transformación, en cambio utiliza una librería llamada FMOD que entre otras cosas, realiza la DSP FFT. Con ésta interesante librería tampoco es necesario encargarse del Streaming multimedia.
program Spectrum; {$apptype console} uses Windows, fmod, fmodtypes; var Screen: array [0..80 * 25 - 1] of TCharInfo; procedure WriteXY(const X, Y: SmallInt; AsciiChar: Char; Attributes: Word = FOREGROUND_BLUE); var Index: Cardinal; begin Index := Y * 80 + X; Screen[Index].AsciiChar := AsciiChar; Screen[Index].Attributes := Attributes; end; type TSingleArray = array [0..511] of Single; const NumFreq = 18; BlockFreq = 128 / NumFreq; var ConsoleCursorInfo: TConsoleCursorInfo = (dwSize: 1); Rect: TSmallRect = (Left: 0; Top: 0; Right: 79; Bottom: 24); Single: System.Single; hOutput, x, y, Value: Integer; Vector: ^TSingleArray; begin hOutput := GetStdHandle(STD_OUTPUT_HANDLE); SetConsoleCursorInfo(hOutput, ConsoleCursorInfo); FSOUND_Init(44100, 2, 0); FSOUND_Stream_Play(FSOUND_FREE, FSOUND_Stream_Open('Every little thing is gonna be all right.mp3', FSOUND_NORMAL, 0, 0)); FSOUND_DSP_SetActive(FSOUND_DSP_GetFFTUnit, True); repeat Sleep(55); // do you remember [int 1Ch] ? Vector := Pointer(FSOUND_DSP_GetSpectrum); FillChar(Screen, SizeOf(Screen), 0); for x := 0 to (NumFreq - 1) do begin Single := 0; Value := Trunc(x * BlockFreq); for y := 0 to Trunc(BlockFreq) do if Vector[y + Value] > Single then Single := Vector[y + Value]; Single := 60 * Single; if Single > 16 then Single := 16; Value := 16 - Trunc(Single); for y := 0 to (Value div 2) - 1 do WriteXY(x, y, #219); if (Value mod 2) <> 0 then WriteXY(x, Value div 2, #223); WriteXY(x, 8, #223); end; for y := 0 to 7 do WriteXY(18, y, #219); WriteXY(18, 8, #223); Inc(Rect.Right); Inc(Rect.Bottom); WriteConsoleOutput(hOutput, @Screen, PCoord(@Rect.Right)^, PCoord(@Rect)^, Rect); until FSOUND_GetChannelsPlaying = 0; FSOUND_Close; end.
FMOD se descarga de aquí, en cualquier caso solo es necesaria la librería.
Enjoy!