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

[FEATURE REQUEST] Send audio #17

Closed
curchunflo13 opened this issue Jul 1, 2019 · 4 comments
Closed

[FEATURE REQUEST] Send audio #17

curchunflo13 opened this issue Jul 1, 2019 · 4 comments
Labels
enhancement New feature or request

Comments

@curchunflo13
Copy link

Hello, how are you? Thank you very much for your work. I would like to send audio, it would be possible? Thanks in advance

Regards

@hoehermann
Copy link
Owner

hoehermann commented Jul 2, 2019

Thank you for your request. Sending audio using go-whatsapp in itself seems easy to do. There are, however, other obstacles to overcome:
The first is about getting the audio into purple. Purple is designed for text-messengers, sending media is only a gimmick. I see these possibilities:

  1. Pidgin drag-and-drop audio file into a conversation window.
    I like this most. It feels convenient. I have no idea hot to do this, though.
  2. Have Pidgin ask for a file.
    Seems quite clean. I have no idea hot to do this, either. It's probably the purple request API which I am not acquainted with. Yet.
  3. Intercept file links to audio files.
    This feels ugly, but it is probably most compatible with i.e. Spectrum or bitlbee applications.

The second is the audio itself. From my experience with davidgf's whatsapp-purple I know the original WhatsApp is (and that is okay) quite picky about the audio format. That is a problem as it represents a Pandoran box of end-user error: People do not even know what a codec or a container is these days. They cannot tell MOV from MPEG4 as they seem similar enough. They see no difference in a raw AAC, MP3 or WAV stream. I do not really want to cope with myriads of invalid bug reports. I would need to make this a very hidden feature for experts at which point I ask myself whether it is a good idea to include it altogether.
I could mitigate this problem by depending on a media library (libav probably) to

  • check the audio format and optionally re-encode as necessary.
  • record directly from a microphone and create the compressed audio file in the plug-in.

Both options seem viable, but adding an additional dependency would make maintaining the code and compiling on other platforms more tedious.

I myself do not really make use of audio messages. As a result, there is no real personal gain for what looks like a decent amount of work. As with any feature, I gladly accept pull requests. Apart from that, an implementation done by me is a very vague "maybe some day". Sorry.

@hoehermann hoehermann added the enhancement New feature or request label Jul 2, 2019
@curchunflo13
Copy link
Author

curchunflo13 commented Jul 2, 2019 via email

@hoehermann
Copy link
Owner

hoehermann commented Jul 4, 2019

After I gave some love to the guy from #5, I decided I should give some to you, too. There now is a new branch. I also uploaded a binary for your convenience. You can now send an audio file by entering /sendmedia audio instead of a message. The plug-in will then read ~/.purple/gowhatsapp/outgoing (hardcoded path) and send it as an audio message. It needs to be in a very specific format. I had success with ffmpeg:

ffmpeg -f pulse -i default -ac 1 -ar 48000 -ab 17k -f opus -y ~/.purple/gowhatsapp/outgoing

(Finish your recording by pressing q.) Although go-whatsapp reports a timeout, it looks like the messages are still sent, though. I cannot really test it since I do not have a second phone at hand. Expect this to be wonky and unreliable. It may not work, get you banned and/or eat your dog.

@curchunflo13
Copy link
Author

curchunflo13 commented Jul 4, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants