Loading
Hey! This thing is still a Work in Progress. Files, instructions, and other stuff might change!

Wave (Sound) to OpenSCAD Bracelet Converter

by pgreenland, published

Wave (Sound) to OpenSCAD Bracelet Converter by pgreenland Mar 10, 2013

Description

Convert a message recorded in Microsoft Wave format into a 3D printed bracelet / necklace / thing.

Given a wave file the python script included with this thing will digitize it into a series of concentric circles forming a bracelet like design, creating an OpenSCAD script.

The OpenSCAD script may be used to view the waveform arranged as a bracelet design as well as preparing trays of circles ready for printing, all numbers to allow for assembly.

Inspired by: http://www.instructables.com/id/Waveform-Necklace-Bracelet/

Recent Comments

view all

The fully rendered view (when the tray is set to -1) is there to give you an idea of what the assembled item would look like. I wasn't expecting that the majority of printers would be able to produce the object as a single structure in any orientation. Also as as it was designed to become a bracelet I wanted it to be flexible hence the separate discs. The script divides the collection of discs produced to represent the sound wave into trays matching the size of your printer bed, attempting to pack as many into each tray as possible. To print you render each tray as an STL. Slice and print each STL, keeping track of positions as pieces are removed from the printer. Then use the shadowy overlaid text in openscad when rendering each tray to assemble the pieces in the correct order.

I had a go at rendering the complete model (with the tray set to -1). My poor old PC spent a good few hours working on it with corner rounding turned on before I gave up, but only 10 minutes to get a complete exportable and slicable model with corner rounding turned off.

I've made a minor update to the script correcting the ability to disable the rounded corners via command line argument (--no-redge) as the previous argument wasn't working.

It's the corner rounding which causes the rendering process to take a very long time. Unfortunately I haven't found a more efficient solution to this in openscad.

The script also now sorts the discs by their vertical position in the output file. If you were to try rendering the complete object for printing you could try rendering in stages, by setting the tray to -1 and commenting out chunks of the waveform calls. Doing so would require you to re-assemble or somehow stack the STLs in your slicing software. Or re-importing them into openscad, stacking them and exporting the final design.

Thanks a lot Phil for replying. Phil could you help me with something else ? The file generated by your code cant be rendered on openscad. If I change set-tray to any other value from -1 for example 0 or 1, I am able to compile and render but the stl generated looks like the 2nd image you have uploaded but I want the model to look like 1st image itself. Do you print those circles individually and then pass a wire through them ? Cant I get a complete model ?

Hi Anu1122,

Apologies for the slow reply. You shouldn't need to change the python script to use it. The arguments should be passed on the command line. On windows you would open a command prompt, navigate to the directory containing the script and execute "python wave-to-openscad.py". Without providing any arguments the script should generate the following usage text:

usage: wave-to-openscad.py [-h] [-t SAMPLE_TIME] [-rmin CIRCLE_RADIUS_MIN]
                       [-rmax CIRCLE_RADIUS_MAX]
                       [-rhole CIRCLE_HOLE_RADIUS]
                       [-tness CIRCLE_THICKNESS] [-redge ROUND_EDGES]
                       [-bwidth BED_WIDTH] [-blength BED_LENGTH]
                       [-bgap BED_GAP] [-v]
                       input_filename output_filename
wave-to-openscad.py: error: too few arguments

This gives you an idea of the arguments you can provide to control the output of the program. The minimum you need to supply however is an input and output filename. The input being that of the wave file you would like to process and the output being the OpenSCAD file you would like to generate.

For example:

"python wave-to-openscad.py C:\myaudio.wav C:\mydesign.scad"

If you're interested the script parses the arguments you type using python's argparse library which can be seen working on line 13, just after "def main()".

Hope it helps,

Good luck!

Phil

More from Bracelets

view more

Liked By

view all

Give a Shout Out

If you print this Thing and display it in public proudly give attribution by printing and displaying this tag. Print Thing Tag

Instructions

  1. Record a message using you favourite audio editor in Microsoft Wave 16-bit PCM format.
  2. Execute python script passing wave and scad file names.
    python wave-to-openscad.py input.wav output.scad
    Note: Many additional options are available to control aspects of the bracelet generated such as minimum / maximum sizes of circle, the size of the hole in the centre as well as printer bed dimensions for tray layout. Also given a stereo audio file only the left channel will be used.
  3. Load scad file in OpenSCAD, changing set_tray variable from -1 (view) from 0-n (trays) to export and print bracelet components.
  4. Print and assemble using OpenSCAD background numbers as a guide.

I tried going through your python code. But I was unable to figure out exactly where I have to pass the input files and output files as arguments. I tried a few place in the code but it didn't work. Moreover do I need to make further changes in other lines as well? Like pass other arguments in parser.add_arguments. I am new to coding that's why I am having a bit trouble understanding your code. Please help!

Jul 14, 2015 - Modified Jul 14, 2015
pgreenland - in reply to anu1122

Hi Anu1122,

Apologies for the slow reply. You shouldn't need to change the python script to use it. The arguments should be passed on the command line. On windows you would open a command prompt, navigate to the directory containing the script and execute "python wave-to-openscad.py". Without providing any arguments the script should generate the following usage text:

usage: wave-to-openscad.py [-h] [-t SAMPLE_TIME] [-rmin CIRCLE_RADIUS_MIN]
                       [-rmax CIRCLE_RADIUS_MAX]
                       [-rhole CIRCLE_HOLE_RADIUS]
                       [-tness CIRCLE_THICKNESS] [-redge ROUND_EDGES]
                       [-bwidth BED_WIDTH] [-blength BED_LENGTH]
                       [-bgap BED_GAP] [-v]
                       input_filename output_filename
wave-to-openscad.py: error: too few arguments

This gives you an idea of the arguments you can provide to control the output of the program. The minimum you need to supply however is an input and output filename. The input being that of the wave file you would like to process and the output being the OpenSCAD file you would like to generate.

For example:

"python wave-to-openscad.py C:\myaudio.wav C:\mydesign.scad"

If you're interested the script parses the arguments you type using python's argparse library which can be seen working on line 13, just after "def main()".

Hope it helps,

Good luck!

Phil

Thanks a lot Phil for replying. Phil could you help me with something else ? The file generated by your code cant be rendered on openscad. If I change set-tray to any other value from -1 for example 0 or 1, I am able to compile and render but the stl generated looks like the 2nd image you have uploaded but I want the model to look like 1st image itself. Do you print those circles individually and then pass a wire through them ? Cant I get a complete model ?

The fully rendered view (when the tray is set to -1) is there to give you an idea of what the assembled item would look like. I wasn't expecting that the majority of printers would be able to produce the object as a single structure in any orientation. Also as as it was designed to become a bracelet I wanted it to be flexible hence the separate discs. The script divides the collection of discs produced to represent the sound wave into trays matching the size of your printer bed, attempting to pack as many into each tray as possible. To print you render each tray as an STL. Slice and print each STL, keeping track of positions as pieces are removed from the printer. Then use the shadowy overlaid text in openscad when rendering each tray to assemble the pieces in the correct order.

I had a go at rendering the complete model (with the tray set to -1). My poor old PC spent a good few hours working on it with corner rounding turned on before I gave up, but only 10 minutes to get a complete exportable and slicable model with corner rounding turned off.

I've made a minor update to the script correcting the ability to disable the rounded corners via command line argument (--no-redge) as the previous argument wasn't working.

It's the corner rounding which causes the rendering process to take a very long time. Unfortunately I haven't found a more efficient solution to this in openscad.

The script also now sorts the discs by their vertical position in the output file. If you were to try rendering the complete object for printing you could try rendering in stages, by setting the tray to -1 and commenting out chunks of the waveform calls. Doing so would require you to re-assemble or somehow stack the STLs in your slicing software. Or re-importing them into openscad, stacking them and exporting the final design.

Cool, just discovered this coincidentially. I'm the designer of the instructable you were refering to. I will definetely try this out!

It's been a while since I had time to play with my printer, or even look on thingiverse :-( - Upload a pic of a printed one if you have a go, would love to see it. :-)

Now someone needs to invent a player for the prints.

Top