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
d26e112d
Commit
d26e112d
authored
Aug 29, 2019
by
Fabrizio Milo
Committed by
Vincent QB
Aug 29, 2019
Browse files
add asound for linux. fix deprecated torch type. (#254)
* fix deprecated torch type. * don't link alsa on linux.
parent
17b54118
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
packaging/build_from_source.sh
packaging/build_from_source.sh
+1
-1
torchaudio/torch_sox.cpp
torchaudio/torch_sox.cpp
+3
-3
No files found.
packaging/build_from_source.sh
View file @
d26e112d
...
@@ -51,7 +51,7 @@ pushd sox-14.4.2
...
@@ -51,7 +51,7 @@ pushd sox-14.4.2
./configure
--disable-shared
--enable-static
--prefix
=
"
$PREFIX
/third_party/sox"
\
./configure
--disable-shared
--enable-static
--prefix
=
"
$PREFIX
/third_party/sox"
\
LDFLAGS
=
"-L
$PREFIX
/third_party/lame/lib -L
$PREFIX
/third_party/flac/lib -L
$PREFIX
/third_party/mad/lib"
\
LDFLAGS
=
"-L
$PREFIX
/third_party/lame/lib -L
$PREFIX
/third_party/flac/lib -L
$PREFIX
/third_party/mad/lib"
\
CPPFLAGS
=
"-I
$PREFIX
/third_party/lame/include -I
$PREFIX
/third_party/flac/include -I
$PREFIX
/third_party/mad/include"
\
CPPFLAGS
=
"-I
$PREFIX
/third_party/lame/include -I
$PREFIX
/third_party/flac/include -I
$PREFIX
/third_party/mad/include"
\
--with-lame
--with-flac
--with-mad
--without-coreaudio
--without-png
--without-oggvorbis
--without-oss
--without-sndfile
CFLAGS
=
-fPIC
CXXFLAGS
=
-fPIC
--with-pic
--disable-debug
--disable-dependency-tracking
--with-lame
--with-flac
--with-mad
--without-alsa
--without-coreaudio
--without-png
--without-oggvorbis
--without-oss
--without-sndfile
CFLAGS
=
-fPIC
CXXFLAGS
=
-fPIC
--with-pic
--disable-debug
--disable-dependency-tracking
make
-s
-j
&&
make
install
make
-s
-j
&&
make
install
popd
popd
...
...
torchaudio/torch_sox.cpp
View file @
d26e112d
...
@@ -36,7 +36,7 @@ struct SoxDescriptor {
...
@@ -36,7 +36,7 @@ struct SoxDescriptor {
int64_t
write_audio
(
SoxDescriptor
&
fd
,
at
::
Tensor
tensor
)
{
int64_t
write_audio
(
SoxDescriptor
&
fd
,
at
::
Tensor
tensor
)
{
std
::
vector
<
sox_sample_t
>
buffer
(
tensor
.
numel
());
std
::
vector
<
sox_sample_t
>
buffer
(
tensor
.
numel
());
AT_DISPATCH_ALL_TYPES
(
tensor
.
type
(),
"write_audio_buffer"
,
[
&
]
{
AT_DISPATCH_ALL_TYPES
(
tensor
.
scalar_
type
(),
"write_audio_buffer"
,
[
&
]
{
auto
*
data
=
tensor
.
data_ptr
<
scalar_t
>
();
auto
*
data
=
tensor
.
data_ptr
<
scalar_t
>
();
std
::
copy
(
data
,
data
+
tensor
.
numel
(),
buffer
.
begin
());
std
::
copy
(
data
,
data
+
tensor
.
numel
(),
buffer
.
begin
());
});
});
...
@@ -63,7 +63,7 @@ void read_audio(
...
@@ -63,7 +63,7 @@ void read_audio(
output
.
resize_
({
samples_read
/
number_of_channels
,
number_of_channels
});
output
.
resize_
({
samples_read
/
number_of_channels
,
number_of_channels
});
output
=
output
.
contiguous
();
output
=
output
.
contiguous
();
AT_DISPATCH_ALL_TYPES
(
output
.
type
(),
"read_audio_buffer"
,
[
&
]
{
AT_DISPATCH_ALL_TYPES
(
output
.
scalar_
type
(),
"read_audio_buffer"
,
[
&
]
{
auto
*
data
=
output
.
data_ptr
<
scalar_t
>
();
auto
*
data
=
output
.
data_ptr
<
scalar_t
>
();
std
::
copy
(
buffer
.
begin
(),
buffer
.
begin
()
+
samples_read
,
data
);
std
::
copy
(
buffer
.
begin
(),
buffer
.
begin
()
+
samples_read
,
data
);
});
});
...
@@ -369,7 +369,7 @@ int build_flow_effects(const std::string& file_name,
...
@@ -369,7 +369,7 @@ int build_flow_effects(const std::string& file_name,
std
::
vector
<
sox_sample_t
>
samples
(
buffer_size
);
std
::
vector
<
sox_sample_t
>
samples
(
buffer_size
);
const
int64_t
samples_read
=
sox_read
(
input
,
samples
.
data
(),
buffer_size
);
const
int64_t
samples_read
=
sox_read
(
input
,
samples
.
data
(),
buffer_size
);
assert
(
samples_read
!=
nc
*
ns
&&
samples_read
!=
0
);
assert
(
samples_read
!=
nc
*
ns
&&
samples_read
!=
0
);
AT_DISPATCH_ALL_TYPES
(
otensor
.
type
(),
"effects_buffer"
,
[
&
]
{
AT_DISPATCH_ALL_TYPES
(
otensor
.
scalar_
type
(),
"effects_buffer"
,
[
&
]
{
auto
*
data
=
otensor
.
data_ptr
<
scalar_t
>
();
auto
*
data
=
otensor
.
data_ptr
<
scalar_t
>
();
std
::
copy
(
samples
.
begin
(),
samples
.
begin
()
+
samples_read
,
data
);
std
::
copy
(
samples
.
begin
(),
samples
.
begin
()
+
samples_read
,
data
);
});
});
...
...
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