Quote: "Can someone modify this so a program understands your voice patterns, and does a function depending on if your voice is correct?"
I don't think so. Voice recognition is a pretty hard subject. It involves spectral analysis (DFT -> Fast Fourier Transforms - FFT) of the sound wave and knowledge of how characters sound which can differ quite a lot from person to person. Even comparing a prerecorded sound to another can be pretty hard since things like noise and pitch can vary greatly.
[edit] Here's one I created a while back. It records data to a memblock and displays that on the screen.
sync on
sync rate 0
#constant SAMPLE_DURATION 90
global SoundRecording = 0
global LastTimer = 0
do
cls
`Clear the screen
KeepRecording()
DrawSound(1, 0, screen height() / 2, 1, 2.0)
sync
loop
function KeepRecording()
`Record sound if not recording
if SoundRecording = 0
if sound exist(1) then delete sound 1
record sound 1, SAMPLE_DURATION
LastTimer = timer()
`Reset sound recording
SoundRecording = 1
else
`Wait for the timer to stop
if timer() - LastTimer > SAMPLE_DURATION
stop recording sound
`Convert to a memblock
if memblock exist(1) then delete memblock 1
if sound exist(1) then make memblock from sound 1, 1
`Reset sound recording so we can start again
SoundRecording = 0
endif
endif
endfunction
function DrawSound(mem, x, y, samplesPPX, scale#)
if memblock exist(mem)
ix = -1
for i = 28 to get memblock size(mem) - samplesPPX step samplesPPX
`Get average of sound samples
SoundH# = 0.0
for j = 0 to samplesPPX - 1
inc SoundH#, memblock byte(mem, i + j) - 128.0
next j
SoundH# = SoundH# / samplesPPX * scale#
`Drawing
if ix >= 0 then line x + ix, y - oldSoundH#, x + ix + 1, y - SoundH#
inc ix
oldSoundH# = soundH#
next i
endif
endfunction
Sven B