SOUND command and variable array


Closed Thread
Results 1 to 13 of 13

Hybrid View

  1. #1
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    938


    Did you find this post helpful? Yes | No

    Default

    Acetronics,

    I'm not sure to understand your remark.

    I tried this:
    SOUND Speaker,[Vsnd(A),10]
    and
    SOUND Speaker,[Vsnd.0(A),10]
    and
    SOUND Speaker,(Vsnd[A],10)
    and
    SOUND Speaker,(Vsnd.0[A],10)

    In fact, I get a sound but it is a much lower frequency than compared to when I play the sound like SOUND Speaker,[121,10].
    Roger

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


    Did you find this post helpful? Yes | No

    Default ... no comment.

    Tried THIS ???
    ...

    Vsnd var byte [4]

    Vsnd[0] = 121
    Vsnd[1] = 120
    Vsnd[2] = 119
    Vsnd[3] = 116

    FOR A = 0 to 3
    SOUND Speaker,[Vsnd[A],10]
    NEXT A

    ...

    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 " !!!
    *****************************************

  3. #3
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by flotulopex View Post
    Acetronics,

    I'm not sure to understand your remark.

    I tried this:
    SOUND Speaker,[Vsnd(A),10]
    and
    SOUND Speaker,[Vsnd.0(A),10]
    and
    SOUND Speaker,(Vsnd[A],10)
    and
    SOUND Speaker,(Vsnd.0[A],10)

    In fact, I get a sound but it is a much lower frequency than compared to when I play the sound like SOUND Speaker,[121,10].
    Do you have a cap on the output like the manual suggests? What kind of speaker are you driving? What's you OSC? Which PIC are you using?

    speaker var portb.1:a var byte:for a=0 to 255:sound speaker,[a,50]:next a

    or maybe:

    vsnd var byte[3]:vsnd[0]=10:vsnd[1]=30:vsnd[2]=75:vsnd[3]=120
    a var byte:for a=0 to 3:sound speaker,[vsnd[a],50]:next a

  4. #4
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    938


    Did you find this post helpful? Yes | No

    Wink It works!!!

    Thank you ACETRONICS,

    You gave me the correct syntax.

    Just to make sure, I tried this that works too:
    Code:
    Vsnd var byte [4]
    Vsnd(0) = 121
    Vsnd(1) = 120
    Vsnd(2) = 119
    Vsnd(3) = 116
    
    FOR A = 0 to 3
    SOUND Speaker,[Vsnd(A),10]
    NEXT A
    I personally would have appreciate to see this kind of example in the Compiler's manual instead of bothering you... I read it a few times, but without any clear example, it stayed unclear to me.

    Thanks a lot for your help.
    Last edited by flotulopex; - 26th March 2007 at 20:50.
    Roger

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


    Did you find this post helpful? Yes | No

    Wink

    Hi, Flotul

    Just remember the same things must have EXACTLY the same name ...

    I do not know if brackets and parenthesis (?) really work the same manner ... but manual says "Brackets" !!! ... so let's write Brackets !!!

    no bad surprises involved ...

    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
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    938


    Did you find this post helpful? Yes | No

    Default Right!

    Thank you for pointing this out.

    Manual shows "brackets" and this is maybe why I wanted to try with parenthesis too

    Again, there is almost anything needed in the manual - same as in the data-sheets.

    Unfortunately, it is not always comprehensible for beginners like me.
    Roger

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