Minimig Discussion Forum

Discussing the Open Source FPGA Amiga Project
It is currently Mon Dec 11, 2017 7:06 pm

All times are UTC




Post new topic Reply to topic  [ 121 posts ]  Go to page Previous  1 ... 8, 9, 10, 11, 12, 13  Next
Author Message
 Post subject: Re: Minimig Sigma-Delta and the noise in Gods!
PostPosted: Wed Nov 07, 2012 8:35 am 
Offline

Joined: Tue Nov 09, 2010 3:10 pm
Posts: 316
OK, some progress: no robotic sounds on the end of Gauntlet3, no jumping noises in Gods. So far, so good.

This is using a two stage sigma-delta with what I believe are adequate amounts of dithering. Still needs some fine tuning, to see what can be done with it. Maybe adding some noise shaping on the feedback might clear the signal even more, but it's going to be tricky. I believe this is the best I can hope for, as the two-stage sigma-delta seems perfectly OK even at just 64x oversampling.

From listening to Startdust memories, it does seem the sigma delta gets overloaded at times when playing at full volume, still have to fix that by increasing the accumulator. The recording is done with half volume.

Next thing is to figure out a way to interpolate the incoming samples, from C simulations that seems to really help.

Enjoy!


Attachments:
StardustMemories.zip [945.06 KiB]
Downloaded 130 times
Gauntlet3.zip [389.02 KiB]
Downloaded 125 times

_________________
** my minimig builds: http://somuch.guru/ **
Top
 Profile  
 
 Post subject: Re: Minimig Sigma-Delta and the noise in Gods!
PostPosted: Wed Nov 07, 2012 8:56 am 
Offline

Joined: Tue Dec 13, 2011 7:48 pm
Posts: 341
chaos wrote:
OK, some progress: no robotic sounds on the end of Gauntlet3, no jumping noises in Gods. So far, so good.

This is using a two stage sigma-delta with what I believe are adequate amounts of dithering.


Awesome! Any bit truncation, or have you been able to keep full precision?

Have you tried playing Stardust Memories at minimum volume and cranking up the recording volume? (Those are the conditions under which the recordings a couple of pages back were made.)

_________________
~ Amiga 4000/030 ~ Amiga 1200 030/50MHz ~ Turbo Chameleon 64 ~ Altera DE1 with Minimig core ~
Details of my projects: http://retroramblings.net


Top
 Profile  
 
 Post subject: Re: Minimig Sigma-Delta and the noise in Gods!
PostPosted: Wed Nov 07, 2012 11:12 am 
Offline

Joined: Tue Nov 09, 2010 3:10 pm
Posts: 316
MMrobinsonb5 wrote:
Awesome! Any bit truncation, or have you been able to keep full precision?

Full precision.

Quote:
Have you tried playing Stardust Memories at minimum volume and cranking up the recording volume? (Those are the conditions under which the recordings a couple of pages back were made.)

Not yet, I just tested this morning before going to work. Will try it in the evening.

_________________
** my minimig builds: http://somuch.guru/ **


Top
 Profile  
 
 Post subject: Re: Minimig Sigma-Delta and the noise in Gods!
PostPosted: Wed Nov 07, 2012 12:38 pm 
Offline

Joined: Thu Jun 18, 2009 9:54 am
Posts: 349
Just been testing Hybrid28Mhz+Dump+SilenceFixed for a while. It's the best core to date.

-Gauntlet III: zero audio problems that I know. No strange pitches after the Skidrow intro or in musics.
Maybe the tail on the intro music is showing some final samples that shouldn't be there, but they sound armonic, matching the notes they echo. It's fine for me :)

-GODS: Just a final high-pitch noise that has to be looked for if one wants to notice it: it's activated when picking a jewel or another object by the picking tone, and only 1 of 3 times. It's there until a new sound is played.
It was IMPOSSIBLE for me to activate any strange tones appart from that now.
No strange noises, and clear strong sound.

-Stardust Memories sounds great with lowest volume set and pumped up speakers volume!


Top
 Profile  
 
 Post subject: Re: Minimig Sigma-Delta and the noise in Gods!
PostPosted: Wed Nov 07, 2012 5:52 pm 
Offline

Joined: Tue Dec 13, 2011 7:48 pm
Posts: 341
chaos wrote:
Full precision.

Excellent! :)

gaula92 wrote:
Just been testing Hybrid28Mhz+Dump+SilenceFixed for a while. It's the best core to date.

-Gauntlet III: zero audio problems that I know. No strange pitches after the Skidrow intro or in musics.
Maybe the tail on the intro music is showing some final samples that shouldn't be there, but they sound armonic, matching the notes they echo. It's fine for me :)

Also good news! The slight oddities at the end are caused by the accumulator dumping, which roughly equates to a partial bit-reduction.

Quote:
-GODS: Just a final high-pitch noise that has to be looked for if one wants to notice it: it's activated when picking a jewel or another object by the picking tone, and only 1 of 3 times. It's there until a new sound is played.
It was IMPOSSIBLE for me to activate any strange tones appart from that now.
No strange noises, and clear strong sound.

LOL - well it's not a huge surprise that there's still a corner case where the "silence" logic doesn't work, but unless it's a trivial fix I won't worry about it immediately - (a) judging from the samples he posted this morning, Chaos's great work on the sigma-delta will remove the need for it altogether, and (b) it's an ugly hack anyway, and doesn't reflect how the real Amiga hardware works.

Exciting times! :D

_________________
~ Amiga 4000/030 ~ Amiga 1200 030/50MHz ~ Turbo Chameleon 64 ~ Altera DE1 with Minimig core ~
Details of my projects: http://retroramblings.net


Top
 Profile  
 
 Post subject: Re: Minimig Sigma-Delta and the noise in Gods!
PostPosted: Thu Nov 08, 2012 1:37 pm 
Offline

Joined: Tue Nov 09, 2010 3:10 pm
Posts: 316
MMrobinsonb5: thank you for the vote of confidence, I just hope it is not premature :)

So, here's the current situation: the two-stage sigma-delta works perfectly in all my current tests, except it has one issue (as do, I believe, all single-bit sigma-deltas): overload. It can't handle very intense signals - that is sounds that contain maximum possible amplitudes, but only in cases where the sample dynamic is big enough.
The reason is purely algorithmic - the integrator in some specific cases can't handle full-scale error feedback (in multi-bit sigma-deltas, the error feedback is rarely full-scale), and it overflows. This causes the sign to change and creates high freq jump from very positive to very negative output (or vise-versa).
It is purely dependent on the sample amplitude, so by decreasing the sample amplitude you can completely avoid the problem. But that would mean loosing one bit of output range, and of course, a (barely) noticeable volume decrease of ~ -6dB.
Do mind that this doesn't necessarily mean loosing any precision, as the output range is defined with the size of the error feedback. It *does* mean loosing some SNR, so the noise will have to be somewhat carefully handled to not be noticeable.
Oh, and you can't fix the integrator by giving it more bits - no matter how many bits it has, it will still overflow.

The problem is so far only somewhat noticeable in Stardust Memories, but very noticeable in Lotus II intro, which is really playing loud.

Another day, another problem to fix :) Like I said, the sigma-delta really requires some fine balancing :)
Hopefully today I'll get home earlier than 11PM, so I'll try to fix this (last?) problem and if it works out, I can share the code for anyone interested.

Enjoy!


Attachments:
sd_overload.png
sd_overload.png [ 7.87 KiB | Viewed 1912 times ]

_________________
** my minimig builds: http://somuch.guru/ **
Top
 Profile  
 
 Post subject: Re: Minimig Sigma-Delta and the noise in Gods!
PostPosted: Thu Nov 08, 2012 8:33 pm 
Offline

Joined: Tue Dec 13, 2011 7:48 pm
Posts: 341
chaos wrote:
MMrobinsonb5: thank you for the vote of confidence, I just hope it is not premature :)


Well you at least have the advantage of understanding the theory, rather than just working on hunches and intuition! :)

Quote:
So, here's the current situation: the two-stage sigma-delta works perfectly in all my current tests, except it has one issue (as do, I believe, all single-bit sigma-deltas): overload. It can't handle very intense signals - that is sounds that contain maximum possible amplitudes, but only in cases where the sample dynamic is big enough.


OK I think I see what your mean there. So does it only happen when the signal hits a specific maximum value, or does it just get increasingly more likely to happen as the signal approaches the limits?

Would using a box filter over the incoming data to reduce the maximum possible clock-to-clock swing help?

Quote:
It is purely dependent on the sample amplitude, so by decreasing the sample amplitude you can completely avoid the problem. But that would mean loosing one bit of output range, and of course, a (barely) noticeable volume decrease of ~ -6dB.


Hmmm - do you have to lose a whole bit, or can you use a multiplier to just reduce the peak amplitude a little?

Quote:
It *does* mean loosing some SNR, so the noise will have to be somewhat carefully handled to not be noticeable.


Yeah - Frenchshark's 3rd-order modulator is attenuated, very possibly for the same reason. It'd be a shame to lose that 6db though, because even though the Minimig's audio output is pretty clean, not all the target platforms are. (My own A/V board is pretty noisy in comparison.)

No idea whether it'll help, but just in case it does here's a box filter I put together a few weeks ago.
("NaiveBoxFilter" because I was trying and failing at the time to make a smart one that could handle variable rate edges. I gave up and wrote this one, which just resamples the incoming data and interpolates between samples. It should smooth each transition into 128 equal steps)

Code:
module naiveboxfilter
(
   input clk,
   input reset,
   input[15:0] pcm_in,
   output [15:0] pcm_out
);

reg [22:0] acc = 23'h000000;
reg [6:0] cnt = 0;
reg [15:0] head=0;
reg [15:0] tail=0;

assign pcm_out=acc[22:7];

always @(posedge clk)
begin
   if(reset)
   begin
      acc<=0;
      cnt<=0;
      head<=0;
      tail<=0;
   end
   else
   begin
      if(cnt==0)
      begin
         cnt<=127;
         tail<=head;
         head<=pcm_in;
      end

      acc<=acc+{{8{head[15]}},head}-{{8{tail[15]}},tail};
      cnt<=cnt+1;
   end
end

endmodule



Edit: And let's expend a potato:
Attachment:
FilterTests.zip [1.06 MiB]
Downloaded 123 times


The zipfile contains three sets of audio snippets. The ones ending in "1.mp3" were recorded through my custom A/V board, using the same component values as the Minimig. I had three PCBs made so I'd have spares in case I messed up the soldering, so last night I populated a second A/V board, using different component values. Instead of 10nF caps in the reconstruction filter I used 22nf, and instead of 100µF DC blocking caps, I used 220µF. The snippets ending in "2.mp3" were recorded using the modified filter.
(I picked these particular songs because I remembered the samples causing aliasing effects on the real Amiga.)

The difference is pretty subtle - but to my ears the sound's now maybe a tiny bit *too* filtered - so I'll try 15nF sometime.

_________________
~ Amiga 4000/030 ~ Amiga 1200 030/50MHz ~ Turbo Chameleon 64 ~ Altera DE1 with Minimig core ~
Details of my projects: http://retroramblings.net


Top
 Profile  
 
 Post subject: Re: Minimig Sigma-Delta and the noise in Gods!
PostPosted: Sun Nov 11, 2012 11:41 am 
Offline

Joined: Tue Nov 09, 2010 3:10 pm
Posts: 316
MMrobinsonb5 wrote:
Well you at least have the advantage of understanding the theory, rather than just working on hunches and intuition! :)

Hunches and intuition are equally, if not more important than theory :)

Quote:
Would using a box filter over the incoming data to reduce the maximum possible clock-to-clock swing help?

Probably, but I haven't tested this yet. I won't be able to do it in FPGA, but I can run some C model to see the effect. Something other than a box filter would probably have to be used, though, as a box filter has unfavorable frequency characteristics for audio filtering (see this). But you could convolve a box filter into a gaussian-type filter, by applying it a few times, that would be much better, or use something like a binomial filter, which is also easy (small!) to implement.

Quote:
Hmmm - do you have to lose a whole bit, or can you use a multiplier to just reduce the peak amplitude a little?

Well, the -6dB is somewhat on the safe side, but i tried implementing a x3/4 gain, which is ~ -3dB, and it seems it works fine. Thanks for the idea!

Quote:
It'd be a shame to lose that 6db though, because even though the Minimig's audio output is pretty clean, not all the target platforms are. (My own A/V board is pretty noisy in comparison.)

Yes, I agree, but I see no way around it with a sigma-delta with levels > 1.
Noise is tricky to handle, especially in the presence of very fast digital logic, which the FPGA has plenty of. You have to be very careful how you route the analog signals (away, always away from digital! :)), and you have to make sure the supply is appropriately filtered.

Quote:
(I picked these particular songs because I remembered the samples causing aliasing effects on the real Amiga.)

I don't think we have to worry about aliasing with the minimig, as the sigma-delta is basically (also) an oversampler, so the spectral images of the base signal should be moved to much higher frequencies.

Quote:
The difference is pretty subtle - but to my ears the sound's now maybe a tiny bit *too* filtered - so I'll try 15nF sometime.

Nobody likes heavily filtered audio :) but if we'd want to match the Amiga audio output, we'd have to tune the filter even lower. But I guess tuning the filter for ~ 18kHz - 20kHz is still OK, since the current design is @ ~ 28kHz.

Regarding my sigma-delta implementation: I think I've come as far as possible with my 2 stage design (or maybe I'm tired of listening to Gauntlet3 intro over and over ;)) and the result is OK, not great. The noise floor is pretty good, but there are still some standing tones, which manifest in the game Gods. Not very audible, but they are there in the spectrogram. MMrobinsonb5: if you think the sigma-delta is adequate & you will try to implement this on the minimig board, you could try removing the additive noise (in the integrator adders) and implementing your silence fix.
I simplified the sigma-delta as much as possible, but the FPGA on the DE1 board is really filled to the max, and I'm having occasional stability problems. In the future, when I'll work on a bigger FPGA, I'll try to design a three- of five-stage sigma-delta, to see if anything better can be done.
For now, this is it, and I'll focus on removing the FLASH requirement from the current DE1 design.

Enjoy!


Attachments:
Audio.zip [5.88 KiB]
Downloaded 123 times

_________________
** my minimig builds: http://somuch.guru/ **
Top
 Profile  
 
 Post subject: Re: Minimig Sigma-Delta and the noise in Gods!
PostPosted: Sun Nov 11, 2012 8:34 pm 
Offline

Joined: Tue Dec 13, 2011 7:48 pm
Posts: 341
chaos wrote:
a box filter has unfavorable frequency characteristics for audio filtering (see this).

Eeeew!

But at 28Mhz the 128-sample box filter would be *way* above the audible spectrum - the question is would it damp the input signal's swing enough to keep the modulator happy?

Quote:
But you could convolve a box filter into a gaussian-type filter, by applying it a few times, that would be much better,

Hmmmm - how would you do that? Use several overlapping instances of the filter and average their output?

Quote:
Well, the -6dB is somewhat on the safe side, but i tried implementing a x3/4 gain, which is ~ -3dB, and it seems it works fine.

Excellent!

Quote:
Noise is tricky to handle, especially in the presence of very fast digital logic, which the FPGA has plenty of. You have to be very careful how you route the analog signals (away, always away from digital! :)),


Yup, that's probably a big part of my problem - the audio signals are routed under part of the VGA resistor ladder (albiet at right-angles).

Quote:
I don't think we have to worry about aliasing with the minimig, as the sigma-delta is basically (also) an oversampler, so the spectral images of the base signal should be moved to much higher frequencies.

Perhaps I used the wrong term, then - but at times the samples in those songs sound lousy on the real Amiga, so I was interested mostly in whether the "lousiness" was a good match for the original hardware!

Quote:
Regarding my sigma-delta implementation: I think I've come as far as possible with my 2 stage design (or maybe I'm tired of listening to Gauntlet3 intro over and over ;))

LOL - yeah it's a pity the trouble-spot isn't at the start of the track!

Quote:
and the result is OK, not great. The noise floor is pretty good, but there are still some standing tones, which manifest in the game Gods. Not very audible, but they are there in the spectrogram. MMrobinsonb5: if you think the sigma-delta is adequate & you will try to implement this on the minimig board, you could try removing the additive noise (in the integrator adders) and implementing your silence fix.


OK cool - well I'll go do a build now and see what happens :)

_________________
~ Amiga 4000/030 ~ Amiga 1200 030/50MHz ~ Turbo Chameleon 64 ~ Altera DE1 with Minimig core ~
Details of my projects: http://retroramblings.net


Top
 Profile  
 
 Post subject: Re: Minimig Sigma-Delta and the noise in Gods!
PostPosted: Sun Nov 11, 2012 10:57 pm 
Offline

Joined: Tue Dec 13, 2011 7:48 pm
Posts: 341
Ok, some... weird results here. I can see that 2nd order modulators are complex enough to be rather squirrelly!

For some reason I couldn't simply substitute the Minimig's audio.v with the new version - I ended up with a core that played no audio, and just played some very quiet dither noise, with another strange effect that I'll come to in a moment.

So I transplanted just the Sigma Delta component into the existing audio.v (and temporarily disabled the Silence fix, to make it a fair test.) Whether I've broken something in the process that accounts for these odd results, I'm not sure, but:

Firstly, I recorded the quiescent output of the sigma delta with the recording level cranked to maximum, expecting to find just some dither noise on which i could run spectrum analysis. Instead I found a periodic crackle effect that happens regularly every few seconds. I've attached a recording. It's only barely audible at normal listening levels, but what I find really interesting is that the crackle is almost fractal in nature! (Chaos, you chose the right nickname!)

Attachment:
FractalCrackle.jpg
FractalCrackle.jpg [ 26.13 KiB | Viewed 1854 times ]


Attachment:
BackgroundCrackle.zip [695.52 KiB]
Downloaded 126 times


(I've only saved one channel here to keep the file size down, but it affects both channels. Once the Minimig's actually played something, the two channels get out of sync with each other, but their phase relationship stays the same until something else is played.)

So next I recorded a snippet of Stardust Memories with the Protracker volume set to minimum and the input level still cranked up to maximum. I expected to hear some white noise in the background - but there's another strange effect here that sounds almost like a distant dog barking! Again, it's a pathological testcase, and not detectable at normal listening levels, but it's a surprise nonetheless.

I also recorded a couple of other snippets using both the Hybrid DAC and the 2nd order DAC, but it's really hard to decide whether or not I can hear a quality difference between them - I suspect I'd have to do a blind test, and that's not easy when they have different attenuation levels.

Again, whether I've messed something up in getting the DAC to work on the Minimig I don't know, but unfortunately I'm hearing robotic tones at the end of Gauntlet III. I haven't tested with Gods yet.

Anyhow, for the sake of completeness the core's here, along with the comparison recordings.
(Actually I'll add the core to the next post, since I can't add any more attachments to this one!)

Interesting times! :)


Attachments:
Comparison.zip [1.42 MiB]
Downloaded 136 times

_________________
~ Amiga 4000/030 ~ Amiga 1200 030/50MHz ~ Turbo Chameleon 64 ~ Altera DE1 with Minimig core ~
Details of my projects: http://retroramblings.net
Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 121 posts ]  Go to page Previous  1 ... 8, 9, 10, 11, 12, 13  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Translated by Xaphos © 2007, 2008, 2009 phpBB.fr