Discussion:
Hask Source: 28s at 58kbps
(too old to reply)
Bohgosity BumaskiL
2011-09-29 06:47:17 UTC
Permalink
' This is source for the new background sound at:
' http://ecn.ab.ca/~brewhaha/Sound/Just_Intonation.htm
' It is also a demonstration of numbers in that document.

' Source is for your perusal, and if you corrupt it enough, use.
' -CC- Released in a creative commons.
' -BY- http://ecn.ab.ca/~brewhaha/ BrewJay's Babble Bin
' -NC- No fees above internet cost may be taken for this.
' -ND- Use in video or on web pages requires permission.
' Recordings are mine. Performance is not.

' Parallel (Timbre) Harmonics:
DATA 3,7,8,5

' Pitch, Length, Glide Fraction;
' Ratio names are between notes.

DATA 0, 1, 0
DATA 360, 3, 0
DATA 0, 1, 0
' Major Sixth
DATA 600, 2, 0
' Minor Second
DATA 540, 4, 0
' Minor Second
DATA 600, 4, 0
DATA 0, 4, 0

' Unison
DATA 600, 3, 0
DATA 0, 1, 0
' Minor Second
DATA 540, 2, 0
' Major Second
DATA 480, 4, 0
' Major Second
DATA 540, 4, 0
DATA 0, 4, 0

' Minor Second
DATA 600, 3, 0
DATA 0, 1, 0
' Minor Second
DATA 540, 2, 0
' Major Second
DATA 480, 4, 0
' Major Second
DATA 540, 2, 8
' Perfect Fourth
DATA 0, 1, 0
DATA 720, 6, 0
' Perfect Fifth
DATA 480, 4, 0
DATA 0, 4, 0

' Minor Sixth
DATA 320, 3, 0
DATA 0, 1, 0
' Pythagorean Major Sixth
DATA 540, 2, 0
' Major Second
DATA 480, 4, 0
' Major Second
DATA 540, 4, 0
DATA 0, 4, 0

' Unison
DATA 540, 3, 0
DATA 0, 1, 0
' Major Second
DATA 480, 2, 0
' Minor Second
DATA 432, 4, 0
' Minor Second
DATA 480, 4, 0
DATA 0, 4, 0

' Major Second
DATA 540, 3, 0
DATA 0, 1, 0
' Major Second
DATA 480, 2, 0
' Minor Second
DATA 432, 4, 0
' Minor Second
DATA 480, 2, 0
DATA 0, 1, 0
' Perfect Fourth
DATA 640, 6, 0
' Grave Fifth
DATA 432, 4, 0
DATA 0, 4, 0

' Perfect Fifth
DATA 288, 3, 0
DATA 0, 1, 0
' Perfect Fifth
DATA 432, 2, 0
' Minor Semitone
DATA 405, 4, 0
' Minor Semitone
DATA 432, 4, 0
DATA 0, 4, 0

' Unison
DATA 432, 3, 0
DATA 0, 1, 0
' Major Second
DATA 384, 2, 0
' Minor Semitone
DATA 360, 4, 0
' Minor Semitone
DATA 384, 4, 0
DATA 0, 4, 0

' Major Second
DATA 480, 3, 0
DATA 0, 1, 0
' Minor Second
DATA 432, 2, 0
' Major Second
DATA 384, 4, 0
' Major Second
DATA 480, 2, 0
' Minor Third
DATA 576, 4, 0
DATA 0, 1, 0
' Perfect Fifth
DATA 384, 4, 0
DATA 0, 1, 0
' Major Second
DATA 432, 6, 0
DATA 0, 6, 0

' Classic Augmented Fourth
DATA 600, 3, 0
DATA 0, 1, 0
' Minor Second
DATA 540, 2, 0
' Major Second
DATA 480, 4, 0
' Major Second
DATA 540, 2, 0
' Perfect Fourth
DATA 720, 4, 0
DATA 0, 2, 0
' Octave
DATA 360, 6, 0
DATA 0, 1, 0
' Perfect Fourth
DATA 480, 6, 0

' F# G G# A A# B C C# D D# E F
' 288 320
' 360,384,405,432,450,480, 500, 540, 576, 600, 640, 675
' 720,768,810,864,900,960,1000,1080,1152,1200,1280,1350

DATA 0,24, 0

' The rest of this message is public domain.

OPTION BASE 1
DIM harmonics(8) AS DOUBLE
DIM chanamp(2, 8) AS DOUBLE
DIM velocity(8) AS DOUBLE
DIM acceleration(8) AS DOUBLE
DIM Angle(8) AS DOUBLE
DIM Phase(8) AS DOUBLE
DIM TerminalAngle(8) AS DOUBLE
DIM DropAngle(8) AS DOUBLE
DIM PhaseDir(8) AS INTEGER
DIM BeatsPerSecond AS DOUBLE
DIM AmpLeft AS DOUBLE
DIM AmpRight AS DOUBLE
DIM temp AS DOUBLE
DIM TwoPi AS DOUBLE
DIM basis, note, length, glide AS SINGLE
DIM samplerate AS LONG
DIM amp AS LONG
DIM k, g, t, lastnote, samples, numharmonics AS INTEGER
DIM test AS STRING

test = "0"
numharmonics = 4
pi = 3.141592653589793#
TwoPi = pi * 2
samplerate = 44100
BeatsPerSecond = 9
lastnote = 0

' For this to work, fbc and waveedit must be in your path.
OPEN "\sox\hask.raw" FOR OUTPUT AS #2
OPEN "hask.bat" FOR OUTPUT AS #1
PRINT #1, "fbc -lang qb hask.bas"
PRINT #1, "hask.exe"
PRINT #1, "cd \sox"
PRINT #1, "sox -c 2 -r"; samplerate; " -sw hask.raw hask.wav stat"
PRINT #1, "WaveEdit.exe c:\sox\hask.wav"
PRINT #1, "cd \basic"
CLOSE #1

temp = 1 / numharmonics
' This pans harmonics in relation to one.
FOR k = 1 TO numharmonics
chanamp(1, k) = temp * k
chanamp(2, k) = 1 - temp * k
NEXT k

' This cuts amplitude in proportion to a harmonic.
FOR k = 1 TO numharmonics
READ harmonics(k)
chanamp(1, k) = (2 / harmonics(k) * 32767) * chanamp(1, k)
chanamp(2, k) = (2 / harmonics(k) * 32767) * chanamp(2, k)
harmonics(k) = harmonics(k) / 5
NEXT k

100
FOR g = 1 TO 77
READ note, length, glide
IF g > 0 THEN
' SOUND note, length * 2
END IF
IF test = "0" THEN
IF note = 0 AND lastnote = 0 THEN
samples = samplerate * length / BeatsPerSecond
GOSUB 300
GOTO 75
END IF
IF note = 0 AND lastnote <> 0 THEN
GOSUB 250
lastnote = note
samples = samplerate * length / BeatsPerSecond
GOSUB 300
GOTO 75
END IF
IF note <> 0 AND lastnote = 0 THEN
lastnote = note
samples = samplerate * length / BeatsPerSecond
GOSUB 275
GOTO 75
END IF
IF note <> 0 AND lastnote <> 0 THEN
IF glide > 0 THEN
samples = samplerate * length
samples = samples / BeatsPerSecond / glide
GOSUB 300
END IF
samples = samplerate * length / BeatsPerSecond
lastnote = note
GOSUB 300
GOTO 75
END IF
END IF
75 NEXT g

IF test = "1" THEN END

CLOSE #2
END

250
FOR k = 1 TO numharmonics
temp = Angle(k) / TwoPi
Angle(k) = (temp - FIX(temp)) * TwoPi
IF Angle(k) > pi * 3 / 2 THEN
TerminalAngle(k) = pi * 3.5
PhaseDir(k) = 2
DropAngle(k) = pi * 2.5
ELSEIF Angle(k) > pi / 2 THEN
TerminalAngle(k) = pi * 2.5
PhaseDir(k) = 1
DropAngle(k) = pi * 3 / 2
ELSE
TerminalAngle(k) = pi * 3 / 2
PhaseDir(k) = -1
DropAngle(k) = pi / 2
END IF
NEXT k

260
FOR k = 1 TO numharmonics
Phase(k) = SIN(Angle(k))
SELECT CASE PhaseDir(k)
CASE 2
IF Angle(k) >= DropAngle(k) THEN
Phase(k) = Phase(k) / 2 + .5
END IF
CASE 1
IF Angle(k) >= DropAngle(k) THEN
Phase(k) = Phase(k) / 2 - .5
END IF
CASE -1
IF Angle(k) >= DropAngle(k) THEN
Phase(k) = Phase(k) / 2 + .5
END IF
END SELECT
IF Angle(k) < TerminalAngle(k) THEN
Angle(k) = Angle(k) + velocity(k)
ELSE
Angle(k) = TerminalAngle(k)
END IF
NEXT k
GOSUB 400

FOR k = 1 TO numharmonics
IF Angle(k) < TerminalAngle(k) THEN GOTO 260
NEXT k
FOR k = 1 TO numharmonics
Angle(k) = Angle(k) - Angle(k)
NEXT k

RETURN

275
' This starts a wave from zero, using half the amplitude,
' a start from where sin(angle) = -1, and a bias of half.
' This cuts a leading click that I can hear on some equipment
' with some tunes.
FOR k = 1 TO numharmonics
velocity(k) = TwoPi * lastnote * harmonics(k) / samplerate
acceleration(k) = TwoPi * note * harmonics(k) / samplerate
acceleration(k) = (acceleration(k) - velocity(k)) / samples
PhaseDir(k) = 1
Angle(k) = 3 / 2 * pi
NEXT k

280
FOR k = 1 TO numharmonics
IF PhaseDir(k) = 1 THEN
Phase(k) = SIN(Angle(k)) / 2 + .5
ELSE
Phase(k) = SIN(Angle(k))
END IF
Angle(k) = Angle(k) + velocity(k)
velocity(k) = velocity(k) + acceleration(k)
NEXT k
samples = samples - 1
GOSUB 400

FOR k = 1 TO numharmonics
IF PhaseDir(k) = 1 THEN
Phase(k) = (Phase(k) - .5) * 2
END IF
IF Phase(k) > SIN(Angle(k)) THEN
PhaseDir(k) = -1
END IF
NEXT k

FOR k = 1 TO numharmonics
IF PhaseDir(k) = 1 GOTO 280
NEXT k

300
FOR k = 1 TO numharmonics
velocity(k) = TwoPi * lastnote * harmonics(k) / samplerate
acceleration(k) = TwoPi * note * harmonics(k) / samplerate
acceleration(k) = (acceleration(k) - velocity(k)) / samples
NEXT k

FOR t = 1 TO samples
FOR k = 1 TO numharmonics
velocity(k) = velocity(k) + acceleration(k)
Angle(k) = Angle(k) + velocity(k)
Phase(k) = SIN(Angle(k))
NEXT k
GOSUB 400
NEXT t
RETURN

400
AmpLeft = 0
FOR k = 1 TO numharmonics
AmpLeft = AmpLeft + Phase(k) * chanamp(1, k)
NEXT k
amp = CINT(AmpLeft)
PRINT #2, CHR$(amp AND 255);
PRINT #2, CHR$((amp AND 65280) / 256);

AmpRight = 0
FOR k = 1 TO numharmonics
AmpRight = AmpRight + Phase(k) * chanamp(2, k)
NEXT k
amp = CINT(AmpRight)
PRINT #2, CHR$(amp AND 255);
PRINT #2, CHR$((amp AND 65280) / 256);
RETURN
Jack Campin
2011-09-30 18:11:36 UTC
Permalink
Post by Bohgosity BumaskiL
' http://ecn.ab.ca/~brewhaha/Sound/Just_Intonation.htm
Do you seriously think anybody's reading that stuff, or is ever going to?

-----------------------------------------------------------------------------
e m a i l : j a c k @ c a m p i n . m e . u k
Jack Campin, 11 Third Street, Newtongrange, Midlothian EH22 4PU, Scotland
mobile 07800 739 557 <http://www.campin.me.uk> Twitter: JackCampin
CharlieC
2011-10-01 11:30:12 UTC
Permalink
i readxc this stuff.. you do to jack.
infact it is very usefull
and has a comical impact

not laughing at how long it takes to develop or write tho

charles
Bohgosity BumaskiL
2011-10-07 05:49:43 UTC
Permalink
Post by CharlieC
i readxc this stuff.. you do to jack.
infact it is very usefull
and has a comical impact
not laughing at how long it takes to develop or write tho
charles
As far as comedy is concerned, I usually start out with that
in my lyrics. I try not to detract from the comedy, anyway.

Most of my source does not change from version to version.
I hav a version that is designed for a lot of parts (usually
two parts to start with), and a version that is designed for
a lot of parallel (timbre) harmonics (with even, automatic
panning).

My notes, of course, change from version to version. After
refining it in my head for quite some time, I write them in
QBASIC's immediate mode, which does not support glides.
Refining timing and glides takes a few (perhaps ten) loops
through Nero WaveEdit. For that matter, in my last tune, my
last two notes needed to be longer, with longer pauses -- once
I decided how to filter it.

I did http://ecn.ab.ca/~brewhaha/Sound/septimal.mp3 in
something less than eight hours from inception to recording,
and I hav things other than music to do here, like attending
my cat, maintaining my aquarium, housework, graphics, and
preparing for choir. My cat does not demand as much attention
since I started feeding her turkey and giblets.

I am in something of a rut for envelopes (filters):
I apply pretty much the same process to different tunes
with different harmonics and they all sound quite different.

I recently posted a lot of older stuff at my playscreen account
into my podcast (HTML version, only, because iTunes does not
support playscreen). I might rework some of that stuff. My brain
has more notes and different rests in some of that older stuff.
It is in descending order of rating. I don't hav a rating system
on my podcast, so every other entry (at ecn) is in descending
order of date, or thereabouts. When I *know* it is trivial work
(like one gliding chord, or a scale), then I put it at the bottom.
_______
http://ecn.ab.ca/~brewhaha/Sound/
Bohgosity BumaskiL
2011-10-07 06:06:16 UTC
Permalink
Post by Jack Campin
Post by Bohgosity BumaskiL
' http://ecn.ab.ca/~brewhaha/Sound/Just_Intonation.htm
Do you seriously think anybody's reading that stuff, or is ever going to?
Even if nobody reads it, it is an archive for me,
and it might be around when my podcast is not.

I do my own micro-tonal analysis.
I could not write this: news:***@mid.individual.net
if I was not planning on showing you what I meant.
_______
Yoh mommuh so skinny she gotta run around in a shower to get wet.
Bohgosity BumaskiL
2011-10-07 11:58:09 UTC
Permalink
' This is source for the new background sound at:
' http://ecn.ab.ca/~brewhaha/Sound/Just_Intonation.htm
' It is also a demonstration of numbers in that document.

' I added one note to the end of my second batch of
' three phrases. My ears wanted it, and not because
' the note before it is a wolf note. I tried making
' 864 into a perfect fifth at 853; didn't work.

' I also adjusted my tonic to 12-TET,
' so that anybody could use this in person.

' That extra note puts a kink in this description:
' I wrote a phrase that starts out sounding major,
' and it ends with a minor ratio. Correspondingly, my next
' phrase, which sounds minor, ends with a major ratio. My
' third phrase ties my first two together. My next three
' phrases are in the same vein, and a lower key. My tune
' drops key three times with the same timing. My finale
' sounds minor, then major; ten phrases in all. My ending
' resembles phrase number nine.

' I do not write in chords: I write one part at a time.
' Any two tunes that carry the same beat can make harmony.
' The best ending for a duet is unison.

' I have not yet begun to procrastinate.

' Source is for your perusal, and if you corrupt it enough, use.
' -CC- Released in a creative commons.
' -BY- http://ecn.ab.ca/~brewhaha/ BrewJay's Babble Bin
' -NC- No fees above internet cost may be taken for this.
' -ND- Use in video or on web pages requires permission.
' Recordings are mine. Performance is not.

' Parallel (Timbre) Harmonics:
DATA 3,8,7,5

' Pitch, Length, Glide Fraction;
' Ratio names are between notes.

DATA 0, 1, 0
DATA 720, 3, 0
DATA 0, 1, 0
' Major Sixth
DATA 1200, 2, 0
' Minor Second
DATA 1280, 4, 0
' Minor Second
DATA 1200, 4, 0
DATA 0, 4, 0

' Unison
DATA 1200, 3, 0
DATA 0, 1, 0
' Minor Second
DATA 1280, 2, 0
' Major Second
DATA 960, 4, 0
' Major Second
DATA 1280, 4, 0
DATA 0, 4, 0

' Minor Second
DATA 1200, 3, 0
DATA 0, 1, 0
' Minor Second
DATA 1280, 2, 0
' Major Second
DATA 960, 4, 0
' Major Second
DATA 1280, 2, 0
' Perfect Fourth
DATA 0, 1, 0
DATA 1440, 6, 0
' Perfect Fifth
DATA 960, 4, 0
DATA 0, 4, 0

' Minor Sixth
DATA 640, 3, 0
DATA 0, 1, 0
' Pythagorean Major Sixth
DATA 1280, 2, 0
' Major Second
DATA 960, 4, 0
' Major Second
DATA 1280, 4, 0
DATA 0, 4, 0

' Unison
DATA 1280, 3, 0
DATA 0, 1, 0
' Major Second
DATA 960, 2, 0
' Minor Second
DATA 864, 4, 0
' Minor Second
DATA 960, 4, 0
DATA 0, 4, 0

' Major Second
DATA 1280, 3, 0
DATA 0, 1, 0
' Major Second
DATA 960, 2, 0
' Minor Second
DATA 864, 4, 0
' Minor Second
DATA 960, 4, 0
DATA 0, 1, 0
' Perfect Fourth
DATA 1280, 6, 0
' Grave Fifth
DATA 864, 6, 0
DATA 0, 2, 0
' Minor Semitone
DATA 810, 6, 0
DATA 0, 4, 0

' Perfect Fifth
DATA 576, 3, 0
DATA 0, 1, 0
' Perfect Fifth
DATA 864, 2, 0
' Minor Semitone
DATA 810, 4, 0
' Minor Semitone
DATA 864, 4, 0
DATA 0, 4, 0

' Unison
DATA 864, 3, 0
DATA 0, 1, 0
' Major Second
DATA 768, 2, 0
' Minor Semitone
DATA 720, 4, 0
' Minor Semitone
DATA 768, 4, 0
DATA 0, 4, 0

' Major Second
DATA 960, 3, 0
DATA 0, 1, 0
' Minor Second
DATA 864, 2, 0
' Major Second
DATA 768, 4, 0
' Major Second
DATA 960, 2, 0
' Minor Third
DATA 1152, 4, 0
DATA 0, 1, 0
' Perfect Fifth
DATA 768, 4, 0
DATA 0, 2, 0
' Major Second
DATA 864, 6, 0
DATA 0, 6, 0

' Classic Augmented Fourth
DATA 1200, 3, 0
DATA 0, 1, 0
' Minor Second
DATA 1080, 2, 0
' Major Second
DATA 960, 4, 0
' Major Second
DATA 1080, 2, 0
' Perfect Fourth
DATA 1440, 4, 0
DATA 0, 2, 0
' Octave
DATA 720, 6, 0
DATA 0, 1, 0
' Perfect Fourth
DATA 960, 6, 0

' F# G G# A A# B C C# D D# E F
' 360,384,405,432,450,480, 500, 540, 576, 600, 640, 675
' 720,768,810,864,900,960,1000,1080,1152,1200,1280,1350

DATA 0,24, 0

' The rest of this message is public domain.

OPTION BASE 1
DIM harmonics(8) AS DOUBLE
DIM chanamp(2, 8) AS DOUBLE
DIM velocity(8) AS DOUBLE
DIM acceleration(8) AS DOUBLE
DIM Angle(8) AS DOUBLE
DIM Phase(8) AS DOUBLE
DIM TerminalAngle(8) AS DOUBLE
DIM DropAngle(8) AS DOUBLE
DIM PhaseDir(8) AS INTEGER
DIM BeatsPerSecond AS DOUBLE
DIM AmpLeft AS DOUBLE
DIM AmpRight AS DOUBLE
DIM temp AS DOUBLE
DIM TwoPi AS DOUBLE
DIM basis, note, length, glide AS SINGLE
DIM samplerate AS LONG
DIM amp AS LONG
DIM k, g, t, LastNote, samples, NumHarmonics AS INTEGER
DIM test AS STRING

test = "0"
NumHarmonics = 4
pi = 3.141592653589793#
TwoPi = pi * 2
samplerate = 44100
BeatsPerSecond = 9
LastNote = 0

' For this to work, fbc and waveedit must be in your path.
OPEN "\sox\hask.raw" FOR OUTPUT AS #2
OPEN "hask.bat" FOR OUTPUT AS #1
PRINT #1, "fbc -lang qb hask.bas"
PRINT #1, "hask.exe"
PRINT #1, "cd \sox"
PRINT #1, "sox -c 2 -r"; samplerate; " -sw hask.raw hask.wav stat"
PRINT #1, "WaveEdit.exe c:\sox\hask.wav"
PRINT #1, "cd \basic"
CLOSE #1

temp = 1 / NumHarmonics
' This pans harmonics in relation to one.
FOR k = 1 TO NumHarmonics
chanamp(1, k) = temp * k
chanamp(2, k) = 1 - temp * k
NEXT k

FOR k = 1 TO NumHarmonics
READ harmonics(k)
chanamp(1, k) = harmonics(k) / 16 * 32767 * chanamp(1, k)
chanamp(2, k) = harmonics(k) / 16 * 32767 * chanamp(2, k)
NEXT k

' This maps 720 (tonic) to a 12-TET F#.
harmonics(1) = (440 / 2 ^ (27 / 12)) / 720
harmonics(2) = harmonics(1) * 8 / 3
harmonics(3) = harmonics(1) * 7 / 3
harmonics(4) = harmonics(1) * 5 / 3

100
FOR g = 1 TO 79
READ note, length, glide
IF g > 0 THEN
' SOUND note / 3, length * 2
END IF
IF test = "0" THEN
IF note = 0 AND LastNote = 0 THEN
samples = samplerate * length / BeatsPerSecond
GOSUB 300
GOTO 75
END IF
IF note = 0 AND LastNote <> 0 THEN
GOSUB 250
LastNote = note
samples = samplerate * length / BeatsPerSecond
GOSUB 300
GOTO 75
END IF
IF note <> 0 AND LastNote = 0 THEN
LastNote = note
samples = samplerate * length / BeatsPerSecond
GOSUB 275
GOTO 75
END IF
IF note <> 0 AND LastNote <> 0 THEN
IF glide > 0 THEN
samples = samplerate * length
samples = samples / BeatsPerSecond / glide
GOSUB 300
END IF
samples = samplerate * length / BeatsPerSecond
LastNote = note
GOSUB 300
GOTO 75
END IF
END IF
75 NEXT g

IF test = "1" THEN END

CLOSE #2
END

250
FOR k = 1 TO NumHarmonics
temp = Angle(k) / TwoPi
Angle(k) = (temp - FIX(temp)) * TwoPi
IF Angle(k) > pi * 3 / 2 THEN
TerminalAngle(k) = pi * 3.5
PhaseDir(k) = 2
DropAngle(k) = pi * 2.5
ELSEIF Angle(k) > pi / 2 THEN
TerminalAngle(k) = pi * 2.5
PhaseDir(k) = 1
DropAngle(k) = pi * 3 / 2
ELSE
TerminalAngle(k) = pi * 3 / 2
PhaseDir(k) = -1
DropAngle(k) = pi / 2
END IF
NEXT k

260
FOR k = 1 TO NumHarmonics
Phase(k) = SIN(Angle(k))
SELECT CASE PhaseDir(k)
CASE 2
IF Angle(k) >= DropAngle(k) THEN
Phase(k) = Phase(k) / 2 + .5
END IF
CASE 1
IF Angle(k) >= DropAngle(k) THEN
Phase(k) = Phase(k) / 2 - .5
END IF
CASE -1
IF Angle(k) >= DropAngle(k) THEN
Phase(k) = Phase(k) / 2 + .5
END IF
END SELECT
IF Angle(k) < TerminalAngle(k) THEN
Angle(k) = Angle(k) + velocity(k)
ELSE
Angle(k) = TerminalAngle(k)
END IF
NEXT k
GOSUB 400

FOR k = 1 TO NumHarmonics
IF Angle(k) < TerminalAngle(k) THEN GOTO 260
NEXT k
FOR k = 1 TO NumHarmonics
Angle(k) = Angle(k) - Angle(k)
NEXT k

RETURN

275
' This starts a wave from zero, using half the amplitude, a start
' from where sin(angle) = -1, and a bias of half. This cuts
' a leading click that I can hear on some equipment with some tunes.
FOR k = 1 TO NumHarmonics
velocity(k) = TwoPi * LastNote * harmonics(k) / samplerate
acceleration(k) = TwoPi * note * harmonics(k) / samplerate
acceleration(k) = (acceleration(k) - velocity(k)) / samples
PhaseDir(k) = 1
Angle(k) = 3 / 2 * pi
NEXT k

280
FOR k = 1 TO NumHarmonics
IF PhaseDir(k) = 1 THEN
Phase(k) = SIN(Angle(k)) / 2 + .5
ELSE
Phase(k) = SIN(Angle(k))
END IF
Angle(k) = Angle(k) + velocity(k)
velocity(k) = velocity(k) + acceleration(k)
NEXT k
samples = samples - 1
GOSUB 400

FOR k = 1 TO NumHarmonics
IF PhaseDir(k) = 1 THEN
Phase(k) = (Phase(k) - .5) * 2
END IF
IF Phase(k) > SIN(Angle(k)) THEN
PhaseDir(k) = -1
END IF
NEXT k

FOR k = 1 TO NumHarmonics
IF PhaseDir(k) = 1 GOTO 280
NEXT k

300
FOR k = 1 TO NumHarmonics
velocity(k) = TwoPi * LastNote * harmonics(k) / samplerate
acceleration(k) = TwoPi * note * harmonics(k) / samplerate
acceleration(k) = (acceleration(k) - velocity(k)) / samples
NEXT k

FOR t = 1 TO samples
FOR k = 1 TO NumHarmonics
velocity(k) = velocity(k) + acceleration(k)
Angle(k) = Angle(k) + velocity(k)
Phase(k) = SIN(Angle(k))
NEXT k
GOSUB 400
NEXT t
RETURN

400
AmpLeft = 0
FOR k = 1 TO NumHarmonics
AmpLeft = AmpLeft + Phase(k) * chanamp(1, k)
NEXT k
amp = CINT(AmpLeft)
PRINT #2, CHR$(amp AND 255);
PRINT #2, CHR$((amp AND 65280) / 256);

AmpRight = 0
FOR k = 1 TO NumHarmonics
AmpRight = AmpRight + Phase(k) * chanamp(2, k)
NEXT k
amp = CINT(AmpRight)
PRINT #2, CHR$(amp AND 255);
PRINT #2, CHR$((amp AND 65280) / 256);
RETURN
Bohgosity BumaskiL
2011-10-07 14:59:21 UTC
Permalink
Somehow, I got 640=540 == Minor Second (10:9).
64:54 = 32:27, though, and that's a Pythagorean minor third.
There are *many* errors in my names.
Looks like I should've been using a calculator that day.
_______
Zen Buddhist ordering a hot dog: "Make me ONE with everything".

Loading...