Skip to content

feat: add sceSasCore library#359

Merged
sharkwouter merged 17 commits intopspdev:masterfrom
IsaacTCB:add-sascore
Apr 20, 2026
Merged

feat: add sceSasCore library#359
sharkwouter merged 17 commits intopspdev:masterfrom
IsaacTCB:add-sascore

Conversation

@IsaacTCB
Copy link
Copy Markdown
Contributor

@IsaacTCB IsaacTCB commented Apr 15, 2026

This pull-request adds stubs, prototypes and documentation for the sceSasCore library, the official SCE's audio software mixer that runs on the Media Engine CPU. This API not only makes mixing trivial, but also grants .vag playback and reverb effects with ease.

Changes

  • Added "pspsascore" stub library.
  • Added header: "pspsascore.h", exposing all sceSasCore functions.
    • Contains annotations for almost all __sceSas function prototypes (29 out of 32) describing their behavior to the best of my understanding.
  • Added new documentation topic: "SAS Core Audio Library".
  • Created sample "sascore" to demonstrate some of sceSasCore's capabilities.

Notes

  • The research/reimplementation done by the PPSSPP guys (referenced below) were used as basis, alongside tests I did on real hardware. The remaining undocumented functions are all ATRAC3-related and no further studies on them were done by me.

  • All function names are intentionally prefixed with double underscores (__). That's because SCE didn't intend these APIs to be used directly, but rather through the higher-level wrapper from the official PSP SDK (presumably called "sceSas"). Despite this, there's no special requirements to use the library's functionality.

Tested on

  • PSP 3000 with ARK-4.

I also made sure that no new Doxygen warnings were introduced.

Reference Material

IsaacTCB added 11 commits April 13, 2026 18:14
Adds prototypes for SceSasCore functions.
also removes an extra blankline
makes comment reference PSP_SAS_NOISE_FREQ_MAX
also removes blankline
changed the annotation of the square's duty cycle parameter to improve its wording.
clarified the loop parameter documentation to specify that the VAG file must contain the end loop flag for looping to work.
added a basic doxygen group (topic) for sceSasCore stuff, called "SAS
Core Audio Library".
@rofl0r
Copy link
Copy Markdown
Contributor

rofl0r commented Apr 15, 2026

All function names are intentionally prefixed with double underscores (__). That's because SCE didn't intend these APIs to be used directly

so these are __ prefixed in the cracked hashes too?

would be quite practical to have a code example that illustrates the usage of these new APIs.

@IsaacTCB
Copy link
Copy Markdown
Contributor Author

so these are __ prefixed in the cracked hashes too?

Yes. All function names matches their NID hashes, with the only exception being __sceSasSetTriangularWave, which is a function alias of __sceSasSetTrianglarWave added by me.

would be quite practical to have a code example that illustrates the usage of these new APIs.

I'll look into making a sample for this.

this description seems more fitting.
adds a sample that demonstrates how to use sceSasCore. Contain a couple
of sounds created by me, too.
attempt to fix a hard-to-reproduce bug where the vag fanfare sound
crackles shortly before loop.
@IsaacTCB
Copy link
Copy Markdown
Contributor Author

Okay, so I made a quick sample project showcasing the library. It explains all basic functionality a developer might want to know, such as initialization code, playing multiple sounds at once, toggling reverb effects, outputting sound, and more. The sample also comes with 2 audio files: sound.pcm.raw and fanfare.vag, which were made by me for the public domain.

test

Screenshot taken from my hardware

The sample runs only on the main thread, which isn't great because of blocking audio functions, but its fine enough for a simple demo.

I also added a README.md file inside the sample's folder, containing info and links to psxavenc, the open-source VAG encoder software I've used to generate fanfare.vag. If external links are a problem, then please tell me so I can remove it.

… loop

attempt pspdev#2 to fix the fanfare.vag loop crackling situation. If this
doesn't fix it, then it's probably bc we are mixing/outputting the sound
on the main thread.
- code cleanup.
- ensure AudioClip->ptr is NULL when load fails.
- don't hardcode loop on vag audio.
- use (void) on parameter-less functions.
- use left asterisk placement.
@bucanero bucanero requested a review from sharkwouter April 16, 2026 16:45
@bucanero
Copy link
Copy Markdown
Contributor

bucanero commented Apr 16, 2026

thanks for the PR and the sample showing how to use this sasCore library 👍

everything LGTM, but just in case I'm tagging @sharkwouter for his feedback, before merging changes

@sharkwouter sharkwouter merged commit 46dfad3 into pspdev:master Apr 20, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants