Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SpeechDatasets.jl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PTAL
Datasets
SpeechDatasets.jl
Commits
2142f5d1
Verified
Commit
2142f5d1
authored
1 year ago
by
Lucas Ondel Yang
Browse files
Options
Downloads
Patches
Plain Diff
load from audio source
parent
fe26b226
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
CHANGELOG.md
+5
-0
5 additions, 0 deletions
CHANGELOG.md
Project.toml
+1
-1
1 addition, 1 deletion
Project.toml
src/manifest_io.jl
+1
-1
1 addition, 1 deletion
src/manifest_io.jl
src/manifest_item.jl
+7
-7
7 additions, 7 deletions
src/manifest_item.jl
with
14 additions
and
9 deletions
CHANGELOG.md
+
5
−
0
View file @
2142f5d1
# Tags
## [0.5.0](https://https://gitlab.lisn.upsaclay.fr/fast/speechcorpora.jl/-/tags/v0.5.0)- 25/09/2023
## Added
-
can load the data directly from an audio source with the
`load`
function.
## [0.4.1](https://https://gitlab.lisn.upsaclay.fr/fast/speechcorpora.jl/-/tags/v0.4.1)- 25/09/2023
## Added
*
HTML display of AudioSource rather than recording
...
...
This diff is collapsed.
Click to expand it.
Project.toml
+
1
−
1
View file @
2142f5d1
name
=
"SpeechCorpora"
uuid
=
"3225a15e-d855-4a07-9546-2418058331ae"
authors
=
[
"Lucas ONDEL YANG <lucas.ondel@cnrs.fr>"
]
version
=
"0.
4.1
"
version
=
"0.
5.0
"
[deps]
Base64
=
"2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
...
...
This diff is collapsed.
Click to expand it.
src/manifest_io.jl
+
1
−
1
View file @
2142f5d1
...
...
@@ -7,7 +7,7 @@ function Base.show(io::IO, ::MIME"text/html", r::AbstractAudioSource)
print
(
io
,
"<audio controls "
)
print
(
io
,
"src=
\"
data:audio/wav;base64,"
)
x
,
s
,
_
=
load
source
(
r
,
:
)
x
,
s
=
load
(
r
)
iob64_encode
=
Base64EncodePipe
(
io
)
wavwrite
(
x
,
iob64_encode
,
Fs
=
s
,
nbits
=
8
,
compression
=
WAV
.
WAVE_FORMAT_PCM
)
close
(
iob64_encode
)
...
...
This diff is collapsed.
Click to expand it.
src/manifest_item.jl
+
7
−
7
View file @
2142f5d1
...
...
@@ -8,9 +8,9 @@ Base class for all audio source. Possible audio sources are:
* `URLAudioSource`
* `CmdAudioSource`
You can load the data of an audio source with the
internal
function
You can load the data of an audio source with the function
load
soce
(s::AbstractAudioSource, subrange)
load(s::AbstractAudioSource, subrange
= :
)
"""
abstract type
AbstractAudioSource
end
...
...
@@ -28,9 +28,9 @@ struct CmdAudioSource <: AbstractAudioSource
end
CmdAudioSource
(
c
::
String
)
=
CmdAudioSource
(
Cmd
(
String
.
(
split
(
c
))))
load
source
(
s
::
FileAudioSource
,
subrange
)
=
wavread
(
s
.
path
;
subrange
)
load
source
(
s
::
URLAudioSource
,
subrange
)
=
wavread
(
IOBuffer
(
HTTP
.
get
(
s
.
url
)
.
body
);
subrange
)
load
source
(
s
::
CmdAudioSource
,
subrange
)
=
wavread
(
IOBuffer
(
read
(
pipeline
(
s
.
cmd
)));
subrange
)
load
(
s
::
FileAudioSource
,
subrange
=
:
)
=
wavread
(
s
.
path
;
subrange
)
[
1
:
2
]
load
(
s
::
URLAudioSource
,
subrange
=
:
)
=
wavread
(
IOBuffer
(
HTTP
.
get
(
s
.
url
)
.
body
);
subrange
)
[
1
:
2
]
load
(
s
::
CmdAudioSource
,
subrange
=
:
)
=
wavread
(
IOBuffer
(
read
(
pipeline
(
s
.
cmd
)));
subrange
)
[
1
:
2
]
"""
abstract type ManifestItem end
...
...
@@ -71,7 +71,7 @@ end
function
Recording
(
uttid
,
s
::
AbstractAudioSource
;
channels
=
missing
,
samplerate
=
missing
)
if
ismissing
(
channels
)
||
ismissing
(
samplerate
)
x
,
sr
=
loads
ource
(
s
,
:
)
x
,
sr
=
load
(
s
)
samplerate
=
ismissing
(
samplerate
)
?
Int
(
sr
)
:
samplerate
channels
=
ismissing
(
channels
)
?
collect
(
1
:
size
(
x
,
2
))
:
channels
end
...
...
@@ -134,7 +134,7 @@ function load(r::Recording; start = -1, duration = -1, channels = r.channels)
subrange
=
(
:
)
end
x
,
sr
,
_
,
_
=
load
source
(
r
.
source
,
subrange
)
x
,
sr
=
load
(
r
.
source
,
subrange
)
x
[
:
,
channels
],
sr
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment