# How to continuously put network PCM data into fmod system

**URL:** https://qa.fmod.com/t/how-to-continuously-put-network-pcm-data-into-fmod-system/14391
**Category:** FMOD Engine
**Created:** [February 26, 2019, 11:15am UTC](https://qa.fmod.com/t/how-to-continuously-put-network-pcm-data-into-fmod-system/14391 "2019-02-26T11:15:48Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![grin](https://avatars.discourse-cdn.com/v4/letter/g/aca169/32.png) [@grin](https://qa.fmod.com/u/grin)
#### Post date: [February 26, 2019, 11:15am UTC](https://qa.fmod.com/t/how-to-continuously-put-network-pcm-data-into-fmod-system/14391/1 "2019-02-26T11:15:49Z")

</div>

Hi, I tried to use fmod in QT to obtain the PCM data transmitted from TCP and draw it.  
However, difficulties were encountered in the real-time transmission of PCM .The PCM data retrieved from the network is stored in QByteArray &buffer,but I have no idea about how to get the buffer into fmod’s system with as little memory footprint as possible.  
I have tried as follow, FMOD\_SYSTEM and FMOD\_CREATESOUNDEXINFO has been declared before.every time the net recieves data, the function will be called.  
void AudioPlot::recvData(const QString &ip, const QByteArray &buffer)  
{  
result = FMOD\_System\_CreateSound(system,buffer.data(), FMOD\_OPENMEMORY, &exinfo, &sound);  
uint bytes, len1, len2;  
void \*ptr1, \*ptr2;  
FMOD\_Sound\_GetLength(sound, &bytes, FMOD\_TIMEUNIT\_PCMBYTES);  
FMOD\_Sound\_Lock(sound, 0, bytes, &ptr1, &ptr2, &len1, &len2);

```
    bytes /= 2;
    int step = 1, len = bytes;
    QVector<float>wavAll(len);
    short* ps = (short*)ptr1;
    for (int i = 0, n = 0; n< len; i += step, n++)
        wavAll[n] = ps[i];
    FMOD_Sound_Unlock(sound, ptr1, ptr2, len1, len2);
    FMOD_Sound_Release(sound);
    ui->widPCMplot->outPut(wavAll);

```

}  
but didn’t show anything.

---

<div class="post-metadata">

### Author: ![brett](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/brett/32/261_2.png) [@brett](https://qa.fmod.com/u/brett)
#### Post date: [March 4, 2019, 4:47am UTC](https://qa.fmod.com/t/how-to-continuously-put-network-pcm-data-into-fmod-system/14391/2 "2019-03-04T04:47:06Z")

</div>

Why did you create an FMOD Sound at all? It looks like you have the data, pass it to fmod just to get the data back again and then delete the sound?  
I would just cut out the fmod part and iterate through the buffer.data()
