Searching \ for '[PIC]:Music' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/microchip/devices.htm?key=pic
Search entire site for: 'Music'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]:Music'
2000\08\19@140024 by Brian Jones

flavicon
face
Apologies to those who get this twice - James Newton has just
reminded me that my original append didn't have the [PIC] header
so may not have reached its full audience.

I run a 'warm iron' evening at my ham radio club every December.
The idea is I design and kit something simple for the members to
build - must take less than a couple of hours and cost less than 10
dollars. Last years 20 sequenced LED Xmas tree driven by a
12C509 was a great hit.

I'd like to add music this year but can't find a cheap source of
Holtek tune chips so was wondering what I'd need to make the
16F84 (or whatever) sound decent. Obviously a starting point is a
simple square wave with the roughness filtered. But how do I make
a richer tone - what harmonics do I need? Is it a simple job of
adding harmonic square waves suitably attentuated and feeding all
the outputs to the filter/speaker?

Any ideas ??

Brian E Jones
Centre for Java Technology
IBM HURSLEY

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

2000\08\19@141723 by Bob Ammerman

picon face
Here's another idea:

Rather than use PWM out, you could set up a simple R-2R D to A. I expect as
few as five or six bits would sound pretty good.

Bob Ammerman
RAm Systems
(contract development of high performance, high function, low-level
software)

{Original Message removed}

2000\08\19@141726 by Bob Ammerman

picon face
{oops: here is the response again, with the [PIC]:}

How about real waveforms with PWM (hardware or software) output?

Or you could use an R-2R D to A. Five or six bits would probably be enough.


You can easily store a sampled (or synthesized) waveform in a table. You
then index through the table at various rates to generate different notes.
This is the basic idea behind "wavetable" sound cards.

The trick is that you maintain a 16 bit value for your current position in
the table, but only use the top 8 bits to index.

The lower 8 bits are a running 'error value'.

Here is the idea in sorta-C

unsigned char sound_table[256] = {
   ... a bunch of numbers for the desired waveform ...
};

union {
   unsigned short as_short;
   struct {
       unsigned char ls_bits;
       unsigned char  ms_bits;
   } as_bytes;
} index;

/*
the following variable determines the frequency of the note to be
generated. You think of it as a fixed point binary number with 8 bits on
each side of the binary point

assume you are sampling at 8,000 samples per second

 if note_value == 0x200    (ie: 2.00 in fixed point)
 then it will take 128 samples or 128/8000 of a second
 to generate one cycle of output. Thus the frequency will be 62.50 Hz.

 because the time taken to cycle through the table is proportional to
note_value
 so will the frequency be.
*/

unsigned short note_value;

// assume you are sampling at 8,000 samples per second
//     if note
//
unsigned short note_value;

index.as_short = 0;

for (;;)    // loop forever
{
    index.as_short += note_value;
    output(sound_table[index.as_bytes.ms_bits]);
}

You can use a similar technique to perform envelope generation, but then you
will need to multiply the envelope value by the waveform value to compute
the output.

At 8000 samples per second and a 4MHz clock you will have 125 instructions
per sample. This should be enough to do quite a bit.

btw: I did this sort of thing over 20 years ago using a Data General
minicomputer and it sounded great.

Bob Ammerman
RAm Systems
(contract development of high performance, high function, low-level
software)

{Original Message removed}

2000\08\19@145253 by James Newton

face picon face
there is some code for managing big tables (for wav tables etc...) on
http://www.piclist.com
I think it is
http://www.piclist.com/../microchip/tables
but if you go the  main page and hit "FAQ" then "Routine Library" then
Memory / tables etc... you should find it.

James Newton, PICList Admin #3
spam_OUTjamesnewtonTakeThisOuTspampiclist.com
1-619-652-0593 phone
http://www.piclist.com

{Original Message removed}

2000\08\19@153343 by Oliver Broad

flavicon
face
I've heard polyphonic music output from a 6809 running at 0.9MHz. AFAIK it
was squarewave sources mixed in software then output through a simple
weighted resistor (not r2r) DAC. I think I would be tempted to do some of
the waveshaping in hardware, say with two pic pins per 'voice', one charging
a largeish capacitor for envelope, and the other 'chopping' it using a diode
or transistor. This could give a simple 'ding' sound which may be
acceptable, with the PIC only outputing squarewaves.

Obviously the passives count would be high.

Table synthesis would be great, you could do anything, but I would expect it
to really eat cycles. Can't say I've tried though.

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

2000\08\20@020202 by Dave Bell

flavicon
face
Oliver Broad <.....obroadKILLspamspam@spam@TELINCO.CO.UK> wrote:

>I've heard polyphonic music output from a 6809 running at 0.9MHz. AFAIK
>it was squarewave sources mixed in software then output through a simple
>weighted resistor (not r2r) DAC.

That wasn't a Vectrex, was it?

Dave

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2000\08\20@073300 by Oliver Broad

flavicon
face
No, either a Dragon or a converted Tandy colour computer.

Vectrex wasn't 6809 based was it?, I never knew much about it. It got it's
name from having a vector display didn't it.

{Original Message removed}

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