Home > Mobile >  About the audio file format and transmission of different questions
About the audio file format and transmission of different questions

Time:04-30

A rookie, are learning,

I'm doing right now a communications software, want to send voice function complete, the current implementation approach is to use the
QAudioFormat format;
Format. SetSampleRate (8000);//set the sampling of Hertz
Format. SetChannelCount (1);//set the channel number v//set the channel number, mono (ire) track number is 1; Stero (stereo) track number is 2
Format. SetSampleSize (16);//set the sample size, usually 8 or 16
Audio/PCM format. SetCodec (" ");//set the codec
Format. SetByteOrder (QAudioFormat: : LittleEndian);//
Format. SetSampleType (QAudioFormat: : UnSignedInt);//
.
QAudioInput * input;
QAudioOutput * output;
.

To save the recording, raw is saved as a file, and then convert wav format files to play, want to use udp transport raw files, the contents of the receiver in the preservation and generate the raw files, the play is converted into wav format, but there is a serious problem, when the recording file is too large, udp transmission will be lost package, lead to transmission failure, but I don't want to use TCP,

What method can solve the above problem, please?

CodePudding user response:

Send voice messages should be use udp or TCP? My idea is that the UDP send content must be compressed audio files, otherwise easy to lost package, is not stable, using TCP, I think is too complicated, because I think that the client was not like server will always listen to port, because of my other data transmission are using UDP (words, expressions, picture (picture I am the compression of the coma, click to download the original way that haven't)), if not always listening, only to listen because of sending audio files, to establish a connection I feel too much trouble,
And I found that when using WeChat send voice can't say too long (if only to the biggest 60 seconds), I guess for too long, can appear even compressed file is too large, using UDP send packet loss may arise,

CodePudding user response:

Now I think the best way is to send voice compression file before sending, because never contact with this kind of operation before, did not know how to start, the website can use lame library code to the MP3 format, MP3 format file should be a little bit small, but I will not again, also can't find this tripartite lame library, also want to have big help children,

CodePudding user response:

Up up up

CodePudding user response:

If the file is in the form of non real-time voice, simplex may save file, using lame lame can direct command line call,

CodePudding user response:

reference 4 floor 丁劲犇 response:
if file is in the form of non real-time voice, simplex may save file, using lame lame can direct command line invocation,


The me to understand, but online didn't find the right example, also can't find this lame tripartite library, can you give a link?

CodePudding user response:

https://lame.sourceforge.io/

CodePudding user response:

refer to 6th floor 丁劲犇 response:
https://lame.sourceforge.io/


Thank you
  •  Tags:  
  • Qt
  • Related