[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] PC speaker emulation (fixed point)
From: |
Joachim Henke |
Subject: |
[Qemu-devel] [PATCH] PC speaker emulation (fixed point) |
Date: |
Mon, 23 Jan 2006 22:10:46 +0100 |
I still prefer using a sine wave, it sounds more smooth and won't
hurt our ears (and speakers) too much. I don't think that people want
to play square waves, when they have their PC connected to their hifi
system (c: The main purpose of the PC speaker is to generate tones
and many programmers used it to play melodies. Why shouldn't we take
this chance to make it sound as good as we can manage it?
I rewrote the wave form generation routine to fit into 32 bit
integer, with the highest fixed point precision for the range of all
possible parameters. To retrieve the sine values, we use a small
lookup table with a resolution of 1024 entries (we need to store the
first quarter only, since the rest is symmetric).
I extensively tested these routines (on iMac G5 / AMD K6, gcc 3 / gcc
4) to ensure, that the final sample values differ at most by +/-1
from their double float calculated counterparts. This difference
doesn't seem to be much, but when comparing directly, you can hear a
minor noise for frequencies below 200 Hz. Maybe it also depends a bit
on the speakers used.
However, this approach should still be sufficient for our purpose.
Most programs don't use too low frequencies, and if they do, people
probably won't notice.
Just test the attached patch yourselves
Jo.
Sebastian Kaliszewski wrote:
One more note about that. PC-speaker generates just plain square
wave not sine wave, so this would be more realistic. Then fixed
point calculation (16 bit integer part and 16 bit fractional) is
easy without all those sin calculation.
--
Joachim Henke
http://he-jo.net/
pc_speaker.diff.gz
Description: GNU Zip compressed data
- Re: [Qemu-devel] [patch] minimal PC speaker output, (continued)
- Re: [Qemu-devel] [patch] minimal PC speaker output, Fabrice Bellard, 2006/01/09
- Re: [Qemu-devel] [patch] minimal PC speaker output, he . jo, 2006/01/10
- [Qemu-devel] [PATCH] PC speaker emulation, Joachim Henke, 2006/01/18
- [Qemu-devel] Re: [PATCH] PC speaker emulation, Joachim Henke, 2006/01/18
- Re: [Qemu-devel] [PATCH] PC speaker emulation, malc, 2006/01/18
- [Qemu-devel] [PATCH] PC speaker emulation (fixed), Joachim Henke, 2006/01/19
- Re: [Qemu-devel] [PATCH] PC speaker emulation (fixed), malc, 2006/01/19
- Re: [Qemu-devel] [PATCH] PC speaker emulation (fixed), Joachim Henke, 2006/01/20
- Re: [Qemu-devel] [PATCH] PC speaker emulation (fixed), Johannes Schindelin, 2006/01/20
- Re: [Qemu-devel] [PATCH] PC speaker emulation (fixed), Sebastian Kaliszewski, 2006/01/20
- [Qemu-devel] [PATCH] PC speaker emulation (fixed point),
Joachim Henke <=
- Re: [Qemu-devel] [PATCH] PC speaker emulation (fixed point), Sebastian Kaliszewski, 2006/01/24
- Re: [Qemu-devel] [PATCH] PC speaker emulation (fixed point), Joachim Henke, 2006/01/24
- Re: [Qemu-devel] [PATCH] PC speaker emulation (fixed point), Sebastian Kaliszewski, 2006/01/24
- Re: [Qemu-devel] [PATCH] PC speaker emulation (fixed point), Fabrice Bellard, 2006/01/24
- Re: [Qemu-devel] [PATCH] PC speaker emulation (fixed point), Sebastian Kaliszewski, 2006/01/24
- [Qemu-devel] [PATCH] PC speaker emulation (square wave), Joachim Henke, 2006/01/25
- Re: [Qemu-devel] [PATCH] PC speaker emulation (square wave), Jamie Lokier, 2006/01/25
- Re: [Qemu-devel] [PATCH] PC speaker emulation (square wave), Sebastian Kaliszewski, 2006/01/26
- Re: [Qemu-devel] [PATCH] PC speaker emulation (square wave), Joachim Henke, 2006/01/29