sample to picture

Find quick help here to get you started with Hollywood
Post Reply
sinisrus
Posts: 347
Joined: Tue Apr 21, 2015 5:43 pm

sample to picture

Post 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?
User avatar
lazi
Posts: 625
Joined: Thu Feb 24, 2011 11:08 pm

Re: sample to picture

Post 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
sinisrus
Posts: 347
Joined: Tue Apr 21, 2015 5:43 pm

Re: sample to picture

Post by sinisrus »

Lazi very Thank you!!! :-)
sinisrus
Posts: 347
Joined: Tue Apr 21, 2015 5:43 pm

Re: sample to picture

Post by sinisrus »

Lazi

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

thank you
User avatar
lazi
Posts: 625
Joined: Thu Feb 24, 2011 11:08 pm

Re: sample to picture

Post 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! ;)
sinisrus
Posts: 347
Joined: Tue Apr 21, 2015 5:43 pm

Re: sample to picture

Post by sinisrus »

ok thank you for your help :-)
Post Reply