Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
ef39068
Implement audio recorder using audioRecord class
ghsdh3409 May 15, 2017
89776f0
Add streaming API
ghsdh3409 May 15, 2017
083a92c
Implement streaming record in Android
ghsdh3409 May 26, 2017
81b39c2
Temporary commit
ohtangza May 30, 2017
28b4574
Implement streaming recorder using AVAudioEngine (temp)
ghsdh3409 May 30, 2017
ad16ae8
Generate dataReceived event
ghsdh3409 May 30, 2017
c7fe659
Implement pause and stop streaming recording
ghsdh3409 May 31, 2017
e4ba227
Write recording stream to file
ghsdh3409 May 31, 2017
a175a6f
Supporting recording options (temporal commit)
ghsdh3409 Jun 9, 2017
d756020
Support recording format
ghsdh3409 Jun 19, 2017
f20371e
Implement recorder eventProgress and eventFinished callback
ghsdh3409 Jun 19, 2017
59ad41b
Support format in Android
ghsdh3409 Jun 20, 2017
cdebdd1
Fix bugs
ghsdh3409 Jun 20, 2017
118c21e
Convert AVAudioPCMFormatFloat32 to AVAudioPCMFormatInt16
ghsdh3409 Jul 17, 2017
7bcebda
Commit missing change
ghsdh3409 Jul 18, 2017
dc992b7
Fix to support channels in iOS
ghsdh3409 Jul 18, 2017
f7e873f
Refactor android code
ghsdh3409 Jul 18, 2017
a33a9d0
Support buffer size
ghsdh3409 Jul 18, 2017
8d5d604
Fix audio buffer in Android
ghsdh3409 Aug 2, 2017
65585eb
Apply WIT VAD in Android
ghsdh3409 Aug 7, 2017
1848031
Fix iOS empty AVAudioSession
ghsdh3409 Aug 8, 2017
b3b3bf3
Apply WIT VAD in iOS
ghsdh3409 Aug 8, 2017
e2a2752
Support sample rate as initializing VAD in android
ghsdh3409 Aug 8, 2017
b3aace9
Support sensitivity and timeout parameter for react-native module
ghsdh3409 Aug 8, 2017
8d2e677
Support to set audioSource in Android
ghsdh3409 Aug 10, 2017
a39ab54
Check null of recordTask
ghsdh3409 Sep 13, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 26 additions & 12 deletions AudioExample/AudioExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,23 @@ class AudioExample extends Component {
recording: false,
stoppedRecording: false,
finished: false,
audioPath: AudioUtils.DocumentDirectoryPath + '/test.aac',
audioPath: AudioUtils.DocumentDirectoryPath + '/test.wav',
hasPermission: undefined,
};

prepareRecordingPath(audioPath){
AudioRecorder.prepareRecordingAtPath(audioPath, {
SampleRate: 22050,
Channels: 1,
AudioQuality: "Low",
AudioEncoding: "aac",
AudioEncodingBitRate: 32000
});
AudioRecorder.prepareStreamingAtPath(this.state.audioPath, 1600, {
SampleRate: 22050,
Channels: 1,
AudioSource: 'MIC',
// Following is not supported
// AudioQuality: "Low",
// AudioEncoding: "aac",
// AudioEncodingBitRate: 32000,
}, {
Sensitivity: 0,
Timeout: 7000,
});
}

componentDidMount() {
Expand All @@ -41,7 +46,8 @@ class AudioExample extends Component {
if (!hasPermission) return;

this.prepareRecordingPath(this.state.audioPath);

console.log(this.state.audioPath);
console.log(AudioRecorder);
AudioRecorder.onProgress = (data) => {
this.setState({currentTime: Math.floor(data.currentTime)});
};
Expand All @@ -52,6 +58,14 @@ class AudioExample extends Component {
this._finishRecording(data.status === "OK", data.audioFileURL);
}
};

AudioRecorder.onDataReceived = (data) => {
// console.log(data);
}

AudioRecorder.onVadReceived = (vadResult) => {
console.log(vadResult);
}
});
}

Expand Down Expand Up @@ -93,7 +107,7 @@ class AudioExample extends Component {
this.setState({stoppedRecording: true, recording: false});

try {
const filePath = await AudioRecorder.pauseRecording();
const filePath = await AudioRecorder.pauseStreaming();

// Pause is currently equivalent to stop on Android.
if (Platform.OS === 'android') {
Expand All @@ -113,7 +127,7 @@ class AudioExample extends Component {
this.setState({stoppedRecording: true, recording: false});

try {
const filePath = await AudioRecorder.stopRecording();
const filePath = await AudioRecorder.stopStreaming();

if (Platform.OS === 'android') {
this._finishRecording(true, filePath);
Expand Down Expand Up @@ -168,7 +182,7 @@ class AudioExample extends Component {
this.setState({recording: true});

try {
const filePath = await AudioRecorder.startRecording();
const filePath = await AudioRecorder.startStreaming();
} catch (error) {
console.error(error);
}
Expand Down
8 changes: 8 additions & 0 deletions AudioExample/iOS/AudioExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -528,8 +528,12 @@
TargetAttributes = {
00E356ED1AD99517003FC87E = {
CreatedOnToolsVersion = 6.2;
DevelopmentTeam = SD72YP83U5;
TestTargetID = 13B07F861A680F5B00A75B9A;
};
13B07F861A680F5B00A75B9A = {
DevelopmentTeam = SD72YP83U5;
};
};
};
buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "AudioExample" */;
Expand Down Expand Up @@ -878,6 +882,7 @@
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
DEVELOPMENT_TEAM = SD72YP83U5;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
Expand All @@ -900,6 +905,7 @@
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
COPY_PHASE_STRIP = NO;
DEVELOPMENT_TEAM = SD72YP83U5;
INFOPLIST_FILE = AudioExampleTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
Expand All @@ -919,6 +925,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CURRENT_PROJECT_VERSION = 1;
DEAD_CODE_STRIPPING = NO;
DEVELOPMENT_TEAM = SD72YP83U5;
INFOPLIST_FILE = AudioExample/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
OTHER_LDFLAGS = (
Expand All @@ -936,6 +943,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = SD72YP83U5;
INFOPLIST_FILE = AudioExample/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
OTHER_LDFLAGS = (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
Expand Down
2 changes: 2 additions & 0 deletions AudioExample/iOS/AudioExample/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
<false/>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<key>NSMicrophoneUsageDescription</key>
<string></string>
<key>NSAppTransportSecurity</key>
<!--See http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/ -->
<dict>
Expand Down
5 changes: 5 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ android {
targetSdkVersion 23
versionCode 1
versionName "1.0"
ndk {
moduleName "witvad"
ldLibs "log"
}
}
buildTypes {
release {
Expand All @@ -21,4 +25,5 @@ dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.facebook.react:react-native:+'
compile 'com.github.wendykierp:JTransforms:3.0'
}
Loading