#pragma rtGlobals=3 // Use modern global access method. Macro MakeMovie(nframes,fRate,wAudio) Variable nframes=NumVarOrDefault("gnframes",10) Variable fRate=NumVarOrDefault("gwFPS",30) Variable wAudio=NumVarOrDefault("gwAudio",2) Prompt nframes,"Number of movie frames" Prompt fRate,"Frame rate" Prompt wAudio,"Sound:",popup "Off;On" Variable/G gnframes= nframes Variable/G gwFPS= fRate Variable/G gwAudio= wAudio DoMakeMovie(nframes,gwFPS,wAudio-1) end // returns error flag Function ValidatePath() PathInfo moviesPath if( V_Flag==0 ) NewPath/Q moviesPath, SpecialDirPath("Igor Pro User Files", 0, 0, 0 ) if( V_Flag != 0 ) return 1 // abort or failure endif endif return 0 End Function DoMakeMovie(nframes,fRate,wAudio) Variable nframes,fRate,wAudio wave scar Execute/Q "SetIgorOption VerboseMode=2" newpath/o IgorSpace, "F:" ValidatePath() String fName= "sampleMovie" String fExtension= ".mp4" Variable isMac= CmpStr(IgorInfo(2),"Macintosh") == 0 Make/O/W/N=( 963332/fRate,2) yuanAudio SetScale/P x,0,20/ 963332,"s" yuanAudio variable i=0 do int a=mod(i,4) string nextImage = "pict"+num2str(a+1)+".bmp" imageload /O/P=IgorSpace /T=bmp nextimage duplicate/o $nextimage,w redimension/n=(259,183,-1) w newimage /n=season/s=0 w if(i==0) if( wAudio) fName += "Audio" NewMovie/Z/O/F=(fRate)/P=moviesPath/S=yuanAudio as fName+fExtension else NewMovie/Z/O/F=(fRate)/P=moviesPath as fName+fExtension endif if( V_Flag!=0 ) Print "OpenMovie failed, err= ",V_Flag return 0 // probably canceled endif endif doupdate AddMovieFrame killwindow season killwaves $nextimage if( V_Flag!=0 ) Print "Add movie frame failed, err= ",V_Flag,", frame ",i if( isMac && wAudio ) Print "Specifing sound may not work on Mac" endif break endif i += 1 while(i