Mod Archive Forums

Music Production => MilkyTracker => Tracking => MilkyTracker Tracks & Songs => Topic started by: necro2607 on March 05, 2008, 19:51:17

Title: ensuring proper "C-4" pitch of hand-drawn chip wave?
Post by: necro2607 on March 05, 2008, 19:51:17
Hey guys,

I had seen some of the tutorial vids on milkytracker download section, they are very useful, and great!   I didn't realize MT was as simple as that.   I used PlayerPRO years ago on my Mac, and all of a sudden everything came back.  Just a different GUI and shortcuts/keys/etc.  ;)

ANYWAYS,  Here's my concern.

In those tutorial vids, they show the user drawing by hand some simple waves with the sample editor.  One of them showed them doing a 40-sample length,  another did 100-sample length with the loop points kind of placed randomly.

Thing is, when you program those samples to play the note C-4,  it doesn't SOUND LIKE C-4.  It's not the correct pitch.   The note you actually hear is much different, potentially *not even a proper note*, but potentially halfway between two normal notes.

So,  is there any solution to this?   Is there a known proper sample-length that ensures any wave drawn within it is going to be looping at the proper speed to assure a truly correct C-4 pitch (which according to wikipedia should be 261.626 hz)?

I guess it's possible to calculate the exact perfect sample-length so that it loops at 261.626hz....   Will have to do some research here..
Title: Re: ensuring proper "C-4" pitch of hand-drawn chip wave?
Post by: raina on March 06, 2008, 14:00:47
Deltafire told me once 32 samples was the right length for a C-4 and I've been using 2^n sizes ever since. Dunno for sure if that's what you're looking for but it seems to match VST synths and so on. Also, using 2^n sizes for sample lengths as well as generator period numbers ensures smooth waveform loops.
Title: Re: ensuring proper "C-4" pitch of hand-drawn chip wave?
Post by: necro2607 on March 07, 2008, 03:16:20
I see.. just last night I had noticed that a repLength of 0x40 seemed to be the right frequency for a proper C-4 note, which is what, 64 decimal, right?   Interesting...  What do you mean n^2,  numbers that are always powers of 2?  except, that would be 2^n or something... I don't know... haha

Anyway, for anyone reading this now, if drawing a basic wave, you can make the repeat length at 0x40 (hex) or 64 (decimal), and you'll get a proper C-note pitch.  ;)
Title: Re: ensuring proper "C-4" pitch of hand-drawn chip wave?
Post by: raina on March 07, 2008, 09:21:43
Oops, brainfart. Yes 2^n, not n^2 (fixed the post). But there you go, 32 is half of 64 so our samples would be in tune, mine just 1 octave higher.
Title: Re: ensuring proper "C-4" pitch of hand-drawn chip wave?
Post by: urban soul on June 12, 2008, 15:15:38
If A-3 = 440 Hz, C-4 = 523,25 Hz. (This is 440 * pow 2\,3/12 )

You need 44100 Hz / 523,25 Hz = 84.280934 samples filled with a sine wave to sound exactly like C-4 on your keyboard.

The other way round:
44100 Hz / 32 samples = 1378.125 Hz (this is between E-5 and F-5)

Remember that the frequency depends on the spectrum you draw in the buffer.
Title: Re: ensuring proper "C-4" pitch of hand-drawn chip wave?
Post by: pailes on June 12, 2008, 17:54:42
But the base is normally not 44100Hz, for finetune 0 and relative note C-4 this is 8363Hz.
Title: Re: ensuring proper "C-4" pitch of hand-drawn chip wave?
Post by: Deltafire on June 12, 2008, 18:12:42
C-4 is in fact 261.63Hz.

8363Hz / 32 samples = 261.34375Hz 8)
Title: Re: ensuring proper "C-4" pitch of hand-drawn chip wave?
Post by: urban soul on June 12, 2008, 23:05:40
C-4 is in fact 261.63Hz.

8363Hz / 32 samples = 261.34375Hz

sorry for putting in the wrong numbers. (A-4 is actually 440 Hz, didn't recall correctly)

So, buffers a read at a virtual rate of 8363Hz in the sampler for transposition 0 ?
Ok.
Title: Re: ensuring proper "C-4" pitch of hand-drawn chip wave?
Post by: DasKreestof on December 14, 2009, 23:44:46
In the tutorial videos, where a sample is created with a 100 length, I'll bet that the 100 length is 100hex, which is 256 in decimal. 256 in decimal 2^8, 32 is 2^4, so the 32dec sample is 3 octaves away from the 256.

I have a made a spreadsheet of note frequency to various common sample speeds, and really no common sample speed will be a truly correct C when looping a single cycle. (at least not by my high school level math skills.)  It may be possible with fine tuning, but even without fine tuning, you can get very close to correct tunings. (I do not know what the math is for Milkytracker fine tuning, I don't know if it's a value of cents or...)
Remember that you don't need perfect tuning to make good music. It's helpful to have it reasonably close to perfect, but perfection can be an academic distraction from creativity.

The formula that I use to calculate note sample lengths is different than the one used by Urban Soul. The formula I use may be incorrect. Samples=8363/(POWER(2,X/12)*440) where X is the number of notes distance from A4, so for middle C the value of X is -9.


midi  octave note          Frequency       Number of samples at 8363
0     -1     C      -69    8.175798916     1022.896978
1     -1     C#     -68    8.661957218     965.4861816
2     -1     D      -67    9.177023997     911.2976061
3     -1     D#     -66    9.722718241     860.1504016
4     -1     E      -65    10.30086115     811.8738691
5     -1     F      -64    10.91338223     766.3068902
6     -1     F#     -63    11.56232571     723.2973893
7     -1     G      -62    12.24985737     682.7018262
8     -1     G#     -61    12.9782718      644.384717
9     -1     A      -60    13.75           608.2181818
10    -1     A#     -59    14.56761755     574.0815183
11    -1     B      -58    15.43385316     541.8607985
12     0     C      -57    16.35159783     511.4484888
13     0     C#     -56    17.32391444     482.7430908
14     0     D      -55    18.35404799     455.6488031
15     0     D#     -54    19.44543648     430.0752008
16     0     E      -53    20.60172231     405.9369346
17     0     F      -52    21.82676446     383.1534451
18     0     F#     -51    23.12465142     361.6486946
19     0     G      -50    24.49971475     341.3509131
20     0     G#     -49    25.9565436      322.1923585
21     0     A      -48    27.5            304.1090909
22     0     A#     -47    29.13523509     287.0407592
23     0     B      -46    30.86770633     270.9303993
24     1     C      -45    32.70319566     255.7242444
25     1     C#     -44    34.64782887     241.3715454
26     1     D      -43    36.70809599     227.8244015
27     1     D#     -42    38.89087297     215.0376004
28     1     E      -41    41.20344461     202.9684673
29     1     F      -40    43.65352893     191.5767226
30     1     F#     -39    46.24930284     180.8243473
31     1     G      -38    48.9994295      170.6754565
32     1     G#     -37    51.9130872      161.0961792
33     1     A      -36    55              152.0545455
34     1     A#     -35    58.27047019     143.5203796
35     1     B      -34    61.73541266     135.4651996
36     2     C      -33    65.40639133     127.8621222
37     2     C#     -32    69.29565774     120.6857727
38     2     D      -31    73.41619198     113.9122008
39     2     D#     -30    77.78174593     107.5188002
40     2     E      -29    82.40688923     101.4842336
41     2     F      -28    87.30705786     95.78836128
42     2     F#     -27    92.49860568     90.41217366
43     2     G      -26    97.998859       85.33772827
44     2     G#     -25    103.8261744     80.54808962
45     2     A      -24    110             76.02727273
46     2     A#     -23    116.5409404     71.76018979
47     2     B      -22    123.4708253     67.73259982
48     3     C      -21    130.8127827     63.9310611
49     3     C#     -20    138.5913155     60.34288635
50     3     D      -19    146.832384      56.95610038
51     3     D#     -18    155.5634919     53.7594001
52     3     E      -17    164.8137785     50.74211682
53     3     F      -16    174.6141157     47.89418064
54     3     F#     -15    184.9972114     45.20608683
55     3     G      -14    195.997718      42.66886414
56     3     G#     -13    207.6523488     40.27404481
57     3     A      -12    220             38.01363636
58     3     A#     -11    233.0818808     35.8800949
59     3     B      -10    246.9416506     33.86629991
60     4     C      -9     261.6255653     31.96553055
61     4     C#     -8     277.182631      30.17144318
62     4     D      -7     293.6647679     28.47805019
63     4     D#     -6     311.1269837     26.87970005
64     4     E      -5     329.6275569     25.37105841
65     4     F      -4     349.2282314     23.94709032
66     4     F#     -3     369.9944227     22.60304342
67     4     G      -2     391.995436      21.33443207
68     4     G#     -1     415.3046976     20.1370224
69     4     A       0     440             19.00681818
70     4     A#      1     466.1637615     17.94004745
71     4     B       2     493.8833013     16.93314995
72     5     C       3     523.2511306     15.98276527
73     5     C#      4     554.365262      15.08572159
74     5     D       5     587.3295358     14.2390251
75     5     D#      6     622.2539674     13.43985003
76     5     E       7     659.2551138     12.68552921
77     5     F       8     698.4564629     11.97354516
78     5     F#      9     739.9888454     11.30152171
79     5     G      10     783.990872      10.66721603
80     5     G#     11     830.6093952     10.0685112
81     5     A      12     880             9.503409091
82     5     A#     13     932.327523      8.970023724
83     5     B      14     987.7666025     8.466574977
84     6     C      15     1046.502261     7.991382637
85     6     C#     16     1108.730524     7.542860794
86     6     D      17     1174.659072     7.119512548
87     6     D#     18     1244.507935     6.719925013
88     6     E      19     1318.510228     6.342764603
89     6     F      20     1396.912926     5.98677258
90     6     F#     21     1479.977691     5.650760854
91     6     G      22     1567.981744     5.333608017
92     6     G#     23     1661.21879      5.034255601
93     6     A      24     1760            4.751704545
94     6     A#     25     1864.655046     4.485011862
95     6     B      26     1975.533205     4.233287489
96     7     C      27     2093.004522     3.995691319
97     7     C#     28     2217.461048     3.771430397
98     7     D      29     2349.318143     3.559756274
99     7     D#     30     2489.01587      3.359962506
100    7     E      31     2637.020455     3.171382301
101    7     F      32     2793.825851     2.99338629
102    7     F#     33     2959.955382     2.825380427
103    7     G      34     3135.963488     2.666804009
104    7     G#     35     3322.437581     2.517127801
105    7     A      36     3520            2.375852273
106    7     A#     37     3729.310092     2.242505931
107    7     B      38     3951.06641      2.116643744
108    8     C      39     4186.009045     1.997845659
109    8     C#     40     4434.922096     1.885715199
110    8     D      41     4698.636287     1.779878137
111    8     D#     42     4978.03174      1.679981253
112    8     E      43     5274.040911     1.585691151
113    8     F      44     5587.651703     1.496693145
114    8     F#     45     5919.910763     1.412690213
115    8     G      46     6271.926976     1.333402004
116    8     G#     47     6644.875161     1.2585639
117    8     A      48     7040            1.187926136
118    8     A#     49     7458.620184     1.121252965
119    8     B      50     7902.13282      1.058321872
120    9     C      51     8372.01809      0.99892283
121    9     C#     52     8869.844191     0.942857599
122    9     D      53     9397.272573     0.889939068
123    9     D#     54     9956.063479     0.839990627
124    9     E      55     10548.08182     0.792845575
125    9     F      56     11175.30341     0.748346572
126    9     F#     57     11839.82153     0.706345107
127    9     G      58     12543.85395     0.666701002


Note that the first two octaves listed are academic. Frequencies below 20 hertz cannot be heard or reproduced by most people/sound systems.  I theorize that Low Frequency Oscillations below 20hz are recognized as distinct separate audio events instead of as pitches by the brain.

If my mathematical formula or results are incorrect, please let me know. I do not possess graduate level mathematical skills nor advanced musical math knowledge.
Title: Re: ensuring proper "C-4" pitch of hand-drawn chip wave?
Post by: saxlovesnightlife on January 21, 2010, 20:16:41
tune here:

http://www.youtube.com/watch?v=OUvlamJN3nM (http://www.youtube.com/watch?v=OUvlamJN3nM)

the right choice for obtain an A (and then the other notes) is to use 64 samples.
so, 32 or 128 and so on will generate octaves from here...

byez, ::sax:::::
Title: Re: ensuring proper "C-4" pitch of hand-drawn chip wave?
Post by: Lenard on January 23, 2010, 22:21:53
I use 65.
Title: Re: ensuring proper "C-4" pitch of hand-drawn chip wave?
Post by: Khades on January 24, 2010, 18:41:30
who cares?
1 wave is enough

(no interpolation settings only)
Title: Re: ensuring proper "C-4" pitch of hand-drawn chip wave?
Post by: haschischtasche on March 13, 2010, 12:03:51
so hex 64 and hex c8 is the same note too, right? (decimal 100 and 200)

how much hz would that be?
Title: Re: ensuring proper "C-4" pitch of hand-drawn chip wave?
Post by: DasKreestof on May 07, 2010, 18:19:27
decimal 100 and 200 sample lengths would be octave 2 E and octave 1 E

midi  octave note          Frequency       Number of samples at 8363
28     1     E      -41    41.20344461     202.9684673
40     2     E      -29    82.40688923     101.4842336