Another UNIX-based approach:
The environment variable LD_PRELOAD can be used to override any shared library with which the executable was associated. All characters exported by the library specified in LD_PRELOAD are allowed for this library, including calls to libc functions such as open , read and close . Using libdl, the wrapper library can also be called into the original implementation.
So, all you have to do is start a process that uses the Hekkus sound system in an environment where LD_PRELOAD is set appropriately, and you can do whatever you like in the file that it reads.
Please note, however, that you absolutely cannot keep the data inaccessible to the user: the fact that he must be able to hear means that he must have access. Even if all the software in the chain uses encryption, and your user does not want to hack the hardware, it would not be difficult to connect the audio output to the audio input jack, right? And you cannot forbid the user to use earphones, right? And, of course, the kernel can see all the audio output unencrypted and can send a copy to another location ...
source share