ATRAC3 Player Sample

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

moonlight
Posts: 567
Joined: Wed Oct 26, 2005 7:46 pm

ATRAC3 Player Sample

Post by moonlight »

This is a sample showing a simple atrac3 player using the libatrac3plus from the firmware.

Warning (to avoid confussion): the use of the libatrac3plus library functions was deduced with a bit of reverse engeneering in the own library and how a game was using it, by hooking calls to the functions and inspecting how the parameters evolved (psplink was of great help, thanks Tyranid for making that beautiful tool)

This program does not pretend to be a serious player, it's only a sample on how to use the sceATRAC3plus_Library, and it may have some bugs or incorrect code.

Third version changes:
- use of sceAtracGetMaxSample to find the appropiated channel size.

http://www.megaupload.com/?d=87UL06DC

Second version changes:
- the bug of the threads not created is gone
- recompiled making use of pspatrac3.h/libpspatrac3 included by Tyranid in the PSPSDK this week.
- faster search of files by filtering extensions (it will search only at3, pbp, toc, a3p and wav)

http://rapidshare.de/files/18713456/AT3 ... 2.zip.html

First Version:
http://rapidshare.de/files/18292583/at3player.zip.html
Last edited by moonlight on Mon May 01, 2006 8:08 pm, edited 7 times in total.
User avatar
dot_blank
Posts: 498
Joined: Wed Sep 28, 2005 8:47 am
Location: Brasil

Post by dot_blank »

wow amazing!
this is an excellent reversal
my hat goes offf to you
10011011 00101010 11010111 10001001 10111010
weltall
Posts: 310
Joined: Fri Feb 20, 2004 1:56 am
Contact:

Post by weltall »

good work :)
weak
Posts: 114
Joined: Thu Jan 13, 2005 8:31 pm
Location: Vienna, Austria

Post by weak »

excellent
jonny
Posts: 351
Joined: Thu Sep 22, 2005 5:46 pm
Contact:

Post by jonny »

awesome!
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

Ive put the atrac3 stubs into pspsdk and shameless c&p the function prototypes from moonlights sample. However as these are user mode functions they are close to useless for normal elfs :) So youll either have to do the function fixup trick as shown in the sample or preload the atrac library before your user mode application :)
TheHorst
Posts: 12
Joined: Thu Apr 13, 2006 10:11 pm

Post by TheHorst »

very nice ...

just one queation, why does it stop playing the at3s after u have played 5 or 6?

does this only happen to me??
i´ve compiled your sample ...
w0lv3121n3
Posts: 2
Joined: Wed Apr 19, 2006 10:20 am

Post by w0lv3121n3 »

Well done!
I was wondering, does this let us play Atrac files in our 1.5 psp?
weltall
Posts: 310
Joined: Fri Feb 20, 2004 1:56 am
Contact:

Post by weltall »

yes
thanatos
Posts: 2
Joined: Wed Apr 19, 2006 6:49 pm

Post by thanatos »

:P come on ,have further try
__count
Posts: 22
Joined: Thu Mar 23, 2006 8:40 pm

Post by __count »

Any clues on the performance of this built in lib? Does it look like it outperforms libmad?
thanatos wrote::P come on ,have further try
?
weak
Posts: 114
Joined: Thu Jan 13, 2005 8:31 pm
Location: Vienna, Austria

Post by weak »

as i understand it atrac is decoded through the ME. so actually it should free all cpu time libmad uses for audio decoding?
Mathieulh
Posts: 67
Joined: Wed Oct 19, 2005 3:31 am

Post by Mathieulh »

It's a great reverse engeneering job you've done here moonlight, Although it would be more interesting to reverse engeneer the way the psp play AVC files (while playing a pmf or a mps (UMD Video) ) as the psp uses AVC hardware decoding so it can play smoothly any avc file at 222mhz and probably in user mode.
Then we could play avc videos at 480x272 witch would be great considering that avc is a great video format.
moonlight
Posts: 567
Joined: Wed Oct 26, 2005 7:46 pm

Post by moonlight »

Mathieulh wrote:It's a great reverse engeneering job you've done here moonlight, Although it would be more interesting to reverse engeneer the way the psp play AVC files (while playing a pmf or a mps (UMD Video) ) as the psp uses AVC hardware decoding so it can play smoothly any avc file at 222mhz and probably in user mode.
Then we could play avc videos at 480x272 witch would be great considering that avc is a great video format.
In fact i was thinking of taking a look on how the firmware decodes the MP4 files (using the sceMpeg i suppose), and see if somekind of patch could be done to play 480x272 MP4 through the firmware.
But this will be probably harder this time, we don't have all the NIDS :(
http://pspdev.ofcode.com/api2.0/index.php?type=2&id=76

But well, i suppose that one does loose nothing for trying ;)
Mathieulh
Posts: 67
Joined: Wed Oct 19, 2005 3:31 am

Post by Mathieulh »

Well the problem is that 1.50 fw can only natively play MP4 SP files and the mpeg4 SP codec sucks, the highest quality file encoded with the SP format at 480x272 takes a LOT of space (about 200MB for 30 minutes of playback) while avc videos would be even lighter than pmp files (xvid/divx muxed with mp3 track) and would take much less ressources considering the fact that the psp features avc h.264 hardware decoding, in fact the avc codec allready exists in 1.00/1.50 and is beeing used while playing pmfs or UMD Video, it's only because sony wanted to promote the umd videos that they didn't input the avc playback feature from memory stick directly in the firmware (they finally did with 2.00 because they wanted people to update their psp systems)
weak
Posts: 114
Joined: Thu Jan 13, 2005 8:31 pm
Location: Vienna, Austria

Post by weak »

i'm just wondering how it's possible to encode your own at3 files.

i tried that horrible sonic stage software from sony. you can convert your files to atrac3/atrac3plus with .oma ending. (maybe another container? i've got no idea).
but doesn't seem like those files are recognized as atrac3 files.

anyone managed to convert and play some files?

edit:

just used this tool and it works great. thx jouni ;)
weak
Posts: 114
Joined: Thu Jan 13, 2005 8:31 pm
Location: Vienna, Austria

Re: ATRAC3 Player Sample

Post by weak »

moonlight wrote: - There is a bug in which sometimes one of the threads cannot be created because the previous copy of the thread is already running (probably, because of a deadlock).
seems like you have to delete the threads after they've finished (although you explicitly wait for end):

Code: Select all

sceKernelWaitThreadEnd(playth, NULL);
sceKernelWaitThreadEnd(decodeth, NULL);
+sceKernelDeleteThread(playth);
+sceKernelDeleteThread(decodeth);
fixes it for me
moonlight
Posts: 567
Joined: Wed Oct 26, 2005 7:46 pm

Re: ATRAC3 Player Sample

Post by moonlight »

weak wrote:
moonlight wrote: - There is a bug in which sometimes one of the threads cannot be created because the previous copy of the thread is already running (probably, because of a deadlock).
seems like you have to delete the threads after they've finished (although you explicitly wait for end):

Code: Select all

sceKernelWaitThreadEnd(playth, NULL);
sceKernelWaitThreadEnd(decodeth, NULL);
+sceKernelDeleteThread(playth);
+sceKernelDeleteThread(decodeth);
fixes it for me
Thanks for pointing that out! Probably i'll rewrite it tomorrow or the next day fixing that and using the new pspatrac3.h header that Tyranid has added to the pspsdk.
w0lv3121n3
Posts: 2
Joined: Wed Apr 19, 2006 10:20 am

Post by w0lv3121n3 »

how come it doesnt detect the atrac files i put in my psp?
majinboo
Posts: 4
Joined: Sat Apr 15, 2006 7:06 pm
Location: France
Contact:

Post by majinboo »

w0lv3121n3 wrote:how come it doesnt detect the atrac files i put in my psp?
Maybe you put some *.oma files that can't be read by the PSP. You need to use EAC PSP Edition to make your atrac3 files for the PSP.
There are only 10 types of people in the world: Those who understand binary, and those who don't !
moonlight
Posts: 567
Joined: Wed Oct 26, 2005 7:46 pm

Post by moonlight »

I've updated the sample. (see the first post).
majinboo
Posts: 4
Joined: Sat Apr 15, 2006 7:06 pm
Location: France
Contact:

Post by majinboo »

It seems that the new version doesn't detect .toc fils. These files are Atrac3 files created with EAC PSP Edition. The first version is able to play these files without any problems.
There are only 10 types of people in the world: Those who understand binary, and those who don't !
moonlight
Posts: 567
Joined: Wed Oct 26, 2005 7:46 pm

Post by moonlight »

majinboo wrote:It seems that the new version doesn't detect .toc fils. These files are Atrac3 files created with EAC PSP Edition. The first version is able to play these files without any problems.
Ok, now it's fixed and updated the link. I didn't know that extension.
majinboo
Posts: 4
Joined: Sat Apr 15, 2006 7:06 pm
Location: France
Contact:

Post by majinboo »

moonlight wrote:
majinboo wrote:It seems that the new version doesn't detect .toc fils. These files are Atrac3 files created with EAC PSP Edition. The first version is able to play these files without any problems.
Ok, now it's fixed and updated the link. I didn't know that extension.
So fast ! Thanks for your work.
There are only 10 types of people in the world: Those who understand binary, and those who don't !
firun
Posts: 3
Joined: Tue Jul 12, 2005 9:55 pm
Location: Russia, Saint-Petersburg

Problem loading a3p files from UMD

Post by firun »

In second version I've noticed that it loads only one file from disc (at least on Metal Gear Ac!d UMD)... In first version everything was alright. But of course, as I noticed on other UMDs, the reading speed increased.


And I have a little question about another your program -- PSP Audio Recorder -- it seems that it can't execute Atrac3 Sample Player from Homebrew dir, but I tried only the first release of Atrac3 Player, maybe with the second one everything will be alright.

Thanks a lot for your work!
moonlight
Posts: 567
Joined: Wed Oct 26, 2005 7:46 pm

Re: Problem loading a3p files from UMD

Post by moonlight »

firun wrote:In second version I've noticed that it loads only one file from disc (at least on Metal Gear Ac!d UMD)... In first version everything was alright. But of course, as I noticed on other UMDs, the reading speed increased.
This is because it applies a extension filter to increase the search speed. Probably those files of that umd have another extension different to at3, wav, pbp, and toc. If you tell me the extension i'll add it quickly.
firun wrote: And I have a little question about another your program -- PSP Audio Recorder -- it seems that it can't execute Atrac3 Sample Player from Homebrew dir, but I tried only the first release of Atrac3 Player, maybe with the second one everything will be alright.
It's strange because I remember to have succeeded using psp audio recorder with the first atrac3 player sample (i also haven't tried the second version)
firun
Posts: 3
Joined: Tue Jul 12, 2005 9:55 pm
Location: Russia, Saint-Petersburg

Post by firun »

moonlight wrote: This is because it applies a extension filter to increase the search speed. Probably those files of that umd have another extension different to at3, wav, pbp, and toc. If you tell me the extension i'll add it quickly.
I din't read the source of the second release yet ^^
The extension is -- a3p.
moonlight wrote: It's strange because I remember to have succeeded using psp audio recorder with the first atrac3 player sample (i also haven't tried the second version)
I'll try the second release, but with the first sample Atrac3 Player I had only nonresponding PSP (PSP Recorder brilliantly works with UMD, but I couldn't make it work with Atrac3 Player). Maybe I've done something wrong -- I've put the Atrac3 Player Sample in PSP\GAME\HOMEBREW. I've put the EBOOT.PBP which was made from 2 (the loader & the executable).
moonlight
Posts: 567
Joined: Wed Oct 26, 2005 7:46 pm

Post by moonlight »

Updated the link with support for that curious extension.

I haven't tried again with the first atrac3 sample, but the second works well with the psp audio recorder.
firun
Posts: 3
Joined: Tue Jul 12, 2005 9:55 pm
Location: Russia, Saint-Petersburg

Post by firun »

Thanks a lot!

-------------------------

Um, but I still can't execute Atrac3 Player from PSP Audio Recorder. After I press "o" it freezes and doesn't respond to any buttons' actions. If that's not a difficult for you, can you write here how to execute Atrac3 Player (second release) from PSP Audio Recorder. Thanks in advance!
__count
Posts: 22
Joined: Thu Mar 23, 2006 8:40 pm

Post by __count »

Just a FYI if anyone else is having problems with EAC (it goes into an infinite loop on my machine); here is a codec you can use to encode/decode AT3. It worked well for me with audiograbber.
Post Reply