Page 2 of 2

Re: Mist/Mistica FPGA

Posted: Thu Jun 25, 2020 6:59 am
by Vic20-Ian
nippur72 wrote: Mon Jun 22, 2020 11:01 am I was able to setup the IDE and compile for the Mister.

I merged the the audio section of the 6561 I wrote for the MiST last year, indeed the Mister code was very old dating back to my intervention, so it also lacks all the improvements on the video section that have been written for the MiST in the while. It's a pity there there is no central repository with just one single implementation always kept update.

I've put the resulting .RBF file here if you want to give it a try. Consider that I don't own a Mister yet, so it was a completely "blind" build. It's the first ever Mister core that I compile, so I don't know if it starts at all.

Anyway, if everything is ok, you should be able to hear the voice in Berzerk MMX+. Please let me know.

Regarding the audio distortion you mentioned, I guess it's something that has to do with "audio mixing" outside of the VIC20 emulation. I don't know much of the Mister yet, the code looks foreign to me, also because it's a much more complex machine than the MiST. Apparently there is a HDMI audio, a SPDIF audio and normal audio. And also a "linux audio"!

The issue I supect might be here, but I'm totally clueless:

Code: Select all

always @(posedge clk) begin
	reg signed [16:0] a1, a2, a3, a4;

	a1 <= is_signed ? {ca[15],ca} : {2'b00,ca[15:1]};
	a2 <= a1 + {linux_audio[15],linux_audio};

	pre_out <= a2[16:1];

	case(mix)
		0: a3 <= a2;
		1: a3 <= $signed(a2) - $signed(a2[16:3]) + $signed(pre_in[15:2]);
		2: a3 <= $signed(a2) - $signed(a2[16:2]) + $signed(pre_in[15:1]);
		3: a3 <= {a2[16],a2[16:1]} + {pre_in[15],pre_in};
	endcase

	if(att[4]) a4 <= 0;
	else a4 <= a3 >>> att[3:0];

	//clamping
	out <= ^a4[16:15] ? {a4[16],{15{a4[15]}}} : a4[15:0];
end

Hi Nippur,

I just tested this on Mister and the Berzerk MMX+ audio is working great, many thanks.

Best regards,
Ian

Re: Mist/Mistica FPGA

Posted: Thu Jun 25, 2020 9:30 am
by nippur72
cool, I will open a "pull request" on the official repo so that the improvement can be included in the future releases.

Is channel mixing still distorded ? I've read somewhere that signed/unsigned values are a common source of distortion.

Re: Mist/Mistica FPGA

Posted: Thu Jun 25, 2020 10:26 am
by Vic20-Ian
I will try a few games tomorrow and let you know

Re: Mist/Mistica FPGA

Posted: Sat Jul 25, 2020 7:52 am
by beamrider
Finally got around to trying this...

The channel mixing is still heavily distorted in my experience.

Video

Thanks for looking at it though. Perhaps when you get your MiSTer you can improve it.

Re: Mist/Mistica FPGA

Posted: Sun Jul 26, 2020 8:28 am
by nippur72
I don't have a MiSTer yet, but let's see if we can at least identify the issue.

The audio output of the emulated 6561 is subject to a lowpass and highpass filtering to simulate the real VIC20 frequency response. It's converted from 6 bits to 16 bits in the process. Then the signal is driven into a sound mixer specific to Mister (I don't know the details). The output of this mixer is then feed into a 1-bit converter which is the final audio output of the MiSTer.

I've hacked the source code skipping all the filtering and the mixing, so the audio now goes strictly from the 6561 to the 1 bit converter. So if it sounds good, then we know where the problem is.

You can try the resulting .rbf image here.

As before, I compiled it "blindly" so I don't know if it works at all. If you don't hear any sound, it's likely I've messed it too much. Please report here.

"NO VIC 20 EMULATION WILL LEFT BEHIND."

Re: Mist/Mistica FPGA

Posted: Mon Jul 27, 2020 5:51 am
by beamrider
Thanks.

The link appears to require permissions.

Re: Mist/Mistica FPGA

Posted: Mon Jul 27, 2020 6:15 am
by nippur72
oops, I forgot to share in google drive. Now it should allow access

Re: Mist/Mistica FPGA

Posted: Mon Jul 27, 2020 11:43 am
by beamrider
thanks.

That works great. The sound is very clear now.

I'll use this core, I can't see any downside to bypassing the mixer.

Re: Mist/Mistica FPGA

Posted: Mon Jul 27, 2020 12:49 pm
by nippur72
I am happy it works :) so the issue can be handled later without hurry.

Re: Mist/Mistica FPGA

Posted: Tue Jul 28, 2020 1:10 pm
by nippur72
If you want to check, I've uploaded here another version which has the filters but NOT the mixing; just to circumscribe the issue further.

Re: Mist/Mistica FPGA

Posted: Fri Jan 01, 2021 2:05 pm
by verm71
I can confirm that the problem returns in the Jul 28 unofficial build, whereas it was fine in the Jul 26 build. This would appear to point to the filters as the culprit.