Re: [hatari-devel] 7an's Hi-Hats

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


----- Nicolas Pomarède wrote:
> Le 30/06/2017 à 02:45, David Savinkoff a écrit :
> > ----- Nicolas Pomarède wrote:
> >> Le 29/06/2017 à 22:01, David Savinkoff a écrit :
> >>> Hi,
> >>>
> >>> I was looking at hatari/src/sound.c :: YM2149_RndCompute()
> >>>
> >>> This function must be executed at the same rate as the noise
> >>> frequency register in the YM2149.
> >>> YM2149_RndCompute() is, however, executed on a per sample
> >>> basis which is not the same. Thus, different sound.
> >>>
> >>>
> >>
> >> Hi
> >>
> >> do you mean in YM2149_NextSample_250() ? code is :
> >>
> >>    if ( Noise_count >= Noise_per )
> >>    {
> >>       Noise_count = 0;
> >>       Noise_val = YM2149_RndCompute();                	
> >>    }
> >>
> >> so it correctly updates noise output each time the counter reached the
> >> current period.
> >>
> >> And when comparing STF wav recording with Hatari's wav this gives indeed
> >> similar wave signals and phase duration for noise.
> >>
> >> Or did you mean sthg else ?
> > 
> > I mean the code here (although I had to look at older code because
> > of hg.tuxfamily.org not working).
> > 
> > The problem is that:  if ( Noise_count >= Noise_per )
> > should be a for() loop because if someone chooses a frequency of
> > 125kHz, YM2149_RndCompute() needs to be called 125000 times
> > per second. In this example, the noise generator makes frequencies
> > from 125kHz down to 125kHz/2^17 and some of these frequencies
> > are above the nyquist limit of the sampling rate.
> 
> Well, it's already theer : look above and there's a :
> 
>          while ( YM_Clock_Step < YM_ATARI_CLOCK_COUNTER )
> 
> You can see that YM_Clock_Step is incremented with YM_REPLAY_FREQ, so 
> the while loop in ten guarantees that tone counter will be incremented 
> 250.000 times per second (and 125.000 times for noise).
> When exiting the while loop, we take the latest values for 
> tone/noise/env state.
> As always, when replay freq is below clock freq (44.1 kHz vs 250 kHz in 
> that case), some frequencies will be altered. But for tone this means 
> per<=6, which is really rarely used as it's nearly non audible on a real ST.
> 
> 
> > (Assuming 125kHz is possible with the registers - What is the highest frequency?)
> 
> Noise uses a base freq of 125 kHz and period can be between 1 and 31. So 
> noise freq will be between 125 kHz and 4 kHz. This means that noise with 
> period <= 3 will also be altered at a replay of 44.1 kHz.
> 
> But here also, this is not the reason for 7an sound being too loud.
> 
> Nicolas
> 

Thanks for the info. I will have to do some testing with my Atari ST.
Note that for YM2149 noise, 125 kHz clock will have infrasonic,
ultrasonic, and the whole audible range because the LFSR is 17 bits.
The audible range may be quieter at high clock rates because
some of the harmonics energy is lost to the ultrasonic.

The LFSR may need to be filtered separately.
The IIR filters I'm using on the YM2149 are exactly what
a first order low pass capacitor/resistor filter is. So the
cutoff frequencies are the only thing reasonable to change.

We may need to know the register settings and code used
for the hi-hats to investigate the sound. Maybe the hi-hats
are very particular (maybe use tone and noise) and hard
to emulate.










Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/