It is currently Wed Jul 18, 2018 2:09 am

 All times are UTC - 7 hours

### Forum rules

Related:
• For making cartridges of your Super NES games, see Reproduction.

 Page 1 of 2 [ 24 posts ] Go to page 1, 2  Next
 Print view Previous topic | Next topic
Author Message
 Post subject: Doing a supersaw lead on the spc700Posted: Tue Jul 18, 2017 2:46 pm

Joined: Wed May 19, 2010 6:12 pm
Posts: 2712
Sorry my computer logged me out from writing this, so I need to explain this quickly.

So I figured out supersaw leads can be done like this. Use a long BRR sample (but not too long because of memory constraints). Set every BRR block to filter 1. Set every sample to 0. Now for every oscillator peak/impulse sample, add 1 to the sample height. If multiple oscillators peak at the same time, add them up. Filter 1 will create the sawtooth pattern after every impulse sample.

Top

 Post subject: Re: Doing a supersaw lead on the spc700Posted: Tue Jul 18, 2017 5:48 pm

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 6402
I don't think the BRR filter on an impulse train is really equivalent to a saw's output spectrum*, but a filtered super-pulse-train might be a useful musical instrument of its own?

Have you tried just making a super-saw sample, though? That worked fairly well for MOD music. (i.e. record a few seconds of it, crossfade for a loop.)

* Edit: maybe it actually is, in the right circumstance, see lidnariq's post below.

Last edited by rainwarrior on Tue Jul 18, 2017 8:00 pm, edited 1 time in total.

Top

 Post subject: Re: Doing a supersaw lead on the spc700Posted: Tue Jul 18, 2017 6:38 pm

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 20258
Location: NE Indiana, USA (NTSC)
The integral of a pulsetrain is a stairstep function. A stairstep function minus the line that bisects each rise and run is a sawtooth wave.

Filter 1 is a leaky integral: y[n] = x[n] + .9375*y[n - 1]. The leaky integral of a pulsetrain is a sawtooth with a bunch of DC added. So you might want to treat some oscillators as positive impulses and some as negative impulses in order to minimize spurious DC.

Top

 Post subject: Re: Doing a supersaw lead on the spc700Posted: Tue Jul 18, 2017 6:48 pm

Joined: Sun Apr 13, 2008 11:12 am
Posts: 7310
Location: Seattle
Saw's spectrum should just be a "perfect" lowpass (i.e. integrator) filter of an impulse train, IIRC?

I guess I should look at the interpolation filters...

Lessee... nocash says
Filter 0: new = sample
Filter 1: new = sample + old*1+((-old*1) SAR 4)
Filter 2: new = sample + old*2+((-old*3) SAR 5) - older+((older*1) SAR 4)
Filter 3: new = sample + old*2+((-old*13) SAR 6) - older+((older*3) SAR 4)

Filter 0 is easy.
Filter 1 is ...
y[n] = x[n]+y[n-1]-y[n-1]/16.
Y = X + 15·Y·z¯¹÷16
Y·(1-15z¯¹÷16)=X
Y÷X=1/(1-15z¯¹÷16)
so transfer function is a single zero at 0 and a pole at +15/16. That's a lowpass with corner frequency at ≈1/56 the sample playback rate ... probably close enough to a perfect integrator?

Filter 2: H=1/(1-61z¯¹÷32+15z¯²÷16) → Two zeros at 0, poles at (61±sqrt(-119))÷64 → Resonant (underdamped) 2nd-order lowpass; resonance is +9db at sample rate÷36; -3db point is at ≈1/20th the sample rate.
Filter 3: H=1/(1-115z¯¹÷64+13z¯²÷16) → Two zeros at 0, poles at (115±sqrt(-87))÷128 → Critically damped 2nd-order lowpass; -3db point is at ≈1/39th of the sample rate.

Last edited by lidnariq on Thu Jul 20, 2017 2:05 pm, edited 1 time in total.

Top

 Post subject: Re: Doing a supersaw lead on the spc700Posted: Tue Jul 18, 2017 7:02 pm

Joined: Wed May 19, 2010 6:12 pm
Posts: 2712
rainwarrior wrote:
Have you tried just making a super-saw sample, though? That worked fairly well for MOD music. (i.e. record a few seconds of it, crossfade for a loop.)

I've tried doing so in the past and they always come out weak sounding, or take up too much memory. Just really difficult to get it to sound good. Using an algorithm would guarantee everything would be crystal clear.

Top

 Post subject: Re: Doing a supersaw lead on the spc700Posted: Tue Jul 18, 2017 7:38 pm

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 6402
lidnariq wrote:
Saw's spectrum should just be a "perfect" lowpass (i.e. integrator) filter of an impulse train, IIRC?

I was thinking that a sawtooth should be -6db/octave but... ah! Yes, a simple lowpass filter should produce that. Sorry, I was working from incorrect fuzzy memories.

Though, also I thought that our filter was at a fixed cutoff, but the impulse train was being streamed in, so I didn't think it was going to be tuned to the target oscillator frequency anyway. Maybe I misinterpreted this as well... maybe that's just a matter of adjusting amplitude to fit.

Last edited by rainwarrior on Tue Jul 18, 2017 8:59 pm, edited 2 times in total.

Top

 Post subject: Re: Doing a supersaw lead on the spc700Posted: Tue Jul 18, 2017 7:52 pm

Joined: Fri Jul 04, 2014 9:31 pm
Posts: 929
Unless I'm missing something, using real single-sample impulses would result in a muffled sound, since the BRR decoding is upstream of the gaussian interpolator. But since the BRR filters are linear, it should be possible to prefilter the impulse train to counteract this.

It seems to me that with a sufficiently compact treble boost filter, such as the one BRRTools uses, it might be feasible to synthesize the BRR data for this scheme in real time. This would allow very long notes with no looping artifacts in not very much RAM. On the other hand, avoiding buffer pacing glitches might be a bit fiddly, and playing more than one note at a time might require multiple buffers...

Top

 Post subject: Re: Doing a supersaw lead on the spc700Posted: Tue Jul 18, 2017 8:30 pm

Joined: Wed May 19, 2010 6:12 pm
Posts: 2712
I can imagine that working by using {2,-1} pre-filter, but then you'd have to make sure more than 3 oscillators peak at once. You can probably use negative peaks instead just because the negative range is slightly bigger.

Top

 Post subject: Re: Doing a supersaw lead on the spc700Posted: Wed Jul 19, 2017 9:32 am

Joined: Wed May 19, 2010 6:12 pm
Posts: 2712
Here's some 65816 code to make a "pulse train." Registers X and Y need to be fed with a random seed value for where to start the first wave, so that the 7 oscillators don't merge into a single sawtooth at the loop point.

Code:
make_pulse_train:
clc
-;
inc {sample},x
tya
tay
txa
tax
cmp #\$2000
bcc -
rts

Top

 Post subject: Re: Doing a supersaw lead on the spc700Posted: Wed Jul 19, 2017 10:22 am

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 20258
Location: NE Indiana, USA (NTSC)
So that we're all on the same page, I first want to understand the requirements for this synthesis.

• In a supersaw, by how much are the oscillators typically detuned?
• At what pitches is it used?
• How long is a note held?
• And at what sample rate did you intend to synthesize it? 8K? 32K?

Top

 Post subject: Re: Doing a supersaw lead on the spc700Posted: Wed Jul 19, 2017 11:42 am

Joined: Sat Apr 25, 2015 1:47 pm
Posts: 393
Location: FL
tepples wrote:
• In a supersaw, by how much are the oscillators typically detuned?

This post seems to have a pretty good analysis of the detune setup on the original Roland JP-8000 supersaw:

Quote:
When you look at the SuperSaw's various examinations, which can be found on the web, it gets pretty clear that Roland used maximum pitch spreads expressed in prime numbers.

I chose maximum detune values in cents and these here should come pretty close to the JP8000: -191, -109, -37, 0, 31, 107, 181. Beating is reduced to an absolute minimum when using prime detune values. Phase randomization (on note-on) is also definitely needed or you won't get a strong attack on every note-on.

Top

 Post subject: Re: Doing a supersaw lead on the spc700Posted: Wed Jul 19, 2017 11:56 am

Joined: Sun Apr 13, 2008 11:12 am
Posts: 7310
Location: Seattle
Having just tried reconstructing that in puredata... I'm think he meant to say "mil" not "cents".

Top

 Post subject: Re: Doing a supersaw lead on the spc700Posted: Wed Jul 19, 2017 11:57 am

Joined: Sat Apr 25, 2015 1:47 pm
Posts: 393
Location: FL
Yeah, I'm pretty sure it's not actually supposed to span almost four semitones, but you get the idea.

Top

 Post subject: Re: Doing a supersaw lead on the spc700Posted: Wed Jul 19, 2017 12:20 pm

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 20258
Location: NE Indiana, USA (NTSC)
Assuming those are in thousandths of a semitone, this one-liner spits out the frequency ratios:
Code:
\$ python3 -c 'print("\n".join("%.5f" % 2**(detune/12000) for detune in [-191, -109, -37, 0, 31, 107, 181]))'
0.98903
0.99372
0.99787
1.00000
1.00179
1.00620
1.01051

Or to scale them by (say) 4096 for soft-synthesizing with integer math:
Code:
\$ python3 -c 'print("\n".join("%d" % round(4096 * 2**(detune/12000)) for detune in [-191, -109, -37, 0, 31, 107, 181]))'
4051
4070
4087
4096
4103
4121
4139

Top

 Post subject: Re: Doing a supersaw lead on the spc700Posted: Wed Jul 19, 2017 1:57 pm

Joined: Wed May 19, 2010 6:12 pm
Posts: 2712
I could possibly do variable detune amounts by making the loop longer or shorter. For example, If I have 8192 samples, and 32 samples per cycle (base frequency) then I can divide 8192 by {253,254,255,256,257,258,259} to get the oscillator frequencies. If I had 8224 samples, then I can divide them by {254,255,256,257,258,259,260} and have resulting frequencies that are slightly closer.

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 2 [ 24 posts ] Go to page 1, 2  Next

 All times are UTC - 7 hours

#### Who is online

Users browsing this forum: No registered users and 3 guests

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

Search for:
 Jump to:  Select a forum ------------------ NES / Famicom    NESdev    NESemdev    NES Graphics    NES Music    Homebrew Projects       2018 NESdev Competition       2017 NESdev Competition       2016 NESdev Competition       2014 NESdev Competition       2011 NESdev Competition    Newbie Help Center    NES Hardware and Flash Equipment       Reproduction    NESdev International       FCdev       NESdev China       NESdev Middle East Other    General Stuff    Membler Industries    Other Retro Dev       SNESdev       GBDev    Test Forum Site Issues    phpBB Issues    Web Issues    nesdevWiki