Hello Konstantin,
Shpinev Konstantin wrote:
Hello!
Prompt please how it is possible to receive a sound stream (directly
frequencies)
from module Sems? It is necessary for me for real-time speech analysis.
For example, I would like to accumulate a sound part in a numerical array in the
form of frequencies, to wait silences of the set duration, and then to start the
analysis of the received data.
in SEMS, the audio processing is separated from the application and
signaling processing logic. The application connects some AmAudio
'devices' to audio input and output of the session, and then in the
media processing thread the AmAudio::read and AmAudio::write functions
will be called. If you want to process the audio yourself, then you
need to derive a class from AmAudio, and implement the AmAudio::read
and AmAudio::write functions. The actual samples will be in
AmAudio::samples, in signed short format (PCM16). The size (in bytes!)
is a parameter to the read/write function. For examples, see e.g.
core/plug-in/echo/AmAudioEcho.[h,cpp], core/AmRingTone.[h,cpp], or
also http://ftp.iptel.org/pub/sems/doc/current/classAmAudio.html .
In your application you then instantiate an object of your class, and
use AmAudio::setInOut (or AmAudio::setInput/AmAudio::setOutput) to set
this to input or output of your session (see e.g. Echo.cpp).
If you need to write the audio data to more than one AmAudio devices,
or you want to pass the audio through some filters, then you can use
AmAudioQueue, where you can put several AmAudio's into.
If you then want to interact with your application logic, best is to
send events into the event queue of the session
(AmSessionContainer::instance()->postEvent(local_tag, new
MyAmEvent(params)), and in your session in the MyAmSession::process
routine, you check for your events.
By the way, how it is possible to define silence?
what do you mean by 'define'? or detect? if you don't want to send
RTP, you can use rtp_str->mute() or rtp_str->setOnHold() +
sendReinvite(). if you want to output silence, just write zeroes in
the buffer, or use AmPlaylist and don't put anything in the play
position of the entry. ATM there is no code to detect silence though.
Stefan
Thanks.
--
Stefan Sayer
VoIP Services Consulting and Development
Warschauer Str. 24
10243 Berlin
tel:+491621366449
sip:[email protected]
email/xmpp:[email protected]
_______________________________________________
Sems mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/sems