Searching \ for 'Music' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/index.htm?key=music
Search entire site for: 'Music'.

Truncated match.
PICList Thread
'Music'
1998\10\20@112855 by Tom Rowley

flavicon
face
Has anyone developed code to generate musical tones with a PIC. I looked
through the archives but didn't see any references. When I find the stamp
maillist archive, (anybody know where that is?) I'll check that also.
Thanks
Tom

1998\10\20@123027 by Quentin

flavicon
face
Here is a simple test program I made to generate sound via 4 outputs and a
R2R ladder (see AN655). Just place a value in FREQ to generate different
tones. With a 4 Megs Crystal I was generating sounds around 1.1 Khz, so a
higher Xtal will help.

Quentin

;***********************************************************************
;*    Look up Tables                                                   *
;***********************************************************************

SINETBL
           ADDWF       PCL,F
           RETLW       0X00
       RETLW   0x08
       RETLW   0x0A
       RETLW   0x0C
       RETLW   0x0D
       RETLW   0x0E
       RETLW   0x0E
       RETLW   0x0F
       RETLW   0x0F
       RETLW   0x0F
       RETLW   0x0E
       RETLW   0x0E
       RETLW   0x0D
       RETLW   0x0C
       RETLW   0x0A
       RETLW   0x08
       RETLW   0x06
       RETLW   0x04
       RETLW   0x02
       RETLW   0x01
       RETLW   0x01
       RETLW   0x00
       RETLW   0x00
       RETLW   0x00
       RETLW   0x01
       RETLW   0x01
       RETLW   0x02
       RETLW   0x04
       RETLW   0x06
;***********************************************************************
;*      SUB routines                                               *
;***********************************************************************

DELAY
           MOVF        FREQ,W
           MOVWF       TEMP1
LOOP        DECFSZ      TEMP1,F
           GOTO        LOOP
           RETLW       0

;***********************************************************************
;*          Main Program                                               *
;***********************************************************************
MAIN
           MOVLW       0X01C
           MOVWF       TBLCNT

OUTSINE
           MOVF        TBLCNT,W
           CALL        SINETBL
           MOVWF       PORTA
           CALL        DELAY
           NOP
           DECFSZ      TBLCNT,F
           GOTO        OUTSINE
           GOTO        MAIN

       END                       ; DONE!!!!!

1998\10\20@175029 by John Payson

flavicon
face
part 0 411 bytes
Sure.  I have a music box program I wrote a couple years ago to
play music using an 8-bit R/2R DAC.  The firmware is designed to
run on a 10MHz PIC, with music stored in a 24C16 EEPROM; eight
simulated tone generators produce sine waves with a simulated
"decay" similar to that of a real music box.  If there's enough
interest I could post the code and/or mail out PCB's (I have a
fair number left).

1998\10\20@184159 by ben

flavicon
face
John Payson wrote:
> >>
> Has anyone developed code to generate musical tones with a PIC. I looked
> through the archives but didn't see any references. When I find the stamp
> maillist archive, (anybody know where that is?) I'll check that also.
> Thanks
> <<
>
> Sure.  I have a music box program I wrote a couple years ago to
> play music using an 8-bit R/2R DAC.  The firmware is designed to
> run on a 10MHz PIC, with music stored in a 24C16 EEPROM; eight
> simulated tone generators produce sine waves with a simulated
> "decay" similar to that of a real music box.  If there's enough
> interest I could post the code and/or mail out PCB's (I have a
> fair number left).

I did a somewhat nastier, lower budget version than this - stored the
music in the PIC, and dispensed with the DAC. I used pulse width
modulation to get the effect of 3 channel square waves on one
digital channel, so you can just hook a piezo speaker to
B0 and GND.

The code I have available for downloading is at

       http://www.codepuppies.com/~ben/sens/pic/saints.zip

It's designed for a 10MHz 16F84, but should work on a 16C84. The ZIP
contains full source/hex. Probably not the best written prog in the
world, but it's one of my first!

It's a cheesy version of "When The Saints Go Marching In", which,
combined with the rather lame sound quality, produces possibly the
most irritating music known to mankind. Be warned.

Cheers,

Ben

1998\10\20@201400 by jamesp

picon face
John,

I would be interested in both the board and the software.  I could put it
in my daughters jewelry box, and when she raises the lid, it would play.


Thanks,


Jim



----------
{Quote hidden}

1998\10\21@163914 by Alessandro Zummo

flavicon
face
Il 20-Ott-98, John Payson scrisse:


> "decay" similar to that of a real music box.  If there's enough
> interest I could post the code and/or mail out PCB's (I have a
> fair number left).

i'm interested. :-)

--

  - *Alex* -

 http://freepage.logicom.it/azummo/

1998\10\26@113405 by myke predko

flavicon
face
Tom Rowley asked:
>Has anyone developed code to generate musical tones with a PIC. I looked
>through the archives but didn't see any references. When I find the stamp
>maillist archive, (anybody know where that is?) I'll check that also.

My old "TuneMkr.zip" is available for download at:

http://www.myke.com/PICMicro/picpage1.htm

myke

Steven Hunter's "The Second Saladin" is my Book of the Week.

http://www.myke.com/Book_Room/book1a.htm

Also look at:

http://www.myke.com/My_Books/homcu.htm

for information on "Handbook of Microcontrollers" which has been named the
Main Selection for November 1998 for the Electronics Book Club!

More... (looser matching)
- Last day of these posts
- In 1998 , 1999 only
- Today
- New search...