Create sound of specific pitch

Blitz3D Forums/Blitz3D Beginners Area/Create sound of specific pitch

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Not through blitz as far as I'm aware. You could create a nice simple wav of a sine wave a a specific pitch.

I was doing something like this with a tracker I was writing for blitz... this code might help:
.frequencies
;      C     C#   D    D#     E     F    F#      G    G#     A     A#     B
Data 065.4,069.3,073.4,077.8,082.4,087.3,092.5,098.0,103.8,110.0,116.5,123.5
Data 130.8,138.6,146.8,155.6,164.8,174.6,185.0,196.0,207.7,220.0,233.1,246.9
Data 261.6,277.2,293.7,311.1,329.6,349.2,370.0,392.0,415.3,440.0,466.2,493.9
Data 523.3,554.4,587.3,622.3,659.3,698.5,740.0,784.0,830.6,880.0,932.3,987.8

;root note is 34 - A2

; notes go from C0 to B7

Restore frequencies
Dim frequency#(95)
For n=0 To 47
Read freq#
frequency(n)=freq/440
frequency(n+48)=(freq*16)/440
Next


This will leave you with a multiplier for your frequencies depending on what note you want to play. The root note being A2 (note 34) which would give you a multiplier of 1.