Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
VisualDL
提交
7633c5a5
V
VisualDL
项目概览
PaddlePaddle
/
VisualDL
大约 1 年 前同步成功
通知
88
Star
4655
Fork
642
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
5
Wiki
分析
仓库
DevOps
项目成员
Pages
V
VisualDL
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
5
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
7633c5a5
编写于
8月 03, 2020
作者:
走神的阿圆
提交者:
GitHub
8月 03, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add audio demo (#715)
上级
e223017d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
49 addition
and
1 deletion
+49
-1
demo/components/audio_test.py
demo/components/audio_test.py
+48
-0
demo/components/test.wav
demo/components/test.wav
+0
-0
visualdl/server/data_manager.py
visualdl/server/data_manager.py
+1
-1
未找到文件。
demo/components/audio_test.py
0 → 100644
浏览文件 @
7633c5a5
# Copyright (c) 2020 VisualDL Authors. All Rights Reserve.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# =======================================================================
# coding=utf-8
from
visualdl
import
LogWriter
import
numpy
as
np
import
wave
def
read_audio_data
(
audio_path
):
"""
Get audio data.
"""
CHUNK
=
4096
f
=
wave
.
open
(
audio_path
,
"rb"
)
rate
=
f
.
getframerate
()
width
=
f
.
getsampwidth
()
channel
=
f
.
getnchannels
()
wavdata
=
[]
chunk
=
f
.
readframes
(
CHUNK
)
while
chunk
:
data
=
np
.
frombuffer
(
chunk
,
dtype
=
'uint8'
)
wavdata
.
extend
(
data
)
chunk
=
f
.
readframes
(
CHUNK
)
shape
=
[
rate
,
width
,
channel
]
return
shape
,
wavdata
if
__name__
==
'__main__'
:
with
LogWriter
(
logdir
=
"vdl_audio_0713"
)
as
writer
:
audio_shape
,
audio_data
=
read_audio_data
(
"./test.wav"
)
audio_data
=
np
.
array
(
audio_data
)
writer
.
add_audio
(
tag
=
"audio_tag"
,
audio_array
=
audio_data
,
step
=
0
,
sample_rate
=
audio_shape
[
0
])
demo/components/test.wav
0 → 100644
浏览文件 @
7633c5a5
文件已添加
visualdl/server/data_manager.py
浏览文件 @
7633c5a5
...
...
@@ -19,7 +19,7 @@ import random
import
collections
DEFAULT_PLUGIN_MAXSIZE
=
{
"scalar"
:
3
00
,
"scalar"
:
10
00
,
"image"
:
10
,
"histogram"
:
100
,
"embeddings"
:
50000
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录