Saravanan666/pypi-org huggingface dataset:
Package: audio-dspy
Audio DSPyaudio_dspy is a Python package for audio signal processing tools.Current tools include:EQ filter designNonlinear ProcessorsSine Sweep ToolsPlotting Frequency Responses and Static CurvesConverting transfer functions to minimum or linear phaseProny's method, and Prony's method with frequency warpingModal modelling toolsInstall usingpip:pipinstallaudio-dspyExamplesimportaudio_dspyasadspimportmatplotlib.pyplotasplt# Plot nonlinear static curvesadsp.plot_static_curve(lambdax:adsp.hard_clipper(x),range=2.5)adsp.plot_static_curve(lambdax:adsp.soft_clipper(x),range=2.5)plt.title('Comparing Nonlinearities')plt.legend(['Hard Clipper','Soft Clipper'])# Design and plot EQ filtersfs=44100b,a=adsp.design_lowshelf(800,2.0,2,fs)adsp.plot_magnitude_response(b,a,fs=fs)plt.title('Low Shelf Filter')# Perform level detectionfromscipy.ioimportwavfilefs,x=wavfile.read('drums.wav')x=adsp.normalize(x[:,0])# only take left channel, normalizeplt.plot(x,label='input')formodein['peak','rms','analog']:y=adsp.level_detect(x,fs,mode=mode)plt.plot(y,label=mode)plt.title('Level Detection Example')plt.xlabel('Time [samples]')plt.legend()
Package: audiofile
The Python packageaudiofilehandles all kind of audio files
with a focus onreading speed.It can read and request information
on channels, duration, number of samples and sampling rate
for all files that are supported byffmpeg,sox,
andmediainfo.
In addition,
it can write WAV, FLAC, MP3, and OGG files.Have a look at theinstallationandusageinstructions as a starting point.Code example for reading a file:importaudiofilesignal,sampling_rate=audiofile.read("signal.wav")Under the hood it usessoundfileto read the audio files,
converting non-supported formats first to WAV files.
The same approach is applied
when requesting duration for formats that need to be decoded
to ensure that duration and number of samples match.
Package: audio-flamingo
AudioFlamingoImplementation of the model "AudioFlamingo" from the paper: "Audio Flamingo: A Novel Audio Language Model with Few-Shot Learning and Dialogue Abilities".PAPER LINKInstallpip3 install audio-flamingoUsageimporttorchfromaudio_flamingo.modelimportAudioFlamingo# Generate a random input sequencetext=torch.randint(0,256,(1,1024))audio=torch.randn(1,16000)# Initialize AudioFlamingo modelmodel=AudioFlamingo(dim=512,num_tokens=256,max_seq_len=1024,heads=8,depth=6,dim_head=64,dropout=0.1,context_dim=512,)# Pass the input sequence through the modeloutput=model(text,audio)# (1, 1024, 256)# Print the output shapeprint(output.shape)# Path: audio_flamingo/model.pyLicenseMIT
Package: audioft
AudioFileTranslatorAFT is a python nano framework based on the googletrans and speechrecognition modules. AFT transcribe and translate an audio file to another language. The code is easy to understand and edit.DocumentationAFT documentation can be found in the "Wiki" tab of this repo.Basic UsageTranslation from a french audio to a japanese text:fromaudioftimport*print(TranslationEngine("audio.wav","fr-FR","fr","ja"))Learn more about the TranslationEngine()TranslationEngine()Basic Attention Token TipsThis Github account is verified by the brave creator program, please consider making a BAT tips !LicenseThe AFT framework is licensed under the GNU Lesser General Public License v2.1 License - see theLICENSEfile for details
Package: audiogen
Theaudiogenpackage provides time domain audio processing tools
using Python generators.This makes some types of audio sample generation and processing pretty
easy:# mix 440 Hz and 445 Hz tones to get 5 Hz beating
beats = audiogen.mixer(
        (audiogen.tone(440), audiogen.tone(445)),
        [(constant(1), constant(1)),]
)The actual samples won’t be generated or stored in memory until they’re
actually consumed – for instance, when they’re being written out to disk
in a wave file:with open("output.wav", "wb") as f:
    audiogen.sampler.write_wav(f, beats)Generators’ at-consumption-time computation also allows creating
infinitely long output, e.g. to stream to speakers rather than a file on
disk:audiogen.sampler.write_wav(sys.stdout, audiogen.tone(440))Or just:audiogen.sampler.play(audiogen.tone(440))You can also use standard generator tools, e.g. the itertools module, to
handle audio data:beep_silence = itertools.chain(audiogen.beep(), audiogen.silence(0.5))
    infinite_beeps = itertools.cycle(beep_silence)

audiogen.sampler.write_wav(sys.stdout, infinite_beeps)Soundcard outputThe easiest way to play directly to a soundcard output is to use theaudiogen.sampler.playfunction, which will play your samples using
PyAudio:import audiogen
import itertools
import sys

audiogen.sampler.play(
    itertools.cycle(itertools.chain(audiogen.beep(), audiogen.silence(0.5)))
)Alternatively, you could write your wave data tostdout, e.g.myaudio.py:import audiogen
import itertools
import sys

audiogen.sampler.write_wav(
    sys.stdout,
    itertools.cycle(itertools.chain(audiogen.beep(), audiogen.silence(0.5)))
)Then pipe to a command line audio player likeSox:python myaudio.py | play -t wav -InstallationInstall with:$ pip install audiogen
$ pip install --allow-external PyAudio --allow-unverified PyAudio PyAudioPyAudio is optional. If it’s not installed, playing audio via the soundcard withaudiogen.sampler.play()will not be available, but generating Wave files –
including for piping to an external player, likesox– will work just fine.Note that to install PyAudio on Mac OS X, you’ll need to first installportaudio:$ brew install portaudioSee alsoProjects built withaudiogen:koch, a Koch method Morse code trainer and audio generatorafsk, a ham radio APRS/Bell-202 audio frequency shift keying encoderContributingGet the source and report any bugs on Github:https://github.com/casebeer/audiogenVersion history0.1.2 - Add band pass and band stop IIR filters; custom beep lengths from @jhobbs0.1.1 - Fix multiplexing bug causing increase in pitch when using mixer() to produce
more than one output channel0.1.0 - Breaking changes: new arguments to tone(), play() blocks by default
Package: audiogen-agc
Audiogen Codec (agc)We are announcing the open source release of Audiogen Codec (agc) 🎉. A low compression 48khz stereo neural audio codec for general audio, optimizing for audio fidelity 🎵.It comes in two flavors:agc-continuous 🔄
KL regularized, 32 channels, 100hz.agc-discrete 🔢
24 stages of residual vector quantization, 50hz.AGC (Audiogen Codec) is a convolutional autoencoder based on the DAC architecture, which holds SOTA 🏆. We found that training with EMA and adding a perceptual loss term with CLAP features improved performance. These codecs, being low compression, outperform Meta's EnCodec and DAC on general audio as validated from internal blind ELO games 🎲.We trained (relatively) very low compression codecs in the pursuit of solving a core issue regarding general music and audio generation, low acoustic quality and audible artifacts, which hinder industry use for these models 🚫🎶. Our hope is to encourage researchers to build hierarchical generative audio models that can efficiently use high sequence length representations without sacrificing semantic abilities 🧠.This codec will power Audiogen's upcoming models. Stay tuned! 🚀Installationpipinstallaudiogen-agcUsagefromagcimportAGCagc=AGC.from_pretrained("Audiogen/agc-continuous")# or "agc-discrete"audio=torch.randn(1,2,480000)# 48khz stereoz=agc.encode(audio)# (1, 32, 6000) or (1, 24, 3000)reconstructed_audio=agc.decode(z)# (1, 2, 480000)
Package: audiogen-p3
Theaudiogen_p3package provides time domain audio processing tools
using Python generators.Please note, this is a forked repository from “audiogen” by user “casebeer”
updated to work with Python3 since the original package has been unmaintained
for a few years. The only modifications to this package were to allow use
in Python 3. The remainder of the code is all original work by Christopher H. CasebeerThis makes some types of audio sample generation and processing pretty
easy:# mix 440 Hz and 445 Hz tones to get 5 Hz beating
beats = audiogen_p3.mixer(
    (audiogen_p3.tone(440), audiogen_p3.tone(445)),
    [(constant(1), constant(1)),]
)The actual samples won’t be generated or stored in memory until they’re
actually consumed – for instance, when they’re being written out to disk
in a wave file:with open("output.wav", "wb") as f:
    audiogen_p3.sampler.write_wav(f, beats)Generators’ at-consumption-time computation also allows creating
infinitely long output, e.g. to stream to speakers rather than a file on
disk:audiogen_p3.sampler.write_wav(sys.stdout, audiogen_p3.tone(440))Or just:audiogen_p3.sampler.play(audiogen_p3.tone(440))You can also use standard generator tools, e.g. the itertools module, to
handle audio data:beep_silence = itertools.chain(audiogen_p3.beep(), audiogen_p3.silence(0.5))
infinite_beeps = itertools.cycle(beep_silence)

audiogen_p3.sampler.write_wav(sys.stdout, infinite_beeps)Soundcard outputThe easiest way to play directly to a soundcard output is to use theaudiogen_p3.sampler.playfunction, which will play your samples using
PyAudio:import audiogen_p3
import itertools
import sys

audiogen_p3.sampler.play(
    itertools.cycle(itertools.chain(audiogen_p3.beep(), audiogen_p3.silence(0.5)))
)Alternatively, you could write your wave data tostdout, e.g.myaudio.py:import audiogen_p3
import itertools
import sys

audiogen_p3.sampler.write_wav(
    sys.stdout,
    itertools.cycle(itertools.chain(audiogen_p3.beep(), audiogen_p3.silence(0.5)))
)Then pipe to a command line audio player likeSox:python myaudio.py | play -t wav -InstallationInstall with:$ pip install audiogen_p3
$ pip install --allow-external PyAudio --allow-unverified PyAudio PyAudioPyAudio is optional. If it’s not installed, playing audio via the soundcard withaudiogen_p3.sampler.play()will not be available, but generating Wave files –
including for piping to an external player, likesox– will work just fine.Note that to install PyAudio on Mac OS X, you’ll need to first installportaudio:$ brew install portaudioContributingGet the source and report any bugs on Github:https://github.com/rguisewite/audiogen_p3Original Code from Christopher H. Casebeer (casebeer):https://github.com/rguisewite/audiogenVersion history0.1.2 - Add band pass and band stop IIR filters; custom beep lengths from @jhobbs0.1.1 - Fix multiplexing bug causing increase in pitch when using mixer() to produce
more than one output channel0.1.0 - Breaking changes: new arguments to tone(), play() blocks by default
Package: audiogrep
Audiogrep=========Audiogrep transcribes audio files and then creates "audio supercuts" based on search phrases. It uses [CMU Pocketsphinx](http://cmusphinx.sourceforge.net/) for speech-to-text and [pydub](http://pydub.com/) to stitch things together.Here's some [sample output](http://lav.io/2015/02/audiogrep-automatic-audio-supercuts/).## RequirementsInstall using pip```pip install audiogrep```Install [ffmpeg](http://ffmpeg.org/) with Ogg/Vorbis support. If you're on a mac with [homebrew](http://brew.sh/) you can install ffmpeg with:```brew install ffmpeg --with-libvpx --with-libvorbis```Finally, install [CMU Pocketsphinx](http://cmusphinx.sourceforge.net/). For macusers I followed [these instructions](https://github.com/watsonbox/homebrew-cmu-sphinx) to get it working:```brew tap watsonbox/cmu-sphinxbrew install --HEAD watsonbox/cmu-sphinx/cmu-sphinxbasebrew install --HEAD watsonbox/cmu-sphinx/cmu-sphinxtrain # optionalbrew install --HEAD watsonbox/cmu-sphinx/cmu-pocketsphinx```## How to use itFirst, transcribe the audio (you'll only need to do this once per audio track, but it can take some time)```# transcribes all mp3s in the selected folderaudiogrep --input path/to/*.mp3 --transcribe```Then, basic use:```# returns all phrases with the word 'word' in themaudiogrep --input path/to/*.mp3 --search 'word'```The previous example will extract phrase chunks containing the search term, but you can also just get individual words:```audiogrep --input path/to/*.mp3 --search 'word' --output-mode word```If you add the '--regex' flag you can use regular expressions. For example:```# creates a supercut of every instance of the words "spectre", "haunting" and "europe"audiogrep --input path/to/*.mp3 --search 'spectre|haunting|europe' --output-mode word --regex```You can also construct 'frankenstein' sentences (mileage may vary):```# stupid jokeaudiogrep --input path/to/*.mp3 --search 'my voice is my passport' --output-mode franken```Or you can just extract individual words into files.```# extracts each individual word into its own file in a directory called 'extracted_words'audiogrep --input path/to/*.mp3 --extractExporting to: extracted_words/i.mp3Exporting to: extracted_words/am.mp3Exporting to: extracted_words/the.mp3Exporting to: extracted_words/key.mp3Exporting to: extracted_words/master.mp3```### Optionsaudiogrep can take a number of options:#### --input / -imp3 file or pattern for input#### --output / -oName of the file to generate. By default this is "supercut.mp3"#### --search / -sSearch term#### --output-mode / -mSplice together phrases, single words, fragments with wildcards, or "frankenstein" sentences.Options are:* sentence: (this is the default)* word* fragment* franken#### --padding / -pTime in milliseconds to add between audio segments. Default is 0.#### --crossfade / -cTime in milliseconds to crossfade audio segments. Default is 0.#### --extract / -x#### --demo / -dShow the results of the search without outputing a file
Package: audioio
AudioIOPlatform independent interfacing of numpy arrays of floats with audio
files and devices.Documentation|API ReferenceThe AudioIO modules try to use whatever audio packages are installed
on your system to achieve their tasks. AudioIO, however, adds own code
for handling metadata and marker lists.Seeinstallationfor further instructions and recommendations on additional audio packages.FeaturesAudio data are alwaysnumpy arrays of floats(np.float64) with values ranging between -1 and 1 ...... independent of how the data are stored in an audio file.load_audio()function for loading a whole audio file.Blockwise random-accessloading of large audio files (class AudioLoader).blocks()generator for iterating over blocks of data with optional overlap.write_audio()function for writing data, metadata, and markers to an audio file.Readmetadata()as nested dictionaries of key-value pairs.Readmarkers(), i.e. cue points with spans, labels, and descriptions.Platform independent, synchronous (blocking) and asynchronous (non blocking) playback of numpy arrays  viaplay().Automatic resampling of data for playback to match supported sampling rates.Detailed andplatform specific installation instructions(pip, conda, Debian and RPM based Linux packages, homebrew for MacOS) for all supported audio packages (audiomodules).
Package: audio-journal
:studio_microphone: Notion Audio JournalGetting startedpipinstallaudio-journalAfter you’ve update the~/.audio-journal/configwith yourpage
IDandintegration keyaudio_journal_startDemohttps://user-images.githubusercontent.com/5474861/236587909-a7b0578b-b742-4571-80a2-65e249c43fca.mp4Why?I wish I journaled more often. The ability to look back through the
years, reflect and remember events long past is invaluable.While the benefits of hand written journaling are clear, forcing one to
slow down, to organize one’s thoughts, I find the 5x slow down makes it
a non-starter. So instead lets optimize for gross word count!Future workOffer alternative storage optionsInterface with a mic, always on, wait for wake word
Package: audiolayer
This package contains a Python 3 Extension for playing audio files, reading and
writing metadata and converting those files. For decoding and encoding files
thelibavlibrary is used. Playback is handled bylibportaudio.The project website can be found atGitHub.Requirementspython3.x (Tested using python3.3)libavcodeclibavformatlibavutillibportaudioInstallationUsing pip:pip install audiolayerFrom GitHub:git clone https://github.com/remcohaszing/python-audiolayer.git
cd python-audiolayer
python3 setup.py installUsageReading song metadata:>>> from audiolayer import Song
>>> filename = 'Finntroll - Trollhammaren.flac'
>>> song = Song(filename)
>>> song['artist']
Finntroll
>>> song['album']
Trollhammaren
>>> song['title']
Trollhammaren
>>>Saving song metadata:>>> song['album'] = 'Nattfödd'
>>> song['album']
'Nattfödd'
>>> song.save()
>>>Saving a copy of the song with the new metadata to a new file:
>>> song.save(filename=’Finntroll/Nattfödd - Trollhammaren.flac’)
>>>Converting the song (not implemented):>>> converted = song.convert('Finntroll - Trollhammaren.ogg',
...                          format='opus', q=4)
>>> converted.filename
Finntroll - Trollhammaren.ogg
>>>Playback (current implementation):>>> song.play()  # Wait for the song to finish.
>>>Playback (target implementation):>>> song.play()
0.00
>>> song.pause()
4.29
>>> song.play_or_pause()
4.29
>>> song.playing_time
12.53
>>>TestingThe unittests can be run using:python3 setup.py testIt is also possible to usenoseto run the tests:python3 setup.py nosetestsCoding styleC code must be in compliance withpep7.Python code must be in compliance withpep8.All code must be covered by unittests.To test the Python code for pep8 compliance, go to the project root directory
and run:python3 setup.py flake8LicenseThis project is licensed under the BSD 3-Clause License.
Package: audioldm-eval
Audio Generation EvaluationThis toolbox aims to unify audio generation model evaluation for easier future comparison.Quick StartFirst, prepare the environmentgitclonehttps://github.com/haoheliu/audioldm_eval.gitcdaudioldm_eval
pipinstall-e.Second, generate test dataset bypython3gen_test_file.pyFinally, perform a test run. A result for reference is attachedhere.python3test.py# Evaluate and save the json file to disk (example/paired.json)Evaluation metricsWe have the following metrics in this toolbox:FD: Frechet distance, realized by PANNs, a state-of-the-art audio classification modelFAD: Frechet audio distanceISc: Inception scoreKID: Kernel inception scoreKL: KL divergence (softmax over logits)KL_Sigmoid: KL divergence (sigmoid over logits)PSNR: Peak signal noise ratioSSIM: Structural similarity index measureLSD: Log-spectral distanceThe evaluation function will accept the paths of two folders as main parameters.If two folder havefiles with same name and same numbers of files, the evaluation will run inpaired mode.If two folder havedifferent numbers of files or files with different name, the evaluation will run inunpaired mode.These metrics will only be calculated in paried mode: KL, KL_Sigmoid, PSNR, SSIM, LSD.
In the unpaired mode, these metrics will return minus one.Evaluation on AudioCaps and AudioSetThe AudioCaps test set consists of audio files with multiple text annotations. To evaluate the performance of AudioLDM, we randomly selected one annotation per audio file, which can be found in theaccompanying json file.Given the size of the AudioSet evaluation set with approximately 20,000 audio files, it may be impractical for audio generative models to perform evaluation on the entire set. As a result, we randomly selected 2,000 audio files for evaluation, with the corresponding annotations available in ajson file.For more information on our evaluation process, please refer toour paper.Exampleimporttorchfromaudioldm_evalimportEvaluationHelper# GPU acceleration is preferreddevice=torch.device(f"cuda:{0}")generation_result_path="example/paired"target_audio_path="example/reference"# Initialize a helper instanceevaluator=EvaluationHelper(16000,device)# Perform evaluation, result will be print out and saved as jsonmetrics=evaluator.main(generation_result_path,target_audio_path,limit_num=None# If you only intend to evaluate X (int) pairs of data, set limit_num=X)TODOAdd pretrained AudioLDM model.Add CLAP scoreCite this repoIf you found this tool useful, please consider citing@article{liu2023audioldm,title={AudioLDM: Text-to-Audio Generation with Latent Diffusion Models},author={Liu, Haohe and Chen, Zehua and Yuan, Yi and Mei, Xinhao and Liu, Xubo and Mandic, Danilo and Wang, Wenwu and Plumbley, Mark D},journal={arXiv preprint arXiv:2301.12503},year={2023}}Referencehttps://github.com/toshas/torch-fidelityhttps://github.com/v-iashin/SpecVQGAN
Package: audiologic
Python Module to process and predict on music attributesTwo Models were built and trained to predict valence given an audio sample. One uses a feature pipeline on top of librosa to make a number of predictors that go into a Random Forest model to determine a valence prediction. The other uses OpenAI's whisper model to transcribe lyrics, then tokenize the words, and again a trained Random Forest model makes the prediction based on lyrics.Model RMSEAudio1.56Lyrics1.28Data Used:1000 Song Dataset -Download hereSpotify Developer API -30 second previewsPackage Requirementspip install -r requirements.txtmake sure to downloadwhisper from openai(not currently included in requirements.txt)Also must install ffmpeg (using brew, choco, etc.)
Package: audioman
audiomanPython library for manipulating audio files. This can be used for editing audio, or tagging audio.InstallationInstallaudiomanusing pippipinstallaudiomanAudioAudio editing here is done using the audio samples represented in a numpy array. Although, it is easy to combine audio together without touching the samples.First we load the audio.fromaudiomanimportAudioaudio=Audio('audio.wav')Or we can load using raw samplesimportnumpyfromaudiomanimportAudioaudio=Audio(numpy.array([[0,0,0,0,0]]),sample_rate=4400)Once you're done modifying the audio file, you can save it.audio.save('modified.wav')If you don't specify a filename, it will useself.filename, but since that is usually lost when modifying the audio, it's best to specify the filename anyway.Audioobjects are can be combinedfromaudiomanimportAudioaudio1=Audio('audio1.wav')audio2=Audio('audio2.wav')audio3=audio1+audio2len(audio3)# len(audio1) + len(audio2)You can also increase the gain.audio=Audio('audio.wav')audio2=audio+5The original audio object does not get modified.Trimming audio is also easy.audio=Audio('audio.wav')trimmed=audio.trim(start=0,length=audio.seconds_to_samples(3))Of course if you only specify the length, the start will be assumed to be 0.trimmed=audio.trim(audio.seconds_to_samples(3))trimmed.samples_to_seconds(len(trimmed))# 3.0If you wish to, you can also split the audio in 2 audio tracks.audio1,audio2=audio.split()By default it will split in half, but you can specify the middle.audio1,audio2=audio.split(audio.seconds_to_samples(3))If you wish to do so, you can add silence to an audio track.audio2=audio.add_silence(start=0,length=audio.seconds_to_samples(3))Of course if you want to add to the end, you can use-1audio2=audio.add_silence(start=-1,length=audio.seconds_to_samples(3))If you omitstart, it will set it to 0.audio2=audio.add_silence(audio.seconds_to_samples(3))If you need to mix (overlay) two audio tracks together, use the.mix()method.audio=Audio('audio.wav')drums=Audio('drums.wav')mixed=audio.mix(drums)EffectsThere are effects that you can apply to audio. Currently the only effect is an adjustable fade, but you can make your own easily.To use effects, create an effect object, and apply the options.fromaudiomanimportAudiofromaudioman.effectimportAdjustableFadeaudio=Audio('audio.wav')fade=AdjustableFade(length=audio.seconds_to_samples(3),gain0=0,gain1=1,fade_adjust=-1)faded=audio.apply_effect(fade,start=audio.seconds_to_samples(-3))You can find all the options for an effect in the.OPTIONSproperty.fromaudioman.effectimportAdjustableFadeprint(AdjustableFade.OPTIONS)""" stdout:{'gain0': {'default': 1,'type': float,},'gain1': {'default': 0,'type': float,},'curve_ratio': {'default': 0,'type': float,}}"""