'my& = _NEWIMAGE(640, 480, 256)
file$ = "ab.wav"
volume = .5: spd = 1
position = 0 'start WAV location after Head
a = volume: BalLeft = 1: BalRight = 1
SEEK #1, 45 + position
'skip wav head, position is the same as _SNDSETPOS, but not in seconds, but in bytes 'screen my&
' IF ABS(a) < 0.01 THEN _CONTINUE
BalLeft = BalLeft + .1
IF BalLeft
> 1 THEN BalLeft
= 1 BalLeft = BalLeft - .1
IF BalLeft
< 0 THEN BalLeft
= 0 BalRight = BalRight + .1
IF BalRight
> 1 THEN BalRight
= 1 BalRight = BalRight - .1
IF BalRight
< 0 THEN BalRight
= 0 spd
= spd
+ 1:
IF spd
> 3 THEN spd
= 1
bps
= _SNDRATE * 16 * 2 / 1000 '_SNDRATE is standard sampling frequency per 1 second, is used by 16 bits (1 INTEGER (2 BYTES) for channel), contains 2 channels (channels and sampling frequency are writed in WAV head) ' and i need this in kilobytes, so divide 1000. SO ONE second for music and one channel need 44100 INTEGERS = 44100 * 16 bites if sampling rate is 44100.
posins
= INT(SEEK(1) - 45) / bps
/ 100
LOCATE 1, 1:
PRINT "Esc for end, + or - for volume, 1,2 for balance left, 3,4 for balance right Press < and , or > and . for shift" LOCATE 3, 1:
PRINT "SNDRAW Volume:";
INT(ABS(a
) * 100);
"%";
" " '; "Byte position:"; bpos 'This outputs are commented, because for unknown reasons, cause sound jamming LOCATE 4, 1:
PRINT " Position in seconds:" '; posins; " " LOCATE 5, 1:
PRINT "balance LEFT:"; BalLeft;
"balance RIGHT:"; BalRight;
" ";
"Effect (press M)"; spd;
" " '-------------- konec SNDRAW bloku hlasitosti --------------------------------------
' DO WHILE _SNDRAWLEN > .2 AND _SNDRAWLEN < 0.5: LOOP
_SNDRAW BalLeft
* a
* left
/ _SNDRATE, BalRight
* a
* right
/ _SNDRATE 'here is diference. If i use this method, is playback speed correct. If i use _SNDRAW a * left / _SNDRATE , 0 in one line and in next _SNDRAW 0, a * right / _SNDRATE in second, then is playback speed slow. Why? (without FOR NEXT e loop) 'multiply "a * left / _SNDRATE" or a * right / _SNDRATE" by zero for simulating _SNDBAL, it work not. Output is in both cases for both speakers.