I've been digging into the project to see how difficult it would be to adapt it to bass. I think that only by changing some numbers you can achieve it.
First of all, we must expand to 24ms the timing for note peak detection in lin 204 change 2 by 4
;--- WAVEFORM PEAK LEVEL DETECTION FOR 12MS ---
PEAKS
CLRF PEAKH
MOVLW 255
MOVWF PEAKL
MOVLW 4
MOVWF DELAY1
Now we need to increase as well the timeout threshold for frequency detection in the TIMING routine. This is done by changin "BTFSC TMR1H,5" to "BTFSC TMR1H,6" in all 4 occurences. This will double the time to wait until failure.
;---- MEASURE TIME FOR ONE WAVE, BETWEEN PEAKS -------
TIMING CLRF TMR1L
CLRF TMR1H
T1 BTFSC TMR1H,6
GOTO TERROR
BCF MARKER,3
CALL ADC
MOVF TRIGL,W
SUBWF ADRESH,W
BTFSC STATUS,C ;IS ADRESH - TRIGL +VE IE CARRY SET?
GOTO T1 ;NO, SO RETEST UNTIL IT IS
T2 BTFSC TMR1H,6
GOTO TERROR
CALL ADC
MOVF ADRESH,W
SUBWF TRIGH,W
BTFSC STATUS,C ;IS ADRESH - TRIGH +VE IE CARRY SET?
GOTO T2 ;NO, SO RETEST UNTIL IT IS
CLRF TMR1L
CLRF TMR1H
NOP
T3 BTFSC TMR1H,6
GOTO TERROR
CALL ADC
MOVF TRIGL,W
SUBWF ADRESH,W
BTFSC STATUS,C ;IS ADRESH - TRIGL +VE IE CARRY SET?
GOTO T3 ;YES, SO RETEST UNTIL IT IS
T4 BTFSC TMR1H,6
GOTO TERROR
CALL ADC
MOVF ADRESH,W
SUBWF TRIGH,W
BTFSC STATUS,C ;IS ADRESH - TRIGH +VE IE CARRY SET?
GOTO T4 ;NO, SO RETEST UNTIL IT IS
BCF T1CON,0 ;STOP THE TIMER TO RETRIEVE THE DATA
MOVF TMR1L,W
MOVWF LOBYTE
MOVF TMR1H,W
MOVWF HIBYTE
BSF T1CON,0 ;RESTART THE TIMER
RETURN
TERROR
BSF MARKER,3
RETURN
Now we need the code to compute correctly the octave (original code cannot go below note 35 and we need to go down to 28). This is achieved by changing 2 things, on one side we have to change the octave offset in line 239. Change 48 to 60
;----- GET MIDI NOTE FROM FREQUENCY TIMING ----------
MIDINOTE BCF MARKER,1
MOVLW 60
And the last change is we need to decrease all numbers in NOTE_TABLE by 12.
;------ MIDI NOTE DATA TABLE ----------
NOTE_TABLE ADDWF PCL,F
DT 35,35,34,34,34,34,34,34,34,33
DT 33,33,33,33,33,33,33,33,33,32
DT 32,32,32,32,32,32,32,32,31,31
... etc....
I haven't included the whole table, you should be able to do the math on your own, it's only subtracting 12 to all numbers.
I haven't tried it, but on paper it looks like this should do the trick and give you one lower octave of range.
Give it a try and let me know.
Mat