audio

In Android, is there any way to route the audio to A2DP using “MODE_IN_COMMUNICATION”?

浪子不回头ぞ 提交于 2021-02-08 10:27:24
问题 If I set AudioManager mode to MODE_IN_COMMUNICATION, and set the Media Player stream to STREAM_VOICE_CALL, I can route the audio to the speakerphone or the internal handset speaker just fine. And if it's routed to the internal speaker, and a wired headset is plugged int, it automatically routes to it. However, I can't figure out a way to route the audio to an A2DP headset (without changing the audio mode to MODE_NORMAL, or the stream to STREAM_MUSIC). My problem is that using MODE_NORMAL and

How to plot the amplitude of audio file with c++?

狂风中的少年 提交于 2021-02-08 08:53:16
问题 I'm trying to create a program, using Qt (c++), which can plot the amplitude Signal (plot like audacity but dynamic waveform) when I playback an audio file (.wav, .mp3) using QAudiooutput and QIODevice . What I've done: with QAudioouput I can play the any audio file, with qwtplot I can plot any signal in 2D, in this case, x-axis will be time and y-axis will be the amplitude. Now, my problem is how to get the amplitude for each second (time)? Any help would be appreciated. 回答1: The normal,

Python - Using multiple flags for winsound?

主宰稳场 提交于 2021-02-08 08:51:01
问题 This is my current code: import winsound as wav wav.PlaySound("music.wav", wav.SND_LOOP | wav.SND_ASYNC) input() wav.PlaySound("beep.wav", wav.SND_ASYNC | wav.SND_NOSTOP) From the python winsound documentation: " [Winsound's] interpretation [of the file] depends on the value of flags, which can be a bitwise ORed combination of the constants described below " The music itself plays asynchronously, and loops. However, when the above code plays the beep, it throws an error (sprites.py is the

Check if audio playing with Python on Windows 10

蹲街弑〆低调 提交于 2021-02-08 08:42:34
问题 I'm working with Python 3.7 on Windows 10. I would like to detect if there is any audio playing on my computer or not. I was looking into win32api.GetVolumeinformation but I'm unable to get what I want. When you control your audio you can see if there is a program playing and I want to achieve that. 来源: https://stackoverflow.com/questions/59636713/check-if-audio-playing-with-python-on-windows-10

How to access to L and R channel samples of stereo audio file separately?

人盡茶涼 提交于 2021-02-08 08:26:24
问题 Suppose I have 8-bits (mono and stereo) .wav files. When processing of this file I have to declare pointer to array of samples. Suppose I create array for samples. Then if it is mono , I read each sample using for(i = 0; i < n; i++ ) . Q: How can I access right and left channels separately (stereo)? PS I've read a lot about "mono, stereo and *.wave" but still I can't understand how can I realise access to each channell separately... 回答1: You still have array of samples, the question is how

Reading audio file in C++

微笑、不失礼 提交于 2021-02-08 08:01:53
问题 I want to read an audio (.wav) file using C++. So far i have read the header of the wav file. How do i loop into the data part of the wav file convert it between -1 and 1 and then write it out to a txt file. i have done the following but when i plot the resulting txt file using MATLAB, the signal seems to be distorted. #include <iostream> #include <stdio.h> #include <stdlib.h> #include <fstream> using namespace std; //double byteToDouble( char firstByte, char secondByte ); // WAVE PCM

Reading audio file in C++

孤街浪徒 提交于 2021-02-08 08:01:08
问题 I want to read an audio (.wav) file using C++. So far i have read the header of the wav file. How do i loop into the data part of the wav file convert it between -1 and 1 and then write it out to a txt file. i have done the following but when i plot the resulting txt file using MATLAB, the signal seems to be distorted. #include <iostream> #include <stdio.h> #include <stdlib.h> #include <fstream> using namespace std; //double byteToDouble( char firstByte, char secondByte ); // WAVE PCM

Java: Processing audio in real time from speakers

£可爱£侵袭症+ 提交于 2021-02-08 06:39:39
问题 I'm working on a project that will change the brightness of keyboard lights with PWM signal, according to output sound levels. That trouble is, I need the output stream in real time. So far I used javax.sound.sampled package and I never succeeded grabbing the audio output. However, what have I done was to use targetDataLine and sourceDataLine, which don't look like the way to go, I'm still trying though. What I need is an audio stream provider, which my java app can "hear" and process it. So

Changing brightness depending on sound (Processing)

。_饼干妹妹 提交于 2021-02-08 06:14:47
问题 I am learning processing right now and I am trying to make a sketch that could change colour when the sound changes. (When Amplitude + , Then Brightness+ ) Because changing colour does not need to change as rapid as the draw() function. So how could I build a clock so that the color would not change in every draw? This is the code I am using right now: import ddf.minim.*; import ddf.minim.signals.*; import ddf.minim.analysis.*; import ddf.minim.effects.*; Minim minim; AudioPlayer song; FFT

Changing brightness depending on sound (Processing)

房东的猫 提交于 2021-02-08 06:14:33
问题 I am learning processing right now and I am trying to make a sketch that could change colour when the sound changes. (When Amplitude + , Then Brightness+ ) Because changing colour does not need to change as rapid as the draw() function. So how could I build a clock so that the color would not change in every draw? This is the code I am using right now: import ddf.minim.*; import ddf.minim.signals.*; import ddf.minim.analysis.*; import ddf.minim.effects.*; Minim minim; AudioPlayer song; FFT