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

broken voice message spectrogram #354

Open
magrega opened this issue Jan 22, 2023 · 8 comments
Open

broken voice message spectrogram #354

magrega opened this issue Jan 22, 2023 · 8 comments

Comments

@magrega
Copy link

magrega commented Jan 22, 2023

broken voice message spectrogram

Steps to reproduce

Just try sending any voice message (.ogg file, opus encoder) with sendVoiceAsync() that is longer than 10-15 minutes

await using Stream stream = System.IO.File.OpenRead(@"C:\Users\magrega\YandexDisk\проги\audio.ogg"); await client.SendVoiceAsync( chatId: message.Chat.Id, voice: new InputOnlineFile(stream), duration: 1097);

Expected behavior

Voice is sent as any other voice message with actual soundwaves
image

Actual behavior

sound spectrogram is flat

Screenshots

image

Additional info

The voice message works properly except for the broken spectrogram. If clicked with right mouse key and Saved as, then after downloading the audio spectrogram refreshes and is visible. How to refresh it on upload to a chat?

Environment data

NuGet Package Version: 18.0.0

.NET Version: .NET 6.0

IDE: VS2022

App: iOS, Win10

@levlam
Copy link
Contributor

levlam commented Jan 22, 2023

This is expected behavior for voice messages bigger than 1 MB, for which waveform can't be generated server-side. As documented, such voice messages can't be uploaded by URL at all, and if uploaded as file they have only properties passed during the upload.

@magrega
Copy link
Author

magrega commented Jan 22, 2023 via email

@levlam
Copy link
Contributor

levlam commented Jan 22, 2023

I’m new to this so if you could elaborate a bit and tell me why the waveform is okay when I upload the same file from recorder app on my phone?

The waveform is generated by the app, which uploads the file. Bot API doesn't support bot-side waveform generation.

By the way, waveform is useless and irrelevant for long files anyway, because it shows samples from too distant points.

@magrega
Copy link
Author

magrega commented Jan 22, 2023

Still I care for aesthetic reasons. I think it's better than a dead man's pulse. So I have to generate waveforms from my app and then send it with stream to bot chat, is that right?

@levlam
Copy link
Contributor

levlam commented Jan 23, 2023

If the file was uploaded by some other means with a waveform, then it can be sent by the bot via file_id with the same waveform.

@magrega
Copy link
Author

magrega commented Jan 23, 2023

If the file was uploaded by some other means with a waveform, then it can be sent by the bot via file_id with the same waveform.

Well, I've tried sending the m4a from recorder as a voice with the bot, the result is the same. What means can I use to upload files differently from Stream to preserve waveforms? An example at least.

@levlam
Copy link
Contributor

levlam commented Jan 23, 2023

Waveforms for voice messages bigger than 1 MB are added by the app, which uploads the file. There is no way to add a waveform through Bot API.

@magrega
Copy link
Author

magrega commented Jan 23, 2023

okay, got it.

SpEcHiDe added a commit to TelegramPlayGround/pyrogram that referenced this issue Feb 10, 2024
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