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

Pixilang programming language
Post Reply
User avatar
spiny
Posts: 46
Joined: Mon Jul 19, 2010 4:28 pm

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

Post 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.
User avatar
NightRadio
Site Admin
Posts: 3941
Joined: Fri Jan 23, 2004 12:28 am
Location: Ekaterinburg. Russia
Contact:

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

Post 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.
User avatar
spiny
Posts: 46
Joined: Mon Jul 19, 2010 4:28 pm

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

Post 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 :)
User avatar
NightRadio
Site Admin
Posts: 3941
Joined: Fri Jan 23, 2004 12:28 am
Location: Ekaterinburg. Russia
Contact:

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

Post 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
User avatar
spiny
Posts: 46
Joined: Mon Jul 19, 2010 4:28 pm

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

Post by spiny »

thanks :)

this looks complicated :D

I'll have a good read of the sources.
User avatar
NightRadio
Site Admin
Posts: 3941
Joined: Fri Jan 23, 2004 12:28 am
Location: Ekaterinburg. Russia
Contact:

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

Post 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
}
User avatar
spiny
Posts: 46
Joined: Mon Jul 19, 2010 4:28 pm

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

Post 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 :)
User avatar
NightRadio
Site Admin
Posts: 3941
Joined: Fri Jan 23, 2004 12:28 am
Location: Ekaterinburg. Russia
Contact:

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

Post 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 :)
User avatar
spiny
Posts: 46
Joined: Mon Jul 19, 2010 4:28 pm

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

Post 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 !
User avatar
NightRadio
Site Admin
Posts: 3941
Joined: Fri Jan 23, 2004 12:28 am
Location: Ekaterinburg. Russia
Contact:

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

Post 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?
User avatar
spiny
Posts: 46
Joined: Mon Jul 19, 2010 4:28 pm

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

Post 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
User avatar
spiny
Posts: 46
Joined: Mon Jul 19, 2010 4:28 pm

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

Post 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
User avatar
NightRadio
Site Admin
Posts: 3941
Joined: Fri Jan 23, 2004 12:28 am
Location: Ekaterinburg. Russia
Contact:

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

Post 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.
User avatar
spiny
Posts: 46
Joined: Mon Jul 19, 2010 4:28 pm

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

Post 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 :)
User avatar
spiny
Posts: 46
Joined: Mon Jul 19, 2010 4:28 pm

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

Post 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 :)
Post Reply