audio-recording

Alsa: snd_pci_readi() and real-time threads

女生的网名这么多〃 提交于 2020-03-26 05:40:12
问题 I've got a dedicated thread that caputures audio from Alsa through snd_pcm_readi(). Periodically I get a short read, meaning snd_pcm_readi() returns a positive integer lower than my buffer size, and there's obviously a 'pop' sound in my audio stream. Then I set the thread priority to real-time and this gives a tangible benefit, far less short reads, but this doesn't solve. Now the question: before going down the bumpy road of a real-time patched Linux kernel, there's something else I can do

Recording Audio from USB with PyAudio

你离开我真会死。 提交于 2020-02-24 11:40:11
问题 I am trying to record a 5 second clip of audio using a microphone that's connected via usb but I can't seem to get it to work. I am able to record using that mic with QuickTime but not with python. When the script runs, it generates the wave file but the file doesn't have any sound. This is the code I'm using to record the audio. I have set the input_device_index=4 which is the input device id for my MADIface XT mic. import pyaudio import wave CHUNK = 1024 FORMAT = pyaudio.paInt16 CHANNELS =

How can I change the Audio Source of a Video in HTML?

烂漫一生 提交于 2020-02-06 08:20:06
问题 I want to change the audio track of a video that I am playing in html. This is my sample code. <!DOCTYPE html> <html> <head> <title>Video</title> </head> <body> <video controls playsinline autoplay muted loop> <source src="video.mp4" type="video/mp4"> Your browser does not support the video tag. </video> </body> </html> Inside the same folder, I have an audio.mp3 . I don't want to mute this video and append a hidden player and play both separately, basically I want to change the audio source.

android voice recording - voice with background noice issue

大兔子大兔子 提交于 2020-01-25 11:14:42
问题 I am developing an voice recording android application. For this I am using the following code. When I record and play it, I am getting recording voice with background noice. How can I get only recording voice. Can anyone help me? import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import android.app.Activity; import android.media.AudioFormat; import android.media.AudioRecord; import android

android voice recording - voice with background noice issue

天涯浪子 提交于 2020-01-25 11:12:59
问题 I am developing an voice recording android application. For this I am using the following code. When I record and play it, I am getting recording voice with background noice. How can I get only recording voice. Can anyone help me? import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import android.app.Activity; import android.media.AudioFormat; import android.media.AudioRecord; import android

audio stream sampling rate in linux

蹲街弑〆低调 提交于 2020-01-24 23:25:34
问题 Im trying read and store samples from an audio microphone in linux using C/C++. Using PCM ioctls i setup the device to have a certain sampling rate say 10Khz using the SOUND_PCM_WRITE_RATE ioctl etc. The device gets setup correctly and im able to read back from the device after setup using the "read". int got = read(itsFd, b.getDataPtr(), b.sizeBytes()); The problem i have is that after setting the appropriate sampling rate i have a thread that continuously reads from /dev/dsp1 and stores

Audio recording in android with particular time interval

China☆狼群 提交于 2020-01-23 17:25:07
问题 I have two method in my activity one is setOnClickListener() and other is setOnLongClickListener() For the same button which used to start audio recording. Now i don't know how to use condition, if i use setOnClickListener() then recording should start for 1 minute and stop automatically, and if i use setOnLongClickListener() then recording start for 2 minute and then stop automatically. buttonStart.setOnLongClickListener(new OnLongClickListener() { @Override public boolean onLongClick(View v

How to mute Microphone when recording from headset

北战南征 提交于 2020-01-23 17:06:07
问题 I am making a application to record audio from bluetooth headset. After that, the signal sound from headset will be played in to speaker of android phone. However, my problem is that some signal from microphone of android phone is also played. I want to mute microphone of android during playing. Is it possible. I am refering some link but it does not useful. Please give me one solution to turn of my microphone. This is my setting _audioManager = (AudioManager) getSystemService(Context.AUDIO

How to mute Microphone when recording from headset

倾然丶 夕夏残阳落幕 提交于 2020-01-23 17:03:02
问题 I am making a application to record audio from bluetooth headset. After that, the signal sound from headset will be played in to speaker of android phone. However, my problem is that some signal from microphone of android phone is also played. I want to mute microphone of android during playing. Is it possible. I am refering some link but it does not useful. Please give me one solution to turn of my microphone. This is my setting _audioManager = (AudioManager) getSystemService(Context.AUDIO

How to solve this error: Android resource linking failed?

爷,独闯天下 提交于 2020-01-22 02:16:25
问题 These two codes below are in the same MainActivity, in my Android Studio project 1) Recoding the audio from smartphone and playing it when pressing Play button: public class Main2Activity extends AppCompatActivity { //Declare variables Button btnRecord, btnStopRecord, btnPlay, btnStop; //String pathSave =""; private static String pathSave; MediaRecorder mediaRecorder; MediaPlayer mediaPlayer; final int REQUEST_PERMISSION_CODE=1000; @Override protected void onCreate(Bundle savedInstanceState)