I grabbed the code from another thread:
It is kinda cool...
But I need to save a sound, about maybe 3 seconds to a .wav file.
Any Ideas?
Import axe.portaudio Global astream:Byte Ptr ''''''''''''''''''''''''' stuff missing from port audio Extern Function Pa_GetDefaultOutputDeviceID:Int() EndExtern Const paInt8 :Int=32 Const paUInt8 :Int=64 Const paInt16 :Int=2 '''''''''''''''''''''''''' end of missing stuff Graphics 640,480 Global buf:Float[256] error( Pa_Initialize() ,"init") ' set the mix buffer running.... playstreamPA(astream,myCallback) While Not KeyDown(key_escape) Cls For Local n:Int=0 To 255 DrawLine 320,n+100,320+buf[n],n+100 Next Flip Wend Pa_CloseStream(astream) End Function myCallback:Int( inputBuffer:Float Ptr, outputBuffer:Short Ptr,.. framesPerBuffer:Int,outTime:Double, userData:Byte Ptr ) For Local n:Int=0 To 255 buf[n]=inputBuffer[0]*128 inputbuffer:+1 Next EndFunction Function error(e:Int,s:String) If e=0 Then Return Pa_Terminate() Print "error "+e+" in "+s Print "message "+String.FromCString(Pa_GetErrorText(e)) End EndFunction Function playstreamPA(stream:Byte Ptr Var,callback:Byte Ptr) error(.. Pa_OpenStream( Varptr stream,Pa_GetDefaultOutputDeviceID(),2,paFloat32,Null,.. paNoDevice,0,paInt8,Null,44100,256,0,paClipOff,.. Callback,Null ).. ,"open stream") error( Pa_StartStream( stream ),"start stream" ) Print "playing" EndFunction
It is kinda cool...
But I need to save a sound, about maybe 3 seconds to a .wav file.
Any Ideas?