Shop OBEX P1 Docs P2 Docs Learn Events
sound pal — Parallax Forums

sound pal

cplattcplatt Posts: 55
edited 2011-05-12 07:29 in BASIC Stamp
I am having no luck getting my soundpal to work...put it on the servo headers, BOE switch to 2 and this is my code. Could someone make a suggestion? Are my bauds wrong? Thank you!

' {$STAMP BS2p}
' {$PBASIC 2.5}

iopin PIN 14 'Pin number used for communicaiton with SoundPAL.
baud CON $8000 + 240 'Communication baudrate is 9600 for BS2p.
reset CON $8000 + 2063 'Reset baudrate is 1200 for BS2p.

'----Reset the SoundPAL
DoReset:
DO:LOOP UNTIL iopin 'Make sure SoundPAL is powered up.
SEROUT iopin, reset, [0] 'Output 9 low bits at 1200 baud (i.e. a 7.5ms pulse).
RETURN

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-05-12 00:33
    The code you've shown will reset the SoundPAL, but that's not enough to make it produce sound. Is there more to your program?

    -Phil
  • cplattcplatt Posts: 55
    edited 2011-05-12 05:46
    ok that makes sense, the documentation is a little spotty. So you must include the template code into your stamp code-like about 70 lines- before you can get it to play a sound. What I want is the soundpal to play a louder and louder alarm as a variable increases. This should be possible I hope. Thank you Phil
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-05-12 07:29
    I do recommend including the template, yes. You will also need some code that uses the constants defined in the template to play sounds. Try one of the demo programs first. Then you can modify it as you wish to change the sounds produced.

    As to changing the volume level, no, that can't be done. The SoundPAL has one volume level: loud. However, you can simulate the effect of different volumes by adjusting the style and duration of the notes you play. For example, notes played staccato with rests in between will be less noticeable than those played legato with no rests.

    -Phil
Sign In or Register to comment.