-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
fix exportPCM to return json data #1094
Conversation
@entonbiba Is this right?
I just get a bunch of null values. |
@agamemnus what browser you using and can you post the audio file, I'll take a look. |
Chrome. But let me play some more with this. The waveform does show up so I must be doing something wrong. |
@agamemnus did you get this working? i just get a blank array |
I was working on it last night, but fell asleep. The data is definitely being generated, but something is not quite right with the parameters, I think. |
Hmm not sure what I'm doing wrong. Everything I try, it just returns an empty array |
Do you have it actually creating a waveform? |
Yeah waveform is generated fine, I just need to export the peaks data so I can save and pre-render on the next load |
I was actually hoping to get this working with node. |
It seems my version did not have |
Same issues here. Waveform gets generated fine but exportPCM just outputs an (almost) empty array - all values are null except the last two, which are 0. No matter which browser I use or which file I use (WAV, mp3, stereo, mono) - no matter which options I use to create the wavesurfer instance. I would really love to use the export of the peaks to use them once generated. |
See solution above... Does that fix it?
|
Thanks, but I'm not sure where I have to put your example line (if you are referring to: var peaks = this.backend.getPeaks(length, start, length - 1);) (I've started using wavesurfer a couple of hours ago...). Would I have to change the exportPCM method in wavesurfer.js or what? I'm using the cdn version //cdnjs.cloudflare.com/ajax/libs/wavesurfer.js/1.4.0/wavesurfer.min.js thanks |
The cdn version isn't up to date. Both getPeaks and exportPCM have updated code.
|
Ok, so what do I have to do to use the most recent version? I have already downloaded the complete zip file and put the contents of the "src" folder in my local webserver's "js" directory and try to reference wavesurfer.js instead of the cdn version but that doesn't seem to work - it's missing utils stuff. The minified version in the "dist" folder is probably as old as the cdn version, right? |
One simple way is to use the un-minified version, just replace the relevant functions from the source... and then minify it. Or you can compile the source with grunt. (see readme under npm)... |
Alrighty! I have done all the npm... grunt stuff and built my own dist folder contents now containing the new minified version generated from the latest master and baaaam - it's working! :) Now I'm getting actual values when calling exportPCM instead of an (almost) empty array! Thanks a ton! Now I have to check how I can re-use those generated peak data! thanks again! |
If your audio data barely changes and/or if the audio files are really big, I would suggest storing on the server -- see #1082. |
thanks, yes I will store the peak data in a mySQL database. I'm creating a php/javascript website at the moment for selling my own royalty-free music ad sound fx. I will parse the peaks only once I upload my music etc. via an admin area and store all the peaks, metadata and description of my sound files in a database... |
fixes #1083 - added default start parameter
0
to work with getPeaks method.update docs for exportPCM #1101