Struth - was it that long ago when I was messing about with this project !

Basically I ended up using a low pass filter to trigger an NE555 in mono stable mode. Its output was then fed to the PIC which ran the pre-set pattern at what ever speed the "gate" was set to. This video shows one of the first versions which used op-ams in the filter

http://www.micro-heli.co.uk/discolights2.avi

This then evolved into this,



which used a simplified (but now looking at the two videos, less responsive) filtering, as can be seen in the video below

http://www.micro-heli.co.uk/lmv.avi

As far as I can tell this is the code for the PIC using the schematic above (I've had to dig it out of an archive backup so can't be 100% sure its the final version)

Code:
'****************************************************************
'*  Name    : Lightmaster V                                     *
'*  Author  : M.Crabbe                                          *
'*  Notice  : Copyright (c) 2007 M. Crabbe                      *
'*          : All Rights Reserved                               *
'*  Date    : 01/01/2007                                        *
'*  Version : 1.0                                               *
'*  Notes   :                                                   *
'*          :                                                   *
'****************************************************************


;*************** Set up LCD *****************

DEFINE LCD_DREG PORTC                           ' LCD data port 
DEFINE LCD_DBIT 0                               ' LCD data starting bit 0 or 4 
DEFINE LCD_RSREG PORTC                          ' LCD register select port 
DEFINE LCD_RSBIT 4                              ' LCD register select bit 
DEFINE LCD_EREG PORTC                           ' LCD enable port 
DEFINE LCD_EBIT 5                               ' LCD enable bit 
DEFINE LCD_BITS 4                               ' LCD bus size 4 or 8 
DEFINE LCD_LINES 2                              ' Number lines on LCD 
DEFINE LCD_COMMANDUS 2000                       ' Command delay time in us 
DEFINE LCD_DATAUS 50                            ' Data delay time in us

;************* set up pattern data **********
    
Patt1 DATA 16,1,2,4,8,16,32,64,128,128,64,32,16,8,4,2,1 
Patt2 DATA 8,129,66,36,24,24,36,66,129 
Patt3 DATA 16,1,3,2,6,4,12,8,24,16,48,32,96,64,192,128,0 
Patt4 DATA 16,1,128,2,64,4,32,8,16,8,32,4,64,2,128,1,0 
Patt5 DATA 12,24,60,126,255,231,195,129,0,129,195,231,255 
Patt6 DATA 13,1,2,4,8,17,34,68,136,16,32,64,128,0 
Patt7 DATA 8,128,64,32,16,8,4,2,1

;************* set up PIC ********************

ADCON1=$07                                      ' PORTA all disgital
CMCON = 7                                       ' Digital inputs
CCP1CON = 0                                     ' PWM off
TRISA=%11111111                                 ' set PORTA as all input 
TRISB=%00000000                                 ' set PORTB as all output
TRISC=%00000000                                 ' set PORTC as all output
PORTB=0
audio var PORTA.0                               ;input from beat filter (+5v)
option var PORTA.2                              ;music or chase option select
sequence var PORTA.3                            ;pattern selection

;************* set up variables ***************

Patt    var byte [8]                            ;used to store the sequences
Patt[1]=Patt1
Patt[2]=Patt2
Patt[3]=Patt3
Patt[4]=Patt4
Patt[5]=Patt5
Patt[6]=Patt6
Patt[7]=Patt7

C var byte                                      ;used to advance through pattern
D var byte                                      ;used for the speed the sequence runs at
scale var byte                                  ;used in the POT command
Scale = 10                                     ;used to provide ragge with pot command
steps var byte                                  ;used for storing the number of steps in a sequence
swcount var byte                                ;used to select the required sequence required
swcount=1                                       ;set default sequence at start
sel var byte                                    ;used to select music or chase
sel=1                                           ;used to select mode 

;**************** main program ********************
main:

Pot PORTA.4,scale,D                             ;used to read value from 10k pot and set the speed
gosub pattern                                   ;jump out to select pattern sequence
LCDOUT $FE,$C0, "Chase Speed " ,#D	            'show decimal value of D for speed of chase
if PORTA.2=0 then goto music                    ;if Pin A2 is low goto music
pause 60                                        ;debounce delay
read patt[swcount],steps                        ;read the first value of the selected patter and place it in the variable steps
for C = 1 to steps                              ;for / next loop
READ PATT[SWCOUNT]+ C,PORTB                     ;reads the step value for selected pattern and send it to PORTB 
PAUSE D                                         ;delay for speed
NEXT                                            ;advance through pattern
goto main:                                      ;go to start of main program

music:                  
gosub pattern                                   ;jump to pattern sequence selection
LCDOUT $FE,$C0, "Music - selected "  	        ;show that music has been selecterd
read patt[swcount],steps                        ;read the first value of the selected patter and place it in the variable steps
READ PATT[SWCOUNT]+ C,PORTB                     ;reads the step value for selected pattern and send it to PORTB 
If audio=1 then C=C+1                           ;if pin is high a beat is present, so advance pattern
If C=steps then C=1                             ;check to see if end of the patetrn is reached
if PORTA.2 = 0 then goto main                   ;if A2 is low then goto main
pause 20                                        ;debounce pause
goto music:                                     ;go back to music and start again

;*********** subs **************

pattern:
if sequence=0 then swcount=swcount+1            ;check to see if cycle button pressed, if so add 1 to SWcount
pause 40                                        ;debounce delay
If swcount>7 then swcount=1                     ;error trap for exceeding max patterns                      
if swcount=1 then LCDOUT $FE, 1, "Pattern 1"    'Clear display and show sequence number
if swcount=2 then LCDOUT $FE, 1, "Pattern 2"
if swcount=3 then LCDOUT $FE, 1, "Pattern 3"
if swcount=4 then LCDOUT $FE, 1, "Pattern 4"
if swcount=5 then LCDOUT $FE, 1, "Pattern 5"
if swcount=6 then LCDOUT $FE, 1, "Pattern 6"
if swcount=7 then LCDOUT $FE, 1, "Pattern 7"
return
Hope this helps