#COMPILE EXE #DIM ALL FUNCTION PBMAIN () AS LONG GOTO Jump2 '--------------------------------------------------------------------------------------------------------- ' first attempt to do something musical with this all: ' find the 3 strongest spectral lines: ' not very convincing in the result... LOCAL n AS LONG LOCAL maxband AS SINGLE LOCAL maxtempo AS SINGLE n = 0 maxband = 0 REDIM tempo(0 TO 128) AS STATIC SINGLE REDIM strength(0 TO 128) AS STATIC SINGLE FOR i = 2 TO (UBOUND(spx)/2) - 2 ' 2 to 126 IF spx(i-2)< spx(i-1) THEN IF spx(i-1) < spx(i) THEN IF spx(i) > spx(i+1) THEN IF spx(i+1) > spx(i+2) THEN tempo(n) = i * 15 ' in MM units for the 4 sec. buffer strength(n) = spx(i) IF spx(i) >= maxband THEN maxband = spx(i): maxtempo = tempo(n) INCR n END IF END IF END IF END IF NEXT i IF maxtempo THEN Task(%Faust_Test_DFTmap).freq = maxtempo / 60 IF ISFALSE Task(%Faust_Test_DFTmap).swit THEN starttask %Faust_Test_DFTmap END IF ELSE IF Task(%Faust_Test_DFTmap).swit THEN stoptask %Faust_Test_DFTmap END IF END IF Task(%Faust_Test_DFTmap).level = maxband * 127 Jump2: