mirror of
https://github.com/ggerganov/whisper.cpp.git
synced 2024-12-27 00:59:01 +01:00
talk.wasm : update video link + some minor fixes
This commit is contained in:
parent
025ff465b6
commit
ff36415a86
@ -135,11 +135,9 @@ void talk_main(size_t index) {
|
|||||||
|
|
||||||
talk_set_status("processing ...");
|
talk_set_status("processing ...");
|
||||||
|
|
||||||
g_force_speak = false;
|
|
||||||
|
|
||||||
t_last = t_now;
|
t_last = t_now;
|
||||||
|
|
||||||
{
|
if (!g_force_speak) {
|
||||||
const auto t_start = std::chrono::high_resolution_clock::now();
|
const auto t_start = std::chrono::high_resolution_clock::now();
|
||||||
|
|
||||||
int ret = whisper_full(ctx, wparams, pcmf32.data(), pcmf32.size());
|
int ret = whisper_full(ctx, wparams, pcmf32.data(), pcmf32.size());
|
||||||
@ -156,18 +154,22 @@ void talk_main(size_t index) {
|
|||||||
{
|
{
|
||||||
std::string text_heard;
|
std::string text_heard;
|
||||||
|
|
||||||
const int n_segments = whisper_full_n_segments(ctx);
|
if (!g_force_speak) {
|
||||||
for (int i = n_segments - 1; i < n_segments; ++i) {
|
const int n_segments = whisper_full_n_segments(ctx);
|
||||||
const char * text = whisper_full_get_segment_text(ctx, i);
|
for (int i = n_segments - 1; i < n_segments; ++i) {
|
||||||
|
const char * text = whisper_full_get_segment_text(ctx, i);
|
||||||
|
|
||||||
const int64_t t0 = whisper_full_get_segment_t0(ctx, i);
|
const int64_t t0 = whisper_full_get_segment_t0(ctx, i);
|
||||||
const int64_t t1 = whisper_full_get_segment_t1(ctx, i);
|
const int64_t t1 = whisper_full_get_segment_t1(ctx, i);
|
||||||
|
|
||||||
printf ("[%s --> %s] %s\n", to_timestamp(t0).c_str(), to_timestamp(t1).c_str(), text);
|
printf ("[%s --> %s] %s\n", to_timestamp(t0).c_str(), to_timestamp(t1).c_str(), text);
|
||||||
|
|
||||||
text_heard += text;
|
text_heard += text;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_force_speak = false;
|
||||||
|
|
||||||
// remove text between brackets using regex
|
// remove text between brackets using regex
|
||||||
{
|
{
|
||||||
std::regex re("\\[.*?\\]");
|
std::regex re("\\[.*?\\]");
|
||||||
|
@ -812,9 +812,9 @@ I'm fine, thanks. How are you?
|
|||||||
Thanks, I'm fine too. What are you doing?
|
Thanks, I'm fine too. What are you doing?
|
||||||
I'm just sitting here.
|
I'm just sitting here.
|
||||||
It's a lovely day, isn't it?
|
It's a lovely day, isn't it?
|
||||||
Yes, it is.
|
Yes, it is. I love the weather this time of year.
|
||||||
Did you know that I'm a robot?
|
I wish it would rain a little bit.
|
||||||
I wasn't aware of that.
|
Me too.
|
||||||
)";
|
)";
|
||||||
|
|
||||||
std::mt19937 rng;
|
std::mt19937 rng;
|
||||||
|
@ -143,7 +143,7 @@
|
|||||||
|
|
||||||
<br><br>
|
<br><br>
|
||||||
|
|
||||||
Here is a short video of the demo in action: <a href="https://youtu.be/2om-7tFMaNs">https://youtu.be/2om-7tFMaNs</a>
|
Here is a short video of the demo in action: <a href="https://youtu.be/LeWKl8t1-Hc">https://youtu.be/LeWKl8t1-Hc</a>
|
||||||
|
|
||||||
<br><br>
|
<br><br>
|
||||||
|
|
||||||
@ -507,7 +507,7 @@
|
|||||||
context = new AudioContext({
|
context = new AudioContext({
|
||||||
sampleRate: 16000,
|
sampleRate: 16000,
|
||||||
channelCount: 1,
|
channelCount: 1,
|
||||||
echoCancellation: true,
|
echoCancellation: false,
|
||||||
autoGainControl: true,
|
autoGainControl: true,
|
||||||
noiseSuppression: true,
|
noiseSuppression: true,
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user