audio

Reroute analogue audio signal using Python

自作多情 提交于 2020-12-15 04:55:13
问题 I'm trying to use Python to 'mic-monitor', i.e., to playback the mic signal through the headphones in real-time, in addition to any other output signal from the PC. I can accomplish this by amending my PC's playback settings, but I want to do it with Python, so that I can program a Raspberry Pi to mic-monitor my cheap headset for the PS4. I can almost accomplish this with PyAudio or sounddevice, but there is a small but significant delay. From a previous question, I believe this is an

Reroute analogue audio signal using Python

空扰寡人 提交于 2020-12-15 04:54:28
问题 I'm trying to use Python to 'mic-monitor', i.e., to playback the mic signal through the headphones in real-time, in addition to any other output signal from the PC. I can accomplish this by amending my PC's playback settings, but I want to do it with Python, so that I can program a Raspberry Pi to mic-monitor my cheap headset for the PS4. I can almost accomplish this with PyAudio or sounddevice, but there is a small but significant delay. From a previous question, I believe this is an

IMFTransform SetInputType()/SetOutputType() fails

一曲冷凌霜 提交于 2020-12-14 06:33:13
问题 I'm trying to playback MP3 (and similar audio files) using WASAPI shared mode and a media foundation IMFSourceReader on Windows 7. From what I understand I have to use an IMFTransform between the IMFSourceReader decoding and the WASAPI playback. Everything seems fine apart from when I call SetInputType()/SetOutputType() on the IMFTransform? The relevant snippets of code are: MFCreateSourceReaderFromURL(...); // Various test mp3 files ... sourceReader->GetCurrentMediaType(MF_SOURCE_READER

IMFTransform SetInputType()/SetOutputType() fails

假装没事ソ 提交于 2020-12-14 06:23:22
问题 I'm trying to playback MP3 (and similar audio files) using WASAPI shared mode and a media foundation IMFSourceReader on Windows 7. From what I understand I have to use an IMFTransform between the IMFSourceReader decoding and the WASAPI playback. Everything seems fine apart from when I call SetInputType()/SetOutputType() on the IMFTransform? The relevant snippets of code are: MFCreateSourceReaderFromURL(...); // Various test mp3 files ... sourceReader->GetCurrentMediaType(MF_SOURCE_READER

FFmpeg: How to merge all audio streams into stereo

二次信任 提交于 2020-12-13 04:55:47
问题 I have 4 audio streams in my video file. They are from 4 microphones placed at 4 different people speaking. I want to transcode to a preview file that can be listened to on headphones where everybody's voice can be heard. I have seen the -ac 2 option, but I can't tell if this will merge all the audio streams or just select the 1st two. I've also seen the amerge filter, but the docs say this will produce 4 audio channels in the output file. So I'm wondering how headphones will deal with the

How to convert 16Bit byte array to audio clip data correctly?

寵の児 提交于 2020-12-13 03:39:08
问题 I work with Media Foundataion and what I need to do is convert sound sample frame from byte to audio float data. In order to do it I use such method (that I found somewhere at google): private static float[] Convert16BitByteArrayToAudioClipData(byte[] source, int headerOffset, int dataSize) { int wavSize = BitConverter.ToInt32(source, headerOffset); headerOffset += sizeof(int); Debug.AssertFormat(wavSize > 0 && wavSize == dataSize, "Failed to get valid 16-bit wav size: {0} from data bytes: {1

How to convert 16Bit byte array to audio clip data correctly?

為{幸葍}努か 提交于 2020-12-13 03:35:05
问题 I work with Media Foundataion and what I need to do is convert sound sample frame from byte to audio float data. In order to do it I use such method (that I found somewhere at google): private static float[] Convert16BitByteArrayToAudioClipData(byte[] source, int headerOffset, int dataSize) { int wavSize = BitConverter.ToInt32(source, headerOffset); headerOffset += sizeof(int); Debug.AssertFormat(wavSize > 0 && wavSize == dataSize, "Failed to get valid 16-bit wav size: {0} from data bytes: {1

Resampling audio using libswresample from 48000 to 44100

旧时模样 提交于 2020-12-12 06:22:12
问题 I'm trying to resample a decoded audio frame from 48KHz to 44.1KHz using the libswresample API. The code I have is the following: // 'frame' is the original decoded audio frame AVFrame *output_frame = av_frame_alloc(); // Without this, there is no sound at all at the output (PTS stuff I guess) av_frame_copy_props(output_frame, frame); output_frame->channel_layout = audioStream->codec->channel_layout; output_frame->sample_rate = audioStream->codec->sample_rate; output_frame->format =

What ffmpeg command to use to convert a list of unsigned integers into an audio file?

感情迁移 提交于 2020-12-12 06:16:10
问题 I have a file that contains a list of about forty thousand integers that are space delimited, with each integer between the value of 0 and 255. It is this file here: https://github.com/johnlai2004/sound-project/blob/master/integers.txt If you connect a speaker to an ESP32 breakout board, then run this list of integers through the digital to analog converter at a frequency of 24kHz, you will hear the sentence, "That's not the post that you missed." What I want to know is how do you use FFMPEG

What ffmpeg command to use to convert a list of unsigned integers into an audio file?

末鹿安然 提交于 2020-12-12 06:12:27
问题 I have a file that contains a list of about forty thousand integers that are space delimited, with each integer between the value of 0 and 255. It is this file here: https://github.com/johnlai2004/sound-project/blob/master/integers.txt If you connect a speaker to an ESP32 breakout board, then run this list of integers through the digital to analog converter at a frequency of 24kHz, you will hear the sentence, "That's not the post that you missed." What I want to know is how do you use FFMPEG