Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Multimedia (https://www.delphipraxis.net/16-multimedia/)
-   -   Scrolling Spectrum (https://www.delphipraxis.net/179080-scrolling-spectrum.html)

Abversoft 13. Feb 2014 08:53

Scrolling Spectrum
 
Liste der Anhänge anzeigen (Anzahl: 1)
Hat Scroll Spectrum , sondern kann `t Arbeit ordnungsgemäß umzusetzen Daten.
Hilfe , es zu verstehen

Medium 13. Feb 2014 09:20

AW: Scrolling Spectrum
 
I have no idea what language you translated that from, but it is gruesome. If you can speak English, please feel free to do so here. A lot of the people here will understand it better than what your translator garbles out. Even this short sentence is almost illegible, I don't want to know what happens if things need to be discussed in more detail :).

From what I can tell, you have some problems with the component you attached. Please be A LOT more specific about what EXACTLY is the problem. A general question like "doesn't work, what to do?" just can't be answered. Especially since this seems not to be a component that is widely used and known.

Abversoft 13. Feb 2014 09:44

AW: Scrolling Spectrum
 
Zitat:

Zitat von Abversoft (Beitrag 1247695)
Hat Scroll Spectrum , sondern kann `t Arbeit ordnungsgemäß umzusetzen Daten.
Hilfe , es zu verstehen

Did Scroll Spectrum, but I can not do the right job with the data.
Please help me in this

DeddyH 13. Feb 2014 09:56

AW: Scrolling Spectrum
 
There are several examples in this forum: Hier im Forum suchenScrolling Spectrum

Abversoft 13. Feb 2014 10:14

AW: Scrolling Spectrum
 
Zitat:

Zitat von DeddyH (Beitrag 1247714)
There are several examples in this forum: Hier im Forum suchenScrolling Spectrum

Seen, but it's not what I need

Medium 13. Feb 2014 17:21

AW: Scrolling Spectrum
 
Then what do you need? We can do marvelous things here, but reading minds ain't one. Why do so many people have such problems simply stating what they want to do, and what happens instead? Escapes me entirely.
When in doubt, post code, mark the line where compiling fails or a runtime error appears, and copy&paste the error message(s) underneath. Even if it's just that output differs from expectation, at least SOME information about what you did would be greatly appreciated. And by that I, of course, mean code.

Abversoft 13. Feb 2014 18:46

AW: Scrolling Spectrum
 
Liste der Anhänge anzeigen (Anzahl: 2)
Zitat:

Zitat von Medium (Beitrag 1247781)
Then what do you need? We can do marvelous things here, but reading minds ain't one. Why do so many people have such problems simply stating what they want to do, and what happens instead? Escapes me entirely.
When in doubt, post code, mark the line where compiling fails or a runtime error appears, and copy&paste the error message(s) underneath. Even if it's just that output differs from expectation, at least SOME information about what you did would be greatly appreciated. And by that I, of course, mean code.

Below is a code that allows you to create motion Spectrum. The problem is that it is wrong to count the data. As a result, Spectrum does not look believable.


var
Form1 : TForm1;
Mp3Len : Cardinal;
XPos : Integer = 0;
aLevel : Cardinal;
aLeft, aRight: single;
WaveOscil : TWaveData;
wavebufL, wavebufR: array of smallint;
ArrWaveL, ArrWaveR: array of array of Integer;

procedure DrawLine(Canvas: TCanvas; X, Y, X2, Y2: Integer);
begin
Canvas.MoveTo(X, Y);
Canvas.LineTo(X2, Y2);
end;

{Draw waveforms}

procedure TForm1.Draw;
var
i, j, y : integer;
WvWig : integer;
L, R, aL, aR : SmallInt;
VisBuff : Tbitmap;
Sample : Smallint;
begin
VisBuff := CreateBmp32(PaintBox2.Width, PaintBox2.Height);
y := (PaintBox2.height - 2) div 2;
WvWig := Round(PaintBox2.Width / WvSpeed);

VisBuff.Canvas.Brush.Color := 0;
VisBuff.Canvas.Pen.Color := $00E6C62D;
VisBuff.Canvas.FillRect(VisBuff.Canvas.ClipRect);
for j := 0 to WvSpeed do
begin

Sample := MulDiv(128, Smallint(LOWORD(WaveOscil[j])), 32768);
if Sample < Low(ShortInt) then
Sample := Low(ShortInt)
else if Sample > High(ShortInt) then
Sample := High(ShortInt);
//-----------------------
L := SmallInt(Loword(WaveOscil[j]));
R := SmallInt(Hiword(WaveOscil[j]));
aL := (trunc(((L ) / (65535)) * y));
// aL := Abs(Trunc(L/32768*50));
aR := (trunc(((R) / (65535)) * y));
//----------------------------
ArrWaveL[j][0] := aL;
ArrWaveR[j][0] := aR;

for i := 0 to WvWig do
begin
ArrWaveL[j][WvWig - i] := ArrWaveL[j][WvWig - i - 1];
ArrWaveR[j][WvWig - i] := ArrWaveR[j][WvWig - i - 1];
end;

end;

for i := 0 to WvWig do
begin
for j := 0 to WvSpeed do
begin
DrawLine(VisBuff.Canvas,
i * WvSpeed + j, y div 2,
i * WvSpeed + j, (y div 2) + ArrWaveL[j][WvWig - i]);

DrawLine(VisBuff.Canvas,
i * WvSpeed + j, y div 2,
i * WvSpeed + j, (y div 2) - ArrWaveL[j][WvWig - i]);

DrawLine(VisBuff.Canvas,
i * WvSpeed + j, (VisBuff.height div 2) + (y div 2),
i * WvSpeed + j, (VisBuff.height div 2) + (y div 2) + ArrWaveR[j][WvWig -
i]);

DrawLine(VisBuff.Canvas,
i * WvSpeed + j, (VisBuff.height div 2) + (y div 2),
i * WvSpeed + j, (VisBuff.height div 2) + (y div 2) - ArrWaveR[j][WvWig -
i]);

end;
end;

BitBlt(PaintBox2.Canvas.Handle, 0, 0, VisBuff.Width, VisBuff.Height,
VisBuff.Canvas.Handle, 0, 0, srccopy);
VisBuff.Free;

end;

See the compiled example

Medium 13. Feb 2014 21:18

AW: Scrolling Spectrum
 
Two things first:
1) This is not a spectrum. It is the waveform, which is the time-amplitude diagram of a sound. A spectrum would be a time-frequency diagram.
2) I do not understand so far, why your arrays "ArrWaveX" are two-dimensional. The following piece actually shows that it shouldn't be:
Delphi-Quellcode:
      for i := 0 to WvWig do
        begin
          ArrWaveL[j][WvWig - i] := ArrWaveL[j][WvWig - i - 1];
          ArrWaveR[j][WvWig - i] := ArrWaveR[j][WvWig - i - 1];
        end;
Here, you set all values of all dimensions (apparently "WvWig" many, where ever that value comes from) the same as their first. Why? You only need that first value. You also go ahead and paint all the dimensions, which could cost you a lot of performance, but does nothing to the output.

But your main issue seems not to be included in the code you have shown. Since you do properly start from 0 everywhere, it appears that the original waveform buffers ("wavebufX") were already filled only in their last half. It's a bit hard to tell, because a number of global variables come into play here, which are not explained anywhere.

More importantly: You seem to not initialize your arrays "ArrWaveX" anywhere. It's a small miracle this doesn't blow up at runtime, and might even be part of the problem. You even access a negative index in the snippet above, which also might cause you your troubles. I would try to fix these first, and see what the result is.
In the end, your waveform doesn't look bad at all. It's just that the first half seems to be missing, and of course it's a waveform. Not a spectrum.

Abversoft 13. Feb 2014 21:47

AW: Scrolling Spectrum
 
Liste der Anhänge anzeigen (Anzahl: 2)
Zitat:

Zitat von Medium (Beitrag 1247796)
Two things first:
1) This is not a spectrum. It is the waveform, which is the time-amplitude diagram of a sound. A spectrum would be a time-frequency diagram.
2) I do not understand so far, why your arrays "ArrWaveX" are two-dimensional. The following piece actually shows that it shouldn't be:
Delphi-Quellcode:
      for i := 0 to WvWig do
        begin
          ArrWaveL[j][WvWig - i] := ArrWaveL[j][WvWig - i - 1];
          ArrWaveR[j][WvWig - i] := ArrWaveR[j][WvWig - i - 1];
        end;
Here, you set all values of all dimensions (apparently "WvWig" many, where ever that value comes from) the same as their first. Why? You only need that first value. You also go ahead and paint all the dimensions, which could cost you a lot of performance, but does nothing to the output.

But your main issue seems not to be included in the code you have shown. Since you do properly start from 0 everywhere, it appears that the original waveform buffers ("wavebufX") were already filled only in their last half. It's a bit hard to tell, because a number of global variables come into play here, which are not explained anywhere.

More importantly: You seem to not initialize your arrays "ArrWaveX" anywhere. It's a small miracle this doesn't blow up at runtime, and might even be part of the problem. You even access a negative index in the snippet above, which also might cause you your troubles. I would try to fix these first, and see what the result is.
In the end, your waveform doesn't look bad at all. It's just that the first half seems to be missing, and of course it's a waveform. Not a spectrum.

I agree with you that this is not the spectrum .
ArrWaveX array initialized with the compiled example.

I should be grateful if you helped implement motion Wave In accordance music.
I need to get a result such as in the picture

Abversoft 15. Feb 2014 09:22

AW: Scrolling Spectrum
 
looked examples http://www.delphipraxis.net/89231-%5...-spectrum.html.
These examples all pull Wave, then when the music played occur scrolling . Possible to do so when the music played only occurred scrolling spectrum


Alle Zeitangaben in WEZ +1. Es ist jetzt 18:37 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz