Send sound to serial object / 56k modem

Jan 19, 2012 at 7:18pm

Send sound to serial object / 56k modem

Hi,

First post. I’ll try to do my best.
Max and a 56k voice modem are talking together pretty well in data mode.
Now I’d like to send 8 bits PCM files to the modem but I can’t find which sound object can be accepted by the serial object..
Can someone help me ?

Thanx. yra.

#61341
Jan 23, 2012 at 8:13am

Hello again,

Maybe I’m talking to myself but this might help someone, one day.
When the modem is in record mode it sends something to the serial object which sounds like ascii code (and which reacts to my voice on the phone). I don’t get how to translate it into sound but I’m still trying.
To be continued..

#221134
Jan 27, 2012 at 11:55am

Ok.

With the record mode I don’t receive ascii code but audio bytes I guess.
When I don’t talk to the phone, silence is like this :
127, 127, 128, 127, 127, 128, 127, 128, 128
And when I start talking :
96, 97, 107, 129, 136, 151, 149, 139, 146, 107, 115, 120, 141, 120, 134
What should I do with this ?
I can produce some modulations with [sig~] but can’t really recognize my voice.. Problem of frequency ?
Any idea ?

#221135
Jan 27, 2012 at 3:42pm

Try subtracting 127, divide by 128 and stuff bytes in a buffer using peek~, incrementing index. You should get a recognizable waweform. Then use groove~ to play the buffer at proper sample rate (it should be around 8000Hz).

http://en.wikipedia.org/wiki/Voice_modem_command_set

#221136
Jan 29, 2012 at 10:48am

That’s it ! It works very fine. peek~ is THE solution. Thanks a lot !

I think I have managed the frequency aspect in a dirty way but it works.

– Pasted Max Patch, click to expand. –

Now I’m working on the opposite way : how to send audio to the modem…
It doesn’t work with a [snapshot~], going from the float number *127 +127.
Maybe I should go through a buffer too.

#221137
Jan 29, 2012 at 4:08pm

Yes, you should peek~ (in read mode) one sample over 6, supposing your DSP runs at 48000 and the modem sample rate is 8000Hz. Make sure your audio has no spectral content over 4000, otherwise you will get aliasing.

Scale to [0..255] and send to serial. There is a flow-control protocol to handle at this point (stuffing bytes faster than the modem can handle will overrun it). Refer to “Voice modem command set”. If the modem uses CTS flow-control, you may be in trouble with Cycling’s serial object. Jasch’s comport is an alternative.

#221138
Jan 31, 2012 at 8:22am

I have a conexant chipset which deals pretty well with overflow. I just have to terminate audio transmission before hanging up, otherwise serial object crashes.

Here is a way to send audio to the serial object for a conexant 56k V.92 modem (works with files which are already in PCM 8bits 8000Hz, same format selected on modem parameters, didn’t try other possbilities).

– Pasted Max Patch, click to expand. –

Thanks again Mister Bernier, I was on a wrong way, couldn’t manage without your help !

#221139
Jun 28, 2012 at 1:52pm

Hello yra,

I’m for days looking for a solution to my problem. I found this topic (http://cycling74.com/forums/topic.php?id=37642) and I think you have the solution.

I’m trying to play a sound over the modem. It works pretty well in the first 10 seconds. After 10 seconds, the sound “skip” and then crashes (mute). I think the modem begins overflow. My file has about 300kb, mono, u-law, 8000 sample rate, 8bits. My modem has a Conexant chipset (CX93010), USB.

Can you share how do you do it? Follows the code I’m trying.

InputStream stream = new InputStream(new File(“C:\Greeting3.wav”));

boolean eof = false;

while(!eof)
{
byte[] b;
b = new byte[512];
int input = stream.read(b);

if(input > 0) {
//outputStream.write(b, 0, input);
}

if(input == -1){
eof = true;
}
}

stream.close();

#221140

You must be logged in to reply to this topic.