Shop OBEX P1 Docs P2 Docs Learn Events
Mairo Theme song for the BS2 — Parallax Forums

Mairo Theme song for the BS2

Ferris_BueFerris_Bue Posts: 40
edited 2007-09-28 16:15 in Learn with BlocklyProp
Hey all,

I'm tring to get the mairo theme song to play on the BS2. I have the setup done, but I need the code for it. I have started it, but I don't have the timeing down. I need help here. I will get any info that I can get.


Ferris!!!!

Comments

  • FranklinFranklin Posts: 4,747
    edited 2007-09-22 01:55
    Post your code so we can help.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • Ferris_BueFerris_Bue Posts: 40
    edited 2007-09-22 21:18
    This is what I got so far. I hope that I can get some help.

    Ferris!!!!



    Main:
    FREQOUT 10, 500, 1400
    FREQOUT 10, 500, 1100
    FREQOUT 10, 500, 1400
    FREQOUT 10, 500, 493
    FREQOUT 10, 500, 1650
    FREQOUT 10, 500, 1100
    FREQOUT 10, 500, 1650
    FREQOUT 10, 500, 1400
    FREQOUT 10, 1000,440
    FREQOUT 10, 1000,493
    FREQOUT 10, 1000,466
    FREQOUT 10, 1000,440
    FREQOUT 10, 1000,392
    FREQOUT 10, 1000,1400
    FREQOUT 10, 1000,783
    FREQOUT 10, 1000,659
    FREQOUT 10, 1000,587
    FREQOUT 10, 1000,293
    END
  • Ferris_BueFerris_Bue Posts: 40
    edited 2007-09-24 15:15
    I really need help here.
  • Steph LindsaySteph Lindsay Posts: 767
    edited 2007-09-24 17:19
    Hi Ferris,

    You are going to use up a lot of program space with all those sequential FREQOUT commands.· Have you taken a close look at the later activities in Chapter 8 of "What's a Microcontroller?"· (WAM). There are more efficient ways to write programs to play songs that also allow for easier control of timing.··You will need to figure out the duration of how long each note lasts by just listening to it over··It takes a while to work out the timing.

    There is·also an example program for playing RTTTL cell phone ringtones.· You may be able to purchase the RTTTL file for the Mario song you need online.·

    The WAM book and the Nokia ringtone player program can be downloaded here:

    http://www.parallax.com/detail.asp?product_id=28152

    -Stephanie Lindsay
    Editor, Parallax Inc.
    ·
  • Ferris_BueFerris_Bue Posts: 40
    edited 2007-09-24 20:26
    Well, yes I have read through that. But what I really need is the frecounse for the notes. That is what is hang me up right now. That is were I need the help and I'm a poor high school student right now.

    Ferris!!!!


    Here is the sheet music that I kind of used.
    http://www.jimmyr.com/mario/mariotheme.pdf

    Post Edited (Ferris_Bue) : 9/28/2007 4:31:46 PM GMT
  • Steph LindsaySteph Lindsay Posts: 767
    edited 2007-09-24 21:43
    If you are just looking for the notes to convert to frequency, here's a link to free sheet music.·· The chart in WAM·shows the frequency for each note.· The sheet music should also help you·with note·durations.· In case you are like me and don't know how to read sheet music, the second web address links to a free tutorial.

    http://www.jimmyr.com/Free_Mario_Sheet_Music.php

    http://www.datadragon.com/education/reading/

    p.s. - ringtones seem to be about $1.99 in case that's an option for you.
  • Ferris_BueFerris_Bue Posts: 40
    edited 2007-09-25 14:15
    Here is what I have so far.

    ' {$STAMP BS2}


    I VAR Byte
    FR VAR Word
    SE VAR Byte

    F CON 349
    E CON 329
    G CON 392
    LD CON 146
    HD CON 293
    C CON 261
    A CON 440
    T CON 500
    Check_Status:
    I=0
    IN4=0 THEN Mario
    GOTO Check_Stauts

    Mario:
    FOR I= 0 TO 27
    LOOKUP I, [noparse][[/noparse]E,E,E,E,C,E,G,G,C,G,E,E,A,B,B,A,G,E,G,AF,G,E,C,D,B,C,G]
    LOOKUP I, [noparse][[/noparse](T+T),T,T,T]
    FREQOUT 2,SE,FR
    IF I=27 THEN Check_Status
    NEXT

    I need help!!!

    Ferris!!!!
  • Steph LindsaySteph Lindsay Posts: 767
    edited 2007-09-25 16:50
    Hi Ferris,

    Did you copy & paste this from your BASIC Stamp Editor? It has a few bugs. I used the Editor's syntax checker and Error messages to locate them:

    There are some characters in your LOOKUP list that have no CON declaration - that's the Undefined Symbol error.

    IN4=0 THEN Mario ' THEN without an IF, giving you

    Error message " Expected ',' ": Your LOOKUP lists need to be followed with a comma and then your target variable (see LOOKUP on page 277 of the BASIC Stamp Manual or the Editor's Help) I noticed you defined FR and SE, then use them in your FREQOUT command, but don't involve them in your LOOKUP commands.

    GOTO Check_Stauts ' you've got a simple typo causing the Undefined Label error message.


    -Stephanie
  • Ferris_BueFerris_Bue Posts: 40
    edited 2007-09-26 01:20
    Well I have part of it working now. I did see some of the error that I had and fix them. But I need the timeing now, and fuger out how to get two set of notes the play the same time.

    Ferris!!!!
  • Steph LindsaySteph Lindsay Posts: 767
    edited 2007-09-26 15:36
    Good deal - I'm glad you are getting somewhere. The FREQOUT command supports generating two frequencies at once (look at FREQOUT in the Editor Help.) So, you could add a FR2 varaible, and have the FR2 notes in another LOOKUP list.

    You could also have easier control of the timing this way. Make a Time variable, then declare 4 constants: T1 CON 250, T2 CON 500, T3 CON 750, T4 CON 1000, etc. Then expand the last LOOKUP list to have one T-number for each note. That way, every time through your loop, the right duration, frequency 1, and frequency 2 get put into the FREQOUT command. The only thing here is that the two notes would play for the same length of time.

    -Stephanie
  • Ferris_BueFerris_Bue Posts: 40
    edited 2007-09-26 15:48
    Thanks for the help. Now I have a new problem. I'm trying to hook up a A type amp to the bs2. I have another qusteon. Which is better, a Class A or a Type A amp? I would like to know.

    Ferris!!!

    Post Edited (Ferris_Bue) : 9/26/2007 3:53:55 PM GMT
  • Steph LindsaySteph Lindsay Posts: 767
    edited 2007-09-26 16:58
    I'm glad that helped!

    But for hooking up amps, that's not my area. Since this is a new problem, it would be good to start a new thread with a title about selecting the amp type, so folks who know about those will find your question.

    -Stephanie
  • Ferris_BueFerris_Bue Posts: 40
    edited 2007-09-26 20:01
    k, Thanks

    Ferris!!!!
  • HumanoidoHumanoido Posts: 5,770
    edited 2007-09-27 10:58
    Would you care to post your working Mario music code?

    humanoido
  • Ferris_BueFerris_Bue Posts: 40
    edited 2007-09-27 16:33
    I have add it to this post. I f there is any I can make it better let me know. This is the working one that I have right now. Will post updatas as I make them.

    Ferris!!!!
  • HumanoidoHumanoido Posts: 5,770
    edited 2007-09-28 05:45
    Thanks for posting the code.
    I don't recognize the tune as the
    original Mario Brothers Song.
    Is this a newer one?

    humanoido
  • Ferris_BueFerris_Bue Posts: 40
    edited 2007-09-28 16:15
    The code right now is just the moldy (in a way) right now. The timeing is not where it should be, but for me right now its just a verson. Like I have said if you have any thing that can help me with this I would like.

    Ferris!!!!
Sign In or Register to comment.