Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Laurent Besacier
lig-aikuma
Commits
b33e4a2d
Commit
b33e4a2d
authored
Apr 25, 2016
by
CallisteHanriat
Browse files
changing sampleRate : force it to become 16khz even if the selected file is at 8khz
parent
e2a9c3a3
Changes
7
Hide whitespace changes
Inline
Side-by-side
Aikuma/src/org/lp20/aikuma/audio/record/Microphone.java
View file @
b33e4a2d
...
...
@@ -39,6 +39,7 @@ public class Microphone {
* @throws MicException If the microphone couldn't be set up.
*/
public
Microphone
(
long
sampleRate
)
throws
MicException
{
sampleRate
=
16000
l
;
physicalMicrophone
=
getListener
(
(
int
)
sampleRate
,
AudioFormat
.
ENCODING_PCM_16BIT
,
...
...
Aikuma/src/org/lp20/aikuma/audio/record/PhoneRespeaker.java
View file @
b33e4a2d
...
...
@@ -58,6 +58,7 @@ public class PhoneRespeaker implements
/** Sets up the microphone for recording. */
private
void
setUpMicrophone
(
long
sampleRate
)
throws
MicException
{
Log
.
d
(
"Rte-PhoneRespeak"
,
"sampleRate : "
+
sampleRate
);
this
.
microphone
=
new
Microphone
(
sampleRate
);
}
...
...
Aikuma/src/org/lp20/aikuma/audio/record/Recorder.java
View file @
b33e4a2d
...
...
@@ -149,6 +149,7 @@ public class Recorder implements AudioHandler, MicrophoneListener, Sampler {
/** Sets up the micrphone for recording */
private
void
setUpMicrophone
(
long
sampleRate
)
throws
MicException
{
Log
.
d
(
"Rte-Recorder"
,
"samrate: "
+
sampleRate
);
this
.
sampleRate
=
sampleRate
;
this
.
microphone
=
new
Microphone
(
sampleRate
);
}
...
...
Aikuma/src/org/lp20/aikuma/audio/record/ThumbRespeaker.java
View file @
b33e4a2d
...
...
@@ -43,6 +43,7 @@ public class ThumbRespeaker {
*/
public
ThumbRespeaker
(
Recording
original
,
UUID
respeakingUUID
,
int
rewindAmount
)
throws
MicException
,
IOException
{
Log
.
d
(
"Rte-ThumbRespeaker"
,
"smp : "
+
original
.
getSampleRate
());
recorder
=
new
Recorder
(
1
,
new
File
(
Recording
.
getNoSyncRecordingsPath
(),
respeakingUUID
+
".wav"
),
original
.
getSampleRate
());
player
=
new
SimplePlayer
(
original
,
true
);
...
...
Aikuma/src/org/lp20/aikuma/model/Recording.java
View file @
b33e4a2d
...
...
@@ -8,6 +8,8 @@ import android.os.Environment;
import
android.os.Parcel
;
import
android.util.Log
;
import
org.lp20.aikuma.Aikuma
;
import
org.lp20.aikuma.audio.SegmentPlayer
;
import
org.lp20.aikuma.ui.RecordActivityLig
;
import
org.lp20.aikuma.util.FileIO
;
import
org.lp20.aikuma.util.IdUtils
;
import
org.lp20.aikuma.util.StandardDateFormat
;
...
...
@@ -500,7 +502,7 @@ public class Recording extends FileModel {
encodedRecording
.
put
(
"speakers"
,
speakersIdsArray
);
encodedRecording
.
put
(
"device"
,
deviceName
);
encodedRecording
.
put
(
"androidID"
,
this
.
androidID
);
encodedRecording
.
put
(
"
sampleRate
"
,
getSampleRate
());
encodedRecording
.
put
(
RecordActivityLig
.
intent_
sampleRate
,
getSampleRate
());
encodedRecording
.
put
(
"durationMsec"
,
getDurationMsec
());
encodedRecording
.
put
(
"item_id"
,
this
.
groupId
);
encodedRecording
.
put
(
"suffix"
,
this
.
respeakingId
);
...
...
@@ -769,10 +771,10 @@ public class Recording extends FileModel {
}
long
sampleRate
;
if
(
jsonObj
.
get
(
"
sampleRate
"
)
==
null
)
{
if
(
jsonObj
.
get
(
RecordActivityLig
.
intent_
sampleRate
)
==
null
)
{
sampleRate
=
-
1
;
}
else
{
sampleRate
=
(
Long
)
jsonObj
.
get
(
"
sampleRate
"
);
sampleRate
=
(
Long
)
jsonObj
.
get
(
RecordActivityLig
.
intent_
sampleRate
);
}
int
durationMsec
;
...
...
@@ -1245,6 +1247,7 @@ public class Recording extends FileModel {
private
void
setSampleRate
(
long
sampleRate
)
{
this
.
sampleRate
=
sampleRate
;
Log
.
d
(
"Recording"
,
"setSampleRate : "
+
sampleRate
);
}
private
void
setRespeakingId
(
String
respeakingId
)
{
...
...
Aikuma/src/org/lp20/aikuma/model/RecordingLig.java
View file @
b33e4a2d
...
...
@@ -162,6 +162,10 @@ public class RecordingLig extends Recording {
Log
.
i
(
TAG
,
"mapping file "
+
mapFile
.
getAbsolutePath
()
+
" moves to "
+
destFile
.
getAbsolutePath
());
}
/**
* called when we want to save wav and json file into recording folder.
*/
public
void
write
()
throws
IOException
{
// Ensure the directory exists
File
dir
=
getIndividualRecordingPath
();
...
...
Aikuma/src/org/lp20/aikuma/ui/RespeakingMetadataLig.java
View file @
b33e4a2d
...
...
@@ -83,7 +83,7 @@ public class RespeakingMetadataLig extends AikumaActivity implements OnClickList
metaJSON
=
FileIO
.
readJSONObject
(
new
File
(
FileIO
.
getOwnerPath
(),
RecordingLig
.
RECORDINGS
+
OrigDirName
+
"/"
+
origRecName
+
RecordingLig
.
METADATA_SUFFIX
));
recordSampleRate
=
(
Long
)
metaJSON
.
get
(
"sampleRate"
)
;
recordSampleRate
=
16000
l
;
// JSONObject metaJSON = FileIO.readJSONObject(new File(recordPath.split(".")[0]
// + RecordingLig.METADATA_SUFFIX));
...
...
Write
Preview
Supports
Markdown
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