Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
hackEns
TouchlessTracking
Commits
5a4fe91c
Commit
5a4fe91c
authored
Dec 05, 2013
by
hackEns
Browse files
Bug correction in sound4python when one doesn't have numpy installed
parent
de7ae02d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Chorizo player/sound4python.py
View file @
5a4fe91c
...
...
@@ -52,7 +52,12 @@ def sound(itr,samprate=16000,autoscale=True,output=False):
wroteFrames
=
True
if
(
not
wroteFrames
and
not
foundNumpy
):
#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
if
(
not
wroteFrames
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment