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

Support for Seeking to a frame? #71

Open
5 tasks done
pconerly opened this issue Aug 21, 2018 · 2 comments
Open
5 tasks done

Support for Seeking to a frame? #71

pconerly opened this issue Aug 21, 2018 · 2 comments

Comments

@pconerly
Copy link

pconerly commented Aug 21, 2018

Hello,
Are there any plans to support seeking to a specific frame?

I'm writing a small app that shows a song's Hz spectograph and, and allows play/pausing of the song along with the spectograph. Play/pause works great, but I'd like a way to reset what frame we're reading from. (That would allow to the user to "stop" and set the time to 0, or click on a spot and seek to that spot.)

I found that the OSX AudioToolbox backend has ExtAudioFileSeek: https://developer.apple.com/documentation/audiotoolbox/1486821-extaudiofileread?language=objc

And Python aifc has:

aifc.rewind()
aifc.setpos(pos)

https://docs.python.org/3.6/library/aifc.html

Backends to investigate:

  • rawread.py/aifc (has aifc.setpos)
  • ffdec ffmpeg (has a seek option on command start. Audioread might have to close & restart the channel on seek?)
  • gstdec.py/Gstreamer / pygobject (has IOChannel.seek)
  • macca.py/AudioToolbox (has ExtAudioFileSeek)
  • maddec.py/MAD/pymad (has seek_time)
@sampsyo
Copy link
Member

sampsyo commented Aug 21, 2018

Great idea! This might be hard to support in some backends, like the ffmpeg one, but that shouldn't stop us from adding it to backends where it's easy/possible.

One thing to remember is that we'll want a consistent story for what happens when you seek too far or backwards, if that's disallowed (silent no-op? immediate exception? exception after trying to read post-seek?).

@pconerly
Copy link
Author

pconerly commented Aug 22, 2018

@sampsyo I think I'd vote for an immediate exception, so that users can take their own action. But also, I investigated the backends and I think it's possible to do with all of them.

I'm gonna try adding it to one of the backends and then submit a PR that we can chat about.

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

2 participants