converter_a_1j.sdlbas 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. function lstinf$(a$,b$,c$)
  2. adra=1:adrb=1:blngt=len(b$):d$=""
  3. while adrb<=blngt
  4. if mid$ (a$,adra,1)=mid$ (b$,adrb,1) then:adrb+=1:end if
  5. adra=adra+1
  6. end while
  7. while mid$(a$,adra,1)<>left$(c$,1)
  8. d$=d$+mid$(a$,adra,1):adra=adra+1
  9. end while
  10. lstinf$=d$
  11. end function
  12. function vldc(a$)
  13. t0$="!"+a$+".0.0.0."
  14. t1$=lstinf$(t0$,"!",".")
  15. t2$=lstinf$(t0$,".",".")
  16. t3=10^(len(t2$))
  17. vldc=val(t1$)+(val(t2$)/t3)
  18. end function
  19. finp$="_.csv"
  20. if argc>2 then:finp$=argv(2):end if
  21. open finp$ for input as #1
  22. mxchn=3
  23. if argc>3 then:mxchn=val(argv(3)):end if
  24. rfst1$=",,,":for i=1 to mxchn:rfst1$+=",,,":next
  25. vblqv=1:vblcv=vblqv:lct=0
  26. while eof(1)=0
  27. file input #1,txrd$
  28. setcaption("a:"+str$(lct)):lct+=1
  29. txrd$=","+txrd$
  30. for i=1 to mxchn:txrd$+=",,,":next
  31. txou$=""
  32. vblqs$=lstinf$(txrd$,left$(rfst1$,1),",")
  33. if vblqs$<>"" then: vblqv=vldc(vblqs$):end if
  34. if vblcv<>vblqv then:vblcv=vblqv:end if
  35. for cchn=0 to mxchn-1
  36. cchnfq$=lstinf$(txrd$,left$(rfst1$,2+(cchn*2)),",")
  37. cchnvl$=lstinf$(txrd$,left$(rfst1$,3+(cchn*2)),",")
  38. cchnfq$=trim$(cchnfq$)
  39. cchnvl$=trim$(cchnvl$)
  40. cchnfqo$="":cchnvlo$=""
  41. if cchnfq$="" then:cchnfqo$="[nul:0]":end if
  42. if cchnvl$="" then:cchnvlo$="[nul:1]":end if
  43. if left$(cchnfq$,1)="(" then:
  44. cchnfq$+="#"
  45. tmv1=val(lstinf$(cchnfq$,"(","/"))
  46. tmv2=val(lstinf$(cchnfq$,"/",")"))
  47. tmv3=val(lstinf$(cchnfq$,"+","#"))
  48. tmvf=(tmv1/tmv2)+tmv3
  49. cchnfqo$="[f"+right$(str$(100+cchn),2)+":"+str$(tmvf)+"]"
  50. end if
  51. if lcase$(left$(cchnfq$,1))="h" then:
  52. cchnfq2$=right$(cchnfq$,len(cchnfq$)-1)
  53. freqhz1=vldc(cchnfq2$)
  54. tmvf=(log(freqhz1*.0611561)/log(2))
  55. cchnfqo$="[f"+right$(str$(100+cchn),2)+":"+str$(tmvf)+"]"
  56. end if
  57. if asc(lcase$(left$(cchnfq$,1)))>=asc("a") and asc(lcase$(left$(cchnfq$,1)))<=asc("g") then:
  58. vq1=asc(lcase$(left$(cchnfq$,1)))-97
  59. tmv1=(((vq1+5)mod 7)*2)-int(((vq1+5)mod 7)/3)+int(((vq1+5)mod 7)/6)
  60. tmv1+=int(((asc(mid$(cchnfq$,2,1)))mod 4)/2)
  61. tmv3=val(mid$(cchnfq$,3,1))
  62. cchnfq2$=cchnfq$+"+0+0+"
  63. tmv5=vldc(lstinf$(cchnfq2$,"+","+"))
  64. tmvf=((tmv1+tmv5)/12)+tmv3
  65. cchnfqo$="[f"+right$(str$(100+cchn),2)+":"+str$(tmvf)+"]"
  66. end if
  67. if cchnvl$<>"" then:
  68. tmv5=vldc(cchnvl$)
  69. cchnvlo$="[v"+right$(str$(100+cchn),2)+":"+str$(tmv5)+"]"
  70. end if
  71. txou$+=cchnfqo$
  72. txou$+=cchnvlo$
  73. next
  74. txou$+="[wvb:"+str$(vblcv)+"]"
  75. print txou$
  76. wend
  77. close #1