Comments (10)
Your detectVoice
function is never called. Is that normal ?Your detectVoice
function is never called. Is that normal ?
from go-astideepspeech.
actually it was called by other function whenever the pcm data decoded by ffmpeg
from go-astideepspeech.
Can you paste a fully working example that I can run myself ?
from go-astideepspeech.
my code is working on a stream server with ffmpeg sdk, so it can't working stand alone, can you show us an example for live stream translate?
from go-astideepspeech.
I've never used the live stream portion of DeepSpeech so I'd need some time to work out an example.
Before that, can you confirm that audio data you're feeding DeepSpeech is 16 bits / 16kHz PCM samples ?
from go-astideepspeech.
yeah, surely, just resample the audio to 16bits / 16kHz pcm data, here is the c lang code for aac to pcm:
static int aacdec_decode(aacdec_t *m, uint8_t *data, int len) {
AVPacket pkt;
av_init_packet(&pkt);
pkt.data = data;
pkt.size = len;
//av_log(m->ctx, AV_LOG_DEBUG, "decode %p\n", m);
int got;
int res = avcodec_decode_audio4(m->ctx, m->f, &got, &pkt);
if(got){
if(m->swr == NULL){
m->src_rate = m->ctx->sample_rate;
m->dst_rate = 16000;
m->swr = swr_alloc();
av_opt_set_int(m->swr, "in_channel_layout", m->ctx->channel_layout, 0);
av_opt_set_int(m->swr, "in_sample_rate", m->src_rate, 0);
av_opt_set_sample_fmt(m->swr, "in_sample_fmt", m->ctx->sample_fmt, 0);
av_opt_set_int(m->swr, "out_channel_layout", AV_CH_LAYOUT_MONO, 0);
av_opt_set_int(m->swr, "out_sample_rate", m->dst_rate, 0);
av_opt_set_sample_fmt(m->swr, "out_sample_fmt", AV_SAMPLE_FMT_S16, 0);
swr_init(m->swr);
}
int dst_linesize;
int dst_nb_channels = av_get_channel_layout_nb_channels(AV_CH_LAYOUT_MONO);
int src_nb_samples = m->f->nb_samples;
m->frameBuff = (uint8_t *)av_malloc(MAX_AUDIO_FRAME_SIZE*2);
int dst_nb_samples = av_rescale_rnd(swr_get_delay(m->swr, m->src_rate) + src_nb_samples, m->dst_rate, m->src_rate, AV_ROUND_UP);
av_samples_alloc_array_and_samples(m->frameBuff, &dst_linesize, dst_nb_channels,dst_nb_samples, AV_SAMPLE_FMT_S16, 0);
int len = swr_convert(m->swr, &m->frameBuff, dst_nb_samples, (const uint8_t **)m->f->data, src_nb_samples);
int total = av_samples_get_buffer_size(&dst_linesize, dst_nb_channels, len, AV_SAMPLE_FMT_S16, 1);
}
av_packet_unref(&pkt);
return res;
}
from go-astideepspeech.
What do you get at fmt.Println("result: ", result)
?
Also, what happens if you save all samples to a .wav file and use this lib's cmd to translate it ? In other words, does the non-streaming translation work with your samples ?
from go-astideepspeech.
just get the response: "result: ". I did not try out the non-streaming translation with my samples, because I failed to save the pcm to wav file successfully, but I can play the raw pcm with audacity or ffplay whenever save them to PCM file.
from go-astideepspeech.
Thing is, we need to be sure your samples give correct results with the non-streaming part of this lib.
To save your samples to a wav
file you can get inspiration from this bit of code.
Once it's done, let me know what results you get from the non-streaming translation.
from go-astideepspeech.
ok, thanks, I will try it in someday, too busy on job things at present.~~
from go-astideepspeech.
Related Issues (13)
- Supporting v0.1.1 and upcoming releases HOT 4
- 'Metadata' does not name a type HOT 4
- Update to new v0.6 API
- v0.7 available HOT 4
- error in "go get go get -u github.com/asticode/go-astideepspeech/... " HOT 4
- Updating bindings ? HOT 7
- Support for 0.8 HOT 2
- [Question] Does this go-binding utilizes GPU for deepspeech engine? HOT 2
- Upcoming 1.0 and renaming HOT 11
- Lib is already compatible with libspeech.so v0.9 HOT 1
- Change LM parameters
- Update with new API HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-astideepspeech.