Modify Revit Elements With Sound Waves

Hey Guys,

I’m pretty new to Dynamo but this is a different use of it from anything I could find, so I thought I should share.

The basic workflow goes like this:

  1. convert a WAV file to a CSV and save it in excel
  2. Bring the data into Dynamo
  3. Clean up and modify the list a bit
  4. modify elements in Revit, in my example I use a fence

Here’s the whole workflow step by step.
https://www.wholeconstructionsolutions.com/single-post/2017/11/27/Dynamo-Workflow-with-Sound-Waves

1 Like

:+1: An interesting concept, sound based facade design anyone?

2 Likes

What did you use to convert the .WAV to .CSV? I’m looking into SoX and wondering if Dynamo could read the .WAV directly, eliminating the need for a middle man in your example, and perhaps allowing for better/smarter/faster acoustical studies tied into Revit geometry.

Thoughts anyone?

1 Like

Thought Id give it a go, James Brown “I feel good” in Dynamo/Revit.


image

@jacob.small if sound measurements were taken within a space (concert hall) to assess sound fade, intensity etc.I reckon that Dynamo could easily provide a scatter plot of zones of interest.

While I am not involved in any acoustic type studies, if i find some time to experiment I’l let you know. :grinning:

5 Likes

I used a (free) program called Audacity. What is SoX?

1 Like

Hey Ewan, this looks really cool, how did you get that green graph?

Any chance you could share the graph and the sound file?

Sure, NP Sound Wave Fence.dyn (668.1 KB)

Seems like I can’t attach a .CSV file for some reason though. Send me an email at strom@wholeconstructionsolutions.com and I’ll email it to you.

The green model line is from a Nurbs.Curve approximation of the sound max dB peaks.

The scaling of the horizontal length of the Curve (length of the track) was just by eye comparing it to the spectrum in Audacity (@Nolan_WCS :+1:)

I did trim the sample down a bit for testing, so the complete WAV track may carry on a bit from the end of the green line.

I think there would be a simple scaling track length to data sample length to curve length formula that could be done in lieu of a keen eye.

CSV, WAV, DYN - rename extension as stated.

JB_feel_good.wav.(removetxt).txt (23.8 KB)
(D1.3) Soundwave dB peaks.dyn (22.5 KB)
JB_feel_good_dB peaks.(removetxt).csv.txt (97.4 KB)

3 Likes

SoX info can be found here:

http://sox.sourceforge.net/Main/HomePage

For now i’m going to play with the provided csv Ewan posted above. I have ideas and stuff. :rofl:

3 Likes

Full WAV file dB output :wink: Just to show the correlation…


1 Like

Nolan, I am really having a hard time finding a way to convert a .WAV file I have into .CSV? What exactly did you do to accomplish the conversion through Audacity. Is there an easier way?

Direct WAV file to Point Spectrum conversion in Dynamo via python :sunglasses:
(with a little help from Stackoverflow)

(Using the same sound-byte as above, and still feeling good!)

import clr

import sys
sys.path.append('C:\Program Files (x86)\IronPython 2.7\Lib')
import wave
import struct

def read_wav(wave_file):
	wf = wave.open(wave_file)
	frame_data = wf.readframes(-1)
	data = []
	if frame_data:
		sample_width = wf.getsampwidth()
		nb_samples = len(frame_data) // sample_width
		format = {1:"%db", 2:"<%dh", 4:"<%dl"}[sample_width] % nb_samples
		data.append(struct.unpack(format, frame_data))
		return data
	else:
		return ()

wa = IN[0]

OUT = read_wav(wa)
8 Likes

:astonished:

1 Like

I really forget how I made this work! Did you figure it out yet? If not I can take a look.

I’ve got nothing to add here really, but wanted to guide eventual musicians reading this in the future to this little piece of software: https://cycling74.com/

2 Likes

Hello, i know it’s been years but have you been able to convert the wav file to CSV?

Hello, i know it’s been a while since your post but can you tell me how you got the file wav that you used?
(How you trimmed it i mean).
Thanks!

Hi @ihssane22
I use Audacity for my audio editing.
Are you going to implement ‘waveform’ design in a project of yours?