sound command & music


Closed Thread
Results 1 to 15 of 15

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default

    Hi Trying. Hi Steve. Using the PWM module is a BIG improvement as each note will be perfectly on key. I converted some tunes into HPWM commands to play music on one of the PWM ports on a 16F818. The 818 can hold about 2 or 3 songs, the 16F819 can hold about 5 and a 16F88 that I used holds 8 different tunes. Below are 2 of them. If you want more volume, output the CCP1 pin to the gate of a FET. Source to ground and speaker from drain to B+. It will be painfully loud. I used a logic-level IRLZ44N at 3 Volts for this. Add the command CCP1CON = 0 and make the port LOW at the end of the song otherwise the FET may be left ON and kill the battery. CAUTION - writing songs and playing them on a PIC can be addicting! Be prepared to spend countless hours writing code.

    BABABLACKSHEEP:
    HPwm 1,127,262:Pause 320
    HPwm 1,127,262:Pause 320
    HPwm 1,127,392:Pause 320
    HPwm 1,127,392:Pause 320
    HPwm 1,127,440:Pause 160
    HPwm 1,127,494:Pause 160
    HPwm 1,127,523:Pause 160
    HPwm 1,127,440:Pause 160
    HPwm 1,127,392:Pause 320
    HPwm 1,127,000:Pause 320
    HPwm 1,127,349:Pause 320
    HPwm 1,127,349:Pause 320
    HPwm 1,127,330:Pause 320
    HPwm 1,127,330:Pause 320
    HPwm 1,127,294:Pause 320
    HPwm 1,127,294:Pause 320
    HPwm 1,127,262:Pause 320
    Pause 1000
    GoTo BABABLACKSHEEP

    STARSPANGLEDBANNER:
    HPwm 1,127,698:Pause 320
    HPwm 1,127,587:Pause 320
    HPwm 1,127,466:Pause 640
    HPwm 1,127,587:Pause 640
    HPwm 1,127,698:Pause 640
    HPwm 1,127,932:Pause 640
    HPwm 1,127,000:Pause 640
    HPwm 1,127,1175:Pause 320
    HPwm 1,127,1047:Pause 320
    HPwm 1,127,932:Pause 640
    HPwm 1,127,587:Pause 640
    HPwm 1,127,659:Pause 640
    HPwm 1,127,698:Pause 640
    HPwm 1,127,000:Pause 320
    HPwm 1,127,698:Pause 320
    HPwm 1,127,698:Pause 320
    HPwm 1,127,1175:Pause 640
    HPwm 1,127,1047:Pause 320
    HPwm 1,127,932:Pause 640
    HPwm 1,127,880:Pause 640
    HPwm 1,127,000:Pause 640
    HPwm 1,127,784:Pause 320
    HPwm 1,127,880:Pause 320
    HPwm 1,127,932:Pause 640
    HPwm 1,127,932:Pause 640
    HPwm 1,127,698:Pause 640
    HPwm 1,127,587:Pause 640
    HPwm 1,127,466:Pause 640
    Pause 1000
    GOTO STARSPANGLEDBANNER

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Funny things amuse grand kids here!
    <img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=881&stc=1&d=1148640458 ">

    Now if there's any existing software to convert music sheet or MIDI sequence to note/duration table it could be just much easy... i'm sure it exist.
    Attached Images Attached Images  
    Last edited by mister_e; - 26th May 2006 at 12:50.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

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


    Did you find this post helpful? Yes | No

    Wink Music ... yessss

    Hi, Steve,

    In my old papers (Electronique pratique 277 )... i've found something interesting !!!

    See a 16F84 reading a 24C256 gives 4 sec of sound.

    ...output on portB with a R -2R ladder ... amp is a LM386.

    Buuuuuut, where it becomes interesting ... is you can load the EEPROM using the Windows sound recorder ... aha !!!

    now, the Wave file has 58 bytes at top to config ...to wipe off !!!

    in the Wav-bin.exe, that's done automatically.

    then just have to load the EEPROM...

    Listen, that's all !!!

    Alain

    Problem ... the 200Kb limit is widely exploded !!! ... have an address to post that ???
    Last edited by Acetronics2; - 26th May 2006 at 14:26.
    ************************************************** ***********************
    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 " !!!
    *****************************************

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Dropped in your PM !

    Interesting but there's some additionnal hardware. Even some ISDXXX chipcoder would do the job as well. Let's see what we can with your suggestion. Will report something here... one day... when i'll found time to play 'round.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  5. #5
    trying's Avatar
    trying Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e
    Funny things amuse grand kids here!
    <img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=881&stc=1&d=1148640458 ">

    Now if there's any existing software to convert music sheet or MIDI sequence to note/duration table it could be just much easy... i'm sure it exist.
    thats great guys but thats wayyyyyy over my head (right now)
    ok mister_e I just finished a spead sheet with excel that has 4 octaves of notes gives you the note freq,period time,note repete time and other things
    for 1/16,1/4,1/2 and whole notes. but I'm stuck on how to use this with
    MSB, LSB, in data the way Melanie used it in "Yankee doodle" for give me for not knowing how to ask the right ?'s but I sure need help on this in simple terms.
    thanks trying

Similar Threads

  1. Delayed output 10 secs
    By lilimike in forum mel PIC BASIC Pro
    Replies: 37
    Last Post: - 14th October 2011, 07:28
  2. comp music with pic Sounds - Aka BeepMaster
    By flipper_md in forum Code Examples
    Replies: 18
    Last Post: - 20th September 2010, 07:04
  3. Help with sound command in 2 programs
    By hyperboarder in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th July 2007, 21:36
  4. Sound and sound control with minimal parts
    By bartman in forum General
    Replies: 23
    Last Post: - 18th January 2005, 15:08
  5. Re: quick fix for sound command?
    By Melanie in forum Code Examples
    Replies: 0
    Last Post: - 9th July 2004, 02: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