Page 1 of 1
Adding Stereo output?
Posted: Sep 16th, '18, 21:25
by Calloway
Would it be possible to have stereo output in GP?
For example, the note block could extend to another input for left/right/center output and if none is detected default to center.
It's a small suggestion but it really can make a difference if people want to get creative with sounds.
Re: Adding Stereo output?
Posted: Feb 9th, '19, 12:56
by JohnM
Stereo is actually supported by the underlying system. Here's some help I got from the GP command line:
Code: Select all
gp> help openAudio
Open the audio output driver. The optional frameCount argument is the number of stereo or mono samples (frames) to buffer, a power of 2 between 256 and 8192. Output is mono unless optional stereoFlag argument is true. Arguments: [frameCount stereoFlag]
gp> help writeSamples
Write sound samples (an array of signed, 16-bit integers). If stereo, left and right channels are interleaved. Arguments: sampleArray
I haven't tried it, but I think if you manually open the driver in stereo mode then you *might* be able to use the "play samples" block to output a stereo buffer. If that doesn't work, you can use "write samples" directly, passing a "BinaryData" object to it with the left and right samples interleaved.
In short, stereo is possible, although it will require you to "roll your own" stereo sound output loop.
Re: Adding Stereo output?
Posted: Feb 9th, '19, 12:57
by JohnM
By the way, here are all the sounds "primitives".
Code: Select all
-- Sound --
openAudio
closeAudio
samplesNeeded
writeSamples
fft
generateNoteSamples
sendMIDI
startSpeech
stopSpeech
startAudioInput
stopAudioInput
readAudioInput
I got this list from the list of primitives you get from typing "help" at the GP command prompt.
Re: Adding Stereo output?
Posted: Feb 11th, '19, 01:36
by Calloway
Ah I see, so a psuedo-stereo solution would be possible.
I'll try working the kinks out somehow
What're the startSpeech and stopSpeech primitives used for?