Music Input


Closed Thread
Results 1 to 22 of 22

Thread: Music Input

Hybrid View

  1. #1
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics
    Hi,

    May I point out this little circuit from the far east...

    http://www.selectronic.fr/includes_s...ek/HT2040A.pdf

    ... really ... cool !!!

    Alain
    Thats wicked ! .... nice find

  2. #2
    Join Date
    Apr 2006
    Location
    New Hampshire USA
    Posts
    298


    Did you find this post helpful? Yes | No

    Smile zimmerframe

    Quote Originally Posted by Malcolm
    God you make me feel old, I think the last century bit made me reach for my zimmerframe and I'm only mid 40's
    Ha, I had to Google "zimmerframe", we have them in this country, just different names... Made me smile...
    http://www.thefreedictionary.com/Zimmer+frame


    Alain
    What a great find. The HT2040A IS a disco light. (they might think it is for Christmas lights, but we know better.) All in one part.


    Side Notes:
    One of the interesting things, about the artistic mode of visual music, is sloppier is better!

    Normally, the goal is to sharpen filters. Make the "cut-off", at band edges, as sharp as possible, without causing "ringing" or other ill effects. However, with "music changed into light", it is better to have overlapping filters, to cause a blending of the lights. Much more interesting patterns, come about, when the band edges overlap.

    Very simple L-C or even R-C passive filters are not only adequate, but even desirable

    "A Project Too Far."
    What might be interesting:
    Have mirrors mounted on some type of PIC controllable devices. This could be stepper motors, syncros, voice coils, linear motors etc..
    The front panel could be some type of translucent, diffusing rear projection screen. Maybe, something as simple as a "suspended ceiling" florescent light diffusion lens.
    The light would be modulated as in a standard colour (color) organ.
    But, the mechanical device would move the modulated colours around by volume (loudness). Who knows, maybe higher on the panel could represent louder musical notes.
    It seems like this might add a third dimension to the mix. ?

    -Adam-
    Ohm it's not just a good idea... it's the LAW !

  3. #3
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Wink The last ... but not least

    Hi,Malc

    I've another lightshow including a Basic stamp interpreter chip ( In easy words : PicBasic compatible ... but some timings, may be, are to be corrected )

    From Electronique Pratique june 2000 issue ... Here, all is done by soft ( no "miracle" filter to cut and paste ... )

    Alain
    Attached Files Attached Files
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  4. #4
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Thanks

    I do get the feeling that I'm re-inventing the wheel... but then again, its all good learning experience

  5. #5
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by malc-c
    Thanks

    I do get the feeling that I'm re-inventing the wheel... )
    You took some time to understand it ... but youth must pass !!!

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  6. #6
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default Ok more confusion

    Now the fact that we all went out to a party last night and I'm still getting over a hangover might have something to do with this...

    Whilst this might be re-inventing the wheel, I'm still having fun at trying to get this working, but I'm having problems... I've managed (with some help from guys on an electronics forum) to come up with a low pass filter cct that goes high (5v) in time with the beat. The idea is to feed this pulse into the PIC so that whilst the pin is high the code continues to run through the sequence, and when its low it stops at what ever position it is in the sequence. Here is the modified code, which compiles but when I tie RA2 high the pattern doesn't advance at all.

    Code:
    ;************ set up PIC *****************
    PORTA = 0 ' declare port level BEFORE port direction = safe power-on
    CMCON = 7 ' PortA Digital inputs
    CCP1CON = 0 ' PWM off
    VRCON = 0        ' Voltage reference disabled
    OPTION_REG.7 =    0
    
    
    TRISA=%11100111        'set PORTA as all input apart from A3 & A4
    TRISB=%00000000        'set PORTB as all output
    
    @RC_OSC_NOCLKOUT 
    @WDT_ON
    @PWRT_ON
    @MCLR_OFF
    @BOD_ON
    @LVP_OFF
    @CPD_OFF
    @PROTECT_OFF
    
    ;************* 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 varibles ************
        
    i var byte                          ;used for for next loops
    M var byte                          
    D var byte                          ;used to store the result of the pot on port A1
    scale var byte                      ;used in the POT command
    Scale = 254                         ;used to set range 
    SW1 var PORTA.6                     ;up switch 
    SW2 var PORTA.0                     ;down switch
    mus var PORTA.2                     ;pin for music input
    SWcount var byte                    ;used as a place holder for patterns selwction
    swcount=1                           ;set place holder to default to pattern 1
    steps VAR BYTE                      ;used to store the number of steps in the pattern sequence
    counts VAR BYTE                     ;used in the FOR NEXT loop to run through the sequence
                                                                
    ;************* main program ****************
    
    Main:
    Pot PORTA.1,scale,D                 ;used to read value from 10k pot
    if sw1=0 then swcount=swcount+1     ;check to see if up button pressed, if so add 1 to SWcount
    if sw2=0 then swcount=swcount-1     ;check to see if down button pressed if so delete 1 to SWcount
    pause 60                            ;debounce delay
    If swcount>7 then swcount=7         ;error trap for exceeding max patterns
    If SWcount<0 then swcount=0         ;error trap for exceeding min patterns
    IF swcount = 0 then all:
    
    
    TRISB = 0                           
    gosub sel1                          ;go to subroutine to select pattern
    counts = 1                          ;set position marker
    gosub sel2                          ;go to subroutine to advance through sequence
    PAUSE D                             ;pause period set by varible D
    If mus = 1 then counts = counts + 1 ;check to see if music trigger is present and if so advance position by 1
    If counts > steps then counts =1    ;check to see if at the end of sequence
    goto main:                          ;go back to the main program and run again
    
    ;************* Subroutines *****************
    Sel1:
    if swcount = 1 then read Patt1, steps
    if swcount = 2 then read Patt2, steps
    If swcount = 3 then read Patt3, steps
    if swcount = 4 then read Patt4, steps
    if swcount = 5 then read Patt5, steps
    If swcount = 6 then read Patt6, steps
    If swcount = 7 then Read patt7, steps
    return
    
    Sel2:
    if swcount = 1 then READ (Patt1+counts), PORTB 
    if swcount = 2 then READ (Patt2+counts), PORTB
    if swcount = 3 then READ (Patt3+counts), PORTB
    if swcount = 4 then READ (Patt4+counts), PORTB
    if swcount = 5 then READ (Patt5+counts), PORTB
    if swcount = 6 then READ (Patt6+counts), PORTB
    if swcount = 7 then READ (Patt7+counts), PORTB
    RETURN
    I also tried modifying the previous arrangement using the for next loop

    Code:
    TRISB = 0                           
    gosub sel1                          ;go to subroutine to select pattern
    FOR counts = 1 TO steps             ;advance to through the entries
    gosub sel2                          ;go to subroutine to advance through sequence
    PAUSE D                             ;pause period set by varible D
    if mus = 1 then
    NEXT counts                         ;advance through loop to next position
    end if                       
    goto main:                          ;go back to the main program and run again
    My logic was that if mus (ie pin RA2) is high then continue the for next loop, but no matter how I phrase the section I get syntax errors (nested next without matching for, etc)

    Anyone have any ideas ?

  7. #7
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    well several cups of coffee later I have something that works.. to a fashion. The only thing with the code at the moment is that it seems to randomly revert back to the default pattern 1, so something is causing SWcount to loose / reset. I'm assuming that the audio filter is causing interfearance, even though the PIN on the PIC is tied low via a 10K resistor.

    Anyway, here is the main section of the code:
    Code:
    ;************* main program ****************
    counts = 0
    
    Main:
    Pot PORTA.1,scale,D                 ;used to read value from 10k pot
    if sw1=0 then swcount=swcount+1     ;check to see if up button pressed, if so add 1 to SWcount
    if sw2=0 then goto music     ;check to see if down button pressed and if so go to music
    pause 60                            ;debounce delay
    If swcount>7 then swcount=1         ;error trap for exceeding max patterns
                               
    gosub sel1                          ;go to subroutine to select pattern
    FOR counts = 1 TO steps             ;advance to through the entries
    gosub sel2                          ;go to subroutine to advance through sequence
    PAUSE D                             ;pause period set by varible D
    NEXT counts                       ;advance through loop to next position                    
    goto main:                          ;go back to the main program and run again
    
    
    music:
    Pot PORTA.1,scale,D                 ;used to read value from 10k pot
    if sw1=0 then swcount=swcount+1     ;cycles through the patterns by adding 1 to SWcount
    if sw2=0 then goto main             ;check to see if down button pressed and if so go to main
    pause 60                            ;debounce delay
    If swcount>7 then swcount=1         ;error trap for exceeding max patterns
    
    
                               
    gosub sel1
    If mus = 1 then counts = counts + 1 ;if bass or beat present move to the next step in pattern 
    gosub sel2                          ;go to subroutine to display pattern in current step
    PAUSE D                             ;pause period set by varible D
    If counts = steps then counts = 0   ;if counts then reset counts to 1
    goto music:                          ;go back to the main program and run again
    
    ;************* Subroutines *****************
    Sel1:
    if swcount = 1 then read Patt1, steps
    if swcount = 2 then read Patt2, steps
    If swcount = 3 then read Patt3, steps
    if swcount = 4 then read Patt4, steps
    if swcount = 5 then read Patt5, steps
    If swcount = 6 then read Patt6, steps
    If swcount = 7 then Read patt7, steps
    return
    
    Sel2:
    if swcount = 1 then READ (Patt1+counts), PORTB 
    if swcount = 2 then READ (Patt2+counts), PORTB
    if swcount = 3 then READ (Patt3+counts), PORTB
    if swcount = 4 then READ (Patt4+counts), PORTB
    if swcount = 5 then READ (Patt5+counts), PORTB
    if swcount = 6 then READ (Patt6+counts), PORTB
    if swcount = 7 then READ (Patt7+counts), PORTB
    RETURN

Similar Threads

  1. Sony LanC Program
    By l_gaminde in forum Code Examples
    Replies: 2
    Last Post: - 25th September 2009, 18:51
  2. floating A/D input
    By muddy0409 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 28th April 2009, 13:21
  3. LED "capacitance" won't get lower
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 3rd May 2007, 20:31
  4. Timing input pulses and re-outputting them
    By jamie_s in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 28th February 2007, 01:50
  5. Using LEDs as light sensors
    By skimask in forum Code Examples
    Replies: 3
    Last Post: - 30th December 2006, 22:19

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts