it is possible to play a sample for a given time? using the sample instance for example?
You can either loop it or set the speed so that it'll stretch to the time you want.
If you want it to play for a shorter amount of time than what it normally lasts for, shouldn't al_init_timeout work? I have to be honest, I don't quite know what timeouts in Allegro are, and a quick read through the manual didn't help much, but I'm guessing that they're a bit like Javascript's setTimeout()?
I think the ALLEGRO_TIMEOUT is only used for the event queue when waiting for an event.
Are you using Allegro 5? There's a function called al_set_sample_instance_length. I haven't ever tried it but it seems to do what you want.
https://www.allegro.cc/manual/5/al_set_sample_instance_length
If that doesn't work you could easily just program an integer to iterate and stop the sound when it reaches a specified value, but this can become desynced if the program stops updating while the sound keeps playing (for example while switching to full screen)