Shop OBEX P1 Docs P2 Docs Learn Events
need to see if anyone got notes and durations for the Star Spangled Banner — Parallax Forums

need to see if anyone got notes and durations for the Star Spangled Banner

MurryAMurryA Posts: 2
edited 2014-07-04 08:26 in Learn with BlocklyProp
I want to use a stamp to play star spangled banner· through a speaker but I can find the song with the notes and durations. I can't use the RTTTL format because all RTTTL program has return, instead of next, so·I can't put it in a subroutine·this causes the stamp to stop after it is played.·I need some help.·

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-11-05 20:05
    Murry,

    If you have the RTTTL script, you can modify Parallax's rtttl_convert.bs2 to output code you can cut and paste into your program. Just change the subroutine PlayNote as follows:

    ' -----[noparse][[/noparse] Subroutine - Find Comma and Play Note/Duration ]-----------------
    
      PlayNote:                                  ' Find last comma in the
                                                 ' current note entry.  Then,
        READ RTTTL_File + counter, char          ' fetch the note frequency
        SELECT char                              ' from data, and play it, or
          CASE ","                               ' pause if frequency = 0.
            counter = counter + 1
            READ Octave8 + (index * 2), Word noteFreq
            noteOctave = 8 - noteOctave
            noteFreq = noteFreq / (DCD noteOctave)
            IF noteFreq = 0 THEN
               DEBUG "PAUSE ", DEC duration, CR
            ELSE
              DEBUG "FREQOUT iopin, ", DEC duration, ",", DEC noteFreq, CR
            ENDIF
        ENDSELECT
    
        RETURN
    
    
    


    Rather than performing the PAUSEs and FREQOUTs, it will output them to the DEBUG screen as PBASIC statements.

    -Phil
  • Rich GreenRich Green Posts: 11
    edited 2007-11-06 15:49
    Where can I find the rtttl_convert.bs2 listing?



    Rich Green
  • MurryAMurryA Posts: 2
    edited 2007-11-14 16:58
    Thanks Phil I'll try it.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-11-14 19:47
    Rich,

    The RTTTL program is supposed to be on this page. Unfortunately, the link to the code is dead, so I'll attach it here.

    -Phil
  • Rich GreenRich Green Posts: 11
    edited 2007-11-18 04:37
    Thanks Phil.



    Rich Green
  • jdpetersdocjdpetersdoc Posts: 26
    edited 2008-01-20 22:04
    Wow thats a cool song! Im going to amkean alarm clock then have the be the alarm!
  • blvonk01blvonk01 Posts: 1
    edited 2011-04-21 16:26
    how do you wire the speaker to work with this code?
  • softconsoftcon Posts: 217
    edited 2014-07-04 08:26
    Our town had a parade today, and I thought it'd be nice to have a stamp playing the star spangled banner while we were rolling along on our various unpowered vehicles (wife in wheelchair, son on ripstick, and daughter on bike, and me pushing said wheelchair). Unfortunately, although I found this thread, I didn't find actual notes and things. Performing a search on google only got me a bunch of rtl links (hello google, I typed in rttl, not rtl) But anyway, even though the parade is over, I'd still like to do this, since I think it'd be a cool project, especially since I was planning to run it on a solar panel (maybe multiples if necessary) So, does anyone know where I can obtain the notes and such needed to use a button speaker on an stamp homework board?
Sign In or Register to comment.