-
-
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
Spectrogram's canvas does not full fill the container of it #3140
Comments
You might need to increase the sampleRate for it to have the data to fill the chart. Try passing 22050 or 44100 like here: https://wavesurfer-js.org/examples/?spectrogram.js |
I see, thanks for checking this. Looks like a regression in v7, since you said it worked well in v6. 🐞 |
Yep, the version of 6.2.0 worked well, but the problem above was found while using the version of 7.1.5. Hope this can help. |
It looks like decreasing the sampleRate value solved your problem in some way? I've tried it too, but makes no diffrence in my case |
Try also adjusting the min and max frequency accordingly. https://wavesurfer.xyz/docs/types/plugins_spectrogram.SpectrogramPluginOptions
|
my sample is 44100 hz. i can give a value up to 11050hz or i must use these value ? |
|
You can set any value down to 8000 for sampleRate. In Chrome down to 3000. |
for spectrogram : |
KrazyPhish, how is the samplerate of your audio file? wich values are you using for sampleRate and frequencyMax ? |
I am not sure about my files sample rate range cause the file was somehow just use to test, 22050 for the sampleRate and 5512.5 for the frequencyMax are my settings. |
I think this is now fixed in the latest version, can anyone confirm? |
I've tried the version of 7.8.15, it worked, I raised the sampleRate value, haven't seen the problem anymore. Appreciate that. |
Bug description
I was doing a Vue2 to Vue3 project, found that spectrogram's canvas cannot full fill its parent element.
But it works well in my Vue2 project.
Infomation of the versions:
my Vue2 project: wavesurfer.js 6.2.0 (2022-05-16)
my Vue3 project: wavesurfer.js latest
Environment
Minimal code snippet
In Vue2:
plugins.push(
spectrogram.create({
container: this.$refs.waveSpectrogramRef,
labels: true,
height: height * this.verticalZoom.value,
colorMap
})
)
In Vue3:
const spectrogram: SpectrogramPlugin = SpectrogramPlugin.create({
container: waveSpectrogramRef.value as HTMLElement,
labels: true,
height: height * state.verticalZoom,
colorMap
})
The value height equals its parent's clientHeight, it's a constant value, so is the verticalZoom value.
Expected result
Like wavesurfer works in my Vue2 project, spectrogram's canvas fully fill its parent element.
Obtained result
Same as Expected result
Screenshots
The parent element div.



The left side label canvas, this means spectrogram tried to fill the element, I guess.
The style attributes show that the canvas has fully filled its parent element, there must be some problems with canvas while the plugin working with canvas.
The text was updated successfully, but these errors were encountered: