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
0c046675
"docs/source/training/text2image.mdx" did not exist on "7bd50cabafc60bf45ebbe1957b125d3f4c758ba8"
Unverified
Commit
0c046675
authored
May 14, 2020
by
Fangjun Kuang
Committed by
GitHub
May 13, 2020
Browse files
Remove multiple definitions of `SoxEffect`. (#635)
Fix #628
parent
3a4f3569
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
14 deletions
+16
-14
setup.py
setup.py
+1
-1
torchaudio/torch_sox.cpp
torchaudio/torch_sox.cpp
+3
-7
torchaudio/torch_sox.h
torchaudio/torch_sox.h
+12
-6
No files found.
setup.py
View file @
0c046675
...
...
@@ -88,7 +88,7 @@ else:
'_torch_sox'
,
[
'torchaudio/torch_sox.cpp'
],
libraries
=
libraries
,
include_dirs
=
include_dirs
,
include_dirs
=
include_dirs
+
[
cwd
]
,
extra_compile_args
=
eca
,
extra_objects
=
extra_objects
,
extra_link_args
=
ela
),
...
...
torchaudio/torch_sox.cpp
View file @
0c046675
#include <torchaudio/torch_sox.h>
#include <torch/extension.h>
#include <sox.h>
...
...
@@ -70,12 +72,6 @@ void read_audio(
}
}
// namespace
struct
SoxEffect
{
SoxEffect
()
:
ename
(
""
),
eopts
({
""
})
{
}
std
::
string
ename
;
std
::
vector
<
std
::
string
>
eopts
;
};
std
::
tuple
<
sox_signalinfo_t
,
sox_encodinginfo_t
>
get_info
(
const
std
::
string
&
file_name
)
{
...
...
@@ -195,7 +191,7 @@ void write_audio_file(
}
int
initialize_sox
()
{
/* Initializion for sox effects. Only initialize once */
/* Initializ
at
ion for sox effects. Only initialize once */
return
sox_init
();
}
...
...
torchaudio/torch_sox.h
View file @
0c046675
#include <sox.h>
#include <string>
#include <tuple>
#include <vector>
#include <torch/extension.h>
namespace
at
{
struct
Tensor
;
...
...
@@ -9,7 +15,7 @@ namespace torch { namespace audio {
/// Reads an audio file from the given `path` into the `output` `Tensor` and
/// returns the sample rate of the audio file.
/// Throws `std::runtime_error` if the audio file could not be opened, or an
/// error ocurred during reading of the audio data.
/// error oc
c
urred during reading of the audio data.
int
read_audio_file
(
const
std
::
string
&
file_name
,
at
::
Tensor
output
,
...
...
@@ -18,24 +24,24 @@ int read_audio_file(
int64_t
offset
,
sox_signalinfo_t
*
si
,
sox_encodinginfo_t
*
ei
,
const
char
*
ft
)
const
char
*
ft
)
;
/// Writes the data of a `Tensor` into an audio file at the given `path`, with
/// a certain extension (e.g. `wav`or `mp3`) and sample rate.
/// Throws `std::runtime_error` when the audio file could not be opened for
/// writing, or an error ocurred during writing of the audio data.
/// writing, or an error oc
c
urred during writing of the audio data.
void
write_audio_file
(
const
std
::
string
&
file_name
,
at
::
Tensor
&
tensor
,
const
at
::
Tensor
&
tensor
,
sox_signalinfo_t
*
si
,
sox_encodinginfo_t
*
ei
,
const
char
*
file_type
)
const
char
*
file_type
)
;
/// Reads an audio file from the given `path` and returns a tuple of
/// sox_signalinfo_t and sox_encodinginfo_t, which contain information about
/// the audio file such as sample rate, length, bit precision, encoding and more.
/// Throws `std::runtime_error` if the audio file could not be opened, or an
/// error ocurred during reading of the audio data.
/// error oc
c
urred during reading of the audio data.
std
::
tuple
<
sox_signalinfo_t
,
sox_encodinginfo_t
>
get_info
(
const
std
::
string
&
file_name
);
...
...
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