DonNews #11
21 апреля 2000

coding - The algorithm of spectral analysis of sound in real time.

<b>coding</b> - The algorithm of spectral analysis of sound in real time.
2000 TheRom / OHG


     Hi coders, people and Snake ^ y.


  Algorithm for spectral analysis of sound

            real-time.


  We will do the audio spectrum analyzer (such a shifty strips 
to the music. centers who jump to the music and illiterate 
people call their EQ). 


  The algorithm is simple.


  From the viewpoint does not understand
Codes Mathematics:

1. Rear of the function y = f (x), interval delta x
too ask.

2. calculate the arithmetic mean of
set of differentials delta y / delta
x. Obtain the result Y ^ - is the coordinate
Y, on it we construct a point in our spectral plot (x = 0 we 
take, but in other times will allow him to rise).


3. produce antiinterpolyatsiyu function
y = f (x) (I do not know what it's called. Well, in
generally smooths her). The result is
new function f (x).

4. repeat many times with all of paragraph 2,
but each time increasing the interval x
between the differentials.


  From the standpoint of unknowing math encoder:

1. drives a piece of sound from the ADC or at least
end of the file into a buffer (512 bytes) with a given 
frequency (eg delayed 5). 

2.1 HL set the first byte of the buffer into register x lyapaem 
0, take a number # 80.


Subtract 2.2 (HL).

2.3 If the carry flag = 1 then NEG ^ amu result, otherwise 
proceed to section 2.4 

2.4 calculate the arithmetic mean
result and register X, the result throws in the register's. Add 
to the HL unit. 

2.5 repeat 2.2-2.4 until the end
buffer.

3. result of draw for the first strip.

4.1 HL set again on the clipboard, and DE
too.

4.2 Take the number of (HL).

4.3 add to the HL unit.

4.4 calculate the arithmetic mean
number and (HL).

4.5 zashvyrivaem result in (DE) and add to (DE) yedinichku.

4.6 add to the HL unit back to DE
too.

Povtaryaem 4.7 4.2-4.6 has not yet completed
buffer. Please note that the new
buffer will be at the same address, but its length
2 times smaller than the previous one. It should be considered 
in Section 2 and 4 

5. repeat 2.1-4.7 for the remaining seven
strips.

6. cleared or toggle the screen and make
all over again p.1.

From the standpoint of me (cool to say).


  We have polosopropuskayuschy filter, the upper frequency is 
theoretically determined by the number of times the smoothed 
considered a piece of sound before this analysis. The lower 
frequency is determined by ratio of the difference in the 
differentiation of addresses to the amount of time a piece of 
smooth before this analysis (item 2 in the description

for coders).

  Thus, if a piece of smooth after each analysis, then the band 
filter is shifted down and we are building a strip for each 
frequency chunk in the buffer. 


  For advanced coders (hello Disableru):


  Due to the fact that at the time when the stone
zamudrennye formula calculates many many times from the buffer, 
a piece of sound passes strips jerk pretty ugly, use a trick. 

  Remember the current value in the array
height of the strip for each frequency and then
before drawing the strip if the resulting
the height of stored for more
this strip, then take memorized, add 1, throw in an array of 
results and it also draw the strip. If less, then

subtract and so on for all bands.
The effect of super-duper.


  P.S. I am a complete zero in mathematics, so that
What can and made a mess in the mathematical
description, but the program works beautifully.
Who's supposed to, I cite the example in zazipovanny
xas ^ format as well.


  P. P. S. Spekrtuma people - unite
The people of the radar-call tel. 71-33-08.



                    ... Continuing the theme of


  Algorithm shifts the spectrum of sound in real-
time (changes in tone, male voice

       the female, by contrast, etc.).


  Hello to all who have the ADC, and all who
it's interesting.


  In order to move the sound spectrum
need to play it with more or less
sampling rate than it was recorded.
However, with this change and the rate of
sound (speed of rhythm of speech, etc.), and
as well, and playing time, but in the real
time such a method generally not possible.

  To realize this effect, I came up with
this algorithm (although he probably was
coined to me):


  Sound is played with more or less
sampling but not all, but a small piece of it (512 ... 1024 
bytes). 

  If the piece is played faster, then after
he played playback Yeshe some
time again and again until the time comes
the next piece.

  If slower, he would not finish the game before
end.

  This izvrashenie by ear almost not noticeable.


  The algorithm consists of two programs running simultaneously 
and independently by Drigo other. This is a program to digitize 
buffer constant sampling and playback software with a variable 
frequency playback. 

  Sampling program figure the sound buffer, and to achieve the 
end of the buffer moves to its beginning and so on to infinity. 

  Program play loses out
the same buffer also cyclical, but on the other
speed.


     Technical description of the program.


  The program only works with ADC and DAC
(S.drive, covox) and does not affect the screen;
occupies 118 bytes in low memory and 768
bytes for the buffer at the top, the sampling frequency is 
unknown to me, in the source ADC Port # F7, D / ports # 0F, # 
1F, # 4F, # 5F (s. drive).


     Press the "6", "7" is carried out
shift of the spectrum smoothly, "8", "9"-roughly, "0"
output.


         Interesting feature.

1. If the shift range of songs Kirkorov, then
get spilled Pugacheva.
2. Turn on a song where a piano. Pick up the tone by ear almost 
like the original. Align the audio from your computer and 
magnitafona so that in a place where you sit could hear both 
equally loud. Not yet man has managed to not fall off

laughter after that.

P.S. Hi Disabler ^ y, his wife, Snake ^ y and
the rest of the OHG and DHG, as well as
RADARavtsem from TheRom ^ but (he is Roman 71)!

P.P.S. Good people sell the modem.

              tel. 71 33 08.





Other articles:

From the authors - The reasons for the delay number.

News - The status of Rostov spektrumistov: Disabler, Klim, Wild, Dimon, The Rom.

Paradox 2k - Information about the Rostov demo-party: paradox 2k

Millennium party - The information on Minsk demopati.

Forever 2E3 results - Final results.

Soft - Description of the C compiler for the Spectrum.

Soft - a small survey of System Software: UltraSonic version 2., Shuffle Commander v1.0, Elastic Copy v1.0, Strange Player v3.0, Screen Mixer v1.0, ZX C + +, Smagly 3, Quick Commander 2.4.

Programming - The algorithm disk protection against copying.

Coding - Fill the closed area on the screen.

coding - The algorithm of spectral analysis of sound in real time.


Темы: Игры, Программное обеспечение, Пресса, Аппаратное обеспечение, Сеть, Демосцена, Люди, Программирование

Similar articles:
Intro - On the creation of the newspaper.
LFG Assembly'2000 - Training before SS'2000 (a story of Perm party).

В этот день...   4 May