# What's the format of \`AUDIO\_S16SYS'?

**URL:** <https://discourse.libsdl.org/t/whats-the-format-of-audio-s16sys/12813>\
**Category:** SDL Development\
**Created:** [December 8, 2005, 6:48am UTC](https://discourse.libsdl.org/t/whats-the-format-of-audio-s16sys/12813 "2005-12-08T06:48:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sigsegv11](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/s/278dde/32.png) [@sigsegv11](https://discourse.libsdl.org/u/sigsegv11)\
**Post date:** [December 8, 2005, 6:48am UTC](https://discourse.libsdl.org/t/whats-the-format-of-audio-s16sys/12813/1 "2005-12-08T06:48:44Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

Hi, people:

```
I'm quite new to audios, could anyone please tell me what's the format

```

of `AUDIO\_S16SYS’? Are they ADPCM samples? I’ve seem some audio  
decoder(such as ffmpeg) send the decoded stream and then use SDL to  
display sound:

```
/* prepare audio output */
if (enc->codec_type == CODEC_TYPE_AUDIO) {
    wanted_spec.freq = enc->sample_rate;
    wanted_spec.format = AUDIO_S16SYS;
    /* hack for AC3. XXX: suppress that */
    if (enc->channels > 2)
        enc->channels = 2;
    wanted_spec.channels = enc->channels;
    wanted_spec.silence = 0;
    wanted_spec.samples = SDL_AUDIO_BUFFER_SIZE;
    wanted_spec.callback = sdl_audio_callback;
    wanted_spec.userdata = is;
    if (SDL_OpenAudio(&wanted_spec, &spec) < 0) {
        fprintf(stderr, "SDL_OpenAudio: %s\n", SDL_GetError());
        return -1;
    }
    is->audio_hw_buf_size = spec.size;
}

Sorry for my bad english -_-

```

* * *

- 
  - sigsegv  
-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1.4.2 (MingW32)

iD8DBQFDl9dMzm46SfqoYmQRAjeMAKCkROtGKLPZmio3MXeW+aW83PrFRwCeJZI1  
rBTE9dEdhnkzFDvQf+WQbFY=  
=Pxda  
-----END PGP SIGNATURE-----

---

<div class="post-metadata">

**Author:** ![icculus](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/icculus/32/81_2.png) [@icculus](https://discourse.libsdl.org/u/icculus)\
**Post date:** [December 8, 2005, 9:39am UTC](https://discourse.libsdl.org/t/whats-the-format-of-audio-s16sys/12813/2 "2005-12-08T09:39:16Z")

</div>

> I’m quite new to audios, could anyone please tell me what’s the format  
> of `AUDIO\_S16SYS’? Are they ADPCM samples? I’ve seem some audio  
> decoder(such as ffmpeg) send the decoded stream and then use SDL to  
> display sound:

They are raw samples (“PCM”), signed 16 bit integers per channel (so 32  
bits per sample frame if you’re in stereo mode, etc), and in the byte  
order of the platform running the program.

SDL by itself doesn’t decode most higher-level formats (just  
uncompressed .WAV, IMA-ADPCM and MS-ADPCM .WAV in SDL\_LoadWAV)…if you  
want to handle any serious formats, like MP3 or OGG, you have to look  
elsewhere for something to build on top of SDL…SDL mostly just plays  
noise, but supplying the noise is up to the application.

–ryan.

---

<div class="post-metadata">

**Author:** ![sigsegv11](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/s/278dde/32.png) [@sigsegv11](https://discourse.libsdl.org/u/sigsegv11)\
**Post date:** [December 8, 2005, 10:37am UTC](https://discourse.libsdl.org/t/whats-the-format-of-audio-s16sys/12813/3 "2005-12-08T10:37:21Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

Ryan C. Gordon wrote:

> > I’m quite new to audios, could anyone please tell me what’s the format  
> > of `AUDIO\_S16SYS’? Are they ADPCM samples? I’ve seem some audio  
> > decoder(such as ffmpeg) send the decoded stream and then use SDL to  
> > display sound:
> 
> They are raw samples (“PCM”), signed 16 bit integers per channel (so 32  
> bits per sample frame if you’re in stereo mode, etc), and in the byte  
> order of the platform running the program.
> 
> SDL by itself doesn’t decode most higher-level formats (just  
> uncompressed .WAV, IMA-ADPCM and MS-ADPCM .WAV in SDL\_LoadWAV)…if you  
> want to handle any serious formats, like MP3 or OGG, you have to look  
> elsewhere for something to build on top of SDL…SDL mostly just plays  
> noise, but supplying the noise is up to the application.
> 
> –ryan.
> 
> * * *
> 
> SDL mailing list  
> SDL at [libsdl.org](http://libsdl.org)  
> [http://www.libsdl.org/mailman/listinfo/sdl](http://www.libsdl.org/mailman/listinfo/sdl)

Thanks Ryan, the answer is exactly what I need :=)

* * *

- 
  - sigsegv  
-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1.4.2 (MingW32)

iD8DBQFDmAzhzm46SfqoYmQRAi7FAKCSlcuZ90KyILvYvzRXccK0BW+aogCgkd+x  
LAOFXCBVYj6Y/Fbi9jOBgrU=  
=0iIb  
-----END PGP SIGNATURE-----
