Deprecated: Unparenthesized `a ? b : c ? d : e` is deprecated. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)` in /homepages/33/d411990001/htdocs/spip/ecrire/inc/utils.php on line 2697
Sound Visualizer - Ian’s Web Page

Sound Visualizer

samedi 8 septembre 2012
par  Yann
popularité : 10%

Sound Visualizer avec Blender

Exemple de test de la fonction Bake Sound to F-Curves

Fichier Blend

Version intermédiaire du projet

Fichier Blend

Code source python de la génération de la matrice de barres

import bpy

rows = 5
columns = 5

r = 0
c = 0

def spiral(X, Y):
   x = y = 0
   dx = 0
   dy = -1
   for i in range(max(X, Y)**2):
       if (-X/2 < x <= X/2) and (-Y/2 < y <= Y/2):
           print(x,y)
           bpy.ops.mesh.primitive_cube_add(location = (x, y, 0))
           bpy.context.scene.cursor_location = bpy.context.active_object.location
           bpy.context.scene.cursor_location.z -= 1
           bpy.ops.object.origin_set(type='ORIGIN_CURSOR')    
           ####
           bpy.context.active_object.scale.x = 0.5
           bpy.context.active_object.scale.y = 0.5
           bpy.context.active_object.scale.z = 3.5
           bpy.ops.object.transform_apply(scale=True)
   
           bpy.ops.anim.keyframe_insert_menu(type='Scaling')
           bpy.context.active_object.animation_data.action.fcurves[0].lock = True
           bpy.context.active_object.animation_data.action.fcurves[1].lock = True
           bpy.context.area.type = 'GRAPH_EDITOR'
   
           step = 19000/(rows*columns)
           bpy.ops.graph.sound_bake(filepath="/home/yann/Documents/articles_lpmag/article_blender_soundvisualizer/blend/Grace_Valhalla_-_99__.mp3", low=i*step, high=i*step + step)
   
           bpy.context.active_object.animation_data.action.fcurves[2].lock = True
       
           if x == y or (x < 0 and x == -y) or (x > 0 and x == 1-y):
               dx, dy = -dy, dx
       
           x, y = x+dx, y+dy
       
spiral(rows, columns)

bpy.context.area.type = 'TEXT_EDITOR'

Version finale "light"

Version "plein jour" de l’animation

Fichier Blend

Version finale "dark"

Version "discothèque" de l’animation. les matériaux ont été modifiés au niveau du "Shading -> emitter". Il est aussi possible de placer une "light" au centre de la matrice pour l’illuminer.

Réglage des matériaux

Fichier Blend

Brèves

25 février 2011 - Scilab : Application GUI

Application GUI dans Scilab : Étude des systèmes automatiques. Systèmes Linéaires

9 janvier 2011 - Modèle 3D dans Scilab

Afficher des patchs dans Scilab à partir de Modèle 3D blender. Modèle 3D dans (...)

2 octobre 2010 - Plugins LDraw pour Blender 2.49

Importez vos modèles LEGO (MLCad et autres) dans blender grâce au plugin d’importation (...)