question about SOUND command


Closed Thread
Results 1 to 8 of 8

Hybrid View

  1. #1
    Join Date
    Nov 2004
    Location
    Saskatchewan Canada
    Posts
    189


    Did you find this post helpful? Yes | No

    Default

    Yes to all of that Steve.

    All the calibrations are set the same on the PIC. The program is different, but the sound has changed between them.

    The only thing I can think of is that the timing is off for some reason between the programs, but in such a way that it isn't obvious as to what is doing it.

    I have been considering using those other routines to make the beep, but this has become one of those things that needs an explaination now to satisfy me.

    I also found that table that Melanie made while I was searching for possible explainations.

    I think today I am going to redo the program from a different angle and see if while doing that I uncover the reason. There has to be a logical reason for it.

    Bart

    After using a different method to get what I wanted I managed to eliminate 200 words which I always like, and bring the two programs to within 66 words of each other. There was no difference in the sound. The second, longer, program still has different sound from the same command as the shorter program. I'm really scratching my head here although I've learned more thinking outside the box through it all.
    Last edited by bartman; - 27th November 2005 at 19:46. Reason: did the re-write

  2. #2
    Join Date
    Nov 2004
    Location
    Saskatchewan Canada
    Posts
    189


    Did you find this post helpful? Yes | No

    Default

    I've done more experiment with your example code Steve using the one that has some assembly.

    If I use Melanie's table to get my corresponding frequency of what SOUND 116 would produce I come up with 886.5 / 2 is 443 as my Avar (from your example). I used a cycle (from your example) of 1200 for the note length.

    Doing this I can duplicate my orignal sound which is good.

    Now, you may remember you gave me this little program bit a while back for something else. At that time the variables were all BYTE size, but to use the 443 and 1200 I needed WORD size. No problem, I changed that in my definitions.

    Now I see that using WORD in place of BYTE actually distorts my other bit of sound code which used a cycle of 30 and a Avar of 255.

    From this I can assuming that it takes the processor longer to deal with a WORD variable than a BYTE variable hence the distortion of my original code?

    I can easily include two of these routines, one to deal with WORD and one for BYTE for the different sounds I need without distortion, but is my logic correct on the handling of different size variables?

    Is there a way around including two routines that are identical except for the variable size?

    Thanks.

    Bart

  3. #3
    Join Date
    Nov 2004
    Location
    Saskatchewan Canada
    Posts
    189


    Did you find this post helpful? Yes | No

    Default

    If I use Melanie's table to get my corresponding frequency of what SOUND 116 would produce I come up with 886.5 / 2 is 443 as my Avar (from your example). I used a cycle (from your example) of 1200 for the note length.
    I see now that this is actually wrong and it should be 1/886 x .5 for a pauseus value of 564.

    At least I am reasonably sure of this from what I have learned.

    Bart

  4. #4
    Join Date
    Nov 2004
    Location
    Saskatchewan Canada
    Posts
    189


    Did you find this post helpful? Yes | No

    Default

    Seems I may have stumped everyone?

    The plot thickens. Last night, out of the blue, it started working properly. I had made no changes to the program. Just as suddenly it returned to producing the wrong sound.

    I swap the buzzer and it works properly so I think that the problem has been a bad buzzer, but when I used the "bad" one again with the other program it still works fine 100% of the time.

    So the new program requires a different buzzer then the old program to make the same sound. I don't think so.

    Anyone have any ideas at all keeping in mind it is the SAME PIC I'm using each time with the same components, just swapping out the programs which are within 66 words of being the same length of each other with the same sound values.

    Bart

Similar Threads

  1. Help w/ speaker for 16F690 and SOUND command
    By bhiggenson in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 22nd March 2009, 18:55
  2. Help with sound command in 2 programs
    By hyperboarder in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th July 2007, 20:36
  3. Replies: 4
    Last Post: - 10th November 2006, 07:37
  4. Can I do this???
    By noobie in forum mel PIC BASIC
    Replies: 2
    Last Post: - 10th June 2006, 18:57
  5. Re: quick fix for sound command?
    By Melanie in forum Code Examples
    Replies: 0
    Last Post: - 9th July 2004, 01:44

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