Playing a waveform

aml25's icon

Hi, is it possible to produce a sound from a waveform? As opposed to viewing the waveform of a sound.

brendan mccloskey's icon

send this message to [waveform]: mode draw

that's ONE way

obviously you already know how to set waveform to your own buffer?

aml25's icon

Honestly, I don't know much about Max/MSP, I have only used it a few times for some fairly simple things like adjusting the frequency of an oscillator. So no I don't think I do know how to set waveform to a buffer.

Thanks

aml25's icon

Basically, I want to take a drawing of a square wave, made in AutoCAD or a similar program, (so the "waveform" would be an image), I could generate a list of the distances between each high and low peaks of the wavelength, and then "play" the waveform.

brendan mccloskey's icon
Max Patch
Copy patch and select New From Clipboard in Max.

this should get you started:

brendan mccloskey's icon

oops, almost forgot, also look in Cycling74/examples/utilities/buffer-writer

aml25's icon

this may be a dumb question, but what do I do with that text you sent? The one you said should get me started?

Thanks and I apologize for my lack of Max/MSP understanding.

brendan mccloskey's icon

ok
select and copy all the text including the hyphens at top and bottom, then go Max/File/New From Clipboard; i think that patch, plus the buffer-writer example should get you going. Don't forget to post your solution for everyone else (unlock your patch, select all, go Edit/Copy Compressed and paste it into your post)
Brendan

aml25's icon

So I bring that text in as "New From Clipboard" and then how do I actually use it? It seems to just be a window of text, no objects or anything.

And I will definitely post the patch I come up with if I can ever get it working.

brendan mccloskey's icon

I guess you've made an error, or you don't have the latest version of Max (5); i don't know a way round this, but here's a screenshot of the patch above

378.drawWin.jpg
jpg
aml25's icon

So I recreated this code and got it working fine. Thank you! My only question now is, can I set "myShape" to be an image?

Basically I am drawing waves, both pure and complex in a program and saving them as jpegs, or really any image file, and want to encode them into an audio signal. Would I have to convert the image file to a graph somehow?