How to support both MP3 and WAV for a gstreamer source element plugin [closed] - rust

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 1 year ago.
Improve this question
I'm developing a gstreamer plugin using the rust programming language. It's a source element and gets a text as a parameter and returns the correspoding speech of the text using some kinds of TTS providers(Google, Amazon, WellSaid, etc). Some providers return an MP3 file and some WAV. So what is the best approach to send the received sound file to the src pad of the element?
Decode MP3 and return PCM for both MP3 and WAV files. (I don't know whether it's possible to decode it inside the plugin or not)
Make the source dynamic to have an MP3 pad or WAV pad.
I'm new to gstreamer and I don't know which approach is better.

Output whatever you receive and let the next elements worry about decoding. That way you're not adding unnecessary complexity to your element, and applications can decide which MP3 decoder they want to use or if they want to directly forward the MP3 elsewhere without re-encoding.

Related

How would you play sounds from a microcontroller (STM32 etc.)? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
For example, how would a washing machine play a specific sound (MP3 or WAV or whatever) when finished? Which external components are needed?
I know this is a really vague question but I could not find any real solutions except some kind of MP3 player module which seems to be more "end-user friendly" instead of being used programmatically (skip and pause buttons).
Various beeps can be made simply by toggling a pin, but I assume your are looking for something more melodious, and without using a sound synthesiser.
For short sound bites: you can store them in (external) memory and play them through a DAC, if your MCU has one. I put a basic implementation of this for SAMD21G-based Arduinos here; the idea is the same for all MCUs that have a DAC. If your MCU doesn't have a DAC, you can use an external one, or make a "poor man's DAC" by using PWM and low-pass filtering the output.
Another option is creating an I2S stream from stored samples and send them to an external amplifier (module) that accepts I2S. It helps when your MCU has an I2S peripheral.
For longer sounds, your best bet is probably playing them from a MCU-controlled MP3-player, because you need the SD-card storage or a similarly large storage anyway for large sound files.
In all cases, you'll need an external amplifier and speaker.

How to encrypt a folder using golang [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I want to encrypt a folder in golang, but I have no idea how to go about it. All I found on the internet are examples of encrypting a file, not a folder..
Thanks!
Encryption is a mechanism for encoding a byte stream in such a way that the original byte stream cannot be deciphered by a reader without the key.
A folder is a file system construct.
You cannot encrypt a file system construct; only a byte stream. In order to "encrypt a folder", you can do one of two things:
Encrypt each file within the folder separately
Convert the folder into a single file (e.g. TAR) and encrypt that
Which is preferable depends on your specific needs, but these are the available options. This is why you cannot find examples of encrypting a folder; as a concept, it is technically infeasible.

what is the best audio format for human voice ? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
Hi i am working on a compression audio stuff and i would like to ask you about the audio format the most adequate for human voice that can concerve the same quality of my files while trasfering to the server ? Thanks
With standard audio formats, there's not much of a difference between music and speech compression. MP3, for example, is designed to only lose information that is largely imperceptible to the human ear, especially at high bit rates. MP3 is nice because can choose a bit rate that meets your data needs. If you need more extreme compression you'll definitely lose a noticeable amount of quality.
You will not be able to tune the flac codec, and it's seams overkill to use it for voice recording.
Even if mp3 is not supported natively with java, you should take a look at "lame" which is a CLI mp3 codec, very easy to use with Java (create a Process object, with the parameters you wants...)
usage:
lame.exe -V2 file.wav file.mp3
or from a wav buffer (if your application records the voice itself)
lame.exe -V2 - file.mp3

How to convert audio stream from PureTool/CVS video? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I apologize if there is a better place to post this. I recently came across a couple CVS single-use video cameras that I had been using back in 2005. I still have the USB cable I made and now that I've switched to Mac I can use Puretool to extract the old videos from the cameras. The problem I'm having is that I can only hear the audio when viewing the videos with VLC media player. I read on PureTools site, a common problem is that the audio codec used is incompatible with Quicktime and the audio stream needs to be converted. There is a link on their site to a program called FixSound which is purported to fix this, but the link is dead and I've been unable to find any further information about this. If anyone could point me in the right direction, I'd be very grateful. All the videos I'm dealing with are from the first year of my son's life and I'd really like to be able to archive them in a more uniform format. I would think this would be possible to do using Adobe Audition or some other program in Adobe's CS6 Master Collection but I've only dealt with Photoshop, Illustrator, Dreamweaver, Flash & Fireworks. I have no experience with audio or video yet.
Thanks,
Mark
I found a workaround but if anyone has a better suggestion, please post.
I used SoundConverter / GStreamer on my Ubuntu box to convert the audio from the old video to mp3 then combined that with the original video on my iMac using Encore and built it as .f4v (for achiving, I can just build a DVD from Encore). I guess from there I can use Media Encoder to come up with a Quicktime, 3gp, etc... version.

Audio Conversion using C#.Net [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I want to build a simple Audio Converter (between major file formats) using C#.NET, so I need to know the basic steps to do so.
Thanks.
Step 1: find a good third-party component(s) that do(es) conversion between file formats.
Step 2: use this component in your app.
If your intent is to write all the raw conversion code yourself, get ready for some pain. The WAV file format (aka Linear PCM) is easy enough to deal with, as long as the file is just a header plus the sample data. Often, however, WAV files are a lot more complicated than this and require much more elaborate code to locate the various RIFF chunks and parse the file.
And that's just for a very straightforward file format that (usually) does not do any encoding of any sort. The MP3 format is vastly more complex, and requires a good knowledge of FFT (Fast Fourier Transform) and the like.
Update: Alvas.Audio is one third-party C# component that may do what you need. NAudio is another.

Resources