Send sound to serial object / 56k modem

    Jan 19 2012 | 7:18 pm
    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.

    • Jan 23 2012 | 8:13 am
      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..
    • Jan 27 2012 | 11:55 am
      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 ?
    • Jan 27 2012 | 3:42 pm
      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).
    • Jan 29 2012 | 10:48 am
      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.
      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.
    • Jan 29 2012 | 4:08 pm
      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.
    • Jan 31 2012 | 8:22 am
      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).
      Thanks again Mister Bernier, I was on a wrong way, couldn't manage without your help !
    • Jun 28 2012 | 1:52 pm
      Hello yra,
      I'm for days looking for a solution to my problem. I found this topic ( 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;
      byte[] b;
      b = new byte[512];
      int input =;
      if(input > 0) {
      //outputStream.write(b, 0, input);
      if(input == -1){
      eof = true;