katspaugh / wavesurfer.js

Audio waveform player
https://wavesurfer.xyz
BSD 3-Clause "New" or "Revised" License
8.74k stars 1.62k forks source link

wavesurfer.backend.getDuration() throws error #256

Closed shsavage closed 10 years ago

shsavage commented 10 years ago

I'm trying to get the duration of an audio file after loading it, and wavesurfer.backend.getDuration() throws an error: this.buffer is undefined on line 31 of webaudio.buffer.js which says, return this.buffer.duration. Without the call, the audio file plays correctly. Is there something else I should be doing?

allannaranjo commented 10 years ago

Are you calling "wavesurfer.backend.getDuration()" inside the wavesurfer.on("ready"...)?

Seems like the buffer has not been set when you make the call.

Allan

On Mon, Sep 29, 2014 at 12:42 PM, shsavage notifications@github.com wrote:

I'm trying to get the duration of an audio file after loading it, and wavesurfer.backend.getDuration() throws an error: this.buffer is undefined on line 31 of webaudio.buffer.js which says, return this.buffer.duration. Without the call, the audio file plays correctly. Is there something else I should be doing?

— Reply to this email directly or view it on GitHub https://github.com/katspaugh/wavesurfer.js/issues/256.

shsavage commented 10 years ago

I didn't call it from inside that function, but will give it a try to see if that works.

-s

On Mon, Sep 29, 2014 at 11:46 AM, Allan Naranjo notifications@github.com wrote:

Are you calling "wavesurfer.backend.getDuration()" inside the wavesurfer.on("ready"...)?

Seems like the buffer has not been set when you make the call.

Allan

On Mon, Sep 29, 2014 at 12:42 PM, shsavage notifications@github.com wrote:

I'm trying to get the duration of an audio file after loading it, and wavesurfer.backend.getDuration() throws an error: this.buffer is undefined on line 31 of webaudio.buffer.js which says, return this.buffer.duration. Without the call, the audio file plays correctly. Is there something else I should be doing?

— Reply to this email directly or view it on GitHub https://github.com/katspaugh/wavesurfer.js/issues/256.

— Reply to this email directly or view it on GitHub https://github.com/katspaugh/wavesurfer.js/issues/256#issuecomment-57208769 .

Stephen H. Savage, PhD. Scientific Software Engineer OKED/IHR Arizona State University Box 876505 Tempe, AZ 85287-6505

Affiliated Investigator - CISA3 Archaeology, Center of Interdisciplinary Science for Art, Architecture and Archaeology, Qualcomm Institute, University of California, San Diego

Senior Fellow, George Washington University, Capitol Archaeological Institute http://research.columbian.gwu.edu/archaeology/people/150

shsavage@asu.edu http://gaialab.asu.edu/home

shsavage commented 10 years ago

That did the trick. Thanks!

BTW, this is a great tool. We are using it to build an oral history project here at ASU. Registered users can upload interviews as .mp3 files. And we use the wavesurfer api to let them add stand-off annotations and transcripts to a MySQL database (both with time stamps to jump to the relevant part of the interview). Non-registered users can listen to any of the audio files.

-Steve

On Mon, Sep 29, 2014 at 11:46 AM, Allan Naranjo notifications@github.com wrote:

Are you calling "wavesurfer.backend.getDuration()" inside the wavesurfer.on("ready"...)?

Seems like the buffer has not been set when you make the call.

Allan

On Mon, Sep 29, 2014 at 12:42 PM, shsavage notifications@github.com wrote:

I'm trying to get the duration of an audio file after loading it, and wavesurfer.backend.getDuration() throws an error: this.buffer is undefined on line 31 of webaudio.buffer.js which says, return this.buffer.duration. Without the call, the audio file plays correctly. Is there something else I should be doing?

— Reply to this email directly or view it on GitHub https://github.com/katspaugh/wavesurfer.js/issues/256.

— Reply to this email directly or view it on GitHub https://github.com/katspaugh/wavesurfer.js/issues/256#issuecomment-57208769 .

Stephen H. Savage, PhD. Scientific Software Engineer OKED/IHR Arizona State University Box 876505 Tempe, AZ 85287-6505

Affiliated Investigator - CISA3 Archaeology, Center of Interdisciplinary Science for Art, Architecture and Archaeology, Qualcomm Institute, University of California, San Diego

Senior Fellow, George Washington University, Capitol Archaeological Institute http://research.columbian.gwu.edu/archaeology/people/150

shsavage@asu.edu http://gaialab.asu.edu/home

katspaugh commented 10 years ago

Allan, thanks so much, I appreciate your answers.

Steve, I'm very glad you're using it for science. Always interested in what people do with wavesurfer.js. Can you give us a link to the project? Can I put it on wavesurfer.fm as an example?

allannaranjo commented 10 years ago

You got it!

Allan

On Mon, Sep 29, 2014 at 1:59 PM, katspaugh notifications@github.com wrote:

Allan, thanks so much, I appreciate your answers.

Steve, I'm very glad you're using it for science. Always interested in what people do with wavesurfer.js. Can you give us a link to the project? Can I put it on wavesurfer.fm as an example?

— Reply to this email directly or view it on GitHub https://github.com/katspaugh/wavesurfer.js/issues/256#issuecomment-57219518 .

shsavage commented 10 years ago

I will be happy to do so, but we are not "live" yet. At the moment it's still running on my development server (http://gaialab.asu.edu/OHP), so I'd rather you didn't post it right now. Our School of Historical, Philosophical & Religious Studies will be getting a dedicated server for it in the near future, at which point it will be moved off my development platform.

Just last Friday we had a symposium here where I demonstrated it for the first time to a bunch of ASU faculty and staff. I've built a full, yet generic, MySQL database around it, and I'm trying to keep the audio part as simple as possible, while maintaining the functionality we need for an audio file annotation and transcription tool. That means not implementing regions, because they can get quite tricky to deal with for the user. I'm including the ability to set start and stop flags for annotations. Transcripts are essentially a special form of annotation, where the start and stop points are pre-set at five second intervals, and registered users can open a form to click links the pre-set blocks, and then type what they hear. We have these keyed by audio file and by userId, so we can collect multiple transcriptions for the same audio blocks because different people will have different interpretations of what the speaker said, especially if the audio is garbled or the speaker has an accent the hearer isn't used to.

It was very well received, and I think we will have a lot of people wanting to use it, as the application fills a niche that's not filled by things like SoundCloud. We already have two groups on campus that are planning on using it, and some NSF/NEH proposals are going to be prepared around it. But for now, please keep it to yourself. I'm still tweaking it on my development server.

Thanks,

-Steve

On Mon, Sep 29, 2014 at 12:59 PM, katspaugh notifications@github.com wrote:

Allan, thanks so much, I appreciate your answers.

Steve, I'm very glad you're using it for science. Always interested in what people do with wavesurfer.js. Can you give us a link to the project? Can I put it on wavesurfer.fm as an example?

— Reply to this email directly or view it on GitHub https://github.com/katspaugh/wavesurfer.js/issues/256#issuecomment-57219518 .

Stephen H. Savage, PhD. Scientific Software Engineer OKED/IHR Arizona State University Box 876505 Tempe, AZ 85287-6505

Affiliated Investigator - CISA3 Archaeology, Center of Interdisciplinary Science for Art, Architecture and Archaeology, Qualcomm Institute, University of California, San Diego

Senior Fellow, George Washington University, Capitol Archaeological Institute http://research.columbian.gwu.edu/archaeology/people/150

shsavage@asu.edu http://gaialab.asu.edu/home

shsavage commented 10 years ago

I've got a quick question for you. Is there a Drupal implementation of wavesurfer?

-Steve

On Mon, Sep 29, 2014 at 12:59 PM, katspaugh notifications@github.com wrote:

Allan, thanks so much, I appreciate your answers.

Steve, I'm very glad you're using it for science. Always interested in what people do with wavesurfer.js. Can you give us a link to the project? Can I put it on wavesurfer.fm as an example?

— Reply to this email directly or view it on GitHub https://github.com/katspaugh/wavesurfer.js/issues/256#issuecomment-57219518 .

Stephen H. Savage, PhD. Scientific Software Engineer OKED/IHR Arizona State University Box 876505 Tempe, AZ 85287-6505

Affiliated Investigator - CISA3 Archaeology, Center of Interdisciplinary Science for Art, Architecture and Archaeology, Qualcomm Institute, University of California, San Diego

Senior Fellow, George Washington University, Capitol Archaeological Institute http://research.columbian.gwu.edu/archaeology/people/150

shsavage@asu.edu http://gaialab.asu.edu/home

katspaugh commented 10 years ago

Cool project, thanks for sharing!

I think I saw a Drupal plugin on some forum, but I don't have a link and don't know the author.