# CreateSoundFromMemblock

## Description

Creates an sound from a memblock. The memblock must exist, this creates a new sound and returns the ID. This will not affect any sound instances already playing, only future ones. The first 2 bytes of the memlbock store the number of channels (1 or 2 supported), the next 2 bytes store the bits per sample (8 or 16 supported), the next 4 bytes store the samples per second, for example 44100. The next 4 bytes are the number of frames in the sound data, the size of the sound data in bytes can be calculated from this with the formula numFrames*(bitsPerSample/8)*channels. In a 2 channel sound a frame contains 2 samples, one for each channel. In a mono sound a frame contains 1 sample. The rest of the memblock is raw sound data, for example in an 8bit stereo sound with 3 frames the raw data would look like this. byte offset 0 = Frame 1, left channel data byte offset 1 = Frame 1, right channel data byte offset 2 = Frame 2, left channel data byte offset 3 = Frame 2, right channel data byte offset 4 = Frame 3, left channel data byte offset 5 = Frame 3, right channel data Returns the ID of the new sound.

## Definition

integer CreateSoundFromMemblock( memID )

UINT agk::CreateSoundFromMemblock( UINT memID )

CreateSoundFromMemblock( soundID, memID )

void agk::CreateSoundFromMemblock( UINT soundID, UINT memID )

## Parameters

- memID - The ID of the memblock to read, the memblock is unaffected by this command.
- soundID - The ID of the sound to create or modify.