English 中文(简体)
生成要在RTP数据包中发送的DTMF音调
原标题:Generating DTMF tone to send in RTP packet

我有以下代码作为音频RTP数据包发送一些DTMF数字:

 int count=0
 for(int j = 0; j < samples; j++) 
  {
      waves = 0;
      // dtmf tone 1

      waves += sin( ((PI * 2.0f / 8000) * 697.0f) * count );
      waves += sin( ((PI * 2.0f / 8000) * 1209.0f) * count);
      waves *= 8191.0f;   //amplitude   
      ++count;
      values[j] = (SInt16)waves;  
  }

我正在用程序生成数字。这段代码基本上将2个正弦波相加并应用缩放。这将产生16位PCM数据,然后可以对其进行编码。采样率是8K以作为RTP分组进行发送。

我做得对吗?

最佳回答

有更有效的方法来编程它,而且它真的不应该被硬编码(音量、频率、长度等),但这大致是正确的。我将使用M_PI而不是PI。

注:count==j,waves=0无效(先将+=更改为=)等。

问题回答

稍微偏离主题,但如果您以RTP形式发送数据,那么您检查过远程对等方是否支持RFC2833吗?如果是这样,您可以使用符合RFC2833的RTP数据包传递DTMF数字,从而避免链路两端的大量工作。

迈克





相关问题
h264 RTP timestamp

I have a confusion about the timestamp of h264 RTP packet. I know the wall clock rate of video is 90KHz which I defined in the SIP SDP. The frame rate of my encoder is not exactly 30 FPS, it is ...

How can I mux/demux RTP media from one stream?

Currently, I m finding a lib able to stream video from multiple sources through one RTP Stream (one connection). Anbody have sugesstion on it? Actually, I figured out that Opal 3.8 is VoIP lib, ...

Rtp on Java beginners help?

I have started playing around with RTP on Java in Android and was wondering if anyone could give me a bit of help or guidance. Here is the code I have started on: public void rtpTest() throws ...

H264 RTP packet parsing [closed]

I am looking for source code of RTP Payload Format for H.264 Video according to RFC(3984). It would be great if someone can point out it. Also I am looking for wireshark plugin which can show me the ...

Reasons to use RTP when streaming a pre-existing file?

The only reason I could think of for using RTP to transfer a pre-existing file is if you re trying to monitor the amount of time a user is streaming the file, like if you re running a time-based On-...

udp socket options for sendng RTP

I am opening socket on windows platform for sending RTP voice packets. The application is softphone. What preferable options should be set on this socket.

RTP 溪流中的MPEG4/H264 I-Frame (IDR)

我需要探测RPG4 I-Frame在RPTP包装中。 我知道如何去除区域边界评估的头盔,使区域空间评估4框架进入其中,但我可以说明如何确定I-Frame。

热门标签