[SUGGESTION] Create audio list with C2

0 favourites
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • Hello, I think it is not possible to create a playlist in C2.

    I mean put songs to a list, then run the list (play list "name") and make the songs run automatically.

    As an option it would be well to choose to run without spaces of silence, then one of the other.

    I mean, the songs go from one to another without spaces of time, without silences.

    The idea is to be able to create a list of music files or sound that are reproduced next without needing control by the user.

  • Hi, construct can do it.

    When finish music1 then play music2.

    For spaces of time: you can cut (edit) the audio file befor import to construct 2 project, or u can set the time u want to star to play.

    Cheers.

  • Between tick and tick there are 16 msec. , I think the silences are not removed from the editor. Editing audio files would not work.

  • You can try this.

    When the audiofile 1, tag "1". Is playing, then triggered once while true, seek to 5 seconds.

    Cheers.

  • You need to be clearer on what exactly you're asking for. Are you talking like a regular playlist of multiple songs? Sure, that's simple. My audio player on my performance music website is done in C2 here. Are you talking about seamless transitioning between segments of music for an adaptive/interactive soundtrack? That's also totally doable but not as simple as using something like wwise or fmod in other engines. As far as the 16ms thing with ticks, there's an event option to schedule audio to play at absolutely precise moments regardless of events or framerate/dt hitches. So for the soundtrack in Courier, I schedule segments of music based on the playback times of previous audio files.

    So maybe tell us what you're trying to achieve. That will be far more useful than something so broad.

  • Hello, I think it is not possible to create a playlist in C2.

    I mean put songs to a list, then run the list (play list "name") and make the songs run automatically.

    As an option it would be well to choose to run without spaces of silence, then one of the other.

    I mean, the songs go from one to another without spaces of time, without silences.

    you mean like this?

    Function PlaySong()

    Play SongArray[x] as tag "CurrentSong"

    On "Current Song" Ended

    Wait 2 seconds

    Add 1 to x

    PlaySong()

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Suppose you have a song divided into 4 parts.

    You want the four parts to sound one after another without silences, otherwise the song will sound bad.

    That's what I want to do.

  • If u can do a simple capx, maybe i can help to u.

  • Okay, tomorrow I'll take the example.

    Now I have a little sleep -_-

  • Suppose you have a song divided into 4 parts.

    You want the four parts to sound one after another without silences, otherwise the song will sound bad.

    That's what I want to do.

    depends on how you cut the music but in that case I would probably do:

    Set overlap to 1 //number of seconds to overlap tracks

    Function PlaySong()

    Play SongArray[x] as tag "CurrentSong"

    Compare 2 values: Audio.PlaybackTime("CurrentSong") > (Audio.Duration("CurrentSong") - overlap)

    Add 1 to x

    PlaySong()

    If you want seamless music that is constant - meaning from a track with an abrupt end cut and seamlessly goes into another track you could try it OnEnd of Audio, then trigger the next track.. but it really depends on the music and how you start/end the track. there might be a small pop or silence that sounds like a pop.. thats why I'd start it before the end.. even 0.05 would prevent the pop.. but you have to make sure there's no beat in the music that will be messed up by offsetting the tracks. But again, it depends on how you make the tracks.

    If you are splitting tracks into 4 parts, most likely you want to mix and match parts.. or loop certain parts? What exactly are you trying to do? there might be a better way..

  • I tried it.. it's strange.. it depends on system resources I think.. and if it's already been played before.. on the first play through it's fine..sometimes I can hear the last cut, but not always.. but when I start the entire song over already having played it once, the overlap is too long and you hear each cut.

    https://www.dropbox.com/s/7pbenhfmarbbq ... .capx?dl=0

    Definitely streaming from disk is the culprit. If you read your tracks into memory that would fix it - not that you would want to do that.

  • Nice song ^^

  • Okay, you're doing it for soundtrack purposes. I'm a little tied up doing animation work to make an example, so hopefully this explains how to do it.

    Each of your four clips need to have the full music for the time frame they should represent + the decay that overhangs the end of the bar. Don't worry about the length of the clips--you'll never use it. But this will give the most realistic approach and is how every major studio does things like this. So for this, I'm going to assume each clip is two measures long in 4/4 with a tempo of 140.

    First, you need to determine the length of time for your segment. This is solved by 60/140*8 (60/tempo*beats). Store that in a variable.

    Now, all you need to do is cue up the next track to play at that regular interval. So 3.428571 repeating. Just have C2 solve it and store the answer in a variable ("length" or whatever)--don't bother using a calculator. I'm going to assume you can come up with your own method for deciding which segment should play next. I keep track of the track currently playing, where it is in context of the piece, and assign the next segment based on that + game parameters.

    So on the first play, store the current system time in a variable ("oldtime" or something). Your next segment should play at "oldtime" + "length" time. Don't use the Audio>Play action any more because you can't ensure events will run at the right times. It may not matter for visuals much, but 16ms is quite significant for audio. Now you should use the Audio plugin's Schedule option. Once the other segment is playing and the current system time is far enough beyond the "oldtime", schedule your next segment. Schedule it for "oldtime"+"length" then set "oldtime" to "oldtime"+"length". I suggest delaying when you call the schedule event until as late as you think reasonable so that you can make last-second changes in what track comes next should you need it. So I run my schedule event after something like 'is system time > "oldtime"+"length"- (however long you want. I suggest maybe 200 milliseconds or .2 seconds). This way, it will schedule the next track 200 milliseconds before it's time to start.

    I've only tried this with the audio preloaded into memory. I'm not sure if streaming it (ie, putting it in the "Music" folder in C2) will have an effect. I put everything in the "Sounds" folder, personally, and just preload everything I need.

    If you're going for mixed-meter stuff, change the "length" variable to a new solution of 60/tempo*beats whenever necessary based on however you determine what track comes next.

    I hope this helps!

  • I've only tried this with the audio preloaded into memory. I'm not sure if streaming it (ie, putting it in the "Music" folder in C2) will have an effect. I put everything in the "Sounds" folder, personally, and just preload everything I need.

    Now that you can unload sounds it's less of a problem but still.. you need to be careful here.. loading music fully into memory can take up a lot of space quick! If I remember correctly audio is uncompressed in memory so your 8MB song can easily be 80MB in memory. Add a handful more tracks and suddenly your footprint is half a GB... and that's no good.

  • Thanks for the advice and for the information.

    Maybe it works the way you describe but it is beyond what I would like but I do not discard it, thanks for taking the time to describe the process! So this is a kind of suggestion.

    THE IMPLEMENTATION OF REPRODUCTION LISTS IN CONSTRUCT

    The example works perfectly, I have reproduced the song 3 times and I have never heard any silence or strange jump in chrome for windows, maybe there were jumps but I did not perceive them because I do not know the song exactly.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)