Bug correction in sound4python when one doesn't have numpy installed
This commit is contained in:
parent
de7ae02da0
commit
5a4fe91ce1
@ -52,7 +52,12 @@ def sound(itr,samprate=16000,autoscale=True,output=False):
|
|||||||
wroteFrames=True
|
wroteFrames=True
|
||||||
if( not wroteFrames and not foundNumpy ):
|
if( not wroteFrames and not foundNumpy ):
|
||||||
#python w/o np doesn't have "short"/"int16", "@h" is "native,aligned short"
|
#python w/o np doesn't have "short"/"int16", "@h" is "native,aligned short"
|
||||||
waveWrite.writeframes( struct.pack(len(itr)*"@h",[int(mult*itm) for itm in itr]) )
|
# BAD : waveWrite.writeframes( struct.pack(len(itr)*"@h",[int(mult*itm) for itm in itr]) )
|
||||||
|
writeValues = []
|
||||||
|
for itm in itr:
|
||||||
|
packed_value = struct.pack('h', int(mult*itm))
|
||||||
|
waveWrite.writeframes(packed_value)
|
||||||
|
|
||||||
wroteFrames=True
|
wroteFrames=True
|
||||||
|
|
||||||
if( not wroteFrames ):
|
if( not wroteFrames ):
|
||||||
|
Loading…
Reference in New Issue
Block a user