Page 1 of 1

[v3.3] Mod/XM/MP3 replay ?

Posted: Mon Jun 18, 2012 12:43 am
by spiny
Is it possible to load and play MOD/XM/MP3 files in v3.3 ?
I'd like to do a 'sequel' to the music disk I did last year, but I can't seem to find the command to load and play a tune.

sorry for all the simple questions :)

cheers, Phil.

Re: [v3.3] Mod/XM/MP3 replay ?

Posted: Mon Jun 18, 2012 10:01 am
by NightRadio
If you want to play MP3, i see one way only now - include external dynamic mp3 library.
In future updates i plan to add OGG Vorbis support to Pixilang.

As for the MOD/XM - i see two ways :)
1. Include some external library.
2. Make native XM/MOD player on Pixilang directly. It is possible, but right now i have no free time to do it. May be someone want to try? :) Of course i can help.

Re: [v3.3] Mod/XM/MP3 replay ?

Posted: Mon Jun 18, 2012 2:56 pm
by spiny
do you have any examples on how to call external libraries, the manual shows the commands, but this is all new to me :)

Re: [v3.3] Mod/XM/MP3 replay ?

Posted: Mon Jun 18, 2012 3:30 pm
by NightRadio
Yes, you can check the SunVox dynamic library:
http://www.warmplace.ru/soft/sunvox/sunvox_dll.zip
example of using it with Pixilang is included to archive.

Another example of using SunVox DLL + Pixilang is my audio-visual album Soul Resonance:
http://www.warmplace.ru/music/soul_resonance/
sources included too

Re: [v3.3] Mod/XM/MP3 replay ?

Posted: Mon Jun 18, 2012 8:36 pm
by spiny
thanks :)

this looks complicated :D

I'll have a good read of the sources.

Re: [v3.3] Mod/XM/MP3 replay ?

Posted: Mon Jun 18, 2012 9:06 pm
by NightRadio
Here is basic example :)

In mylib.dll you have the following function
int show_info( int x, int y, void* some_data );

Now let's call this function from Pixilang:

Code: Select all

dl = dlopen( "mylib.dll" ) //Open the library
if dl >= 0 
{
  f = dlsym( dl, "show_info", "iip" ) //Get the function show_info() from dynamic library
  // "iip" - int int pointer
  if f >= 0
  {
    retval = dlcall( dl, f, 1, 2, "blahblah" ) //Call the function show_info() with parameters (int) 1, (int) 2, (pointer) "blahblah"
  }
  dlclose( dl ) //Close the library
}

Re: [v3.3] Mod/XM/MP3 replay ?

Posted: Tue Jun 19, 2012 2:19 pm
by spiny
I see, that makes sense :)

I've been playing with the sunvox DLL download (and the 'text.pixi' example) and have managed to integrate it into one of my own programs, but the sound is quite low quality, is this by design ? I've used one of the tunes from soul resonance as a test. Are there options to increase the playback rate ?

and one other thing, I then tried this prog (and the text.pixi example) on the Raspberry Pi, and it fails to run when the sunvox code is present, does sunvox also need compiling for ARM, or is it just not compatable ?

thanks again :)

Re: [v3.3] Mod/XM/MP3 replay ?

Posted: Thu Jun 21, 2012 9:10 pm
by NightRadio
but the sound is quite low quality
Please open the test.pixi and find this string: set_audio_callback( audio_callback, 0, 44100, INT16, 2 )
replace it by set_audio_callback( audio_callback, 0, 44100, INT16, 2, AUDIO_FLAG_INTERP2 )
I think the problem in this place.
I then tried this prog (and the text.pixi example) on the Raspberry Pi
Just i have no sunvox library for Raspberry now :)

Re: [v3.3] Mod/XM/MP3 replay ?

Posted: Tue Jun 26, 2012 11:59 pm
by spiny
NightRadio wrote: Please open the test.pixi and find this string: set_audio_callback( audio_callback, 0, 44100, INT16, 2 )
replace it by set_audio_callback( audio_callback, 0, 44100, INT16, 2, AUDIO_FLAG_INTERP2 )
I think the problem in this place.
thanks :) that sounds better, but it's still not as 'crisp' as it sounds in Sunvox itself, but I am also seeing some corruption on screen, so there may be bugs in my code :)
I then tried this prog (and the text.pixi example) on the Raspberry Pi
Just i have no sunvox library for Raspberry now :)[/quote]

at least I know why :)

thanks !

Re: [v3.3] Mod/XM/MP3 replay ?

Posted: Wed Jun 27, 2012 8:57 am
by NightRadio
but it's still not as 'crisp' as it sounds in Sunvox itself
hm... may be you can record this sound someway for me?

Re: [v3.3] Mod/XM/MP3 replay ?

Posted: Wed Jun 27, 2012 8:29 pm
by spiny
OK, when i get a moment I'll record two MP3s, one of sunvox and one of pixi running the code i've put together. But first, this is the corruption I see on screen:

Image

its the yellow lines at the top, when the program is running, the first few lines flash random pixels. Could this be related to the sound playback problem ?

I'll put my code up if you think that will help, I've almost certainly done something wrong :D

Re: [v3.3] Mod/XM/MP3 replay ?

Posted: Wed Jun 27, 2012 8:38 pm
by spiny
Ok, weirdness :)

I've just moved my files to a new directory to make an archive to upload, and it now plays perfectly :D
The only file missing was the .ini file.
when i put that back, the sound quality drops.

so, I've looked and if I comment out this line:

// Sound buffer size (in frames):
buffer 1024

it sounds perfect.

is my computer weird ?

cheers :)

I'm still seeing the screen corruption, but thats obviously something else :D

Re: [v3.3] Mod/XM/MP3 replay ?

Posted: Wed Jun 27, 2012 8:48 pm
by NightRadio
is my computer weird
Your computer is ok :) Just not all systems can provide 1024 frames audio buffer. If you remove this string in config - default 4096 value will be used :)
As for the screen corruption - it looks like a bug, when you try to write some data (sound?) to the zero container. But the container with ID 0 is default Pixilang screen :)
Please send me your code.

Re: [v3.3] Mod/XM/MP3 replay ?

Posted: Thu Aug 02, 2012 3:24 pm
by spiny
hello again, sorry for the delay, been too busy to code :/

anyway, here is the program I have styarted that shows corruption at the top of the screen. I expect it's some simple typo, but if you could look, I would be very grateful :)

http://www.spiny.org/temp/spiny-pixi.rar

thanks :)

Re: [v3.3] Mod/XM/MP3 replay ?

Posted: Wed Sep 17, 2014 8:41 pm
by spiny
update :)

I changed the replay code to the routing used in your most recent demo '6bit genesis' and the corruption has gone, and the tracks I converted to .sunvox format play properly, happy days :)