You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[SEPIA STT Server](https://github.com/SEPIA-Framework/sepia-stt-server) WebSocket module for speech recognition
16
+
-[SEPIA STT Server](https://github.com/SEPIA-Framework/sepia-stt-server) WebSocket module for speech recognition (see STT Server for demo)
17
17
- more to come ...
18
18
19
-
## Tutorial
19
+
## Quick-Start - Voice Recorder
20
20
21
-
Full tutorial code can be found at: [tutorial-code-page.html](tutorial-code-page.html).
22
-
Please check out the modules and voice-recorder demo and test pages for more examples.
21
+
Efficiently resampling audio to 16000 Hz and creating 16Bit mono samples for speech recognition was one of the primary objectives when building this library.
22
+
While you can put together your own audio pipeline to do that (see below) there is a very convenient plugin available that does the job for you.
23
+
In this quick-start guide you will learn the basics to use the 'SepiaVoiceRecorder'.
24
+
25
+
The first step is to import the required files and set the correct path to the modules folder. You will find more details about this step in the tutorial below. In this example the required files in 'modules' are 'speex-resample-switch.js', 'wave-encoder-worker.js' and 'shared/ring-buffer.min.js':
targetSampleRate:16000, //16kHz is actually the voice recorder default
56
+
gain:3.0, //we can pre-amplify the signal using the gain option
57
+
recordingLimitMs:30000, //Total recording limit ms
58
+
});
59
+
```
60
+
61
+
Everything is prepared. To finally start recording you should wait for the ready event and then call:
62
+
```javascript
63
+
//to start:
64
+
SepiaVoiceRecorder.start();
65
+
66
+
//to stop:
67
+
SepiaVoiceRecorder.stop();
68
+
```
69
+
70
+
That's it :-).
71
+
72
+
Of cause there are many more events, options and features available ^^. Please check out the [voice-recorder-demo.html](voice-recorder-demo.html) for a more complex recorder setup including VAD etc..
73
+
74
+
75
+
## Tutorial - Building Audio Pipelines
76
+
77
+
Full code for this tutorial can be found at: [tutorial-code-page.html](tutorial-code-page.html).
78
+
Please check out the extensive [modules-demo.html](modules-demo.html) and the test pages for more examples.
23
79
24
80
25
81
### Part 1: Basic setup and single buffer module
@@ -32,7 +88,7 @@ Copy `sepia-web-audio.js` to your project and import the library using the `<hea
Copy the audio modules you are planning to use and set the correct folder:
91
+
Copy the audio modules you are planning to use, for part 1 of the tutorial we only need 'buffer-switch.js'. When you're done set the correct path to your modules folder:
36
92
37
93
```html
38
94
<script>
@@ -41,7 +97,7 @@ Copy the audio modules you are planning to use and set the correct folder:
41
97
```
42
98
43
99
Note: In this example we've used a folder called `src` for the library and modules folder but you can choose whatever you like.
44
-
Note2: Currently (v0.9.6) there is no Javascript modules support yet. Feel free to create a request via the issues section if you need it ;-).
100
+
Note2: Currently there is no Javascript modules support yet. Feel free to create a request via the issues section if you need it ;-).
45
101
46
102
#### Create the audio processor
47
103
@@ -103,7 +159,8 @@ If we don't want to restart later we can close the processor and clean up resour
103
159
### Part 2: Resample input and record raw 16Bit PCM mono audio (WAV)
104
160
105
161
A very common use-case for this library is to resample microphone input and encode it as 16Bit PCM mono data (which is basically the default WAV file format).
106
-
To make this happen we will replace the buffer module from earlier with a resampler and wave encoder module.
162
+
To make this happen we will replace the buffer module from earlier with a resampler and wave encoder module. If you haven't done already please copy 'speex-resample-switch.js', 'wave-encoder-worker.js' and 'shared/ring-buffer.min.js' to your modules folder.
163
+
107
164
NOTE: Some browsers are actually able to natively resampling for us ^^. The resampler module will simply skip transformation in this case but it might be preferable to prevent native resampling to retain full control over the quality and speed.
108
165
`SepiaFW.webAudio.isNativeStreamResamplingSupported` will be 'true' when the lib is imported because we can't test for the feature but set to 'false' after the first failed attempt of native resampling!
0 commit comments