Read microphone input in WASM - rust

I'm trying to figure out how to read microphone input in WASM (Rust), but I can't figure it out. I found a bunch of examples of generating audio output, but reading input doesn't seem to be covered anywhere. I was trying to convert some JS examples into WASM, but I failed.
I'm going to process the microphone input in WASM, so I'd need a solution that doesn't need to communicate too much with JS.

Related

Read audio channel data from video file nodejs

I want to read audio frequency data from video mp4 file get it as array (not mp3 file) that’s it, no need to do anything fancy
Currently I ‘m doing it it with webaudio api in javascript
However i need to do it with nodejs
i want to make this as fast as possible
I don’t care about the video frames data Or anything else
I’m trying with ffmpeg it seems very hard
if there is another way with fs maybe ?!!
Thank you in advance

How to access AudioContext in NodeJS and write sinewave into AudioBuffer

I'm trying to create a small snippet that allows me to make small audio buffers with simple sine waves in nodeJS.
I found some code here on StackOverflow that I edited a little. It was intended for a web environment with new window.audioContext. After a bit of searching, I only found an NPM module called audio-context.
What I'm trying to achieve is to make a function that is capable of layering waves of different forms and differing frequency.
Sadly, after a lot of trying and finally looking into the module itself, it seems the only available contexts are from web environments.
Any effective way to do this? I can't believe there is no proper way to do direct buffer work like this with just Node.Js.
More general solutions would probably help me more.
The code for generating sine waves and writing them into the AudioBuffer was from the solution to this:
Generate sine wave and play it in the browser

Recording microphone audio with Haskell

I am working on some voice recognition software as my first Haskell project. I am looking for something something that could work cross-platform. My plan is as follows:
Record audio as a .wav file
Use https://hackage.haskell.org/package/flac to convert the .wav file to a FLAC file.
Send a speech API request to Google's Speech API (as can be seen here https://cloud.google.com/speech/docs/quickstart).
Receive response and interpret it.
However, I am currently somewhat stuck on step 1 as it seems rather difficult to record microphone input in Haskell.
Since this is a learning experience I wanted to try to find something simple that I could understand quite easily. After some googling I found this: https://codereview.stackexchange.com/questions/169577/sound-recorder-based-on-sdl2, which uses Haskell SDL2 bindings and Codec.Audio.Wave. I tried copying the code to see if it would work, but alas it did not. I did not have any errors with running the program, but when I tried playing the wave file, nothing happened and it seemed completely empty. Nothing seems to have been recorded, as the file size is only 44 bytes.
I figured the issue was the SDL open device spec not being able to find a suitable recording device, so I tried checking the frequency to see if my microphone wasn't able to handle 48000 Hz and then since that didn't help (it is 96000 Hz max) I tried messing around with the device channels, but that did not help either.
The problem is not with my microphone since I tried recording some audio with arecord (on Arch Linux), which worked just fine. As I said, this is my first Haskell project and I am a bit of a newbie and although I do have experience in other languages it is completely possible that I have done something really silly.
I am not opposed to any solutions not involving SDL2, but as I am looking for something (hopefully) simple and cross-platform, this seemed like a good fit.

Integrating a video codec into gstreamer or vlc

I have an C-Code for a video codec. It takes in a compressed format as an input and give out a YUV data buffer. As a standalone application i'm able to render the YUV generated using OpenGL.
Note: This codec is currently not supported by VLC/gstreamer.
My task now is to create a player using this code (that is with features such as play, pause, step, etc.). Instead of re-inventing the whole wheel, i think it would be better if i'm able to integrate my codec into gstreamer player code(for Linux).
Is it possible to achieve the above? Is there some tutorial using which i can proceed? I have searched a lot on net but was unable to find anything specific to my requirement. Any information or links specific to the above problem will be of great help to me. Thanks in advance.
-Regards
Since the codec and container are of new MIME types, you will have to implement a new GstElement for demuxer and codec. A simple example (for audio) is available in this location. I presume this should provide a good starting reference for you.
Some additional links:
To create a decoder plugin, you can refer to the vorbisdec implementation.
To create a demuxer, you can refer to the oggdemuxer implementation.
Reference to factory make

Extract Wavelength from MP3 as an Image

Are there any good libraries that can help convert an MP3 into an image of its wavelengths (I think that's the proper term). What I'm looking for is a way to generate the wavelengths of MP3s server-side like is done on Souncloud: http://soundcloud.com/smixx/takin-vc-money-money-cash-ipos
What would be the best approach to extact that type of image from an audio file?
This would be the best response from the community:
http://andrewfreiday.com/2010/04/29/generating-mp3-waveforms-with-php/
The correct term is WAVEFORM that's what you see #soundcloud.
From what I've seen, the PHP script is pretty lightweight and awesome!
BTW: I just realized that the stackoverflow question points to the same PHP code #andrewfreiday
EDIT: Just a FYI, I started playing with node.js for a while now and while I was making a simple MP3 player I started using this packaged for the waveform.
https://www.npmjs.com/package/waveform-data

Resources