Famitracker: DPCM Loop Problem

Discuss NSF files, FamiTracker, MML tools, or anything else related to NES music.

Moderator: Moderators

User avatar
dougeff
Posts: 3079
Joined: Fri May 08, 2015 7:17 pm

Re: Famitracker: DPCM Loop Problem

Post by dougeff »

Are these samples explicitly open-source / free to use?

I am working on a music related NES project, and I might be able to use these as a pseudo 2nd triangle channel.
nesdoug.com -- blog/tutorial on programming for the NES
User avatar
rainwarrior
Posts: 8735
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Famitracker: DPCM Loop Problem

Post by rainwarrior »

dougeff wrote:Are these samples explicitly open-source / free to use?
lidnariq provided the script that generated them, so yes they're open source: viewtopic.php?p=154032#p154032

I don't think any license was explicitly stated but I suspect that it's not really possible to copyright a triangle wave anyway?

One thing you might try to take into account if trying to build a more practical version is that the samples have a volume that is kind of determined by the divisor of its sample period, so the volumes are very mismatched between different samples. (The timbre varies too.)
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: Famitracker: DPCM Loop Problem

Post by lidnariq »

1- I think they probably count as "math", so not copyrightable
2- If they are, I'm certain there's prior art to my instance
3- as far as I am concerned, they're public domain / CC-0 / WTFPL as you wish.


Different timbre? Oh, right, there's
A- weirdness with odd divisors (because ÷3 when quantized has to be 001101), but this gets more and more subtle the larger the divisor.
B- the stairstep harmonics because it's DPCM: The ÷2 case is necessarily just a square wave, and the larger the divisor the subtler the distortion and louder the triangle wave.
C- clipping with divisors larger than ÷62 124

edit:
rainwarrior wrote:Well, lidnariq's goal was to provide every possible usable sample that evenly divides the available sample lengths.
Where I chose "usable" to mean "within 7 cents of A440 12-TET". Some of the other divisors (e.g. ÷7, ÷11) just don't fit into 12-TET, but might fit into 17-, 19-, or 24-TET...

.. has anyone written chiptune music that uses these microtonal temperaments? I guess I just found Sevish, who's done a bunch of random things, including 10-TET FM and 13-TET PSG...
Last edited by lidnariq on Sun Jun 24, 2018 3:58 pm, edited 1 time in total.
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: Famitracker: DPCM Loop Problem

Post by lidnariq »

Apropos of
in this post, FrankenGraphics wrote:But it'll eventually be an easy check up if the tuning sounds too raunchy or not once i get back home in august. But i'm pretty sure i need to either use another of lidnariqs' samples for my B-2 that doesn't use sample rate $C as a divisor, or if it still would sound too raunchy on PAL, come up with separate instrument lists for PAL and NTSC.
it's trivial for me to generate a new table for 2A07 tuning, so here's the perl, HTML table, dmc files, and the DPCM import script (h/t rainwarrior for pointing that that could be a thing) for same.

There's a few differences, primarily:
* Rate #4 (÷276) is usually only useful for a single pitch, but there are a few divisors where rate #12 (÷98) is also in A440 12TET. (Unfortunately, rates #4 and #12 are an octave plus a tritone apart, 1793 cents)
* Rates #7, #8, #9, #11, and #15 are all about 6-8 cents more sharp. Rates #7 and #15 are mostly unaffected (being a little flat on 2A03), rate #11 is improved (being too flat on 2A03, so 2A07 in A440 12TET) but rates #8 and #9 are moved out of A440 12TET.
* Rate #14 is 23 cents more sharp. This causes more notes to be in A440 12TET, but they're not the same ones as in 2A03 tuning.

.... of course, I tried to run my generated DPCM import script and famitracker crashed.
Attachments
calculate-chip-dmc-triangle-waves-PAL-tuning.7z
To regenerate import.txt, concatenate "dpcmdef" then "keydpcm"
(10.19 KiB) Downloaded 408 times
Last edited by lidnariq on Sun Jun 24, 2018 1:21 pm, edited 1 time in total.
User avatar
rainwarrior
Posts: 8735
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Famitracker: DPCM Loop Problem

Post by rainwarrior »

lidnariq wrote:.... of course, I tried to run my generated DPCM import script and famitracker crashed.
I think there's a limit to how many notes you can stick in a single instrument, at least I ran into a crash when doing that earlier, which is why I split the instrument into 2 halves.
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: Famitracker: DPCM Loop Problem

Post by lidnariq »

I was trying to divide the instruments into ranges that covered overlapping groups of 2 octaves of divisor, to try to minimize volume and tone color changes within an instrument... but without even a message to start debugging what went wrong I'm kinda inclined to stop trying.
User avatar
FrankenGraphics
Formerly WheelInventor
Posts: 2064
Joined: Thu Apr 14, 2016 2:55 am
Location: Gothenburg, Sweden
Contact:

Re: Famitracker: DPCM Loop Problem

Post by FrankenGraphics »

Thanks, lindariq! That saves a lot of manual labor, again.

I wouldn't worry about the auto-import. It's not much of a job to hand pick some with those tables as a guide.


It looks like i may be able to make a fairly region-consistent version of the song without exploding the filesize too much. I estimate going from 132 to 626 bytes for all the divisor samples needed if the sound of it checks out fine, or if not, some more. As a bonus, the note range will be a bit more complete, perhaps for use in some other song.

I suppose keeping the size super small is a criteria that mostly applies to the scenario where music using .dmc:s is everywhere (since they'd then need to be accessed everywhere), but since i've isolated use of them to menus and perhaps story, i probably don't need to be that frugal.
User avatar
dougeff
Posts: 3079
Joined: Fri May 08, 2015 7:17 pm

Re: Famitracker: DPCM Loop Problem

Post by dougeff »

I figured out why my own attempt at a WAV to DMC converter never sounded very good. I misunderstood the order of the bits being read. For some reason, I thought it would read the highest bit first. Duh. Lowest bit first.

Visually, if something goes from on to off, it might look like

FF FF F0 00 00
but that's
\\ \\ /\ // //
so it should be like
FF FF 0F 00 00 to get
\\ \\ \/ // //

the hex looks wrong to me, because I misunderstood.


Anyway, I made some progress making some DMC triangle samples, but I'm working slowly on it.
nesdoug.com -- blog/tutorial on programming for the NES
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: Famitracker: DPCM Loop Problem

Post by lidnariq »

I had also written a program that used Bresenham's Line Algorithm / 1st order delta-sigma modulation to generate other (non-integer) divisors of the sample rate. It didn't sound good at all... basically any fractional part smaller than 1/2 produced a horrible spectral smear rather than something useful.
User avatar
dougeff
Posts: 3079
Joined: Fri May 08, 2015 7:17 pm

Re: Famitracker: DPCM Loop Problem

Post by dougeff »

Here's my attempt. 6 samples at different rates, makes triangle waves from c3-c5 (and f5). Total 1254 bytes. Some are slightly off tune.

http://dl.dropboxusercontent.com/s/f07v ... _test2.ftm

I didn't use an c5 sample, because it was too long, but if you did, you could then tune that one sample like this...

rate / freq / note
15 523 same c5
14 392 g4
13 335 e4
12 266 c4 octave down
11 221 a3
10 199 g3
9 177 f3
8 148 d3
7 132 c3 2 octaves down
6 125 b3
5 111 a3
4 99 g2
3 88 f2
...didn't test 2-0

(I also wrote a bad python script to produce these dmc files)
nesdoug.com -- blog/tutorial on programming for the NES
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: Famitracker: DPCM Loop Problem

Post by lidnariq »

Just for reference, the loops dougeff generated were:
"a5" - divisor of 226/3, 75⅓
"as5" - divisor of 1928/27, approximately 71.4
"b5" - divisor of 1544/23, approximately 67.1
"f5" - divisor of 900/19, approximately 47.4
"g4" - divisor of 84. Not clear why there's phase shift here; there's a very gradual accumulation of DC shift (two counts per loop)
"gs4" - divisor of 1672/21, approximately 79.6

Also, my tables indicate that a period 84 divisor should generate tones that about 25 cents sharp (relative to A440 12TET)...

If you listen to "a5.dmc", you can easily hear the kind of (unwanted-by-me) subharmonics that led me to discard this approach... of course, people with more musical experience might find those fun or useful.
User avatar
dougeff
Posts: 3079
Joined: Fri May 08, 2015 7:17 pm

Re: Famitracker: DPCM Loop Problem

Post by dougeff »

about 25 cents sharp


Yes, I chose some slightly off-tune frequencies for some of these, to produce a cleaner cut-off point, and reduce unwanted loop sounds.

These could be redone, but I suspect they will have longer DMC files.
nesdoug.com -- blog/tutorial on programming for the NES
Post Reply