+OLD CS1 Posted November 30, 2010 Share Posted November 30, 2010 (edited) Originally, I had intended this to be a "crap game" entry, asking the player if he or she heard a sound in the left ear or right ear, and then chastising the player for not hearing the tone in both ears since the TI is mono. But then someone says to me, what if the poor fecker has hearing loss in one ear? So this became more of a "serious" project. I may yet come up with time to work on a couple of crap ideas, but I distract easily. The program is an implementation of a basic screening, with some variations owing to the TI's lack of resolution and range, and my own curiosity. In particular, since the program has no control over user volume adjustment and therefor lacks a real measure of audio power output, a good bit of guessing and user interaction is required. As well, we have no control over the frequency response of the audio equipment, headphones, etc. I think it may still be viable as a tool for home screening or idle curiosity. Some notes. Frequencies tested: 250, 500, 1000, 2000, 4000, 8000, 12000, 16000, and 18000Hz. Attenuations from 28dB to 4dB in 6dB increments. (Ranges above 16000Hz are considered "lost" in a person's 20s, so not everyone will hear 16000 and 18000 Hz. I expect to expand the test range as time goes on.) No responses are recorded, currently. The tested tone is played in a random position out of five slots, an idea which came about while it was still a game to prevent "cheating." I left it in place as I feel it helps keep the screenee "on his feet," so to speak, for better or worse. (In any case, it should not have any effect on the results, over all.) There is a 1.5s delay between each volume, and a 3.5s delay between each frequency. As progress is made I will put in some debugging features and response recording and simple analysis, as well as a more "enhanced" test which will offer more frequency granularity and range. I also expect to use longer and more descriptive variable names (old habit to use short names to conserve memory.) I do not plan to work on this much right now as I have other irons in the fire, but I thought it interesting enough to share. 1 REM ** BASIC HEARING TEST 2 REM ** TI EXTENDED BASIC 10 UNTRACE :: UNBREAK :: ON BREAK NEXT :: CALL CLEAR :: RANDOMIZE :: DIM F(10) 11 CALL SCREEN( 15 PRINT "BASIC HEARING TEST": : : 20 PRINT "PRODUCES A SERIES OF TONES TO TEST YOUR HEARING. THIS IS A VERY BASIC TEST AND SHOULD NOT REPLACE PRO- FESSIONAL MEDICAL SCREENING.": : 25 CALL PAUSE 26 CALL CLEAR 27 PRINT "VOLUME CALIBRATION": : : 28 PRINT "SINCE IT IS NOT POSSIBLE TO PERFORM AN EXACT READING ON THE OUTPUT OF YOUR SYSTEM, YOU WILL BE ASKED TO SET THEVOLUME TO AN APPROPRIATE LEVEL.": : 29 PRINT "* YOU SHOULD USE HEADPHONES FOR CALIBRATION AND TESTING*": : 35 CALL PAUSE :: CALL CLEAR 50 PRINT "** CALIBRATION **": : : 52 PRINT "CONNECT YOUR HEADPHONES AND TURN YOUR VOLUME COMPLETELY DOWN.": : 55 CALL PAUSE 57 CALL SCREEN(3) 58 PRINT : :"NOW, TURN UP THE VOLUME UNTIL THE SOUND PLAYING BECOMES JUST AUDIBLE, THEN PRESS ANY KEY." 59 CALL SOUND(-500,440,28) 60 CALL KEY(3,K,S):: IF S=0 THEN 59 61 CALL SCREEN( 62 PRINT : :"WE ARE READY TO BEGIN..." 63 CALL PAUSE 75 CALL CLEAR 76 DISPLAY AT(12,10):"PLEASE WAIT" 77 FOR I=1 TO 10 :: READ F$ :: IF F$="*" THEN 80 78 F(I)=VAL(F$)*10 :: NEXT I 80 CALL SCREEN(11):: CALL CLEAR 81 PRINT "TONE IN:","PRESS:": :"LEFT","Z":"RIGHT",".":"BOTH","SPACE" 82 DISPLAY AT(12,5):"TESTING IN PROGRESS" 100 FOR I=1 TO 10 :: IF F(I)=0 THEN 200 105 FOR DB=28 TO 4 STEP -6 109 SL=INT(RND*5)+1 110 FOR J=1 TO 5 112 IF J=SL THEN CALL SOUND(400,F(I),DB)ELSE CALL SOUND(400,44000,30) 115 CALL KEY(3,K,S) 120 NEXT J 122 CALL SOUND(1500,44000,30) 125 NEXT DB 126 CALL SOUND(3500,44000,30) 130 NEXT I 200 REM 30000 STOP 30999 ! 31000 DATA 25,50,100,200,400,800,1200,1600,1800,* 31999 ! 32000 SUB PAUSE 32001 PRINT "PRESS ANY KEY TO CONTINUE"; 32002 CALL KEY(3,K,S):: IF S=0 THEN 32002 32003 SUBEND EDIT: my CALL KEY statements had an IF-THEN check of "NOT S" which now I am not sure why I used. They have been changed to "S=0" instead. I also found my delays were inside the wrong FOR-NEXT loops. One last thing; the program is using ON BREAK NEXT, but I can break at a CALL SOUND statement. Does this happen in TI Extended BASIC on a real TI? Edited November 30, 2010 by OLD CS1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.