1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
# testsuite_wav_include section for BASIC256
# Modification History
# date programmer description
# 20140415 j.m.reneau original coding
# 2014-08-04 j.m.reneau rewrote using spoken number sound file
currentsuite = "wav"
file$ = "jim_saying_numbers.mp3"
notes = 5
len = 6
if ostype = 2 then
# android does not have enhansed WAV support
# (WAVPLAY, WAVSTOP, and WAVWAIT only)
#
# simple play then stop
wavplay file$
pause 2 * len/notes
wavstop
call q("wavstop - were the words 'one' and 'two' played and then stop?")
#
# simple play to the end of the wav file
wavplay file$
wavwait
call q("wavwait - Were the words 'one', 'two', 'three', 'four', and 'five' played?")
else
# other systems use Multimedia that allows for pause, seek, position and duration
#
# simple play then stop
wavplay file$
pause 2* len/notes
wavstop
call q("wavstop - were the words 'one' and 'two' played and then stop?")
#
call n("wavstop - check position 0",wavpos, 0)
#
notel = wavlength() / notes
call npercent("wavlength - check average note length",notel, len/notes, .10)
#
wavplay # play from begining
pause notel
wavpause
call npercent("wavpos - check position 1 note",wavpos, notel, .20)
pause notel
wavplay
pause notel
wavstop
call q("wavstop - were the words 'one' and 'two' played with a rest between them and then stop?")
#
call n("wavpos stop - check position after stop",wavpos, 0)
#
#
# simple reload and play to the end of the wav file
# play scale forward
timer = msec
wavseek 0
wavplay
wavwait
timer = (msec - timer) / 1000 / wavlength()
call npercent("wavwait - timer 100%",timer, 1, .10)
call q("wavwait - Were the words 'one', 'two', 'three', 'four', and 'five'played in order?")
#
# play scale backwards
# sound currently at stopped state
# should be in stop state from wavwait
timer = msec
wavplay file$
for a = notes-1 to 0 step -1
wavseek a * notel
pause notel
next a
wavstop
timer = (msec - timer) / 1000 / wavlength()
call npercent("wavseek/wavstop - timer 100%",timer,1,.1)
call q("wavseek/wavstop - were the numbers 1 to 5 counted from high to low?")
endif
|