Post by honkytonk on Aug 19, 2022 8:42:33 GMT
I modified your "Viewer" --> libertybasiccom.proboards.com/thread/2073/listening-microphone?page=1&scrollTo=14865
The line tagged: '()()()()() has been modified.
Lines tagged: '*********** have been added
Question how to stop after xxx ms (timer)?
The line tagged: '()()()()() has been modified.
Lines tagged: '*********** have been added
Question how to stop after xxx ms (timer)?
'experimental Radiometer by rodbird@hotmail.com
'uses MMI to stream audio from Mic
'8bit audio is set for faster parsing
'blips from giger counter are heard but
'need parsed, recorded and displayed
'currently samples at 50ms
nomainwin
WindowWidth = 450: WindowHeight = 230
UpperLeftX=100: UpperLeftY=100
statictext #1.txt, "0", 130, 20, 70, 25 '***********
button #1.start, "Start", [start], UL, 30, 20, 70, 25 '************
graphicbox #1.bar, 23, 70, 400, 20
open "Radiometer" for window_nf as #1
#1.bar "down; fill white; flush"
#1.bar "backcolor green"
#1 "trapclose [quit]"
#1, "font courrier 12 bold" '**********
dim count(500) '****************
wait
[start] '*************
' timer 5000, [temps] '************
[startRecording]
'set the .wav recording format
bitspersample = 8
channels = 1
samplespersec = 8000
alignment = bitspersample * channels / 8
bytespersec = alignment * samplespersec
params$ = " bitspersample " + STR$(bitspersample)+_
" channels " + STR$(channels) +_
" alignment " + STR$(alignment) + _
" samplespersec " + STR$(samplespersec) + _
" bytespersec " + STR$(bytespersec)
'open wav audio to listen to the wavaudio
r$=mciSendString$("open new type waveaudio alias wav")
r$=mciSendString$("set wav "+params$)
timer 100, [readVolume] '()()()()()
dim count(500)
wait
[readVolume]
#1.bar "discard ; backcolor white"
#1.bar "boxfilled 400 25 ; backcolor green"
r$=mciSendString$("status wav level")
level = val(r$)
print level'''''''''''''''''
if level > 30 then '***********
c=c+1: count(c)=c '************
#1.txt, str$(c) '************
end if '****************
#1.bar "boxfilled ";(level^1.25);" 20; discard"
'[temps] '*************
' timer 0 '************
wait
'--------------
Function mciSendString$(s$)
'Buffer will contain a return string from
'the function, if there is one.
buffer$=space$(1024)+chr$(0)
calldll #winmm,"mciSendStringA",s$ as ptr,buffer$ as ptr,_
1028 as long, 0 as long, r as long
'truncate returned string at null character
buffer$=left$(buffer$, instr(buffer$, chr$(0)) - 1)
if r>0 then
mciSendString$="error"
else
mciSendString$=buffer$
end if
End Function
[quit] 'End the program
timer 0
r$=mciSendString$("close wav")
close #1
end