-
-
Notifications
You must be signed in to change notification settings - Fork 177
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
Feature voice message as mp3 #4920
Conversation
- uses MediaRecorder which is restricted to audio/webm or audio/mp4 codecs based on pr #3456
The only codec supported natively in Chrome MediaRecorder weba (Web Audio) which is not supported in iOS. This PR adds a standalone AudioRecorder with a simple dependency to lame
ea00cea
to
2638fe1
Compare
2638fe1
to
79bf7d2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't looked thoroughly yet.
packages/frontend/src/components/AudioRecorder/AudioRecorder.tsx
Outdated
Show resolved
Hide resolved
packages/frontend/src/components/AudioRecorder/AudioRecorder.tsx
Outdated
Show resolved
Hide resolved
very nice to push that forward! tested a bit - voice recording and sending works already nicely, also for iOS - thanks a lot to give us more time to adapt iOS to ogg, and to remove the pressure 🙏 some UI things that come to my mind:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
packages/frontend/src/components/AudioRecorder/styles.module.scss
Outdated
Show resolved
Hide resolved
ah, another things that needs to be targeted before it can be released: you can switch to another chat while recording, and the bar will stay as is. the message then is sent to whatever chat was selected last, this is quite unexpected ... i suggest to stop recording and stage the recording when switching chats (this is what eg. signal is doing) |
sampleRate: 44100, | ||
bitRate: 128, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this results in unexpectedly high data usage. until we can switch to opus, i suggest to half both parameters, for voice that is usually good enough
sampleRate: 44100, | |
bitRate: 128, | |
sampleRate: 22050, | |
bitRate: 64, |
just a rough estimation, for sampleRate, i am not 100% sure, maybe that's unrelated to file size, we should try out (older considerations)
moreover, we should respect the "media_quality" setting, but that can be done in another PR to not complicate things here further
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're into downsampling, for speech 8000 would be enough to make it understandable, but yeah, that is gonna be phone-level quality.
https://en.wikipedia.org/wiki/Sampling_(signal_processing)#Speech_sampling
For reference, in Telegram a one-minute voice message takes up ~230KB.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I played around with various values but it didn't had any impact on the size of the recorded audio. It's always ~484kB for 30 seconds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm, then there is a bug somewhere, maybe in the used library, ~1 mb/minute is the standard rate mp3 has as 128 kbit, 44.1 kHz
i think, it should not block merging this PR, but we might want to file an issue for that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will open a new issue when this PR is merged
About colors in the volume meter: many apps such as discord, mumble (in first setup), audacity and professional Digital Audio Workstations have different colors for ranges, like green, yellow and red (red is if you are too loud so that it clips/overloads). Bildschirmaufnahme.2025-04-08.um.06.43.41.movBildschirmaufnahme.2025-04-08.um.06.45.34.movJust an idea, I'm not saying that we need it, especially not now, I think it is fine as is (with button placement that r10s posted). maybe we find a more intuitive solution in the future like a waveform. |
48a1709
to
610f668
Compare
You can see it, if you put the audio input to a maximum in your system settings Only question is: it's hard to detect the "real" limit where clipping starts... I set the values here: https://github.com/deltachat/deltachat-desktop/pull/4920/files#diff-769f75b81cc687f60e9af48e627fdb8efe8608b32f185df559644c374358998dR131 |
I fixed it now lilke this: when you switch chats without stopping the recording it will be lost. If you stop recording before switching your record will be saved as draft. That should be sufficient for now. |
packages/frontend/src/components/AudioRecorder/AudioRecorder.tsx
Outdated
Show resolved
Hide resolved
_locales/_untranslated_en.json
Outdated
"voice_send": { | ||
"message": "Send a voice message" | ||
}, | ||
"voice_send_cannot": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is the case.
packages/frontend/src/components/AudioRecorder/AudioRecorder.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels pretty solid overall.
I left a couple more non-critical comments, but I won't insist on addressing them in this MR. I'll also create an issue with further improvement ideas.
IMO this can be merged at the current state.
Thanks for finally bringing such a demanded feature to life!
packages/frontend/src/components/AudioRecorder/AudioRecorder.tsx
Outdated
Show resolved
Hide resolved
packages/frontend/src/components/AudioRecorder/AudioRecorder.tsx
Outdated
Show resolved
Hide resolved
packages/frontend/src/components/AudioRecorder/AudioRecorder.tsx
Outdated
Show resolved
Hide resolved
packages/frontend/src/components/AudioRecorder/AudioRecorder.tsx
Outdated
Show resolved
Hide resolved
packages/frontend/src/components/AudioRecorder/AudioRecorder.tsx
Outdated
Show resolved
Hide resolved
packages/frontend/src/components/AudioRecorder/AudioRecorder.tsx
Outdated
Show resolved
Hide resolved
Co-authored-by: WofWca <wofwca@protonmail.com>
Co-authored-by: WofWca <wofwca@protonmail.com>
This is a workaround as long as iOS does not support the weba codec and as long as we don't have some audio converter in core.