Comments (2)
I think it should work like this, i will try it next weekend: (pseudo code):
import pyaudio import wave import numpy as np from Realtime_PyAudio_FFT import Visualization
Read audio file
audio_file = "path_to_audiofile.mp3" wf = wave.open(audio_file, 'rb')
Initialization of the PyAudio library and the Visualization object
p = pyaudio.pyAudio() visualization = visualization()
Set parameters for audio playback
stream = p.open( format=p.get_format_from_width(wf.getsampwidth()), channels=wf.getnchannels(), rate=wf.getframerate(), output=True, stream_callback=visualization.callback, # Callback callback function callback for animation )
Audio creation
data = wf.readframes(1024) whiledata: stream.write(data) data = wf.readframes(1024)
End the thread and clean up the resources
stream.stop_stream() stream.close() p.terminate()
Did you manage to write the full code and does it work?
from realtime_pyaudio_fft.
I think it should work like this, i will try it next weekend: (pseudo code):
import pyaudio import wave import numpy as np from Realtime_PyAudio_FFT import VisualizationRead audio file
audio_file = "path_to_audiofile.mp3" wf = wave.open(audio_file, 'rb')
Initialization of the PyAudio library and the Visualization object
p = pyaudio.pyAudio() visualization = visualization()
Set parameters for audio playback
stream = p.open( format=p.get_format_from_width(wf.getsampwidth()), channels=wf.getnchannels(), rate=wf.getframerate(), output=True, stream_callback=visualization.callback, # Callback callback function callback for animation )
Audio creation
data = wf.readframes(1024) whiledata: stream.write(data) data = wf.readframes(1024)
End the thread and clean up the resources
stream.stop_stream() stream.close() p.terminate()
Did you manage to write the full code and does it work?
do you want to specify the path to the file and see everything just like with the microphone? I could make a fork and add such functionality there, if someone really needs it :)
from realtime_pyaudio_fft.
Related Issues (20)
- Use this script with a wav file HOT 2
- Error message on startup
- HOW TO USE THE PACKAGE?
- visualizer.py", line 213, in plot_bars self.prev_screen.set_alpha(self.prev_screen.get_alpha()*self.alpha_multiplier) TypeError: unsupported operand type(s) for *: 'NoneType' and 'float' HOT 2
- Close button is not working and need to insert new function
- Changing inputs doesn't work (Not supported)
- Logarithmic Scaling for X Axis HOT 1
- Can't read system audio HOT 1
- This and BirdNET-Pi HOT 1
- low fps on raspberry cm4 HOT 1
- sounddevice.PortAudioError: Error querying device -1 HOT 1
- My desired device doesn't work with default settings? HOT 1
- export DISPLAY=:0 run on Pi 4 8GB RAM
- Issue on MAC OSX HOT 1
- Script is running but sound is not being processed HOT 1
- For beat detection and tempo tracking
- Sometimes emojis (🎙 👋) cause errors HOT 1
- Installing PyAudio on Windows (Maybe add to README) HOT 1
- Option to select device index, visualizer height, visualizer ratio, etc.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from realtime_pyaudio_fft.