Subject:
|
RE: legOS 0.2.2 dsound_play ?
|
Newsgroups:
|
lugnet.robotics
|
Date:
|
Mon, 29 Nov 1999 16:31:50 GMT
|
Original-From:
|
Jim Thomas <jim.thomas@trw.comSPAMLESS>
|
Viewed:
|
763 times
|
| |
| |
Ok, I see the problem, this won't play WAV files (assuming the description
below is accurate). If a new bit to the speaker is only being generated at
8KHz then you cannot get useful speech out of it. What you need is to PWM
to get various amplitudes. Basically the WAV file needs to be upsampled in
frequency at the same time decimated in amplitude (to one bit). Worst case
would require, assuming 8 bit amplitude, a base frequency increase of 256
times -- this is a one bit dither. There may be an optimization to this but
in general this is the solution. This was done with a windows driver for
the PC speaker. Some of the newer brand name PCs sounded like crap because
they replaced the large speaker with something sub-standard.
Hope this helps,
JT
> -----Original Message-----
> From: Joel Shafer [mailto:joel@connect.net]
> Sent: Wednesday, November 24, 1999 9:38 PM
> To: lego-robotics@crynwr.com
> Subject: Re: legOS 0.2.2 dsound_play ?
>
>
> One of my first goals for the RCX was to try and get it to
> speak. I talked
> to Markus about this a long time ago. At the time, he had
> written the
> speaker driver but was unable to get much more than noise to
> come out of
> it. Perhaps the digital resolution of the speaker is such
> that it can only
> produce beeps.
>
> I would be very interested if you can get it to do more than beep.
>
> At 04:15 AM 11/25/99 +0000, you wrote:
> > hello again,
> > has anybody got anything else than noise from legOS 0.2.2 dsound_play ?
> >
> > i'm able to compile and dll this little application:
> >
> > #include <dsound.h>
> > #include "sample.h"
> >
> > int main(int argc, char *argv[])
> > {
> > dsound_play(sample,sizeof(sample));
> > return 0;
> > }
> >
> > ( sample.h was produced by running : sample-convert fuenfte.wav )
> >
> > However, everything i hear when i press RUN is a short burst of noise.
> >
> > What i'm wondering about: as far as i understand currently, dsound_play
> > works as follows:
> > 8-Bit-Timer0 (whose output is wired to the speaker ?) is programmed to
> > output 1 on compare A match, and 0 on compare B match. IRQ is enabled on
> > A match, and the IRQ handler puts a new sample into compare B register
> > on every 4.th interrupt. The level of A match is fixed to 0xff-20 = 235
> > ( maybe the speaker needs some DC ??).
> > Timer base frequency is set to system/2 making 8 Mhz, what results in
> > 8000000/256 = 31250 IRQ frequency. Because only every 4.th interrupt
> > gets a new sample, actual playback frequency is 31250/4 = 7812.5,
> > approximately 8000.
> > Thus, the average voltage that is output to the speaker will be
> > following the samples, as long as the value of the samples won't exceed
> > 235. However, the converted sample.h contains many values larger than
> > 235, so i think this can't work.
> > Thanks for any hints (or a .wav file that plays nicely),
> Martin
>
>
> Joel Shafer joel@connect.net
>
|
|
1 Message in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
Active threads in Robotics
|
|
|
|