Category: Audio
Syntax:
audCreateStream:Int(rate:Int, channels:Int)
Int
Starts a stream of raw sound samples that the program supplies itself. Returns the stream's handle.
View detailed documentation online
Global buf:Short[4410]
Function Main()
Local s:Int = audCreateStream(44100, 2)
Local i:Int, v:Int, phase:Int
Local t0:Int = sysMillisecs()
While sysMillisecs() - t0 < 3000 ; 3 seconds of a 441 Hz square wave
If audStreamQueued(s) < 4410 Then
For i = 0 To 2204
v = ((phase / 50) Mod 2) * 8000 - 4000
buf[i * 2] = v ; left
buf[i * 2 + 1] = v ; right
phase = phase + 1
Next
audQueueStream(s, buf, 4410)
EndIf
Wend
audFreeStream(s)
Return False
EndFunction
BambooBasic © 2026 Michael Denathorn