Public Streamer1 As AudioStreamer
Try
Streamer1.Initialize("streamer1", 4000, False, 16, Streamer1.VOLUME_MUSIC)
Streamer1.StartPlaying
Catch
Log(LastException)
End Try
Public Sub GenBB (DurationMs As Double, FreqLeft As Double, FreqRight As Double)
Dim Samples As Int = 4000 * 2 * DurationMs / 1000
Dim Tone(2 * Samples) As Byte
For i = 0 To Samples - 1 Step 2
Dim Sample1 As Double = Sin(1 * cPI * i / (4000 / FreqLeft))
Dim Left As Short =...
Dear kimstudio,Use AudioStreamer in Audio library you can generate the two signals and put in left/right channels in a stereo wave and play it.
I remeber there is a post on the forum exactly discussing about this but I forget the keyword for searching.
Public Streamer1 As AudioStreamer
Try
Streamer1.Initialize("streamer1", 4000, False, 16, Streamer1.VOLUME_MUSIC)
Streamer1.StartPlaying
Catch
Log(LastException)
End Try
Public Sub GenBB (DurationMs As Double, FreqLeft As Double, FreqRight As Double)
Dim Samples As Int = 4000 * 2 * DurationMs / 1000
Dim Tone(2 * Samples) As Byte
For i = 0 To Samples - 1 Step 2
Dim Sample1 As Double = Sin(1 * cPI * i / (4000 / FreqLeft))
Dim Left As Short = Sample1 * 32767
Dim Sample2 As Double = Sin(1 * cPI * i / (4000 / FreqRight))
Dim Right As Short = Sample2 * 32767
Tone(2 * i + 1) = Bit.UnsignedShiftRight(Bit.And(Left, 0xff00), 8)
Tone(2 * i + 3) = Bit.UnsignedShiftRight(Bit.And(Right, 0xff00), 8)
Next
Streamer1.Write(Tone)
End Sub
Starter.Streamer1.StartPlaying
Starter.GenBB(5000, 432, 436) 'Milliseconds, Left channel, Right channel:
Streamer1.StartPlaying
GenBB(5000, 432, 436) 'Milliseconds, Left channel, Right channel:
Starter.Streamer1.StopPlaying
Streamer1.StopPlaying