Author Topic: Bad stereo with _SNDRAW  (Read 1182 times)

0 Members and 1 Guest are viewing this topic.

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
Bad stereo with _SNDRAW
« on: May 29, 2019, 01:47:41 pm »
Hi. Can anyone fix _SNDRAW? It appears that the right channel is added to the left though it should not, because it is separated by _SNDOPENRAW.
Just a little corrected code from the Wiki is enough to demonstrate a bad feature:
Original source use twice right channel.  Why?

Original code by Galleon:

a = _SNDOPENRAW
b = _SNDOPENRAW

FOR x = 1 TO 100000
    _SNDRAW SIN(x / 10), , a 'fill with a tone   
    _SNDRAW RND * 1 - 0.5, , b 'fill with static       as you can see, both _SNDRAW calls contains , , handle. So both are for right channel?
NEXT

_SNDCLOSE a
_SNDCLOSE b 


I think it should be this way:

a = _SNDOPENRAW
b = _SNDOPENRAW

FOR x = 1 TO 100000
    _SNDRAW SIN(x / 10) , a 'fill with a tone    '      so for left channel
    _SNDRAW RND * 1 - 0.5 , , b 'fill with static       and so for right channel?
NEXT

_SNDCLOSE a
_SNDCLOSE b 

However, I am unable to achieve a full stereo effect in either case. Although _SNDOPENRAW will ensure the correct sampling rate for both channels, they are not separated as I would expect and both sounds are played from both speakers (is not tone left and noise right).

In the past, I already have asked to this, I wonder if anyone has done any research in this regard. Thank you.