[SOLVED] Music doesn't loop seamlessly?

Post here if you need help getting started with Daggerfall Unity or just want to clarify a potential bug. Questions about playing or modding classic Daggerfall should be posted to Community.
User avatar
Nash
Posts: 11
Joined: Fri Jun 08, 2018 11:19 am
Location: Kuala Lumpur, Malaysia
Contact:

[SOLVED] Music doesn't loop seamlessly?

Post by Nash »

I'm not sure if this is a bug or something else, so figured I'd ask first - it seems that music does not loop seamlessly for me. There'll be a tiny pause before the song goes back to the beginning.

In some situations, the music doesn't even repeat and goes silent until a certain random amount of time has passed before replaying!
Last edited by Nash on Fri Sep 27, 2019 1:32 pm, edited 1 time in total.
Nash Muhandes

User avatar
King of Worms
Posts: 4751
Joined: Mon Oct 17, 2016 11:18 pm
Location: Scourg Barrow (CZ)
Contact:

Re: Music doesn't loop seamlessly?

Post by King of Worms »

And I will use this opportunity to report another problem I have with a IMPORTED (bytemixers) music in a OGG format:

Everytime a new track is loaded, or the current one gets replayed, theres a cca 0.5sec stutter of the whole game - it just freezes.

This is very noticeable in a dungeons, where the track is on a repeat for a long time.

Sorry for hijacking the thread but this seems to be closely related

Best regards!

User avatar
Jay_H
Posts: 4061
Joined: Tue Aug 25, 2015 1:54 am
Contact:

Re: Music doesn't loop seamlessly?

Post by Jay_H »

Welcome to the forums! :) In this case seamless music is something not yet implemented. Once Interkarma had music running, it was left in a "good enough" state until other core systems could be finished. Like other systems, this can be revisited closer to release to ensure it works well.

The best way for it to get done quickly is if another developer takes over that concept and works to get it done, but that hasn't happened yet.

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Music doesn't loop seamlessly?

Post by Interkarma »

Nash wrote: Fri Jun 08, 2018 1:16 pm I'm not sure if this is a bug or something else, so figured I'd ask first - it seems that music does not loop seamlessly for me. There'll be a tiny pause before the song goes back to the beginning.

In some situations, the music doesn't even repeat and goes silent until a certain random amount of time has passed before replaying!
After conversion from HMI to MIDI, many of the songs have silence at either end of the track. If someone experienced with editing MIDI tracks can trim them, they should loop fairly seamlessly. If this is something you're interesting in, the songs are in following folder on git. I can test and merge replacement once a pull request is issued.

https://github.com/Interkarma/daggerfal ... rces/Songs


King of Worms wrote: Fri Jun 08, 2018 3:11 pm And I will use this opportunity to report another problem I have with a IMPORTED (bytemixers) music in a OGG format:

Everytime a new track is loaded, or the current one gets replayed, theres a cca 0.5sec stutter of the whole game - it just freezes.

This is very noticeable in a dungeons, where the track is on a repeat for a long time.

Sorry for hijacking the thread but this seems to be closely related

Best regards!
I'm not sure about this one. The song shouldn't need to reload or reimport on loop (which is most likely reason for stutter). It should just sit in memory and play. There might be some unintended interaction between SongPlayer and asset injection system here.

User avatar
Nash
Posts: 11
Joined: Fri Jun 08, 2018 11:19 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Music doesn't loop seamlessly?

Post by Nash »

Interkarma wrote: Fri Jun 08, 2018 9:07 pm After conversion from HMI to MIDI, many of the songs have silence at either end of the track. If someone experienced with editing MIDI tracks can trim them, they should loop fairly seamlessly. If this is something you're interesting in, the songs are in following folder on git. I can test and merge replacement once a pull request is issued.

https://github.com/Interkarma/daggerfal ... rces/Songs
Oh, that's interesting! I didn't know the songs had to be converted offline - I had assumed DFU has an internal converter that just plays the songs on the fly from whatever music data is inside arena2.

I can have a go at trimming the MIDIs, will have to try that when I get on my digital audio computer... from a cursory glance at that Github repo, I assume the files I'd be interested in are the .mid.bytes files? I'm not familiar with these file types because I don't have any experience with Unity. :D
Nash Muhandes

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Music doesn't loop seamlessly?

Post by Interkarma »

Yes, converting directly from HMI at runtime was a bit inflexible, and I had already built an offline converter many years back in "Daggerfall Jukebox". Considering the original songs are freely downloadable with the game data anyway, and even available for download in several other places (e.g. UESP), I didn't think Bethesda would mind the shortcut for these assets. :)

The files are just straight .mid files. You can remove the ".bytes" extension while working on file and just put extension back before submitting PR. The extra extension is just to help Unity's asset manager load file.

CM August
Posts: 86
Joined: Fri Jul 14, 2017 11:11 am

Re: Music doesn't loop seamlessly?

Post by CM August »

Will be very grateful to see this improved. The game is going to feel so much better when all music is playing properly.

Are there any music tracks in vanilla Daggerfall that loop from a different point than the beginning? And does DFU already have the functionality to handle that?

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Music doesn't loop seamlessly?

Post by Interkarma »

I'm not sure if any of the songs loop from a point other than the start. Does the .mid format itself support addition of loop points?

The MIDI synth in Daggerfall Unity is built on the open source and cross platform C# Synth Project adapted for Unity starting from the information here with a few very minor tweaks of my own. If .mid supports loop points, there's a good chance the synthesizer will simply use them as intended. I haven't really dived deeply into the synth code as music formats aren't a speciality at all.

CM August
Posts: 86
Joined: Fri Jul 14, 2017 11:11 am

Re: Music doesn't loop seamlessly?

Post by CM August »

Interkarma wrote: Sat Jun 09, 2018 2:58 amDoes the .mid format itself support addition of loop points?
I haven't been able to find an answer to that one - the original question came to mind because I seem to recall many game music tracks of yesteryear having such things; most commonly, a short (or long) intro that played only once before reaching a looping melody. Perhaps I'm thinking of home console games with more bespoke functions. :)

User avatar
TheLacus
Posts: 1305
Joined: Wed Sep 14, 2016 6:22 pm

Re: Music doesn't loop seamlessly?

Post by TheLacus »

Interkarma wrote: Fri Jun 08, 2018 9:07 pm I'm not sure about this one. The song shouldn't need to reload or reimport on loop (which is most likely reason for stutter). It should just sit in memory and play. There might be some unintended interaction between SongPlayer and asset injection system here.
Just checked, sound data is reimported every time, but i don't think this is due to asset-injection. I'm not sure how SongManager is setting a music for loop, if is doing it. I think is just calling for the same song to reimport and play. Is Midi synth doing this automatically?

EDIT
If i wasn't clear, i meant that i checked with an original song in a dungeon. When it finished, the Play() function was called again, causing data to be reimported.

Post Reply