Rockbox

  • Status Closed
  • Percent Complete
    100%
  • Task Type Patches
  • Category Codecs
  • Assigned To No-one
  • Operating System All players
  • Severity Low
  • Priority Very Low
  • Reported Version Daily build (which?)
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by gama - 2011-02-15
Last edited by Buschel - 2011-07-04

FS#11945 - New HES (Hudson Entertainment System) sound codec ;)

Hi, this is a new codec that plays HES music files. It is based on gme-0.5.2 by blargg http://slack.net/~ant/libs/audio.html

The patch was made from r29307

Features:

  1. 44Khz stereo sound.
  2. M3u Playlist support for additional metadata.
  3. Fade support.
  4. Subtrack selection using the seek function.
  5. Support adpcm samples.
  6. Based on the great game_music_emu library by blargg,

so you can expect nice sound quality.

Note 1: This version is for testing, if you find any bug please let me know.
Note 2: The codec uses the file open, read, seek functions that are only defined in

            players that support recording,  so we must find a solution for the players that
           doesn't support that.

For a nice collection of HES music you can visit http://namida.com/kaminarimon/

Closed by  Buschel
2011-07-04 05:53
Reason for closing:  Duplicate
Additional comments about closing:   Warning: Undefined array key "typography" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 371 Warning: Undefined array key "camelcase" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 407

Replaced by FS#12176.

i modified codec.c/h to make this patch work on non-recording device, but seems it failed to load hes-m3u?

Done next to compile:
Got latest rockbox 29317 from SVN
Made directory “D2build” near rockbox folder then changed to it
Then “../rockbox/tools/configure” selected D2 normal build and then “make -j4” got this
http://pastebin.com/raw.php?i=SQK37KKk
What am i doing wrong again? or maybe some additional patches requed?

PS this all was made under cygwin with arm-elf-eabi-gcc (GCC) 4.4.4 and GNU ar (GNU Binutils) 2.20.1.20100303

gama commented on 2011-02-17 03:02

The m3u playlist uses file open, read and close from the codec api, but those are only defined for
targets that supports recording, you can check that in the codecs.h file, i’m still looking how to solve that.

> i modified codec.c/h to make this patch work on non-recording device, but seems it failed to load hes-m3u?

That’s strange, i have tested it on a sansa and on the uisimulator and it works fine. But the sansa supports
recording so the file api is already available. I guess i will try with another target in the simulator, could you please
paste your changes Joshua?

By the way, you can tell the m3u is loaded correctly because the codec will display additional info about
author, game and title and it will set the correct number of tracks. But t will not display the track title.

Then it loads correctly. Finally compiled updated gbs and hes codecs with joshuachang’s fix ^^
btw i commented:

  char * (*strrchr)(const char *s, int c);
  int (*strcasecmp)(const char *, const char *);

in codecs.h and

  strrchr,
  strcasecmp,

in codecs.c because it caused some errors (this strings was doubled somewhere)

PS Switching track then loop enabled doesn’t work like with nsf files (for both gbs and hes)
PPS Can you amplify pce’s sound a bit?

gama commented on 2011-02-17 15:23

I’m glad it worked now.

Switching track then loop enabled doesn’t work like with nsf files (for both gbs and hes)

Yes, i have to take a look at that. What should be the correct behavior?

Can you amplify pce’s sound a bit?

That is no problem, the volume gain value is located in the Hes_init function in hes_emu.c.
I reduced those values because it was a bit high compared to other formats like spc. But
i still have to find a good value for it.

Hmm correct behaviour was: next song acts as next sub-track previous track moves to the first sub-track and iirc if looping enabled it loops current track forever (i mean no fade out just like if it played in game).
I compared loudness to standard mp3s and it’s much lower compared to them (SPC too but I didn’t thought about editing source).

Sigh. why there are no external config files for codecs like in winamp? ~_~
PS is it real to get track title and length from m3u files or make them to work like CUEs?

gama commented on 2011-02-17 22:07
if looping enabled it loops current track forever

I believe you mean loop current sub-track not the whole file, right?

is it real to get track title and length from m3u files or make them to work like CUEs

I guess that could be done but someone would have to change the main rockbox app to achieve that.
The track title can be obtained in the codec but rockbox takes around 15 seconds to update metadata changes,
so i decided to keep the game, artist and album info only. And even if track length is not displayed, it is used
internally by the codec.

And i also think that a codec config file like winamp’s ini file would be nice. By the way i have finished a beta
of the atari SC68 plugin it is based on the sc68 library by Benjamin Gerard. There are some really nice
songs in his archive. Will upload the patch next week, though i’m not sure if anyone is interested in that format ;).

oh ‘coz I mean’d current sub-song

and.. will that sc68 plugin support sndh files? (original one was pretty buggy)

gama commented on 2011-02-18 03:08
oh ‘coz I mean’d current sub-song

Ok I don’t think that would be difficult to do ;).

The sc68 codec supports both sc68 and sndh files, big sndh tunes (~450 Kb) are not supported yet, but i’m trying to fix that.
I have tested a lot of songs from the sc68.org archive and it seems they play fine.

By the way there are still some formats from game_music_emu that can be ported: kss (msx, sms),
ay, nsf, vgm (gg, sms, genesis) and maybe sgc (sms, gg).

I know there is already a nsf codec but i believe gme’s nsf emu has better sound quality so it might be worth to make a new codec.
The ay emu would be easier to port but i haven’t found any songs in that format.

And i’m not sure the kss and vgm codecs would work in rockbox, since they need a lot of cpu, but they may work without
the ym2413 chip (just maybe).

well HES tunes with DAC used works fine on CPU with >80mHz frequency without they works fine even on 32mHz (at leat on D2 which uses ARM9). AY will be really nice :) (hmm is there tool to convert spectrum’s tracker formats to ay?)
And does NSF emulation in blargg’s supports vrc7 expansion?
And future idea: why not to use one path for same components? (blargg_common, blargg_config, m3u_playlist etc)

gama commented on 2011-03-07 15:24

Hi i just updated the patch, it contains minnor changes but
it should compile fine on all targets.

Changelog:

  1. Merged Joshua’s patch to make the codec compile fine on all targets.
  2. Fixed some internal stuff.
  3. Increased sound gain (a bit).
gama commented on 2011-03-07 15:26

Oh again, the patch :|

this one also based on latest blargg’s library?

gama commented on 2011-03-09 03:46

Yes, partially, the most relevant change was the addition of the adpcm apu. But i will check if the cpu was
updated as well.

Since what time PCE had ADPCM output? I remember only 5-bit wavetable synth and PCM DAC which can be used instead of one chanel (though wiki says that any chanel can be set to DAC mode)

gama commented on 2011-03-10 02:41

It’s in the wiki (http://en.wikipedia.org/wiki/TurboGrafx-16), in the PCEngine an ADPCM channel
was added, it is used by several HES rips especially for drums.

Oh that’s for CD expansion :)

i’ve tried to make this work on new playback engine, here’s the patch, sync against svn r29817:
NOTE: this is a very rough patch which contains some hacks in metadata stage, use at your own risk

gama commented on 2011-05-12 01:27

Thanks, i am going to give it a try. But I guess it will be better if the extended m3u is read only once, just in the metadata parser.
And maybe subsongs info (remap and lengths) can be ‘passed’ to the codec through the ide3v2 buffer. Also i will try to remove the
Emu dependency from the m3u parser that way all the gme codecs could use the extended m3u support.

Anyway, the only codec that actually needs the extended m3u is the HES, since it doesn’t contain an standarized metadata info. So for
now i removed the m3u support from the rest of the gme codecs and will upload the updated patches next week.

P.S. I have been working on a plugin based on the UADE (Unix Amiga Delitracker Emulator) library, it’s working fine on the sansa, but i haven’t
decided to upload if yet, maybe it would be better to do some private beta testing first. So if someone is interested please let me know :).

well, the patch uploaded was very rough, it eats too much memory, i’ve made a modification to the hes_m3u.c and remove the dependency, will upload it ASAP, also, the multitrack sc68’s length is wrong after modification, could you fix it?

gama commented on 2011-05-12 03:32
i’ve made a modification to the hes_m3u.c and remove the dependency,

Oh, that’s nice ;).

also, the multitrack sc68’s length is wrong after modification, could you fix it?

Ok, will take a look at it.

here’s the patch,
when build all multi-track codecs(hes,nsf,gbs)with m3u support, the new patch only need additional 50k memory
compare to previous one, we have 350k memory saved!

gama commented on 2011-05-16 01:48

Thanks Joshua, i will try to pass the m3u data (at least the track’s length and remap) to the codec through the id3 buffer,
.

gama commented on 2011-05-17 00:30

Hi, i have made some changes to your patch Joshua, could you try them?.

- Removed the Gme_emu structure dependency in the gme_m3u code,
- Store the entries data in the id3v2 buffer to make it available inside the codec.
- Stripped down the entry_t structure to hold only the track and length data, in order to reduce the size of the data
passed to the codec through the id3v2 buffer.
- Removed the m3u_playlist.c file from libhes since it is no longer needed and changed the m3u_playlist.h file to ‘load’ the m3u playlist
from the id3v2 buffer.
- Reduced the max m3u data to 16384 bytes, is there any hes m3u playlist bigger than that?

Can you help test this patch and tell me your thoughts about the changes?

P.S. I guess the strrchr and strcasecmp functions can now be removed from the codec structure as well.

i’ll give it a try soon
ps: the biggest hes m3u as far as i know is Tokimeki Memorial.m3u, 12756 bytes

have tested the patch, only one question:
why use “ci→set_elapsed(t*1000)” instead of “ci→id3→elapsed = t*1000” in codecs/hes.c?
in this way, i can’t change sub-track using 1 second skip length, the official nsf.c also has the same problem.

gama commented on 2011-05-18 21:49
why use “ci→set_elapsed(t*1000)” instead of “ci→id3→elapsed = t*1000” in codecs/hes.c?

Well because i thought it was the correct way of doing it ;). I was just looking at some related bug,
the wps time doesn’t get updated automatically with the new playback engine, when a subsong changes it stays in zero,
but if i skip forward to manually change subsong it starts to work fine. Looking at the playback.c file it has to do something
with the pcm latency (see playback.c ~ void audio_codec_update_elapsed(unsigned long value)), but i don’t understand quite well
that part.

Unfortunately, setting ci→id3→elapsed directly doesn’t help either 8(.

BTW, i have updated the other codecs as well, will upload them ASAP. Also i finished porting the AY and SGC codecs too ;).

i don’t know if you use settings→playback settings→skip length→1s to make it easier to change subtrack, but when using “ci→set_elapsed(t*1000)” in the code, i couldn’t change subtrack anymore

gama commented on 2011-05-19 00:30
i don’t know if you use settings→playback settings→skip length→1s …

Mmm, no i don’t use that option. Some findings, if i use ci→set_elapsed() the WPS time gets updated until subtrack 3 is reached,
and the reason for this is that the function audio_codec_update_elapsed(unsigned long value) rejects the value if it is lower than the pcm buffer latency,
in the sansa fuze the ‘latency’ is around 2500.

If i use ci→id3→elapsed directly, it is easier to change subtrack but the WPS time doesn’t get updated at all, and i haven’t been able
to find the reason for this. Hope some dev can help us with this ;).

the new 0.5a patch has a small issue, it couldn’t play $00 track in m3u, here’s the fix, put it in the libhes dir.

   hes_emu.c (22.3 KiB)
gama commented on 2011-06-09 23:13

Thanks again Joshua, i have merged your changes and made a couple of code cleaning,
but there is still pending the elapsed time issue. Here is the latest full patch:

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing