Shop OBEX P1 Docs P2 Docs Learn Events
christmas song — Parallax Forums

christmas song

Hi I am new to basic stamp.....question how can I play my song on my basic board over and over....I know I little bit of code....thnakx

Comments

  • PublisonPublison Posts: 12,366
    edited 2015-12-02 14:51
    Welcome to the forums!

    It may be as simply adding a repeat at the end of your code. If you could post your code that you are using now, a suggestion could be made.

  • ercoerco Posts: 20,256
    do

    SONG CODE

    loop
  • erco wrote: »
    do

    SONG CODE

    loop

    Easy Peasy! :)


  • In the interest of not having your board "adjusted" with a hammer, you should probably do something like
    DO WHILE iterations < TooManyTimes
    
        SONG CODE
        iterations = interations + 1
    
    LOOP
    

    just saying'
  • ercoerco Posts: 20,256
    C'mon Tom, every seasoned radio listener/mall shopper knows that part of the Christmas fun is having the same jolly tune drummed endlessly into your noggin. We're turning benitoleyva's Christmas project into an electronic seasonal simulation. :)

    Pa-rum-pum-pum-pum...

    Speaking of which, benitoleyva please post a Youtube vid or such, and you'll be the first entry into the 2015 Hack the Halls contest. Ken, Matt, what can we win this year? And no, I don't need ANOTHER S3.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2015-12-09 08:47
    "Wreck the halls with Boston Charlie, Wala Wala, Washington and Kalamazoo.
    This the season to buy a Harley. You can get one and join the zoo.
    Now we don our gay apparel, fa la la, fa la la, fa la la LA."

    I hope you don't expect us to take a musical score and convert all the notes to frequencies and timing to delays to get the actual output. That would best be first done in a spreadsheet, like Excel. Then the BS2 could just use FREQOUT and a bit of clever timing loops to look up the data pairs.

    It might be easier to try something short for a first go - like "Hi Ho Hi, it's off to work we go". If that works, then tackle something longer.

    +++++++++++++++++

    I heard this song below once again today and actually began to wonder if this was indeed 'The Last Christmas'.

    Last Christmas, I gave you my heart
    But the very next day, you gave it away
    This year, to save me from tears
    I'll give it to someone special

    Last Christmas, I gave you my heart
    But the very next day, you gave it away
    This year, to save me from tears
    I'll give it to someone special (special)

    Once bitten and twice shy
    I keep my distance but you still catch my eye
    Tell me baby do you recognize me?
    Well it's been a year, it doesn't surprise me

    I wrapped it up and sent it
    With a note saying "I Love You" I meant it
    Now I know what a fool I've been
    But if you kissed me now I know you'd fool me again

    Last Christmas, I gave you my heart
    But the very next day, you gave it away
    This year, to save me from tears
    I'll give it to someone special (special)

    Last Christmas, I gave you my heart


  • ercoerco Posts: 20,256
    In the true spirit of Christmas, allow me to amend my pseudo code:

    DO

    SONG CODE

    VOLUME=VOLUME+1
    TEMPO=TEMPO+1
    LOOP
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2015-12-09 08:49
    As a novice coding project, this is all about having the skill to read music before you start with the coding.

    If you don't know a bass cleft from a treble cleft, 3/4 time versus 6/8, a note from a rest, key signatures, and so on --- you are not really prepared to program music on a microcontroller.

    This all reminds me of a guy that refused to pay is bookie who broke all his fingers. So the guy goes to the ER to get help. After treatment, he asks the doctor one question.

    Guy - "Doctor, will I be able to play the piano?"
    Doctor - "The prognosis is good, I doubt that you will have any problems."
    Guy - "I don't understand."
    Doctor - "Yes, you will be able to play the piano."
    Guy - "That's great. I never could before."

    IOW -- Background skills might be required to program music. Other projects may require different background skills.
  • benitoleyva,

    The BASIC Stamp Manual has an explanation of every BS2 command and how to use it.
    DO...LOOP is on page 175 (page 179 of the PDF)
    FREQOUT is on page 199 (page 203 of the PDF)
    https://www.parallax.com/sites/default/files/downloads/27218-Web-BASICStampManual-v2.2.pdf

    Chapter 8 of What's a Microcontroller shows you how to make sounds and music with the piezospeaker (page 245).
    You can also see an example of a DO...LOOP on page 39.
    https://www.parallax.com/sites/default/files/downloads/28123-Whats-a-Micro-v3.0.pdf

    This project shows how to play sheet music on the piezospeaker.
    http://learn.parallax.com/project/playing-sheet-music-piezospeaker

    This project is a Christmas caroling light display.
    http://learn.parallax.com/project/christmas-caroling-device-light-display

    Now is also a good time to buy the BASIC Stamp Activity Kit or a BS2 module since both are on sale.
    https://www.parallax.com/product/90005
    https://www.parallax.com/product/bs2-ic
  • ercoerco Posts: 20,256
    edited 2015-12-18 13:37
    @Loopy: It's your cleft sentence that is causing the treble here. :)https://en.m.wikipedia.org/wiki/Cleft_sentence

    I bet you meant treble clef & bass clef when you and your staff waltzed in. Noted for the rest of us. ;)
Sign In or Register to comment.