Homebrew [POC][Developer-Only] Background 3ds mp3 player

Kartik

Well-Known Member
OP
Member
Joined
Jun 6, 2015
Messages
622
Trophies
0
Location
github
XP
1,850
Country
India
What is this:-
People for the longest time have wanted to play mp3(s) while games are running. Up until now, it was unknown whether this was possible, but as it turns out it is possible to do this.As anyone who has developed for 3ds before, should know that 3ds has two ways of playing audios, one through CSND and one through DSP. Apparently, it is possible to use CSND with modules to play music.

Attached is a functional POC of the music player, it just plays a mp3 off your sd card. You need to put a mp3 file named as `sound.mp3` on the root of your sd card and then enable game patching. I rewrote the PDN sysmodule, so now it spawns a thread in appcore for mp3 decoding and playing. The POC works (atleast on n3ds, for o3ds you might need to change appcore to syscore or change the prio) but not smoothly, every time the system/game spawns a new thread there is a small break in audio due to the audio thread freezing and there are constant "pop" sounds. My guess is the audio decoding and playing code will need soft-tuning(do note I'm not the best when it comes to audio stuff). The code for the POC is located here:- https://github.com/hax0kartik/3ds_pdn/tree/music-player.


Notes:-
  • Please remove patches for any other sysmodule before trying this as they can cause issues.
  • It might be better if we do not use PDN for our purposes but create a entirely new sysmodule which will be launched by the homebrew audio player app.
  • 3ds sleep mode will be broken by this, you'll need to restart your console.
  • On a n3ds, enabling "Clock + L2C" seems to make the code run a bit more smoother.
I hope the scene will be able to work its magic and fix the issues my POC has and then incorporate the code in other homebrew audio players!:yay3ds:

Also if you test this and if this works/does not work for you, please let me know!
 

Attachments

  • 0004013000002102.zip
    173 KB · Views: 38
Last edited by Kartik,

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
33,867
Trophies
2
Website
trastindustries.com
XP
22,600
Country
United Kingdom
Shiny. Always liked being able to play own audio during games so nice to see you don't have to necessarily get down and dirty with the games themselves for this one.

Wonder whether this will be able to stick as a generic plugin or if it will be better to go for a more low power audio codec -- SD card space relative to such things is not a great concern these days really.

I should also note that various game undub, dubbing and music replacement types might appreciate a way for the game itself to reach out and touch something or trigger playback of specific files from within a set. It is not my favourite approach to ROM hacking but it is effective and seemingly can be done on hardware so there is that.
 

Wavy

Ayayayaya
Member
Joined
Aug 24, 2020
Messages
214
Trophies
0
Location
MAP13: Downtown
XP
691
Country
Australia
It doesn't loop the mp3, and the sound starts playing before even the home menu starts, how were you able to use this with ctrquake? :P
I haven't actually tried this on my 3DS yet. I just saw that you released this and I thought that I could have the Quake MP3's play. Still cool though
 

Kartik

Well-Known Member
OP
Member
Joined
Jun 6, 2015
Messages
622
Trophies
0
Location
github
XP
1,850
Country
India
I haven't actually tried this on my 3DS yet. I just saw that you released this and I thought that I could have the Quake MP3's play. Still cool though
Well what you're trying is not completely impossible to do. You'll need to recompile ctrquake as well ad the POC though.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
    The Real Jdbye @ The Real Jdbye: 🍆 +3