Author Topic: [Release] libvitaSAS - Easy-to-use SceSas and Audiodec library wrapper  (Read 1357 times)

Offline Graphene

  • End User
  • *
  • Posts: 41
    • View Profile
SAS is a library for performing synthesizer processing with software. Some of the functions are hardware accelerated using codec engine.
Audiodec is a library for decoding audio data with a Codec Engine.

libvitaSAS is easy-to-use SceSas and Audiodec library wrapper with system mode applications support.
Loading directly from FIOS2 overlay (for example, loading directly from PSARC archive) is supported. When calling vitaSAS_load_audio_XXX() specify 1 for io_type to use FIOS2 or 0 to use SceIo.

sceSas supports up to 31 voices simultaneous playback.
Pitch, panning, envelope processing and digital effects processing can be done.

Native SAS playback:

Only HE-ADPCM (.vag) and PCM (.pcm) files are supported.

Codec Engine hardware decoding and playback:

Supported input formats (all application modes):

ATRAC9
Supported channels : 1 channel, 2 channels
Supported sampling frequencies : 12000/ 24000/ 48000 Hz
Supported bit rates : 48/ 60/ 70/ 84/ 96/ 120/ 144/ 168/ 192 kbps

AAC
Supported codecs : AAC-LC, HE-AAC v1/v2
Supported channels : 1 channel, 2 channels
Supported sampling frequencies : 8000/ 11025/ 12000/ 16000/ 22050/ 24000/ 32000/ 44100/ 48000 Hz
Supported bit rates : 16 - 576 kbps

Supported input formats (game applications only):

MP3
Supported codecs : MPEG1/ 2/ 2.5 Layer3
Supported channels : 1 channel, 2 channels
Supported sampling
frequencies: 8000/ 11025/ 12000/ 16000/ 22050/ 24000/ 32000/ 44100/ 48000 Hz
Supported bit rates : 8/ 16/ 24/ 32/ 40/ 48/ 56/ 64/ 80/ 96/ 112/ 128/ 144/ 160/ 192/ 224/ 256/ 320 kbps

Github: https://github.com/GrapheneCt/libvitaSAS
« Last Edit: April 20, 2020, 03:35:00 AM by Graphene »

Offline Graphene

  • End User
  • *
  • Posts: 41
    • View Profile
Re: [Release] libvitaSAS - Easy-to-use SceSas library wrapper
« Reply #1 on: April 07, 2020, 05:26:51 PM »
libvitaSAS has been updated:
- Fixed grain value handling.
- Added noise generator voice type.
- Added ability to set DSP effects.
- Updated sample with DSP demo, added comments.

Offline Graphene

  • End User
  • *
  • Posts: 41
    • View Profile
Re: [Release] libvitaSAS - Easy-to-use SceSas library wrapper
« Reply #2 on: April 10, 2020, 11:49:10 PM »
libvitaSAS has been updated:
-Added hardware ATRAC9 decoding using Codec Engine
-Added hardware AAC decoding using Codec Engine

All playback related functions are non-blocking type except void vitaSAS_decode_to_buffer(). Both decoder playback and native SAS playback can be used at the same time.

Some usage examples:

1. Native SAS playback with hall DSP effect:

vitaSAS_init(SCE_AUDIO_OUT_PORT_TYPE_MAIN, GRAIN, SAS_THREAD_PRIORITY, SAS_THREAD_STACK, SAS_THREAD_AFFINITY);
vitaSASAudio* testAudio = vitaSAS_load_audio_VAG("app0:test.vag");
vitaSAS_set_voice_VAG(0, testAudio, SCE_SAS_LOOP_ENABLE, PITCH, DRY_L_VOLUME, DRY_R_VOLUME, WET_L_VOLUME, WET_R_VOLUME, ADSR1, ADSR2);
vitaSAS_set_effect(SCE_SAS_FX_TYPE_HALL, WET_L_VOLUME, WET_R_VOLUME, 0, 0);
sceSasSetKeyOn(0);

2. ATRAC9 decode + playback:

VitaSAS_Decoder* newDecoder = vitaSAS_create_AT9_decoder("app0:test.at9", VITASAS_USE_PHYCONT_MEMORY);
vitaSAS_decoder_start_playback(newDecoder, DEC_THREAD_PRIORITY, DEC_THREAD_STACK, DEC_THREAD_AFFINITY);

3. Simultaneous AAC decode + playback and Native SAS playback:

vitaSAS_init(SCE_AUDIO_OUT_PORT_TYPE_MAIN, GRAIN, SAS_THREAD_PRIORITY, SAS_THREAD_STACK, SAS_THREAD_AFFINITY);
vitaSASAudio* testAudio = vitaSAS_load_audio_VAG("app0:test.vag");
vitaSAS_set_voice_VAG(0, testAudio, SCE_SAS_LOOP_ENABLE, PITCH, DRY_L_VOLUME, DRY_R_VOLUME, WET_L_VOLUME, WET_R_VOLUME, ADSR1, ADSR2);
vitaSAS_set_effect(SCE_SAS_FX_TYPE_HALL, WET_L_VOLUME, WET_R_VOLUME, 0, 0);

VitaSAS_Decoder* newDecoder = vitaSAS_create_AAC_decoder("app0:test.aac", VITASAS_USE_PHYCONT_MEMORY);

sceSasSetKeyOn(0);
vitaSAS_decoder_start_playback(newDecoder, DEC_THREAD_PRIORITY, DEC_THREAD_STACK, DEC_THREAD_AFFINITY);

4. Decode mono AAC file to memory buffer, than play it back with SAS and add hall DSP effect:

uint8_t* pBuf = sceClibMspaceMemalign(mspace, SCE_AUDIODEC_ALIGNMENT_SIZE, SCE_AUDIODEC_ROUND_UP(bufSize));
VitaSAS_Decoder* newDecoder = vitaSAS_create_AAC_decoder("app0:test.aac", VITASAS_USE_PHYCONT_MEMORY);
vitaSAS_decode_to_buffer(newDecoder, 0, 1024 * 8, pBuf);

vitaSASAudio* newAudio = vitaSAS_load_audio_custom(pBuf, 1024 * 9);
vitaSAS_set_voice_PCM(0, newAudio, SCE_SAS_LOOP_DISABLE_PCM, PITCH, DRY_L_VOLUME, DRY_R_VOLUME, WET_L_VOLUME, WET_R_VOLUME, ADSR1, ADSR2);
vitaSAS_set_effect(SCE_SAS_FX_TYPE_HALL, WET_L_VOLUME, WET_R_VOLUME, 0, 0);
sceSasSetKeyOn(0);

« Last Edit: April 20, 2020, 05:50:27 PM by Graphene »

Offline Graphene

  • End User
  • *
  • Posts: 41
    • View Profile
libvitaSAS has been updated:
-Added partial hardware MP3 decoding support using Codec Engine
-Added fast PCM channel separation function using Arm Neon
-Added ability to use main memory for decoding
« Last Edit: April 12, 2020, 02:05:36 AM by Graphene »

Offline Graphene

  • End User
  • *
  • Posts: 41
    • View Profile
libvitaSAS has been updated:
- Loading .vag and .pcm files using FIOS2 overlay is now supported (for example, loading directly from PSARC archive). When calling vitaSAS_load_audio_XXX() specify 1 for io_type to use FIOS2 or 0 to use SceIo.