Possible issue with sfx: Bass tones sounds high
#define MAX_PERIOD_VALUE 4096
#define BASE_NOTE_FREQ 440.0
#define BASE_NOTE_POS 49.0
-#define ENVELOPE_FREQ_SCALE 2
#define NOTES_PER_MUNUTE (TIC_FRAMERATE / NOTES_PER_BEET * 60)
#define min(a,b) ((a) < (b) ? (a) : (b))
#define max(a,b) ((a) > (b) ? (a) : (b))
@@ -103,7 +102,7 @@ static inline s32 freq2period(double freq)
{
if(freq == 0.0) return MAX_PERIOD_VALUE;
- enum {Rate = CLOCKRATE * ENVELOPE_FREQ_SCALE / ENVELOPE_VALUES};
+ enum {Rate = CLOCKRATE / ENVELOPE_VALUES};
s32 period = round((double)Rate / freq - 1.0);
if(period < MIN_PERIOD_VALUE) return MIN_PERIOD_VALUE;
@@ -121,7 +120,7 @@ static inline s32 getAmp(const tic_sound_register* reg, s32 amp)
static void runEnvelope(blip_buffer_t* blip, tic_sound_register* reg, tic_sound_register_data* data, s32 end_time )
{
- s32 period = freq2period(reg->freq * ENVELOPE_FREQ_SCALE);
+ s32 period = freq2period(reg->freq);
for ( ; data->time < end_time; data->time += period )
{
