Recherche avancée

Médias (91)

Autres articles (54)

  • (Dés)Activation de fonctionnalités (plugins)

    18 février 2011, par

    Pour gérer l’ajout et la suppression de fonctionnalités supplémentaires (ou plugins), MediaSPIP utilise à partir de la version 0.2 SVP.
    SVP permet l’activation facile de plugins depuis l’espace de configuration de MediaSPIP.
    Pour y accéder, il suffit de se rendre dans l’espace de configuration puis de se rendre sur la page "Gestion des plugins".
    MediaSPIP est fourni par défaut avec l’ensemble des plugins dits "compatibles", ils ont été testés et intégrés afin de fonctionner parfaitement avec chaque (...)

  • Activation de l’inscription des visiteurs

    12 avril 2011, par

    Il est également possible d’activer l’inscription des visiteurs ce qui permettra à tout un chacun d’ouvrir soit même un compte sur le canal en question dans le cadre de projets ouverts par exemple.
    Pour ce faire, il suffit d’aller dans l’espace de configuration du site en choisissant le sous menus "Gestion des utilisateurs". Le premier formulaire visible correspond à cette fonctionnalité.
    Par défaut, MediaSPIP a créé lors de son initialisation un élément de menu dans le menu du haut de la page menant (...)

  • MediaSPIP : Modification des droits de création d’objets et de publication définitive

    11 novembre 2010, par

    Par défaut, MediaSPIP permet de créer 5 types d’objets.
    Toujours par défaut les droits de création et de publication définitive de ces objets sont réservés aux administrateurs, mais ils sont bien entendu configurables par les webmestres.
    Ces droits sont ainsi bloqués pour plusieurs raisons : parce que le fait d’autoriser à publier doit être la volonté du webmestre pas de l’ensemble de la plateforme et donc ne pas être un choix par défaut ; parce qu’avoir un compte peut servir à autre choses également, (...)

Sur d’autres sites (11675)

  • Python : How to convert a mp3 chunk from webstream to .wav samples ?

    13 novembre 2019, par Bendzko

    I’m trying to catch chunks of an mp3 webstream and coverting them into wav samples for signal processing. I tried to catch the audio via requests and io.BytesIO to save the data as .wav file.
    But I think, that I have to convert the mp3 data to wav data, but I don’t know how. (My goal is not to record a .wav file, i am just doing this to test the algorithm.)

    I found the pymedia lib, but it is very old (last commit in 2006), using python 2.7 and for me not installable.

    Maybe it is possible with ffmpeg-python, but I have just seen examples using files as input and output.

    Here’s my code :

    import requests
    import io
    import soundfile as sf
    import struct
    import wave
    import numpy as np


    def main():
       stream_url = r'http://dg-wdr-http-dus-dtag-cdn.cast.addradio.de/wdr/1live/diggi/mp3/128/stream.mp3'
       r = requests.get(stream_url, stream=True)
       sample_array = []
       try:
           for block in r.iter_content(1024):
               data, samplerate = sf.read(io.BytesIO(block), format="RAW", channels=2, samplerate=44100, subtype='FLOAT',
                                          dtype='float32')
               sample_array = np.append(sample_array, data)

       except KeyboardInterrupt:
           print("...saving")
           obj = wave.open('sounds/stream1.wav', 'w')
           obj.setnchannels(1)  # mono
           obj.setsampwidth(2)  # bytes
           obj.setframerate(44100)

           data_max = np.nanmax(abs(sample_array))

           # fill WAV with samples from sample_array
           for sample in sample_array:
               if (np.isnan(sample) or np.isnan(32760 * sample / data_max)) is True:
                   continue
               try:
                   value = int(32760 * sample / data_max)  # normalization INT16
               except ValueError:
                   value = 1
               finally:
                   data = struct.pack('code>

    Do you have an idea how to handle this problem ?

  • Python : How to decode a mp3 chunk from webstream to .wav samples ?

    13 novembre 2019, par Bendzko

    I’m trying to catch chunks of an mp3 webstream and decoding them into wav samples for signal processing. I tried to catch the audio via requests and io.BytesIO to save the data as .wav file.
    I have to convert the mp3 data to wav data, but I don’t know how. (My goal is not to record a .wav file, i am just doing this to test the algorithm.)

    I found the pymedia lib, but it is very old (last commit in 2006), using python 2.7 and for me not installable.

    Maybe it is possible with ffmpeg-python, but I have just seen examples using files as input and output.

    Here’s my code :

    import requests
    import io
    import soundfile as sf
    import struct
    import wave
    import numpy as np


    def main():
       stream_url = r'http://dg-wdr-http-dus-dtag-cdn.cast.addradio.de/wdr/1live/diggi/mp3/128/stream.mp3'
       r = requests.get(stream_url, stream=True)
       sample_array = []
       try:
           for block in r.iter_content(1024):
               data, samplerate = sf.read(io.BytesIO(block), format="RAW", channels=2, samplerate=44100, subtype='FLOAT',
                                          dtype='float32')
               sample_array = np.append(sample_array, data)

       except KeyboardInterrupt:
           print("...saving")
           obj = wave.open('sounds/stream1.wav', 'w')
           obj.setnchannels(1)  # mono
           obj.setsampwidth(2)  # bytes
           obj.setframerate(44100)

           data_max = np.nanmax(abs(sample_array))

           # fill WAV with samples from sample_array
           for sample in sample_array:
               if (np.isnan(sample) or np.isnan(32760 * sample / data_max)) is True:
                   continue
               try:
                   value = int(32760 * sample / data_max)  # normalization INT16
               except ValueError:
                   value = 1
               finally:
                   data = struct.pack('code>

    Do you have an idea how to handle this problem ?

  • Typesetting

    9 juin 2010, par Mikko Koppanen — Imagick, PHP stuff

    Ever had the situation where you have a piece of string which you need to overlay on an image ? Maybe a situation where the area reserved for the string is known in pixels but you need to know the font size to fill most of the area ? Think no more !

    Here is a small example of how to fit a certain piece of a string on to an area of which you know the width and the height or only the width. The magic happens through the ImageMagick CAPTION : format. You can see from the example images how the parameters actually affect the image.

    1. < ?php
    2.  
    3. /* How wide is our image */
    4. $image_width = 200 ;
    5.  
    6. /* Give zero for autocalculating the height */
    7. $image_height = 200 ;
    8.  
    9. /* Specify the text */
    10. $text = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
    11.     Mauris lectus mi, mattis non, euismod vel, sagittis nec, ipsum." ;
    12.  
    13. /* Instanciate imagick */
    14. $im = new Imagick() ;
    15.  
    16. /* Create new image using caption : pseudo format */
    17. $im->newPseudoImage( $image_width, $image_height, "caption :" . $text ) ;
    18.  
    19. /* Put 1px border around the image */
    20. $im->borderImage( ’black’, 1, 1 ) ;
    21.  
    22. /* PNG format */
    23. $im->setImageFormat( "png")  ;
    24.  
    25. /* Output */
    26. header( "Content-Type : image/png" ) ;
    27. echo $im ;
    28.  
    29.  ?>

    Here is image with width 100 and height 0 :

    width_100_height_0.png

    Width 100 Height 50 :

    width_100_height_50.png

    Width 200 Height 200 (as you can see the font size is now larger) :

    width_200_height_200.png