
Recherche avancée
Médias (2)
-
GetID3 - Bloc informations de fichiers
9 avril 2013, par
Mis à jour : Mai 2013
Langue : français
Type : Image
-
GetID3 - Boutons supplémentaires
9 avril 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Image
Autres articles (111)
-
Encoding and processing into web-friendly formats
13 avril 2011, parMediaSPIP automatically converts uploaded files to internet-compatible formats.
Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
All uploaded files are stored online in their original format, so you can (...) -
MediaSPIP Player : les contrôles
26 mai 2010, parLes contrôles à la souris du lecteur
En plus des actions au click sur les boutons visibles de l’interface du lecteur, il est également possible d’effectuer d’autres actions grâce à la souris : Click : en cliquant sur la vidéo ou sur le logo du son, celui ci se mettra en lecture ou en pause en fonction de son état actuel ; Molette (roulement) : en plaçant la souris sur l’espace utilisé par le média (hover), la molette de la souris n’exerce plus l’effet habituel de scroll de la page, mais diminue ou (...) -
Récupération d’informations sur le site maître à l’installation d’une instance
26 novembre 2010, parUtilité
Sur le site principal, une instance de mutualisation est définie par plusieurs choses : Les données dans la table spip_mutus ; Son logo ; Son auteur principal (id_admin dans la table spip_mutus correspondant à un id_auteur de la table spip_auteurs)qui sera le seul à pouvoir créer définitivement l’instance de mutualisation ;
Il peut donc être tout à fait judicieux de vouloir récupérer certaines de ces informations afin de compléter l’installation d’une instance pour, par exemple : récupérer le (...)
Sur d’autres sites (6057)
-
Revision 37620 : Une erreur sur le select
24 avril 2010, par kent1@… — LogUne erreur sur le select
-
Revision 37620 : Une erreur sur le select
24 avril 2010, par kent1@… — LogUne erreur sur le select
-
How to read realtime microphone audio volume in python and ffmpeg or similar
1er septembre 2023, par Ryan MartinI'm trying to read, in near-realtime, the volume coming from the audio of a USB microphone in Python.


I have the pieces, but can't figure out how to put it together.


If I already have a .wav file, I can pretty simply read it using wavefile :


from wavefile import WaveReader

with WaveReader("/Users/rmartin/audio.wav") as r:
 for data in r.read_iter(size=512):
 left_channel = data[0]
 volume = np.linalg.norm(left_channel)
 print(volume)



This works great, but I want to process the audio from the microphone in real-time, not from a file.


So my thought was to use something like ffmpeg to PIPE the real-time output into WaveReader, but my Byte knowledge is somewhat lacking.


import subprocess
import numpy as np

command = ["/usr/local/bin/ffmpeg",
 '-f', 'avfoundation',
 '-i', ':2',
 '-t', '5',
 '-ar', '11025',
 '-ac', '1',
 '-acodec','aac', '-']

pipe = subprocess.Popen(command, stdout=subprocess.PIPE, bufsize=10**8)
stdout_data = pipe.stdout.read()
audio_array = np.fromstring(stdout_data, dtype="int16")

print audio_array



That looks pretty, but it doesn't do much. It fails with a
[NULL @ 0x7ff640016600] Unable to find a suitable output format for 'pipe:'
error.

I assume this is a fairly simple thing to do given that I only need to check the audio for volume levels.


Anyone know how to accomplish this simply ? FFMPEG isn't a requirement, but it does need to work on OSX & Linux.