Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
Torchaudio
Commits
f80d6e37
Commit
f80d6e37
authored
Jun 12, 2017
by
David Pollack
Committed by
Adam Paszke
Jun 12, 2017
Browse files
bytes function requires type
parent
2936245a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
torchaudio/__init__.py
torchaudio/__init__.py
+2
-2
No files found.
torchaudio/__init__.py
View file @
f80d6e37
...
@@ -23,7 +23,7 @@ def load(filename, out=None):
...
@@ -23,7 +23,7 @@ def load(filename, out=None):
typename
=
type
(
out
).
__name__
.
replace
(
'Tensor'
,
''
)
typename
=
type
(
out
).
__name__
.
replace
(
'Tensor'
,
''
)
func
=
getattr
(
th_sox
,
'libthsox_{}_read_audio_file'
.
format
(
typename
))
func
=
getattr
(
th_sox
,
'libthsox_{}_read_audio_file'
.
format
(
typename
))
sample_rate_p
=
ffi
.
new
(
'int*'
)
sample_rate_p
=
ffi
.
new
(
'int*'
)
func
(
bytes
(
filename
),
out
,
sample_rate_p
)
func
(
bytes
(
filename
,
"ascii"
),
out
,
sample_rate_p
)
sample_rate
=
sample_rate_p
[
0
]
sample_rate
=
sample_rate_p
[
0
]
return
out
,
sample_rate
return
out
,
sample_rate
...
@@ -37,4 +37,4 @@ def save(filepath, src, sample_rate):
...
@@ -37,4 +37,4 @@ def save(filepath, src, sample_rate):
typename
=
type
(
src
).
__name__
.
replace
(
'Tensor'
,
''
)
typename
=
type
(
src
).
__name__
.
replace
(
'Tensor'
,
''
)
func
=
getattr
(
th_sox
,
'libthsox_{}_write_audio_file'
.
format
(
typename
))
func
=
getattr
(
th_sox
,
'libthsox_{}_write_audio_file'
.
format
(
typename
))
func
(
bytes
(
filepath
),
src
,
extension
[
1
:],
sample_rate
)
func
(
bytes
(
filepath
,
"ascii"
),
src
,
extension
[
1
:],
sample_rate
)
Write
Preview
Markdown
is supported
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