digitalmars.D.learn - Seeking in arsd.simpleaudio?
- TheZipCreator (22/22) Nov 20 2022 I'm currently making a library to do programmatic animation (akin
- Adam D Ruppe (7/10) Nov 20 2022 My underlying vorbis lib has it, but haven't added to the
- Adam D Ruppe (5/6) Nov 20 2022 i went overbudget lol. but yeah the seek function in the
- TheZipCreator (4/10) Nov 20 2022 I can imagine, errors in C are extremely annoying.
- Adam D Ruppe (9/11) Nov 20 2022 i found the problem
- Adam D Ruppe (13/16) Nov 20 2022 Here's the patch for ogg, you can download those two files off
- TheZipCreator (2/4) Nov 20 2022 works great! thanks
- Adam D Ruppe (7/10) Nov 20 2022 This is fixed on my computer now too, just need to check the rest
I'm currently making a library to do programmatic animation (akin to [manim](https://www.manim.community/) but for D and a different style) and for audio arsd.simpleaudio seems like the only real option (all the others I could find are too low-level for my taste) but if I want to skip to a specific section of the video, then I'd need to be able to seek the audio to that location too, and it appears that arsd.simpleaudio doesn't have a seek function. Is there a way to do this via other means? I want something like: ```d import arsd.simpleaudio, arsd.vorbis; void main() { AudioOutputThread aot = AudioOutputThread(true); aot.playOgg("myAudio.ogg"); import std.datetime; aot.seek(5.seconds); // or maybe this could be directly in .playOgg } ``` so how would you implement this hypothetical `seek` function? (or if you could tell me a different library that already has this functionality that'd be great too)
Nov 20 2022
On Sunday, 20 November 2022 at 20:23:28 UTC, TheZipCreator wrote:so how would you implement this hypothetical `seek` function? (or if you could tell me a different library that already has this functionality that'd be great too)My underlying vorbis lib has it, but haven't added to the simpleaudio interface yet. (Partly cuz i haven't figured it out for the ogg/mp3/wav combo yet) Give me a half hour lemme see if I can do it right now. I'll actually put it on the interface returned by playOgg...... i'll get back to you in a lil
Nov 20 2022
On Sunday, 20 November 2022 at 20:34:44 UTC, Adam D Ruppe wrote:i'll get back to you in a lili went overbudget lol. but yeah the seek function in the underlying lib fails and idk why it is so hard to even trace what error actually happened in these C codebases
Nov 20 2022
On Sunday, 20 November 2022 at 21:57:03 UTC, Adam D Ruppe wrote:On Sunday, 20 November 2022 at 20:34:44 UTC, Adam D Ruppe wrote:I can imagine, errors in C are extremely annoying. I guess in the meantime I'll just use a python script to cut the audio before executioni'll get back to you in a lili went overbudget lol. but yeah the seek function in the underlying lib fails and idk why it is so hard to even trace what error actually happened in these C codebases
Nov 20 2022
On Sunday, 20 November 2022 at 22:26:26 UTC, TheZipCreator wrote:I guess in the meantime I'll just use a python script to cut the audio before executioni found the problem the library called seek(-thing) and my seek had a if(x <= 0) return; when it should have been if(x == 0) return. so it wouldn't go backward in the file! i'll add it to the interface and do some more fixes, then i can link you to the new file. should ACTUALLY be closer to 30 mins now but no promises i might still find new bugs yet but it is working in the one test file very well now.
Nov 20 2022
On Sunday, 20 November 2022 at 20:23:28 UTC, TheZipCreator wrote:and it appears that arsd.simpleaudio doesn't have a seek function. Is there a way to do this via other means? I want something like:Here's the patch for ogg, you can download those two files off git master too (i can't tag yet since i have a lot of pending stuff before regression testing but you can copy them into your current dir or replace the dub cache if you're using that directly and it will work) https://github.com/adamdruppe/arsd/commit/1f6ead0a178a8cfbb284d7719fe38863610165e2 It looks like: auto controller = aot.playOgg("myAudio.ogg"); controller.seek(5.0); // a float that is seconds in the file Looking at doing it for mp3 is why I didn't put it in the interface yet... my mp3 code ported to D doesn't have a seek function! But ogg did, it was just buggy.
Nov 20 2022
On Sunday, 20 November 2022 at 23:03:49 UTC, Adam D Ruppe wrote:Here's the patch for ogg, you can download those two files off git master tooworks great! thanks
Nov 20 2022
On Sunday, 20 November 2022 at 23:03:49 UTC, Adam D Ruppe wrote:Looking at doing it for mp3 is why I didn't put it in the interface yet... my mp3 code ported to D doesn't have a seek function!This is fixed on my computer now too, just need to check the rest of the bugs. So mp3 support will be coming before long as well. I'll do .wav too later in the week. Not sure about the emulated midi yet, but I'd love them all to implement the same interface, so I'll try. The next arsd tag is gonna have a lot of cool little things.
Nov 20 2022