Re: DirectSound
- From: "alanglloyd@xxxxxxx" <alanglloyd@xxxxxxx>
- Date: Fri, 20 Jul 2007 06:08:06 -0700
<snip>
for a simple sine wave out, you can use the basic trig sin/cos math<snip>
to plot the PCM bits.
A neat trick for generating sampled single frequency PCM signals is
to :
1 Generate an array of samples for a 1Hz wave at the PCM sampling rate
you intend to use.
2 Generate the consecutive values you need for frequency Fs by
sampling the above array every Fs'th element. Obviously you have to
wrap around when you've got past the end of the array by modding with
the array size
ithPCMValue := My1HzArray[(Fs * i) mod (High(My1HzArray) + 1)];
This should be quicker than calculating the sin of every sample. For a
cos value, increment the array access argument by (SamplingRate div 4)
or generate another 1Hz array for cos values from the 1Hz sin array.
Alan Lloyd
.
- References:
- DirectSound
- From: Fonon
- Re: DirectSound
- From: Jamie
- DirectSound
- Prev by Date: Re: DirectSound
- Next by Date: Re: DirectSound
- Previous by thread: Re: DirectSound
- Next by thread: Re: DirectSound
- Index(es):
Relevant Pages
|