Cool Sound Effects?


Closed Thread
Results 1 to 8 of 8
  1. #1
    Join Date
    Aug 2003
    Posts
    985

    Default Cool Sound Effects?

    Here's one:

    Code:
    ticksnd:
    @ movlw     0x01                        'set sound duration for intro
    @ movwf     _sbyte                        '
    @ movlw     0x1B                        'set sound step value for intro
    @ movwf     _soundcalc                    'soundcalc = $1B
    @ movlw     0xFF                        'set the start frequency
    @ movwf     _sbuff                        '
    xcr:
    @ movf         _soundcalc     ,W                'calc the next sound
    @ addwf     _sbuff     ,F                    '
    @ call         _audo                        'make sound
    @ decf         _sbuff    ,F                    '
    @ incfsz     _sbuff    ,F                    '
    @ goto         _xcr                        'check for exit blast routine
    @ return                                'exit when sound is finished
    audo:
    SOUND portc.7,[sbuff,sbyte]                'output sound
    @ return
    '
    Just gosub ticksnd.

    Anyone got any others to share?

  2. #2
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default Re: Cool Sound Effects?

    Here's one that sounds like a blast from a futuristic laser:

    Code:
    blast:                                    '
    soundcalc = $FD    : sndcnt = 0            'make blast sound
    @ movlw     0x8F                        'set the start frequency
    @ movwf     _sbuff                        '
    xxxxx:
    @ incf        _sndcnt    ,F                    '
    IF sndcnt = $25 THEN return                '
    @ movf         _soundcalc     ,W                'calc the next sound
    @ addwf     _sbuff     ,F                    '
    @ call         _audo                        'make sound
    @ decf         _sbuff    ,F                    '
    @ incfsz     _sbuff    ,F                    '
    @ goto         _xxxxx                        'check for exit blast routine
    @ return                                'exit when sound is finished
    audo:
    SOUND portc.7,[sbuff,sbyte]                'output sound
    @ return
    
    '

  3. #3
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default Re: Cool Sound Effects?

    Translation to PBP.

    SoundPin VAR PORTC.7

    Post #1
    Code:
    ticksnd:
        sbuff = $FF
        WHILE sbuff != 0
            sbuff = sbuff + $1B
            SOUND SoundPin,[sbuff,1]
        WEND
    RETURN
    Post #2
    Code:
    blast:
        FOR sndcnt = $8F TO $20 STEP -3
            SOUND Sound2Pin,[sndcnt,1]
        NEXT sndcnt
    RETURN
    A little easier on the eyes.

    Uht-Oh, I got an idea......
    DT

  4. #4
    Join Date
    Oct 2009
    Location
    Utah, USA
    Posts
    427


    Did you find this post helpful? Yes | No

    Default Re: Cool Sound Effects?

    So I'd like to try some of these sound effects... But it seems this thread started out of thin air??? What am I missing? Is this a continuation of another thread? Is there a complete sample code that can be posted.

    In the dark here... (though that is nothing new for me)
    Thanks
    Dwight
    These PIC's are like intricate puzzles just waiting for one to discover their secrets and MASTER their capabilities.

  5. #5
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default Re: Cool Sound Effects?

    That is the complete code, you only need to declare the byte sized variables used,
    and use the sounds in some program of your own

  6. #6
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    644


    Did you find this post helpful? Yes | No

    Default Re: Cool Sound Effects?

    Quote Originally Posted by Darrel Taylor View Post
    Translation to PBP.
    It is always good to have a translator .
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

  7. #7
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default Re: Cool Sound Effects?

    Here are a couple more sound effects. All of these use the freqout command. I tried them on a PIC18F4550 at 48 mhz. You can listen to them on the attached sound file.


    Howler
    Code:
    Howler:
      FOR sndcnt = 1 TO 4
        FREQOUT sound2pin, 500, 467, 687           ' was combine 1400 Hz and 2060 Hz
        FREQOUT Sound2pin, 500, 817, 867           ' was combine 2450 Hz and 2600 Hz
      NEXT sndcnt
    Space Transporter
    Code:
    Space_Transporter:
      'DEBUG "Space Transporter", CR
      FOR sndcnt = 5 TO 5000 STEP 5                  ' frequency sweep up
        FREQOUT sound2pin, 15, sndcnt, sndcnt */ 323    ' play note, note * 1.26
      NEXT sndcnt
      FOR sndcnt = 5000 TO 5 STEP -5                 ' frequency sweep down
        FREQOUT sound2pin, 15, sndcnt;, sndcnt */ 323  ' play note, note * 1.26
      NEXT sndcnt
    Warp
    Code:
    Warp:
    for sndcnt2 = 200 to 450 step 1
       FREQOUT Sound2pin,7,sndcnt2;,(sndcnt2 -166)
    next sndcnt2
    warble/alarm sinusoidal - could use some work
    Code:
    sineval var byte[32]
    sineval[0] = 128
    sineval[1] = 148
    sineval[2] = 167
    sineval[3] = 185
    sineval[4] = 200
    sineval[5] = 213
    sineval[6] = 222
    sineval[7] = 228
    sineval[8] = 230
    sineval[9] = 228
    sineval[10] = 222
    sineval[11] = 213
    sineval[12] = 200
    sineval[13] = 185
    sineval[14] = 167
    sineval[15] = 148
    sineval[16] = 128
    sineval[17] = 108
    sineval[18] = 189
    sineval[19] = 171
    sineval[20] = 156
    sineval[21] = 143
    sineval[22] = 134
    sineval[23] = 128
    sineval[24] = 126
    sineval[25] = 128
    sineval[26] = 134
    sineval[27] = 143
    sineval[28] = 156
    sineval[29] = 171
    sineval[30] = 189
    sineval[31] = 208
    
    warble:       ;alarmish sinusoidal - needs some work!
     for sbuff = 1 to 10
         for sndcnt2 = 0 to 31 step 1
             FREQOUT Sound2pin,7,(500 +sineval[sndcnt2]);,(sndcnt2 -166)
         next sndcnt2
     next sbuff
    Attached Files Attached Files
    Last edited by ScaleRobotics; - 19th February 2012 at 17:45. Reason: Add sound file
    http://www.scalerobotics.com

  8. #8
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default Re: Cool Sound Effects?

    Nice

    ___________________

Members who have read this thread : 1

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