A YM2149 (aka PSG) emulator written in C.
- Internal clock divider is disabled by default. Use
PSG_setClockDivider(psg, 1)
to enable clock divider.
/* Typical YM2149 configuration */
PSG *psg = PSG_new(3579545, 44100);
PSG_setClockDivider(psg, 1);
PSG_setVolumeMode(psg, 1); // YM style
PSG_reset();
/* Typical AY-3-8910 configuration */
PSG *psg = PSG_new(3579545/2, 44100);
PSG_setVolumeMode(psg, 2); // AY style
PSG_reset();
The internal sample rate converter in emu2149 is a light-weight, simplified procedure.
Even if 1
is set to the quality (PSG_setQuality), the alias noise cannot be completely eliminated.
To obtain the best accurate result, an external sample rate conversion should be used. Please follow these steps.
- Set the sample rate to 1/8 of the chip's master clock. i.e. rate=223721Hz for master=1.78MHz.
- Set
0
to the quality value withPSG_setQuality(psg, 0)
so that you can bypass the internal rate converter. - Call
PSG_calc()
to generate samples. - Apply your preferred external rate converter to the samples to obtain your desired sample rate.