amigniter / mod_audio_stream

FreeSWITCH module to stream audio to websocket and receive response
MIT License
56 stars 30 forks source link

Receive audio of specific channel. #38

Closed SumyabazarBaatar closed 2 weeks ago

SumyabazarBaatar commented 3 weeks ago

Hi.

First of all, i want to know that can i receive only stream of caller leg ? not the callee leg, or mixed stream

Then, If i receive a stream with stereo 16k, can i split it into 2 channels ? is that possible?

Next, i sent uuid_audio_stream <UUID> start <PATH> stereo 16k this command, and i write received binary data to .pcm file for trying to know exactly is this a 16k stereo. after i write it to file and plays with ffplay -f s16le -ar 32k Output.pcm this command, audio will play human understandable, if i play with other format and rates its just not audio that i received. Like just noise. How can i get it with correct rate ?

amigniter commented 3 weeks ago

First of all, i want to know that can i receive only stream of caller leg ? not the callee leg, or mixed stream

use mono to stream single channel.

Then, If i receive a stream with stereo 16k, can i split it into 2 channels ? is that possible?

Yes. Probably utils like ffmpeg or sox, or an audio editor can help you do that.

Next, i sent uuid_audio_stream start stereo 16k this command, and i write received binary data to .pcm file for trying to know exactly is this a 16k stereo. after i write it to file and plays with ffplay -f s16le -ar 32k Output.pcm this command, audio will play human understandable, if i play with other format and rates its just not audio that i received. Like just noise. How can i get it with correct rate ?

Not familiar with ffplay but if you streamed the audio as stereo at 16k you'd need to tell it to play utility. -ar 32k doesn't look right. Why 32k when you streamed at 16k sample rate?

With aplay you can play it like this: aplay -t raw -c 2 -r 16000 -f S16_LE Output.pcm Use aplay -h for more info about the parameters.

SumyabazarBaatar commented 3 weeks ago

use mono to stream single channel.

ohh, mono is only caller voice ? or do i have to specify it on command ??

Not familiar with ffplay but if you streamed the audio as stereo at 16k you'd need to tell it to play utility. -ar 32k doesn't look right. Why 32k when you streamed at 16k sample rate?

ffplay command is from ffmpeg,

yes 32k is not the sample rate that i want from stream. i played a raw pcm data from stream, and trying to know how many sample rate does that raw pcm have. but if i play it with 16k sample rate its sounds like just a noise. [https://we.tl/t-MRToVVupnx](Here is the audio that uploaded on WeTransfer (i cant upload audio to this reply)). And then i played on 32k. it was correct audio that i recorded.

in my logic, if i execute a command with 16k stereo, and i should receive stream as 16k raw pcm.
Then i play it with 16k sample rate, it has to be the human understandable my normal talking voice. Right? But its not. its gets correct on 32k.

how can i get correct stream ?

amigniter commented 3 weeks ago

in my logic, if i execute a command with 16k stereo, and i should receive stream as 16k raw pcm. Then i play it with 16k sample rate, it has to be the human understandable my normal talking voice. Right?

Right. And it is exactly like that.

But its not. its gets correct on 32k.

I truly doubt it. If you stream at 16k you will get exactly what you streamed. The module will send raw audio (no headers) with correct sample rate.

The audio file you uploaded, please take a look at the signature, it is not what this module streams: file Output.wav Output.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, stereo 44100 Hz

amigniter commented 3 weeks ago

ohh, mono is only caller voice ? or do i have to specify it on command ??