Page 1 of 1

sample to picture

Posted: Sat Aug 27, 2016 1:49 pm
by sinisrus
Hello,
Is it possible to convert sample audio to picture? (For crear wavform)
I find algorithme lua for this, is it possible with Hollywood?

Re: sample to picture

Posted: Sat Aug 27, 2016 8:46 pm
by lazi

Code: Select all

LoadSample(1,"hollywood:Examples/Hollywood/Epiphany/bounce.wav")

Switch GetAttribute(#SAMPLE,1,#ATTRTYPE)
Case #MONO8:
	NPrint("MONO8")
Case #MONO16:
	NPrint("MONO16")
Case #STEREO8:
	NPrint("STEREO8")
Case #STEREO16:
	NPrint("STEREO16")
EndSwitch

NPrint("Duration:",GetAttribute(#SAMPLE,1,#ATTRDURATION),"ms")
NPrint("PCM Frames:",GetAttribute(#SAMPLE,1,#ATTRNUMFRAMES))

table,count=GetSampleData(1)

NPrint("Count:",count)

StartPath(1)
MoveTo(1,0,128)
For i=0 To 640
  LineTo(1,i,table[i])
Next

Line(0,250,640,250,#WHITE)
DrawPath(1,0,250,#RED)

WaitLeftMouse  
Image

Re: sample to picture

Posted: Sun Aug 28, 2016 12:15 am
by sinisrus
Lazi very Thank you!!! :-)

Re: sample to picture

Posted: Sun Aug 28, 2016 11:39 am
by sinisrus
Lazi

After test this algoritm no good work. Have you tested with other sample??

thank you

Re: sample to picture

Posted: Mon Aug 29, 2016 9:28 pm
by lazi
No, not tested with others.
This is a mono 8 bit sample and the script should be modified to handle other types.
You asked if is it possible, so I said with that script: yes, it is possible of course! ;)

Re: sample to picture

Posted: Tue Aug 30, 2016 11:43 pm
by sinisrus
ok thank you for your help :-)