I don't see a reason why it shouldn't be possible.
For example you can create a pool byte array in your script and add the bytes that you generated manually to this buffer (make sure you're using the right format). Then simply set is as .data like I did in the original answer:
var Sample = AudioStreamSample.new()
Sample.data = YOUR_GENERATED_POOL_BYTE_ARRAY # unsafe?
Sample.format = AudioStreamSample.FORMAT_16_BITS
Sample.loop_mode = AudioStreamSample.LOOP_DISABLED
Sample.loop_begin = 0
Sample.loop_end = 0
Sample.mix_rate = 44100 # you can also use AudioServer.get_mix_rate() to get the sampling rate of the current device
Sample.stereo = false
Keep in mind that doing this in GDScript will be slower than doing it in GDNative.
Edit: If you're trying to generate fully procedual audio during playback it might not work very well.
You could try using Sample.data as a ring buffer (with looping enabled, obviously) and sample into it while playing but you'll have to make sure that it is synchronized properly. Also you might need to use multithreading to prevent framedrops while generating new audio.
Edit2: here's a quick and dirty example
func ShortToBytes(value): # value: 16 bit INTEGER! [0 - 65535]
var bytes = PoolByteArray()
var X = value / 255
bytes.append(value - X - 128) # are godot bytes signed or unsigned?
bytes.append(X - 128)
# generate data
var audio_buffer = PoolByteArray()
var samples_per_second = AudioServer.get_mix_rate()
var length = int(samples_per_second * 2.5) # length in number of samples (here 2.5 seconds)
for i in range(0, length): # for number of samples
var sample = int(sin(float(i) / samples_per_second * 440.0 * PI * 2.0) * 16000 + 16000) # generate a 440 Hz sine wave
# create sample from generated data
var sample = AudioStreamSample.new()
sample.data = audio_buffer
sample.format = AudioStreamSample.FORMAT_16_BITS
sample.loop_mode = AudioStreamSample.LOOP_DISABLED
sample.loop_begin = 0
sample.loop_end = 0
sample.mix_rate = samples_per_second
sample.stereo = false
# create audio stream player & play sample
var asp = AudioStreamPlayer.new()
asp.volume_db = -13.0 # don't blast your ears!
asp.stream = sample # set the sample as source
add_child(asp) # add stream player to the scene tree so the output is heard
It works but I'm not sure if the value mapping is correct. Using Godot for this kind of stuff doesn't feel very great, maybe in the future there will be more solid options for these kind of tasks.