Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Runs on half speed on RPi 3 #1

Closed
jthecodebuilder opened this issue Mar 9, 2017 · 16 comments
Closed

Runs on half speed on RPi 3 #1

jthecodebuilder opened this issue Mar 9, 2017 · 16 comments

Comments

@jthecodebuilder
Copy link

Compiles successfully on Raspbian, but seems to play at half speed. How do we/us fix this?

@jgilje
Copy link
Owner

jgilje commented Mar 9, 2017

I'll try to have a look at it within the next couple of days. I've got a Pi3 standing by :)

@jgilje
Copy link
Owner

jgilje commented Mar 9, 2017

Hi, just compiled and ran it successfully on my Pi3. No playback issues. Which song where you testing?

@jthecodebuilder
Copy link
Author

jthecodebuilder commented Mar 9, 2017

we have accidently borrowed your votedisk.v2m
Also there's garbled synth in the left channel
but the right channel sounds somewhat ok

@jgilje
Copy link
Owner

jgilje commented Mar 10, 2017

Sorry, I've got none of your issues. I've uploaded my compiled version here, https://jgilje.net/prosjekter/v2m/, if you'd like to compare.

I also checked against a recording of the original demo, at https://www.youtube.com/watch?v=muMqrNZz0dQ, and noticed some effects are missing when played with this player. But this don't match the problem you're describing.

@jthecodebuilder
Copy link
Author

Still runs on half speed on your own binary.
Maybe there is something in my alsamixer or SDL that I don't know about that is bottle-necking the speed??

@jgilje
Copy link
Owner

jgilje commented Mar 12, 2017

I'm starting to think you don't get the expected audio format back from SDL. In https://github.com/jgilje/v2m-player/blob/master/tinyplayer.cpp#L36. I never implemented a check on whether the actual SDL_AudioSpec matches the requested format.

Are you able to debug this code yourself? If not, I can compile a test-build to try to pinpoint the bug.

@frranck
Copy link

frranck commented Mar 15, 2017

jgilje, what's special about this format ? couldn't find much info.

@jgilje
Copy link
Owner

jgilje commented Mar 16, 2017

@frranck it's a soft-synth created by farbrausch (https://en.wikipedia.org/wiki/Farbrausch) and used in many (most? all?) of their demos.

@jthecodebuilder
Copy link
Author

perhaps, but right now we are focusing on a issue related to sample rate & speed. Also I might be able to debug the code, and a SDL_AudioSpec check sounds like it would fix this problem.

@jgilje
Copy link
Owner

jgilje commented Mar 19, 2017

@jthecodebuilder i just added some code for checking and validating the actual audio format returned by SDL. give it a go, and let me know if it reports any errors.

@jgilje
Copy link
Owner

jgilje commented Mar 19, 2017

@frranck probably, but as already noted this issue is for a different topic. feel free to open a new issue when they land a stable API :)

@jthecodebuilder
Copy link
Author

got "INFO: Failed to get requested format, wanted 8120, got 8010" when attempting to play it and then it quits

@jthecodebuilder
Copy link
Author

Just now, while looking through the code (thinking the values im looking for will never be found), line 63 of v2mplayer.h contains a very important value which can alter the speed, which would be the perfect place to implement a failsafe for when the audio format isn't the expected one! yay

@jthecodebuilder
Copy link
Author

but ive also found that the static values in synth_core need to be auto-tweaked as well...!

@jgilje
Copy link
Owner

jgilje commented Mar 22, 2017

Nope, the failed format message means SDL failed to open the audio output device using the requested format. The requested format is 32-bit floats (which is what the soft-synth itself outputs), but the actual format returned by the audio device is 16-bit integers (ref. SDL_audio.h).

I just committed a change which should cause SDL to do this conversion automaticly.

@jthecodebuilder
Copy link
Author

Well, darn. I thought I had caught the bug in it's tracks. Atleast it finally plays fine now. Now all it needs now is those effects fixed and then this is a very good port to SDL!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants