'**************************************************************** '* Name : Bello_Hub.BAS * '* Author : Godfried-Willem RAES * '* Notice : Copyleft (c) 2015 Logosoft Public Domain * '* Date : 07.04.2015 * '* Version : 1.2 * '* Notes : Based On HybriHi-hub code model * '**************************************************************** '08.06.2013: PIC: 18F2525 On MidiHub board, 1 relay, 7 out's '20.03.2015: This code should have two main loops: powerdown_loop and active_loop '21.03.2015: powerdown loop added. '30.03.2015: further coding after wiring is finished. '31.03.2015: first version flashed. '07.04.2015: Individual velocity scaling lookup tables added ' logarithmic durations added. ' warning: high repetition rates must use reduced velocities!!! Include "18F2525.inc" 'version for the Bello board. (40MHz) 'Include "18F2520.inc" 'also possible. (40MHz) 'Include "18F25K20.inc" 'for test & debug on an Amicus board. (64MHz) ' Mapping defines for midi-events on pin outputs and inputs: $define Relay PORTA.4 ' power on relay, ctrl 66 $define Blue_Led PORTB.2 ' on board LED $define bel66 PORTA.5 ' bel66 out7 added 08.05.2015 $define bel64 PORTC.0 ' bell 64/70 stainless steel out6 $define lite1 PORTC.1 ' lite1 can pwm out5 $define lite2 PORTC.2 ' lite2 can pwm out4 $define bel63 PORTC.3 ' bell 63 out3 added 10.05.2015 $define bel62 PORTC.4 ' bell 62 out2 added 10.05.2015 $define bel61 PORTC.5 ' bell 61/78 steel dome out1 ' analog inputs: $define Ana_1 PORTA.0 $define Ana_2 PORTA.1 'red LED for debug: $define Debug_Led PORTB.5 ' for testing - red led - watchdog ' configure the input and output pins: Clear SSPCON1.5 'RC3 must be available for I/O TRISA = %01000011 'bits set to 0 are output, 1 = input TRISB = %11100000 TRISC = %11000000 'RC1 en RC2 zijn pwm outputs and must be set to output 'RC6 en RC7 zijn USART I/O and must be set to input 'constant definitions: 'initialisations for the midi input parser: Symbol Midichannel = 13 ' Balmec channel Symbol NoteOff_Status = 128 + Midichannel ' 2 bytes follow Symbol NoteOn_Status = 144 + Midichannel Symbol Keypres_Status = 160 + Midichannel ' 2 bytes follow Symbol Control_Status = 176 + Midichannel Symbol ProgChange_Status = 192 + Midichannel ' 1 byte message Symbol Aftertouch_Status = 208 + Midichannel ' 1 byte follows Symbol Pitchbend_Status = 224 + Midichannel ' lsb msb follow 'application specific constants Symbol NrTasks = 5 ' maximum 16 Symbol fPWM = PWMminF * 4 ' in avoidance of audible artifacts ' Setup the USART Declare Hserial_Baud = 31250 ' Set baud rate for the USART to MIDI specs. Declare Hserial_TXSTA = 0x24 ' instead of the normal 0x20 - ?? 0x24 Declare All_Digital = True ' Declare Hserial_Clear = On ' should clear on errors. Bytes get lost of course... ' Create variables Dim Cnt As Dword System Dim CntHw As Cnt.Word1 'used in the timer0 interrupt, to create a 32 bit timer Dim CntLw As TMR0L.Word 'this is the trick to read both TMR0L and TMR0H 'it makes Cntlw the low word of cnt 'We still have to copy the contents of Lw to Cnt ' Dim Tim3 As TMR3L.Word Dim Bytein As Byte System ' midi byte read from buffer Dim StBit As Bytein.7 ' highest bit of ByteIn Dim i As Byte System ' general purpose counter ' midi variables Dim statusbyte As Byte System Dim noteUit As Byte System ' note off + release value Dim release As Byte System Dim noteAan As Byte System ' note on + release value Dim velo As Byte System Dim notePres As Byte System ' note pressure + pressure value Dim pres As Byte System Dim Ctrl As Byte System ' continuous controller + value Dim value As Byte System Dim prog As Byte System ' program change + program-byte ' Dim aft As Byte System ' channel aftertouch ' Dim pblsb As Byte System ' pitch bend lsb ' Dim pbmsb As Byte System ' pitch bend msb Dim veltim As Dword System ' 32 bit velo Dim VelFlags As Word System ' bits 0 - 15 used as flags for active timers Dim VelFlags0 As VelFlags.Byte0 ' alias for bits 0-7 Dim CC66 As Byte System ' global on/off switch Dim st As Byte System Dim b1 As Byte System Dim b2 As Byte System Dim Notes As Byte System ' bits used as flags - can be byte here as we have 5 notes Dim Rate_0 As Word System Dim Rate_1 As Word System Dim Rate_2 As Word System Dim Rate_3 As Word System Dim Rate_4 As Word System Dim pw As Byte System ' PwmLite1 ' Dim pw2 As Byte System '----------------------------------------------------------------------------------------- ' Load the USART Interrupt handler And buffer read subroutines into memory 'Include "ADC.inc" ' Load the ADC macros into the program - used in the IRQ include. Include "Propeller_Irq.inc" ' our own version for UART And Timer0/3 Interrupt 'Include "Timers.inc" ' required for velo support with timed pulses and periods. 'framework for a multitasker: Dim Task_rsi[NrTasks] As Word 'task reschedule interval (period), if 0 the task is not active 'max. value limited to 65535. For longer periods, it will have to 'become dword!!! ' here only used for the velocity pulse timers Dim Velmsb[NrTasks] As Word 'the application for velo-timers, is in fact just a one-shot task Dim VelLsb[NrTasks] As Word Dim Permsb[NrTasks] As Word Dim PerLsb[NrTasks] As Word Dim Dur[128] As Word ' duration lookup for repetitions Dim Vels[128] As Word ' velocity lookup table Dim Vels0[128] As Word Dim Vels1[128] As Word Dim Vels2[128] As Word Dim Vels3[128] As Word Dim Vels4[128] As Word 'DeclareDwordArray(TimeVals , NrTasks) 'alternative using the macro's. [not yet used] ' assigning values syntax: DwordArray Timvals,[i], value ' reading values syntax: value = DwordArray TimVals,[i] 'make sure we initialize the used pins on start up: 'fault?: there should be no executable statements outside the main program. Low Relay Low Blue_Led Low bel61 Low bel62 Low bel63 Low lite2 Low lite1 Low bel64 Low bel66 Clear Rate_0 Clear Rate_1 Clear Rate_2 Clear Rate_3 Clear Rate_4 Low PORTA.2 Low PORTA.3 Low Debug_Led HPWM 2, 0, fPWM ' connected to RC1 HPWM 1, 0, fPWM ' connected to RC2 Clear CC66 GoSub Dur_Lookup GoSub Vels_Lookup '----------------------------------------------------------------------------------------- ' Main program starts here MAIN: High Debug_Led DelayMS 50 ' wait for stability Low Debug_Led Clear VelFlags0 ' Clear Lites Init_Usart_Interrupt ' Initiate the USART serial buffer interrupt ' this procedure is in the include file Clear_Serial_Buffer ' Clear the serial buffer and reset its pointers ' in the include as well ' Configure Timer0 for: ' Clear TMR0L and TMR0H registers ' Interrupt on Timer0 overflow ' 16-bit operation ' Internal clock source 40MHz ' 1:256 Prescaler : thus 40MHz / 256 = 156.250kHz ' Opentimer0 (Timer_INT_On & T0_16BIT & T0_SOURCE_INT & T0_PS_1_256) in macro file. Clear T1CON Clear IntConBits_T0IF ' clear interrupt flag Set INTCONBITS_T0IE ' enable interrupt on overflow T0CON = %10000111 ' bit 7 = enable/disable ' bit 6 = 1=8 bit, 0=16 bit ' bit 5 = 1 pin input, 0= Internal Clk0 ' bit 4 = HL or LH transition when bit5 =1 ' bit 3 = 1= bypass prescaler, 0= input from prescaler ' bit 2-0 = prescaler select: 111= 1:256 ' Setup the High priorities for the interrupts ' open and start timer3 for sampling: Clear T3CON Clear PIR2BITS_TMR3IF ' clear IRQ flag Set PIE2BITS_TMR3IE ' irq on ' Clear Tim3 ' Clear TMR3L And TMR3H registers Set RCONbits_IPEN ' Enable priority interrupts Clear IPR2bits_TMR3IP ' Set Timer3 as a low priority interrupt source ' we can also set T3Con in one instruction as: T3CON = %10110000 ' oef, now it works... ' bit 7 = 16 bit mode ' bit 6,3 = 0, 0 ' bit 5,4 = 1:8 prescale ' bit 2 = 0 ' bit 1 = 0 Internal clock = Fosc/4 ' bit 0 : 1= enable timer 3, 0= disable set to 0 for Whisper! ' maximum count = 52.42ms, 1 tick =0.8uS, lowest freq.=19Hz ' wait for controller 66 to get set: 'GoTo Sleep_Loop '- bug: it does never get out of that loop... ' start the main program loop: (it starts here as soon as CC66 ON is received). LOOP: ' Create an infinite loop Bytein = HRSIn ' Read data from the serial buffer, with no timeout ' Start the midi parser. Midi_Parse: If Bytein > Control_Status Then ' here higher statusses are not implemented. If Bytein > 253 Then '254 = midiclock, 255= reset 'midiclock can interrupt all other msg's... '255 had to be intercepted since thats what we 'get when no new byte flows in (?) GoTo Check_Timers 'throw away... Else Clear statusbyte 'reset the status byte GoTo Check_Timers 'throw away End If EndIf If StBit =1 Then 'should be faster than If Bytein > 127 Then 'status byte received, bit 7 is set Clear statusbyte 'if on another channel, the statusbyte needs a reset Select Bytein 'eqv to Select case ByteIn Case NoteOff_Status statusbyte = Bytein Set noteUit '= 255 'reset value. Cannot be 0 !!! Set release '= 255 '0 is a valid midi note! Case NoteOn_Status statusbyte = Bytein Set noteAan '= 255 Set velo '= 255 Case Keypres_Status ' used for note repetition speed statusbyte = Bytein Set notePres '= 255 Set pres '= 255 Case Control_Status ' only 66 and 123 statusbyte = Bytein Set Ctrl '= 255 Set value '= 255 ' Case ProgChange_Status ' statusbyte = Bytein ' prog = 255 ' Case Aftertouch_Status ' statusbyte = Bytein ' aft = 255 ' Case Pitchbend_Status ' statusbyte = Bytein ' pblsb = 255 ' pbmsb = 255 End Select Else 'midi byte is 7 bits Select statusbyte Case 0 'not a message for this channel GoTo Check_Timers 'disregard Case NoteOff_Status If noteUit = 255 Then noteUit = Bytein Else 'release = Bytein 'message complete, so we can do the action... Select noteUit Case 61 Clear VelFlags0.0 Clear bel61 Clear Notes.0 Case 62 Clear VelFlags0.1 Clear bel62 Clear Notes.1 Case 63 Clear VelFlags0.2 Clear bel63 Clear Notes.2 Case 64 Clear VelFlags0.3 Clear bel64 Clear Notes.3 Case 66 Clear VelFlags0.4 Clear bel66 Clear Notes.4 Case 126 HPWM 1,0, fPWM Case 127 HPWM 2,0, fPWM End Select Set noteUit '= 255 'reset EndIf GoTo Check_Timers Case NoteOn_Status If noteAan = 255 Then noteAan = Bytein Else velo = Bytein If velo = 0 Then Select noteAan Case 61 Clear VelFlags0.0 Clear bel61 Clear Notes.0 Case 62 Clear VelFlags0.1 Clear bel62 Clear Notes.1 Case 63 Clear VelFlags0.2 Clear bel63 Clear Notes.2 Case 64 Clear VelFlags0.3 Clear bel64 Clear Notes.3 Case 66 Clear VelFlags0.4 Clear bel66 Clear Notes.4 Case 126 HPWM 1,0, fPWM Case 127 HPWM 2,0, fPWM End Select Set noteAan '= 255 'reset !!! GoTo Check_Timers 'jump out EndIf Select noteAan Case 61 'hier moeten we een pulse timer starten, duur evenredig met velo 'na afloop van de puls moet een wachttimer ingeschakeld worden 'voor zover een repeat speed is ingesteld met keypressure ' na de wachttijd moet een nieuwe puls gegeven worden met de bestaande velo ' note off schakelt de repeats uiteraard uit. If Rate_0 > 0 Then Set Notes.0 ' set flag only if note is to be repeated. Set VelFlags0.0 Cnt.Word0 = CntLw 'read timer ' stroke duration should never be larger than 16ms (= 60Hz bell) Task_rsi[0] = Vels0[velo] ' use lookup veltim = Cnt + Task_rsi[0] 'add the period duration Velmsb[0] = veltim.Word1 VelLsb[0] = veltim.Word0 Set bel61 Case 62 If Rate_1 > 0 Then Set Notes.1 Set VelFlags0.1 Cnt.Word0 = CntLw 'read timer Task_rsi[1] = Vels1[velo] ' use lookup veltim = Cnt + Task_rsi[1] 'add the period duration Velmsb[1] = veltim.Word1 VelLsb[1] = veltim.Word0 Set bel62 Case 63 If Rate_2 > 0 Then Set Notes.2 Set VelFlags0.2 Cnt.Word0 = CntLw 'read timer Task_rsi[2] = Vels2[velo] ' use lookup veltim = Cnt + Task_rsi[2] 'add the period duration Velmsb[2] = veltim.Word1 VelLsb[2] = veltim.Word0 Set bel63 Case 64 If Rate_3 > 0 Then Set Notes.3 Set VelFlags0.3 Cnt.Word0 = CntLw 'read timer Task_rsi[3] = Vels3[velo] ' use lookup veltim = Cnt + Task_rsi[3] 'add the period duration Velmsb[3] = veltim.Word1 VelLsb[3] = veltim.Word0 Set bel64 Case 66 If Rate_4 > 0 Then Set Notes.4 Set VelFlags0.4 Cnt.Word0 = CntLw 'read timer Task_rsi[4] = Vels4[velo] ' use lookup veltim = Cnt + Task_rsi[4] 'add the period duration Velmsb[4] = veltim.Word1 VelLsb[4] = veltim.Word0 Set bel66 Case 126 pw = velo <<1 HPWM 1,pw, fPWM Case 127 pw = velo <<1 HPWM 2,pw, fPWM End Select Set noteAan '= 255 'reset EndIf GoTo Check_Timers Case Keypres_Status 'used for repeat speed modulation If notePres = 255 Then notePres = Bytein Else pres = Bytein GoSub KeyPres EndIf GoTo Check_Timers Case Control_Status 'this is where the action takes place for controllers If Ctrl = 255 Then Ctrl = Bytein Else value = Bytein GoSub Controller EndIf GoTo Check_Timers End Select EndIf Check_Timers: ' here we check the Task counters and compare them with the 32 bit cnt value ' using the Velflags dword variable: If VelFlags0.0 = 1 Then veltim.Word1 = Velmsb[0] veltim.Word0 = VelLsb[0] Cnt.Word0 = CntLw 'read counter If Cnt >= veltim Then 'note 61 Clear bel61 ' bij terugslag bellen ontstaat pas nu de klank Clear VelFlags0.0 ' stop the pulse timer 'IF repeats are set, than, start a new timer for the wait time If Notes.0 = 1 Then ' zoniet zouden we hier nooit mogen terecht komen... If Rate_0 > 0 Then Cnt.Word0 = CntLw veltim = Cnt + Rate_0 Permsb[0] = veltim.Word1 PerLsb[0] = veltim.Word0 Else Clear Notes.0 ' no repeats End If EndIf EndIf Else If Notes.0 = 1 Then ' the velflags0.0 bit must be off at this time veltim.Word1 = Permsb[0] veltim.Word0 = PerLsb[0] Cnt.Word0 = CntLw 'read counter If Cnt >= veltim Then 'note 61 ' restart the velo pulse timer Set VelFlags0.0 'Cnt.Word0 = CntLw 'read timer 'Task_rsi[0] = Vels[velo] stored already as we are repeating a note veltim = Cnt + Task_rsi[0] 'add the pulse duration Velmsb[0] = veltim.Word1 VelLsb[0] = veltim.Word0 Set bel61 EndIf EndIf EndIf If VelFlags0.1 = 1 Then veltim.Word1 = Velmsb[1] veltim.Word0 = VelLsb[1] Cnt.Word0 = CntLw 'read counter If Cnt >= veltim Then ' was GoSub Task1 'note 62 Clear bel62 ' bij terugslag bellen ontstaat pas nu de klank Clear VelFlags0.1 ' stop the pulse timer If Notes.1 = 1 Then ' zoniet zouden we hier nooit mogen terecht komen... If Rate_1 > 0 Then Cnt.Word0 = CntLw veltim = Cnt + Rate_1 Permsb[1] = veltim.Word1 PerLsb[1] = veltim.Word0 Else Clear Notes.1 ' no repeats End If EndIf End If Else If Notes.1 = 1 Then veltim.Word1 = Permsb[1] veltim.Word0 = PerLsb[1] Cnt.Word0 = CntLw 'read counter If Cnt >= veltim Then 'note 62 Set VelFlags0.1 veltim = Cnt + Task_rsi[1] 'add the pulse duration Velmsb[1] = veltim.Word1 VelLsb[1] = veltim.Word0 Set bel62 EndIf EndIf EndIf If VelFlags0.2 = 1 Then veltim.Word1 = Velmsb[2] veltim.Word0 = VelLsb[2] Cnt.Word0 = CntLw 'read counter If Cnt >= veltim Then ' was GoSub Task2 'note 63 Clear bel63 ' bij terugslag bellen ontstaat pas nu de klank Clear VelFlags0.2 ' stop the pulse timer If Notes.2 = 1 Then ' zoniet zouden we hier nooit mogen terecht komen... If Rate_2 > 0 Then Cnt.Word0 = CntLw veltim = Cnt + Rate_2 Permsb[2] = veltim.Word1 PerLsb[2] = veltim.Word0 Else Clear Notes.2 ' no repeats End If EndIf End If Else If Notes.2 = 1 Then veltim.Word1 = Permsb[2] veltim.Word0 = PerLsb[2] Cnt.Word0 = CntLw 'read counter If Cnt >= veltim Then 'note 63 Set VelFlags0.2 veltim = Cnt + Task_rsi[2] 'add the pulse duration Velmsb[2] = veltim.Word1 VelLsb[2] = veltim.Word0 Set bel63 EndIf EndIf EndIf If VelFlags0.3 = 1 Then veltim.Word1 = Velmsb[3] veltim.Word0 = VelLsb[3] Cnt.Word0 = CntLw 'read counter If Cnt >= veltim Then ' was GoSub Task3 'note 64 Clear bel64 ' bij terugslag bellen ontstaat pas nu de klank Clear VelFlags0.3 ' stop the pulse timer If Notes.3 = 1 Then ' zoniet zouden we hier nooit mogen terecht komen... If Rate_3 > 0 Then Cnt.Word0 = CntLw veltim = Cnt + Rate_3 Permsb[3] = veltim.Word1 PerLsb[3] = veltim.Word0 Else Clear Notes.3 ' no repeats End If EndIf EndIf Else If Notes.3 = 1 Then veltim.Word1 = Permsb[3] veltim.Word0 = PerLsb[3] Cnt.Word0 = CntLw 'read counter If Cnt >= veltim Then 'note 64 Set VelFlags0.3 veltim = Cnt + Task_rsi[3] 'add the pulse duration Velmsb[3] = veltim.Word1 VelLsb[3] = veltim.Word0 Set bel64 EndIf EndIf EndIf If VelFlags0.4 = 1 Then veltim.Word1 = Velmsb[4] veltim.Word0 = VelLsb[4] Cnt.Word0 = CntLw 'read counter If Cnt >= veltim Then 'GoSub Task4 'note 66 Clear bel66 ' bij terugslag bellen ontstaat pas nu de klank Clear VelFlags0.4 ' stop the pulse timer If Notes.4 = 1 Then ' zoniet zouden we hier nooit mogen terecht komen... If Rate_4 > 0 Then Cnt.Word0 = CntLw veltim = Cnt + Rate_4 Permsb[4] = veltim.Word1 PerLsb[4] = veltim.Word0 Else Clear Notes.4 ' no repeats End If EndIf EndIf Else If Notes.4 = 1 Then veltim.Word1 = Permsb[4] veltim.Word0 = PerLsb[4] Cnt.Word0 = CntLw 'read counter If Cnt >= veltim Then 'note 64 Set VelFlags0.4 veltim = Cnt + Task_rsi[4] 'add the pulse duration Velmsb[4] = veltim.Word1 VelLsb[4] = veltim.Word0 Set bel66 EndIf EndIf EndIf If VelFlags0 + Notes = 0 Then If CntHw > 0xFF Then Clear CntHw EndIf GoTo LOOP ' end of the main loop KeyPres: 'the note to which the pressure should be applied is passed in NotePres, the value in Pres 'here we use it for repeat speed of the bells '20.08.2013: coding modified such that the repetition period is only refreshed after the previous ' timer flip over. ' Thus we can make smoother accel. and decel. Select notePres Case 61 If pres > 0 Then Rate_0 = Dur[pres] Else Clear Rate_0 EndIf Case 62 If pres > 0 Then Rate_1 = Dur[pres] Else Clear Rate_1 EndIf Case 63 If pres > 0 Then Rate_2 = Dur[pres] Else Clear Rate_2 EndIf Case 64 If pres > 0 Then Rate_3 = Dur[pres] Else Clear Rate_3 EndIf Case 66 If pres > 0 Then Rate_4 = Dur[pres] Else Clear Rate_4 EndIf End Select Set notePres '= 255 Return 'ProgChange: ' Set prog '= 255 'this is not realy required 'Return 'Pitchbend: ' 'only implemented on dsPIC based robots ' Set pblsb '= 255 'Return 'Aftertouch: ' 'this is the channel aftertouch, affecting all notes ' Set aft '= 255 'not mandatory 'Return Controller: Select Ctrl Case 66 'on/off for the robot If value = 0 Then GoSub PowerDown Clear CC66 'GoTo Sleep_Loop ' disregarding any other midi messages Else Set Relay CC66 = value EndIf Case 123 GoSub AllNotesOff End Select Set Ctrl '= 255 'mandatory reset Return AllNotesOff: Clear VelFlags0 Clear Notes HPWM 1, 0, fPWM ' connected to RC2 lite1 HPWM 2, 0, fPWM ' connected to RC1 lite2 Clear bel61 Clear bel62 Clear bel63 Clear bel64 Clear bel66 Return PowerDown: Clear VelFlags0 'stop all running timers Clear Notes Clear Relay HPWM 1, 0, fPWM ' connected to RC2 HPWM 2, 0, fPWM ' connected to RC1 Clear bel61 Clear bel62 Clear bel63 Clear bel64 Clear bel66 Clear Rate_0 Clear Rate_1 Clear Rate_2 Clear Rate_3 Clear Rate_4 ' after return goes to sleep-loop ... Return Sleep_Loop: ' the program enters this loop when CC66 is OFF. ' In this state it only listens to CC66 becoming set. ' Create an infinite loop Bytein = HRSIn ' Read data from the serial buffer, with no timeout ' Start the midi parser. 'Midi_Parse: If Bytein > Control_Status Then ' here higher statusses are not implemented. If Bytein > 253 Then '254 = midiclock, 255= reset 'midiclock can interrupt all other msg's... '255 had to be intercepted since thats what we 'get when no new byte flows in (?) Else Clear statusbyte 'reset the status byte End If EndIf If StBit =1 Then 'should be faster than If Bytein > 127 Then 'status byte received, bit 7 is set Clear statusbyte 'if on another channel, the statusbyte needs a reset Select Bytein 'eqv to Select case ByteIn Case Control_Status statusbyte = Bytein Set Ctrl '= 255 Set value '= 255 End Select Else 'midi byte is 7 bits Select statusbyte Case Control_Status 'this is where the action takes place for controllers If Ctrl = 255 Then Ctrl = Bytein Else CC66 = Bytein Select Case Ctrl Case 66 Set Ctrl If CC66 > 0 Then Set Relay Set Blue_Led GoTo LOOP EndIf End Select EndIf End Select End Select EndIf If CntHw > 0xFF Then Clear CntHw GoTo Sleep_Loop Dur_Lookup: 'this lookup is for a good scaling of the velocity byte on event periodicity ' the values are calculated based on a timer resolution of 24 microseconds. ' The values must be containable in a word (16 bits!) ' This is the simple Power Basic program wherewith the lookup was calculated: 'FUNCTION PBMAIN ()AS LONG ' OPEN "Whisper_Dur_scales.inc" FOR OUTPUT AS #1 ' LOCAL unit, fastest, slowest, velo_traject AS DOUBLE ' LOCAL velo, i AS DWORD ' unit = 0.000024 ' in seconds (24 microseconds) ' fastest = 1 / 16 ' 16 Hz ' slowest = 1.5 ' 0.66 Hz ' velo_traject = slowest - fastest ' PRINT# 1, "Lookup for Whisper durations in periodic events" ' FOR i = 1 TO 127 ' velo = velo_traject / i ' PRINT i; velo, ' PRINT# 1 ,"Dur[";i;"] ="; velo ' NEXT i 'DO: LOOP UNTIL INKEY$ <> "" 'END FUNCTION '31.03.2015: for these bells a better range would be fastest = 30 Hz, slowest = 1 Hz ' Dur[1] = 39930 ' = 1Hz or MM60 ' For i = 2 To 127 ' Dur[i] = Dur[i-1] - 304 ' Next i ' Dur[ 1 ] = 59896 ' this is 1.5 sec. ' Dur[ 2 ] = 29948 ' Dur[ 3 ] = 19965 ' Dur[ 4 ] = 14974 ' Dur[ 5 ] = 11979 ' Dur[ 6 ] = 9983 ' Dur[ 7 ] = 8557 ' Dur[ 8 ] = 7487 ' Dur[ 9 ] = 6655 ' Dur[ 10 ] = 5990 ' Dur[ 11 ] = 5445 ' Dur[ 12 ] = 4991 ' Dur[ 13 ] = 4607 ' Dur[ 14 ] = 4278 ' Dur[ 15 ] = 3993 ' Dur[ 16 ] = 3743 ' Dur[ 17 ] = 3523 ' Dur[ 18 ] = 3328 ' Dur[ 19 ] = 3152 ' Dur[ 20 ] = 2995 ' Dur[ 21 ] = 2852 ' Dur[ 22 ] = 2723 ' Dur[ 23 ] = 2604 ' Dur[ 24 ] = 2496 ' Dur[ 25 ] = 2396 ' Dur[ 26 ] = 2304 ' Dur[ 27 ] = 2218 ' Dur[ 28 ] = 2139 ' Dur[ 29 ] = 2065 ' Dur[ 30 ] = 1997 ' Dur[ 31 ] = 1932 ' Dur[ 32 ] = 1872 ' Dur[ 33 ] = 1815 ' Dur[ 34 ] = 1762 ' Dur[ 35 ] = 1711 ' Dur[ 36 ] = 1664 ' Dur[ 37 ] = 1619 ' Dur[ 38 ] = 1576 ' Dur[ 39 ] = 1536 ' Dur[ 40 ] = 1497 ' Dur[ 41 ] = 1461 ' Dur[ 42 ] = 1426 ' Dur[ 43 ] = 1393 ' Dur[ 44 ] = 1361 ' Dur[ 45 ] = 1331 ' Dur[ 46 ] = 1302 ' Dur[ 47 ] = 1274 ' Dur[ 48 ] = 1248 ' Dur[ 49 ] = 1222 ' Dur[ 50 ] = 1198 ' Dur[ 51 ] = 1174 ' Dur[ 52 ] = 1152 ' Dur[ 53 ] = 1130 ' Dur[ 54 ] = 1109 ' Dur[ 55 ] = 1089 ' Dur[ 56 ] = 1070 ' Dur[ 57 ] = 1051 ' Dur[ 58 ] = 1033 ' Dur[ 59 ] = 1015 ' Dur[ 60 ] = 998 ' Dur[ 61 ] = 982 ' Dur[ 62 ] = 966 ' Dur[ 63 ] = 951 ' Dur[ 64 ] = 936 ' Dur[ 65 ] = 921 ' Dur[ 66 ] = 908 ' Dur[ 67 ] = 894 ' Dur[ 68 ] = 881 ' Dur[ 69 ] = 868 ' Dur[ 70 ] = 856 ' Dur[ 71 ] = 844 ' Dur[ 72 ] = 832 ' Dur[ 73 ] = 820 ' Dur[ 74 ] = 809 ' Dur[ 75 ] = 799 ' Dur[ 76 ] = 788 ' Dur[ 77 ] = 778 ' Dur[ 78 ] = 768 ' Dur[ 79 ] = 758 ' Dur[ 80 ] = 749 ' Dur[ 81 ] = 739 ' Dur[ 82 ] = 730 ' Dur[ 83 ] = 722 ' Dur[ 84 ] = 713 ' Dur[ 85 ] = 705 ' Dur[ 86 ] = 696 ' Dur[ 87 ] = 688 ' Dur[ 88 ] = 681 ' Dur[ 89 ] = 673 ' Dur[ 90 ] = 666 ' Dur[ 91 ] = 658 ' Dur[ 92 ] = 651 ' Dur[ 93 ] = 644 ' Dur[ 94 ] = 637 ' Dur[ 95 ] = 630 ' Dur[ 96 ] = 624 ' Dur[ 97 ] = 617 ' Dur[ 98 ] = 611 ' Dur[ 99 ] = 605 ' Dur[ 100 ] = 599 ' Dur[ 101 ] = 593 ' Dur[ 102 ] = 587 ' Dur[ 103 ] = 582 ' Dur[ 104 ] = 576 ' Dur[ 105 ] = 570 ' Dur[ 106 ] = 565 ' Dur[ 107 ] = 560 ' Dur[ 108 ] = 555 ' Dur[ 109 ] = 550 ' Dur[ 110 ] = 545 ' Dur[ 111 ] = 540 ' Dur[ 112 ] = 535 ' Dur[ 113 ] = 530 ' Dur[ 114 ] = 525 ' Dur[ 115 ] = 521 ' Dur[ 116 ] = 516 ' Dur[ 117 ] = 512 ' Dur[ 118 ] = 508 ' Dur[ 119 ] = 503 ' Dur[ 120 ] = 499 ' Dur[ 121 ] = 495 ' Dur[ 122 ] = 491 ' Dur[ 123 ] = 487 ' Dur[ 124 ] = 483 ' Dur[ 125 ] = 479 ' Dur[ 126 ] = 475 ' Dur[ 127 ] = 472 ' 07.04.2015: ' linear scaling: 'Dur[1]= 41667 ' freq= .999992000063999 'Dur[2]= 41342 ' freq= 1.00785319207263 'Dur[3]= 41017 ' freq= 1.01583896108118 'Dur[4]= 40692 ' freq= 1.02395229201481 'Dur[5]= 40367 ' freq= 1.03219626592679 'Dur[6]= 40042 ' freq= 1.04057406389957 'Dur[7]= 39717 ' freq= 1.04908897113746 'Dur[8]= 39392 ' freq= 1.05774438126185 'Dur[9]= 39067 ' freq= 1.06654380082081 'Dur[10]= 38742 ' freq= 1.07549085402578 'Dur[11]= 38417 ' freq= 1.08458928772852 'Dur[12]= 38092 ' freq= 1.09384297665302 'Dur[13]= 37767 ' freq= 1.10325592889736 'Dur[14]= 37442 ' freq= 1.11283229172231 'Dur[15]= 37117 ' freq= 1.12257635764385 'Dur[16]= 36792 ' freq= 1.13249257084874 'Dur[17]= 36467 ' freq= 1.14258553395307 'Dur[18]= 36142 ' freq= 1.15286001512552 'Dur[19]= 35817 ' freq= 1.16332095559836 'Dur[20]= 35492 ' freq= 1.17397347759119 'Dur[21]= 35167 ' freq= 1.184822892674 'Dur[22]= 34842 ' freq= 1.19587471059832 'Dur[23]= 34517 ' freq= 1.20713464862725 'Dur[24]= 34192 ' freq= 1.2186086413976 'Dur[25]= 33867 ' freq= 1.23030285134989 'Dur[26]= 33542 ' freq= 1.24222367976467 'Dur[27]= 33217 ' freq= 1.25437777844678 'Dur[28]= 32892 ' freq= 1.26677206210223 'Dur[29]= 32567 ' freq= 1.27941372145628 'Dur[30]= 32242 ' freq= 1.29231023716477 'Dur[31]= 31917 ' freq= 1.30546939457551 'Dur[32]= 31592 ' freq= 1.31889929940069 'Dur[33]= 31267 ' freq= 1.3326083943668 'Dur[34]= 30942 ' freq= 1.3466054769138 'Dur[35]= 30617 ' freq= 1.36089971802158 'Dur[36]= 30292 ' freq= 1.37550068224834 'Dur[37]= 29967 ' freq= 1.39041834907287 'Dur[38]= 29642 ' freq= 1.40566313564087 'Dur[39]= 29317 ' freq= 1.42124592102421 'Dur[40]= 28992 ' freq= 1.43717807211185 'Dur[41]= 28667 ' freq= 1.45347147126196 'Dur[42]= 28342 ' freq= 1.47013854585656 'Dur[43]= 28017 ' freq= 1.48719229991315 'Dur[44]= 27692 ' freq= 1.50464634792238 'Dur[45]= 27367 ' freq= 1.52251495109682 'Dur[46]= 27042 ' freq= 1.54081305623351 'Dur[47]= 26717 ' freq= 1.55955633741313 'Dur[48]= 26392 ' freq= 1.57876124078003 'Dur[49]= 26067 ' freq= 1.59844503267222 'Dur[50]= 25742 ' freq= 1.6186258513972 'Dur[51]= 25417 ' freq= 1.63932276298016 'Dur[52]= 25092 ' freq= 1.66055582124449 'Dur[53]= 24767 ' freq= 1.68234613262271 'Dur[54]= 24442 ' freq= 1.70471592613807 'Dur[55]= 24117 ' freq= 1.72768862904452 'Dur[56]= 23792 ' freq= 1.75128894866622 'Dur[57]= 23467 ' freq= 1.77554296103748 'Dur[58]= 23142 ' freq= 1.80047820701178 'Dur[59]= 22817 ' freq= 1.82612379658442 'Dur[60]= 22492 ' freq= 1.85251052225977 'Dur[61]= 22167 ' freq= 1.87967098239124 'Dur[62]= 21842 ' freq= 1.90763971553276 'Dur[63]= 21517 ' freq= 1.93645334696596 'Dur[64]= 21192 ' freq= 1.9661507487102 'Dur[65]= 20867 ' freq= 1.99677321448539 'Dur[66]= 20542 ' freq= 2.02836465128355 'Dur[67]= 20217 ' freq= 2.06097178941815 'Dur[68]= 19892 ' freq= 2.09464441316442 'Dur[69]= 19567 ' freq= 2.12943561438476 'Dur[70]= 19242 ' freq= 2.1654020718567 'Dur[71]= 18917 ' freq= 2.20260435939455 'Dur[72]= 18592 ' freq= 2.24110728628801 'Dur[73]= 18267 ' freq= 2.28098027408259 'Dur[74]= 17942 ' freq= 2.32229777430981 'Dur[75]= 17617 ' freq= 2.36513973245539 'Dur[76]= 17292 ' freq= 2.40959210424859 'Dur[77]= 16967 ' freq= 2.45574743128819 'Dur[78]= 16642 ' freq= 2.50370548411649 'Dur[79]= 16317 ' freq= 2.55357398214541 'Dur[80]= 15992 ' freq= 2.60546940136735 'Dur[81]= 15667 ' freq= 2.65951788259824 'Dur[82]= 15342 ' freq= 2.71585625516013 'Dur[83]= 15017 ' freq= 2.77463319349182 'Dur[84]= 14692 ' freq= 2.83601052727108 'Dur[85]= 14367 ' freq= 2.90016472935663 'Dur[86]= 14042 ' freq= 2.9672886103594 'Dur[87]= 13717 ' freq= 3.0375932541129 'Dur[88]= 13392 ' freq= 3.11131023496615 'Dur[89]= 13067 ' freq= 3.18869416596515 'Dur[90]= 12742 ' freq= 3.27002563700099 'Dur[91]= 12417 ' freq= 3.35561461437277 'Dur[92]= 12092 ' freq= 3.44580438857647 'Dur[93]= 11767 ' freq= 3.54097617631228 'Dur[94]= 11442 ' freq= 3.64155450678786 'Dur[95]= 11117 ' freq= 3.74801355281701 'Dur[96]= 10792 ' freq= 3.8608846058809 'Dur[97]= 10467 ' freq= 3.9807649437916 'Dur[98]= 10142 ' freq= 4.10832840333925 'Dur[99]= 9817 ' freq= 4.24433805303725 'Dur[100]= 9492 ' freq= 4.38966146930749 'Dur[101]= 9167 ' freq= 4.54528926220865 'Dur[102]= 8842 ' freq= 4.71235768679786 'Dur[103]= 8517 ' freq= 4.89217643145082 'Dur[104]= 8192 ' freq= 5.08626302083333 'Dur[105]= 7867 ' freq= 5.29638574636668 'Dur[106]= 7542 ' freq= 5.5246176964554 'Dur[107]= 7217 ' freq= 5.77340538543254 'Dur[108]= 6892 ' freq= 6.04565680015477 'Dur[109]= 6567 ' freq= 6.34485559108675 'Dur[110]= 6242 ' freq= 6.6752109366656 'Dur[111]= 5917 ' freq= 7.04185679680018 'Dur[112]= 5592 ' freq= 7.45112064854554 'Dur[113]= 5267 ' freq= 7.9108917157142 'Dur[114]= 4942 ' freq= 8.43113449345744 'Dur[115]= 4617 ' freq= 9.0246191610714 'Dur[116]= 4292 ' freq= 9.70798384591488 'Dur[117]= 3967 ' freq= 10.5033190488194 'Dur[118]= 3642 ' freq= 11.4406004027091 'Dur[119]= 3317 ' freq= 12.561551602854 'Dur[120]= 2992 ' freq= 13.9260249554367 'Dur[121]= 2667 ' freq= 15.6230471191101 'Dur[122]= 2342 ' freq= 17.7910617705665 'Dur[123]= 2017 ' freq= 20.6577425218972 'Dur[124]= 1692 ' freq= 24.6256895193065 'Dur[125]= 1367 ' freq= 30.480370641307 'Dur[126]= 1042 ' freq= 39.9872040946897 'Dur[127]= 717 ' freq= 58.1125058112506 ' logarithmic scaling: Dur[1]= 41667 ' freq= .999992000063999 Dur[2]= 39065 ' freq= 1.06659840436879 Dur[3]= 37826 ' freq= 1.1015350993144 Dur[4]= 36626 ' freq= 1.13762536631537 Dur[5]= 35464 ' freq= 1.17490036844876 Dur[6]= 34339 ' freq= 1.21339196443305 Dur[7]= 33249 ' freq= 1.25317052141919 Dur[8]= 32195 ' freq= 1.29419682145261 Dur[9]= 31173 ' freq= 1.3366267817235 Dur[10]= 30184 ' freq= 1.38042229878964 Dur[11]= 29227 ' freq= 1.42562242675152 Dur[12]= 28299 ' freq= 1.47237240420745 Dur[13]= 27402 ' freq= 1.52057027467581 Dur[14]= 26532 ' freq= 1.57043067490829 Dur[15]= 25691 ' freq= 1.62183903571938 Dur[16]= 24876 ' freq= 1.67497454038699 Dur[17]= 24086 ' freq= 1.72991225885023 Dur[18]= 23322 ' freq= 1.78658205414058 Dur[19]= 22582 ' freq= 1.84512738759484 Dur[20]= 21866 ' freq= 1.90554590078966 Dur[21]= 21172 ' freq= 1.96800806096102 Dur[22]= 20501 ' freq= 2.03242118270653 Dur[23]= 19850 ' freq= 2.09907640638119 Dur[24]= 19220 ' freq= 2.16788067984738 Dur[25]= 18611 ' freq= 2.23881933623484 Dur[26]= 18020 ' freq= 2.31224565297817 Dur[27]= 17449 ' freq= 2.38791143714062 Dur[28]= 16895 ' freq= 2.4662128834961 Dur[29]= 16359 ' freq= 2.54701795138252 Dur[30]= 15840 ' freq= 2.63047138047138 Dur[31]= 15338 ' freq= 2.71656452384057 Dur[32]= 14851 ' freq= 2.80564720669764 Dur[33]= 14380 ' freq= 2.89754288363468 Dur[34]= 13924 ' freq= 2.99243512400651 Dur[35]= 13482 ' freq= 3.09054047371804 Dur[36]= 13054 ' freq= 3.19186966957765 Dur[37]= 12640 ' freq= 3.2964135021097 Dur[38]= 12239 ' freq= 3.40441757224174 Dur[39]= 11851 ' freq= 3.51587770370995 Dur[40]= 11475 ' freq= 3.63108206245461 Dur[41]= 11111 ' freq= 3.750037500375 Dur[42]= 10758 ' freq= 3.87308669517258 Dur[43]= 10417 ' freq= 3.99987200409587 Dur[44]= 10086 ' freq= 4.13113887236433 Dur[45]= 9766 ' freq= 4.26650283295788 Dur[46]= 9457 ' freq= 4.40590744069648 Dur[47]= 9157 ' freq= 4.55025299406647 Dur[48]= 8866 ' freq= 4.69960147379502 Dur[49]= 8585 ' freq= 4.8534265191225 Dur[50]= 8313 ' freq= 5.01222984081158 Dur[51]= 8049 ' freq= 5.17662649604506 Dur[52]= 7793 ' freq= 5.34667864322683 Dur[53]= 7546 ' freq= 5.52168919515858 Dur[54]= 7307 ' freq= 5.70229460334839 Dur[55]= 7075 ' freq= 5.88928150765606 Dur[56]= 6851 ' freq= 6.08183720138179 Dur[57]= 6633 ' freq= 6.28172269963315 Dur[58]= 6423 ' freq= 6.48710363796772 Dur[59]= 6219 ' freq= 6.69989816154794 Dur[60]= 6022 ' freq= 6.91907450459426 Dur[61]= 5831 ' freq= 7.14571542902875 Dur[62]= 5646 ' freq= 7.37985594521195 Dur[63]= 5467 ' freq= 7.62148649472593 Dur[64]= 5293 ' freq= 7.87203224384407 Dur[65]= 5125 ' freq= 8.13008130081301 Dur[66]= 4963 ' freq= 8.39545973537511 Dur[67]= 4805 ' freq= 8.67152271938952 Dur[68]= 4653 ' freq= 8.95479618883874 Dur[69]= 4505 ' freq= 9.24898261191269 Dur[70]= 4362 ' freq= 9.55219318355494 Dur[71]= 4224 ' freq= 9.86426767676768 Dur[72]= 4090 ' freq= 10.1874490627547 Dur[73]= 3960 ' freq= 10.5218855218855 Dur[74]= 3834 ' freq= 10.867675186924 Dur[75]= 3713 ' freq= 11.2218331986713 Dur[76]= 3595 ' freq= 11.5901715345387 Dur[77]= 3481 ' freq= 11.969740496026 Dur[78]= 3371 ' freq= 12.3603282903194 Dur[79]= 3264 ' freq= 12.765522875817 Dur[80]= 3160 ' freq= 13.1856540084388 Dur[81]= 3060 ' freq= 13.6165577342048 Dur[82]= 2963 ' freq= 14.0623242209472 Dur[83]= 2869 ' freq= 14.523062623446 Dur[84]= 2778 ' freq= 14.9988000959923 Dur[85]= 2690 ' freq= 15.4894671623296 Dur[86]= 2604 ' freq= 16.0010240655402 Dur[87]= 2522 ' freq= 16.5212794078773 Dur[88]= 2442 ' freq= 17.0625170625171 Dur[89]= 2364 ' freq= 17.6254935138184 Dur[90]= 2289 ' freq= 18.202999854376 Dur[91]= 2217 ' freq= 18.7941662907833 Dur[92]= 2146 ' freq= 19.4159676918298 Dur[93]= 2078 ' freq= 20.0513314084055 Dur[94]= 2012 ' freq= 20.7090788601723 Dur[95]= 1948 ' freq= 21.3894592744695 Dur[96]= 1887 ' freq= 22.0809044338456 Dur[97]= 1827 ' freq= 22.8060572888159 Dur[98]= 1769 ' freq= 23.5537968720558 Dur[99]= 1713 ' freq= 24.3237984043588 Dur[100]= 1658 ' freq= 25.1306795335746 Dur[101]= 1606 ' freq= 25.9443752594438 Dur[102]= 1555 ' freq= 26.7952840300107 Dur[103]= 1505 ' freq= 27.6854928017719 Dur[104]= 1458 ' freq= 28.5779606767261 Dur[105]= 1411 ' freq= 29.5298842428538 Dur[106]= 1367 ' freq= 30.480370641307 Dur[107]= 1323 ' freq= 31.4940791131267 Dur[108]= 1281 ' freq= 32.5266718709342 Dur[109]= 1241 ' freq= 33.5750738651625 Dur[110]= 1201 ' freq= 34.6933111296142 Dur[111]= 1163 ' freq= 35.8268844941244 Dur[112]= 1126 ' freq= 37.00414446418 Dur[113]= 1091 ' freq= 38.1912618392912 Dur[114]= 1056 ' freq= 39.4570707070707 Dur[115]= 1022 ' freq= 40.7697325505545 Dur[116]= 990 ' freq= 42.0875420875421 Dur[117]= 959 ' freq= 43.4480361487661 Dur[118]= 928 ' freq= 44.8994252873563 Dur[119]= 899 ' freq= 46.347793845013 Dur[120]= 870 ' freq= 47.8927203065134 Dur[121]= 843 ' freq= 49.4266508501384 Dur[122]= 816 ' freq= 51.062091503268 Dur[123]= 790 ' freq= 52.7426160337553 Dur[124]= 765 ' freq= 54.4662309368192 Dur[125]= 741 ' freq= 56.2303193882141 Dur[126]= 717 ' freq= 58.1125058112506 Dur[127]= 694 ' freq= 60.0384245917387 Return Vels_Lookup: ' lookup table for the velocity controlled pulse durations ' if we state that the longest pulse (for fortissimo) should not exceed 16ms (=666 24us units) ' and we set the minimum pulse duration at 1ms (=42 24us units) then we can calculate the lookup ' as follows: Vels[1] = 42 ' minimum velocity 1ms For i = 2 To 127 Vels[i] = Vels[i-1] + 5 Next i ' Velocity lookup tables for board 0 - after measurements 06.04.2015 ' Noot= 61 Output= 1 Vels0[1]= 184 Vels0[2]= 186 Vels0[3]= 187 Vels0[4]= 188 Vels0[5]= 189 Vels0[6]= 190 Vels0[7]= 191 Vels0[8]= 193 Vels0[9]= 194 Vels0[10]= 195 Vels0[11]= 196 Vels0[12]= 197 Vels0[13]= 198 Vels0[14]= 200 Vels0[15]= 201 Vels0[16]= 202 Vels0[17]= 203 Vels0[18]= 204 Vels0[19]= 205 Vels0[20]= 207 Vels0[21]= 208 Vels0[22]= 209 Vels0[23]= 210 Vels0[24]= 211 Vels0[25]= 212 Vels0[26]= 214 Vels0[27]= 215 Vels0[28]= 216 Vels0[29]= 217 Vels0[30]= 218 Vels0[31]= 219 Vels0[32]= 220 Vels0[33]= 222 Vels0[34]= 223 Vels0[35]= 224 Vels0[36]= 225 Vels0[37]= 226 Vels0[38]= 227 Vels0[39]= 229 Vels0[40]= 230 Vels0[41]= 231 Vels0[42]= 232 Vels0[43]= 233 Vels0[44]= 234 Vels0[45]= 236 Vels0[46]= 237 Vels0[47]= 238 Vels0[48]= 239 Vels0[49]= 240 Vels0[50]= 241 Vels0[51]= 243 Vels0[52]= 244 Vels0[53]= 245 Vels0[54]= 246 Vels0[55]= 247 Vels0[56]= 248 Vels0[57]= 249 Vels0[58]= 251 Vels0[59]= 252 Vels0[60]= 253 Vels0[61]= 254 Vels0[62]= 255 Vels0[63]= 256 Vels0[64]= 258 Vels0[65]= 259 Vels0[66]= 260 Vels0[67]= 261 Vels0[68]= 262 Vels0[69]= 263 Vels0[70]= 265 Vels0[71]= 266 Vels0[72]= 267 Vels0[73]= 268 Vels0[74]= 269 Vels0[75]= 270 Vels0[76]= 272 Vels0[77]= 273 Vels0[78]= 274 Vels0[79]= 275 Vels0[80]= 276 Vels0[81]= 277 Vels0[82]= 279 Vels0[83]= 280 Vels0[84]= 281 Vels0[85]= 282 Vels0[86]= 283 Vels0[87]= 284 Vels0[88]= 285 Vels0[89]= 287 Vels0[90]= 288 Vels0[91]= 289 Vels0[92]= 290 Vels0[93]= 291 Vels0[94]= 292 Vels0[95]= 294 Vels0[96]= 295 Vels0[97]= 296 Vels0[98]= 297 Vels0[99]= 298 Vels0[100]= 299 Vels0[101]= 301 Vels0[102]= 302 Vels0[103]= 303 Vels0[104]= 304 Vels0[105]= 305 Vels0[106]= 306 Vels0[107]= 308 Vels0[108]= 309 Vels0[109]= 310 Vels0[110]= 311 Vels0[111]= 312 Vels0[112]= 313 Vels0[113]= 314 Vels0[114]= 316 Vels0[115]= 317 Vels0[116]= 318 Vels0[117]= 319 Vels0[118]= 320 Vels0[119]= 321 Vels0[120]= 323 Vels0[121]= 324 Vels0[122]= 325 Vels0[123]= 326 Vels0[124]= 327 Vels0[125]= 328 Vels0[126]= 330 Vels0[127]= 331 ' Noot= 62 Output= 2 Vels1[1]= 47 Vels1[2]= 52 Vels1[3]= 57 Vels1[4]= 62 Vels1[5]= 66 Vels1[6]= 71 Vels1[7]= 76 Vels1[8]= 81 Vels1[9]= 86 Vels1[10]= 91 Vels1[11]= 96 Vels1[12]= 101 Vels1[13]= 105 Vels1[14]= 110 Vels1[15]= 115 Vels1[16]= 120 Vels1[17]= 125 Vels1[18]= 130 Vels1[19]= 135 Vels1[20]= 140 Vels1[21]= 144 Vels1[22]= 149 Vels1[23]= 154 Vels1[24]= 159 Vels1[25]= 164 Vels1[26]= 169 Vels1[27]= 174 Vels1[28]= 179 Vels1[29]= 183 Vels1[30]= 188 Vels1[31]= 193 Vels1[32]= 198 Vels1[33]= 203 Vels1[34]= 208 Vels1[35]= 213 Vels1[36]= 218 Vels1[37]= 222 Vels1[38]= 227 Vels1[39]= 232 Vels1[40]= 237 Vels1[41]= 242 Vels1[42]= 247 Vels1[43]= 252 Vels1[44]= 257 Vels1[45]= 261 Vels1[46]= 266 Vels1[47]= 271 Vels1[48]= 276 Vels1[49]= 281 Vels1[50]= 286 Vels1[51]= 291 Vels1[52]= 296 Vels1[53]= 300 Vels1[54]= 305 Vels1[55]= 310 Vels1[56]= 315 Vels1[57]= 320 Vels1[58]= 325 Vels1[59]= 330 Vels1[60]= 335 Vels1[61]= 339 Vels1[62]= 344 Vels1[63]= 349 Vels1[64]= 354 Vels1[65]= 359 Vels1[66]= 364 Vels1[67]= 369 Vels1[68]= 374 Vels1[69]= 378 Vels1[70]= 383 Vels1[71]= 388 Vels1[72]= 393 Vels1[73]= 398 Vels1[74]= 403 Vels1[75]= 408 Vels1[76]= 413 Vels1[77]= 417 Vels1[78]= 422 Vels1[79]= 427 Vels1[80]= 432 Vels1[81]= 437 Vels1[82]= 442 Vels1[83]= 447 Vels1[84]= 452 Vels1[85]= 456 Vels1[86]= 461 Vels1[87]= 466 Vels1[88]= 471 Vels1[89]= 476 Vels1[90]= 481 Vels1[91]= 486 Vels1[92]= 491 Vels1[93]= 495 Vels1[94]= 500 Vels1[95]= 505 Vels1[96]= 510 Vels1[97]= 515 Vels1[98]= 520 Vels1[99]= 525 Vels1[100]= 530 Vels1[101]= 534 Vels1[102]= 539 Vels1[103]= 544 Vels1[104]= 549 Vels1[105]= 554 Vels1[106]= 559 Vels1[107]= 564 Vels1[108]= 569 Vels1[109]= 573 Vels1[110]= 578 Vels1[111]= 583 Vels1[112]= 588 Vels1[113]= 593 Vels1[114]= 598 Vels1[115]= 603 Vels1[116]= 608 Vels1[117]= 612 Vels1[118]= 617 Vels1[119]= 622 Vels1[120]= 627 Vels1[121]= 632 Vels1[122]= 637 Vels1[123]= 642 Vels1[124]= 647 Vels1[125]= 651 Vels1[126]= 656 Vels1[127]= 661 ' Noot= 63 Output= 3 Vels2[1]= 47 Vels2[2]= 52 Vels2[3]= 57 Vels2[4]= 62 Vels2[5]= 66 Vels2[6]= 71 Vels2[7]= 76 Vels2[8]= 81 Vels2[9]= 86 Vels2[10]= 91 Vels2[11]= 96 Vels2[12]= 101 Vels2[13]= 105 Vels2[14]= 110 Vels2[15]= 115 Vels2[16]= 120 Vels2[17]= 125 Vels2[18]= 130 Vels2[19]= 135 Vels2[20]= 140 Vels2[21]= 144 Vels2[22]= 149 Vels2[23]= 154 Vels2[24]= 159 Vels2[25]= 164 Vels2[26]= 169 Vels2[27]= 174 Vels2[28]= 179 Vels2[29]= 183 Vels2[30]= 188 Vels2[31]= 193 Vels2[32]= 198 Vels2[33]= 203 Vels2[34]= 208 Vels2[35]= 213 Vels2[36]= 218 Vels2[37]= 222 Vels2[38]= 227 Vels2[39]= 232 Vels2[40]= 237 Vels2[41]= 242 Vels2[42]= 247 Vels2[43]= 252 Vels2[44]= 257 Vels2[45]= 261 Vels2[46]= 266 Vels2[47]= 271 Vels2[48]= 276 Vels2[49]= 281 Vels2[50]= 286 Vels2[51]= 291 Vels2[52]= 296 Vels2[53]= 300 Vels2[54]= 305 Vels2[55]= 310 Vels2[56]= 315 Vels2[57]= 320 Vels2[58]= 325 Vels2[59]= 330 Vels2[60]= 335 Vels2[61]= 339 Vels2[62]= 344 Vels2[63]= 349 Vels2[64]= 354 Vels2[65]= 359 Vels2[66]= 364 Vels2[67]= 369 Vels2[68]= 374 Vels2[69]= 378 Vels2[70]= 383 Vels2[71]= 388 Vels2[72]= 393 Vels2[73]= 398 Vels2[74]= 403 Vels2[75]= 408 Vels2[76]= 413 Vels2[77]= 417 Vels2[78]= 422 Vels2[79]= 427 Vels2[80]= 432 Vels2[81]= 437 Vels2[82]= 442 Vels2[83]= 447 Vels2[84]= 452 Vels2[85]= 456 Vels2[86]= 461 Vels2[87]= 466 Vels2[88]= 471 Vels2[89]= 476 Vels2[90]= 481 Vels2[91]= 486 Vels2[92]= 491 Vels2[93]= 495 Vels2[94]= 500 Vels2[95]= 505 Vels2[96]= 510 Vels2[97]= 515 Vels2[98]= 520 Vels2[99]= 525 Vels2[100]= 530 Vels2[101]= 534 Vels2[102]= 539 Vels2[103]= 544 Vels2[104]= 549 Vels2[105]= 554 Vels2[106]= 559 Vels2[107]= 564 Vels2[108]= 569 Vels2[109]= 573 Vels2[110]= 578 Vels2[111]= 583 Vels2[112]= 588 Vels2[113]= 593 Vels2[114]= 598 Vels2[115]= 603 Vels2[116]= 608 Vels2[117]= 612 Vels2[118]= 617 Vels2[119]= 622 Vels2[120]= 627 Vels2[121]= 632 Vels2[122]= 637 Vels2[123]= 642 Vels2[124]= 647 Vels2[125]= 651 Vels2[126]= 656 Vels2[127]= 661 ' Noot= 64 Output= 6 Vels3[1]= 81 Vels3[2]= 83 Vels3[3]= 85 Vels3[4]= 87 Vels3[5]= 88 Vels3[6]= 90 Vels3[7]= 92 Vels3[8]= 94 Vels3[9]= 96 Vels3[10]= 97 Vels3[11]= 99 Vels3[12]= 101 Vels3[13]= 103 Vels3[14]= 104 Vels3[15]= 106 Vels3[16]= 108 Vels3[17]= 110 Vels3[18]= 112 Vels3[19]= 113 Vels3[20]= 115 Vels3[21]= 117 Vels3[22]= 119 Vels3[23]= 120 Vels3[24]= 122 Vels3[25]= 124 Vels3[26]= 126 Vels3[27]= 128 Vels3[28]= 129 Vels3[29]= 131 Vels3[30]= 133 Vels3[31]= 135 Vels3[32]= 136 Vels3[33]= 138 Vels3[34]= 140 Vels3[35]= 142 Vels3[36]= 144 Vels3[37]= 145 Vels3[38]= 147 Vels3[39]= 149 Vels3[40]= 151 Vels3[41]= 152 Vels3[42]= 154 Vels3[43]= 156 Vels3[44]= 158 Vels3[45]= 160 Vels3[46]= 161 Vels3[47]= 163 Vels3[48]= 165 Vels3[49]= 167 Vels3[50]= 169 Vels3[51]= 170 Vels3[52]= 172 Vels3[53]= 174 Vels3[54]= 176 Vels3[55]= 177 Vels3[56]= 179 Vels3[57]= 181 Vels3[58]= 183 Vels3[59]= 185 Vels3[60]= 186 Vels3[61]= 188 Vels3[62]= 190 Vels3[63]= 192 Vels3[64]= 193 Vels3[65]= 195 Vels3[66]= 197 Vels3[67]= 199 Vels3[68]= 201 Vels3[69]= 202 Vels3[70]= 204 Vels3[71]= 206 Vels3[72]= 208 Vels3[73]= 209 Vels3[74]= 211 Vels3[75]= 213 Vels3[76]= 215 Vels3[77]= 217 Vels3[78]= 218 Vels3[79]= 220 Vels3[80]= 222 Vels3[81]= 224 Vels3[82]= 225 Vels3[83]= 227 Vels3[84]= 229 Vels3[85]= 231 Vels3[86]= 233 Vels3[87]= 234 Vels3[88]= 236 Vels3[89]= 238 Vels3[90]= 240 Vels3[91]= 241 Vels3[92]= 243 Vels3[93]= 245 Vels3[94]= 247 Vels3[95]= 249 Vels3[96]= 250 Vels3[97]= 252 Vels3[98]= 254 Vels3[99]= 256 Vels3[100]= 257 Vels3[101]= 259 Vels3[102]= 261 Vels3[103]= 263 Vels3[104]= 265 Vels3[105]= 266 Vels3[106]= 268 Vels3[107]= 270 Vels3[108]= 272 Vels3[109]= 274 Vels3[110]= 275 Vels3[111]= 277 Vels3[112]= 279 Vels3[113]= 281 Vels3[114]= 282 Vels3[115]= 284 Vels3[116]= 286 Vels3[117]= 288 Vels3[118]= 290 Vels3[119]= 291 Vels3[120]= 293 Vels3[121]= 295 Vels3[122]= 297 Vels3[123]= 298 Vels3[124]= 300 Vels3[125]= 302 Vels3[126]= 304 Vels3[127]= 306 ' Noot= 66 Output= 7 Vels4[1]= 47 Vels4[2]= 52 Vels4[3]= 57 Vels4[4]= 62 Vels4[5]= 66 Vels4[6]= 71 Vels4[7]= 76 Vels4[8]= 81 Vels4[9]= 86 Vels4[10]= 91 Vels4[11]= 96 Vels4[12]= 101 Vels4[13]= 105 Vels4[14]= 110 Vels4[15]= 115 Vels4[16]= 120 Vels4[17]= 125 Vels4[18]= 130 Vels4[19]= 135 Vels4[20]= 140 Vels4[21]= 144 Vels4[22]= 149 Vels4[23]= 154 Vels4[24]= 159 Vels4[25]= 164 Vels4[26]= 169 Vels4[27]= 174 Vels4[28]= 179 Vels4[29]= 183 Vels4[30]= 188 Vels4[31]= 193 Vels4[32]= 198 Vels4[33]= 203 Vels4[34]= 208 Vels4[35]= 213 Vels4[36]= 218 Vels4[37]= 222 Vels4[38]= 227 Vels4[39]= 232 Vels4[40]= 237 Vels4[41]= 242 Vels4[42]= 247 Vels4[43]= 252 Vels4[44]= 257 Vels4[45]= 261 Vels4[46]= 266 Vels4[47]= 271 Vels4[48]= 276 Vels4[49]= 281 Vels4[50]= 286 Vels4[51]= 291 Vels4[52]= 296 Vels4[53]= 300 Vels4[54]= 305 Vels4[55]= 310 Vels4[56]= 315 Vels4[57]= 320 Vels4[58]= 325 Vels4[59]= 330 Vels4[60]= 335 Vels4[61]= 339 Vels4[62]= 344 Vels4[63]= 349 Vels4[64]= 354 Vels4[65]= 359 Vels4[66]= 364 Vels4[67]= 369 Vels4[68]= 374 Vels4[69]= 378 Vels4[70]= 383 Vels4[71]= 388 Vels4[72]= 393 Vels4[73]= 398 Vels4[74]= 403 Vels4[75]= 408 Vels4[76]= 413 Vels4[77]= 417 Vels4[78]= 422 Vels4[79]= 427 Vels4[80]= 432 Vels4[81]= 437 Vels4[82]= 442 Vels4[83]= 447 Vels4[84]= 452 Vels4[85]= 456 Vels4[86]= 461 Vels4[87]= 466 Vels4[88]= 471 Vels4[89]= 476 Vels4[90]= 481 Vels4[91]= 486 Vels4[92]= 491 Vels4[93]= 495 Vels4[94]= 500 Vels4[95]= 505 Vels4[96]= 510 Vels4[97]= 515 Vels4[98]= 520 Vels4[99]= 525 Vels4[100]= 530 Vels4[101]= 534 Vels4[102]= 539 Vels4[103]= 544 Vels4[104]= 549 Vels4[105]= 554 Vels4[106]= 559 Vels4[107]= 564 Vels4[108]= 569 Vels4[109]= 573 Vels4[110]= 578 Vels4[111]= 583 Vels4[112]= 588 Vels4[113]= 593 Vels4[114]= 598 Vels4[115]= 603 Vels4[116]= 608 Vels4[117]= 612 Vels4[118]= 617 Vels4[119]= 622 Vels4[120]= 627 Vels4[121]= 632 Vels4[122]= 637 Vels4[123]= 642 Vels4[124]= 647 Vels4[125]= 651 Vels4[126]= 656 Vels4[127]= 661 Return '[EOF]