Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
HighBlueParsers
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
Paul Best
HighBlueParsers
Commits
8606741d
Commit
8606741d
authored
2 years ago
by
Paul Best
Browse files
Options
Downloads
Plain Diff
Merge branch 'main' of
https://gitlab.lis-lab.fr/paul.best/HighBlueParsers
parents
82e43089
19384e04
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Rapport2wavs.py
+17
-18
17 additions, 18 deletions
Rapport2wavs.py
RapportInfo2txt
+0
-0
0 additions, 0 deletions
RapportInfo2txt
RapportInfo2txt.c
+4
-3
4 additions, 3 deletions
RapportInfo2txt.c
with
21 additions
and
21 deletions
Rapport2wavs.py
+
17
−
18
View file @
8606741d
...
@@ -6,11 +6,12 @@ parser = argparse.ArgumentParser()
...
@@ -6,11 +6,12 @@ parser = argparse.ArgumentParser()
parser
.
add_argument
(
'
filename
'
)
parser
.
add_argument
(
'
filename
'
)
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
RORQUAL_HOPSIZE
,
RORQUAL_WINSIZE
,
RORQUAL_FE
=
256
,
4096
,
4000
RORQUAL_HOPSIZE
,
RORQUAL_WINSIZE
,
RORQUAL_FE
,
RORQUAL_SAMPLEPERSAMPLE
=
256
,
4096
,
4000
,
25600
CACHA_HOPSIZE
,
CACHA_WINSIZE
,
CACHA_FE
=
256
,
512
,
64000
CACHA_HOPSIZE
,
CACHA_WINSIZE
,
CACHA_FE
,
CACHA_SAMPLEPERSAMPLE
=
256
,
512
,
64000
,
12800
RAPPORT_FE
=
128_000
CACHA_RAPPORT_FE
,
RORQUAL_RAPPORT_FE
,
RAPPORT_N_CHANNELS
=
128_000
,
128_00
,
5
rorqual_predPos
=
lambda
p
:
int
(((
p
*
RORQUAL_HOPSIZE
+
(
RORQUAL_WINSIZE
/
2
+
RORQUAL_HOPSIZE
*
13
)
/
2
)
/
RORQUAL_FE
-
1
)
*
RAPPORT_FE
)
CACHA_NUM_DETEC
,
RORQUAL_NUM_DETEC
=
10
,
3
cacha_predPos
=
lambda
p
:
int
(((
p
*
CACHA_HOPSIZE
*
8
+
(
CACHA_WINSIZE
+
CACHA_HOPSIZE
*
7
*
6
)
/
2
)
/
CACHA_FE
-
0.05
)
*
RAPPORT_FE
)
rorqual_predPos
=
lambda
p
:
int
(((
p
*
RORQUAL_HOPSIZE
+
(
RORQUAL_WINSIZE
/
2
+
RORQUAL_HOPSIZE
*
13
)
/
2
)
/
RORQUAL_FE
-
1
)
*
RORQUAL_RAPPORT_FE
)
cacha_predPos
=
lambda
p
:
int
(((
p
*
CACHA_HOPSIZE
*
8
+
(
CACHA_WINSIZE
+
CACHA_HOPSIZE
*
7
*
6
)
/
4
)
/
CACHA_FE
-
0.05
)
*
CACHA_RAPPORT_FE
)
file
=
open
(
args
.
filename
,
'
r
'
)
file
=
open
(
args
.
filename
,
'
r
'
)
lines
=
iter
(
file
.
readlines
())
lines
=
iter
(
file
.
readlines
())
...
@@ -19,26 +20,24 @@ for l in lines:
...
@@ -19,26 +20,24 @@ for l in lines:
if
l
==
'
rorqual predPeaks
\n
'
:
if
l
==
'
rorqual predPeaks
\n
'
:
l
=
next
(
lines
)
l
=
next
(
lines
)
if
'
,
'
in
l
:
if
'
,
'
in
l
:
sig
=
np
.
zeros
((
30
*
RORQUAL_RAPPORT_FE
,
RAPPORT_N_CHANNELS
),
dtype
=
'
int16
'
)
peaks
=
np
.
array
(
l
[:
-
2
].
split
(
'
,
'
)).
astype
(
int
)
l
=
next
(
lines
)
l
=
next
(
lines
)
if
'
,
'
in
l
:
for
p
in
peaks
[:
RORQUAL_NUM_DETEC
]:
sig
=
np
.
zeros
((
30
*
128_000
,
5
),
dtype
=
'
int16
'
)
peaks
=
np
.
array
(
l
[:
-
2
].
split
(
'
,
'
)).
astype
(
int
)
l
=
next
(
lines
)
l
=
next
(
lines
)
for
p
in
peaks
:
samples
=
np
.
array
(
l
[:
-
2
].
split
(
'
,
'
)).
astype
(
'
int16
'
).
reshape
(
-
1
,
RAPPORT_N_CHANNELS
)
l
=
next
(
lines
)
sig
[
rorqual_predPos
(
p
):
rorqual_predPos
(
p
)
+
RORQUAL_SAMPLEPERSAMPLE
]
=
samples
[:
min
(
rorqual_predPos
(
p
)
+
RORQUAL_SAMPLEPERSAMPLE
,
len
(
sig
))
-
rorqual_predPos
(
p
)]
samples
=
np
.
array
(
l
[:
-
2
].
split
(
'
,
'
)).
astype
(
'
int16
'
).
reshape
(
-
1
,
5
)
sf
.
write
(
f
'
{
args
.
filename
[
:
-
8
]
}
_rorqual.wav
'
,
sig
,
RORQUAL_RAPPORT_FE
)
sig
[
rorqual_predPos
(
p
):
rorqual_predPos
(
p
)
+
256000
]
=
samples
sf
.
write
(
f
'
{
args
.
filename
[
:
-
8
]
}
_rorqual.wav
'
,
sig
,
RAPPORT_FE
)
if
l
==
'
cacha predPeaks
\n
'
:
if
l
==
'
cacha predPeaks
\n
'
:
l
=
next
(
lines
)
l
=
next
(
lines
)
if
'
,
'
in
l
:
if
'
,
'
in
l
:
sig
=
np
.
zeros
((
10
*
128_000
,
5
),
dtype
=
'
int16
'
)
sig
=
np
.
zeros
((
10
*
CACHA_RAPPORT_FE
,
RAPPORT_N_CHANNELS
),
dtype
=
'
int16
'
)
peaks
=
np
.
array
(
l
[:
-
2
].
split
(
'
,
'
)).
astype
(
int
)
peaks
=
np
.
array
(
l
[:
-
2
].
split
(
'
,
'
)).
astype
(
int
)
l
=
next
(
lines
)
l
=
next
(
lines
)
for
p
in
peaks
:
for
p
in
peaks
[:
CACHA_NUM_DETEC
]
:
l
=
next
(
lines
)
l
=
next
(
lines
)
samples
=
np
.
array
(
l
[:
-
2
].
split
(
'
,
'
)).
astype
(
'
int16
'
).
reshape
(
-
1
,
5
)
samples
=
np
.
array
(
l
[:
-
2
].
split
(
'
,
'
)).
astype
(
'
int16
'
).
reshape
(
-
1
,
RAPPORT_N_CHANNELS
)
sig
[
cacha_predPos
(
p
):
cacha_predPos
(
p
)
+
12800
]
=
samples
sig
[
cacha_predPos
(
p
):
cacha_predPos
(
p
)
+
CACHA_SAMPLEPERSAMPLE
]
=
samples
sf
.
write
(
f
'
{
args
.
filename
[
:
-
8
]
}
_cacha.wav
'
,
sig
,
RAPPORT_FE
)
sf
.
write
(
f
'
{
args
.
filename
[
:
-
8
]
}
_cacha.wav
'
,
sig
,
CACHA_
RAPPORT_FE
)
file
.
close
()
file
.
close
()
This diff is collapsed.
Click to expand it.
RapportInfo2txt
+
0
−
0
View file @
8606741d
No preview for this file type
This diff is collapsed.
Click to expand it.
RapportInfo2txt.c
+
4
−
3
View file @
8606741d
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
#include
<stdlib.h>
#include
<stdlib.h>
#include
<string.h>
#include
<string.h>
#include
<stdbool.h>
#include
<stdbool.h>
#include
<math.h>
#define NTOAS_MAX 200
#define NTOAS_MAX 200
...
@@ -13,8 +14,8 @@
...
@@ -13,8 +14,8 @@
#define RORQUAL_HOPSIZE 256
#define RORQUAL_HOPSIZE 256
#define RORQUAL_LENPRED RORQUAL_LENSPEC - (5-1)*3 //3 layers of kernel size 5
#define RORQUAL_LENPRED RORQUAL_LENSPEC - (5-1)*3 //3 layers of kernel size 5
#define RORQUAL_RAPPORT_NSAMPLESTOSEND 3 // see cacha
#define RORQUAL_RAPPORT_NSAMPLESTOSEND 3 // see cacha
#define RORQUAL_RAPPORT_SAMPLE_RATE 12800
0
#define RORQUAL_RAPPORT_SAMPLE_RATE 12800
#define RORQUAL_RAPPORT_SAMPLESPERSAMPLE 25600
0
// see cacha
#define RORQUAL_RAPPORT_SAMPLESPERSAMPLE 25600 // see cacha
#define CACHA_SAMPLE_RATE 64000
#define CACHA_SAMPLE_RATE 64000
#define CACHA_LENSIG CACHA_SAMPLE_RATE*10 // load 10sec
#define CACHA_LENSIG CACHA_SAMPLE_RATE*10 // load 10sec
...
@@ -86,7 +87,7 @@ int main(int argc, char* argv[]){
...
@@ -86,7 +87,7 @@ int main(int argc, char* argv[]){
fprintf
(
outfile
,
"%hd,"
,
rapport
.
predPeaksC
[
i
]);
fprintf
(
outfile
,
"%hd,"
,
rapport
.
predPeaksC
[
i
]);
}
}
fprintf
(
outfile
,
"
\n
cacha samples
\n
"
);
fprintf
(
outfile
,
"
\n
cacha samples
\n
"
);
for
(
i
=
0
;
i
<
rapport
.
numDetectionsCachalot
;
i
++
){
for
(
i
=
0
;
i
<
fmin
(
rapport
.
numDetectionsCachalot
,
CACHA_RAPPORT_NSAMPLESTOSEND
)
;
i
++
){
for
(
j
=
0
;
j
<
CACHA_RAPPORT_SAMPLESPERSAMPLE
;
j
++
){
for
(
j
=
0
;
j
<
CACHA_RAPPORT_SAMPLESPERSAMPLE
;
j
++
){
for
(
k
=
0
;
k
<
RAPPORT_CHANNELS
;
k
++
){
for
(
k
=
0
;
k
<
RAPPORT_CHANNELS
;
k
++
){
fprintf
(
outfile
,
"%hd,"
,
rapport
.
samplesC
[
i
][
j
][
k
]);
fprintf
(
outfile
,
"%hd,"
,
rapport
.
samplesC
[
i
][
j
][
k
]);
...
...
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