Author Topic: Compiler issue with sound commands  (Read 14571 times)

0 Members and 1 Guest are viewing this topic.

Offline Nuke

  • Newbie
  • Posts: 8
    • View Profile
Compiler issue with sound commands
« on: September 21, 2018, 01:10:27 pm »
Hi guys,

Been using QB64 off on on over the years.   Love it and the work you do.  Thanks.

I updated to the newest version the other day, and haven't used QB64 in quite some time, probably at all since I bought a new lap top.  When I tried compiling a program with a sound command in it I received a compiler error.  After a little testing I discovered it seems that the _SNDOPEN and _SNDPLAYFILE generate this compiler message.  I've tried converting my sound file in .OGG, .WAV, and .MP3 formats, and tried it using other sound files, but still get the same message, but I don't believe the compiler even looks at the sound source file during the compile process, does it?

This sample program below generates the following compiler message.  I'm using REALTek Audio drivers, which I'm posting below as well.  Any help you could give me solving this would be appreciated.  Thanks alot!

Nuke

h& = _SNDOPEN("D:\qb64\dog.wav")
IF h& = 0 THEN BEEP ELSE _SNDPLAY h& 'check for valid handle before using!

Compiler message:

libqb\os\win\libqb_1_2_011100000000.o:libqb.cpp:(.text+0x621cf): undefined reference to `_speex_resampler_init'
libqb\os\win\libqb_1_2_011100000000.o:libqb.cpp:(.text+0x62313): undefined reference to `_speex_resampler_process_interleaved_int'
libqb\os\win\libqb_1_2_011100000000.o:libqb.cpp:(.text+0x62341): undefined reference to `_speex_resampler_destroy'
libqb\os\win\libqb_1_2_011100000000.o:libqb.cpp:(.text+0x6235d): undefined reference to `_speex_resampler_destroy'
d:/qb64/internal/c/c_compiler/bin/../lib/gcc/i686-w64-mingw32/4.7.1/../../../../i686-w64-mingw32/bin/ld.exe: libqb\os\win\libqb_1_2_011100000000.o: bad reloc address 0x524 in section `.data'
d:/qb64/internal/c/c_compiler/bin/../lib/gcc/i686-w64-mingw32/4.7.1/../../../../i686-w64-mingw32/bin/ld.exe: final link failed: Invalid operation
collect2.exe: error: ld returned 1 exit status



If the world didn't suck, we'd all fall off.

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Compiler issue with sound commands
« Reply #1 on: September 22, 2018, 05:52:59 am »
Hi. You are Linux user? Oh i see, you are Win 10 user, sorry.
« Last Edit: September 22, 2018, 05:54:48 am by Petr »

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Compiler issue with sound commands
« Reply #2 on: September 22, 2018, 06:09:34 am »
Oh yes. Its some from bugs in QB64, because your WAV file is played too fast in QB64 under Win7. QB64 own it play wrong, but my player, which use SNDRAW it play correct. Try it playing in my program, but graphic outputs in this program are not correct set for so low biterate:

i add here your wav file info for developers.

Code: QB64: [Select]
  1.  
  2. _TITLE "_SNDRAW in action by Petr"
  3. DIM SHARED left AS SINGLE, right AS SINGLE, oblast AS LONG, a, r, b, rb, OLDa, OLDr, ob, oldB, le AS SINGLE, ri AS SINGLE, oldleft, oldright, linXL, lm, rm, BalL, BalR, OvrLd, FilePercent AS DOUBLE, SongPos, FilePos AS LONG, hodin, minut, sekund, CurrTime AS STRING, norm, normL, normR, file AS STRING, size, oldsize, lef AS SINGLE, righ AS SINGLE, corector, block, t AS _UNSIGNED LONG, c AS _UNSIGNED LONG, d AS LONG, i
  4. DIM SHARED LEG AS SINGLE, RIG AS SINGLE, id AS LONG, scrn, krok AS _UNSIGNED LONG, kro, spd
  5.  
  6.  
  7.  
  8.  
  9.  
  10. file$ = "dog.wav" 'Ufo - Phenomenom is my testing LP        <- insert your 16bit stereo LPCM WAV file here NEW: INSERT 8bit mono/stereo WAV - NEWEREST: Insert your MP3 here.
  11.  
  12.  
  13.  
  14.  
  15. TYPE snd
  16.     l AS SINGLE
  17.     r AS SINGLE
  18.  
  19. TYPE sndM
  20.     l AS SINGLE
  21.  
  22. TYPE Esnd
  23.     l AS INTEGER
  24.     r AS INTEGER
  25.  
  26. TYPE DiscCache
  27.     L AS SINGLE
  28.     R AS SINGLE
  29.  
  30. TYPE ID3HEAD
  31.     Identifier AS STRING * 3
  32.     VersionMajor AS STRING * 1 '                                           Classical way - ASC number of this characters in file is Version number
  33.     VersionRevis AS STRING * 1
  34.     BinarFlags AS _UNSIGNED _BYTE
  35.     BinarSizeA AS STRING * 1
  36.     BinarSizeB AS STRING * 1
  37.     BinarSizeC AS STRING * 1
  38.     BinarSizeD AS STRING * 1
  39.  
  40. TYPE FRAME
  41.     Id AS STRING * 4
  42.     SizeA AS STRING * 1
  43.     SizeB AS STRING * 1
  44.     SizeC AS STRING * 1
  45.     SizeD AS STRING * 1
  46.     Flags AS _UNSIGNED INTEGER
  47.  
  48. DIM SHARED ID3 AS ID3HEAD
  49. DIM SHARED FRM AS FRAME
  50. DIM SHARED OUTList(150, 150) AS STRING * 80 '                                                 output list with infos from ID3TAG
  51. DIM SHARED DiscCache(88200) AS DiscCache
  52. DIM SHARED vystup(88200) AS DiscCache
  53.  
  54.  
  55. spd = .4
  56. size = 88200
  57.  
  58. '                         program now supported undirectly MP3, directly ID3, WAV 16/8 all uncompressed types. In program you can see how to read MP3 ID3, MP3 heads, WAV head, APIC and RAW.
  59.  
  60.  
  61.  
  62. sc = _NEWIMAGE(640, 480, 256)
  63. IF UCASE$(RIGHT$(file$, 3)) = "MP3" THEN
  64.     mp3 = 1
  65.     bits = 16
  66.     MP3HEADER file$
  67.     IF _FILEEXISTS("mp3enc.exe") THEN
  68.  
  69.         IF _FILEEXISTS(file$) THEN
  70.             id3s file$
  71.             block = 2 * chan
  72.             IF bVelikost = 0 THEN
  73.                 CLOSE
  74.                 OPEN "soundcopy.mp3" FOR OUTPUT AS #1: CLOSE #1: OPEN "soundcopy.mp3" FOR BINARY AS #2 'external decoder know not filenames contains spaces. So i use this way.
  75.                 OPEN file$ FOR BINARY AS #4
  76.                 new$ = SPACE$(LOF(4) + 8)
  77.                 GET #4, , new$
  78.                 PUT #2, , new$
  79.                 CLOSE #4
  80.                 CLOSE #2
  81.             END IF
  82.  
  83.             SCREEN sc
  84.             _DEST sc
  85.             po$ = "mp3enc --decode " + file$ + " !swapsoundfile!.raw"
  86.         ELSE PRINT file$; "not exist.": END
  87.         END IF
  88.         _LIMIT .3
  89.         SHELL _HIDE po$
  90.  
  91.         RAW = 1
  92.         CLS
  93.         file$ = "!swapsoundfile!.raw"
  94.         IF _FILEEXISTS(file$) THEN
  95.             OPEN file$ FOR BINARY AS #5
  96.             fsiz = LOF(5)
  97.             CLOSE #5
  98.             IF fsiz = 0 THEN
  99.                 CLS: BEEP: PRINT "External decoder failure. Variable compression is not supported."
  100.                 KILL file$
  101.                 END
  102.             END IF
  103.         ELSE PRINT "External decoder error, file not created": END
  104.         END IF
  105.     ELSE PRINT "external decoder not found, file can not be played": END
  106.     END IF
  107.     Header
  108.  
  109.  
  110. corector = RATE / _SNDRATE * (16 / bits)
  111. DIM SHARED SOnd(0) AS snd 'for analyzer
  112.  
  113. IF bits = 16 AND chan = 2 THEN
  114.     REDIM SHARED snd(size) AS snd
  115.  
  116. IF bits = 16 AND chan = 1 THEN
  117.     REDIM SHARED snd(size) AS sndM
  118.  
  119. IF bits = 8 AND chan = 2 THEN
  120.     REDIM SHARED snd(size) AS snd
  121.  
  122. IF bits = 8 AND chan = 1 THEN
  123.     REDIM SHARED snd(size) AS sndM
  124.  
  125.  
  126. IF identit$ <> "" THEN _PRINTSTRING (308, 224), "ID3"
  127.  
  128. CIRCLE (160, 100), 100, 15, 6.28, 3.4
  129. CIRCLE (160, 100), 100, 15, 6, 6.28
  130. CIRCLE (160, 105), 5, 15
  131. PAINT (160, 105), 15, 15
  132. CIRCLE (160, 100), 76, 22, 6.28, 3.4
  133. CIRCLE (160, 100), 76, 22, 6, 6.28
  134. FOR ra = 76 TO 97
  135.     CIRCLE (160, 100), ra, 43, 0, 1.1
  136.     CIRCLE (160, 100), ra, 41, 6, 6.28
  137.     CIRCLE (160, 100), ra, 44, 1.1, 1.6
  138.     CIRCLE (160, 100), ra, 2, 1.6, 3.4
  139. NEXT ra
  140. LINE (60, 120)-(260, 150), 15, BF
  141. COLOR 0, 15: _PRINTSTRING (80, 130), "Left speaker volume"
  142. COLOR 15, 0
  143.  
  144. CIRCLE (160 * 3, 100), 100, 15, 6.28, 3.4
  145. CIRCLE (160 * 3, 100), 100, 15, 6, 6.28
  146. CIRCLE (160 * 3, 105), 5, 15
  147. PAINT (160 * 3, 105), 15, 15
  148. CIRCLE (160 * 3, 100), 76, 22, 6.28, 3.4
  149. CIRCLE (160 * 3, 100), 76, 22, 6, 6.28
  150. FOR ra = 76 TO 97
  151.     CIRCLE (160 * 3, 100), ra, 43, 0, 1.1
  152.     CIRCLE (160 * 3, 100), ra, 41, 6, 6.28
  153.     CIRCLE (160 * 3, 100), ra, 44, 1.1, 1.6
  154.     CIRCLE (160 * 3, 100), ra, 2, 1.6, 3.4
  155. NEXT ra
  156. LINE (380, 120)-(580, 150), 15, BF
  157. COLOR 0, 15: _PRINTSTRING (400, 130), "Right speaker volume"
  158. COLOR 15, 0
  159. _PRINTSTRING (100, 390), "Overload:"
  160. _PRINTSTRING (210, 390), "Spd / dir:"
  161. '////////////
  162.  
  163. LINE (58, 210)-(262, 290), 15, B
  164. LINE (60, 250)-(260, 250), 15
  165.  
  166. LINE (378, 210)-(582, 290), 15, B
  167. LINE (380, 250)-(580, 250), 15
  168. '/////////////
  169. _PRINTSTRING (280, 300), "Position:"
  170. _PRINTSTRING (316, 250), "E"
  171. 'LINE (310, 250)-(330, 265), 15, B
  172. FOR windows = 60 TO 240 STEP 20
  173.     SELECT CASE windows
  174.         CASE IS < 140
  175.             clr = 193
  176.         CASE 140 TO 200
  177.             clr = 115
  178.         CASE IS > 200
  179.             clr = 184
  180.     END SELECT
  181.     LINE (windows, 350)-(windows + 15, 370), clr, BF
  182.     LINE (320 + windows, 350)-(320 + windows + 15, 370), clr, BF
  183. '///////////////
  184. BalL = 1
  185. BalR = 1
  186. IF bits = 16 THEN OverLoad = 0
  187. norm = 0
  188. normL = 1
  189. normR = 1
  190. EffLen = 0
  191. '///specan////
  192.  
  193. FOR linies = 332 TO 580 STEP 14
  194.     FOR ll = 450 TO 400 STEP -7
  195.         SELECT CASE ll
  196.             CASE 443, 450
  197.                 c = 190
  198.             CASE 429, 436
  199.                 c = 188
  200.             CASE 415, 422
  201.                 c = 209
  202.             CASE 401, 408
  203.                 c = 184
  204.         END SELECT
  205.         LINE (linies, ll)-(linies + 10, ll - 5), c, BF
  206.     NEXT
  207. _PRINTSTRING (390, 460), " L  analyzer  R "
  208.  
  209. sc2 = _COPYIMAGE(sc, 256)
  210. krok = 41: kro = block
  211. OPEN file$ FOR BINARY AS #1
  212. SEEK #1, 41 ' + 12566900
  213.  
  214.     IF quit THEN EXIT DO
  215.     krok = krok + kro
  216.     IF krok < block THEN EXIT DO
  217.     IF krok > LOF(1) THEN krok = LOF(1)
  218.  
  219.     IF bits = 16 AND chan = 2 THEN
  220.         REDIM lefi AS INTEGER, righi AS INTEGER
  221.         GET #1, krok, lefi
  222.         GET #1, krok + 2, righi
  223.         lef = lefi
  224.         righ = righi
  225.  
  226.     END IF
  227.  
  228.     IF bits = 16 AND chan = 1 THEN
  229.         REDIM leftMono AS INTEGER
  230.         GET #1, krok, leftMono
  231.         lef = leftMono
  232.         righ = leftMono
  233.     END IF
  234.  
  235.     IF bits = 8 AND chan = 2 THEN
  236.         REDIM lleft8 AS _UNSIGNED _BYTE, rright8 AS _UNSIGNED _BYTE
  237.         GET #1, krok, lleft8
  238.         GET #1, krok, rright8
  239.         lef = lleft8 / 256
  240.         righ = rright8 / 256
  241.     END IF
  242.  
  243.     IF bits = 8 AND chan = 1 THEN
  244.         REDIM mono8 AS _UNSIGNED _BYTE
  245.         GET #1, krok, mono8
  246.         lef = mono8 / 256
  247.         righ = lef
  248.     END IF
  249.  
  250.     oldleft = left
  251.     oldright = right
  252.     LEG = lef
  253.     RIG = righ
  254.  
  255.     IF bits = 16 THEN left = lef / RATE * BalL * OvrLd * normL * corector ELSE left = lef * BalL * OvrLd
  256.     IF bits = 16 THEN right = righ / RATE * BalR * OvrLd * normR * corector ELSE right = righ * BalR * OvrLd
  257.     IF left > 0.74 THEN left = 0.74
  258.     IF right > 0.74 THEN right = 0.74 '    protect speakers from damage, 0.74 is maximal value in standard records from studios if is amplitude really in maximum.
  259.     IF left < -0.74 THEN left = -0.74
  260.     IF right < -0.74 THEN right = -0.74
  261.  
  262.  
  263.     oblast = oblast + 1
  264.  
  265.  
  266.     IF TrueEffect = 0 THEN
  267.         IF RATE > 44100 THEN frekvence = RATE ELSE frekvence = 44100
  268.         FOR plll = 1 TO frekvence / RATE
  269.             _SNDRAW left, right
  270.         NEXT plll
  271.     END IF
  272.     eff
  273.     IF oblast MOD 5000 * corector = 0 THEN ob = 1
  274.     le = le + ABS(left): ri = ri + ABS(right)
  275.     IF oblast MOD 2 = 0 THEN speed
  276.  
  277.     IF bits = 8 AND oblast MOD 4 = 0 THEN digi: budzik le, ri: lin
  278.     IF bits = 16 AND oblast MOD 2 = 0 THEN digi: budzik le, ri: lin
  279.  
  280.  
  281.     IF oblast > 50000 * corector THEN oblast = 0
  282.     CC = tahloL(100, 200, 180, BalL)
  283.     CC2 = tahloL(430, 530, 180, BalR)
  284.     OO = tahloL(80, 180, 420, OverLoad)
  285.     IF bits = 16 THEN OvrLd = (8 * OO) + 1 ELSE OvrLd = OO + 1 'set volume UP to 800% before original record
  286.  
  287.     FilePos = SEEK(1)
  288.     IF oblast MOD 210 = 0 THEN SongPos = tahloL(90, 550, 325, FilePos / LOF(1)) 'function is designated with single values. This is not enought for this use. DOUBLE is better if you need calculating in file position (WAV > 1 GB)... but i create it so as it is...
  289.  
  290.     IF oblast MOD RATE = 0 THEN
  291.         Time = (SEEK(1) / RATE) / block 'vraci cas ve vterinach spravne
  292.         timing Time
  293.         IF hodin < 9 THEN hodina$ = "0" + LTRIM$(STR$(hodina)) ELSE hodina$ = STR$(hodin)
  294.         IF minuta <= 9 THEN minuta$ = "0" + LTRIM$(STR$(minuta)) ELSE minuta$ = STR$(minuta)
  295.         IF sekunda <= 9 THEN sekunda$ = "0" + LTRIM$(STR$(sekunda)) ELSE sekunda$ = STR$(sekunda)
  296.         CurrTime$ = hodina$ + ":" + LTRIM$(minuta$) + ":" + LTRIM$(sekunda$)
  297.     END IF
  298.  
  299.     IF oblast MOD 200 = 0 THEN
  300.         _PRINTSTRING (240, 180), "Track time: " + CurrTime$, sc
  301.         IF TrueEffect = 1 THEN _PRINTSTRING (100, 430), "Echo:", sc: COLOR 2: _PRINTSTRING (316, 250), "E": COLOR 15
  302.         IF RATE < 44100 THEN COLOR 240: _PRINTSTRING (316, 250), "E": COLOR 15
  303.  
  304.  
  305.  
  306.  
  307.  
  308.         ' ------------------------------------------------- ovladani zobrazeni vysledne obrazovky id3
  309.         IF scrn = 1 THEN viewtime = TIMER + 15: scrn = 0: vloz = 1
  310.         IF TIMER < viewtime THEN _SOURCE sc: SCREEN id ELSE SCREEN sc: IF vloz = 1 THEN _PUTIMAGE (0, 0), sc2, sc: PCOPY _DISPLAY, 1: vloz = 0
  311.  
  312.         ' ------------------------------------------------
  313.  
  314.  
  315.         IF oldsize <> size THEN
  316.             oldsize = size
  317.             REDIM _PRESERVE SHARED snd(size) AS snd
  318.             '            REDIM _PRESERVE SHARED effect(size) AS snd
  319.         END IF
  320.         size = (441 * 8) + 10 * (EffLen * 1000)
  321.  
  322.  
  323.  
  324.     END IF
  325.     IF TrueEffect = 1 THEN Effl = tahloL(80, 180, 455, EffLen)
  326.  
  327.  
  328.     IF oblast MOD chan = 0 THEN specan
  329.     '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!   REM    IF oblast MOD 10 = 0 THEN specan
  330.  
  331.  
  332.  
  333.  
  334.     DO WHILE _SNDRAWLEN > 0: LOOP
  335.     IF oblast MOD INT(2500 / corector) = 0 AND vloz = 0 THEN PCOPY 1, _DISPLAY
  336.  
  337. 'this program use control exit and end!
  338. IF _FILEEXISTS("!swapsoundfile!.raw") THEN KILL "!swapsoundfile!.raw" 'if you plays wav, this file not exist
  339. IF _FILEEXISTS("soundcopy.mp3") THEN KILL "soundcopy.mp3" '            if you plays wav, this file not exist
  340. LINE (100, 140)-(540, 340), 15, B
  341. LINE (75, 220)-(100, 260), 15, BF
  342. FOR cary = 101 TO 539 STEP 40
  343.     SELECT CASE cary
  344.         CASE 101 TO 261: barva = 47 '101,141,181,221,261
  345.         CASE 262 TO 381: barva = 42 '301,341,381
  346.         CASE 382 TO 539: barva = 40
  347.     END SELECT
  348.     LINE (cary, 141)-(cary + 38, 339), barva, BF
  349. NEXT cary
  350.  
  351. FOR cary = 101 TO 539 STEP 40
  352.     LINE (cary, 141)-(cary + 38, 339), 17, BF
  353.     _DELAY .2
  354. NEXT cary
  355. FOR f = 1 TO 6
  356.     PCOPY 3, _DISPLAY
  357.     _DELAY .2
  358.     CLS
  359.     _DELAY .2
  360. _PRINTSTRING (308, 230), "Bye", sc
  361.  
  362. SUB budzik (Le AS SINGLE, Ri AS SINGLE)
  363.     SHARED bits, aC, OLDaC
  364.     IF ob = 1 THEN
  365.         CIRCLE (160, 100), 78, 0, aC, -aC
  366.         CIRCLE (480, 100), 78, 0, r, -r
  367.         '        IF oblast MOD 1000 = 0 THEN PCOPY 1, _DISPLAY
  368.  
  369.         IF bits = 8 THEN
  370.             oprava = 4
  371.             b = left * oprava
  372.             rb = right * oprava
  373.         ELSE
  374.             b = 10 * (Le / 5000) / corector 'because in my loop is MOD 5000
  375.             rb = 10 * (Ri / 5000) / corector
  376.         END IF
  377.  
  378.  
  379.  
  380.         Le = 0: Ri = 0
  381.  
  382.         aC = ((3.14 - b) + aC) / 2
  383.         r = ((3.14 - rb) + r) / 2
  384.         IF aC < 0.01 THEN aC = 0.01
  385.         IF r < 0.01 THEN r = 0.01
  386.  
  387.         ob = 0
  388.     END IF
  389.  
  390.     IF oblast MOD 300 = 0 THEN
  391.  
  392.         OLDaC = aC
  393.         OLDr = r
  394.  
  395.         IF bits = 8 THEN padani = .0001 ELSE padani = .0001
  396.         IF aC > 0 THEN aC = aC - padani
  397.         IF r > 0 THEN r = r - padani
  398.  
  399.         CIRCLE (160, 100), 78, 0, OLDaC, -OLDaC
  400.         CIRCLE (480, 100), 78, 0, OLDr, -OLDr
  401.  
  402.         CIRCLE (160, 100), 78, 25, aC, -aC
  403.         CIRCLE (480, 100), 78, 25, r, -r
  404.     END IF
  405.  
  406.  
  407. SUB lin '(le AS SINGLE, ri AS SINGLE)
  408.     SHARED bits, oldleft, oldright, mu
  409.     IF bits = 8 THEN
  410.         mu = mu + 1
  411.         IF mu MOD 3 = 0 THEN mu = 0: MN = -1 ELSE MN = 1
  412.         oldleftG = oldleft
  413.         oldrightG = oldright
  414.         leftG = left * MN
  415.         rightG = right * MN
  416.         m = 3 '* (left + right) / 2
  417.  
  418.     ELSE
  419.  
  420.         oldleftG = oldleft
  421.         oldrightG = oldright
  422.         leftG = left
  423.         rightG = right
  424.         m = .25
  425.  
  426.     END IF
  427.  
  428.     IF linXL = 0 OR linXL > 260 THEN linXL = 60
  429.  
  430.  
  431.     linXL = linXL + (m / corector)
  432.     linX2L = linXL + 320
  433.     lxc = linXL - (.1 / corector)
  434.     lxc2 = linX2L - (.1 / corector)
  435.     oldle = 250 + (oldleftG * 30)
  436.     Leprvy = 250 + (leftG * 30)
  437.     oldri = 250 + (oldrightG * 30)
  438.     RiPrvy = 250 + (rightG * 30)
  439.  
  440.     LINE (linXL, (oldle))-(lxc, Leprvy), 14, BF
  441.     LINE (linX2L, oldri)-(lxc2, RiPrvy), 14, BF
  442.  
  443. SUB digi
  444.     SHARED bites
  445.     'deset pasem
  446.     IF bites = 8 THEN cr = 100 ELSE cr = 1
  447.     IF oblast MOD 50 * cr = 0 THEN
  448.         lm = (le / 800 / corector) * (120 / corector)
  449.         rm = (ri / 800 / corector) * (120 / corector)
  450.         IF lm >= 245 THEN lm = 245
  451.         IF rm >= 245 THEN rm = 245
  452.     ELSE
  453.         IF lm > 60 THEN lm = lm - .01 ' * corector
  454.         IF rm > 60 THEN rm = rm - .01 '* corector
  455.  
  456.  
  457.     END IF
  458.     FOR windows = 60 TO lm STEP 20 'maximal signal = 240
  459.         SELECT CASE windows
  460.             CASE IS < 140
  461.                 clr = 47
  462.             CASE 140 TO 200
  463.                 clr = 44
  464.             CASE IS > 200
  465.                 clr = 39
  466.         END SELECT
  467.         LINE (windows, 350)-(windows + 15, 370), clr, BF
  468.     NEXT
  469.  
  470.     FOR windows = 60 TO rm STEP 20 'maximal signal = 240
  471.         SELECT CASE windows
  472.             CASE IS < 140
  473.                 clr = 47
  474.             CASE 140 TO 200
  475.                 clr = 44
  476.             CASE IS > 200
  477.                 clr = 39
  478.         END SELECT
  479.         LINE (320 + windows, 350)-(320 + windows + 15, 370), clr, BF
  480.     NEXT
  481.  
  482.  
  483.  
  484.  
  485. FUNCTION tahloL (xx1 AS INTEGER, xx2 AS INTEGER, yy AS INTEGER, startvalue AS SINGLE) 'delka = lenght
  486.     SHARED bits, chan, scrn
  487.     IF xx1 > xx2 THEN SWAP xx2, xx1
  488.     tahloL = startvalue
  489.         MX = _MOUSEX
  490.         MY = _MOUSEY
  491.         'extra function - shift in song:
  492.         IF MX > 308 AND MX < 332 AND MY > 224 AND MY < 240 AND _MOUSEBUTTON(1) = -1 THEN GOTO id3
  493.         IF MX > 90 AND MX < 550 AND MY > 315 AND MY < 335 AND _MOUSEBUTTON(1) = -1 THEN
  494.             songprocento# = (550 - 90) / 100
  495.             sngpos# = (MX - 90) / 100 / songprocento#
  496.             newpos# = sngpos# * LOF(1)
  497.             DO UNTIL newpos# MOD block = 0
  498.                 newpos# = newpos# + 1
  499.             LOOP
  500.             SEEK #1, 41 + newpos#
  501.             krok = 41 + newpos#
  502.         END IF
  503.         'end this shifting function
  504.  
  505.  
  506.  
  507.         IF MX >= xx1 AND MX <= xx2 AND MY < yy + 10 AND MY > yy - 10 AND _MOUSEBUTTON(1) = -1 THEN
  508.             procento# = (xx2 - xx1) / 100
  509.             tahloL = (_MOUSEX - xx1) / 100 / procento# 'return value 0 to 1, 1 is full
  510.             IF tahloL > 1 THEN tahloL = 1
  511.             IF tahloL < 0 THEN tahloL = 0
  512.             startvalue = tahloL
  513.  
  514.  
  515.  
  516.  
  517.         END IF
  518.     LOOP
  519.     LINE (xx1, yy)-(xx2, yy), 15
  520.     LINE (xx1 + ((xx2 - xx1) * tahloL), yy + 5)-(xx1 + ((xx2 - xx1) * tahloL) + 5, yy - 5), 15, BF
  521.  
  522.     id3:
  523.     IF scrn = 0 THEN scrn = 1: ELSE scrn = 0
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531. SUB timing (hodnota AS DOUBLE) '                                                                 calculate time. Writed for Timer, _SndLen. Input format as TIMER or _SNDLEN WITH "."
  532.     SHARED hodin, minuta, sekunda '                                                          try it copying to new program and write "timing TIMER" for current time calculating.
  533.     IF hodnota < 60 THEN hodin = 0: minut = 0: sekund = hodnota: GOTO a1
  534.     IF hodnota > 60 AND hodnota < 3600 THEN hodin = 0: minut = hodnota / 60: GOTO a2
  535.     hodin = hodnota / 3600
  536.     hodin$ = STR$(hodin)
  537.     tecka = INSTR(0, hodin$, ".")
  538.     minut = (VAL("0." + RIGHT$(hodin$, LEN(hodin$) - tecka)) * 0.6) * 100
  539.     a2:
  540.     minut$ = STR$(minut)
  541.     tecka = INSTR(0, STR$(minut), ".")
  542.     sekund = (VAL("0." + RIGHT$(minut$, LEN(minut$) - tecka)) * 0.6) * 100
  543.     a1:
  544.     sekund$ = STR$(sekund)
  545.     tecka = INSTR(0, sekund$, ".")
  546.     sets = (VAL("0." + RIGHT$(sekund$, LEN(sekund$) - tecka)) * 1) * 100
  547.  
  548.     minuta = INT(minut)
  549.     sekunda = INT(sekund)
  550.     IF sekunda = 60 THEN sekunda = 0
  551.  
  552.  
  553. SUB eff
  554.     SHARED TrueEffect, start, c, t, RATE, prubeh AS LONG, OpoIndex, DiscCacheIndex, start, Effl, i, oldeffl
  555.  
  556.     IF RATE < 44100 THEN EXIT SUB
  557.         IF _MOUSEX > 310 AND _MOUSEX < 330 AND _MOUSEY > 250 AND _MOUSEY < 265 AND _MOUSEBUTTON(1) = -1 THEN
  558.             IF TrueEffect = 0 THEN TrueEffect = 1 ELSE TrueEffect = 0
  559.         END IF
  560.     LOOP
  561.     IF TrueEffect = 1 THEN
  562.         IF oldeffl <> Effl THEN
  563.             OpoIndex = 0
  564.             DiscCacheIndex = 0
  565.             prubeh = 0
  566.             start = 0
  567.             oldeffl = Effl
  568.         END IF
  569.  
  570.         '        d = d + 4
  571.         '  IF d > LOF(10) THEN EXIT SUB
  572.         i = i + 1
  573.         DiscCacheIndex = DiscCacheIndex + 1: IF DiscCacheIndex >= 88200 THEN DiscCacheIndex = 0
  574.         DiscCache(DiscCacheIndex).L = left
  575.         DiscCache(DiscCacheIndex).R = right
  576.  
  577.  
  578.  
  579.         prubeh = prubeh + 1
  580.         IF DiscCacheIndex > (Effl * 5000) THEN start = 1
  581.         IF start = 1 THEN
  582.             OpoIndex = OpoIndex + 1
  583.             IF OpoIndex >= 88200 THEN OpoIndex = 0
  584.  
  585.             IF prubeh MOD 2 = 0 AND start = 1 THEN
  586.                 vystup(i).L = DiscCache(OpoIndex).L * .8
  587.                 vystup(i).R = DiscCache(OpoIndex).R * .8
  588.  
  589.             ELSE
  590.                 vystup(i).L = DiscCache(DiscCacheIndex).L
  591.                 vystup(i).R = DiscCache(DiscCacheIndex).R
  592.             END IF
  593.         END IF
  594.  
  595.  
  596.         IF i >= 88200 THEN i = 0
  597.         IF prubeh > 40000 THEN prubeh = 0
  598.         IF RATE > 44100 THEN frekvence = RATE ELSE frekvence = 44100
  599.         FOR plll = 1 TO frekvence / RATE
  600.             _SNDRAW vystup(i).L, vystup(i).R
  601.         NEXT plll
  602.     END IF
  603.  
  604. SUB specan 'experimental sub UPGRADED
  605.     SHARED left, right, oldALeft, oldARight, RATE, LeftFreq, RightFreq, doba, LF, RF, L0, L1, L2, L3, L4, L5, L6, L7, L8, R0, R1, R2, R3, R4, R5, R6, R7, R8
  606.     IF oldALeft = 0 AND SGN(left) <> 0 THEN oldALeft = SGN(left)
  607.     LeftFreq = LeftFreq + 1
  608.  
  609.     IF oldARight = 0 AND SGN(right) <> 0 THEN oldARight = SGN(right)
  610.     RightFreq = RightFreq + 1
  611.  
  612.  
  613.     IF SGN(right) <> SGN(oldARight) AND SGN(right) <> 0 THEN
  614.         RF = RATE / RightFreq
  615.         RightFreq = 0: oldARight = 0
  616.         '        PRINT "RF"; RF: SLEEP
  617.     END IF
  618.  
  619.     IF SGN(left) <> SGN(oldALeft) AND SGN(left) <> 0 THEN
  620.         LF = RATE / LeftFreq
  621.         LeftFreq = 0: oldALeft = 0
  622.         '        PRINT LF: SLEEP
  623.     END IF
  624.     '100 Hz frequency = IF rate is 44100, then its 44100/100 = LF or RF muss contains 441 or more (more bass fraquency) samples.
  625.     '16000 Hz  = 44100 / 16000 = 2.7    ------++++++
  626.     '                                     2.7   2.7
  627.  
  628.     'dobu pridelovani hodnot k jednotlivym frekvencim stanovim na 2000 pruchodu:
  629.     pole = 451
  630.     doba = doba + 1: IF doba > pole THEN '882 = 50 Hz, lowest, longest signal
  631.         GOSUB vykresleni
  632.         L0 = 0: L1 = 0: L2 = 0: L3 = 0: L4 = 0: L5 = 0: L6 = 0: L7 = 0: L8 = 0
  633.         R0 = 0: R1 = 0: R2 = 0: R3 = 0: R4 = 0: R5 = 0: R6 = 0: R7 = 0: R8 = 0
  634.         doba = 0
  635.         EXIT SUB
  636.     ELSE
  637.  
  638.         SELECT CASE LF
  639.             CASE 220 TO 451: L0 = L0 + .4 'sub bass area 50 to 100 Hz
  640.             CASE 452 TO 900: L1 = L1 + .4
  641.             CASE 900 TO 1800: L2 = L2 + .4
  642.             CASE 1800 TO 3600: L3 = L3 + .4
  643.             CASE 3600 TO 5000: L4 = L4 + .4
  644.             CASE 5000 TO 8000: L5 = L5 + .4
  645.             CASE 8000 TO 11000: L6 = L6 + .4
  646.             CASE 11000 TO 14000: L7 = L7 + .4
  647.             CASE 14000 TO 17000: L8 = L8 + .4
  648.         END SELECT
  649.         SELECT CASE RF
  650.             CASE 220 TO 451: R0 = R0 + .4
  651.             CASE 452 TO 900: R1 = R1 + .4
  652.             CASE 900 TO 1800: R2 = R2 + .4
  653.             CASE 1800 TO 3600: R3 = R3 + .4
  654.             CASE 3600 TO 5000: R4 = R4 + .4
  655.             CASE 5000 TO 8000: R5 = R5 + .4
  656.             CASE 8000 TO 11000: R6 = R6 + .4
  657.             CASE 11000 TO 14000: R7 = R7 + .4
  658.             CASE 14000 TO 17000: R8 = R8 + .4
  659.         END SELECT
  660.     END IF
  661.     EXIT SUB
  662.     vykresleni:
  663.  
  664.     IF R8 > 49 THEN R8 = 49
  665.     IF R7 > 49 THEN R7 = 49
  666.     IF R6 > 49 THEN R6 = 49
  667.     IF R5 > 49 THEN R5 = 49
  668.     IF R4 > 49 THEN R4 = 49
  669.     IF R3 > 49 THEN R3 = 49
  670.     IF R2 > 49 THEN R2 = 49
  671.     IF R1 > 49 THEN R1 = 49
  672.     IF R0 > 49 THEN R0 = 49
  673.  
  674.     IF L8 > 49 THEN L8 = 49
  675.     IF L7 > 49 THEN L7 = 49
  676.     IF L6 > 49 THEN L6 = 49
  677.     IF L5 > 49 THEN L5 = 49
  678.     IF L4 > 49 THEN L4 = 49
  679.     IF L3 > 49 THEN L3 = 49
  680.     IF L2 > 49 THEN L2 = 49
  681.     IF L1 > 49 THEN L1 = 49
  682.     IF L0 > 49 THEN L0 = 49
  683.  
  684.     m = 1
  685.     FOR ll0 = 450 TO 450 - L0 * m STEP -7
  686.         '332 TO 580 STEP 14
  687.         SELECT CASE ll0
  688.             CASE 443, 450
  689.                 c = 49
  690.             CASE 429, 436
  691.                 c = 44
  692.             CASE 415, 422
  693.                 c = 43
  694.             CASE 401, 408
  695.                 c = 39
  696.         END SELECT
  697.         LINE (332, ll0)-(332 + 10, ll0 - 5), c, BF
  698.     NEXT
  699.  
  700.  
  701.     FOR ll1 = 450 TO 450 - (L1) * m STEP -7
  702.         '332 TO 580 STEP 14
  703.         SELECT CASE ll1
  704.             CASE 443, 450
  705.                 c = 49
  706.             CASE 429, 436
  707.                 c = 44
  708.             CASE 415, 422
  709.                 c = 43
  710.             CASE 401, 408
  711.                 c = 39
  712.         END SELECT
  713.         LINE (346, ll1)-(346 + 10, ll1 - 5), c, BF
  714.     NEXT
  715.  
  716.     FOR ll2 = 450 TO 450 - (L2) * m STEP -7
  717.         '332 TO 580 STEP 14
  718.         SELECT CASE ll2
  719.             CASE 443, 450
  720.                 c = 49
  721.             CASE 429, 436
  722.                 c = 44
  723.             CASE 415, 422
  724.                 c = 43
  725.             CASE 401, 408
  726.                 c = 39
  727.         END SELECT
  728.         LINE (360, ll2)-(360 + 10, ll2 - 5), c, BF
  729.     NEXT
  730.  
  731.     FOR ll3 = 450 TO 450 - (L3) * m STEP -7
  732.         '332 TO 580 STEP 14
  733.         SELECT CASE ll3
  734.             CASE 443, 450
  735.                 c = 49
  736.             CASE 429, 436
  737.                 c = 44
  738.             CASE 415, 422
  739.                 c = 43
  740.             CASE 401, 408
  741.                 c = 39
  742.         END SELECT
  743.         LINE (374, ll3)-(374 + 10, ll3 - 5), c, BF
  744.     NEXT
  745.  
  746.  
  747.     FOR ll4 = 450 TO 450 - (L4) * m STEP -7
  748.         '332 TO 580 STEP 14
  749.         SELECT CASE ll4
  750.             CASE 443, 450
  751.                 c = 49
  752.             CASE 429, 436
  753.                 c = 44
  754.             CASE 415, 422
  755.                 c = 43
  756.             CASE 401, 408
  757.                 c = 39
  758.         END SELECT
  759.         LINE (388, ll4)-(388 + 10, ll4 - 5), c, BF
  760.     NEXT
  761.  
  762.     FOR ll5 = 450 TO 450 - (L5) * m STEP -7
  763.         '332 TO 580 STEP 14
  764.         SELECT CASE ll5
  765.             CASE 443, 450
  766.                 c = 49
  767.             CASE 429, 436
  768.                 c = 44
  769.             CASE 415, 422
  770.                 c = 43
  771.             CASE 401, 408
  772.                 c = 39
  773.         END SELECT
  774.         LINE (402, ll5)-(402 + 10, ll5 - 5), c, BF
  775.     NEXT
  776.  
  777.     FOR ll6 = 450 TO 450 - (L6) * m STEP -7
  778.         '332 TO 580 STEP 14
  779.         SELECT CASE ll6
  780.             CASE 443, 450
  781.                 c = 49
  782.             CASE 429, 436
  783.                 c = 44
  784.             CASE 415, 422
  785.                 c = 43
  786.             CASE 401, 408
  787.                 c = 39
  788.         END SELECT
  789.         LINE (416, ll6)-(416 + 10, ll6 - 5), c, BF
  790.     NEXT
  791.  
  792.     FOR ll7 = 450 TO 450 - (L7) * m STEP -7
  793.         '332 TO 580 STEP 14
  794.         SELECT CASE ll7
  795.             CASE 443, 450
  796.                 c = 49
  797.             CASE 429, 436
  798.                 c = 44
  799.             CASE 415, 422
  800.                 c = 43
  801.             CASE 401, 408
  802.                 c = 39
  803.         END SELECT
  804.         LINE (430, ll7)-(430 + 10, ll7 - 5), c, BF
  805.     NEXT
  806.  
  807.     FOR ll8 = 450 TO 450 - (L8) * m STEP -7
  808.         '332 TO 580 STEP 14
  809.         SELECT CASE ll8
  810.             CASE 443, 450
  811.                 c = 49
  812.             CASE 429, 436
  813.                 c = 44
  814.             CASE 415, 422
  815.                 c = 43
  816.             CASE 401, 408
  817.                 c = 39
  818.         END SELECT
  819.         LINE (444, ll8)-(444 + 10, ll8 - 5), c, BF
  820.     NEXT
  821.  
  822.  
  823.     FOR rr0 = 450 TO 450 - (R0) * m STEP -7
  824.         '332 TO 580 STEP 14
  825.         SELECT CASE rr0
  826.             CASE 443, 450
  827.                 c = 49
  828.             CASE 429, 436
  829.                 c = 44
  830.             CASE 415, 422
  831.                 c = 43
  832.             CASE 401, 408
  833.                 c = 39
  834.         END SELECT
  835.         LINE (458, rr0)-(458 + 10, rr0 - 5), c, BF
  836.     NEXT
  837.  
  838.  
  839.     FOR rr1 = 450 TO 450 - (R1) * m STEP -7
  840.         '332 TO 580 STEP 14
  841.         SELECT CASE rr1
  842.             CASE 443, 450
  843.                 c = 49
  844.             CASE 429, 436
  845.                 c = 44
  846.             CASE 415, 422
  847.                 c = 43
  848.             CASE 401, 408
  849.                 c = 39
  850.         END SELECT
  851.         LINE (472, rr1)-(472 + 10, rr1 - 5), c, BF
  852.     NEXT
  853.  
  854.     FOR rr2 = 450 TO 450 - (R2) * m STEP -7
  855.         '332 TO 580 STEP 14
  856.         SELECT CASE rr2
  857.             CASE 443, 450
  858.                 c = 49
  859.             CASE 429, 436
  860.                 c = 44
  861.             CASE 415, 422
  862.                 c = 43
  863.             CASE 401, 408
  864.                 c = 39
  865.         END SELECT
  866.         LINE (486, rr2)-(486 + 10, rr2 - 5), c, BF
  867.     NEXT
  868.  
  869.     FOR rr3 = 450 TO 450 - (R3) * m STEP -7
  870.         '332 TO 580 STEP 14
  871.         SELECT CASE rr3
  872.             CASE 443, 450
  873.                 c = 49
  874.             CASE 429, 436
  875.                 c = 44
  876.             CASE 415, 422
  877.                 c = 43
  878.             CASE 401, 408
  879.                 c = 39
  880.         END SELECT
  881.         LINE (500, rr3)-(500 + 10, rr3 - 5), c, BF
  882.     NEXT
  883.  
  884.  
  885.     FOR rr4 = 450 TO 450 - (R4) * m STEP -7
  886.         '332 TO 580 STEP 14
  887.         SELECT CASE rr4
  888.             CASE 443, 450
  889.                 c = 49
  890.             CASE 429, 436
  891.                 c = 44
  892.             CASE 415, 422
  893.                 c = 43
  894.             CASE 401, 408
  895.                 c = 39
  896.         END SELECT
  897.         LINE (514, rr4)-(514 + 10, rr4 - 5), c, BF
  898.     NEXT
  899.  
  900.     FOR rr5 = 450 TO 450 - (R5) * m STEP -7
  901.         '332 TO 580 STEP 14
  902.         SELECT CASE rr5
  903.             CASE 443, 450
  904.                 c = 49
  905.             CASE 429, 436
  906.                 c = 44
  907.             CASE 415, 422
  908.                 c = 43
  909.             CASE 401, 408
  910.                 c = 39
  911.         END SELECT
  912.         LINE (528, rr5)-(528 + 10, rr5 - 5), c, BF
  913.     NEXT
  914.  
  915.     FOR rr6 = 450 TO 450 - (R6) * m STEP -7
  916.         '332 TO 580 STEP 14
  917.         SELECT CASE rr6
  918.             CASE 443, 450
  919.                 c = 49
  920.             CASE 429, 436
  921.                 c = 44
  922.             CASE 415, 422
  923.                 c = 43
  924.             CASE 401, 408
  925.                 c = 39
  926.         END SELECT
  927.         LINE (542, rr6)-(542 + 10, rr6 - 5), c, BF
  928.     NEXT
  929.  
  930.     FOR rr7 = 450 TO 450 - (R7) * m STEP -7
  931.         '332 TO 580 STEP 14
  932.         SELECT CASE rr7
  933.             CASE 443, 450
  934.                 c = 49
  935.             CASE 429, 436
  936.                 c = 44
  937.             CASE 415, 422
  938.                 c = 43
  939.             CASE 401, 408
  940.                 c = 39
  941.         END SELECT
  942.         LINE (556, rr7)-(556 + 10, rr7 - 5), c, BF
  943.     NEXT
  944.  
  945.     FOR rr8 = 450 TO 450 - (R8) * m STEP -7
  946.         '332 TO 580 STEP 14
  947.         SELECT CASE rr8
  948.             CASE 443, 450
  949.                 c = 49
  950.             CASE 429, 436
  951.                 c = 44
  952.             CASE 415, 422
  953.                 c = 43
  954.             CASE 401, 408
  955.                 c = 39
  956.         END SELECT
  957.         LINE (570, rr8)-(570 + 10, rr8 - 5), c, BF
  958.     NEXT
  959.     RETURN
  960.  
  961.  
  962. SUB Header
  963.     SHARED RATE, chan, bits
  964.     TYPE head
  965.         chunk AS STRING * 4 '       4 bytes  (RIFF)
  966.         size AS LONG '              4 bytes  (?E??)
  967.         fomat AS STRING * 4 '       4 bytes  (WAVE)
  968.         sub1 AS STRING * 4 '        4 bytes  (fmt )
  969.         subchunksize AS LONG '      4 bytes  (lo / hi), $00000010 for PCM audio
  970.         format AS STRING * 2 '      2 bytes  (0001 = standard PCM, 0101 = IBM mu-law, 0102 = IBM a-law, 0103 = IBM AVC ADPCM)
  971.         channels AS INTEGER '       2 bytes  (1 = mono, 2 = stereo)
  972.         rate AS LONG '              4 bytes  (sample rate, standard is 44100)
  973.         ByteRate AS LONG '          4 bytes  (= sample rate * number of channels * (bits per channel /8))
  974.         Block AS INTEGER '          2 bytes  (block align = number of channels * bits per sample /8)
  975.         Bits AS INTEGER '           2 bytes  (bits per sample. 8 = 8, 16 = 16)
  976.         subchunk2 AS STRING * 4 '   4 bytes  ("data")  contains begin audio samples
  977.     END TYPE '                     40 bytes  total
  978.     DIM H AS head
  979.  
  980.     IF _FILEEXISTS(file$) THEN OPEN file$ FOR BINARY AS #10 ELSE PRINT file$; " not found": SYSTEM
  981.     GET #10, , H
  982.     CLOSE #10
  983.     PRINT "File info:"
  984.     PRINT "File name: "; file$
  985.     PRINT H.chunk;: IF H.chunk = "RIFF" THEN COLOR 49: PRINT " - OK, WAV format" ELSE COLOR 39: PRINT "ERROR! Unsupported type!": END
  986.     COLOR 15: PRINT "File size: "; H.size + 8; "bytes"
  987.     PRINT "File format: "; H.fomat
  988.     PRINT "Subchunk1 (may be fmt): "; H.sub1
  989.     PRINT "Subchunk size: "; H.subchunksize
  990.     PRINT "Audio format: "; CVI(H.format) '              in this and next line you see two way to get values. This is read as string and then converted using CVI,
  991.     PRINT "Audio channels: "; H.channels '               but this value is directly read as number INTEGER (2 byte long number), then is not need CVI.
  992.     PRINT "Audio Sample Rate:"; H.rate
  993.     PRINT "Audio Byte Rate:"; H.ByteRate; "bites per second"
  994.     PRINT "Block align: "; H.Block; "bytes (in stereo format 2x more as in mono)"
  995.     PRINT "Bits per sample:"; H.Bits
  996.     PRINT "Is found data area? ";: IF H.subchunk2 = "data" THEN COLOR 49: PRINT "yes" ELSE COLOR 39: PRINT "no"
  997.  
  998.     block = H.Block
  999.     RATE = H.rate
  1000.     chan = H.channels
  1001.     bits = H.Bits
  1002.     IF bits <> 16 THEN COLOR 39: PRINT "Ok, this version support 8 bit WAV audio files! Graphic is not full coordinated with this sounds.": ' SLEEP 3: SYSTEM
  1003.     SLEEP 2
  1004.     COLOR 15
  1005.     CLS
  1006.  
  1007.  
  1008. SUB MP3HEADER (file AS STRING)
  1009.     SHARED chan, RATE
  1010.     PRINT "Reading MP3 file headers...."
  1011.     TYPE MP3
  1012.         A AS STRING * 1
  1013.         B AS STRING * 1
  1014.         C AS STRING * 1
  1015.         D AS STRING * 1
  1016.     END TYPE
  1017.  
  1018.     REDIM MP3 AS MP3
  1019.     IF _FILEEXISTS(file$) THEN OPEN file$ FOR BINARY AS #4 ELSE PRINT "file not found": END
  1020.     DO WHILE NOT EOF(4)
  1021.         GET #4, , MP3
  1022.  
  1023.         first8$ = DECtoBIN$(ASC(MP3.A))
  1024.         second3$ = LEFT$(DECtoBIN$(ASC(MP3.B)), 3) '                    all 11 bites muss be 11111111111, its head identifier
  1025.         second2$ = LEFT$(RIGHT$(DECtoBIN$(ASC(MP3.B)), 5), 2) '         2 bites MPEG audio version ID: 00=2.5, 01 = reserved, 10=layer2, 11=layer1
  1026.         seco2d2$ = LEFT$(RIGHT$(DECtoBIN$(ASC(MP3.B)), 3), 2) '         2 bites layer description. 00=reserved,01=layer3,10=layer2,11=layer1
  1027.         seco3d1$ = RIGHT$(DECtoBIN$(ASC(MP3.B)), 1) '                   1 bite protection bit. 0=protected by CRC, 1=not protected
  1028.         third4$ = LEFT$(DECtoBIN$(ASC(MP3.C)), 4) '                     4 bites for bitrate index. This value CAN NOT BE 1111.
  1029.         thi2r2$ = LEFT$(RIGHT$(DECtoBIN$(ASC(MP3.C)), 4), 2) '          2 bites sampling rate frequency. This we need for us program
  1030.         thi3r1$ = LEFT$(RIGHT$(DECtoBIN$(ASC(MP3.C)), 2), 1) '          1 bite - padding bit. 0=frame not padded, 1=frame padded
  1031.         '
  1032.         thi4r1$ = RIGHT$(DECtoBIN$(ASC(MP3.C)), 1) '                    1 bite - private bit
  1033.  
  1034.         four2$ = LEFT$(DECtoBIN$(ASC(MP3.D)), 2) '                      2 bite - channel mode: 00=stereo, 01=joint stereo, 10=dual stereo, 11=mono
  1035.         fou22$ = LEFT$(RIGHT$(DECtoBIN$(ASC(MP3.D)), 7), 2) '           2 bite - mode extension. ONLY IF IS JOINT STEREO
  1036.  
  1037.         fou31$ = LEFT$(RIGHT$(DECtoBIN$(ASC(MP3.D)), 4), 2) '           copyright - 0=not copyrighted, 1=copyrighted
  1038.         fou41$ = LEFT$(RIGHT$(DECtoBIN$(ASC(MP3.D)), 4), 2) '           0=copy, 1=original
  1039.         fou52$ = RIGHT$(DECtoBIN$(ASC(MP3.D)), 2) '                     emphasis:   00=none, 01=50/15mS, 10=reserves, 11=CCIT J.17
  1040.  
  1041.  
  1042.         first11$ = first8$ + second3$
  1043.         IF first11$ = "11111111111" THEN
  1044.             SELECT CASE second2$
  1045.                 CASE "00": Version$ = "Layer 2.5": MPG = 2: MP = 2.5: FrameSize = 1152
  1046.                 CASE "10": Vesrion$ = "Layer 2": MPG = 2: MP = 2: FrameSize = 1152
  1047.                 CASE "11": Version$ = "Layer 1": MPG = 1: MP = 1: FrameSize = 384
  1048.                 CASE "01": Version$ = "ERROR!"
  1049.             END SELECT
  1050.  
  1051.             SELECT CASE seco2d2$
  1052.                 CASE "00": layer$ = "ERROR!"
  1053.                 CASE "01": layer$ = "Layer 3": LAY = 3
  1054.                 CASE "10": layer$ = "Layer 2": LAY = 2
  1055.                 CASE "11": layer$ = "Layer 1": LAY = 1
  1056.             END SELECT
  1057.             SELECT CASE seco3d1$
  1058.                 CASE "0": protect$ = "Protected by CRC"
  1059.                 CASE "1": protect$ = "Not protected"
  1060.             END SELECT
  1061.             SELECT CASE third4$
  1062.                 CASE "0000": 'PRINT "Bitrate free"
  1063.                 CASE "0001"
  1064.                     IF MPG = 1 AND LAY = 1 THEN Bitrate = 32
  1065.                     IF MPG = 1 AND LAY = 2 THEN Bitrate = 32
  1066.                     IF MPG = 1 AND LAY = 3 THEN Bitrate = 32
  1067.                     IF MPG = 2 AND LAY = 1 THEN Bitrate = 32
  1068.                     IF MPG = 2 AND LAY = 2 OR MPG = 2 AND LAY = 3 THEN Bitrate = 8
  1069.                 CASE "0010"
  1070.                     IF MPG = 1 AND LAY = 1 THEN Bitrate = 64
  1071.                     IF MPG = 1 AND LAY = 2 THEN Bitrate = 48
  1072.                     IF MPG = 1 AND LAY = 3 THEN Bitrate = 40
  1073.                     IF MPG = 2 AND LAY = 1 THEN Bitrate = 48
  1074.                     IF MPG = 2 AND LAY = 2 OR MPG = 2 AND LAY = 3 THEN Bitrate = 16
  1075.                 CASE "0011"
  1076.                     IF MPG = 1 AND LAY = 1 THEN Bitrate = 96
  1077.                     IF MPG = 1 AND LAY = 2 THEN Bitrate = 56
  1078.                     IF MPG = 1 AND LAY = 3 THEN Bitrate = 48
  1079.                     IF MPG = 2 AND LAY = 1 THEN Bitrate = 56
  1080.                     IF MPG = 2 AND LAY = 2 OR MPG = 2 AND LAY = 3 THEN Bitrate = 24
  1081.                 CASE "0100"
  1082.                     IF MPG = 1 AND LAY = 1 THEN Bitrate = 128
  1083.                     IF MPG = 1 AND LAY = 2 THEN Bitrate = 64
  1084.                     IF MPG = 1 AND LAY = 3 THEN Bitrate = 56
  1085.                     IF MPG = 2 AND LAY = 1 THEN Bitrate = 64
  1086.                     IF MPG = 2 AND LAY = 2 OR MPG = 2 AND LAY = 3 THEN Bitrate = 32
  1087.                 CASE "0101"
  1088.                     IF MPG = 1 AND LAY = 1 THEN Bitrate = 160
  1089.                     IF MPG = 1 AND LAY = 2 THEN Bitrate = 80
  1090.                     IF MPG = 1 AND LAY = 3 THEN Bitrate = 64
  1091.                     IF MPG = 2 AND LAY = 1 THEN Bitrate = 80
  1092.                     IF MPG = 2 AND LAY = 2 OR MPG = 2 AND LAY = 3 THEN Bitrate = 40
  1093.                 CASE "0110"
  1094.                     IF MPG = 1 AND LAY = 1 THEN Bitrate = 192
  1095.                     IF MPG = 1 AND LAY = 2 THEN Bitrate = 96
  1096.                     IF MPG = 1 AND LAY = 3 THEN Bitrate = 80
  1097.                     IF MPG = 2 AND LAY = 1 THEN Bitrate = 96
  1098.                     IF MPG = 2 AND LAY = 2 OR MPG = 2 AND LAY = 3 THEN Bitrate = 48
  1099.                 CASE "0111"
  1100.                     IF MPG = 1 AND LAY = 1 THEN Bitrate = 224
  1101.                     IF MPG = 1 AND LAY = 2 THEN Bitrate = 112
  1102.                     IF MPG = 1 AND LAY = 3 THEN Bitrate = 96
  1103.                     IF MPG = 2 AND LAY = 1 THEN Bitrate = 112
  1104.                     IF MPG = 2 AND LAY = 2 OR MPG = 2 AND LAY = 3 THEN Bitrate = 56
  1105.                 CASE "1000"
  1106.                     IF MPG = 1 AND LAY = 1 THEN Bitrate = 256
  1107.                     IF MPG = 1 AND LAY = 2 THEN Bitrate = 128
  1108.                     IF MPG = 1 AND LAY = 3 THEN Bitrate = 112
  1109.                     IF MPG = 2 AND LAY = 1 THEN Bitrate = 128
  1110.                     IF MPG = 2 AND LAY = 2 OR MPG = 2 AND LAY = 3 THEN Bitrate = 64
  1111.                 CASE "1001"
  1112.                     IF MPG = 1 AND LAY = 1 THEN Bitrate = 288
  1113.                     IF MPG = 1 AND LAY = 2 THEN Bitrate = 160
  1114.                     IF MPG = 1 AND LAY = 3 THEN Bitrate = 128
  1115.                     IF MPG = 2 AND LAY = 1 THEN Bitrate = 144
  1116.                     IF MPG = 2 AND LAY = 2 OR MPG = 2 AND LAY = 3 THEN Bitrate = 80
  1117.                 CASE "1010"
  1118.                     IF MPG = 1 AND LAY = 1 THEN Bitrate = 320
  1119.                     IF MPG = 1 AND LAY = 2 THEN Bitrate = 192
  1120.                     IF MPG = 1 AND LAY = 3 THEN Bitrate = 160
  1121.                     IF MPG = 2 AND LAY = 1 THEN Bitrate = 160
  1122.                     IF MPG = 2 AND LAY = 2 OR MPG = 2 AND LAY = 3 THEN Bitrate = 96
  1123.                 CASE "1011"
  1124.                     IF MPG = 1 AND LAY = 1 THEN Bitrate = 352
  1125.                     IF MPG = 1 AND LAY = 2 THEN Bitrate = 224
  1126.                     IF MPG = 1 AND LAY = 3 THEN Bitrate = 192
  1127.                     IF MPG = 2 AND LAY = 1 THEN Bitrate = 176
  1128.                     IF MPG = 2 AND LAY = 2 OR MPG = 2 AND LAY = 3 THEN Bitrate = 112
  1129.                 CASE "1100"
  1130.                     IF MPG = 1 AND LAY = 1 THEN Bitrate = 384
  1131.                     IF MPG = 1 AND LAY = 2 THEN Bitrate = 256
  1132.                     IF MPG = 1 AND LAY = 3 THEN Bitrate = 224
  1133.                     IF MPG = 2 AND LAY = 1 THEN Bitrate = 192
  1134.                     IF MPG = 2 AND LAY = 2 OR MPG = 2 AND LAY = 3 THEN Bitrate = 128
  1135.                 CASE "1101"
  1136.                     IF MPG = 1 AND LAY = 1 THEN Bitrate = 416
  1137.                     IF MPG = 1 AND LAY = 2 THEN Bitrate = 320
  1138.                     IF MPG = 1 AND LAY = 3 THEN Bitrate = 256
  1139.                     IF MPG = 2 AND LAY = 1 THEN Bitrate = 224
  1140.                     IF MPG = 2 AND LAY = 2 OR MPG = 2 AND LAY = 3 THEN Bitrate = 144
  1141.                 CASE "1110"
  1142.                     IF MPG = 1 AND LAY = 1 THEN Bitrate = 448
  1143.                     IF MPG = 1 AND LAY = 2 THEN Bitrate = 384
  1144.                     IF MPG = 1 AND LAY = 3 THEN Bitrate = 320
  1145.                     IF MPG = 2 AND LAY = 1 THEN Bitrate = 256
  1146.                     IF MPG = 2 AND LAY = 2 OR MPG = 2 AND LAY = 3 THEN Bitrate = 160
  1147.                 CASE "1111"
  1148.                     Bitrate = -1
  1149.             END SELECT
  1150.             SELECT CASE thi2r2$ 'sample rate table
  1151.                 CASE "00"
  1152.                     IF MP = 1 THEN Freq = 44100
  1153.                     IF MP = 2 THEN Freq = 22050
  1154.                     IF MP = 2.5 THEN Freq = 11025
  1155.                 CASE "01"
  1156.                     IF MP = 1 THEN Freq = 48000
  1157.                     IF MP = 2 THEN Freq = 24000
  1158.                     IF MP = 2.5 THEN Freq = 12000
  1159.                 CASE "10"
  1160.                     IF MP = 1 THEN Freq = 32000
  1161.                     IF MP = 2 THEN Freq = 16000
  1162.                     IF MP = 2.5 THEN Freq = 8000
  1163.                 CASE "11"
  1164.                     Freq = -1
  1165.             END SELECT
  1166.             SELECT CASE thi3r1$ 'padding bit
  1167.                 CASE "1"
  1168.                     IF MPG = 1 THEN pad = 32: FrameLenghtInBytes = (12 * Bitrate * 1000 / Freq * 10 + pad) * 4
  1169.                     IF MPG = 2 THEN pad = 8: FrameLenghtInBytes = 144 * Bitrate * 1000 / Freq * 10 + pad
  1170.                 CASE "0"
  1171.                     IF MPG = 1 THEN FrameLenghtInBytes = (12 * Bitrate * 1000 / Freq * 10) * 4
  1172.                     IF MPG = 2 THEN FrameLenghtInBytes = 144 * Bitrate * 1000 / Freq * 10
  1173.             END SELECT
  1174.             SELECT CASE four2$
  1175.                 CASE "00", "01", "10": chan = 2
  1176.                 CASE "11": chan = 1
  1177.             END SELECT
  1178.  
  1179.             IF Bitrate <> -1 AND Freq <> -1 THEN
  1180.  
  1181.                 IF ch = chan AND f = Freq THEN pass = pass + 1 ELSE ch = chan: f = Freq 'MUSS BE TESTED IN MORE CASES FOR VARIABLE MP3 COMPRESSION COMPATIBILITY!!!!!!!!!!!!!!!!!!!!
  1182.                 IF pass > 10 THEN EXIT DO '                                             you can see blick character E in program. Its because E is possible in 44 Khz only and sound use variable compression.
  1183.             END IF
  1184.  
  1185.  
  1186.  
  1187.  
  1188.         END IF
  1189.     LOOP
  1190.  
  1191.     PRINT "Found MP3 frame in"; SEEK(4)
  1192.     PRINT "Mode:"; chan
  1193.     PRINT "Rate:"; Freq
  1194.     PRINT "Bitrate:"; Bitrate; "kbps"
  1195.     RATE = Freq
  1196.     CLOSE #4
  1197.  
  1198.  
  1199. SUB id3s (file AS STRING)
  1200.     SHARED inframe$, file$, identit$, FileCreated, bVelikost
  1201.     id& = _NEWIMAGE(640, 480, 32)
  1202.     _DEST id&
  1203.  
  1204.     OPEN file$ FOR BINARY AS #1
  1205.     GET #1, , ID3
  1206.  
  1207.     IF ID3.Identifier$ <> "ID3" THEN PRINT "ID3 mark not found": identit$ = "ID3V1.1": GOTO ID3V11
  1208.     Version$ = "2." + LTRIM$(RTRIM$(STR$(ASC(ID3.VersionMajor$)))) + "." + LTRIM$(STR$(ASC(ID3.VersionRevis$))): PRINT "Detected ID3 v."; Version$: IF Version$ <> "2.3.0" THEN PRINT "WARNING, WRONG VERSION, THIS IS V2.3!!!"
  1209.     identit$ = Version$
  1210.  
  1211.  
  1212.     Ba$ = DECtoBIN$(ASC(ID3.BinarSizeA$))
  1213.     Bb$ = DECtoBIN$(ASC(ID3.BinarSizeB$)) '                                     FUNCTION converted decimal numbers to binar numbers
  1214.     Bc$ = DECtoBIN$(ASC(ID3.BinarSizeC$))
  1215.     Bd$ = DECtoBIN$(ASC(ID3.BinarSizeD$))
  1216.  
  1217.  
  1218.     headd$ = RIGHT$(Ba$, 7) + RIGHT$(Bb$, 7) + RIGHT$(Bc$, 7) + RIGHT$(Bd$, 7) '            BINARY WAR
  1219.     h = HEAD(headd$) / 2
  1220.     PRINT "Head size calculated AS STRING: "; h; " bytes"
  1221.  
  1222.     IF VAL(LEFT$(DECtoBIN$(ID3.BinarFlags), 1)) = 0 THEN PRINT "Synchronisation is not used" ELSE PRINT "Synchronisation is used"
  1223.     IF VAL(RIGHT$(LEFT$(DECtoBIN$(ID3.BinarFlags), 1), 1)) = 0 THEN PRINT "Extended header for ID3TAG is not used" ELSE PRINT "Extended header for ID3TAG is used - not supported by this program"
  1224.     IF VAL(RIGHT$(LEFT$(DECtoBIN$(ID3.BinarFlags), 2), 1)) = 1 THEN PRINT "Experimental ID3 TAG!" 'VAL is possile to use because strings contains zero or one
  1225.  
  1226.  
  1227.     '----------- cteni framu --------------               frames reading
  1228.     w = 1 '                                                                    FRAME head is 10 bytes long. 4 byte = name "AENC" or other, 4 byte size, 2 byte flags. Size is calculated as ASC sum of all four
  1229.     home: '                                                                    bytes.
  1230.  
  1231.     GET #1, , FRM '                                                             hlava ma 10 bytu: 4 byty jmeno, 4 byty velikost, 2 byty flags. Vse je psano klasicky hexadecimalne, uz zadny nesmysly s bitama.
  1232.     '                                                                                                   minimalni krok k dalsimu zaznamu ma byt 11 bytu (1byt je minimum pro kazdy identifikator, 10 byt
  1233.     '                                                                                                  je velikost hlavy. Velikost framu je dana souctem ASC ctyr bytu v hlave Framu.
  1234.     FrameSize = ASC(FRM.SizeA$) + ASC(FRM.SizeB$) + ASC(FRM.SizeC$) + ASC(FRM.SizeD$)
  1235.     inframe$ = SPACE$(FrameSize) 'this statement using is Clippy method, thank Clippy!
  1236.     GET #1, , inframe$
  1237.     q$ = FRM.Id$
  1238.     SELECT CASE FRM.Id$ '   -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  - X =  HAVE OWN SECOND HEAD and can be more defined
  1239.         CASE "AENC": q$ = "Audio encryption:" '                    X
  1240.         CASE "APIC": q$ = "Attached Picture:": APICSUB: FC = 1: GOTO home 'X have writed. Is in this program.
  1241.         CASE "COMM": q$ = "Comments:" '                            X
  1242.         CASE "COMR": q$ = "Commercial frame:" '                    X
  1243.         CASE "ENCR": q$ = "Encryption method:" '                   X
  1244.         CASE "EQUA": q$ = "Equalization:" '                        X
  1245.         CASE "ETCO": q$ = "Event timing codes:" '                  X
  1246.         CASE "GEOB": q$ = "General encapsulated object:" '         X
  1247.         CASE "GRID": q$ = "Group identification registration:" '   X
  1248.         CASE "IPLS": q$ = "Involved people list:"
  1249.         CASE "LINK": q$ = "Linked information:" '                  X
  1250.         CASE "MCDI": q$ = "Music CD identifier:" '                 X
  1251.         CASE "MLLT": q$ = "MPEG location lookup table:" '          X
  1252.         CASE "OWNE": q$ = "Ownership frame:" '                     X
  1253.         CASE "PRIV": q$ = "Private frame:" '                       X
  1254.         CASE "PCNT": q$ = "Play counter:" '                        X
  1255.         CASE "POPM": q$ = "Popularimeter:"
  1256.         CASE "POSS": q$ = "Position synchronisation frame:" '      X
  1257.         CASE "RBUF": q$ = "Recommended buffer size:" '             X
  1258.         CASE "RVAD": q$ = "Relative volume adjustment:" '          X
  1259.         CASE "RVRB": q$ = "Reverb" '                               X
  1260.         CASE "SYLT": q$ = "Synchronized lyric / text:"
  1261.         CASE "SYTC": q$ = "Synchronized tempo codes:" '            X
  1262.         CASE "TALB": q$ = "Album / Movie / Show title:"
  1263.         CASE "TBPM": q$ = "Beats per minute:"
  1264.         CASE "TCOM": q$ = "Composer: "
  1265.         CASE "TCON": q$ = "Content type:" '                        X - number = style as ID3TAGV1.1
  1266.         CASE "TCOP": q$ = "Copyright message:"
  1267.         CASE "TDAT": q$ = "Date:" '                                    numeric record always 4 bytes long
  1268.         CASE "TDLY": q$ = "Playlist delay:"
  1269.         CASE "TENC": q$ = "Encoded by:"
  1270.         CASE "TEXT": q$ = "Lyricist / Text Writer"
  1271.         CASE "TFLT": q$ = "File type:" '                           X -  1/2/3/2.5(MPGs)/AAC/VQF/PCM
  1272.         CASE "TIME": q$ = "Time:" '                                      format HH:MM
  1273.         CASE "TIT1": q$ = "Content group description:"
  1274.         CASE "TIT2": q$ = "Title / songname:"
  1275.         CASE "TIT3": q$ = "Subtitle / Description refinement:"
  1276.         CASE "TKEY": q$ = "Initial key:"
  1277.         CASE "TLAN": q$ = "Language:"
  1278.         CASE "TLEN": q$ = "Length:"
  1279.         CASE "TMED": q$ = "Media type" '                           X
  1280.         CASE "TOAL": q$ = "Original album / movie / show title:"
  1281.         CASE "TOFN": q$ = "Original filename:"
  1282.         CASE "TOLY": q$ = "Original lyricist / text writer:"
  1283.         CASE "TOPE": q$ = "Original artist / performer:"
  1284.         CASE "TORY": q$ = "Original release year:"
  1285.         CASE "TOWN": q$ = "File owner / license:"
  1286.         CASE "TPE1": q$ = "Lead performer / Soloist:"
  1287.         CASE "TPE2": q$ = "Band / orchestra / accompaniment:"
  1288.         CASE "TPE3": q$ = "Conductor / performer refinement:"
  1289.         CASE "TPE4": q$ = "Modified by:"
  1290.         CASE "TPOS": q$ = "Part of a set:"
  1291.         CASE "TPUB": q$ = "Publisher:"
  1292.         CASE "TRCK": q$ = "Track number / Position in set:"
  1293.         CASE "TRDA": q$ = "Recording dates:"
  1294.         CASE "TRSN": q$ = "Internet radio station name:"
  1295.         CASE "TRSO": q$ = "Internet radio station owner:"
  1296.         CASE "TSIZ": q$ = "Size:"
  1297.         CASE "TSRC": q$ = "International standard recording code (ISRC):"
  1298.         CASE "TSSE": q$ = "Software / Hardware used for encoding:"
  1299.         CASE "TYER": q$ = "Year:"
  1300.         CASE "TXXX": q$ = "User defined text frame:" '             X - text encoding, description and value
  1301.         CASE "UFID": q$ = "Unique file identifier:"
  1302.         CASE "USER": q$ = "Terms of use:" '                        X
  1303.         CASE "USLT": q$ = "Unsychronized lyric/text transcription:" 'X
  1304.         CASE "WCOM": q$ = "Commercial information:"
  1305.         CASE "WCOP": q$ = "Copyright / Legal information:"
  1306.         CASE "WOAF": q$ = "Official audio file webpage:"
  1307.         CASE "WOAR": q$ = "Official artist / performer webpage:"
  1308.         CASE "WOAS": q$ = "Official audio source webpage:"
  1309.         CASE "WORS": q$ = "Official internet radio webpage:"
  1310.         CASE "WPAY": q$ = "Payment:"
  1311.         CASE "WPUB": q$ = "Publishers official webpage:"
  1312.         CASE "WXXX": q$ = "User defined URL link frame:" '           X
  1313.     END SELECT
  1314.  
  1315.  
  1316.     IF FRM.Id$ = "USLT" THEN
  1317.         textencod1 = ASC(LEFT$(inframe$, 1))
  1318.         textencod2 = ASC(LEFT$(MID$(inframe$, 1), 1))
  1319.         PRINT textencod1, textencod2
  1320.     END IF
  1321.  
  1322.     IF LEFT$(FRM.Id$, 1) = CHR$(0) OR LEFT$(FRM.Id$, 1) = CHR$(32) OR LEFT$(FRM.Id$, 1) = CHR$(255) OR RIGHT$(FRM.Id$, 1) = "d" THEN GOTO EndRec
  1323.  
  1324.     OUTList$(w, 0) = q$
  1325.     OUTList$(0, w) = inframe$
  1326.  
  1327.     inframe$ = ""
  1328.     readet = readet + 10 + FrameSize
  1329.     w = w + 1: GOTO home
  1330.     EndRec:
  1331.  
  1332.  
  1333.  
  1334.     PRINT "List: "; identit$
  1335.     FOR z = 1 TO w
  1336.         COLOR _RGB32(255, 0, 0): PRINT OUTList$(z, 0);: COLOR _RGB32(128, 128, 128): PRINT OUTList$(0, z)
  1337.     NEXT z
  1338.     IF FC = 1 THEN tis = 1000 ELSE tis = -SEEK(1)
  1339.     bVelikost = SEEK(1) + tis
  1340.     IF bVelikost > 0 THEN
  1341.         '-------- russian upgrade -------
  1342.         '            file$ = "soundcopy.mp3"
  1343.         new$ = SPACE$(LOF(1) - bVelikost)
  1344.         OPEN "soundcopy.mp3" FOR BINARY AS #60
  1345.         SEEK #1, bVelikost
  1346.         GET #1, , new$
  1347.         PUT #60, , new$
  1348.         CLOSE #60
  1349.         file$ = "soundcopy.mp3"
  1350.         '-----------------------------------
  1351.     END IF
  1352.     CLOSE #1
  1353.     EXIT SUB
  1354.  
  1355.  
  1356.     ID3V11:
  1357.     CLOSE
  1358.     OPEN file$ FOR BINARY AS #1
  1359.     DIM re AS STRING * 256
  1360.     DIM re0 AS STRING * 128
  1361.     DIM re2 AS STRING * 128
  1362.     GET #1, , re0$: IF LEFT$(re0$, 3) <> "ID3" THEN PRINT "ID3 mark not found! - but i try this" ' its opened, also its posibble to have uncorrect outputs.
  1363.     PRINT "Wait..."
  1364.     e = LOF(1) - 128
  1365.     IF e < 128 THEN PRINT "Error: LOF returned file length < 128 bytes!"
  1366.     CLS
  1367.     SEEK #1, e
  1368.     GET #1, e - 1, re0$
  1369.     GET #1, e, re2$
  1370.     re$ = re0$ + re2$ '                                   After several attempts, I realized that the begin of the last record may not be the very last recording at the end of the file...    :-D
  1371.  
  1372.     FOR scan = 1 TO LEN(re$) '                            Here this loop byte to byte scanned re$ for text "TAG" - its definition for ID3 tag begin
  1373.         id$ = LEFT$(MID$(re$, scan), 3)
  1374.         IF id$ = "TAG" THEN sca = scan: found = 1 '       byte position in string, "found" is myself method to prevent uncorrect outputs if file have none or ID3 V.2.2 ID3TAG, but its not usefull at 100%
  1375.     NEXT scan
  1376.     IF found = 0 THEN PRINT "Uncorrect record or no ID3V1.1 / ID3V2.3": CLOSE #1: EXIT SUB
  1377.     dal:
  1378.  
  1379.     SongName$ = LEFT$(MID$(re$, 3 + sca), 30)
  1380.     Autor$ = LEFT$(MID$(re$, 33 + sca), 30) '           filtering strings
  1381.     Album$ = LEFT$(MID$(re$, 63 + sca), 30) '           This way "integer = ASC(LEFT$(MID$(string$, position), long)) is way how read MP3 HEAD. BUT MP3 HEAD contains MANY tables and recordings.
  1382.     Rok$ = LEFT$(MID$(re$, 93 + sca), 4)
  1383.     Coment$ = LEFT$(MID$(re$, 97 + sca), 28)
  1384.     TrackID$ = LEFT$(MID$(re$, 125 + sca), 1)
  1385.     IF TrackID$ = CHR$(0) THEN track$ = STR$(ASC(LEFT$(MID$(re$, 126 + sca), 1))) ELSE track$ = "Not writed" '  See to https://en.wikipedia.org/wiki/ID3
  1386.     Gen$ = LEFT$(MID$(re$, 127 + sca), 1)
  1387.     IF Gen$ = "" THEN GOTO none
  1388.     genre = ASC(Gen$) + 1
  1389.     IF genre = 0 OR genre > 125 THEN GOTO none
  1390.     FOR gnr = 1 TO genre
  1391.         READ genre$
  1392.     NEXT gnr
  1393.     none:
  1394.     'PRINT re$ '  If you delete this mark "'", you see as its writed in file
  1395.     PRINT identit$
  1396.     PRINT
  1397.     PRINT "Song name: "; SongName$ '         Song
  1398.     PRINT "Author: "; Autor$ '               Author name
  1399.     PRINT "Album: "; Album$ '                Album
  1400.     PRINT "Year: "; Rok$ '                   Year
  1401.     PRINT "Comment: "; Coment$ '             Comment
  1402.     PRINT "Track: "; track$ '                Track number
  1403.     PRINT "Genre: "; genre$ '                Genre
  1404.  
  1405.     genre:
  1406.  
  1407.     DATA Blues,Classic Rock,Country,Dance,Disco,Funk,Grunge,Hip-Hop,Jazz,Metal,New Age,Oldies,Other,Pop,R&B,Rap,Reggae,Rock,Techno,Industrial,Alternative,Ska,Death Metal,Pranks,Soundtrack,Eurotechno,Ambient
  1408.     DATA Trip-Hop,Vocal,Jazz+Funk,Fusion,Trance,Classical,Instrumental,Acid,House,Game,Sound Clip,Gospel,Noise,Alternative Rock,Bass,Soul,Punk,Space,Meditative,Instrumental Pop,Instrumental Rock,Ethnic
  1409.     DATA Gothic,Darkwave,Techno-Industrial,Electronic,Jungle,Pop-Folk,Eurodance,Dream,Southern Rock,Comedy,Cult,Gangsta,Top 40,Christian Rap,Pop/Funk,Native American,Cabaret,New Wave,Psychadelic,Rave,Show Tunes
  1410.     DATA Trailer,Lo-Fi,Tribal,Acid Punk,Acid Jazz,Polka,Retro,Musical,Rock & Roll,Hard Rock,Folk,Folk/Rock,National Folk,Swing,Fast-Fusion,Bebop,Latin,Revival,Celtic,Bluegrass,Avantgarde,Gothic Rock,Progressive Rock
  1411.     DATA Psychedelic Rock,Symphonic Rock,Slow Rock,Big Band,Chorus,Easy Listening,Acoustic,Humour,Speech,Chanson,Opera,Chamber Music,Sonata,Symphony,Booty Bass,Primus,Porn Groove,Satire,Slow Jam,Club,Tango,Samba
  1412.     DATA Folklore,Ballad,Power Ballad,Rhytmic Soul,Freestyle,Duet,Punk Rock,Drum Solo,Acapella,Euro-House,Dance Hall,Goa,Drum & Bass,Club-House,Hardcore,Terror,Indie,BritPop,Negerpunk,Polsk Punk,Beat,Christian Gangsta Rap
  1413.     DATA Heavy Metal,Black Metal,Crossover,Contemporary Christian,Christian Rock
  1414.  
  1415.  
  1416. SUB APICSUB
  1417.     SHARED file$, inframe$, id&, bVelikost
  1418.     _DEST id&
  1419.     'vstupni souborova pozice je jedno. Vystupni je podstatna.
  1420.     mime$ = LTRIM$(RTRIM$(LEFT$(MID$(inframe$, 2), 9)))
  1421.  
  1422.     DIM detect AS STRING * 1024: REM soubor budu cist po 1 kilobytu
  1423.     OPEN file$ FOR BINARY AS #21
  1424.     home:
  1425.     IF EOF(21) THEN GOTO konec
  1426.     GET #21, , detect$
  1427.  
  1428.     SELECT CASE LCASE$(mime$)
  1429.  
  1430.         CASE "image/bmp" 'mt.mp3
  1431.             FOR hledej = 1 TO LEN(detect$)
  1432.                 a = a + 1
  1433.                 s$ = LEFT$(MID$(detect$, hledej), 2)
  1434.                 IF s$ = "BM" THEN
  1435.                     x = INSTR(detect$, s$)
  1436.                     PRINT "Picture detected. Begin at: "; a
  1437.                     bmpsize = CVL(LEFT$(MID$(detect$, a + 2), 4)) 'read bytes 3,4,5,6 - here is saved file lenght
  1438.                     PRINT " Bitmap size: "; bmpsize
  1439.                     GOTO dd4
  1440.                 END IF
  1441.             NEXT hledej
  1442.             GOTO home
  1443.  
  1444.             dd4:
  1445.             b = a + bmpsize
  1446.             ee = bmpsize
  1447.  
  1448.         CASE "image/png" 'na.mp3
  1449.  
  1450.             FOR hledej = 1 TO LEN(detect$)
  1451.                 a = a + 1
  1452.                 s$ = LEFT$(MID$(detect$, hledej), 3)
  1453.                 t$ = LEFT$(MID$(detect$, hledej), 12)
  1454.                 ePNG$ = CHR$(0) + CHR$(0) + CHR$(0) + CHR$(0) + CHR$(73) + CHR$(69) + CHR$(78) + CHR$(68) + CHR$(174) + CHR$(66) + CHR$(96) + CHR$(130)
  1455.                 IF s$ = "PNG" THEN PRINT "Picture detected. Begin at: "; a - 1: newA = a - 1 'first byte in PNG is for transfer control
  1456.                 IF t$ = ePNG$ THEN PRINT "Picture detected. End at: "; a: b = a: GOTO dd3
  1457.             NEXT hledej
  1458.             GOTO home
  1459.             dd3:
  1460.             a = newA
  1461.             ee = b - a
  1462.             b = b + 12
  1463.             xt$ = ".png"
  1464.  
  1465.         CASE "image/gif" 'both type, 87a or 89a not tested
  1466.             FOR hledej = 1 TO LEN(detect$)
  1467.                 a = a + 1
  1468.                 s$ = LEFT$(MID$(detect$, hledej), 3)
  1469.                 t$ = LEFT$(MID$(detect$, hledej), 2)
  1470.                 IF s$ = "GIF" THEN PRINT "Picture detected. Begin at: "; a: c = a
  1471.                 IF t$ = CHR$(0) + CHR$(59) THEN PRINT "Picture detected. End at: "; a: b = a: GOTO dd2
  1472.             NEXT hledej
  1473.             GOTO home
  1474.             dd2:
  1475.             a = c
  1476.             ee = b - a
  1477.             xt$ = ".gif"
  1478.  
  1479.         CASE "image/jpe", "image/jpg", "image/jfi"
  1480.  
  1481.             FOR hledej = 1 TO LEN(detect$)
  1482.                 a = a + 1
  1483.                 s$ = LEFT$(MID$(detect$, hledej), 2)
  1484.                 a$ = LEFT$(MID$(detect$, hledej), 4)
  1485.                 t$ = LEFT$(s$, 1)
  1486.                 u$ = RIGHT$(s$, 1)
  1487.                 IF t$ = CHR$(255) AND u$ = CHR$(216) THEN PRINT "Picture detected. Begin at: "; a: c = a
  1488.                 IF t$ = CHR$(255) AND u$ = CHR$(217) THEN PRINT "Picture detected. End at: "; a: b = a: GOTO dd
  1489.             NEXT hledej
  1490.             GOTO home
  1491.             dd:
  1492.             xt$ = ".jpg"
  1493.             ee = b - c
  1494.             a = c
  1495.     END SELECT
  1496.     konec:
  1497.  
  1498.     DIM picture(ee) AS LONG
  1499.     image$ = "swap" + xt$
  1500.     SEEK #1, a
  1501.     picture$ = SPACE$(ee)
  1502.     GET #1, , picture$
  1503.     'PRINT "EE"; ee, picture$: BEEP: SLEEP
  1504.     OPEN image$ FOR OUTPUT AS #22: CLOSE #22
  1505.     OPEN image$ FOR BINARY AS #22
  1506.     PUT #22, , picture$
  1507.     CLOSE #22
  1508.     i& = _LOADIMAGE(image$, 32)
  1509.     IF i& <> -1 THEN _PUTIMAGE (439, 279)-(639, 479), i&, id&, (0, 0)-(_WIDTH(i&), _HEIGHT(i&)), _SMOOTH ELSE PRINT "This image format is in QB64 not supported. See to "; image$; " to picture output."
  1510.  
  1511.     SEEK #1, b
  1512.     bVelikost = b
  1513.  
  1514.  
  1515.  
  1516. SUB speed
  1517.     SHARED kro, block, spd, ko, quit
  1518.     i$ = INKEY$
  1519.     SELECT CASE i$
  1520.         CASE "+": spd = spd + .01
  1521.         CASE "-": spd = spd - .01
  1522.         CASE CHR$(27): quit = 1: EXIT SUB
  1523.     END SELECT
  1524.     IF spd > 1 THEN spd = 1
  1525.     IF spd < 0 THEN spd = 0
  1526.     ko = tahloL(200, 300, 420, spd)
  1527.     kro = block + INT(-4 + (ko * 10)) * (block / 2)
  1528.  
  1529.  
  1530.  
  1531. FUNCTION HEAD (b AS STRING) 'BIN to DEC vystup je integer, vstup je string (jmeno FUNKCE je promenna s hodnotou z funkce)
  1532.     FOR Si = 0 TO LEN(b$)
  1533.         e$ = LEFT$(MID$(b$, Si + 1), 1)
  1534.         c = VAL(e$)
  1535.         Sj = LEN(b$) - Si
  1536.         DECtoBI2 = DECtoBI2 + (c * 2 ^ Sj)
  1537.     NEXT Si
  1538.     '    PRINT "Si:"; Si
  1539.     HEAD = DECtoBI2
  1540.  
  1541.  
  1542. FUNCTION DECtoBIN$ (vstup) 'DEC to BIN ok vystup je string, vstup je integer          decimal to binary number convertor   -   FROM QB64WIKI
  1543.     SHARED BINARY$
  1544.     '   BINARY$ = ""
  1545.     FOR rj = 7 TO 0 STEP -1
  1546.         IF vstup AND 2 ^ rj THEN BINtoDE$ = BINtoDE$ + "1" ELSE BINtoDE$ = BINtoDE$ + "0"
  1547.     NEXT rj
  1548.     DECtoBIN$ = BINtoDE$
  1549.  
  1550. FUNCTION BINtoDEC (b AS STRING) 'BIN to DEC vystup je integer, vstup je string (jmeno FUNKCE je promenna s hodnotou z funkce)
  1551.     FOR Si = 0 TO 7
  1552.         e$ = LEFT$(MID$(b$, Si + 1), 1)
  1553.         c = VAL(e$) '                                                                  binary to decimaly number convertor
  1554.         Sj = 7 - Si
  1555.         DECtoBI = DECtoBI + (c * 2 ^ Sj)
  1556.     NEXT Si
  1557.     BINtoDEC = DECtoBI
  1558.  
  1559. FUNCTION HEXtoDEC (h AS STRING) 'Vystup je integer, vstup je string, opacne k funkci HEX$
  1560.     HEXtoDEC = VAL("&H" + h$) '                                                         hexadecimaly to decimaly number convertor
  1561.  
  1562. FUNCTION BINtoHEX$ (bi$)
  1563.     c = BINtoDEC(bi$) '                                                                 binary to hexadecimaly number convertor (use binary to decimaly convertor)
  1564.     BINtoHEX$ = HEX$(c)
  1565.  

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Compiler issue with sound commands
« Reply #3 on: September 22, 2018, 06:53:53 am »
So I found one more bug about SNDRAW in the 07-21-18 version - if the playing is longer than a minute and 35 seconds breaks into noise. When compiling in the old version of .85, this will not happen and everything works as it should. To test this error, I attach an external MP3 decoder (third party software). Take the attached MP3 file and play it in the previous program. When compiling in the latest ide, the noise will go to the end after 1:35. When compiling in the older one, everything runs right to the end.


edit: older ide = .85 a test it on more than 10 MP3 files, behavior is always the same. The old IDE .85 has no problem, the new sabotage my work after 1:35
« Last Edit: September 22, 2018, 07:17:36 am by Petr »

Offline Nuke

  • Newbie
  • Posts: 8
    • View Profile
Re: Compiler issue with sound commands
« Reply #4 on: September 22, 2018, 12:39:59 pm »
Hi Petr!

Thanks for the reply.  This is a really nice little program.  Beautifully done.  And yes, it works fine for me.  I don't encounter any errors when playing the full length of your sulc.mp3 file, or my dog.wav or anything else that I've tried so far.  Not sure why it would start generating noise at the 1:35 mark for your, unless perhaps its a memory issue with the _SNDRAW command.  My computer may have a more memory perhaps?  Regardless, I didn't encounter any error playing the full length of sulc.mp3.

I'll use _SNDRAW and an encoder to work around the issues with _SNDOPEN and _SNDPLAYFILE for now. 

Did you also encounter errors using _SNDOPEN or _SNDPLAYFILE on this latest build?  Or is this just me?
If the world didn't suck, we'd all fall off.

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: Compiler issue with sound commands
« Reply #5 on: September 22, 2018, 01:08:19 pm »
Hi Nuke
where is Duke?  :-)

welcome in this forum....

I use QB64 version 20180228/86 downloaded from here http://qb64.org/autobuilds/development/qb64_2018-09-21-04-38-01_e490b1a-development_win.7z
In my notebook Intel i3 8Gb Ram 500Gb HDD, TOSHIBA.
Usually I use QB64IDE to write and compile, but for the preference of the moment I have used DavIDE to test your program!
On first I have tryed to use your program with one of my MP3 more long of 1.35 minutes and all go good, no error or noise after this time.
On Second I have downloaded your dog.wav and the code works again well.

in the help of QB64 we can read
Quote
The _SNDOPEN function loads a sound file into memory and returns a LONG handle value
above 0.

Syntax:
     soundHandle& = _SNDOPEN(fileName$)

=Syntax prior to build 20170811/60=
ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
     soundHandle& = _SNDOPEN(fileName$[, "[VOL][,][SYNC][,][LEN][,][PAUSE][,][SETPOS]"])

Description:
þ Returns a LONG soundHandle& value to the sound file in memory. A zero value means the
  sound could not be loaded.
þ The literal or variable STRING sound fileName$ can be WAV, OGG or MP3 file types.
    þ Older versions of QB64 may support AIFF, RIFF, VOC, MOD and MIDI.
þ Always check the handle value returned is greater than zero before attempting to play
  the sound.
þ The handle can be used by most of the _SND sound playing functions and statements in
  QB64 except _SNDPLAYFILE which plays a sound file directly from the disk and does not
  use a handle value.
þ Handles can be closed with _SNDCLOSE when the sound is no longer necessary.
þ If a WAV sound file won't play, try it using the Windows Play WAV sounds library to
  check it or convert the sound file to OGG.

I can say that sometimes I have trouble with sound files but making a second attempt to run the code it goes well.
Good Coding
Programming isn't difficult, only it's  consuming time and coffee

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Compiler issue with sound commands
« Reply #6 on: September 22, 2018, 02:42:17 pm »
Quote
Did you also encounter errors using _SNDOPEN or _SNDPLAYFILE on this latest build?  Or is this just me?

Actually, I came to them right now because of your problem. I think the developers have already solved this, but I'm not quite sure. I currently know about the problem (and its solution with Fellippe) when trying to play MP3s on Linux. I do nothing with the sound right now, because make now something with graphic in 32 bit.

Offline Nuke

  • Newbie
  • Posts: 8
    • View Profile
Re: Compiler issue with sound commands
« Reply #7 on: September 22, 2018, 04:19:12 pm »
Hi TempodiBasic,

That's interesting.  The previous build you're running has no issues with _SNDOPEN or _SNDPLAY?  Then I would guess this issue is something that was introduced since then, maybe in the last build.  I'm going to download the version you're using and test it to see if I have issues with _SNDPLAY using it.   To be clear, that program was Petr's, not mine.  My issue was just getting these two lines to even compile.

h& = _SNDOPEN("D:\qb64\dog.wav")
IF h& = 0 THEN BEEP ELSE _SNDPLAY h& 'check for valid handle before using!

I get a compiler error message from these two lines of code.  It's not a run-time issue really.  But now I suspect this is being caused by the latest build of the compiler.

I'll let you know if I get the error using the version of QB64 that you're using.  Thanks for the reply!
If the world didn't suck, we'd all fall off.

Offline Nuke

  • Newbie
  • Posts: 8
    • View Profile
Re: Compiler issue with sound commands
« Reply #8 on: September 22, 2018, 04:22:14 pm »
And Petr, thanks for taking the time to look into it further.  I'll load a previous version of the compiler build as TempodiBasic suggested and see if the compile error still persists.  I'll let you know.

Regardless, I'll wait for an updated version of QB64 to try and use these commands.  I'll just use _SNDRAW for now.

Thanks man!
If the world didn't suck, we'd all fall off.

Offline TerryRitchie

  • Seasoned Forum Regular
  • Posts: 495
  • Semper Fidelis
    • View Profile
Re: Compiler issue with sound commands
« Reply #9 on: September 22, 2018, 04:23:56 pm »
I periodically had issues with .WAV and .MP3 files when I first started using QB64. I've never had an issue with .OGG files (that I can remember anyway) so now I convert all my sound files to .OGG using Audacity ( https://www.audacityteam.org/ ) before I use them in QB64.
In order to understand recursion, one must first understand recursion.

FellippeHeitor

  • Guest
Re: Compiler issue with sound commands
« Reply #10 on: September 22, 2018, 05:14:00 pm »
That MP3 specifically played with no issues on my machine until the end and I didn't encounter the issue with other files I had tested before. We use an external library for sound (OpenAL) and something must be interacting weirdly with your systems, but it's hard to pinpoint what exactly the issue may be.

Code: QB64: [Select]
  1. h& = _SNDOPEN("sulc.mp3")
  2. IF h& = 0 THEN PRINT "Loading failed.": END
  3.  
  4. PRINT "File loaded ok"
  5. PRINT "Sound length (seconds): "; _SNDLEN(h&)
  6. PRINT "Hit a key to start playing..."
  7. r = CSRLIN
  8. a$ = INPUT$(1)
  9.     LOCATE r, 1
  10.     PRINT USING "###.## / ###.##"; _SNDGETPOS(h&); _SNDLEN(h&)
  11.     _LIMIT 30

Now the dog.wav file not only didn't play on my machine but it also crashed when playing was attempted [EDIT: crash occurred when trying to load the file, I didn't even get to try playing it]. It may be encoded in too low a bitrate for the library to handle, but either way we'll have to wait for the C++ experts to be able to analyze what could be causing it, as well as the compilation error.

I was able to provide a solution to a recent issue of sound library not being able to be compiled on 64bit Linux systems (that's coming to a near-future dev build as soon as I can confirm it doesn't break 32bit versions), but that's a completely different beast.
« Last Edit: September 22, 2018, 05:16:09 pm by FellippeHeitor »

Offline Nuke

  • Newbie
  • Posts: 8
    • View Profile
Re: Compiler issue with sound commands
« Reply #11 on: September 22, 2018, 06:45:46 pm »
Hi Fellippe,

Well, hmm.  I tried pasting your program and compiling it after changing it to access the correct drive and directory for the sulc.mp3.  It gave me the same compiler error message.  I then changed the program to point to an MP3 file that didn't even exist, and it gave me the same compiler error message.  I don't believe it's even getting to the point that it's looking at the sound file before it crashes the compiler.  My guess is something is going on with my sound drivers and how they are allocated by Windows 10.  I tried running QB64 as the administrator, but that didn't seem to make any difference.  I'm obviously way out of my depth here.  Here's the compiler message that it generated again.  Thanks for looking at this.

libqb\os\win\libqb_1_2_011100000000.o:libqb.cpp:(.text+0x621cf): undefined reference to `_speex_resampler_init'
libqb\os\win\libqb_1_2_011100000000.o:libqb.cpp:(.text+0x62313): undefined reference to `_speex_resampler_process_interleaved_int'
libqb\os\win\libqb_1_2_011100000000.o:libqb.cpp:(.text+0x62341): undefined reference to `_speex_resampler_destroy'
libqb\os\win\libqb_1_2_011100000000.o:libqb.cpp:(.text+0x6235d): undefined reference to `_speex_resampler_destroy'
d:/qb64/internal/c/c_compiler/bin/../lib/gcc/i686-w64-mingw32/4.7.1/../../../../i686-w64-mingw32/bin/ld.exe: libqb\os\win\libqb_1_2_011100000000.o: bad reloc address 0x524 in section `.data'
d:/qb64/internal/c/c_compiler/bin/../lib/gcc/i686-w64-mingw32/4.7.1/../../../../i686-w64-mingw32/bin/ld.exe: final link failed: Invalid operation
collect2.exe: error: ld returned 1 exit status
If the world didn't suck, we'd all fall off.

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: Compiler issue with sound commands
« Reply #12 on: September 22, 2018, 07:27:39 pm »
Hi Nuke
I have just downloaded the last development version and your code with dog.wav runs well

QB64 version 1.2  revision (dev build) from git e490b1a

and you what OS is on your pc? What version of QB64 does error on your pc?
can your feedback more accurate?

Thanks
Programming isn't difficult, only it's  consuming time and coffee

Offline Nuke

  • Newbie
  • Posts: 8
    • View Profile
Re: Compiler issue with sound commands
« Reply #13 on: September 22, 2018, 09:32:05 pm »
Hi TempoidBasic,

Sorry, thought I'd mentioned that.  The error message is coming up using QB64, 32 bit version 1.2, Revision 20180202/85 From git 1d0f920.

I'm attaching a specifications file from Windows 10 showing all versions of O/S and driver information on my system.  The compiler error message doesn't give version information that I can see.

The simple line B& =_SNDOPEN("D:\qb64\dog.wav") compiled results in the error message in the IDE window below.  C++ Compilation Failed (Check .\internal\temp2\compilelog.txt), and that file contains the following text.

libqb\os\win\libqb_1_2_011100000000.o:libqb.cpp:(.text+0x621cf): undefined reference to `_speex_resampler_init'
libqb\os\win\libqb_1_2_011100000000.o:libqb.cpp:(.text+0x62313): undefined reference to `_speex_resampler_process_interleaved_int'
libqb\os\win\libqb_1_2_011100000000.o:libqb.cpp:(.text+0x62341): undefined reference to `_speex_resampler_destroy'
libqb\os\win\libqb_1_2_011100000000.o:libqb.cpp:(.text+0x6235d): undefined reference to `_speex_resampler_destroy'
d:/qb64/internal/c/c_compiler/bin/../lib/gcc/i686-w64-mingw32/4.7.1/../../../../i686-w64-mingw32/bin/ld.exe: libqb\os\win\libqb_1_2_011100000000.o: bad reloc address 0x524 in section `.data'
d:/qb64/internal/c/c_compiler/bin/../lib/gcc/i686-w64-mingw32/4.7.1/../../../../i686-w64-mingw32/bin/ld.exe: final link failed: Invalid operation
collect2.exe: error: ld returned 1 exit status
If the world didn't suck, we'd all fall off.

FellippeHeitor

  • Guest
Re: Compiler issue with sound commands
« Reply #14 on: September 22, 2018, 09:33:40 pm »
I'd try the latest development build to see if the issue may have already been addressed. Get it from the homepage www.qb64.org

The version you're using is ~7 months old now.
« Last Edit: September 22, 2018, 09:34:58 pm by FellippeHeitor »