alphacep / alphacep/vosk-api

Valid wav file is returning an empty text as transcription

Đang mở
#1,504 12 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Jupyter Notebook
Star
15.1k
Fork
1.8k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

## Expected Behavior

Receive the wav file stream and get the transcription

## Current Behavior

**rec.result()** is returning an empty text `{"text":""}`

```js
if (rec.acceptWaveform(message)){
console.log(JSON.stringify(rec.result()));
}
```

## Steps to Reproduce

1. I'm creating a valid wav file from web browser using javascript first obtaining a buffer then creating a blob
2. Send the wav file to the nodejs (socket-io server)
3. Get the Buffer ` {
var id = uuidv4();
console.log(id);
console.log(message);
var wavLocation = `/tmp/${id}.wav`;
await fs.promises.writeFile(wavLocation, message);
console.log(wavLocation)

//initRecognizer(); singleton
if (rec.acceptWaveform(message)){
console.log(JSON.stringify(rec.result()));
}else{
console.log("not a wave format")
}
}
```

## Context (Environment)

- Ubuntu 22
- Firefox
- Nodejs 16
- Vosk npm library 0.3.39

## Additional information

- I uploaded the recorded wav file recorded here: https://filebin.net/e0dt62s5u0rg3ltj

- Wav file details are

**with browser**

![image](https://github.com/alphacep/vosk-api/assets/3322836/a35679a9-6a26-489b-b418-61b3e10b48f5)

**With ffmpeg**

```
ffprobe -loglevel error -show_streams -i /tmp/19e2f4ce-bd22-4af2-8eac-180fbdd1cfc8.wav

index=0
codec_name=pcm_s16le
codec_long_name=PCM signed 16-bit little-endian
profile=unknown
codec_type=audio
codec_tag_string=[1][0][0][0]
codec_tag=0x0001
sample_fmt=s16
sample_rate=48000
channels=1
channel_layout=unknown
bits_per_sample=16
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/48000
start_pts=N/A
start_time=N/A
duration_ts=173696
duration=3.618667
bit_rate=768000
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=N/A
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=0
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
[/STREAM]

```

**With https://www.npmjs.com/package/wavefile**

```js
{
container: 'RIFF',
chunkSize: 347428,
format: 'WAVE',
Y: {
chunkId: 'RIFF',
chunkSize: 347428,
format: 'WAVE',
subChunks: [ [Object], [Object] ]
},
c: 36,
a: { h: 32, o: false },
Z: [ 'RIFF', 'RIFX', 'RF64' ],
fmt: {
chunkId: 'fmt ',
chunkSize: 16,
audioFormat: 1,
numChannels: 1,
sampleRate: 48000,
byteRate: 96000,
blockAlign: 2,
bitsPerSample: 16,
cbSize: 0,
validBitsPerSample: 0,
dwChannelMask: 0,
subformat: []
},
fact: { chunkId: '', chunkSize: 0, dwSampleLength: 0 },
cue: { chunkId: '', chunkSize: 0, dwCuePoints: 0, points: [] },
smpl: {
chunkId: '',
chunkSize: 0,
dwManufacturer: 0,
dwProduct: 0,
dwSamplePeriod: 0,
dwMIDIUnityNote: 0,
dwMIDIPitchFraction: 0,
dwSMPTEFormat: 0,
dwSMPTEOffset: 0,
dwNumSampleLoops: 0,
dwSamplerData: 0,
loops: []
},
bext: {
chunkId: '',
chunkSize: 0,
description: '',
originator: '',
originatorReference: '',
originationDate: '',
originationTime: '',
timeReference: [ 0, 0 ],
version: 0,
UMID: '',
loudnessValue: 0,
loudnessRange: 0,
maxTruePeakLevel: 0,
maxMomentaryLoudness: 0,
maxShortTermLoudness: 0,
reserved: '',
codingHistory: ''
},
iXML: { chunkId: '', chunkSize: 0, value: '' },
ds64: {
chunkId: '',
chunkSize: 0,
riffSizeHigh: 0,
riffSizeLow: 0,
dataSizeHigh: 0,
dataSizeLow: 0,
originationTime: 0,
sampleCountHigh: 0,
sampleCountLow: 0
},
data: {
chunkId: 'data',
chunkSize: 347392,
samples:
},
LIST: [],
junk: { chunkId: '', chunkSize: 0, chunkData: [] },
_PMX: { chunkId: '', chunkSize: 0, value: '' },
g: { h: 16, o: false, O: false, R: false },
bitDepth: '16',
f: { h: 16, R: false, O: true, o: false },
G: {
'4': 17,
'8': 1,
'16': 1,
'24': 1,
'32': 1,
'64': 3,
'8a': 6,
'8m': 7,
'32f': 3
}
}
```

- Reading the docs of vosk the expected sound should be PCM 16-bit mono format and according the wav file complies

```
/**
* Accept voice data
*
* accept and process new chunk of voice data
*
* @param {Buffer} data audio data in PCM 16-bit mono format
* @returns {boolean} true if silence is occured and you can retrieve a new utterance with result method
*/
acceptWaveform(data: Buffer): boolean;
```

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.