What i meant is that if you for example listen on it trough the laptop speakers you will only hear the high frequencies.
But yeah, the noise in the song is there by design For instance the lead is using a square wave oscillator and the drum track is, of course, just noise with a fast envelope and a delay effect. But I’ll review the sound settings for the published song later today. If it’s too much noise I’ll lower the delay effect or volume on that track a bit.
For those interested, here’s the synth itself. As you can see there are plenty of room for bit loss in the calculations, but it’s very compact!
It features three oscillators, a delay effect, envelope, transpose on each track.
I’ll publish the complete code including the tracker, with more comments, in a few days.
final int[][] wave = new int[3][WAVE_BUFFER];
for (index = 0; index < WAVE_BUFFER; index++) {
wave[0][index] = (int) (FP_S1 * (float) Math.sin(index * (2f * PI / WAVE_BUFFER)));
wave[1][index] = index < (WAVE_BUFFER >> 1) ? FP_S1 : -FP_S1;
wave[2][index] = (int) (FP_U1 * (float) Math.random()) - FP_S1;
}
while (true) {
for (int track = 0; track < NUM_TRACKS; track++) {
final int[] ins = song[INSTRUMENT_OFFSET + track];
ins[ENV_LEVEL + 1] = FP_U1;
final int pattern = song[SEQUENCE_OFFSET + (track >> 1)][((track & 1) * SEQ_LENGTH) + (sequence >> 5)];
final int note = song[PATTERN_OFFSET + pattern][sequence & 0x1f];
if (note == 1 && ins[ENV_STAGE] < (2 << FP)) {
ins[ENV_STAGE] = (2 << FP);
}
if (note > 1) {
ins[OSC1_RATE] = frequencies.charAt((note - 2 + ins[PITCH]) & 0xf) << ((note - 2 + ins[PITCH]) >> 4);
ins[ENV_STAGE] = 0;
}
for (index = 0, offset = 0; index < SAMPLES_PER_TICK; index++, offset += 2) {
if (track == 0) {
out[offset] = 0;
out[offset + 1] = 0;
}
final int stage = ins[ENV_STAGE] >> FP;
ins[ENV_STAGE] += ins[ENV_RATE + stage];
ins[OSC1_PHASE] += ins[OSC1_RATE];
int value = wave[ins[OSC_TYPE]][ins[OSC1_PHASE] & WAVE_BUFFER_MASK];
final int env = ins[ENV_LEVEL + stage]
+ (int) ((long) (ins[ENV_LEVEL + stage + 1] - ins[ENV_LEVEL + stage]) * (ins[ENV_STAGE] & FP_U1) >> FP);
value = (((value * env) >> (FP + 2)) * ins[VOLUME]) >> 6;
value += ((delay[track][(ins[DELAY_POS] - ((ins[DELAY] * SAMPLES_PER_TICK >> 1))) & DELAY_MASK]) * ins[DELAY_MIX]) / 128;
delay[track][ins[DELAY_POS]] = (value * ins[DELAY_FEEDBACK]) / 128;
out[offset + 0] += (byte) value;
out[offset + 1] += (byte) (value >> 8);
ins[DELAY_POS] = (ins[DELAY_POS] + 1) & DELAY_MASK;
}
}
index = 0;
while (index < BUFFER_SIZE) {
index += line.write(out, index, BUFFER_SIZE - index);
}
sequence = (sequence + 1) & SEQ_WRAP;
}