I have tested your emulator and it has sound, but the melodies are reversed in pitch.
The AY-3-891x chip "pitch" parameter corresponds to the wave period, not its frequency. Your code passes directly pitch as frequency, which is not correct.
For an AY running at 4MHz, reference frequency is 125000 Hz. But on a Spectrum 128K, it runs at 3.5469MHz, so the frequency is 125000 * 3.5469 / 4 = 110840.
You should substitute line 141 in /lib/Sound/ay3-8912-state.cpp
from
_channel[channel].setFrequency(this->channelFrequency[channel]);
to
_channel[channel].setFrequency(fixPitch(this->channelFrequency[channel]));
and defining somewhere in your code a fixPitch function like this:
Hello,
I have tested your emulator and it has sound, but the melodies are reversed in pitch.
The AY-3-891x chip "pitch" parameter corresponds to the wave period, not its frequency. Your code passes directly pitch as frequency, which is not correct.
For an AY running at 4MHz, reference frequency is 125000 Hz. But on a Spectrum 128K, it runs at 3.5469MHz, so the frequency is 125000 * 3.5469 / 4 = 110840.
You should substitute line 141 in /lib/Sound/ay3-8912-state.cpp from
_channel[channel].setFrequency(this->channelFrequency[channel]);
to_channel[channel].setFrequency(fixPitch(this->channelFrequency[channel]));
and defining somewhere in your code a fixPitch function like this:
Regards, David