C# bass detection from windows audio output - c#

I want to create somewhat of a simple visualizer for my PC audio output channel (same as speakers/headphones) that will send signals to my arduino board when there is bass or treble being played. I already have LEDs wired up and my own program with animations and colors running, I also developed a game modification that lets me control the lights using game events. All I need now is to read my PC audio output channel, find there a specific sound (probably bass, right?) and send byte on serial port just as I did previously.
I can't find any simple tutorials how to read windows audio so I decided to ask here. Where should I start? BASS.NET looks very complicated for that "simple" task. Is there something built-in in standard .NET libraries? I am by no means audio mastermind, I am not even sure if I am using correct terms. In simple words I just want to make lights light up to the rhythm when there is real-time music playing.

Related

C# Equalizer app for Windows Sound System

I would like to make an Equalizer app for Windows and apply settings for sound system. I've found many sound API like WASAPI, DirectSound but I don't know if I can use there to apply a filter in real time for all sounds. On C# there is CSCore to manipulate Audio sources but I don't know if I can use it for device.
The other solution is to create a virtual sound device on Windows. It get the actual sound output, transform it with a filter in real time and output this sound. But I don't know where to start to do this. This thing suppose to change to C++ but it is possible in C#?

Music file rhythm and intensity detection on Xamarin.Forms

Our product is a dimmable light bulb, connected via Bluetooth and App, App can adjust the brightness (color) of the bulb, the brightness value is 1-100.
Now the App wants to add a function that automatically dims according to music (Mp3). While playing music, it automatically adjusts the brightness of the light according to the rhythm and sound size of the music.
The music has been played using https://github.com/adrianstevens/Xamarin-Plugins/tree/master/SimpleAudioPlayer
My question is, when playing music (Mp3), how do I convert the rhythm and intensity of the music to a 1-100 number and send it as a brightness value to the light bulb?
A lot of C# (Windows-based) music analysis examples were found online, but Xamarin was not found.
Thank you for your help!
Sounds cool! There are two parts to your problem,
Enhancing the audio player - Since you have implemented the Audio Player already, all you need to do is add a Value changed event to the slider, as shown in this official Microsoft Example, so that changing the value of the slider will now also communicate with your device/bulb
Communicating with your device - This will depend on how your device accepts values over bluetooth. We wouldn't be able to know for sure what serial values your bulb is accepting, but you have to send serial data values through bluetooth. You can use this to help simplify with this part.

Playback sound while recording

I want to record sound to a file and at the same time I want to be able to play audio from the same file in C#
For example, play the last 15 seconds but the microphone has to keep on registering and recording while replaying.
Is this possible and in that case, which is the best approach to do this?
The answer is YES, and you should play around with low level audio API, namely WaveIn/Out functions from winmm.dll, through P/Invoke in C#.
In short words, you need to use WaveIn to capture input signal from a input device and store in some structure, then use WaveOut to play back the audio simultaneously, or some delay after.
Here is a project you can start with: a duplex audio player. You can download the project and play around with it and see how it achieves it, then do some modifications upon the project to achieve what you want :)

Should I use DirectSound or WASAPI for my audio project?

I am starting a project where minimum requirements will be Windows 7. I'll be using NAudio as my interface to audio. I am not sure what I should be using: DirectSound or WASAPI? I am going to be doing the following:
Manipulating volume/mute on multiple USB sound cards for both speaker and the microphone.
Rerouting input from sound card 2 into the output of the sound card 2 (if that's possible).
Manipulating the audio input of the sound card with some effects.
I understand that behind the scenes DirectSound processes all the audio via WASAPI anyway and it sounds like DirectSound has joined the list of deprecated technologies.
However, my question is more from a functional level: which API will let me do what I described above.
where minimum requirements will be Windows 7
Certainly WASAPI - you have better control over things, WASAPI interfaces/API are well made and easier to use, less overhead if you need to be close to real time. There is nothing on th elist that DirectSound can give you and WASAPI can not.
The only reason to use DirectSound if you need pre-Vista systems where WASAPI was just not available.

sending a beep through microphone input

Is a way of creating a program (either in C(+,++,#) or VB.net) that would be able to send a beep sound through the same line-in that is being used for audacity (not stereo mix)?
I am trying to make a way of syncing up audio and video from 2 different programs, in a similar way that a clapper bored works in the movies.
Would there be a way of using a sort of microphone enhancement that could be created because they affect the microphone input?
I assume you're trying to implement something like http://www.singularsoftware.com/pluraleyes.html then? I think the best way would be to write a VST/LADSPA plug-in for Audacity that inserts the beeps synced to a timecode stream (or whatever you're syncing to).
There's a neat little library called VST.NET that allows you to write VST plug-ins in standard C#/VB.NET if you like.

Categories