audio

What is the max sampling rate for scipy.io.wavfile.write command?

What is the max sampling rate for scipy.io.wavfile.write command? Question: As I checked, usually it is 44100 Hz, but I am wondering for my own purposes can it be 490 KHz? Didn’t notice any information about that in documentation. I successfully made a wavfile with 48000 Hz, but it’s nearly the same that 44100. import …

Total answers: 1

Identifying the loudest part of an audio track and cropping (Librosa or torchaudio)

Identifying the loudest part of an audio track and cropping (Librosa or torchaudio) Question: I’ve built a U-Net model to perform audio mixing of multitrack audio, for which I’ve used 20s clips of the audio tracks (converted into spectrograms) as input in training the model. However the training process is incredibly long, so I think …

Total answers: 2

How to play audio in Jupyter notebook with VSCode?

How to play audio in Jupyter notebook with VSCode? Question: Using a jupyter notebook in VSCode, I’m trying to run the following code from this documentation: import numpy as np from IPython.display import Audio framerate = 44100 t = np.linspace(0,5,framerate*5) data = np.sin(2*np.pi*220*t) + np.sin(2*np.pi*224*t) Audio(data, rate=framerate) However, I only get this If I press …

Total answers: 2

How would i find the current decibel level and set it as a variable?

How would i find the current decibel level and set it as a variable? Question: I’m looking to find the current decibel level in a room using a microphone and setting it as a variable. I haven’t been able to find any python code on this so I’m very stuck. It would be good if …

Total answers: 1

Python TypeError: reduce_noise() got an unexpected keyword

Python TypeError: reduce_noise() got an unexpected keyword Question: Hi guys I’m trying to do audio classification using python and I installed a package and when I tried to use the functions, it said TypeError: TypeError: reduce_noise() got an unexpected keyword argument ‘audio_clip’ hear the code of function. import librosa import numpy as np import noisereduce …

Total answers: 2

Librosa – Audio Spectrogram/Frequency Bins to Spectrum

Librosa – Audio Spectrogram/Frequency Bins to Spectrum Question: I’ve read around for several days but haven’t been to find a solution… I’m able to build Librosa spectrograms and extract amplitude/frequency data using the following: audio, sr = librosa.load(‘short_piano melody_keyCmin_110bpm.wav’, sr = 22500) spectrum = librosa.stft(audio, n_fft=2048, window=scipy.signal.windows.hamming) D = librosa.amplitude_to_db(np.abs(spectrum), ref=np.max) n = D.shape[0] Nfft …

Total answers: 2

Generate colors of noise in Python

Generate colors of noise in Python Question: I would like to use Python to generate different colors of noise, just like Wikipedia mentions : https://en.wikipedia.org/wiki/Colors_of_noise. For example, White, Pink, Brownian, Blue and Violet noise. And would like to have similar spectrums just like the website. It would be a great help if I could just …

Total answers: 3

Fastest way of reading audio files in Python

Fastest way of reading audio files in Python Question: I’m processing about 500,000 audio files, each about 10 seconds long. The bottleneck is reading the audio files. I’m currently using pydub, and have tried reading both as mp3 (original source) and wav (after ffmpeg conversion). Both are too slow, and would take more than 3 …

Total answers: 1

Detect & Record Audio in Python – trim beginning silence

Detect & Record Audio in Python – trim beginning silence Question: Using the script in this answer, silence at the beginning of the recording is not clipped. I’m using python3. As I’ve actually slightly tweaked the script, here’s my copy: https://wtools.io/paste-code/b2tk from sys import byteorder from array import array from struct import pack import pyaudio …

Total answers: 1

Save audio file to desired path

Save audio file to desired path Question: I have a lot of text-to-speech audio files that I need to save but often, the files get lost. Currently I’m using import gtts from playsound import playsound def say(speech): tts = gtts.gTTS(speech) tts.save("audio.mp3") playsound("audio.mp3") Is there any way that I can save the mp3 to wherever I …

Total answers: 3